summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-04-29 15:22:55 +0100
committerCarl Hetherington <cth@carlh.net>2013-04-29 15:22:55 +0100
commit5b6d753439207fcb33b84690bcc22d142a7c3bfa (patch)
tree092c65d1e8d83b816cfd37ead57699d729d9f3be /src/util.cc
parent085f9fa7a4e389a5579742f20e142513c21bbd82 (diff)
Change output gamma correction to be closer to EasyDCP behaviour.
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/util.cc b/src/util.cc
index 2fae8561..c66e63f5 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -35,7 +35,6 @@
#include "types.h"
#include "argb_frame.h"
#include "gamma_lut.h"
-#include "xyz_srgb_lut.h"
using std::string;
using std::stringstream;
@@ -203,11 +202,13 @@ libdcp::decompress_j2k (uint8_t* data, int64_t size, int reduce)
* @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 },
@@ -264,9 +265,9 @@ libdcp::xyz_to_rgb (opj_image_t* xyz_frame, shared_ptr<const GammaLUT> lut_in, s
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;
}