Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Unified Diff: java/org/libjpegturbo/turbojpeg/TJLoader.java.tmpl

Issue 1934113002: Update libjpeg_turbo to 1.4.90 from https://github.com/libjpeg-turbo/ (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: java/org/libjpegturbo/turbojpeg/TJLoader.java.tmpl
diff --git a/tjutil.c b/java/org/libjpegturbo/turbojpeg/TJLoader.java.tmpl
similarity index 59%
copy from tjutil.c
copy to java/org/libjpegturbo/turbojpeg/TJLoader.java.tmpl
index 6618d158cf72965886fca304b337a068aa339e83..5ef31182b8be15d07a43f992b728433fc11f46c4 100644
--- a/tjutil.c
+++ b/java/org/libjpegturbo/turbojpeg/TJLoader.java.tmpl
@@ -1,5 +1,5 @@
/*
- * Copyright (C)2011 D. R. Commander. All Rights Reserved.
+ * Copyright (C)2011-2013 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -26,41 +26,34 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef _WIN32
-
-#include <windows.h>
-
-static double getfreq(void)
-{
- LARGE_INTEGER freq;
- if(!QueryPerformanceFrequency(&freq)) return 0.0;
- return (double)freq.QuadPart;
-}
-
-static double f=-1.0;
-
-double gettime(void)
-{
- LARGE_INTEGER t;
- if(f<0.0) f=getfreq();
- if(f==0.0) return (double)GetTickCount()/1000.;
- else
- {
- QueryPerformanceCounter(&t);
- return (double)t.QuadPart/f;
- }
+package org.libjpegturbo.turbojpeg;
+
+final class TJLoader {
+ static void load() {
+ try {
+ System.loadLibrary("turbojpeg");
+ } catch (java.lang.UnsatisfiedLinkError e) {
+ String os = System.getProperty("os.name").toLowerCase();
+ if (os.indexOf("mac") >= 0) {
+ try {
+ System.load("%{__libdir}/libturbojpeg.jnilib");
+ } catch (java.lang.UnsatisfiedLinkError e2) {
+ System.load("/usr/lib/libturbojpeg.jnilib");
+ }
+ } else {
+ try {
+ System.load("%{__libdir}/libturbojpeg.so");
+ } catch (java.lang.UnsatisfiedLinkError e3) {
+ String libdir = "%{__libdir}";
+ if (libdir.equals("/opt/libjpeg-turbo/lib64")) {
+ System.load("/opt/libjpeg-turbo/lib32/libturbojpeg.so");
+ } else if (libdir.equals("/opt/libjpeg-turbo/lib32")) {
+ System.load("/opt/libjpeg-turbo/lib64/libturbojpeg.so");
+ } else {
+ throw e3;
+ }
+ }
+ }
+ }
+ }
}
-
-#else
-
-#include <stdlib.h>
-#include <sys/time.h>
-
-double gettime(void)
-{
- struct timeval tv;
- if(gettimeofday(&tv, NULL)<0) return 0.0;
- else return (double)tv.tv_sec+((double)tv.tv_usec/1000000.);
-}
-
-#endif

Powered by Google App Engine
This is Rietveld 408576698