--- /dev/null
+/*
+ Taken from OpenDCP: Builds Digital Cinema Packages
+ Copyright (c) 2010-2011 Terrence Meiczinger, All Rights Reserved
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "colour_matrices.h"
+
+/* Color Matrices */
+float color_matrix[3][3][3] = {
+ /* SRGB */
+ {{0.4124564, 0.3575761, 0.1804375},
+ {0.2126729, 0.7151522, 0.0721750},
+ {0.0193339, 0.1191920, 0.9503041}},
+
+ /* REC.709 */
+ {{0.4124564, 0.3575761, 0.1804375},
+ {0.2126729, 0.7151522, 0.0721750},
+ {0.0193339, 0.1191920, 0.9503041}},
+
+ /* DC28.30 (2006-02-24) */
+ {{0.4451698156, 0.2771344092, 0.1722826698},
+ {0.2094916779, 0.7215952542, 0.0689130679},
+ {0.0000000000, 0.0470605601, 0.9073553944}}
+};
--- /dev/null
+/*
+ Taken from OpenDCP: Builds Digital Cinema Packages
+ Copyright (c) 2010-2011 Terrence Meiczinger, All Rights Reserved
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+enum COLOR_PROFILE_ENUM {
+ CP_SRGB = 0,
+ CP_REC709,
+ CP_DC28,
+ CP_MAX
+};
+
+extern float color_matrix[3][3][3];
#include <boost/asio.hpp>
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
+#include <libdcp/rec709_linearised_gamma_lut.h>
+#include <libdcp/srgb_linearised_gamma_lut.h>
+#include <libdcp/gamma_lut.h>
#include "film.h"
#include "dcp_video_frame.h"
-#include "lut.h"
#include "config.h"
#include "exceptions.h"
#include "server.h"
#include "scaler.h"
#include "image.h"
#include "log.h"
+#include "colour_matrices.h"
#include "i18n.h"
using boost::shared_ptr;
using libdcp::Size;
+#define DCI_COEFFICENT (48.0 / 52.37)
+
/** Construct a DCP video frame.
* @param input Input image.
* @param f Index of the frame within the DCP.
double x, y, z;
} d;
+ /* In sRGB / Rec709 gamma LUT */
+ shared_ptr<libdcp::LUT<float> > lut_in;
+ if (_colour_lut == 0) {
+ lut_in = libdcp::SRGBLinearisedGammaLUT::cache.get (12, 2.4);
+ } else {
+ lut_in = libdcp::Rec709LinearisedGammaLUT::cache.get (12, 1 / 0.45);
+ }
+
+ /* Out DCI gamma LUT */
+ shared_ptr<libdcp::LUT<float> > lut_out = libdcp::GammaLUT::cache.get (16, 1 / 2.6);
+
/* Copy our RGB into the openjpeg container, converting to XYZ in the process */
int jn = 0;
for (int x = 0; x < _image->size().width; ++x) {
/* In gamma LUT (converting 8-bit input to 12-bit) */
- s.r = lut_in[_colour_lut][*p++ << 4];
- s.g = lut_in[_colour_lut][*p++ << 4];
- s.b = lut_in[_colour_lut][*p++ << 4];
+ s.r = lut_in->lut()[*p++ << 4];
+ s.g = lut_in->lut()[*p++ << 4];
+ s.b = lut_in->lut()[*p++ << 4];
/* RGB to XYZ Matrix */
d.x = ((s.r * color_matrix[_colour_lut][0][0]) +
(s.b * color_matrix[_colour_lut][2][2]));
/* DCI companding */
- d.x = d.x * DCI_COEFFICENT * (DCI_LUT_SIZE - 1);
- d.y = d.y * DCI_COEFFICENT * (DCI_LUT_SIZE - 1);
- d.z = d.z * DCI_COEFFICENT * (DCI_LUT_SIZE - 1);
+ d.x = d.x * DCI_COEFFICENT * 65535;
+ d.y = d.y * DCI_COEFFICENT * 65535;
+ d.z = d.z * DCI_COEFFICENT * 65535;
/* Out gamma LUT */
- _opj_image->comps[0].data[jn] = lut_out[LO_DCI][(int) d.x];
- _opj_image->comps[1].data[jn] = lut_out[LO_DCI][(int) d.y];
- _opj_image->comps[2].data[jn] = lut_out[LO_DCI][(int) d.z];
+ _opj_image->comps[0].data[jn] = lut_out->lut()[(int) d.x] * 4096;
+ _opj_image->comps[1].data[jn] = lut_out->lut()[(int) d.y] * 4096;
+ _opj_image->comps[2].data[jn] = lut_out->lut()[(int) d.z] * 4096;
++jn;
}
+++ /dev/null
-/*
- Taken from OpenDCP: Builds Digital Cinema Packages
- Copyright (c) 2010-2011 Terrence Meiczinger, All Rights Reserved
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/** @file src/lut.h
- * @brief Look-up tables for colour conversions (from OpenDCP)
- */
-
-#define BIT_DEPTH 12
-#define BIT_PRECISION 16
-#define COLOR_DEPTH (4095)
-#define DCI_LUT_SIZE ((COLOR_DEPTH + 1) * BIT_PRECISION)
-#define DCI_GAMMA (2.6)
-#define DCI_DEGAMMA (1/DCI_GAMMA)
-#define DCI_COEFFICENT (48.0/52.37)
-
-enum COLOR_PROFILE_ENUM {
- CP_SRGB = 0,
- CP_REC709,
- CP_DC28,
- CP_MAX
-};
-
-enum LUT_IN_ENUM {
- LI_SRGB = 0,
- LI_REC709,
- LI_MAX
-};
-
-enum LUT_OUT_ENUM {
- LO_DCI = 0,
- LO_MAX
-};
-
-extern float color_matrix[3][3][3];
-extern float lut_in[LI_MAX][4095+1];
-extern int lut_out[1][DCI_LUT_SIZE];
audio_content.cc
audio_decoder.cc
audio_mapping.cc
+ colour_matrices.cc
config.cc
content.cc
cross.cc
job.cc
job_manager.cc
log.cc
- lut.cc
player.cc
playlist.cc
ratio.cc