diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-08-17 22:21:15 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-08-17 22:21:15 +0100 |
| commit | 5f64a83b76dd015cc03d106061bf890d3d80d788 (patch) | |
| tree | ca26a9e9c94d98d4d6dc5fbf0af71279546c1063 /src | |
| parent | 395b88b4ee3a0739a32af4129b0a47d2f063a937 (diff) | |
Try to actually use colour conversion; bump libdcp in cscript.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/dcp_video_frame.cc | 27 | ||||
| -rw-r--r-- | src/lib/dcp_video_frame.h | 3 | ||||
| -rw-r--r-- | src/lib/encoder.cc | 4 | ||||
| -rw-r--r-- | src/lib/encoder.h | 2 | ||||
| -rw-r--r-- | src/lib/player.cc | 6 | ||||
| -rw-r--r-- | src/lib/player.h | 7 | ||||
| -rw-r--r-- | src/lib/server.cc | 4 | ||||
| -rw-r--r-- | src/lib/transcoder.cc | 6 | ||||
| -rw-r--r-- | src/wx/content_colour_conversion_dialog.cc | 2 | ||||
| -rw-r--r-- | src/wx/preset_colour_conversion_dialog.cc | 2 |
10 files changed, 43 insertions, 20 deletions
diff --git a/src/lib/dcp_video_frame.cc b/src/lib/dcp_video_frame.cc index 1cb20b611..cde9f8a32 100644 --- a/src/lib/dcp_video_frame.cc +++ b/src/lib/dcp_video_frame.cc @@ -77,11 +77,12 @@ using libdcp::Size; * @param l Log to write to. */ DCPVideoFrame::DCPVideoFrame ( - shared_ptr<const Image> image, int f, Eyes eyes, 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, shared_ptr<Log> l ) : _image (image) , _frame (f) , _eyes (eyes) + , _conversion (c) , _frames_per_second (dcp_fps) , _j2k_bandwidth (bw) , _log (l) @@ -95,11 +96,27 @@ DCPVideoFrame::DCPVideoFrame ( shared_ptr<EncodedData> DCPVideoFrame::encode_locally () { + shared_ptr<libdcp::LUT> in_lut; + if (_conversion.input_gamma_linearised) { + in_lut = libdcp::SRGBLinearisedGammaLUT::cache.get (12, _conversion.input_gamma); + } else { + in_lut = libdcp::GammaLUT::cache.get (12, _conversion.input_gamma); + } + + /* XXX: libdcp should probably use boost */ + + double matrix[3][3]; + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 3; ++j) { + matrix[i][j] = _conversion.matrix (i, j); + } + } + shared_ptr<libdcp::XYZFrame> xyz = libdcp::rgb_to_xyz ( _image, - libdcp::SRGBLinearisedGammaLUT::cache.get (12, 2.4), - libdcp::GammaLUT::cache.get (16, 1 / 2.6), - libdcp::colour_matrix::srgb_to_xyz + in_lut, + libdcp::GammaLUT::cache.get (16, 1 / _conversion.output_gamma), + matrix ); /* Set the max image and component sizes based on frame_rate */ @@ -224,6 +241,8 @@ DCPVideoFrame::encode_remotely (ServerDescription serv) socket->connect (*endpoint_iterator); + /* XXX: colour conversion! */ + stringstream s; s << "encode please\n" << "width " << _image->size().width << "\n" diff --git a/src/lib/dcp_video_frame.h b/src/lib/dcp_video_frame.h index ce6444293..9e58b5879 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, int, int, boost::shared_ptr<Log>); + DCPVideoFrame (boost::shared_ptr<const Image>, int, Eyes, ColourConversion, int, int, boost::shared_ptr<Log>); boost::shared_ptr<EncodedData> encode_locally (); boost::shared_ptr<EncodedData> encode_remotely (ServerDescription); @@ -119,6 +119,7 @@ private: boost::shared_ptr<const Image> _image; int _frame; ///< frame index within the DCP's intrinsic duration Eyes _eyes; + ColourConversion _conversion; int _frames_per_second; ///< Frames per second that we will use for the DCP int _j2k_bandwidth; ///< J2K bandwidth to use diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index 29fe64e26..ea175f1f4 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -171,7 +171,7 @@ Encoder::frame_done () } void -Encoder::process_video (shared_ptr<const Image> image, Eyes eyes, bool same) +Encoder::process_video (shared_ptr<const Image> image, Eyes eyes, ColourConversion conversion, bool same) { boost::mutex::scoped_lock lock (_mutex); @@ -205,7 +205,7 @@ Encoder::process_video (shared_ptr<const Image> image, Eyes eyes, bool same) TIMING ("adding to queue of %1", _queue.size ()); _queue.push_back (shared_ptr<DCPVideoFrame> ( new DCPVideoFrame ( - image, _video_frames_out, eyes, _film->video_frame_rate(), + image, _video_frames_out, eyes, conversion, _film->video_frame_rate(), _film->j2k_bandwidth(), _film->log() ) )); diff --git a/src/lib/encoder.h b/src/lib/encoder.h index c0ea30fcb..44134e568 100644 --- a/src/lib/encoder.h +++ b/src/lib/encoder.h @@ -66,7 +66,7 @@ public: * @param i Video frame image. * @param same true if i is the same as the last time we were called. */ - void process_video (boost::shared_ptr<const Image> i, Eyes eyes, bool same); + void process_video (boost::shared_ptr<const Image> i, Eyes eyes, ColourConversion, bool same); /** Call with some audio data */ void process_audio (boost::shared_ptr<const AudioBuffers>); diff --git a/src/lib/player.cc b/src/lib/player.cc index af2e6216a..f8ccb0142 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -276,11 +276,11 @@ Player::process_video (weak_ptr<Piece> weak_piece, shared_ptr<const Image> image _last_video = piece->content; #endif - Video (work_image, eyes, same, time); + Video (work_image, eyes, content->colour_conversion(), same, time); time += TIME_HZ / _film->video_frame_rate(); if (frc.repeat) { - Video (work_image, eyes, true, time); + Video (work_image, eyes, content->colour_conversion(), true, time); time += TIME_HZ / _film->video_frame_rate(); } @@ -549,7 +549,7 @@ Player::emit_black () _last_video.reset (); #endif - Video (_black_frame, EYES_BOTH, _last_emit_was_black, _video_position); + Video (_black_frame, EYES_BOTH, ColourConversion(), _last_emit_was_black, _video_position); _video_position += _film->video_frames_to_time (1); _last_emit_was_black = true; } diff --git a/src/lib/player.h b/src/lib/player.h index 85d750f6f..2261f66ea 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -62,10 +62,11 @@ public: /** Emitted when a video frame is ready. * First parameter is the video image. * Second parameter is the eye(s) that should see this image. - * Third parameter is true if the image is the same as the last one that was emitted. - * Fourth parameter is the time. + * Third parameter is the colour conversion that should be used for this image. + * Fourth parameter is true if the image is the same as the last one that was emitted. + * Fifth parameter is the time. */ - boost::signals2::signal<void (boost::shared_ptr<const Image>, Eyes, bool, Time)> Video; + boost::signals2::signal<void (boost::shared_ptr<const Image>, Eyes, ColourConversion, bool, Time)> Video; /** Emitted when some audio data is ready */ boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>, Time)> Audio; diff --git a/src/lib/server.cc b/src/lib/server.cc index de265dca4..e4c281172 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -112,8 +112,10 @@ Server::process (shared_ptr<Socket> socket) image->read_from_socket (socket); + /* XXX: colour conversion... */ + DCPVideoFrame dcp_video_frame ( - image, frame, eyes, frames_per_second, j2k_bandwidth, _log + image, frame, eyes, ColourConversion(), frames_per_second, j2k_bandwidth, _log ); shared_ptr<EncodedData> encoded = dcp_video_frame.encode_locally (); diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index 3002ef61c..715a158db 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -40,11 +40,11 @@ using boost::weak_ptr; using boost::dynamic_pointer_cast; static void -video_proxy (weak_ptr<Encoder> encoder, shared_ptr<const Image> image, Eyes eyes, bool same) +video_proxy (weak_ptr<Encoder> encoder, shared_ptr<const Image> image, Eyes eyes, ColourConversion conversion, bool same) { shared_ptr<Encoder> e = encoder.lock (); if (e) { - e->process_video (image, eyes, same); + e->process_video (image, eyes, conversion, same); } } @@ -67,7 +67,7 @@ Transcoder::Transcoder (shared_ptr<const Film> f, shared_ptr<Job> j) , _player (f->make_player ()) , _encoder (new Encoder (f, j)) { - _player->Video.connect (bind (video_proxy, _encoder, _1, _2, _3)); + _player->Video.connect (bind (video_proxy, _encoder, _1, _2, _3, _4)); _player->Audio.connect (bind (audio_proxy, _encoder, _1)); } diff --git a/src/wx/content_colour_conversion_dialog.cc b/src/wx/content_colour_conversion_dialog.cc index 8fca090ad..d8e768bcd 100644 --- a/src/wx/content_colour_conversion_dialog.cc +++ b/src/wx/content_colour_conversion_dialog.cc @@ -44,7 +44,7 @@ ContentColourConversionDialog::ContentColourConversionDialog (wxWindow* parent) table->Add (_preset_choice); overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); - overall_sizer->Add (new wxStaticLine (this, wxID_ANY)); + overall_sizer->Add (new wxStaticLine (this, wxID_ANY), 0, wxEXPAND); overall_sizer->Add (_editor); wxSizer* buttons = CreateSeparatedButtonSizer (wxOK); diff --git a/src/wx/preset_colour_conversion_dialog.cc b/src/wx/preset_colour_conversion_dialog.cc index 8c4a6dbcf..e7f8cf049 100644 --- a/src/wx/preset_colour_conversion_dialog.cc +++ b/src/wx/preset_colour_conversion_dialog.cc @@ -39,7 +39,7 @@ PresetColourConversionDialog::PresetColourConversionDialog (wxWindow* parent) table->Add (_name); overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); - overall_sizer->Add (new wxStaticLine (this, wxID_ANY)); + overall_sizer->Add (new wxStaticLine (this, wxID_ANY), 0, wxEXPAND); overall_sizer->Add (_editor); wxSizer* buttons = CreateSeparatedButtonSizer (wxOK); |
