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 "opendcp_lut.h"
21 #include "opendcp_lut.cc"
22 #include "srgb_linearised_gamma_lut.h"
23 #include "rec709_linearised_gamma_lut.h"
24 #include "gamma_lut.h"
26 /* Check that some of our LUTs match the ones from OpenDCP that
27 DVD-o-matic uses / once used.
29 BOOST_AUTO_TEST_CASE (lut_test)
31 libdcp::SRGBLinearisedGammaLUT lut_in_srgb (12, 2.4);
32 for (int i = 0; i < 4096; ++i) {
33 /* Hmm; 1% isn't exactly great... */
34 BOOST_CHECK_CLOSE (opendcp::lut_in[0][i], lut_in_srgb.lut()[i], 1);
37 libdcp::Rec709LinearisedGammaLUT lut_in_rec709 (12, 1 / 0.45);
38 for (int i = 0; i < 4096; ++i) {
39 /* Hmm; 1% isn't exactly great... */
40 BOOST_CHECK_CLOSE (opendcp::lut_in[1][i], lut_in_rec709.lut()[i], 1);
43 libdcp::GammaLUT lut_out (16, 1 / 2.6);
44 for (int i = 0; i < 65536; ++i) {
45 BOOST_CHECK_CLOSE (opendcp::lut_out[0][i], lut_out.lut()[i] * 4096, 1);