49 #ifdef LIBDCP_OPENJPEG1
50 #define OPJ_CLRSPC_SRGB CLRSPC_SRGB
61 #ifdef LIBDCP_OPENJPEG1
62 typedef int32_t OPJ_INT32;
63 typedef uint8_t OPJ_BYTE;
69 _opj_image =
reinterpret_cast<opj_image_t*
>(malloc(
sizeof(opj_image_t)));
75 _opj_image->comps =
reinterpret_cast<opj_image_comp_t*
> (malloc (
_opj_image->numcomps * sizeof (opj_image_comp_t)));
78 for (
unsigned int i = 0; i <
_opj_image->numcomps; ++i) {
79 _opj_image->comps[i].data =
reinterpret_cast<OPJ_INT32*
> (malloc (data_size));
84 _opj_image->icc_profile_buf =
reinterpret_cast<OPJ_BYTE*
> (malloc (
_opj_image->icc_profile_len));
101 for (
int y = 0; y <
size.height; ++y) {
102 uint16_t
const * p =
reinterpret_cast<uint16_t
const *
> (data_16 + y * stride);
103 for (
int x = 0; x <
size.width; ++x) {
115 OpenJPEGImage::create (
Size size)
117 opj_image_cmptparm_t cmptparm[3];
119 for (
int i = 0; i < 3; ++i) {
122 cmptparm[i].w =
size.width;
123 cmptparm[i].h =
size.height;
126 cmptparm[i].prec = 12;
127 cmptparm[i].bpp = 12;
128 cmptparm[i].sgnd = 0;
132 _opj_image = opj_image_create (3, &cmptparm[0], OPJ_CLRSPC_SRGB);
134 throw std::runtime_error (
"could not create libopenjpeg image");
144 OpenJPEGImage::~OpenJPEGImage ()
153 DCP_ASSERT (c >= 0 && c < 3);
167 OpenJPEGImage::precision (
int component)
const
174 OpenJPEGImage::factor (
int component)
const
181 OpenJPEGImage::srgb ()
const
183 return _opj_image->color_space == OPJ_CLRSPC_SRGB;
A wrapper of libopenjpeg's opj_image_t.
opj_image_t * _opj_image
opj_image_t that we are managing
OpenJPEGImage(opj_image_t *)
Namespace for everything in libdcp.
The integer, two-dimensional size of something.