fixed a few bugs
This commit is contained in:
parent
1a8f929111
commit
6347686385
|
@ -1547,7 +1547,7 @@ OPJ_FLOAT64 opj_clock(void) {
|
||||||
/* cout << "freq = " << ((double) freq.QuadPart) << endl; */
|
/* cout << "freq = " << ((double) freq.QuadPart) << endl; */
|
||||||
/* t is the high resolution performance counter (see MSDN) */
|
/* t is the high resolution performance counter (see MSDN) */
|
||||||
QueryPerformanceCounter ( & t ) ;
|
QueryPerformanceCounter ( & t ) ;
|
||||||
return ( t.QuadPart /(OPJ_FLOAT64) freq.QuadPart ) ;
|
return freq.QuadPart ? ( t.QuadPart /(OPJ_FLOAT64) freq.QuadPart ) : 0 ;
|
||||||
#else
|
#else
|
||||||
/* Unix or Linux: use resource usage */
|
/* Unix or Linux: use resource usage */
|
||||||
struct rusage t;
|
struct rusage t;
|
||||||
|
@ -1871,8 +1871,9 @@ int main(int argc, char **argv) {
|
||||||
if(raw_cp.rawComps) free(raw_cp.rawComps);
|
if(raw_cp.rawComps) free(raw_cp.rawComps);
|
||||||
|
|
||||||
t = opj_clock() - t;
|
t = opj_clock() - t;
|
||||||
|
if (num_compressed_files)
|
||||||
fprintf(stdout, "encode time: %d ms \n", (int)((t * 1000)/num_compressed_files));
|
fprintf(stdout, "encode time: %d ms \n", (int)((t * 1000)/num_compressed_files));
|
||||||
scanf("%d");
|
//getch());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -852,7 +852,7 @@ OPJ_FLOAT64 opj_clock(void) {
|
||||||
/* cout << "freq = " << ((double) freq.QuadPart) << endl; */
|
/* cout << "freq = " << ((double) freq.QuadPart) << endl; */
|
||||||
/* t is the high resolution performance counter (see MSDN) */
|
/* t is the high resolution performance counter (see MSDN) */
|
||||||
QueryPerformanceCounter ( & t ) ;
|
QueryPerformanceCounter ( & t ) ;
|
||||||
return ( t.QuadPart /(OPJ_FLOAT64) freq.QuadPart ) ;
|
return freq.QuadPart ? (t.QuadPart / (OPJ_FLOAT64)freq.QuadPart) : 0;
|
||||||
#else
|
#else
|
||||||
/* Unix or Linux: use resource usage */
|
/* Unix or Linux: use resource usage */
|
||||||
struct rusage t;
|
struct rusage t;
|
||||||
|
@ -1535,8 +1535,9 @@ int main(int argc, char **argv)
|
||||||
if(failed) remove(parameters.outfile);
|
if(failed) remove(parameters.outfile);
|
||||||
}
|
}
|
||||||
destroy_parameters(¶meters);
|
destroy_parameters(¶meters);
|
||||||
|
if (numDecompressedImages)
|
||||||
fprintf(stdout, "decode time: %d ms \n", (int)( (tCumulative * 1000) / numDecompressedImages));
|
fprintf(stdout, "decode time: %d ms \n", (int)( (tCumulative * 1000) / numDecompressedImages));
|
||||||
scanf("%d");
|
//getch();
|
||||||
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
|
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
/*end main*/
|
/*end main*/
|
||||||
|
|
|
@ -118,8 +118,30 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* MSVC before 2013 and Borland C do not have lrintf */
|
/* MSVC before 2013 and Borland C do not have lrintf */
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
#if defined(_MSC_VER)
|
||||||
|
#include <intrin.h>
|
||||||
|
static INLINE long lrintf(float f){
|
||||||
|
#ifdef _M_X64
|
||||||
|
return _mm_cvt_ss2si(_mm_load_ss(&f));
|
||||||
|
|
||||||
|
// commented out line breaks many tests
|
||||||
|
///return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
|
||||||
|
#else
|
||||||
|
int i;
|
||||||
|
_asm{
|
||||||
|
fld f
|
||||||
|
fistp i
|
||||||
|
};
|
||||||
|
|
||||||
|
return i;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__BORLANDC__)
|
||||||
static INLINE long lrintf(float f) {
|
static INLINE long lrintf(float f) {
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
|
return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
|
||||||
|
@ -136,6 +158,8 @@ static INLINE long lrintf(float f){
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1400)
|
#if defined(_MSC_VER) && (_MSC_VER < 1400)
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue