fixed handling of "jp2->meth" value (Restricted ICC profile handling currently not implemented)

This commit is contained in:
Antonin Descampe 2011-07-03 17:56:49 +00:00
parent b09051fd79
commit fa6aea80f5
3 changed files with 19 additions and 24 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed ! : changed
+ : added + : added
July 3, 2011
* [antonin] fixed handling of "jp2->meth" value (Restricted ICC profile handling currently not implemented)
June 30, 2011 June 30, 2011
! [antonin] fixed CTest configuration files ! [antonin] fixed CTest configuration files

View File

@ -289,6 +289,9 @@ void color_apply_icc_profile(opj_image_t *image)
in_prof = in_prof =
cmsOpenProfileFromMem(image->icc_profile_buf, image->icc_profile_len); cmsOpenProfileFromMem(image->icc_profile_buf, image->icc_profile_len);
if(in_prof == NULL) return;
in_space = cmsGetPCS(in_prof); in_space = cmsGetPCS(in_prof);
out_space = cmsGetColorSpace(in_prof); out_space = cmsGetColorSpace(in_prof);
intent = cmsGetHeaderRenderingIntent(in_prof); intent = cmsGetHeaderRenderingIntent(in_prof);

View File

@ -281,11 +281,10 @@ static void jp2_write_colr(opj_jp2_t *jp2, opj_cio_t *cio) {
cio_write(cio, jp2->precedence, 1); /* PRECEDENCE */ cio_write(cio, jp2->precedence, 1); /* PRECEDENCE */
cio_write(cio, jp2->approx, 1); /* APPROX */ cio_write(cio, jp2->approx, 1); /* APPROX */
if (jp2->meth == 1) { if(jp2->meth == 2)
cio_write(cio, jp2->enumcs, 4); /* EnumCS */ jp2->enumcs = 0;
} else {
cio_write(cio, 0, 1); /* PROFILE (??) */ cio_write(cio, jp2->enumcs, 4); /* EnumCS */
}
box.length = cio_tell(cio) - box.init_pos; box.length = cio_tell(cio) - box.init_pos;
cio_seek(cio, box.init_pos); cio_seek(cio, box.init_pos);
@ -557,7 +556,8 @@ static opj_bool jp2_read_colr(opj_jp2_t *jp2, opj_cio_t *cio,
{ {
jp2->enumcs = cio_read(cio, 4); /* EnumCS */ jp2->enumcs = cio_read(cio, 4); /* EnumCS */
} }
else else
if (jp2->meth == 2)
{ {
/* skip PROFILE */ /* skip PROFILE */
skip_len = box->init_pos + box->length - cio_tell(cio); skip_len = box->init_pos + box->length - cio_tell(cio);
@ -1042,24 +1042,13 @@ void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_
for (i = 0; i < image->numcomps; i++) { for (i = 0; i < image->numcomps; i++) {
jp2->comps[i].bpcc = image->comps[i].prec - 1 + (image->comps[i].sgnd << 7); jp2->comps[i].bpcc = image->comps[i].prec - 1 + (image->comps[i].sgnd << 7);
} }
jp2->meth = 1;
/* Colour Specification box */ if (image->color_space == 1)
jp2->enumcs = 16; /* sRGB as defined by IEC 61966-2.1 */
if ((image->numcomps == 1 || image->numcomps == 3) && (jp2->bpc != 255)) { else if (image->color_space == 2)
jp2->meth = 1; /* METH: Enumerated colourspace */ jp2->enumcs = 17; /* greyscale */
} else { else if (image->color_space == 3)
jp2->meth = 2; /* METH: Restricted ICC profile */ jp2->enumcs = 18; /* YUV */
}
if (jp2->meth == 1) {
if (image->color_space == 1)
jp2->enumcs = 16; /* sRGB as defined by IEC 61966-2.1 */
else if (image->color_space == 2)
jp2->enumcs = 17; /* greyscale */
else if (image->color_space == 3)
jp2->enumcs = 18; /* YUV */
} else {
jp2->enumcs = 0; /* PROFILE (??) */
}
jp2->precedence = 0; /* PRECEDENCE */ jp2->precedence = 0; /* PRECEDENCE */
jp2->approx = 0; /* APPROX */ jp2->approx = 0; /* APPROX */