summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-12-23 23:53:40 +0000
committerCarl Hetherington <cth@carlh.net>2013-12-23 23:53:40 +0000
commit3eda767ad2e9a3512405802dfa273923acc3cf07 (patch)
treeeb81b5f63026309a2793050b663a6e0af5c07bf3 /src/lib
parent2635a4e6617c9fc96c24d9e2259e972525d2929f (diff)
A couple of potential fixes for 4K.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dcp_video_frame.cc9
-rw-r--r--src/lib/dcp_video_frame.h3
-rw-r--r--src/lib/encoder.cc2
3 files changed, 9 insertions, 5 deletions
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<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)
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<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
};
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<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()
)
));