summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorAaron Boxer <boxerab@gmail.com>2015-06-20 00:01:19 -0400
committerAntonin Descampe <antonin@gmail.com>2015-07-03 15:22:58 +0200
commit63476863856513a5bc3aa40654395977b0f9f9df (patch)
treea30639326713dde90aaddba6c6d76ba9d2aac410 /src/bin
parent1a8f929111d43b44dcc380a7d8fb43500edcfd8a (diff)
fixed a few bugs
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/jp2/opj_compress.c7
-rw-r--r--src/bin/jp2/opj_decompress.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c
index 9ad6175f..ba3bb281 100644
--- a/src/bin/jp2/opj_compress.c
+++ b/src/bin/jp2/opj_compress.c
@@ -1547,7 +1547,7 @@ OPJ_FLOAT64 opj_clock(void) {
/* cout << "freq = " << ((double) freq.QuadPart) << endl; */
/* t is the high resolution performance counter (see MSDN) */
QueryPerformanceCounter ( & t ) ;
- return ( t.QuadPart /(OPJ_FLOAT64) freq.QuadPart ) ;
+ return freq.QuadPart ? ( t.QuadPart /(OPJ_FLOAT64) freq.QuadPart ) : 0 ;
#else
/* Unix or Linux: use resource usage */
struct rusage t;
@@ -1871,8 +1871,9 @@ int main(int argc, char **argv) {
if(raw_cp.rawComps) free(raw_cp.rawComps);
t = opj_clock() - t;
- fprintf(stdout, "encode time: %d ms \n", (int)((t * 1000)/num_compressed_files));
- scanf("%d");
+ if (num_compressed_files)
+ fprintf(stdout, "encode time: %d ms \n", (int)((t * 1000)/num_compressed_files));
+ //getch());
return 0;
}
diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c
index cfc04a9e..c6e5cff8 100644
--- a/src/bin/jp2/opj_decompress.c
+++ b/src/bin/jp2/opj_decompress.c
@@ -852,7 +852,7 @@ OPJ_FLOAT64 opj_clock(void) {
/* cout << "freq = " << ((double) freq.QuadPart) << endl; */
/* t is the high resolution performance counter (see MSDN) */
QueryPerformanceCounter ( & t ) ;
- return ( t.QuadPart /(OPJ_FLOAT64) freq.QuadPart ) ;
+ return freq.QuadPart ? (t.QuadPart / (OPJ_FLOAT64)freq.QuadPart) : 0;
#else
/* Unix or Linux: use resource usage */
struct rusage t;
@@ -1535,8 +1535,9 @@ int main(int argc, char **argv)
if(failed) remove(parameters.outfile);
}
destroy_parameters(&parameters);
- fprintf(stdout, "decode time: %d ms \n", (int)( (tCumulative * 1000) / numDecompressedImages));
- scanf("%d");
+ if (numDecompressedImages)
+ fprintf(stdout, "decode time: %d ms \n", (int)( (tCumulative * 1000) / numDecompressedImages));
+ //getch();
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
}
/*end main*/