summaryrefslogtreecommitdiff
path: root/test/colour_conversion_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-05-05 01:11:50 +0200
committerCarl Hetherington <cth@carlh.net>2025-10-14 20:50:53 +0200
commita29d21d854dd37ab17db9b6d28255fd4b52f6017 (patch)
tree01215d937d8b90a6e11b30d1c9b2aef0688ab02e /test/colour_conversion_test.cc
parentfbe4e1ca774fce6608de7ab910b0e346453682b2 (diff)
Add convert_rgb_gamma().3026-mpeg2-colour
Diffstat (limited to 'test/colour_conversion_test.cc')
-rw-r--r--test/colour_conversion_test.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/test/colour_conversion_test.cc b/test/colour_conversion_test.cc
index aff178f5..9f5476b8 100644
--- a/test/colour_conversion_test.cc
+++ b/test/colour_conversion_test.cc
@@ -273,8 +273,8 @@ BOOST_AUTO_TEST_CASE(rgb_xyz_test)
}
-/** Check the piecewise LUT that is used for inverse gamma calculation */
-BOOST_AUTO_TEST_CASE (rgb_xyz_lut_test)
+/** Check the piecewise LUT that is used for inverse J2K gamma calculation */
+BOOST_AUTO_TEST_CASE(inverse_j2k_lut_test)
{
auto conversion = dcp::ColourConversion::rec709_to_dcp();
auto lut = dcp::make_inverse_gamma_lut(conversion.out_j2k(), 4095);
@@ -285,6 +285,18 @@ BOOST_AUTO_TEST_CASE (rgb_xyz_lut_test)
}
+/** Check the piecewise LUT that is used for inverse MPEG2 gamma calculation */
+BOOST_AUTO_TEST_CASE(inverse_mpeg2_lut_test)
+{
+ auto conversion = dcp::ColourConversion::rec709_to_dcp();
+ auto lut = dcp::make_inverse_gamma_lut(conversion.out_mpeg2(), 255);
+
+ for (double x = 0; x < 1; x += 0.000001) {
+ BOOST_CHECK(std::abs(lut.lookup(x) - lrint(pow(x, 1 / 2.4) * 255)) < 2);
+ }
+}
+
+
static list<string> notes;
static void