diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index 57721fbb..7b784fc7 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -153,8 +153,8 @@ typedef struct opj_decompress_params { int num_threads; /* Quiet */ int quiet; - /* Strict decoding mode */ - int strict; + /* Allow partial decode */ + int allow_partial; /** number of components to decode */ OPJ_UINT32 numcomps; /** indices of components to decode */ @@ -248,8 +248,8 @@ static void decode_help_display(void) fprintf(stdout, " -threads \n" " Number of threads to use for decoding or ALL_CPUS for all available cores.\n"); } - fprintf(stdout, " -strict\n" - " Enable strict decoding mode.\n"); + fprintf(stdout, " -allow-partial\n" + " Disable strict mode to allow decoding partial codestreams.\n"); fprintf(stdout, " -quiet\n" " Disable output from the library and other output.\n"); /* UniPG>> */ @@ -605,7 +605,7 @@ int parse_cmdline_decoder(int argc, char **argv, {"split-pnm", NO_ARG, NULL, 1}, {"threads", REQ_ARG, NULL, 'T'}, {"quiet", NO_ARG, NULL, 1}, - {"strict", NO_ARG, NULL, 1}, + {"allow-partial", NO_ARG, NULL, 1}, }; const char optlist[] = "i:o:r:l:x:d:t:p:c:" @@ -621,7 +621,7 @@ int parse_cmdline_decoder(int argc, char **argv, long_option[3].flag = &(parameters->upsample); long_option[4].flag = &(parameters->split_pnm); long_option[6].flag = &(parameters->quiet); - long_option[7].flag = &(parameters->strict); + long_option[7].flag = &(parameters->allow_partial); totlen = sizeof(long_option); opj_reset_options_reading(); img_fol->set_out_format = 0; @@ -1497,9 +1497,9 @@ int main(int argc, char **argv) goto fin; } - /* Set strict mode. */ - if (!opj_decoder_set_strict_mode(l_codec, parameters.strict)) { - fprintf(stderr, "ERROR -> opj_decompress: failed to set strict mode\n"); + /* Disable strict mode if we want to decode partial codestreams. */ + if (parameters.allow_partial && !opj_decoder_set_strict_mode(l_codec, OPJ_FALSE)) { + fprintf(stderr, "ERROR -> opj_decompress: failed to disable strict mode\n"); opj_stream_destroy(l_stream); opj_destroy_codec(l_codec); failed = 1;