Change opj_decompress back to strict mode.

This commit is contained in:
Robert G. Jakabosky 2022-01-30 00:18:32 +08:00
parent 12aef962f2
commit 3db5f0e48c
No known key found for this signature in database
GPG Key ID: 0C38AF433FE0B1C0
1 changed files with 9 additions and 9 deletions

View File

@ -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 <num_threads|ALL_CPUS>\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;