58 _opj_image =
reinterpret_cast<opj_image_t*
>(malloc(
sizeof(opj_image_t)));
64 _opj_image->comps =
reinterpret_cast<opj_image_comp_t*
> (malloc (
_opj_image->numcomps * sizeof (opj_image_comp_t)));
67 for (
unsigned int i = 0; i <
_opj_image->numcomps; ++i) {
68 _opj_image->comps[i].data =
reinterpret_cast<OPJ_INT32*
> (malloc (data_size));
73 _opj_image->icc_profile_buf =
reinterpret_cast<OPJ_BYTE*
> (malloc (
_opj_image->icc_profile_len));
90 for (
int y = 0; y <
size.height; ++y) {
91 uint16_t
const * p =
reinterpret_cast<uint16_t
const *
> (data_16 + y * stride);
92 for (
int x = 0; x <
size.width; ++x) {
104 OpenJPEGImage::create (
Size size)
106 opj_image_cmptparm_t cmptparm[3];
108 for (
int i = 0; i < 3; ++i) {
111 cmptparm[i].w =
size.width;
112 cmptparm[i].h =
size.height;
115 cmptparm[i].prec = 12;
116 cmptparm[i].bpp = 12;
117 cmptparm[i].sgnd = 0;
121 _opj_image = opj_image_create (3, &cmptparm[0], OPJ_CLRSPC_SRGB);
123 throw std::runtime_error (
"could not create libopenjpeg image");
133 OpenJPEGImage::~OpenJPEGImage ()
142 DCP_ASSERT (c >= 0 && c < 3);
156 OpenJPEGImage::precision (
int component)
const
163 OpenJPEGImage::factor (
int component)
const
170 OpenJPEGImage::srgb ()
const
172 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.