Rename XYZFrame -> XYZImage and ARGBFrame -> ARGBImage.
authorCarl Hetherington <cth@carlh.net>
Mon, 2 Feb 2015 19:25:43 +0000 (19:25 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 2 Feb 2015 19:25:43 +0000 (19:25 +0000)
25 files changed:
examples/read_dcp.cc
src/argb_frame.cc [deleted file]
src/argb_frame.h [deleted file]
src/argb_image.cc [new file with mode: 0644]
src/argb_image.h [new file with mode: 0644]
src/mono_picture_frame.cc
src/mono_picture_frame.h
src/picture_mxf.cc
src/rgb_xyz.cc
src/rgb_xyz.h
src/stereo_picture_frame.cc
src/stereo_picture_frame.h
src/util.cc
src/util.h
src/wscript
src/xyz_frame.cc [deleted file]
src/xyz_frame.h [deleted file]
src/xyz_image.cc [new file with mode: 0644]
src/xyz_image.h [new file with mode: 0644]
test/argb_frame_test.cc [deleted file]
test/argb_image_test.cc [new file with mode: 0644]
test/decryption_test.cc
test/rgb_xyz_test.cc
test/round_trip_test.cc
test/wscript

index f3c47a3cf5d72fb76626cb90c4804091bcf0b6f9..901ef8ce6b349d1e662b0d45085cdbdd262dd46b 100644 (file)
@@ -32,7 +32,7 @@
 #include "stereo_picture_mxf.h"
 #include "sound_mxf.h"
 #include "subtitle_content.h"
-#include "argb_frame.h"
+#include "argb_image.h"
 #include <Magick++.h>
 
 /** @file examples/read_dcp.cc
@@ -81,9 +81,9 @@ main ()
        boost::shared_ptr<const dcp::MonoPictureFrame> picture_frame_j2k = picture_mxf->get_frame(999);
 
        /* Get a ARGB copy of it */
-       boost::shared_ptr<dcp::ARGBFrame> picture_frame_rgb = picture_frame_j2k->argb_frame ();
+       boost::shared_ptr<dcp::ARGBImage> picture_image_rgb = picture_frame_j2k->argb_image ();
 
-       Magick::Image image (picture_frame_rgb->size().width, picture_frame_rgb->size().height, "BGRA", Magick::CharPixel, picture_frame_rgb->data ());
+       Magick::Image image (picture_image_rgb->size().width, picture_image_rgb->size().height, "BGRA", Magick::CharPixel, picture_image_rgb->data ());
        image.write ("frame.png");
 
        return 0;
diff --git a/src/argb_frame.cc b/src/argb_frame.cc
deleted file mode 100644 (file)
index 99d6c81..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file  src/argb_frame.cc
- *  @brief ARGBFrame class. 
- */
-
-#include "argb_frame.h"
-
-using namespace dcp;
-
-/** Construct an empty ARGBFrame of a given size and with
- *  undefined contents.
- *  @param size Size in pixels.
- */
-ARGBFrame::ARGBFrame (Size size)
-       : _size (size)
-{
-       _data = new uint8_t[_size.width * _size.height * 4];
-}
-
-
-ARGBFrame::~ARGBFrame ()
-{
-       delete[] _data;
-}
-
-/** @return The stride, in bytes; that is, the number of bytes per row of the image */
-int
-ARGBFrame::stride () const
-{
-       return _size.width * 4;
-}
diff --git a/src/argb_frame.h b/src/argb_frame.h
deleted file mode 100644 (file)
index db0d07a..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file  src/argb_frame.h
- *  @brief ARGBFrame class. 
- */
-
-#include "util.h"
-#include <stdint.h>
-
-namespace dcp
-{
-
-/** @class ARGBFrame
- *  @brief A single frame of picture data held in an ARGB buffer.
- *
- *  The format of the data is:
- *
- *  <pre>
- *  Byte   /- 0 -------|- 1 --------|- 2 --------|- 3 --------|- 4 --------|- 5 --------| ...
- *         |(0, 0) Blue|(0, 0)Green |(0, 0) Red  |(0, 0) Alpha|(0, 1) Blue |(0, 1) Green| ...
- *  </pre>
- *
- *  So that the first byte is the blue component of the pixel at x=0, y=0, the second
- *  is the green component, and so on.
- *
- *  Lines are packed so that the second row directly follows the first.
- *
- *  XXX: this should probably be an Image...?
- */
-class ARGBFrame : boost::noncopyable
-{
-public:
-       ARGBFrame (Size size);
-       ~ARGBFrame ();
-
-       /** @return pointer to the image data */
-       uint8_t* data () const {
-               return _data;
-       }
-
-       /** @return length of one picture row in bytes */
-       int stride () const;
-
-       /** @return size of the picture in pixels */
-       Size size () const {
-               return _size;
-       }
-
-private:
-       Size _size;     ///< frame size in pixels
-       uint8_t* _data; ///< pointer to image data
-};
-
-}
diff --git a/src/argb_image.cc b/src/argb_image.cc
new file mode 100644 (file)
index 0000000..79dcd85
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file  src/argb_image.cc
+ *  @brief ARGBImage class. 
+ */
+
+#include "argb_image.h"
+
+using namespace dcp;
+
+/** Construct an empty ARGBImage of a given size and with
+ *  undefined contents.
+ *  @param size Size in pixels.
+ */
+ARGBImage::ARGBImage (Size size)
+       : _size (size)
+{
+       _data = new uint8_t[_size.width * _size.height * 4];
+}
+
+
+ARGBImage::~ARGBImage ()
+{
+       delete[] _data;
+}
+
+/** @return The stride, in bytes; that is, the number of bytes per row of the image */
+int
+ARGBImage::stride () const
+{
+       return _size.width * 4;
+}
diff --git a/src/argb_image.h b/src/argb_image.h
new file mode 100644 (file)
index 0000000..805d0a2
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+    Copyright (C) 2012-2014 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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file  src/argb_image.h
+ *  @brief ARGBImage class. 
+ */
+
+#include "util.h"
+#include <stdint.h>
+
+namespace dcp
+{
+
+/** @class ARGBImage
+ *  @brief A single frame of picture data held in an ARGB buffer.
+ *
+ *  The format of the data is:
+ *
+ *  <pre>
+ *  Byte   /- 0 -------|- 1 --------|- 2 --------|- 3 --------|- 4 --------|- 5 --------| ...
+ *         |(0, 0) Blue|(0, 0)Green |(0, 0) Red  |(0, 0) Alpha|(0, 1) Blue |(0, 1) Green| ...
+ *  </pre>
+ *
+ *  So that the first byte is the blue component of the pixel at x=0, y=0, the second
+ *  is the green component, and so on.
+ *
+ *  Lines are packed so that the second row directly follows the first.
+ *
+ *  XXX: this should probably be an Image...?
+ */
+class ARGBImage : boost::noncopyable
+{
+public:
+       ARGBImage (Size size);
+       ~ARGBImage ();
+
+       /** @return pointer to the image data */
+       uint8_t* data () const {
+               return _data;
+       }
+
+       /** @return length of one picture row in bytes */
+       int stride () const;
+
+       /** @return size of the picture in pixels */
+       Size size () const {
+               return _size;
+       }
+
+private:
+       Size _size;     ///< frame size in pixels
+       uint8_t* _data; ///< pointer to image data
+};
+
+}
index 563853ba3845130e408233759266d548041f2dc8..1edfd4119575e13b552ce239c9b8c96da4eac54a 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "mono_picture_frame.h"
 #include "exceptions.h"
-#include "argb_frame.h"
+#include "argb_image.h"
 #include "util.h"
 #include "rgb_xyz.h"
 #include "colour_conversion.h"
@@ -119,8 +119,8 @@ MonoPictureFrame::j2k_size () const
  *  Cairo sense, so that each pixel takes up 4 bytes; the first byte
  *  is blue, second green, third red and fourth alpha (always 255).
  */
-shared_ptr<ARGBFrame>
-MonoPictureFrame::argb_frame (int reduce) const
+shared_ptr<ARGBImage>
+MonoPictureFrame::argb_image (int reduce) const
 {
        return xyz_to_rgba (
                decompress_j2k (const_cast<uint8_t*> (_buffer->RoData()), _buffer->Size(), reduce),
index fde918fb97b6b4fa76a307bdda65b88fd7fe431e..c9183a12a961033869a8952c1d53cbf569b751d9 100644 (file)
@@ -38,7 +38,7 @@ namespace ASDCP {
 
 namespace dcp {
 
-class ARGBFrame;
+class ARGBImage;
 class Image;
 
 /** @class MonoPictureFrame
@@ -52,7 +52,7 @@ public:
        MonoPictureFrame ();
        ~MonoPictureFrame ();
 
-       boost::shared_ptr<ARGBFrame> argb_frame (int reduce = 0) const;
+       boost::shared_ptr<ARGBImage> argb_image (int reduce = 0) const;
        void rgb_frame (boost::shared_ptr<Image> rgb, boost::optional<NoteHandler> note = boost::optional<NoteHandler> ()) const;
        uint8_t const * j2k_data () const;
        uint8_t* j2k_data ();
index 0991cd50e52d749e6afb4514ab2bc66c16fdee8a..46aa7752847aa539aaeb790194ccfcf7b293a311 100644 (file)
@@ -20,7 +20,7 @@
 #include "picture_mxf.h"
 #include "util.h"
 #include "exceptions.h"
-#include "xyz_frame.h"
+#include "xyz_image.h"
 #include "picture_mxf_writer.h"
 #include "compose.hpp"
 #include "AS_DCP.h"
@@ -124,8 +124,8 @@ PictureMXF::frame_buffer_equals (
        }
                
        /* Decompress the images to bitmaps */
-       shared_ptr<XYZFrame> image_A = decompress_j2k (const_cast<uint8_t*> (data_A), size_A, 0);
-       shared_ptr<XYZFrame> image_B = decompress_j2k (const_cast<uint8_t*> (data_B), size_B, 0);
+       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);
        
        /* Compare them */
        
index c5dbcb8f07cbeba14bb3f07c0cf9557881d3ef16..f44b1a304ee438d5e1bcd452b8b78878ea3138fc 100644 (file)
@@ -18,8 +18,8 @@
 */
 
 #include "rgb_xyz.h"
-#include "argb_frame.h"
-#include "xyz_frame.h"
+#include "argb_image.h"
+#include "xyz_image.h"
 #include "image.h"
 #include "colour_matrix.h"
 #include "colour_conversion.h"
@@ -37,12 +37,12 @@ using namespace dcp;
 #define DCI_COEFFICIENT (48.0 / 52.37)
 
 /** Convert an openjpeg XYZ image to RGBA.
- *  @param xyz_frame Frame in XYZ.
+ *  @param xyz_image Image in XYZ.
  *  @return RGB image.
  */
-shared_ptr<ARGBFrame>
+shared_ptr<ARGBImage>
 dcp::xyz_to_rgba (
-       boost::shared_ptr<const XYZFrame> xyz_frame,
+       boost::shared_ptr<const XYZImage> xyz_image,
        ColourConversion const & conversion
        )
 {
@@ -56,20 +56,20 @@ dcp::xyz_to_rgba (
                double r, g, b;
        } d;
        
-       int* xyz_x = xyz_frame->data (0);
-       int* xyz_y = xyz_frame->data (1);
-       int* xyz_z = xyz_frame->data (2);
+       int* xyz_x = xyz_image->data (0);
+       int* xyz_y = xyz_image->data (1);
+       int* xyz_z = xyz_image->data (2);
 
-       shared_ptr<ARGBFrame> argb_frame (new ARGBFrame (xyz_frame->size ()));
-       uint8_t* argb = argb_frame->data ();
+       shared_ptr<ARGBImage> argb_image (new ARGBImage (xyz_image->size ()));
+       uint8_t* argb = argb_image->data ();
        
        double const * lut_in = conversion.in()->lut (16);
        double const * lut_out = conversion.out()->lut (12);
        boost::numeric::ublas::matrix<double> matrix = conversion.matrix ();
 
-       for (int y = 0; y < xyz_frame->size().height; ++y) {
+       for (int y = 0; y < xyz_image->size().height; ++y) {
                uint8_t* argb_line = argb;
-               for (int x = 0; x < xyz_frame->size().width; ++x) {
+               for (int x = 0; x < xyz_image->size().width; ++x) {
 
                        DCP_ASSERT (*xyz_x >= 0 && *xyz_y >= 0 && *xyz_z >= 0 && *xyz_x < 4096 && *xyz_y < 4096 && *xyz_z < 4096);
                        
@@ -104,14 +104,14 @@ dcp::xyz_to_rgba (
                        *argb_line++ = 0xff;
                }
                
-               argb += argb_frame->stride ();
+               argb += argb_image->stride ();
        }
 
-       return argb_frame;
+       return argb_image;
 }
 
 /** Convert an openjpeg XYZ image to RGB.
- *  @param xyz_frame Frame in XYZ.
+ *  @param xyz_image Frame in XYZ.
  *  @param conversion Colour conversion to use.
  *  @param rgb Image to write RGB data to; must have space to be
  *  filled with packed RGB 16:16:16, 48bpp, 16R, 16G, 16B,
@@ -120,7 +120,7 @@ dcp::xyz_to_rgba (
  */
 void
 dcp::xyz_to_rgb (
-       shared_ptr<const XYZFrame> xyz_frame,
+       shared_ptr<const XYZImage> xyz_image,
        ColourConversion const & conversion,
        shared_ptr<Image> rgb,
        optional<NoteHandler> note
@@ -135,17 +135,17 @@ dcp::xyz_to_rgb (
        } d;
 
        /* These should be 12-bit values from 0-4095 */
-       int* xyz_x = xyz_frame->data (0);
-       int* xyz_y = xyz_frame->data (1);
-       int* xyz_z = xyz_frame->data (2);
+       int* xyz_x = xyz_image->data (0);
+       int* xyz_y = xyz_image->data (1);
+       int* xyz_z = xyz_image->data (2);
 
        double const * lut_in = conversion.in()->lut (12);
        double const * lut_out = conversion.out()->lut (16);
        boost::numeric::ublas::matrix<double> matrix = conversion.matrix ();
        
-       for (int y = 0; y < xyz_frame->size().height; ++y) {
+       for (int y = 0; y < xyz_image->size().height; ++y) {
                uint16_t* rgb_line = reinterpret_cast<uint16_t*> (rgb->data()[0] + y * rgb->stride()[0]);
-               for (int x = 0; x < xyz_frame->size().width; ++x) {
+               for (int x = 0; x < xyz_image->size().width; ++x) {
 
                        int cx = *xyz_x++;
                        int cy = *xyz_y++;
@@ -206,13 +206,13 @@ dcp::xyz_to_rgb (
 /** rgb must be packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, with the 2-byte value for each R/G/B component stored as little-endian;
  *  i.e. AV_PIX_FMT_RGB48LE.
  */
-shared_ptr<dcp::XYZFrame>
+shared_ptr<dcp::XYZImage>
 dcp::rgb_to_xyz (
        boost::shared_ptr<const Image> rgb,
        ColourConversion const & conversion
        )
 {
-       shared_ptr<XYZFrame> xyz (new XYZFrame (rgb->size ()));
+       shared_ptr<XYZImage> xyz (new XYZImage (rgb->size ()));
 
        struct {
                double r, g, b;
@@ -266,10 +266,10 @@ dcp::rgb_to_xyz (
 /** Image must be packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, with the 2-byte value for each R/G/B component stored as little-endian;
  *  i.e. AV_PIX_FMT_RGB48LE.
  */
-shared_ptr<dcp::XYZFrame>
+shared_ptr<dcp::XYZImage>
 dcp::xyz_to_xyz (shared_ptr<const Image> xyz_16)
 {
-       shared_ptr<XYZFrame> xyz_12 (new XYZFrame (xyz_16->size ()));
+       shared_ptr<XYZImage> xyz_12 (new XYZImage (xyz_16->size ()));
 
        int jn = 0;
        for (int y = 0; y < xyz_16->size().height; ++y) {
index 0c998e41922031ea2f88d5488103af83d0a55bf1..cd0125cb04a4b8827601b5e49ec72838b15d9829 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-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
 
 namespace dcp {
 
-class ARGBFrame;       
-class XYZFrame;
+class ARGBImage;       
+class XYZImage;
 class Image;
 class ColourConversion;
        
-extern boost::shared_ptr<ARGBFrame> xyz_to_rgba (boost::shared_ptr<const XYZFrame>, ColourConversion const & conversion);
+extern boost::shared_ptr<ARGBImage> xyz_to_rgba (boost::shared_ptr<const XYZImage>, ColourConversion const & conversion);
 extern void xyz_to_rgb (
-       boost::shared_ptr<const XYZFrame>,
+       boost::shared_ptr<const XYZImage>,
        ColourConversion const & conversion,
        boost::shared_ptr<Image> rgb,
        boost::optional<NoteHandler> note = boost::optional<NoteHandler> ()
        );
-extern boost::shared_ptr<XYZFrame> rgb_to_xyz (boost::shared_ptr<const Image>, ColourConversion const & conversion);
-extern boost::shared_ptr<XYZFrame> xyz_to_xyz (boost::shared_ptr<const Image>);
+extern boost::shared_ptr<XYZImage> rgb_to_xyz (boost::shared_ptr<const Image>, ColourConversion const & conversion);
+extern boost::shared_ptr<XYZImage> xyz_to_xyz (boost::shared_ptr<const Image>);
        
 }
index 060e86cc86bfdd0122b33795665f43c6438883bc..0eae758357949d2e20304408af58045387c72a6c 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "stereo_picture_frame.h"
 #include "exceptions.h"
-#include "argb_frame.h"
+#include "argb_image.h"
 #include "util.h"
 #include "rgb_xyz.h"
 #include "colour_conversion.h"
@@ -74,36 +74,36 @@ StereoPictureFrame::~StereoPictureFrame ()
  *  third red and fourth alpha (always 255).
  *
  */
-shared_ptr<ARGBFrame>
-StereoPictureFrame::argb_frame (Eye eye, int reduce) const
+shared_ptr<ARGBImage>
+StereoPictureFrame::argb_image (Eye eye, int reduce) const
 {
-       shared_ptr<XYZFrame> xyz_frame;
+       shared_ptr<XYZImage> xyz_image;
        switch (eye) {
        case LEFT:
-               xyz_frame = decompress_j2k (const_cast<uint8_t*> (_buffer->Left.RoData()), _buffer->Left.Size(), reduce);
+               xyz_image = decompress_j2k (const_cast<uint8_t*> (_buffer->Left.RoData()), _buffer->Left.Size(), reduce);
                break;
        case RIGHT:
-               xyz_frame = decompress_j2k (const_cast<uint8_t*> (_buffer->Right.RoData()), _buffer->Right.Size(), reduce);
+               xyz_image = decompress_j2k (const_cast<uint8_t*> (_buffer->Right.RoData()), _buffer->Right.Size(), reduce);
                break;
        }
        
-       return xyz_to_rgba (xyz_frame, ColourConversion::xyz_to_srgb ());
+       return xyz_to_rgba (xyz_image, ColourConversion::xyz_to_srgb ());
 }
 
 void
 StereoPictureFrame::rgb_frame (Eye eye, shared_ptr<Image> image) const
 {
-       shared_ptr<XYZFrame> xyz_frame;
+       shared_ptr<XYZImage> xyz_image;
        switch (eye) {
        case LEFT:
-               xyz_frame = decompress_j2k (const_cast<uint8_t*> (_buffer->Left.RoData()), _buffer->Left.Size(), 0);
+               xyz_image = decompress_j2k (const_cast<uint8_t*> (_buffer->Left.RoData()), _buffer->Left.Size(), 0);
                break;
        case RIGHT:
-               xyz_frame = decompress_j2k (const_cast<uint8_t*> (_buffer->Right.RoData()), _buffer->Right.Size(), 0);
+               xyz_image = decompress_j2k (const_cast<uint8_t*> (_buffer->Right.RoData()), _buffer->Right.Size(), 0);
                break;
        }
        
-       return xyz_to_rgb (xyz_frame, ColourConversion::xyz_to_srgb (), image);
+       return xyz_to_rgb (xyz_image, ColourConversion::xyz_to_srgb (), image);
 }
 
 uint8_t const *
index d1aa613734a1f7df1b99b5106cc675be31ba7e7d..ba78d92203f28f77507f55d3c7c6bfc379c25b37 100644 (file)
@@ -33,7 +33,7 @@ namespace ASDCP {
 
 namespace dcp {
 
-class ARGBFrame;
+class ARGBImage;
 class Image;
 
 /** A single frame of a 3D (stereoscopic) picture asset */     
@@ -44,7 +44,7 @@ public:
        StereoPictureFrame ();
        ~StereoPictureFrame ();
 
-       boost::shared_ptr<ARGBFrame> argb_frame (Eye eye, int reduce = 0) const;
+       boost::shared_ptr<ARGBImage> argb_image (Eye eye, int reduce = 0) const;
        void rgb_frame (Eye eye, boost::shared_ptr<Image>) const;
        uint8_t const * left_j2k_data () const;
        uint8_t* left_j2k_data ();
index ac067a7670233f32581c178d6cf896b553a58dc7..89b563ae7ff437d90af28723f50c110f8685bfc6 100644 (file)
@@ -24,9 +24,9 @@
 #include "util.h"
 #include "exceptions.h"
 #include "types.h"
-#include "argb_frame.h"
+#include "argb_image.h"
 #include "certificates.h"
-#include "xyz_frame.h"
+#include "xyz_image.h"
 #include "dcp_assert.h"
 #include "compose.hpp"
 #include "KM_util.h"
@@ -202,7 +202,7 @@ dcp::content_kind_from_string (string kind)
  *  This is useful for scaling 4K DCP images down to 2K.
  *  @return XYZ image.
  */
-shared_ptr<dcp::XYZFrame>
+shared_ptr<dcp::XYZImage>
 dcp::decompress_j2k (uint8_t* data, int64_t size, int reduce)
 {
        opj_dinfo_t* decoder = opj_create_decompress (CODEC_J2K);
@@ -223,7 +223,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<XYZFrame> (new XYZFrame (image));
+       return shared_ptr<XYZImage> (new XYZImage (image));
 }
 
 /** @param s A string.
index 857f872f63c4d4a6f9805f5207d856de80eb9920..5bc3a78d55a9acb7dd78204a716719f0ee8e46f9 100644 (file)
@@ -39,10 +39,10 @@ namespace xmlpp {
 
 namespace dcp {
 
-class ARGBFrame;
+class ARGBImage;
 class CertificateChain;
 class GammaLUT;
-class XYZFrame;
+class XYZImage;
 
 /** @struct Size
  *  @brief The integer, two-dimensional size of something.
@@ -76,7 +76,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<XYZFrame> decompress_j2k (uint8_t* data, int64_t size, int reduce);
+extern boost::shared_ptr<XYZImage> decompress_j2k (uint8_t* data, int64_t size, int reduce);
 extern bool ids_equal (std::string a, std::string b);
 
 extern void init ();
index d6444aee507b049b853884de2a9ebd313b0d8b8b..af7b823e47253f186a9af3bc1c6fd4139daa12fa 100644 (file)
@@ -2,7 +2,7 @@ from waflib import TaskGen
 
 def build(bld):
     source = """
-             argb_frame.cc
+             argb_image.cc
              asset.cc
              certificate_chain.cc
              certificates.cc
@@ -60,7 +60,7 @@ def build(bld):
              types.cc
              util.cc
              version.cc
-             xyz_frame.cc
+             xyz_image.cc
              """
 
     headers = """
@@ -104,7 +104,7 @@ def build(bld):
               reel_stereo_picture_asset.h
               reel_subtitle_asset.h
               ref.h
-              argb_frame.h
+              argb_image.h
               signer.h
               smpte_load_font.h
               smpte_subtitle_content.h
@@ -120,7 +120,7 @@ def build(bld):
               types.h
               util.h
               version.h
-              xyz_frame.h
+              xyz_image.h
               """
 
     # Main library
diff --git a/src/xyz_frame.cc b/src/xyz_frame.cc
deleted file mode 100644 (file)
index f1c6949..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file  src/xyz_frame.cc
- *  @brief XZYFrame class.
- */
-
-#include "xyz_frame.h"
-#include "dcp_assert.h"
-#include <stdexcept>
-
-using namespace dcp;
-
-/** Construct an XYZFrame, taking ownership of the opj_image_t */
-XYZFrame::XYZFrame (opj_image_t* image)
-       : _opj_image (image)
-{
-       DCP_ASSERT (_opj_image->numcomps == 3);
-}
-
-/** Construct a new XYZFrame with undefined contents.
- *  @param size Size for the frame in pixels.
- */
-XYZFrame::XYZFrame (Size size)
-{
-       opj_image_cmptparm_t cmptparm[3];
-       
-       for (int i = 0; i < 3; ++i) {
-               cmptparm[i].dx = 1;
-               cmptparm[i].dy = 1;
-               cmptparm[i].w = size.width;
-               cmptparm[i].h = size.height;
-               cmptparm[i].x0 = 0;
-               cmptparm[i].y0 = 0;
-               cmptparm[i].prec = 12;
-               cmptparm[i].bpp = 12;
-               cmptparm[i].sgnd = 0;
-       }
-
-       /* XXX: is this _SRGB right? */
-       _opj_image = opj_image_create (3, &cmptparm[0], CLRSPC_SRGB);
-       if (_opj_image == 0) {
-               throw std::runtime_error ("could not create libopenjpeg image");
-       }
-
-       _opj_image->x0 = 0;
-       _opj_image->y0 = 0;
-       _opj_image->x1 = size.width;
-       _opj_image->y1 = size.height;
-}
-
-/** XYZFrame destructor */
-XYZFrame::~XYZFrame ()
-{
-       opj_image_destroy (_opj_image);
-}
-
-/** @param c Component index (0, 1 or 2)
- *  @return Pointer to the data for component c; 12-bit values from 0-4095.
- */
-int *
-XYZFrame::data (int c) const
-{
-       DCP_ASSERT (c >= 0 && c < 3);
-       return _opj_image->comps[c].data;
-}
-
-/** @return Size of the image in pixels */
-dcp::Size
-XYZFrame::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_frame.h b/src/xyz_frame.h
deleted file mode 100644 (file)
index 8ba829b..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file  src/xyz_frame.h
- *  @brief XZYFrame class.
- */
-
-#include "util.h"
-#include <openjpeg.h>
-
-namespace dcp {
-
-/** @class XYZFrame
- *  @brief An image in XYZ colour.
- *
- *  This class is a thin wrapper of libopenjpeg's opj_image_t.
- */
-class XYZFrame : public boost::noncopyable
-{
-public:
-       XYZFrame (opj_image_t *);
-       XYZFrame (Size);
-       ~XYZFrame ();
-
-       int* data (int) const;
-       dcp::Size size () const;
-
-       /** @return Pointer to opj_image_t struct.  The caller
-        *  must not delete this.
-        */
-       opj_image_t* opj_image () const {
-               return _opj_image;
-       }
-
-private:
-       opj_image_t* _opj_image; ///< opj_image_t that we are managing
-};
-
-}
diff --git a/src/xyz_image.cc b/src/xyz_image.cc
new file mode 100644 (file)
index 0000000..48ee6ad
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file  src/xyz_image.cc
+ *  @brief XYZImage class.
+ */
+
+#include "xyz_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)
+       : _opj_image (image)
+{
+       DCP_ASSERT (_opj_image->numcomps == 3);
+}
+
+/** Construct a new XYZImage with undefined contents.
+ *  @param size Size for the frame in pixels.
+ */
+XYZImage::XYZImage (Size size)
+{
+       opj_image_cmptparm_t cmptparm[3];
+       
+       for (int i = 0; i < 3; ++i) {
+               cmptparm[i].dx = 1;
+               cmptparm[i].dy = 1;
+               cmptparm[i].w = size.width;
+               cmptparm[i].h = size.height;
+               cmptparm[i].x0 = 0;
+               cmptparm[i].y0 = 0;
+               cmptparm[i].prec = 12;
+               cmptparm[i].bpp = 12;
+               cmptparm[i].sgnd = 0;
+       }
+
+       /* XXX: is this _SRGB right? */
+       _opj_image = opj_image_create (3, &cmptparm[0], CLRSPC_SRGB);
+       if (_opj_image == 0) {
+               throw std::runtime_error ("could not create libopenjpeg image");
+       }
+
+       _opj_image->x0 = 0;
+       _opj_image->y0 = 0;
+       _opj_image->x1 = size.width;
+       _opj_image->y1 = size.height;
+}
+
+/** XYZImage destructor */
+XYZImage::~XYZImage ()
+{
+       opj_image_destroy (_opj_image);
+}
+
+/** @param c Component index (0, 1 or 2)
+ *  @return Pointer to the data for component c; 12-bit values from 0-4095.
+ */
+int *
+XYZImage::data (int c) const
+{
+       DCP_ASSERT (c >= 0 && c < 3);
+       return _opj_image->comps[c].data;
+}
+
+/** @return Size of the image in pixels */
+dcp::Size
+XYZImage::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/xyz_image.h
new file mode 100644 (file)
index 0000000..6be065e
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file  src/xyz_image.h
+ *  @brief XYZImage class.
+ */
+
+#include "util.h"
+#include <openjpeg.h>
+
+namespace dcp {
+
+/** @class XYZImage
+ *  @brief An image in XYZ colour.
+ *
+ *  This class is a thin wrapper of libopenjpeg's opj_image_t.
+ */
+class XYZImage : public boost::noncopyable
+{
+public:
+       XYZImage (opj_image_t *);
+       XYZImage (Size);
+       ~XYZImage ();
+
+       int* data (int) const;
+       dcp::Size size () const;
+
+       /** @return Pointer to opj_image_t struct.  The caller
+        *  must not delete this.
+        */
+       opj_image_t* opj_image () const {
+               return _opj_image;
+       }
+
+private:
+       opj_image_t* _opj_image; ///< opj_image_t that we are managing
+};
+
+}
diff --git a/test/argb_frame_test.cc b/test/argb_frame_test.cc
deleted file mode 100644 (file)
index e5c881a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-    Copyright (C) 2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "argb_frame.h"
-#include <boost/test/unit_test.hpp>
-
-/** Very simple tests of ARGBFrame */
-BOOST_AUTO_TEST_CASE (argb_frame_test)
-{
-       dcp::ARGBFrame f (dcp::Size (100, 200));
-
-       BOOST_CHECK (f.data() != 0);
-       BOOST_CHECK_EQUAL (f.stride(), 100 * 4);
-       BOOST_CHECK_EQUAL (f.size(), dcp::Size (100, 200));
-}
diff --git a/test/argb_image_test.cc b/test/argb_image_test.cc
new file mode 100644 (file)
index 0000000..e88d208
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+    Copyright (C) 2014 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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "argb_image.h"
+#include <boost/test/unit_test.hpp>
+
+/** Very simple tests of ARGBImage */
+BOOST_AUTO_TEST_CASE (argb_image_test)
+{
+       dcp::ARGBImage f (dcp::Size (100, 200));
+
+       BOOST_CHECK (f.data() != 0);
+       BOOST_CHECK_EQUAL (f.stride(), 100 * 4);
+       BOOST_CHECK_EQUAL (f.size(), dcp::Size (100, 200));
+}
index d9170daaf0c2253c9bfb8816d59d668546aff1c1..a28f3c640e2f3a70e022f8039cae9c13feb2a55c 100644 (file)
@@ -23,7 +23,7 @@
 #include "cpl.h"
 #include "decrypted_kdm.h"
 #include "encrypted_kdm.h"
-#include "argb_frame.h"
+#include "argb_image.h"
 #include "mono_picture_mxf.h"
 #include "reel_picture_asset.h"
 #include "reel.h"
@@ -32,7 +32,7 @@
 using boost::dynamic_pointer_cast;
 using boost::shared_ptr;
 
-static shared_ptr<const dcp::ARGBFrame>
+static shared_ptr<const dcp::ARGBImage>
 get_frame (dcp::DCP const & dcp)
 {
        shared_ptr<const dcp::Reel> reel = dcp.cpls().front()->reels().front ();
@@ -41,7 +41,7 @@ get_frame (dcp::DCP const & dcp)
 
        shared_ptr<const dcp::MonoPictureMXF> mono_picture = dynamic_pointer_cast<const dcp::MonoPictureMXF> (picture);
        shared_ptr<const dcp::MonoPictureFrame> j2k_frame = mono_picture->get_frame (0);
-       return j2k_frame->argb_frame ();
+       return j2k_frame->argb_image ();
 }
 
 /** Decrypt an encrypted test DCP and check that its first frame is the same as the unencrypted version */
@@ -68,8 +68,8 @@ BOOST_AUTO_TEST_CASE (decryption_test)
        
        encrypted.add (kdm);
 
-       shared_ptr<const dcp::ARGBFrame> plaintext_frame = get_frame (plaintext);
-       shared_ptr<const dcp::ARGBFrame> encrypted_frame = get_frame (encrypted);
+       shared_ptr<const dcp::ARGBImage> plaintext_frame = get_frame (plaintext);
+       shared_ptr<const dcp::ARGBImage> encrypted_frame = get_frame (encrypted);
 
        /* Check that plaintext and encrypted are the same */
        BOOST_CHECK_EQUAL (plaintext_frame->stride(), encrypted_frame->stride());
index da897b9f5f6c6c5c215c581e5758b960ea399e4b..6ee62dbf2a86b5ad89d59d61e7dd5ee27dc7b2fd 100644 (file)
@@ -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
@@ -19,7 +19,7 @@
 
 #include "image.h"
 #include "rgb_xyz.h"
-#include "xyz_frame.h"
+#include "xyz_image.h"
 #include "colour_conversion.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/bind.hpp>
@@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE (rgb_xyz_test)
                }
        }
 
-       shared_ptr<dcp::XYZFrame> xyz = dcp::rgb_to_xyz (rgb, dcp::ColourConversion::srgb_to_xyz ());
+       shared_ptr<dcp::XYZImage> xyz = dcp::rgb_to_xyz (rgb, dcp::ColourConversion::srgb_to_xyz ());
 
        for (int y = 0; y < size.height; ++y) {
                uint16_t* p = reinterpret_cast<uint16_t*> (rgb->data()[0] + y * rgb->stride()[0]);
@@ -144,7 +144,7 @@ note_handler (dcp::NoteType n, string s)
 /** Check that xyz_to_rgb clamps XYZ values correctly */
 BOOST_AUTO_TEST_CASE (xyz_rgb_range_test)
 {
-       shared_ptr<dcp::XYZFrame> xyz (new dcp::XYZFrame (dcp::Size (2, 2)));
+       shared_ptr<dcp::XYZImage> xyz (new dcp::XYZImage (dcp::Size (2, 2)));
        
        xyz->data(0)[0] = -4;
        xyz->data(0)[1] = 6901;
index 94097e7584c212ac6fc59bcab1f1e38a07ea8975..6f5372ecabad5f4b256524229ebb4c49e9398d4b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-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
@@ -27,7 +27,7 @@
 #include "test.h"
 #include "cpl.h"
 #include "mono_picture_frame.h"
-#include "argb_frame.h"
+#include "argb_image.h"
 #include "certificate_chain.h"
 #include "mono_picture_mxf_writer.h"
 #include "reel_picture_asset.h"
@@ -102,8 +102,8 @@ BOOST_AUTO_TEST_CASE (round_trip_test)
        BOOST_CHECK (!kdm_B.keys().empty ());
        mxf_B->set_key (kdm_B.keys().front().key());
 
-       shared_ptr<dcp::ARGBFrame> frame_A = mxf_A->get_frame(0)->argb_frame ();
-       shared_ptr<dcp::ARGBFrame> frame_B = mxf_B->get_frame(0)->argb_frame ();
+       shared_ptr<dcp::ARGBImage> frame_A = mxf_A->get_frame(0)->argb_image ();
+       shared_ptr<dcp::ARGBImage> frame_B = mxf_B->get_frame(0)->argb_image ();
        BOOST_CHECK_EQUAL (frame_A->size().width, frame_B->size().width);
        BOOST_CHECK_EQUAL (frame_A->size().height, frame_B->size().height);
        BOOST_CHECK_EQUAL (memcmp (frame_A->data(), frame_B->data(), frame_A->size().width * frame_A->size().height), 0);
index f669c3784ef77142d3afc3e3c0af555fe67c8367..b723f54c357e7be18f4495ecf2a700dcec8454ae 100644 (file)
@@ -25,7 +25,7 @@ def build(bld):
     else:
         obj.use = 'libdcp%s' % bld.env.API_VERSION
     obj.source = """
-                 argb_frame_test.cc
+                 argb_image_test.cc
                  certificates_test.cc
                  colour_test.cc
                  colour_conversion_test.cc