#include "lut.h"
#include "util.h"
#include "gamma_lut.h"
-#include "xyz_srgb_lut.h"
#define DCI_GAMMA 2.6
{
opj_image_t* xyz_frame = decompress_j2k (const_cast<uint8_t*> (_buffer->RoData()), _buffer->Size(), reduce);
assert (xyz_frame->numcomps == 3);
- shared_ptr<ARGBFrame> f = xyz_to_rgb (xyz_frame, GammaLUT::cache.get (12, DCI_GAMMA), XYZsRGBLUT::cache.get (12, srgb_gamma));
+ shared_ptr<ARGBFrame> f = xyz_to_rgb (xyz_frame, GammaLUT::cache.get (12, DCI_GAMMA), GammaLUT::cache.get (12, 1 / srgb_gamma));
opj_image_destroy (xyz_frame);
return f;
}
}
assert (xyz_frame->numcomps == 3);
- shared_ptr<ARGBFrame> f = xyz_to_rgb (xyz_frame, GammaLUT::cache.get (12, DCI_GAMMA), XYZsRGBLUT::cache.get (12, srgb_gamma));
+ shared_ptr<ARGBFrame> f = xyz_to_rgb (xyz_frame, GammaLUT::cache.get (12, DCI_GAMMA), GammaLUT::cache.get (12, 1 / srgb_gamma));
opj_image_destroy (xyz_frame);
return f;
}
#include "types.h"
#include "argb_frame.h"
#include "gamma_lut.h"
-#include "xyz_srgb_lut.h"
using std::string;
using std::stringstream;
* @return RGB image.
*/
shared_ptr<ARGBFrame>
-libdcp::xyz_to_rgb (opj_image_t* xyz_frame, shared_ptr<const GammaLUT> lut_in, shared_ptr<const XYZsRGBLUT> lut_out)
+libdcp::xyz_to_rgb (opj_image_t* xyz_frame, shared_ptr<const GammaLUT> lut_in, shared_ptr<const GammaLUT> lut_out)
{
float const dci_coefficient = 48.0 / 52.37;
- /* sRGB color matrix for XYZ -> RGB */
+ /* sRGB color matrix for XYZ -> RGB. This is the same as the one used by the Fraunhofer
+ EasyDCP player, I think.
+ */
float const colour_matrix[3][3] = {
{ 3.24096989631653, -1.5373831987381, -0.498610764741898 },
d.b = max (d.b, 0.0);
/* Out gamma LUT */
- *argb_line++ = lut_out->lut()[(int) (d.b * max_colour)];
- *argb_line++ = lut_out->lut()[(int) (d.g * max_colour)];
- *argb_line++ = lut_out->lut()[(int) (d.r * max_colour)];
+ *argb_line++ = lut_out->lut()[(int) (d.b * max_colour)] * 0xff;
+ *argb_line++ = lut_out->lut()[(int) (d.g * max_colour)] * 0xff;
+ *argb_line++ = lut_out->lut()[(int) (d.r * max_colour)] * 0xff;
*argb_line++ = 0xff;
}
extern ContentKind content_kind_from_string (std::string kind);
extern bool empty_or_white_space (std::string s);
extern opj_image_t* decompress_j2k (uint8_t* data, int64_t size, int reduce);
-extern boost::shared_ptr<ARGBFrame> xyz_to_rgb (opj_image_t* xyz_frame, boost::shared_ptr<const GammaLUT>, boost::shared_ptr<const XYZsRGBLUT>);
+extern boost::shared_ptr<ARGBFrame> xyz_to_rgb (opj_image_t* xyz_frame, boost::shared_ptr<const GammaLUT>, boost::shared_ptr<const GammaLUT>);
}
util.cc
version.cc
xml.cc
- xyz_srgb_lut.cc
"""
headers = """
+++ /dev/null
-#include <iostream>
-#include <cmath>
-#include "xyz_srgb_lut.h"
-
-using namespace libdcp;
-
-LUTCache<XYZsRGBLUT> XYZsRGBLUT::cache;
-
-XYZsRGBLUT::XYZsRGBLUT(int bits, float gamma)
- : LUT<int> (bits, gamma)
-{
- int const bit_length = pow(2, bits);
-
- for (int i = 0; i < bit_length; ++i) {
- float v = float(i) / (bit_length - 1);
- if (v < (0.04045 / 12.92)) {
- v *= 12.92;
- } else {
- v = (1.055 * pow (v, (1 / gamma))) - 0.055;
- }
-
- _lut[i] = int(v * 255);
- }
-}
+++ /dev/null
-#include "lut.h"
-#include "lut_cache.h"
-
-namespace libdcp {
-
-class XYZsRGBLUT : public LUT<int>
-{
-public:
- XYZsRGBLUT(int colour_depth, float gamma);
- static LUTCache<XYZsRGBLUT> cache;
-};
-
-}