A couple of potential fixes for 4K.
authorCarl Hetherington <cth@carlh.net>
Mon, 23 Dec 2013 23:53:40 +0000 (23:53 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 23 Dec 2013 23:53:40 +0000 (23:53 +0000)
ChangeLog
src/lib/dcp_video_frame.cc
src/lib/dcp_video_frame.h
src/lib/encoder.cc
src/tools/server_test.cc
test/client_server_test.cc

index b8e5e5245f31a6ee7669f528e3c5942ac3e24cd4..c2b20c67a4185f067a2e4713c62ef9623720acc8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2013-12-23  Carl Hetherington  <cth@carlh.net>
 
+       * A couple of potential fixes for 4K.
+
        * Version 1.50 released.
 
 2013-12-23  Carl Hetherington  <cth@carlh.net>
index 679a0490e8850955a782e76a0ccd387c96254ba4..e719d7ef4f4be87d205796a1d03d521c968722f8 100644 (file)
@@ -79,7 +79,7 @@ using libdcp::Size;
  *  @param l Log to write to.
  */
 DCPVideoFrame::DCPVideoFrame (
-       shared_ptr<const Image> image, int f, Eyes eyes, ColourConversion c, int dcp_fps, int bw, shared_ptr<Log> l
+       shared_ptr<const Image> image, int f, Eyes eyes, ColourConversion c, int dcp_fps, int bw, Resolution r, shared_ptr<Log> l
        )
        : _image (image)
        , _frame (f)
@@ -87,6 +87,7 @@ DCPVideoFrame::DCPVideoFrame (
        , _conversion (c)
        , _frames_per_second (dcp_fps)
        , _j2k_bandwidth (bw)
+       , _resolution (r)
        , _log (l)
 {
        
@@ -110,6 +111,7 @@ DCPVideoFrame::DCPVideoFrame (shared_ptr<const Image> image, shared_ptr<const cx
        _conversion = ColourConversion (node->node_child ("ColourConversion"));
        _frames_per_second = node->number_child<int> ("FramesPerSecond");
        _j2k_bandwidth = node->number_child<int> ("J2KBandwidth");
+       _resolution = Resolution (node->optional_number_child<int>("J2KBandwidth").get_value_or (RESOLUTION_2K));
 }
 
 /** J2K-encode this frame on the local host.
@@ -194,9 +196,9 @@ DCPVideoFrame::encode_locally ()
        parameters.tcp_rates[0] = 0;
        parameters.tcp_numlayers++;
        parameters.cp_disto_alloc = 1;
-       parameters.cp_rsiz = CINEMA2K;
+       parameters.cp_rsiz = _resolution == RESOLUTION_2K ? CINEMA2K : CINEMA4K;
        parameters.cp_comment = strdup (N_("DCP-o-matic"));
-       parameters.cp_cinema = CINEMA2K_24;
+       parameters.cp_cinema = _resolution == RESOLUTION_2K ? CINEMA2K_24 : CINEMA4K_24;
 
        /* 3 components, so use MCT */
        parameters.tcp_mct = 1;
@@ -317,6 +319,7 @@ DCPVideoFrame::add_metadata (xmlpp::Element* el) const
 
        el->add_child("FramesPerSecond")->add_child_text (lexical_cast<string> (_frames_per_second));
        el->add_child("J2KBandwidth")->add_child_text (lexical_cast<string> (_j2k_bandwidth));
+       el->add_child("Resolution")->add_child_text (lexical_cast<string> (int (_resolution)));
 }
 
 EncodedData::EncodedData (int s)
index c642fb4db842446ea5a03421d7e9104ce8f1b491..40f758c7423ab855e07ac3991984bfa559eeef1d 100644 (file)
@@ -102,7 +102,7 @@ public:
 class DCPVideoFrame : public boost::noncopyable
 {
 public:
-       DCPVideoFrame (boost::shared_ptr<const Image>, int, Eyes, ColourConversion, int, int, boost::shared_ptr<Log>);
+       DCPVideoFrame (boost::shared_ptr<const Image>, int, Eyes, ColourConversion, int, int, Resolution, boost::shared_ptr<Log>);
        DCPVideoFrame (boost::shared_ptr<const Image>, boost::shared_ptr<const cxml::Node>, boost::shared_ptr<Log>);
 
        boost::shared_ptr<EncodedData> encode_locally ();
@@ -126,6 +126,7 @@ private:
        ColourConversion _conversion;
        int _frames_per_second;          ///< Frames per second that we will use for the DCP
        int _j2k_bandwidth;              ///< J2K bandwidth to use
+       Resolution _resolution;          ///< Resolution (2K or 4K)
 
        boost::shared_ptr<Log> _log; ///< log
 };
index f8a5971911278b96eb5332691c23f52de7aca2f3..eff38b6a57840ddbd3a3e3dcc9194f440f5503af 100644 (file)
@@ -217,7 +217,7 @@ Encoder::process_video (shared_ptr<PlayerImage> image, Eyes eyes, ColourConversi
                _queue.push_back (shared_ptr<DCPVideoFrame> (
                                          new DCPVideoFrame (
                                                  image->image(), _video_frames_out, eyes, conversion, _film->video_frame_rate(),
-                                                 _film->j2k_bandwidth(), _film->log()
+                                                 _film->j2k_bandwidth(), _film->resolution(), _film->log()
                                                  )
                                          ));
                
index f0a44954ff2ee2ed88d9dcaef2de1044a7f42f09..b2c5e784ba8caf2346c08b903c5a81dec8d8e296 100644 (file)
@@ -49,8 +49,8 @@ static int frame = 0;
 void
 process_video (shared_ptr<PlayerImage> image, Eyes eyes, ColourConversion conversion, Time)
 {
-       shared_ptr<DCPVideoFrame> local  (new DCPVideoFrame (image->image(), frame, eyes, conversion, film->video_frame_rate(), 250000000, log_));
-       shared_ptr<DCPVideoFrame> remote (new DCPVideoFrame (image->image(), frame, eyes, conversion, film->video_frame_rate(), 250000000, log_));
+       shared_ptr<DCPVideoFrame> local  (new DCPVideoFrame (image->image(), frame, eyes, conversion, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_));
+       shared_ptr<DCPVideoFrame> remote (new DCPVideoFrame (image->image(), frame, eyes, conversion, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_));
 
        cout << "Frame " << frame << ": ";
        cout.flush ();
index 91b482f4f849ba37558695d9772609fa596fff06..1ad156ae38f98495ce3a23e58e71ce3da6c18369 100644 (file)
@@ -79,6 +79,7 @@ BOOST_AUTO_TEST_CASE (client_server_test)
                        ColourConversion (),
                        24,
                        200000000,
+                       RESOLUTION_2K,
                        log
                        )
                );