X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_video.cc;h=a2668c4a767f60586b9c79bfbc4fd3da4bd1f625;hb=527deef6f18c46badb396e4520d802333997add2;hp=d849866512d4cdc0e983ca42201631fe3fe88d70;hpb=cb1dfa9ec09af2abf6d10e4bf2764476db83841b;p=dcpomatic.git diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc index d84986651..a2668c4a7 100644 --- a/src/lib/dcp_video.cc +++ b/src/lib/dcp_video.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-2015 Carl Hetherington Taken from code Copyright (C) 2010-2011 Terrence Meiczinger This program is free software; you can redistribute it and/or modify @@ -28,6 +28,25 @@ * of images that require encoding. */ +#include "dcp_video.h" +#include "config.h" +#include "exceptions.h" +#include "server.h" +#include "dcpomatic_socket.h" +#include "image.h" +#include "log.h" +#include "cross.h" +#include "player_video.h" +#include "encoded_data.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -38,28 +57,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "film.h" -#include "dcp_video.h" -#include "config.h" -#include "exceptions.h" -#include "server.h" -#include "util.h" -#include "scaler.h" -#include "image.h" -#include "log.h" -#include "cross.h" -#include "player_video.h" -#include "encoded_data.h" #define LOG_GENERAL(...) _log->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL); @@ -109,28 +106,22 @@ DCPVideo::DCPVideo (shared_ptr frame, shared_ptr -DCPVideo::encode_locally () +DCPVideo::encode_locally (dcp::NoteHandler note) { - shared_ptr 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 xyz; + + shared_ptr image = _frame->image (AV_PIX_FMT_RGB48LE, _burn_subtitles, note); + if (_frame->colour_conversion()) { + xyz = dcp::rgb_to_xyz ( + image->data()[0], + image->size(), + image->stride()[0], + _frame->colour_conversion().get() + ); + } else { + xyz = dcp::xyz_to_xyz (image->data()[0], image->size(), image->stride()[0]); } - shared_ptr xyz = dcp::rgb_to_xyz ( - _frame->image (_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) { @@ -315,3 +306,18 @@ DCPVideo::eyes () const return _frame->eyes (); } +/** @return true if this DCPVideo is definitely the same as another; + * (apart from the frame index), false if it is probably not. + */ +bool +DCPVideo::same (shared_ptr other) const +{ + if (_frames_per_second != other->_frames_per_second || + _j2k_bandwidth != other->_j2k_bandwidth || + _resolution != other->_resolution || + _burn_subtitles != other->_burn_subtitles) { + return false; + } + + return _frame->same (other->_frame); +}