diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-10-25 14:47:43 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-10-25 14:47:43 +0100 |
| commit | b6c780d3107557d452c6612d715d01e2be52dbda (patch) | |
| tree | 3548fe3eef61f3b0145bb33a57a89f97bfa75f50 /src/lib/dcp_video.cc | |
| parent | e725a6b4bce2a05275ee611965c62d6803f3bf7c (diff) | |
| parent | 0dcbc398124f740e4fd7b552926f601a3e5c755e (diff) | |
Merge master.
Diffstat (limited to 'src/lib/dcp_video.cc')
| -rw-r--r-- | src/lib/dcp_video.cc | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc index f6c671fd1..cacba190f 100644 --- a/src/lib/dcp_video.cc +++ b/src/lib/dcp_video.cc @@ -111,26 +111,33 @@ DCPVideo::DCPVideo (shared_ptr<const PlayerVideo> frame, shared_ptr<const cxml:: shared_ptr<EncodedData> DCPVideo::encode_locally () { - 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]; - for (int i = 0; i < 3; ++i) { - for (int j = 0; j < 3; ++j) { - matrix[i][j] = _frame->colour_conversion().matrix (i, j); + shared_ptr<dcp::XYZFrame> xyz; + + if (_frame->colour_conversion()) { + ColourConversion conversion = _frame->colour_conversion().get (); + shared_ptr<dcp::GammaLUT> in_lut = dcp::GammaLUT::cache.get ( + 12, conversion.input_gamma, conversion.input_gamma_linearised + ); + + /* XXX: dcp 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); + } } + + xyz = dcp::rgb_to_xyz ( + _frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles), + in_lut, + dcp::GammaLUT::cache.get (16, 1 / conversion.output_gamma, false), + matrix + ); + } else { + xyz = dcp::xyz_to_xyz (_frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles)); } - shared_ptr<dcp::XYZFrame> xyz = dcp::rgb_to_xyz ( - _frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles), - in_lut, - dcp::GammaLUT::cache.get (16, 1 / _frame->colour_conversion().output_gamma, false), - matrix - ); - /* Set the max image and component sizes based on frame_rate */ int max_cs_len = ((float) _j2k_bandwidth) / 8 / _frames_per_second; if (_frame->eyes() == EYES_LEFT || _frame->eyes() == EYES_RIGHT) { |
