summaryrefslogtreecommitdiff
path: root/src/lib/image.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-06-10 23:04:54 +0200
committerCarl Hetherington <cth@carlh.net>2022-06-10 23:04:54 +0200
commit9704833bdfc8c8f104203200be27f714fa677506 (patch)
tree8060672f5ddb4e708f472a8a67f04b9e931ec59e /src/lib/image.cc
parent7fa7b39acdb940d8eafdf8b553525dae7c152084 (diff)
Fix incorrect burnt-in subtitle colours when burning into a DCP source (#2261).
dcp::combined_rgb_to_xyz was changed in libdcp (the values are no longer scaled by 65535) but DoM wasn't changed, and there was no test to catch it.
Diffstat (limited to 'src/lib/image.cc')
-rw-r--r--src/lib/image.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc
index 7b95e6766..f86c105d4 100644
--- a/src/lib/image.cc
+++ b/src/lib/image.cc
@@ -730,14 +730,14 @@ Image::alpha_blend (shared_ptr<const Image> other, Position<int> position)
double const b = lut_in[op[blue]];
/* RGB to XYZ, including Bradford transform and DCI companding */
- double const x = max (0.0, min (65535.0, r * fast_matrix[0] + g * fast_matrix[1] + b * fast_matrix[2]));
- double const y = max (0.0, min (65535.0, r * fast_matrix[3] + g * fast_matrix[4] + b * fast_matrix[5]));
- double const z = max (0.0, min (65535.0, r * fast_matrix[6] + g * fast_matrix[7] + b * fast_matrix[8]));
+ double const x = max(0.0, min(1.0, r * fast_matrix[0] + g * fast_matrix[1] + b * fast_matrix[2]));
+ double const y = max(0.0, min(1.0, r * fast_matrix[3] + g * fast_matrix[4] + b * fast_matrix[5]));
+ double const z = max(0.0, min(1.0, r * fast_matrix[6] + g * fast_matrix[7] + b * fast_matrix[8]));
/* Out gamma LUT and blend */
- tp[0] = lrint(lut_out[lrint(x)] * 65535) * alpha + tp[0] * (1 - alpha);
- tp[1] = lrint(lut_out[lrint(y)] * 65535) * alpha + tp[1] * (1 - alpha);
- tp[2] = lrint(lut_out[lrint(z)] * 65535) * alpha + tp[2] * (1 - alpha);
+ tp[0] = lrint(lut_out[lrint(x * 65535)] * 65535) * alpha + tp[0] * (1 - alpha);
+ tp[1] = lrint(lut_out[lrint(y * 65535)] * 65535) * alpha + tp[1] * (1 - alpha);
+ tp[2] = lrint(lut_out[lrint(z * 65535)] * 65535) * alpha + tp[2] * (1 - alpha);
tp += this_bpp / 2;
op += other_bpp;