* @param size Size for the frame in pixels.
*/
OpenJPEGImage::OpenJPEGImage (Size size)
+{
+ create (size);
+}
+
+/** @param data_16 XYZ/RGB image data in packed 16:16:16, 48bpp with
+ * the 2-byte value for each component stored as little-endian.
+ */
+OpenJPEGImage::OpenJPEGImage (uint8_t const * data_16, dcp::Size size, int stride)
+{
+ create (size);
+
+ int jn = 0;
+ for (int y = 0; y < size.height; ++y) {
+ uint16_t const * p = reinterpret_cast<uint16_t const *> (data_16 + y * stride);
+ for (int x = 0; x < size.width; ++x) {
+ /* Truncate 16-bit to 12-bit */
+ _opj_image->comps[0].data[jn] = *p++ >> 4;
+ _opj_image->comps[1].data[jn] = *p++ >> 4;
+ _opj_image->comps[2].data[jn] = *p++ >> 4;
+ ++jn;
+ }
+ }
+}
+
+void
+OpenJPEGImage::create (Size size)
{
opj_image_cmptparm_t cmptparm[3];
explicit OpenJPEGImage (opj_image_t *);
explicit OpenJPEGImage (OpenJPEGImage const & other);
explicit OpenJPEGImage (Size);
+ OpenJPEGImage (uint8_t const * in_16, dcp::Size size, int stride);
~OpenJPEGImage ();
int* data (int) const;
}
private:
+ void create (Size size);
+
opj_image_t* _opj_image; ///< opj_image_t that we are managing
};
return xyz;
}
-
-
-/** @param xyz_16 XYZ image data in packed 16:16:16, 48bpp, 16X, 16Y,
- * 16Z, with the 2-byte value for each X/Y/Z component stored as
- * little-endian.
- */
-shared_ptr<dcp::OpenJPEGImage>
-dcp::xyz_to_xyz (uint8_t const * xyz_16, dcp::Size size, int stride)
-{
- shared_ptr<OpenJPEGImage> xyz_12 (new OpenJPEGImage (size));
-
- int jn = 0;
- for (int y = 0; y < size.height; ++y) {
- uint16_t const * p = reinterpret_cast<uint16_t const *> (xyz_16 + y * stride);
- for (int x = 0; x < size.width; ++x) {
- /* Truncate 16-bit to 12-bit */
- xyz_12->data(0)[jn] = *p++ >> 4;
- xyz_12->data(1)[jn] = *p++ >> 4;
- xyz_12->data(2)[jn] = *p++ >> 4;
- ++jn;
- }
- }
-
- return xyz_12;
-}
boost::optional<NoteHandler> note = boost::optional<NoteHandler> ()
);
-extern boost::shared_ptr<OpenJPEGImage> xyz_to_xyz (uint8_t const * xyz, dcp::Size size, int stride);
-
extern void combined_rgb_to_xyz (ColourConversion const & conversion, double* matrix);
}