[trunk] merge rev 1333 from 1.5 to trunk

This commit is contained in:
Mathieu Malaterre 2012-03-02 14:19:44 +00:00
parent 24d7f54662
commit d28e8f537a
4 changed files with 14 additions and 4 deletions

View File

@ -1374,7 +1374,7 @@ opj_bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color)
jp2_read_boxhdr(cinfo, cio, &box);
continue;
}
if(box.type == JP2_CDEF)
if(box.type == JP2_CDEF && !jp2->ignore_pclr_cmap_cdef)
{
if( !jp2_read_cdef(jp2, cio, &box, color))
{
@ -1384,7 +1384,7 @@ opj_bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color)
jp2_read_boxhdr(cinfo, cio, &box);
continue;
}
if(box.type == JP2_PCLR)
if(box.type == JP2_PCLR && !jp2->ignore_pclr_cmap_cdef)
{
if( !jp2_read_pclr(jp2, cio, &box, color))
{
@ -1394,7 +1394,7 @@ opj_bool jp2_read_jp2h(opj_jp2_t *jp2, opj_cio_t *cio, opj_jp2_color_t *color)
jp2_read_boxhdr(cinfo, cio, &box);
continue;
}
if(box.type == JP2_CMAP)
if(box.type == JP2_CMAP && !jp2->ignore_pclr_cmap_cdef)
{
if( !jp2_read_cmap(jp2, cio, &box, color))
{
@ -1448,8 +1448,10 @@ opj_image_t* opj_jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio,
opj_event_msg(cinfo, EVT_ERROR, "Failed to decode J2K image\n");
return NULL;
}
if (!jp2->ignore_pclr_cmap_cdef){
/* Set Image Color Space */
/* Set Image Color Space */
if (jp2->enumcs == 16)
image->color_space = CLRSPC_SRGB;
else if (jp2->enumcs == 17)
@ -1477,6 +1479,8 @@ opj_image_t* opj_jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio,
color.icc_profile_buf = NULL;
image->icc_profile_len = color.icc_profile_len;
}
}
return image;
}/* opj_jp2_decode() */
@ -1796,6 +1800,7 @@ void jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters) {
/* setup the J2K codec */
j2k_setup_decoder(jp2->j2k, parameters);
/* further JP2 initializations go here */
jp2->ignore_pclr_cmap_cdef = parameters->flags & OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
}
void jp2_setup_decoder_v2(opj_jp2_v2_t *jp2, opj_dparameters_t *parameters)

View File

@ -175,6 +175,7 @@ typedef struct opj_jp2 {
unsigned int j2k_codestream_offset;
unsigned int j2k_codestream_length;
opj_bool jpip_on;
opj_bool ignore_pclr_cmap_cdef;
} opj_jp2_t;
/**

View File

@ -418,6 +418,7 @@ void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *paramete
parameters->decod_format = -1;
parameters->cod_format = -1;
parameters->flags = 0;
/* UniPG>> */
#ifdef USE_JPWL
parameters->jpwl_correct = OPJ_FALSE;

View File

@ -419,6 +419,8 @@ typedef struct opj_cparameters {
opj_bool jpip_on;
} opj_cparameters_t;
#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001
/**
* Decompression parameters
* */
@ -488,6 +490,7 @@ typedef struct opj_dparameters {
*/
OPJ_LIMIT_DECODING cp_limit_decoding;
unsigned int flags;
} opj_dparameters_t;