diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-04-22 13:58:16 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-04-22 13:58:16 +0100 |
| commit | 86bfdeb77f55b379302a65b22f57fc0583ec6b3c (patch) | |
| tree | 66ed8eb0e4855c520b1b1a0d9dae052a0ad5bfe6 /test/colour_conversion_test.cc | |
| parent | 3c88524c9a2418d6d2d8b8eac29737c95b9a7411 (diff) | |
Express colour conversions as chromaticities and adjust so that
everything is specified as something_to_xyz and then you can get
an inverse LUT if you want one.
Diffstat (limited to 'test/colour_conversion_test.cc')
| -rw-r--r-- | test/colour_conversion_test.cc | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/test/colour_conversion_test.cc b/test/colour_conversion_test.cc index 9111b918..2eb5edf5 100644 --- a/test/colour_conversion_test.cc +++ b/test/colour_conversion_test.cc @@ -28,9 +28,9 @@ using boost::shared_ptr; using namespace dcp; static void -check_gamma (shared_ptr<const TransferFunction> tf, int bit_depth, float gamma) +check_gamma (shared_ptr<const TransferFunction> tf, int bit_depth, bool inverse, float gamma) { - double const * lut = tf->lut (bit_depth); + double const * lut = tf->lut (bit_depth, inverse); int const count = rint (pow (2.0, bit_depth)); for (int i = 0; i < count; ++i) { @@ -39,9 +39,9 @@ check_gamma (shared_ptr<const TransferFunction> tf, int bit_depth, float gamma) } static void -check_modified_gamma (shared_ptr<const TransferFunction> tf, int bit_depth, double power, double threshold, double A, double B) +check_modified_gamma (shared_ptr<const TransferFunction> tf, int bit_depth, bool inverse, double power, double threshold, double A, double B) { - double const * lut = tf->lut (bit_depth); + double const * lut = tf->lut (bit_depth, inverse); int const count = rint (pow (2.0, bit_depth)); for (int i = 0; i < count; ++i) { @@ -58,25 +58,25 @@ BOOST_AUTO_TEST_CASE (colour_conversion_test1) { ColourConversion cc = ColourConversion::srgb_to_xyz (); - check_modified_gamma (cc.in(), 8, 2.4, 0.04045, 0.055, 12.92); - check_modified_gamma (cc.in(), 12, 2.4, 0.04045, 0.055, 12.92); - check_modified_gamma (cc.in(), 16, 2.4, 0.04045, 0.055, 12.92); + check_modified_gamma (cc.in(), 8, false, 2.4, 0.04045, 0.055, 12.92); + check_modified_gamma (cc.in(), 12, false, 2.4, 0.04045, 0.055, 12.92); + check_modified_gamma (cc.in(), 16, false, 2.4, 0.04045, 0.055, 12.92); - check_gamma (cc.out(), 8, 1 / 2.6); - check_gamma (cc.out(), 12, 1 / 2.6); - check_gamma (cc.out(), 16, 1 / 2.6); + check_gamma (cc.out(), 8, true, 1 / 2.6); + check_gamma (cc.out(), 12, true, 1 / 2.6); + check_gamma (cc.out(), 16, true, 1 / 2.6); } BOOST_AUTO_TEST_CASE (colour_conversion_test2) { ColourConversion cc = ColourConversion::rec709_to_xyz (); - check_modified_gamma (cc.in(), 8, 1 / 0.45, 0.081, 0.099, 4.5); - check_modified_gamma (cc.in(), 12, 1 / 0.45, 0.081, 0.099, 4.5); - check_modified_gamma (cc.in(), 16, 1 / 0.45, 0.081, 0.099, 4.5); + check_modified_gamma (cc.in(), 8, false, 1 / 0.45, 0.081, 0.099, 4.5); + check_modified_gamma (cc.in(), 12, false, 1 / 0.45, 0.081, 0.099, 4.5); + check_modified_gamma (cc.in(), 16, false, 1 / 0.45, 0.081, 0.099, 4.5); - check_gamma (cc.out(), 8, 1 / 2.6); - check_gamma (cc.out(), 12, 1 / 2.6); - check_gamma (cc.out(), 16, 1 / 2.6); + check_gamma (cc.out(), 8, true, 1 / 2.6); + check_gamma (cc.out(), 12, true, 1 / 2.6); + check_gamma (cc.out(), 16, true, 1 / 2.6); } |
