From 969906f2dd6c5c144781861f53e2a0f6baefb9a3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 3 Oct 2021 21:22:14 +0200 Subject: Don't scale chroma subsampled images to sizes that don't align with the subsampling (#1872). There's a slightly odd effect when scaling e.g. YVU420 images to odd and then even widths - there's a small but visible luminance shift. I don't know why this happens, but keeping the scaling sizes locked to the subsampling seems to help. --- src/lib/util.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib/util.cc') diff --git a/src/lib/util.cc b/src/lib/util.cc index d3af74376..78ed8da99 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -1111,7 +1111,7 @@ linear_to_db (double linear) dcp::Size -scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container) +scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta) { /* Now scale it down if the display container is smaller than the film container */ if (display_container != film_container) { @@ -1122,6 +1122,7 @@ scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_cont s.width = lrintf (s.width * scale); s.height = lrintf (s.height * scale); + s = quanta.round (s); } return s; -- cgit v1.2.3