48#define OPJ_CLRSPC_GRAY CLRSPC_GRAY
49#define OPJ_CLRSPC_SRGB CLRSPC_SRGB
75 g = y -
qFloor (0.344 *
double (
cb) + 0.714 *
double (
cr));
78 b = y +
qFloor (1.772 *
double (
cb));
79 if(b < 0) b = 0;
else if(b >
upb) b =
upb; *
out_b = b;
85 const int *y, *
cb, *
cr;
95 y =
img->comps[0].data;
96 cb =
img->comps[1].data;
97 cr =
img->comps[2].data;
99 d0 =
r =
static_cast<int*
> (
malloc(
sizeof(
int) *
static_cast<size_t> (
max)));
100 d1 =
g =
static_cast<int*
> (
malloc(
sizeof(
int) *
static_cast<size_t> (
max)));
101 d2 = b =
static_cast<int*
> (
malloc(
sizeof(
int) *
static_cast<size_t> (
max)));
107 ++y; ++
cb; ++
cr; ++
r; ++
g; ++b;
118 const int *y, *
cb, *
cr;
129 y =
img->comps[0].data;
130 cb =
img->comps[1].data;
131 cr =
img->comps[2].data;
133 d0 =
r =
static_cast<int*
> (
malloc(
sizeof(
int) *
static_cast<size_t> (
max)));
134 d1 =
g =
static_cast<int*
> (
malloc(
sizeof(
int) *
static_cast<size_t> (
max)));
135 d2 = b =
static_cast<int*
> (
malloc(
sizeof(
int) *
static_cast<size_t> (
max)));
147 ++y; ++
r; ++
g; ++b; ++
cb; ++
cr;
154#if defined(USE_JPWL) || defined(USE_MJ2)
163 img->comps[1].dx =
img->comps[0].dx;
164 img->comps[2].dx =
img->comps[0].dx;
165 img->comps[1].dy =
img->comps[0].dy;
166 img->comps[2].dy =
img->comps[0].dy;
173 const int *y, *
cb, *
cr, *
ny;
184 y =
img->comps[0].data;
185 cb =
img->comps[1].data;
186 cr =
img->comps[2].data;
188 d0 =
r =
static_cast<int*
> (
malloc(
sizeof(
int) *
static_cast<size_t> (
max)));
189 d1 =
g =
static_cast<int*
> (
malloc(
sizeof(
int) *
static_cast<size_t> (
max)));
190 d2 = b =
static_cast<int*
> (
malloc(
sizeof(
int) *
static_cast<size_t> (
max)));
221#if defined(USE_JPWL) || defined(USE_MJ2)
230 img->comps[1].dx =
img->comps[0].dx;
231 img->comps[2].dx =
img->comps[0].dx;
232 img->comps[1].dy =
img->comps[0].dy;
233 img->comps[2].dy =
img->comps[0].dy;
239 if(
img->numcomps < 3)
245 if((
img->comps[0].dx == 1)
246 && (
img->comps[1].dx == 2)
247 && (
img->comps[2].dx == 2)
248 && (
img->comps[0].dy == 1)
249 && (
img->comps[1].dy == 2)
250 && (
img->comps[2].dy == 2))
255 if((
img->comps[0].dx == 1)
256 && (
img->comps[1].dx == 2)
257 && (
img->comps[2].dx == 2)
258 && (
img->comps[0].dy == 1)
259 && (
img->comps[1].dy == 1)
260 && (
img->comps[2].dy == 1))
265 if((
img->comps[0].dx == 1)
266 && (
img->comps[1].dx == 1)
267 && (
img->comps[2].dx == 1)
268 && (
img->comps[0].dy == 1)
269 && (
img->comps[1].dy == 1)
270 && (
img->comps[2].dy == 1))
276 fprintf(
stderr,
"%s:%d:color_sycc_to_rgb\n\tCAN NOT CONVERT\n",
285#if defined(OPJ_HAVE_LIBLCMS2) || defined(OPJ_HAVE_LIBLCMS1)
286#ifdef OPJ_HAVE_LIBLCMS1
288#define cmsSigXYZData icSigXYZData
289#define cmsSigLabData icSigLabData
290#define cmsSigCmykData icSigCmykData
291#define cmsSigYCbCrData icSigYCbCrData
292#define cmsSigLuvData icSigLuvData
293#define cmsSigGrayData icSigGrayData
294#define cmsSigRgbData icSigRgbData
295#define cmsUInt32Number DWORD
297#define cmsColorSpaceSignature icColorSpaceSignature
298#define cmsGetHeaderRenderingIntent cmsTakeRenderingIntent
369#ifdef OPJ_HAVE_LIBLCMS2
378#ifdef OPJ_HAVE_LIBLCMS1
385 if(image->numcomps > 2)
395 r = image->comps[0].data;
396 g = image->comps[1].data;
397 b = image->comps[2].data;
403 *
in++ = (
unsigned char)*b++;
408 r = image->comps[0].data;
409 g = image->comps[1].data;
410 b = image->comps[2].data;
428 r = image->comps[0].data;
429 g = image->comps[1].data;
430 b = image->comps[2].data;
441 r = image->comps[0].data;
442 g = image->comps[1].data;
443 b = image->comps[2].data;
465 if(image->numcomps == 2)
466 image->comps[3] = image->comps[1];
468 image->comps[1] = image->comps[0];
469 image->comps[2] = image->comps[0];
471 image->comps[1].data = (
int*)
calloc((
size_t)
max,
sizeof(
int));
472 image->comps[2].data = (
int*)
calloc((
size_t)
max,
sizeof(
int));
474 image->numcomps += 2;
476 r = image->comps[0].data;
484 r = image->comps[0].data;
485 g = image->comps[1].data;
486 b = image->comps[2].data;
500#ifdef OPJ_HAVE_LIBLCMS1
const int INNER_RADIUS_MIN
void sycc_to_rgb(int offset, int upb, int y, int cb, int cr, int *out_r, int *out_g, int *out_b)
void color_sycc_to_rgb(opj_image_t *img)
void sycc420_to_rgb(opj_image_t *img)
void sycc444_to_rgb(opj_image_t *img)
void sycc422_to_rgb(opj_image_t *img)
void color_apply_icc_profile(opj_image_t *image)