projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '2.0' of ssh://main.carlh.net/home/carl/git/dcpomatic into 2.0
[dcpomatic.git]
/
src
/
lib
/
j2k_image_proxy.cc
diff --git
a/src/lib/j2k_image_proxy.cc
b/src/lib/j2k_image_proxy.cc
index 6924fad795bd1ddbdcab067036a96917110560ed..99e4dddab52dd6bbd59d3a10fca166e49d4f1cf7 100644
(file)
--- a/
src/lib/j2k_image_proxy.cc
+++ b/
src/lib/j2k_image_proxy.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014
-2015
Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-17,39
+17,47
@@
*/
*/
-#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
-#include <dcp/mono_picture_frame.h>
-#include <dcp/stereo_picture_frame.h>
#include "j2k_image_proxy.h"
#include "j2k_image_proxy.h"
-#include "
util
.h"
+#include "
dcpomatic_socket
.h"
#include "image.h"
#include "encoded_data.h"
#include "image.h"
#include "encoded_data.h"
+#include <dcp/raw_convert.h>
+#include <dcp/mono_picture_frame.h>
+#include <dcp/stereo_picture_frame.h>
+#include <dcp/colour_conversion.h>
+#include <dcp/rgb_xyz.h>
+#include <libcxml/cxml.h>
#include "i18n.h"
using std::string;
using boost::shared_ptr;
#include "i18n.h"
using std::string;
using boost::shared_ptr;
+using boost::optional;
+
+/** Construct a J2KImageProxy from a JPEG2000 file */
+J2KImageProxy::J2KImageProxy (boost::filesystem::path path, dcp::Size size)
+ : _mono (new dcp::MonoPictureFrame (path))
+ , _size (size)
+{
+
+}
-J2KImageProxy::J2KImageProxy (shared_ptr<const dcp::MonoPictureFrame> frame, dcp::Size size, shared_ptr<Log> log)
- : ImageProxy (log)
- , _mono (frame)
+J2KImageProxy::J2KImageProxy (shared_ptr<const dcp::MonoPictureFrame> frame, dcp::Size size)
+ : _mono (frame)
, _size (size)
{
}
, _size (size)
{
}
-J2KImageProxy::J2KImageProxy (shared_ptr<const dcp::StereoPictureFrame> frame, dcp::Size size, dcp::Eye eye, shared_ptr<Log> log)
- : ImageProxy (log)
- , _stereo (frame)
+J2KImageProxy::J2KImageProxy (shared_ptr<const dcp::StereoPictureFrame> frame, dcp::Size size, dcp::Eye eye)
+ : _stereo (frame)
, _size (size)
, _eye (eye)
{
}
, _size (size)
, _eye (eye)
{
}
-J2KImageProxy::J2KImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket, shared_ptr<Log> log)
- : ImageProxy (log)
+J2KImageProxy::J2KImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> socket)
{
_size = dcp::Size (xml->number_child<int> ("Width"), xml->number_child<int> ("Height"));
if (xml->optional_number_child<int> ("Eye")) {
{
_size = dcp::Size (xml->number_child<int> ("Width"), xml->number_child<int> ("Height"));
if (xml->optional_number_child<int> ("Eye")) {
@@
-69,17
+77,17
@@
J2KImageProxy::J2KImageProxy (shared_ptr<cxml::Node> xml, shared_ptr<Socket> soc
}
shared_ptr<Image>
}
shared_ptr<Image>
-J2KImageProxy::image () const
+J2KImageProxy::image (
optional<dcp::NoteHandler> note
) const
{
{
- shared_ptr<Image> image (new Image (PIX_FMT_RGB
24, _size, fals
e));
+ shared_ptr<Image> image (new Image (PIX_FMT_RGB
48LE, _size, tru
e));
if (_mono) {
if (_mono) {
-
_mono->rgb_frame (image->data()[0]
);
+
dcp::xyz_to_rgb (_mono->xyz_image (), dcp::ColourConversion::xyz_to_srgb(), image->data()[0], image->stride()[0], note
);
} else {
} else {
-
_stereo->rgb_frame (_eye, image->data()[0]
);
+
dcp::xyz_to_rgb (_stereo->xyz_image (_eye.get ()), dcp::ColourConversion::xyz_to_srgb(), image->data()[0], image->stride()[0], note
);
}
}
- return
shared_ptr<Image> (new Image (image, true))
;
+ return
image
;
}
void
}
void
@@
-89,7
+97,7
@@
J2KImageProxy::add_metadata (xmlpp::Node* node) const
node->add_child("Width")->add_child_text (dcp::raw_convert<string> (_size.width));
node->add_child("Height")->add_child_text (dcp::raw_convert<string> (_size.height));
if (_stereo) {
node->add_child("Width")->add_child_text (dcp::raw_convert<string> (_size.width));
node->add_child("Height")->add_child_text (dcp::raw_convert<string> (_size.height));
if (_stereo) {
- node->add_child("Eye")->add_child_text (dcp::raw_convert<string> (_eye));
+ node->add_child("Eye")->add_child_text (dcp::raw_convert<string> (_eye
.get ()
));
node->add_child("LeftSize")->add_child_text (dcp::raw_convert<string> (_stereo->left_j2k_size ()));
node->add_child("RightSize")->add_child_text (dcp::raw_convert<string> (_stereo->right_j2k_size ()));
} else {
node->add_child("LeftSize")->add_child_text (dcp::raw_convert<string> (_stereo->left_j2k_size ()));
node->add_child("RightSize")->add_child_text (dcp::raw_convert<string> (_stereo->right_j2k_size ()));
} else {
@@
-114,7
+122,7
@@
J2KImageProxy::j2k () const
if (_mono) {
return shared_ptr<EncodedData> (new EncodedData (_mono->j2k_data(), _mono->j2k_size()));
} else {
if (_mono) {
return shared_ptr<EncodedData> (new EncodedData (_mono->j2k_data(), _mono->j2k_size()));
} else {
- if (_eye == dcp::EYE_LEFT) {
+ if (_eye
.get()
== dcp::EYE_LEFT) {
return shared_ptr<EncodedData> (new EncodedData (_stereo->left_j2k_data(), _stereo->left_j2k_size()));
} else {
return shared_ptr<EncodedData> (new EncodedData (_stereo->right_j2k_data(), _stereo->right_j2k_size()));
return shared_ptr<EncodedData> (new EncodedData (_stereo->left_j2k_data(), _stereo->left_j2k_size()));
} else {
return shared_ptr<EncodedData> (new EncodedData (_stereo->right_j2k_data(), _stereo->right_j2k_size()));