summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-10-03 21:22:14 +0200
committerCarl Hetherington <cth@carlh.net>2021-10-03 23:41:02 +0200
commit969906f2dd6c5c144781861f53e2a0f6baefb9a3 (patch)
treed4091610b2c0582f52a8d484fd7a36a9c4878111 /src/lib/util.cc
parent70b72b53eab0f247eb4dc605a2d669d4adb4e469 (diff)
Don't scale chroma subsampled images to sizes that don't align with the subsampling (#1872).v2.15.166
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.
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc3
1 files changed, 2 insertions, 1 deletions
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;