+ if (parameters.numcomps) {
+ if (! opj_set_decoded_components(l_codec,
+ parameters.numcomps,
+ parameters.comps_indices,
+ OPJ_FALSE)) {
+ fprintf(stderr,
+ "ERROR -> opj_decompress: failed to set the component indices!\n");
+ opj_destroy_codec(l_codec);
+ opj_stream_destroy(l_stream);
+ opj_image_destroy(image);
+ failed = 1;
+ goto fin;
+ }
+ }
+
+ if (getenv("USE_OPJ_SET_DECODED_RESOLUTION_FACTOR") != NULL) {
+ /* For debugging/testing purposes, and also an illustration on how to */
+ /* use the alternative API opj_set_decoded_resolution_factor() instead */
+ /* of setting parameters.cp_reduce */
+ if (! opj_set_decoded_resolution_factor(l_codec, cp_reduce)) {
+ fprintf(stderr,
+ "ERROR -> opj_decompress: failed to set the resolution factor tile!\n");
+ opj_destroy_codec(l_codec);
+ opj_stream_destroy(l_stream);
+ opj_image_destroy(image);
+ failed = 1;
+ goto fin;
+ }
+ }
+