diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-02-02 19:25:43 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-02-02 19:25:43 +0000 |
| commit | 0d7fe66361a40702cb97357955cf35256f1d2c26 (patch) | |
| tree | 5cc44b13cbe6e257cb422ba9d79d1c385234495c /src | |
| parent | 1dc082f3295f64a9fd4a103078a1dbb5121a865d (diff) | |
Rename XYZFrame -> XYZImage and ARGBFrame -> ARGBImage.
Diffstat (limited to 'src')
| -rw-r--r-- | src/argb_image.cc (renamed from src/argb_frame.cc) | 16 | ||||
| -rw-r--r-- | src/argb_image.h (renamed from src/argb_frame.h) | 12 | ||||
| -rw-r--r-- | src/mono_picture_frame.cc | 6 | ||||
| -rw-r--r-- | src/mono_picture_frame.h | 4 | ||||
| -rw-r--r-- | src/picture_mxf.cc | 6 | ||||
| -rw-r--r-- | src/rgb_xyz.cc | 50 | ||||
| -rw-r--r-- | src/rgb_xyz.h | 14 | ||||
| -rw-r--r-- | src/stereo_picture_frame.cc | 22 | ||||
| -rw-r--r-- | src/stereo_picture_frame.h | 4 | ||||
| -rw-r--r-- | src/util.cc | 8 | ||||
| -rw-r--r-- | src/util.h | 6 | ||||
| -rw-r--r-- | src/wscript | 8 | ||||
| -rw-r--r-- | src/xyz_image.cc (renamed from src/xyz_frame.cc) | 24 | ||||
| -rw-r--r-- | src/xyz_image.h (renamed from src/xyz_frame.h) | 16 |
14 files changed, 98 insertions, 98 deletions
diff --git a/src/argb_frame.cc b/src/argb_image.cc index 99d6c814..79dcd85a 100644 --- a/src/argb_frame.cc +++ b/src/argb_image.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net> + 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 @@ -17,33 +17,33 @@ */ -/** @file src/argb_frame.cc - * @brief ARGBFrame class. +/** @file src/argb_image.cc + * @brief ARGBImage class. */ -#include "argb_frame.h" +#include "argb_image.h" using namespace dcp; -/** Construct an empty ARGBFrame of a given size and with +/** Construct an empty ARGBImage of a given size and with * undefined contents. * @param size Size in pixels. */ -ARGBFrame::ARGBFrame (Size size) +ARGBImage::ARGBImage (Size size) : _size (size) { _data = new uint8_t[_size.width * _size.height * 4]; } -ARGBFrame::~ARGBFrame () +ARGBImage::~ARGBImage () { delete[] _data; } /** @return The stride, in bytes; that is, the number of bytes per row of the image */ int -ARGBFrame::stride () const +ARGBImage::stride () const { return _size.width * 4; } diff --git a/src/argb_frame.h b/src/argb_image.h index db0d07a9..805d0a22 100644 --- a/src/argb_frame.h +++ b/src/argb_image.h @@ -17,8 +17,8 @@ */ -/** @file src/argb_frame.h - * @brief ARGBFrame class. +/** @file src/argb_image.h + * @brief ARGBImage class. */ #include "util.h" @@ -27,7 +27,7 @@ namespace dcp { -/** @class ARGBFrame +/** @class ARGBImage * @brief A single frame of picture data held in an ARGB buffer. * * The format of the data is: @@ -44,11 +44,11 @@ namespace dcp * * XXX: this should probably be an Image...? */ -class ARGBFrame : boost::noncopyable +class ARGBImage : boost::noncopyable { public: - ARGBFrame (Size size); - ~ARGBFrame (); + ARGBImage (Size size); + ~ARGBImage (); /** @return pointer to the image data */ uint8_t* data () const { diff --git a/src/mono_picture_frame.cc b/src/mono_picture_frame.cc index 563853ba..1edfd411 100644 --- a/src/mono_picture_frame.cc +++ b/src/mono_picture_frame.cc @@ -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), diff --git a/src/mono_picture_frame.h b/src/mono_picture_frame.h index fde918fb..c9183a12 100644 --- a/src/mono_picture_frame.h +++ b/src/mono_picture_frame.h @@ -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 (); diff --git a/src/picture_mxf.cc b/src/picture_mxf.cc index 0991cd50..46aa7752 100644 --- a/src/picture_mxf.cc +++ b/src/picture_mxf.cc @@ -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 */ diff --git a/src/rgb_xyz.cc b/src/rgb_xyz.cc index c5dbcb8f..f44b1a30 100644 --- a/src/rgb_xyz.cc +++ b/src/rgb_xyz.cc @@ -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) { diff --git a/src/rgb_xyz.h b/src/rgb_xyz.h index 0c998e41..cd0125cb 100644 --- a/src/rgb_xyz.h +++ b/src/rgb_xyz.h @@ -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 @@ -24,19 +24,19 @@ 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>); } diff --git a/src/stereo_picture_frame.cc b/src/stereo_picture_frame.cc index 060e86cc..0eae7583 100644 --- a/src/stereo_picture_frame.cc +++ b/src/stereo_picture_frame.cc @@ -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 * diff --git a/src/stereo_picture_frame.h b/src/stereo_picture_frame.h index d1aa6137..ba78d922 100644 --- a/src/stereo_picture_frame.h +++ b/src/stereo_picture_frame.h @@ -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 (); diff --git a/src/util.cc b/src/util.cc index ac067a76..89b563ae 100644 --- a/src/util.cc +++ b/src/util.cc @@ -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. @@ -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 (); diff --git a/src/wscript b/src/wscript index d6444aee..af7b823e 100644 --- a/src/wscript +++ b/src/wscript @@ -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_image.cc index f1c69491..48ee6ad6 100644 --- a/src/xyz_frame.cc +++ b/src/xyz_image.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net> + 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 @@ -17,27 +17,27 @@ */ -/** @file src/xyz_frame.cc - * @brief XZYFrame class. +/** @file src/xyz_image.cc + * @brief XYZImage class. */ -#include "xyz_frame.h" +#include "xyz_image.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) +/** 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 XYZFrame with undefined contents. +/** Construct a new XYZImage with undefined contents. * @param size Size for the frame in pixels. */ -XYZFrame::XYZFrame (Size size) +XYZImage::XYZImage (Size size) { opj_image_cmptparm_t cmptparm[3]; @@ -65,8 +65,8 @@ XYZFrame::XYZFrame (Size size) _opj_image->y1 = size.height; } -/** XYZFrame destructor */ -XYZFrame::~XYZFrame () +/** XYZImage destructor */ +XYZImage::~XYZImage () { opj_image_destroy (_opj_image); } @@ -75,7 +75,7 @@ XYZFrame::~XYZFrame () * @return Pointer to the data for component c; 12-bit values from 0-4095. */ int * -XYZFrame::data (int c) const +XYZImage::data (int c) const { DCP_ASSERT (c >= 0 && c < 3); return _opj_image->comps[c].data; @@ -83,7 +83,7 @@ XYZFrame::data (int c) const /** @return Size of the image in pixels */ dcp::Size -XYZFrame::size () const +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_frame.h b/src/xyz_image.h index 8ba829b2..6be065e0 100644 --- a/src/xyz_frame.h +++ b/src/xyz_image.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net> + 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 @@ -17,8 +17,8 @@ */ -/** @file src/xyz_frame.h - * @brief XZYFrame class. +/** @file src/xyz_image.h + * @brief XYZImage class. */ #include "util.h" @@ -26,17 +26,17 @@ namespace dcp { -/** @class XYZFrame +/** @class XYZImage * @brief An image in XYZ colour. * * This class is a thin wrapper of libopenjpeg's opj_image_t. */ -class XYZFrame : public boost::noncopyable +class XYZImage : public boost::noncopyable { public: - XYZFrame (opj_image_t *); - XYZFrame (Size); - ~XYZFrame (); + XYZImage (opj_image_t *); + XYZImage (Size); + ~XYZImage (); int* data (int) const; dcp::Size size () const; |
