#include <iostream>
#include <iomanip>
#include <boost/filesystem.hpp>
+#include <boost/lexical_cast.hpp>
#include <openssl/sha.h>
#include "KM_util.h"
#include "KM_fileio.h"
#include "types.h"
#include "argb_frame.h"
#include "gamma_lut.h"
-#include "xyz_srgb_lut.h"
using std::string;
using std::stringstream;
using std::min;
using std::max;
using boost::shared_ptr;
+using boost::lexical_cast;
using namespace libdcp;
/** Create a UUID.
if (!image) {
opj_destroy_decompress (decoder);
opj_cio_close (cio);
- boost::throw_exception (DCPReadError ("could not decode JPEG2000 codestream"));
+ boost::throw_exception (DCPReadError ("could not decode JPEG2000 codestream of " + lexical_cast<string> (size) + " bytes."));
}
opj_cio_close (cio);
* @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;
}