[trunk] fixed a bug preventing palette image with cdef to decode properly (fixes issue 412)
This commit is contained in:
parent
03a410e03d
commit
3b7dced8e6
|
@ -772,12 +772,12 @@ static OPJ_BOOL opj_jp2_check_color(opj_image_t *image, opj_jp2_color_t *color,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (info[i].cn >= image->numcomps) {
|
if (info[i].cn >= nr_channels) {
|
||||||
opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n", info[i].cn, image->numcomps);
|
opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n", info[i].cn, nr_channels);
|
||||||
return OPJ_FALSE;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
if (info[i].asoc > 0 && (OPJ_UINT32)(info[i].asoc - 1) >= image->numcomps) {
|
if (info[i].asoc > 0 && (OPJ_UINT32)(info[i].asoc - 1) >= nr_channels) {
|
||||||
opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n", info[i].asoc - 1, image->numcomps);
|
opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n", info[i].asoc - 1, nr_channels);
|
||||||
return OPJ_FALSE;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1357,11 +1357,6 @@ OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
|
||||||
else
|
else
|
||||||
p_image->color_space = OPJ_CLRSPC_UNKNOWN;
|
p_image->color_space = OPJ_CLRSPC_UNKNOWN;
|
||||||
|
|
||||||
/* Apply the color space if needed */
|
|
||||||
if(jp2->color.jp2_cdef) {
|
|
||||||
opj_jp2_apply_cdef(p_image, &(jp2->color));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(jp2->color.jp2_pclr) {
|
if(jp2->color.jp2_pclr) {
|
||||||
/* Part 1, I.5.3.4: Either both or none : */
|
/* Part 1, I.5.3.4: Either both or none : */
|
||||||
if( !jp2->color.jp2_pclr->cmap)
|
if( !jp2->color.jp2_pclr->cmap)
|
||||||
|
@ -1370,6 +1365,11 @@ OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
|
||||||
opj_jp2_apply_pclr(p_image, &(jp2->color));
|
opj_jp2_apply_pclr(p_image, &(jp2->color));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Apply the color space if needed */
|
||||||
|
if(jp2->color.jp2_cdef) {
|
||||||
|
opj_jp2_apply_cdef(p_image, &(jp2->color));
|
||||||
|
}
|
||||||
|
|
||||||
if(jp2->color.icc_profile_buf) {
|
if(jp2->color.icc_profile_buf) {
|
||||||
p_image->icc_profile_buf = jp2->color.icc_profile_buf;
|
p_image->icc_profile_buf = jp2->color.icc_profile_buf;
|
||||||
p_image->icc_profile_len = jp2->color.icc_profile_len;
|
p_image->icc_profile_len = jp2->color.icc_profile_len;
|
||||||
|
|
Loading…
Reference in New Issue