diff options
Diffstat (limited to 'src/lib/openjp3d/jp3d_lib.c')
| -rw-r--r-- | src/lib/openjp3d/jp3d_lib.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/src/lib/openjp3d/jp3d_lib.c b/src/lib/openjp3d/jp3d_lib.c index 03bd3955..bccb3fbc 100644 --- a/src/lib/openjp3d/jp3d_lib.c +++ b/src/lib/openjp3d/jp3d_lib.c @@ -1,6 +1,6 @@ /* - * The copyright in this software is being made available under the 2-clauses - * BSD License, included below. This software may be subject to other third + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * @@ -38,44 +38,48 @@ #endif /* _WIN32 */ #include "opj_includes.h" -double opj_clock() { +double opj_clock() +{ #ifdef _WIN32 - /* WIN32: use QueryPerformance (very accurate) */ - LARGE_INTEGER freq , t ; + /* WIN32: use QueryPerformance (very accurate) */ + LARGE_INTEGER freq, t ; /* freq is the clock speed of the CPU */ QueryPerformanceFrequency(&freq) ; - /* cout << "freq = " << ((double) freq.QuadPart) << endl; */ + /* cout << "freq = " << ((double) freq.QuadPart) << endl; */ /* t is the high resolution performance counter (see MSDN) */ - QueryPerformanceCounter ( & t ) ; - return ( t.QuadPart /(double) freq.QuadPart ) ; + QueryPerformanceCounter(& t) ; + return (t.QuadPart / (double) freq.QuadPart) ; #else - /* Unix or Linux: use resource usage */ + /* Unix or Linux: use resource usage */ struct rusage t; double procTime; /* (1) Get the rusage data structure at this moment (man getrusage) */ - getrusage(0,&t); + getrusage(0, &t); /* (2) What is the elapsed time ? - CPU time = User time + System time */ - /* (2a) Get the seconds */ + /* (2a) Get the seconds */ procTime = t.ru_utime.tv_sec + t.ru_stime.tv_sec; /* (2b) More precisely! Get the microseconds part ! */ - return ( procTime + (t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6 ) ; + return (procTime + (t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6) ; #endif /* _WIN32 */ } -void* opj_malloc( size_t size ) { - void *memblock = malloc(size); - if(memblock) { - memset(memblock, 0, size); - } - return memblock; +void* opj_malloc(size_t size) +{ + void *memblock = malloc(size); + if (memblock) { + memset(memblock, 0, size); + } + return memblock; } -void* opj_realloc( void *memblock, size_t size ) { - return realloc(memblock, size); +void* opj_realloc(void *memblock, size_t size) +{ + return realloc(memblock, size); } -void opj_free( void *memblock ) { - free(memblock); +void opj_free(void *memblock) +{ + free(memblock); } |
