Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-07-12 18:38:26 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-07-12 18:38:26 +0300
commit5fae2503bf7d81b89f68f4c494f4c0e4c9eb5f46 (patch)
tree9b37773884e020430093b429c4fba4ff7b04481f /extern/libopenjpeg/j2k_lib.c
parent51b274a6be5d59c7009fd3f439821d1e15b72709 (diff)
Revert "OpenJPEG: update to 2.1 from 1.5"
This reverts commit f12204196fb1ee985ab9745cf9c70877601145f9. Campbell, sorry. have to revert this for the time being. We've missed some very important bits, such as: - FFmpeg is usually linked against OpenJPEG - OIIO needs OpenJPEG as well. For FFmpeg issues we can either disable OpenJPEG there (since we don't really use it), or bump FFmpeg to version 3.1.1 which can use either of OpenJPEG 1.5 or 2.1. For OIIO we do need OpenJPEG support (otherwise Cycles will not be able to use j2k/j2c textures) and currently there is NO solution to make OIIO working with OpenJPEG 2.1. According to Matthias Fauconneau (aka mfv) Larry is working on the patch to get OIIO work with OpenJPEG 2.1, but it'll take some time still. I've tried to look into support of some sort of build system flag and do ifdefs, but it all becomes quite nasty, especially with bundled OpenJPEG bumped to 2.1. Surely such an update is something we'll have to apply to but at this exact moment it causes quite some pain for all developers. Suggest to wait for until OIIO supports OpenJPEG 2.1 and then go with the updates for real.
Diffstat (limited to 'extern/libopenjpeg/j2k_lib.c')
-rw-r--r--extern/libopenjpeg/j2k_lib.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/extern/libopenjpeg/j2k_lib.c b/extern/libopenjpeg/j2k_lib.c
new file mode 100644
index 00000000000..a66e31e9afb
--- /dev/null
+++ b/extern/libopenjpeg/j2k_lib.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2005, Herve Drolon, FreeImage Team
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/times.h>
+#endif /* _WIN32 */
+#include "opj_includes.h"
+
+double opj_clock(void) {
+#ifdef _WIN32
+ /* _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; */
+ /* t is the high resolution performance counter (see MSDN) */
+ QueryPerformanceCounter ( & t ) ;
+ return ( t.QuadPart /(double) freq.QuadPart ) ;
+#else
+ /* 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);
+ /* (2) What is the elapsed time ? - CPU time = User time + System time */
+ /* (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 ) ;
+#endif
+}
+