Move video level conversion for RGB from FFmpegImageProxy to Image.
[dcpomatic.git] / src / lib / image.cc
index 5b926d77c07feb69e52daeeb44c1655f8b51d2b1..8e6c5717b9064025a1adb03a619731a13835b347 100644 (file)
@@ -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;
 }