summaryrefslogtreecommitdiff
path: root/src/lib/image.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-05-25 00:57:16 +0200
committerCarl Hetherington <cth@carlh.net>2021-05-25 21:35:12 +0200
commit62f9b78a2eb5f0fc6b9028264bac6ad501d83309 (patch)
treea187c6385350318f7d96090d09712106ac08ed19 /src/lib/image.cc
parent5d9ff746138a30c1469b788afe5a4eee25fed368 (diff)
Move video level conversion for RGB from FFmpegImageProxy to Image.
Since FFmpeg does not do video level conversion for RGB sources when we (sort of) ask it to in Image::crop_scale_window() it seems to make more sense to compensate for that by calling full_to_video_range() in the same place (rather than in FFmpegImageProxy).
Diffstat (limited to 'src/lib/image.cc')
-rw-r--r--src/lib/image.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc
index 5b926d77c..8e6c5717b 100644
--- a/src/lib/image.cc
+++ b/src/lib/image.cc
@@ -297,6 +297,15 @@ Image::crop_scale_window (
out->make_part_black (corner.x + cropped_size.width, out_size.width - cropped_size.width);
}
+ if (
+ video_range == VideoRange::VIDEO &&
+ out_video_range == VideoRange::FULL &&
+ av_pix_fmt_desc_get(_pixel_format)->flags & AV_PIX_FMT_FLAG_RGB
+ ) {
+ /* libswscale will not convert video range for RGB sources, so we have to do it ourselves */
+ out->video_range_to_full_range ();
+ }
+
return out;
}