Makes j2k_dump focus on parsing j2k codestreams, nothing else.

Avoid processing JP2 PCLR, CMAP, CDEF boxes and J2K packets in j2k_dump.
Fixes #595
This commit is contained in:
Antonin Descampe 2015-09-23 17:48:30 +02:00
parent 5e3fae7f48
commit 32b04ad49d
2 changed files with 9 additions and 2 deletions

View File

@ -359,6 +359,11 @@ int main(int argc, char *argv[])
return 1;
}
/* j2k_dump focuses on j2k codestream and skips JP2 boxes */
parameters.flags = 1;
/* j2k_dump shall not actually decode packets (parsing codestream is enough). */
parameters.cp_limit_decoding = DECODE_ALL_BUT_PACKETS;
/* Initialize reading of directory */
if(img_fol.set_imgdir==1){
num_images=get_num_images(img_fol.imgdirpath);
@ -454,7 +459,7 @@ int main(int argc, char *argv[])
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
/* decode the stream and fill the image structure */
if (*indexfilename) /* If need to extract codestream information*/
if (*indexfilename) /* If need to extract codestream information*/
image = opj_decode_with_info(dinfo, cio, &cstr_info);
else
image = opj_decode(dinfo, cio);
@ -503,7 +508,7 @@ int main(int argc, char *argv[])
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
/* decode the stream and fill the image structure */
if (*indexfilename) /* If need to extract codestream information*/
if (*indexfilename) /* If need to extract codestream information*/
image = opj_decode_with_info(dinfo, cio, &cstr_info);
else
image = opj_decode(dinfo, cio);

View File

@ -1726,6 +1726,8 @@ static void j2k_read_eoc(opj_j2k_t *j2k) {
}
/* if packets should not be decoded */
else {
opj_event_msg(j2k->cinfo, EVT_INFO, "Codestream parsing complete.\n");
opj_event_msg(j2k->cinfo, EVT_INFO, "Skipped actual packet decoding.\n");
for (i = 0; i < j2k->cp->tileno_size; i++) {
tileno = j2k->cp->tileno[i];
opj_free(j2k->tile_data[tileno]);