[1.5] fix issue #104
This commit is contained in:
parent
d3c1a49246
commit
ba01e855a3
|
@ -680,7 +680,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);
|
jp2_read_boxhdr(cinfo, cio, &box);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(box.type == JP2_CDEF)
|
if(box.type == JP2_CDEF && !jp2->ignore_pclr_cmap_cdef)
|
||||||
{
|
{
|
||||||
if( !jp2_read_cdef(jp2, cio, &box, color))
|
if( !jp2_read_cdef(jp2, cio, &box, color))
|
||||||
{
|
{
|
||||||
|
@ -690,7 +690,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);
|
jp2_read_boxhdr(cinfo, cio, &box);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(box.type == JP2_PCLR)
|
if(box.type == JP2_PCLR && !jp2->ignore_pclr_cmap_cdef)
|
||||||
{
|
{
|
||||||
if( !jp2_read_pclr(jp2, cio, &box, color))
|
if( !jp2_read_pclr(jp2, cio, &box, color))
|
||||||
{
|
{
|
||||||
|
@ -700,7 +700,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);
|
jp2_read_boxhdr(cinfo, cio, &box);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(box.type == JP2_CMAP)
|
if(box.type == JP2_CMAP && !jp2->ignore_pclr_cmap_cdef)
|
||||||
{
|
{
|
||||||
if( !jp2_read_cmap(jp2, cio, &box, color))
|
if( !jp2_read_cmap(jp2, cio, &box, color))
|
||||||
{
|
{
|
||||||
|
@ -754,8 +754,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");
|
opj_event_msg(cinfo, EVT_ERROR, "Failed to decode J2K image\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!jp2->ignore_pclr_cmap_cdef){
|
||||||
|
|
||||||
/* Set Image Color Space */
|
/* Set Image Color Space */
|
||||||
if (jp2->enumcs == 16)
|
if (jp2->enumcs == 16)
|
||||||
image->color_space = CLRSPC_SRGB;
|
image->color_space = CLRSPC_SRGB;
|
||||||
else if (jp2->enumcs == 17)
|
else if (jp2->enumcs == 17)
|
||||||
|
@ -783,6 +785,8 @@ opj_image_t* opj_jp2_decode(opj_jp2_t *jp2, opj_cio_t *cio,
|
||||||
color.icc_profile_buf = NULL;
|
color.icc_profile_buf = NULL;
|
||||||
image->icc_profile_len = color.icc_profile_len;
|
image->icc_profile_len = color.icc_profile_len;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|
||||||
}/* opj_jp2_decode() */
|
}/* opj_jp2_decode() */
|
||||||
|
@ -1056,6 +1060,7 @@ void jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters) {
|
||||||
/* setup the J2K codec */
|
/* setup the J2K codec */
|
||||||
j2k_setup_decoder(jp2->j2k, parameters);
|
j2k_setup_decoder(jp2->j2k, parameters);
|
||||||
/* further JP2 initializations go here */
|
/* further JP2 initializations go here */
|
||||||
|
jp2->ignore_pclr_cmap_cdef = parameters->flags & OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
|
@ -141,6 +141,7 @@ typedef struct opj_jp2 {
|
||||||
unsigned int j2k_codestream_offset;
|
unsigned int j2k_codestream_offset;
|
||||||
unsigned int j2k_codestream_length;
|
unsigned int j2k_codestream_length;
|
||||||
opj_bool jpip_on;
|
opj_bool jpip_on;
|
||||||
|
opj_bool ignore_pclr_cmap_cdef;
|
||||||
} opj_jp2_t;
|
} opj_jp2_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -125,6 +125,7 @@ void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *paramete
|
||||||
|
|
||||||
parameters->decod_format = -1;
|
parameters->decod_format = -1;
|
||||||
parameters->cod_format = -1;
|
parameters->cod_format = -1;
|
||||||
|
parameters->flags = 0;
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
parameters->jpwl_correct = OPJ_FALSE;
|
parameters->jpwl_correct = OPJ_FALSE;
|
||||||
|
|
|
@ -351,6 +351,8 @@ typedef struct opj_cparameters {
|
||||||
opj_bool jpip_on;
|
opj_bool jpip_on;
|
||||||
} opj_cparameters_t;
|
} opj_cparameters_t;
|
||||||
|
|
||||||
|
#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Decompression parameters
|
Decompression parameters
|
||||||
*/
|
*/
|
||||||
|
@ -403,6 +405,7 @@ typedef struct opj_dparameters {
|
||||||
*/
|
*/
|
||||||
OPJ_LIMIT_DECODING cp_limit_decoding;
|
OPJ_LIMIT_DECODING cp_limit_decoding;
|
||||||
|
|
||||||
|
unsigned int flags;
|
||||||
} opj_dparameters_t;
|
} opj_dparameters_t;
|
||||||
|
|
||||||
/** Common fields between JPEG-2000 compression and decompression master structs. */
|
/** Common fields between JPEG-2000 compression and decompression master structs. */
|
||||||
|
|
Loading…
Reference in New Issue