2 Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <boost/test/unit_test.hpp>
21 #include "opendcp_lut.h"
22 #include "opendcp_lut.cc"
23 #include "srgb_linearised_gamma_lut.h"
24 #include "rec709_linearised_gamma_lut.h"
25 #include "gamma_lut.h"
27 /* Check that some of our LUTs match the ones from OpenDCP that
28 DVD-o-matic uses / once used.
30 BOOST_AUTO_TEST_CASE (lut_test)
32 libdcp::SRGBLinearisedGammaLUT lut_in_srgb (12, 2.4);
33 for (int i = 0; i < 4096; ++i) {
34 /* Hmm; 1% isn't exactly great... */
35 BOOST_CHECK_CLOSE (opendcp::lut_in[0][i], lut_in_srgb.lut()[i], 1);
38 libdcp::Rec709LinearisedGammaLUT lut_in_rec709 (12, 1 / 0.45);
39 for (int i = 0; i < 4096; ++i) {
40 /* Hmm; 1% isn't exactly great... */
41 BOOST_CHECK_CLOSE (opendcp::lut_in[1][i], lut_in_rec709.lut()[i], 1);
44 libdcp::GammaLUT lut_out (16, 1 / 2.6);
45 for (int i = 0; i < 65536; ++i) {
46 BOOST_CHECK_CLOSE (opendcp::lut_out[0][i], lut_out.lut()[i] * 4096, 1);