diff options
author | Nicolas Pena <npm@chromium.org> | 2017-09-01 13:25:16 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-05 14:10:37 +0000 |
commit | 088ca03f25fe1f6d75c0ff3b71e0ad3d018a5e0c (patch) | |
tree | 27f55db27d9112910d9219efa58474a0c2bd9b52 /third_party/libopenjpeg20/opj_clock.c | |
parent | 740bcd892d22136873b2b123b94e51bf6e77b8f9 (diff) | |
download | pdfium-088ca03f25fe1f6d75c0ff3b71e0ad3d018a5e0c.tar.xz |
Upgrade OpenJPEG to 2.2.0
This CL upgrades OpenJPEG by copying the files from 2.2.0 and then applying
patches. Patch files that are no longer relevant are deleted. The relevant
ones are applied manually due to changes in formatting in OpenJPEG. Patch 34
is added to account for opj_malloc changes in PDFium.
Bug: chromium:718731
Change-Id: I3d316893eab5e235c9f71222a6818b8ae0c98383
Reviewed-on: https://pdfium-review.googlesource.com/12770
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'third_party/libopenjpeg20/opj_clock.c')
-rw-r--r-- | third_party/libopenjpeg20/opj_clock.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/third_party/libopenjpeg20/opj_clock.c b/third_party/libopenjpeg20/opj_clock.c index 0df99ef04d..24f79a9ae7 100644 --- a/third_party/libopenjpeg20/opj_clock.c +++ b/third_party/libopenjpeg20/opj_clock.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. * @@ -29,6 +29,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "opj_includes.h" + #ifdef _WIN32 #include <windows.h> #else @@ -36,29 +38,30 @@ #include <sys/resource.h> #include <sys/times.h> #endif /* _WIN32 */ -#include "opj_includes.h" -OPJ_FLOAT64 opj_clock(void) { +OPJ_FLOAT64 opj_clock(void) +{ #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 /(OPJ_FLOAT64) freq.QuadPart ) ; + QueryPerformanceCounter(& t) ; + return ((OPJ_FLOAT64) t.QuadPart / (OPJ_FLOAT64) freq.QuadPart) ; #else - /* Unix or Linux: use resource usage */ + /* Unix or Linux: use resource usage */ struct rusage t; OPJ_FLOAT64 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 = (OPJ_FLOAT64)(t.ru_utime.tv_sec + t.ru_stime.tv_sec); /* (2b) More precisely! Get the microseconds part ! */ - return ( procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6 ) ; + return (procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) * + 1e-6) ; #endif } |