Merge master.
[dcpomatic.git] / src / lib / dcp_video_frame.cc
index 5cd6a118e6256987646734b0a2d47b4187872ac3..d154ba96b074298824da3713de768e892e6e5ed2 100644 (file)
 #include <boost/array.hpp>
 #include <boost/asio.hpp>
 #include <boost/filesystem.hpp>
+#include <boost/lexical_cast.hpp>
 #include <openssl/md5.h>
-#include <libdcp/rec709_linearised_gamma_lut.h>
-#include <libdcp/srgb_linearised_gamma_lut.h>
-#include <libdcp/gamma_lut.h>
-#include <libdcp/xyz_frame.h>
-#include <libdcp/rgb_xyz.h>
-#include <libdcp/colour_matrix.h>
-#include <libdcp/raw_convert.h>
+#include <dcp/gamma_lut.h>
+#include <dcp/xyz_frame.h>
+#include <dcp/rgb_xyz.h>
+#include <dcp/colour_matrix.h>
+#include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 #include "film.h"
 #include "dcp_video_frame.h"
@@ -69,8 +68,9 @@ using std::string;
 using std::stringstream;
 using std::cout;
 using boost::shared_ptr;
-using libdcp::Size;
-using libdcp::raw_convert;
+using boost::lexical_cast;
+using dcp::Size;
+using dcp::raw_convert;
 
 #define DCI_COEFFICENT (48.0 / 52.37)
 
@@ -109,13 +109,10 @@ DCPVideoFrame::DCPVideoFrame (shared_ptr<const PlayerVideoFrame> frame, shared_p
 shared_ptr<EncodedData>
 DCPVideoFrame::encode_locally ()
 {
-       shared_ptr<libdcp::LUT> in_lut;
-       if (_frame->colour_conversion().input_gamma_linearised) {
-               in_lut = libdcp::SRGBLinearisedGammaLUT::cache.get (12, _frame->colour_conversion().input_gamma);
-       } else {
-               in_lut = libdcp::GammaLUT::cache.get (12, _frame->colour_conversion().input_gamma);
-       }
-
+       shared_ptr<dcp::GammaLUT> in_lut = dcp::GammaLUT::cache.get (
+               12, _frame->colour_conversion().input_gamma, _frame->colour_conversion().input_gamma_linearised
+               );
+       
        /* XXX: libdcp should probably use boost */
        
        double matrix[3][3];
@@ -125,10 +122,10 @@ DCPVideoFrame::encode_locally ()
                }
        }
 
-       shared_ptr<libdcp::XYZFrame> xyz = libdcp::rgb_to_xyz (
+       shared_ptr<dcp::XYZFrame> xyz = dcp::rgb_to_xyz (
                _frame->image(),
                in_lut,
-               libdcp::GammaLUT::cache.get (16, 1 / _frame->colour_conversion().output_gamma),
+               dcp::GammaLUT::cache.get (16, 1 / _frame->colour_conversion().output_gamma, false),
                matrix
                );
 
@@ -388,7 +385,7 @@ EncodedData::write (shared_ptr<const Film> film, int frame, Eyes eyes) const
 }
 
 void
-EncodedData::write_info (shared_ptr<const Film> film, int frame, Eyes eyes, libdcp::FrameInfo fin) const
+EncodedData::write_info (shared_ptr<const Film> film, int frame, Eyes eyes, dcp::FrameInfo fin) const
 {
        boost::filesystem::path const info = film->info_path (frame, eyes);
        FILE* h = fopen_boost (info, "w");