X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fimage.cc;h=b473403e42ed50fdfe295815b2ed922aa7f5c76a;hb=b68fb4c103b5580509070c7733d3ae7deb46c3ce;hp=d3b193e7bc99a7d17c5c103489118809a3875d33;hpb=46df210e1c25c3cdae664390efac8e60714ad635;p=dcpomatic.git diff --git a/src/lib/image.cc b/src/lib/image.cc index d3b193e7b..b473403e4 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -129,7 +129,7 @@ Image::planes () const */ shared_ptr Image::crop_scale_window ( - Crop crop, dcp::Size inter_size, dcp::Size out_size, dcp::YUVToRGB yuv_to_rgb, 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, bool out_aligned, bool fast ) const { /* Empirical testing suggests that sws_scale() will crash if @@ -192,15 +192,14 @@ Image::crop_scale_window ( 0 -> destination range MPEG (i.e. "video", 16-235) 1 -> destination range JPEG (i.e. "full", 0-255) - But remember: sws_setColorspaceDetails ignores - these parameters unless the image isYUV or isGray - (if it's neither, it uses video range for source - and destination). + But remember: sws_setColorspaceDetails ignores these + parameters unless the corresponding image isYUV or isGray. + (If it's neither, it uses video range). */ sws_setColorspaceDetails ( scale_context, - sws_getCoefficients (lut[yuv_to_rgb]), 0, - sws_getCoefficients (lut[yuv_to_rgb]), 0, + sws_getCoefficients (lut[yuv_to_rgb]), video_range == VIDEO_RANGE_VIDEO ? 0 : 1, + sws_getCoefficients (lut[yuv_to_rgb]), 1, 0, 1 << 16, 1 << 16 ); @@ -290,10 +289,9 @@ Image::scale (dcp::Size out_size, dcp::YUVToRGB yuv_to_rgb, AVPixelFormat out_fo 0 -> destination range MPEG (i.e. "video", 16-235) 1 -> destination range JPEG (i.e. "full", 0-255) - But remember: sws_setColorspaceDetails ignores - these parameters unless the image isYUV or isGray - (if it's neither, it uses video range for source - and destination). + But remember: sws_setColorspaceDetails ignores these + parameters unless the corresponding image isYUV or isGray. + (If it's neither, it uses video range). */ sws_setColorspaceDetails ( scale_context,