From 3eda767ad2e9a3512405802dfa273923acc3cf07 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 23 Dec 2013 23:53:40 +0000 Subject: A couple of potential fixes for 4K. --- src/lib/dcp_video_frame.cc | 9 ++++++--- src/lib/dcp_video_frame.h | 3 ++- src/lib/encoder.cc | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video_frame.cc index 679a0490e..e719d7ef4 100644 --- a/src/lib/dcp_video_frame.cc +++ b/src/lib/dcp_video_frame.cc @@ -79,7 +79,7 @@ using libdcp::Size; * @param l Log to write to. */ DCPVideoFrame::DCPVideoFrame ( - shared_ptr image, int f, Eyes eyes, ColourConversion c, int dcp_fps, int bw, shared_ptr l + shared_ptr image, int f, Eyes eyes, ColourConversion c, int dcp_fps, int bw, Resolution r, shared_ptr 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 image, shared_ptrnode_child ("ColourConversion")); _frames_per_second = node->number_child ("FramesPerSecond"); _j2k_bandwidth = node->number_child ("J2KBandwidth"); + _resolution = Resolution (node->optional_number_child("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 (_frames_per_second)); el->add_child("J2KBandwidth")->add_child_text (lexical_cast (_j2k_bandwidth)); + el->add_child("Resolution")->add_child_text (lexical_cast (int (_resolution))); } EncodedData::EncodedData (int s) diff --git a/src/lib/dcp_video_frame.h b/src/lib/dcp_video_frame.h index c642fb4db..40f758c74 100644 --- a/src/lib/dcp_video_frame.h +++ b/src/lib/dcp_video_frame.h @@ -102,7 +102,7 @@ public: class DCPVideoFrame : public boost::noncopyable { public: - DCPVideoFrame (boost::shared_ptr, int, Eyes, ColourConversion, int, int, boost::shared_ptr); + DCPVideoFrame (boost::shared_ptr, int, Eyes, ColourConversion, int, int, Resolution, boost::shared_ptr); DCPVideoFrame (boost::shared_ptr, boost::shared_ptr, boost::shared_ptr); boost::shared_ptr 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 }; diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index f8a597191..eff38b6a5 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -217,7 +217,7 @@ Encoder::process_video (shared_ptr image, Eyes eyes, ColourConversi _queue.push_back (shared_ptr ( 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() ) )); -- cgit v1.2.3