diff options
| author | Antonin Descampe <antonin@gmail.com> | 2014-10-30 18:26:10 +0000 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2014-10-30 18:26:10 +0000 |
| commit | 3b7dced8e66418ab90c1f7398fc36453e834f4dc (patch) | |
| tree | a1bab59d3d2616acb00940c6caa37aa6c7ebbed8 /src/lib | |
| parent | 03a410e03d242e135d5de0bf82a61adc0e5ff853 (diff) | |
[trunk] fixed a bug preventing palette image with cdef to decode properly (fixes issue 412)
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/openjp2/jp2.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c index 7d15e368..bce8813c 100644 --- a/src/lib/openjp2/jp2.c +++ b/src/lib/openjp2/jp2.c @@ -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++) { - if (info[i].cn >= image->numcomps) { - opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n", 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, nr_channels); return OPJ_FALSE; } - if (info[i].asoc > 0 && (OPJ_UINT32)(info[i].asoc - 1) >= image->numcomps) { - opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n", 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, nr_channels); return OPJ_FALSE; } } @@ -1357,11 +1357,6 @@ OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2, else 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) { /* Part 1, I.5.3.4: Either both or none : */ 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)); } + /* 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) { p_image->icc_profile_buf = jp2->color.icc_profile_buf; p_image->icc_profile_len = jp2->color.icc_profile_len; |
