diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-11-15 20:47:42 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-11-16 01:40:36 +0100 |
| commit | b057363e69b77119137c0c8b07402828096e03aa (patch) | |
| tree | 3389d557c0cd8626fd574e51cadd5b17ef8b63f8 /src/lib/image.cc | |
| parent | c241da6c6db16ed5d73b2f349d69006cba12cf3f (diff) | |
Make sure we use limited ("video") range data when exporting.
Our export formats all currently use limited range but we weren't
making sure data fed to the encoders was limited range.
Should fix #1832.
Diffstat (limited to 'src/lib/image.cc')
| -rw-r--r-- | src/lib/image.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc index 57c152f13..9dae94f7c 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -122,14 +122,24 @@ Image::planes () const * @param inter_size Size to scale the cropped image to. * @param out_size Size of output frame; if this is larger than inter_size there will be black padding. * @param yuv_to_rgb YUV to RGB transformation to use, if required. + * @param video_range Video range of the image. * @param out_format Output pixel format. * @param out_aligned true to make the output image aligned. + * @param out_video_range Video range to use for the output image. * @param fast Try to be fast at the possible expense of quality; at present this means using * fast bilinear rather than bicubic scaling. */ shared_ptr<Image> Image::crop_scale_window ( - Crop crop, dcp::Size inter_size, dcp::Size out_size, dcp::YUVToRGB yuv_to_rgb, VideoRange video_range, AVPixelFormat out_format, bool out_aligned, bool fast + Crop crop, + dcp::Size inter_size, + dcp::Size out_size, + dcp::YUVToRGB yuv_to_rgb, + VideoRange video_range, + AVPixelFormat out_format, + VideoRange out_video_range, + bool out_aligned, + bool fast ) const { /* Empirical testing suggests that sws_scale() will crash if @@ -171,13 +181,13 @@ Image::crop_scale_window ( 1 -> destination range JPEG (i.e. "full", 0-255) But remember: sws_setColorspaceDetails ignores these - parameters unless the corresponding image isYUV or isGray. - (If it's neither, it uses video range). + parameters unless the both source and destination images + are isYUV or isGray. (If either is not, it uses video range). */ sws_setColorspaceDetails ( scale_context, sws_getCoefficients (lut[yuv_to_rgb]), video_range == VIDEO_RANGE_VIDEO ? 0 : 1, - sws_getCoefficients (lut[yuv_to_rgb]), 1, + sws_getCoefficients (lut[yuv_to_rgb]), out_video_range == VIDEO_RANGE_VIDEO ? 0 : 1, 0, 1 << 16, 1 << 16 ); |
