[trunk] Import patch from issue 218. No dataset to check, so blindly applied it.

Fixes issue 218
This commit is contained in:
Mathieu Malaterre 2014-02-27 17:21:00 +00:00
parent 6a6fa7027a
commit a347262468

View File

@ -823,6 +823,7 @@ static OPJ_BOOL opj_jp2_check_color(opj_image_t *image, opj_jp2_color_t *color,
return OPJ_TRUE;
}
// file9.jp2
void opj_jp2_apply_pclr(opj_image_t *image, opj_jp2_color_t *color)
{
opj_image_comp_t *old_comps, *new_comps;
@ -1076,7 +1077,8 @@ void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color)
for(i = 0; i < n; ++i)
{
/* WATCH: acn = asoc - 1 ! */
if((asoc = info[i].asoc) == 0)
asoc = info[i].asoc;
if(asoc == 0 || asoc == 65535)
{
if (i < image->numcomps)
image->comps[i].alpha = info[i].typ;
@ -1085,6 +1087,11 @@ void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color)
cn = info[i].cn;
acn = asoc - 1;
if( cn >= image->numcomps || acn >= image->numcomps )
{
fprintf(stderr, "cn=%d, acn=%d, numcomps=%d\n", cn, acn, image->numcomps);
continue;
}
if(cn != acn)
{