summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-06-10 15:05:48 +0100
committerCarl Hetherington <cth@carlh.net>2015-06-10 15:05:48 +0100
commit41ab9a3ad26bb2fd17eca4d99780c46e315c393a (patch)
tree67561be4fe87b1e2dd3ae56664baa8c3a033e2aa /src
parentda2cb0bddaaca815440a06884cf3364050e03a0e (diff)
Rename XYZImage -> OpenJPEGImage.
Diffstat (limited to 'src')
-rw-r--r--src/mono_picture_frame.cc2
-rw-r--r--src/mono_picture_frame.h4
-rw-r--r--src/openjpeg_image.cc (renamed from src/xyz_image.cc)22
-rw-r--r--src/openjpeg_image.h (renamed from src/xyz_image.h)18
-rw-r--r--src/picture_asset.cc6
-rw-r--r--src/rgb_xyz.cc14
-rw-r--r--src/rgb_xyz.h10
-rw-r--r--src/stereo_picture_frame.cc4
-rw-r--r--src/stereo_picture_frame.h4
-rw-r--r--src/util.cc8
-rw-r--r--src/util.h4
-rw-r--r--src/wscript4
12 files changed, 49 insertions, 51 deletions
diff --git a/src/mono_picture_frame.cc b/src/mono_picture_frame.cc
index 1237fd90..fe35b6a9 100644
--- a/src/mono_picture_frame.cc
+++ b/src/mono_picture_frame.cc
@@ -112,7 +112,7 @@ MonoPictureFrame::j2k_size () const
* of the image, expressed as a power of two (pass 0 for no
* reduction).
*/
-shared_ptr<XYZImage>
+shared_ptr<OpenJPEGImage>
MonoPictureFrame::xyz_image (int reduce) const
{
return decompress_j2k (const_cast<uint8_t*> (_buffer->RoData()), _buffer->Size(), reduce);
diff --git a/src/mono_picture_frame.h b/src/mono_picture_frame.h
index d4853d52..68e4edf8 100644
--- a/src/mono_picture_frame.h
+++ b/src/mono_picture_frame.h
@@ -38,7 +38,7 @@ namespace ASDCP {
namespace dcp {
-class XYZImage;
+class OpenJPEGImage;
/** @class MonoPictureFrame
* @brief A single frame of a 2D (monoscopic) picture asset.
@@ -51,7 +51,7 @@ public:
MonoPictureFrame ();
~MonoPictureFrame ();
- boost::shared_ptr<XYZImage> xyz_image (int reduce = 0) const;
+ boost::shared_ptr<OpenJPEGImage> xyz_image (int reduce = 0) const;
uint8_t const * j2k_data () const;
uint8_t* j2k_data ();
diff --git a/src/xyz_image.cc b/src/openjpeg_image.cc
index 3183df33..d8bb0fcb 100644
--- a/src/xyz_image.cc
+++ b/src/openjpeg_image.cc
@@ -17,27 +17,27 @@
*/
-/** @file src/xyz_image.cc
- * @brief XYZImage class.
+/** @file src/openjpeg_image.cc
+ * @brief OpenJPEGImage class.
*/
-#include "xyz_image.h"
+#include "openjpeg_image.h"
#include "dcp_assert.h"
#include <stdexcept>
using namespace dcp;
-/** Construct an XYZImage, taking ownership of the opj_image_t */
-XYZImage::XYZImage (opj_image_t* image)
+/** Construct an OpenJPEGImage, taking ownership of the opj_image_t */
+OpenJPEGImage::OpenJPEGImage (opj_image_t* image)
: _opj_image (image)
{
DCP_ASSERT (_opj_image->numcomps == 3);
}
-/** Construct a new XYZImage with undefined contents.
+/** Construct a new OpenJPEGImage with undefined contents.
* @param size Size for the frame in pixels.
*/
-XYZImage::XYZImage (Size size)
+OpenJPEGImage::OpenJPEGImage (Size size)
{
opj_image_cmptparm_t cmptparm[3];
@@ -65,8 +65,8 @@ XYZImage::XYZImage (Size size)
_opj_image->y1 = size.height;
}
-/** XYZImage destructor */
-XYZImage::~XYZImage ()
+/** OpenJPEGImage destructor */
+OpenJPEGImage::~OpenJPEGImage ()
{
opj_image_destroy (_opj_image);
}
@@ -75,7 +75,7 @@ XYZImage::~XYZImage ()
* @return Pointer to the data for component c.
*/
int *
-XYZImage::data (int c) const
+OpenJPEGImage::data (int c) const
{
DCP_ASSERT (c >= 0 && c < 3);
return _opj_image->comps[c].data;
@@ -83,7 +83,7 @@ XYZImage::data (int c) const
/** @return Size of the image in pixels */
dcp::Size
-XYZImage::size () const
+OpenJPEGImage::size () const
{
/* XXX: this may not be right; x0 and y0 can presumably be non-zero */
return dcp::Size (_opj_image->x1, _opj_image->y1);
diff --git a/src/xyz_image.h b/src/openjpeg_image.h
index 6be065e0..9d6615a2 100644
--- a/src/xyz_image.h
+++ b/src/openjpeg_image.h
@@ -17,8 +17,8 @@
*/
-/** @file src/xyz_image.h
- * @brief XYZImage class.
+/** @file src/openjpeg_image.h
+ * @brief OpenJPEGImage class.
*/
#include "util.h"
@@ -26,17 +26,15 @@
namespace dcp {
-/** @class XYZImage
- * @brief An image in XYZ colour.
- *
- * This class is a thin wrapper of libopenjpeg's opj_image_t.
+/** @class OpenJPEGImage
+ * @brief A wrapper of libopenjpeg's opj_image_t.
*/
-class XYZImage : public boost::noncopyable
+class OpenJPEGImage : public boost::noncopyable
{
public:
- XYZImage (opj_image_t *);
- XYZImage (Size);
- ~XYZImage ();
+ OpenJPEGImage (opj_image_t *);
+ OpenJPEGImage (Size);
+ ~OpenJPEGImage ();
int* data (int) const;
dcp::Size size () const;
diff --git a/src/picture_asset.cc b/src/picture_asset.cc
index ef3ff1f4..e9eff5b0 100644
--- a/src/picture_asset.cc
+++ b/src/picture_asset.cc
@@ -20,7 +20,7 @@
#include "picture_asset.h"
#include "util.h"
#include "exceptions.h"
-#include "xyz_image.h"
+#include "openjpeg_image.h"
#include "picture_asset_writer.h"
#include "dcp_assert.h"
#include "compose.hpp"
@@ -127,8 +127,8 @@ PictureAsset::frame_buffer_equals (
}
/* Decompress the images to bitmaps */
- shared_ptr<XYZImage> image_A = decompress_j2k (const_cast<uint8_t*> (data_A), size_A, 0);
- shared_ptr<XYZImage> image_B = decompress_j2k (const_cast<uint8_t*> (data_B), size_B, 0);
+ shared_ptr<OpenJPEGImage> image_A = decompress_j2k (const_cast<uint8_t*> (data_A), size_A, 0);
+ shared_ptr<OpenJPEGImage> image_B = decompress_j2k (const_cast<uint8_t*> (data_B), size_B, 0);
/* Compare them */
diff --git a/src/rgb_xyz.cc b/src/rgb_xyz.cc
index 703694da..9a062614 100644
--- a/src/rgb_xyz.cc
+++ b/src/rgb_xyz.cc
@@ -18,7 +18,7 @@
*/
#include "rgb_xyz.h"
-#include "xyz_image.h"
+#include "openjpeg_image.h"
#include "colour_matrix.h"
#include "colour_conversion.h"
#include "transfer_function.h"
@@ -51,7 +51,7 @@ using namespace dcp;
*/
void
dcp::xyz_to_rgba (
- boost::shared_ptr<const XYZImage> xyz_image,
+ boost::shared_ptr<const OpenJPEGImage> xyz_image,
ColourConversion const & conversion,
uint8_t* argb
)
@@ -130,7 +130,7 @@ dcp::xyz_to_rgba (
*/
void
dcp::xyz_to_rgb (
- shared_ptr<const XYZImage> xyz_image,
+ shared_ptr<const OpenJPEGImage> xyz_image,
ColourConversion const & conversion,
uint8_t* rgb,
int stride,
@@ -220,7 +220,7 @@ dcp::xyz_to_rgb (
* @param size of RGB image in pixels.
* @param stride of RGB data in pixels.
*/
-shared_ptr<dcp::XYZImage>
+shared_ptr<dcp::OpenJPEGImage>
dcp::rgb_to_xyz (
uint8_t const * rgb,
dcp::Size size,
@@ -228,7 +228,7 @@ dcp::rgb_to_xyz (
ColourConversion const & conversion
)
{
- shared_ptr<XYZImage> xyz (new XYZImage (size));
+ shared_ptr<OpenJPEGImage> xyz (new OpenJPEGImage (size));
struct {
double r, g, b;
@@ -292,10 +292,10 @@ dcp::rgb_to_xyz (
* 16Z, with the 2-byte value for each X/Y/Z component stored as
* little-endian.
*/
-shared_ptr<dcp::XYZImage>
+shared_ptr<dcp::OpenJPEGImage>
dcp::xyz_to_xyz (uint8_t const * xyz_16, dcp::Size size, int stride)
{
- shared_ptr<XYZImage> xyz_12 (new XYZImage (size));
+ shared_ptr<OpenJPEGImage> xyz_12 (new OpenJPEGImage (size));
int jn = 0;
for (int y = 0; y < size.height; ++y) {
diff --git a/src/rgb_xyz.h b/src/rgb_xyz.h
index 5d1a4d17..04529db0 100644
--- a/src/rgb_xyz.h
+++ b/src/rgb_xyz.h
@@ -25,25 +25,25 @@
namespace dcp {
class ARGBImage;
-class XYZImage;
+class OpenJPEGImage;
class Image;
class ColourConversion;
extern void xyz_to_rgba (
- boost::shared_ptr<const XYZImage>,
+ boost::shared_ptr<const OpenJPEGImage>,
ColourConversion const & conversion,
uint8_t* rgba
);
extern void xyz_to_rgb (
- boost::shared_ptr<const XYZImage>,
+ boost::shared_ptr<const OpenJPEGImage>,
ColourConversion const & conversion,
uint8_t* rgb,
int stride,
boost::optional<NoteHandler> note = boost::optional<NoteHandler> ()
);
-extern boost::shared_ptr<XYZImage> rgb_to_xyz (uint8_t const * rgb, dcp::Size size, int stride, ColourConversion const & conversion);
-extern boost::shared_ptr<XYZImage> xyz_to_xyz (uint8_t const * xyz, dcp::Size size, int stride);
+extern boost::shared_ptr<OpenJPEGImage> rgb_to_xyz (uint8_t const * rgb, dcp::Size size, int stride, ColourConversion const & conversion);
+extern boost::shared_ptr<OpenJPEGImage> xyz_to_xyz (uint8_t const * xyz, dcp::Size size, int stride);
}
diff --git a/src/stereo_picture_frame.cc b/src/stereo_picture_frame.cc
index 855795eb..70e802d1 100644
--- a/src/stereo_picture_frame.cc
+++ b/src/stereo_picture_frame.cc
@@ -68,7 +68,7 @@ StereoPictureFrame::~StereoPictureFrame ()
* of the image, expressed as a power of two (pass 0 for no
* reduction).
*/
-shared_ptr<XYZImage>
+shared_ptr<OpenJPEGImage>
StereoPictureFrame::xyz_image (Eye eye, int reduce) const
{
switch (eye) {
@@ -78,7 +78,7 @@ StereoPictureFrame::xyz_image (Eye eye, int reduce) const
return decompress_j2k (const_cast<uint8_t*> (_buffer->Right.RoData()), _buffer->Right.Size(), reduce);
}
- return shared_ptr<XYZImage> ();
+ return shared_ptr<OpenJPEGImage> ();
}
uint8_t const *
diff --git a/src/stereo_picture_frame.h b/src/stereo_picture_frame.h
index 261bac93..e10167aa 100644
--- a/src/stereo_picture_frame.h
+++ b/src/stereo_picture_frame.h
@@ -32,7 +32,7 @@ namespace ASDCP {
namespace dcp {
-class XYZImage;
+class OpenJPEGImage;
/** A single frame of a 3D (stereoscopic) picture asset */
class StereoPictureFrame : public boost::noncopyable
@@ -42,7 +42,7 @@ public:
StereoPictureFrame ();
~StereoPictureFrame ();
- boost::shared_ptr<XYZImage> xyz_image (Eye eye, int reduce = 0) const;
+ boost::shared_ptr<OpenJPEGImage> xyz_image (Eye eye, int reduce = 0) const;
uint8_t const * left_j2k_data () const;
uint8_t* left_j2k_data ();
diff --git a/src/util.cc b/src/util.cc
index d972d8ce..cfaeafbe 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -25,7 +25,7 @@
#include "exceptions.h"
#include "types.h"
#include "certificates.h"
-#include "xyz_image.h"
+#include "openjpeg_image.h"
#include "dcp_assert.h"
#include "compose.hpp"
#include "KM_util.h"
@@ -199,9 +199,9 @@ dcp::content_kind_from_string (string kind)
* e.g. 0 reduces by (2^0 == 1), ie keeping the same size.
* 1 reduces by (2^1 == 2), ie halving the size of the image.
* This is useful for scaling 4K DCP images down to 2K.
- * @return XYZ image.
+ * @return OpenJPEGImage.
*/
-shared_ptr<dcp::XYZImage>
+shared_ptr<dcp::OpenJPEGImage>
dcp::decompress_j2k (uint8_t* data, int64_t size, int reduce)
{
uint8_t const jp2_magic[] = {
@@ -248,7 +248,7 @@ dcp::decompress_j2k (uint8_t* data, int64_t size, int reduce)
image->x1 = rint (float(image->x1) / pow (2, reduce));
image->y1 = rint (float(image->y1) / pow (2, reduce));
- return shared_ptr<XYZImage> (new XYZImage (image));
+ return shared_ptr<OpenJPEGImage> (new OpenJPEGImage (image));
}
/** @param s A string.
diff --git a/src/util.h b/src/util.h
index 2ae91266..52a5dcde 100644
--- a/src/util.h
+++ b/src/util.h
@@ -43,7 +43,7 @@ namespace dcp {
class ARGBImage;
class CertificateChain;
class GammaLUT;
-class XYZImage;
+class OpenJPEGImage;
extern bool operator== (Size const & a, Size const & b);
extern bool operator!= (Size const & a, Size const & b);
@@ -54,7 +54,7 @@ extern std::string make_digest (boost::filesystem::path filename, boost::functio
extern std::string content_kind_to_string (ContentKind kind);
extern ContentKind content_kind_from_string (std::string kind);
extern bool empty_or_white_space (std::string s);
-extern boost::shared_ptr<XYZImage> decompress_j2k (uint8_t* data, int64_t size, int reduce);
+extern boost::shared_ptr<OpenJPEGImage> decompress_j2k (uint8_t* data, int64_t size, int reduce);
extern bool ids_equal (std::string a, std::string b);
extern void init ();
diff --git a/src/wscript b/src/wscript
index ede704bb..bf28183e 100644
--- a/src/wscript
+++ b/src/wscript
@@ -30,6 +30,7 @@ def build(bld):
mxf.cc
asset_writer.cc
object.cc
+ openjpeg_image.cc
picture_asset.cc
picture_asset_writer.cc
reel.cc
@@ -58,7 +59,6 @@ def build(bld):
types.cc
util.cc
version.cc
- xyz_image.cc
"""
headers = """
@@ -90,6 +90,7 @@ def build(bld):
mxf.h
asset_writer.h
object.h
+ openjpeg_image.h
picture_asset.h
picture_asset_writer.h
raw_convert.h
@@ -118,7 +119,6 @@ def build(bld):
types.h
util.h
version.h
- xyz_image.h
"""
# Main library