fprintf(stdout, " -threads <num_threads>\n"
" Number of threads to use for decoding.\n");
}
+ fprintf(stdout, " -quiet\n"
+ " Disable output from the library and other output.\n");
/* UniPG>> */
#ifdef USE_JPWL
fprintf(stdout, " -W <options>\n"
/* cout << "freq = " << ((double) freq.QuadPart) << endl; */
/* t is the high resolution performance counter (see MSDN) */
QueryPerformanceCounter(& t) ;
- return freq.QuadPart ? (t.QuadPart / (OPJ_FLOAT64)freq.QuadPart) : 0;
+ return freq.QuadPart ? ((OPJ_FLOAT64)t.QuadPart / (OPJ_FLOAT64)freq.QuadPart) :
+ 0;
#elif defined(__linux)
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
*/
static void quiet_callback(const char *msg, void *client_data)
{
+ (void)msg;
+ (void)client_data;
}
static void set_default_parameters(opj_decompress_parameters* parameters)
/*Decoding image one by one*/
for (imageno = 0; imageno < num_images ; imageno++) {
- fprintf(stderr, "\n");
+ if (!parameters.quiet) {
+ fprintf(stderr, "\n");
+ }
if (img_fol.set_imgdir == 1) {
if (get_next_file(imageno, dirptr, &img_fol, ¶meters)) {
}
}
+ /* FIXME? Shouldn't that situation be considered as an error of */
+ /* opj_decode() / opj_get_decoded_tile() ? */
+ if (image->comps[0].data == NULL) {
+ fprintf(stderr, "ERROR -> opj_decompress: no image data!\n");
+ opj_destroy_codec(l_codec);
+ opj_stream_destroy(l_stream);
+ opj_image_destroy(image);
+ failed = 1;
+ goto fin;
+ }
+
tCumulative += opj_clock() - t;
numDecompressedImages++;
}
free(dirptr);
}
- if (numDecompressedImages && !(parameters.quiet)) {
+ if (numDecompressedImages && !failed && !(parameters.quiet)) {
fprintf(stdout, "decode time: %d ms\n",
(int)((tCumulative * 1000.0) / (OPJ_FLOAT64)numDecompressedImages));
}