summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/colour_conversion.cc29
-rw-r--r--src/lib/colour_conversion.h17
-rw-r--r--src/lib/dcp_video.cc21
-rw-r--r--src/lib/dcp_video.h2
-rw-r--r--src/wx/video_waveform_plot.cc2
5 files changed, 48 insertions, 23 deletions
diff --git a/src/lib/colour_conversion.cc b/src/lib/colour_conversion.cc
index b0c81e91c..da6dca61d 100644
--- a/src/lib/colour_conversion.cc
+++ b/src/lib/colour_conversion.cc
@@ -22,12 +22,15 @@
#include "colour_conversion.h"
#include "config.h"
#include "digester.h"
+#include "player_video.h"
#include "util.h"
#include <dcp/chromaticity.h>
#include <dcp/gamma_transfer_function.h>
#include <dcp/identity_transfer_function.h>
#include <dcp/modified_gamma_transfer_function.h>
+#include <dcp/openjpeg_image.h>
#include <dcp/raw_convert.h>
+#include <dcp/rgb_xyz.h>
#include <dcp/s_gamut3_transfer_function.h>
#include <dcp/warnings.h>
#include <libcxml/cxml.h>
@@ -47,6 +50,9 @@ using std::shared_ptr;
using std::string;
using std::vector;
using boost::optional;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
using dcp::raw_convert;
@@ -305,3 +311,26 @@ PresetColourConversion::from_id (string s)
DCPOMATIC_ASSERT (false);
}
+
+
+shared_ptr<dcp::OpenJPEGImage>
+convert_to_xyz (shared_ptr<const PlayerVideo> frame, dcp::NoteHandler note)
+{
+ shared_ptr<dcp::OpenJPEGImage> xyz;
+
+ auto image = frame->image (bind(&PlayerVideo::keep_xyz_or_rgb, _1), VideoRange::FULL, false);
+ if (frame->colour_conversion()) {
+ xyz = dcp::rgb_to_xyz (
+ image->data()[0],
+ image->size(),
+ image->stride()[0],
+ frame->colour_conversion().get(),
+ note
+ );
+ } else {
+ xyz = make_shared<dcp::OpenJPEGImage>(image->data()[0], image->size(), image->stride()[0]);
+ }
+
+ return xyz;
+}
+
diff --git a/src/lib/colour_conversion.h b/src/lib/colour_conversion.h
index 73b6ad23c..66726f492 100644
--- a/src/lib/colour_conversion.h
+++ b/src/lib/colour_conversion.h
@@ -18,21 +18,34 @@
*/
+
#ifndef DCPOMATIC_COLOUR_CONVERSION_H
#define DCPOMATIC_COLOUR_CONVERSION_H
+
/* Hack for OS X compile failure; see https://bugs.launchpad.net/hugin/+bug/910160 */
#ifdef check
#undef check
#endif
+
#include <dcp/colour_conversion.h>
+#include <dcp/types.h>
#include <libcxml/cxml.h>
+
namespace xmlpp {
class Node;
}
+namespace dcp {
+ class OpenJPEGImage;
+}
+
+
+class PlayerVideo;
+
+
class ColourConversion : public dcp::ColourConversion
{
public:
@@ -77,4 +90,8 @@ bool operator== (ColourConversion const &, ColourConversion const &);
bool operator!= (ColourConversion const &, ColourConversion const &);
bool operator== (PresetColourConversion const &, PresetColourConversion const &);
+
+extern std::shared_ptr<dcp::OpenJPEGImage> convert_to_xyz (std::shared_ptr<const PlayerVideo> frame, dcp::NoteHandler note);
+
+
#endif
diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc
index 50d33e9d5..2cecee95b 100644
--- a/src/lib/dcp_video.cc
+++ b/src/lib/dcp_video.cc
@@ -30,6 +30,7 @@
*/
+#include "colour_conversion.h"
#include "compose.hpp"
#include "config.h"
#include "cross.h"
@@ -100,26 +101,6 @@ DCPVideo::DCPVideo (shared_ptr<const PlayerVideo> frame, shared_ptr<const cxml::
_resolution = Resolution (node->optional_number_child<int>("Resolution").get_value_or(static_cast<int>(Resolution::TWO_K)));
}
-shared_ptr<dcp::OpenJPEGImage>
-DCPVideo::convert_to_xyz (shared_ptr<const PlayerVideo> frame, dcp::NoteHandler note)
-{
- shared_ptr<dcp::OpenJPEGImage> xyz;
-
- auto image = frame->image (bind(&PlayerVideo::keep_xyz_or_rgb, _1), VideoRange::FULL, false);
- if (frame->colour_conversion()) {
- xyz = dcp::rgb_to_xyz (
- image->data()[0],
- image->size(),
- image->stride()[0],
- frame->colour_conversion().get(),
- note
- );
- } else {
- xyz = make_shared<dcp::OpenJPEGImage>(image->data()[0], image->size(), image->stride()[0]);
- }
-
- return xyz;
-}
/** J2K-encode this frame on the local host.
* @return Encoded data.
diff --git a/src/lib/dcp_video.h b/src/lib/dcp_video.h
index 3bd516ccd..14440deb9 100644
--- a/src/lib/dcp_video.h
+++ b/src/lib/dcp_video.h
@@ -59,8 +59,6 @@ public:
bool same (std::shared_ptr<const DCPVideo> other) const;
- static std::shared_ptr<dcp::OpenJPEGImage> convert_to_xyz (std::shared_ptr<const PlayerVideo> frame, dcp::NoteHandler note);
-
private:
void add_metadata (xmlpp::Element *) const;
diff --git a/src/wx/video_waveform_plot.cc b/src/wx/video_waveform_plot.cc
index 8e3284682..7c3e9528f 100644
--- a/src/wx/video_waveform_plot.cc
+++ b/src/wx/video_waveform_plot.cc
@@ -198,7 +198,7 @@ VideoWaveformPlot::set_image (shared_ptr<PlayerVideo> image)
/* We must copy the PlayerVideo here as we will call ::image() on it, potentially
with a different pixel_format than was used when ::prepare() was called.
*/
- _image = DCPVideo::convert_to_xyz (image->shallow_copy(), [](dcp::NoteType, string) {});
+ _image = convert_to_xyz (image->shallow_copy(), [](dcp::NoteType, string) {});
_dirty = true;
Refresh ();
}