diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-05-08 23:47:12 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-05-09 00:21:21 +0200 |
| commit | 6de2bb3751b449abf06d44e4dda5e41b66df3f62 (patch) | |
| tree | e163f6b83d3bbf2981e4e727ac067d9eeea47282 /test | |
| parent | ee48fc460c9dc03b89bd7c7ab17fd3ad4560657d (diff) | |
Extract, test and slightly adjust the piecewise LUT for inverse gamma.
Diffstat (limited to 'test')
| -rw-r--r-- | test/rgb_xyz_test.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/rgb_xyz_test.cc b/test/rgb_xyz_test.cc index f64debc4..00787938 100644 --- a/test/rgb_xyz_test.cc +++ b/test/rgb_xyz_test.cc @@ -32,9 +32,10 @@ */ -#include "rgb_xyz.h" -#include "openjpeg_image.h" #include "colour_conversion.h" +#include "openjpeg_image.h" +#include "piecewise_lut.h" +#include "rgb_xyz.h" #include "stream_operators.h" #include <boost/bind.hpp> #include <boost/random.hpp> @@ -149,6 +150,18 @@ 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) +{ + auto conversion = dcp::ColourConversion::rec709_to_xyz(); + auto lut = dcp::make_inverse_gamma_lut(conversion.out()); + + for (double x = 0; x < 1; x += 0.000001) { + BOOST_CHECK(std::abs(lrint(lut.lookup(x) * 4095) - lrint(pow(x, 1 / 2.6) * 4095)) < 2); + } +} + + static list<string> notes; static void |
