diff --git a/Engine/OfxEffectInstance.cpp b/Engine/OfxEffectInstance.cpp index b20b0a2d4c..29633f6afd 100644 --- a/Engine/OfxEffectInstance.cpp +++ b/Engine/OfxEffectInstance.cpp @@ -1611,7 +1611,7 @@ OfxEffectInstance::getFramesNeeded(double time, int view) if ( (stat != kOfxStatOK) && (stat != kOfxStatReplyDefault) ) { throw std::runtime_error("getFrameViewsNeeded action failed"); - } else if (stat == kOfxStatOK) { + } else { for (OFX::Host::ImageEffect::ViewsRangeMap::iterator it = inputRanges.begin(); it != inputRanges.end(); ++it) { OfxClipInstance* clip = dynamic_cast(it->first); assert(clip); diff --git a/Gui/CurveGui.cpp b/Gui/CurveGui.cpp index e532dad10a..cc0cc5450c 100644 --- a/Gui/CurveGui.cpp +++ b/Gui/CurveGui.cpp @@ -329,9 +329,13 @@ CurveGui::drawCurve(int curveIndex, glCheckError(); if (hasDrawnExpr) { glBegin(GL_LINE_STRIP); + bool prevVisible = true; for (int i = 0; i < (int)exprVertices.size(); i += 2) { - if (exprVertices[i] < btmLeft.x() || exprVertices[i] > topRight.x() || - exprVertices[i+1] < btmLeft.y() || exprVertices[i+1] > topRight.y()) { + bool vertexVisible = exprVertices[i] >= btmLeft.x() && exprVertices[i] <= topRight.x() && + exprVertices[i+1] >= btmLeft.y() && exprVertices[i+1] <= topRight.y(); + bool previousWasVisible = prevVisible; + prevVisible = vertexVisible; + if (!previousWasVisible && !vertexVisible) { continue; } glVertex2f(exprVertices[i],exprVertices[i + 1]); @@ -343,13 +347,19 @@ CurveGui::drawCurve(int curveIndex, glEnable(GL_LINE_STIPPLE); } glBegin(GL_LINE_STRIP); + + bool prevVisible = true; for (int i = 0; i < (int)vertices.size(); i += 2) { - if (vertices[i] < btmLeft.x() || vertices[i] > topRight.x() || - vertices[i+1] < btmLeft.y() || vertices[i+1] > topRight.y()) { + bool vertexVisible = vertices[i] >= btmLeft.x() && vertices[i] <= topRight.x() && + vertices[i+1] >= btmLeft.y() && vertices[i+1] <= topRight.y(); + bool previousWasVisible = prevVisible; + prevVisible = vertexVisible; + if (!previousWasVisible && !vertexVisible) { continue; } glVertex2f(vertices[i],vertices[i + 1]); } + glEnd(); if (hasDrawnExpr) { glDisable(GL_LINE_STIPPLE); diff --git a/Gui/DopeSheetView.cpp b/Gui/DopeSheetView.cpp index 8ac0b8ea3d..e6601a29bb 100644 --- a/Gui/DopeSheetView.cpp +++ b/Gui/DopeSheetView.cpp @@ -74,6 +74,8 @@ CLANG_DIAG_OFF(deprecated-declarations) GCC_DIAG_OFF(deprecated-declarations) +#define NATRON_DOPESHEET_MIN_RANGE_FIT 10 + NATRON_NAMESPACE_ENTER; namespace { @@ -2681,6 +2683,15 @@ void DopeSheetView::centerOnSelection() if (range.first == range.second) { return; } + + double actualRange = (range.second - range.first); + if (actualRange < NATRON_DOPESHEET_MIN_RANGE_FIT) { + double diffRange = NATRON_DOPESHEET_MIN_RANGE_FIT - actualRange; + diffRange /= 2; + range.first -= diffRange; + range.second += diffRange; + } + _imp->zoomContext.fill(range.first, range.second, _imp->zoomContext.bottom(), _imp->zoomContext.top()); @@ -3463,7 +3474,7 @@ DopeSheetView::wheelEvent(QWheelEvent *e) } else if (par > par_max) { par = par_max; - scaleFactor = par / _imp->zoomContext.factor(); + scaleFactor = 1; } diff --git a/tools/MacOSX/ports/graphics/openimageio/Portfile b/tools/MacOSX/ports/graphics/openimageio/Portfile index 6414062eae..8fd02bb463 100644 --- a/tools/MacOSX/ports/graphics/openimageio/Portfile +++ b/tools/MacOSX/ports/graphics/openimageio/Portfile @@ -13,7 +13,7 @@ PortGroup qt4 1.0 epoch 1 fetch.type git -github.setup OpenImageIO oiio 1.6.9 tags/Release- +github.setup OpenImageIO oiio 1.5.23 tags/Release- #github.version ${version}-dist #github.tarball_from downloads @@ -79,8 +79,7 @@ if {${configure.build_arch} eq "ppc"} { patch.pre_args -p1 patchfiles \ - oiio-x86intrin.patch \ - oiio-sha1.patch + oiio-1.5.22-exrthreads.patch cmake.out_of_source yes diff --git a/tools/MacOSX/ports/graphics/openimageio/Portfile~1.5 b/tools/MacOSX/ports/graphics/openimageio/Portfile~1.5 new file mode 100644 index 0000000000..8fd02bb463 --- /dev/null +++ b/tools/MacOSX/ports/graphics/openimageio/Portfile~1.5 @@ -0,0 +1,169 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 +# $Id$ + +PortSystem 1.0 +PortGroup github 1.0 +PortGroup cmake 1.0 +PortGroup conflicts_build 1.0 +PortGroup qt4 1.0 +# gcc-4.8 cannot compile universal +# The internal yaml-cpp is not compiled with multiple archs in universal mode +#PortGroup muniversal 1.0 + +epoch 1 + +fetch.type git +github.setup OpenImageIO oiio 1.5.23 tags/Release- +#github.version ${version}-dist +#github.tarball_from downloads + +name openimageio +#version 1.4.5.91 +#revision 2 +categories graphics +platforms darwin +license BSD +maintainers openmaintainer +description OpenImageIO is a library for reading and writing images +long_description ${description} +homepage http://sites.google.com/site/openimageio/ + + +#master_sites debian:o/openimageio/ +#worksrcdir ${name}-${version}~dfsg0.orig +#distfiles ${name}_${version}~dfsg0.orig${extract.suffix} +#checksums rmd160 94c6e2274be01e82cfe8bc4bf11677593d33f299 \ +# sha256 4cf3b373e56694ce9e3896a356b68a2ed92978e76be653a5b5e45b17937faae8 + +depends_lib port:boost port:jpeg port:tiff port:libpng port:openexr port:glew port:ilmbase port:libraw port:giflib + +# can't compile openimageio when another version is installed, because the include path is wrong +conflicts_build ${name} + +depends_build port:txt2man +depends_skip_archcheck txt2man +# port:opencolorio + +# we need gcc atomics (clang >= 3.5 maybe?, gcc >= 4.8 works) +# tested with openimageio 1.4.6rc1: +# macports-clang-3.3 and later work +# gcc-4.2 doesn't work +# llvm-gcc-4.2 works +# macports-clang < 3.3 untested +#compiler.fallback-append macports-gcc-4.8 macports-gcc-4.9 macports-clang-3.3 macports-clang-3.4 macports-clang-3.5 +compiler.blacklist apple-gcc-4.0 apple-gcc-4.2 gcc-3.3 gcc-4.0 gcc-4.2 macports-gcc-4.0 macports-gcc-4.2 + +# The PowerPC build requires GCC >= 4.8, which doesn't recognize the -arch flag, and requires libatomic +if {${configure.build_arch} eq "ppc"} { + compiler.blacklist-append macports-gcc-4.3 macports-gcc-4.4 macports-gcc-4.5 macports-gcc-4.6 macports-gcc-4.7 macports-clang-3.3 macports-clang-3.4 macports-clang-3.5 + # the following removes the flag "-arch ppc" put by cmake-1.0 portgroup in the pre-configure phase + pre-configure { + configure.args-delete -DCMAKE_OSX_ARCHITECTURES="${configure.build_arch}" + } + # -latomic is necessary on ppc for __atomic_fetch_add_8 and __atomic_exchange_8 + configure.args-append -DCMAKE_SHARED_LINKER_FLAGS=-latomic -DCMAKE_EXE_LINKER_FLAGS=-latomic +} + +#post-extract { +# system "touch ${worksrcpath}/LICENSE ${workpath}/${worksrcdir}/LICENSE" +#} + +# Those are Debian patches, which require -p1 +#patch.pre_args -p1 +#patchfiles \ +# build_in_sources.patch +# 0001-Fix_docs_generation.patch \ +# 0002-Fix_IlmBase_issue.patch \ +# 0003-Fix_multiarch_paths.patch \ +# 0004-Fix_FTBFS_on_atomic_operations.patch \ + +patch.pre_args -p1 +patchfiles \ + oiio-1.5.22-exrthreads.patch + +cmake.out_of_source yes + +configure.args-append \ + -DOIIO_BUILD_TESTS:BOOL=FALSE \ + -DBOOST_ROOT=${prefix} \ + -DUSE_QT:BOOL=FALSE \ + -DUSE_TBB:BOOL=FALSE \ + -DUSE_PYTHON:BOOL=FALSE \ + -DUSE_PYTHON3:BOOL=FALSE \ + -DUSE_FIELD3D:BOOL=FALSE \ + -DUSE_FFMPEG:BOOL=FALSE \ + -DUSE_OPENJPEG:BOOL=FALSE \ + -DUSE_OCIO:BOOL=FALSE \ + -DUSE_OPENCV:BOOL=FALSE \ + -DUSE_OPENSSL:BOOL=FALSE \ + -DUSE_FREETYPE:BOOL=FALSE \ + -DUSE_GIF:BOOL=TRUE \ + -DUSE_PTEX:BOOL=FALSE \ + -DUSE_LIBRAW:BOOL=TRUE \ + -DSTOP_ON_WARNING:BOOL=FALSE + +default_variants +opencolorio +openjpeg +qt4 +freetype + +variant opencolorio description {Add OpenColorIO support.} { + depends_lib-append port:opencolorio + configure.args-delete -DUSE_OCIO:BOOL=FALSE + configure.args-append -DUSE_OCIO:BOOL=TRUE +} + +variant ffmpeg description {Add FFmpeg support.} { + depends_lib-append port:ffmpeg + configure.args-delete -DUSE_FFMPEG:BOOL=FALSE + configure.args-append -DUSE_FFMPEG:BOOL=TRUE +} + +variant openjpeg description {Add OpenJPEG support.} { + depends_lib-append port:openjpeg15 + configure.args-delete -DUSE_OPENJPEG:BOOL=FALSE + configure.args-append -DUSE_OPENJPEG:BOOL=TRUE -DOPENJPEG_INCLUDE_DIR=${prefix}/include/openjpeg-1.5 +} + +variant python26 conflicts python27 description {Add Python 2.6 bindings.} { + depends_lib-append port:python26 + configure.args-delete -DUSE_PYTHON:BOOL=FALSE + configure.args-append -DUSE_PYTHON:BOOL=TRUE \ + -DPYTHON_VERSION=2.6 \ + -DPYTHON_EXECUTABLE=${prefix}/bin/python2.6 \ + -DPYTHON_LIBRARY=${prefix}/lib/libpython2.6.dylib \ + -DPYTHON_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/2.6/Headers \ + -DPYTHON_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/2.6/lib/python2.6/site-packages +} + +variant python27 conflicts python26 description {Add Python 2.7 bindings.} { + depends_lib-append port:python27 + configure.args-delete -DUSE_PYTHON:BOOL=FALSE + configure.args-append -DUSE_PYTHON:BOOL=TRUE \ + -DPYTHON_VERSION=2.7 \ + -DPYTHON_EXECUTABLE=${prefix}/bin/python2.7 \ + -DPYTHON_LIBRARY=${prefix}/lib/libpython2.7.dylib \ + -DPYTHON_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/2.7/Headers \ + -DPYTHON_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages +} + +variant qt4 description {Build the Qt-based image viewer.} { + configure.args-delete -DUSE_QT:BOOL=FALSE + configure.args-append -DUSE_QT:BOOL=TRUE + depends_lib-append port:qt4-mac +} + +variant field3d description {Use Field3D.} { + configure.args-delete -DUSE_FIELD3D:BOOL=FALSE + configure.args-append -DUSE_FIELD3D:BOOL=TRUE + depends_lib-append port:field3d +} + +variant freetype description {Use FreeType.} { + configure.args-delete -DUSE_FREETYPE:BOOL=FALSE + configure.args-append -DUSE_FREETYPE:BOOL=TRUE -DFREETYPE_INCLUDE_PATH=${prefix}/include/freetype2 + depends_lib-append port:freetype +} + +variant natron require field3d description {Compile a version to be included in Natron} { +} +#configure.args --enable-bsdtar=shared --enable-bsdcpio=shared \ +# --without-lzmadec --without-lzma +#use_autoreconf yes diff --git a/tools/MacOSX/ports/graphics/openimageio/Portfile~1.6 b/tools/MacOSX/ports/graphics/openimageio/Portfile~1.6 new file mode 100644 index 0000000000..6414062eae --- /dev/null +++ b/tools/MacOSX/ports/graphics/openimageio/Portfile~1.6 @@ -0,0 +1,170 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 +# $Id$ + +PortSystem 1.0 +PortGroup github 1.0 +PortGroup cmake 1.0 +PortGroup conflicts_build 1.0 +PortGroup qt4 1.0 +# gcc-4.8 cannot compile universal +# The internal yaml-cpp is not compiled with multiple archs in universal mode +#PortGroup muniversal 1.0 + +epoch 1 + +fetch.type git +github.setup OpenImageIO oiio 1.6.9 tags/Release- +#github.version ${version}-dist +#github.tarball_from downloads + +name openimageio +#version 1.4.5.91 +#revision 2 +categories graphics +platforms darwin +license BSD +maintainers openmaintainer +description OpenImageIO is a library for reading and writing images +long_description ${description} +homepage http://sites.google.com/site/openimageio/ + + +#master_sites debian:o/openimageio/ +#worksrcdir ${name}-${version}~dfsg0.orig +#distfiles ${name}_${version}~dfsg0.orig${extract.suffix} +#checksums rmd160 94c6e2274be01e82cfe8bc4bf11677593d33f299 \ +# sha256 4cf3b373e56694ce9e3896a356b68a2ed92978e76be653a5b5e45b17937faae8 + +depends_lib port:boost port:jpeg port:tiff port:libpng port:openexr port:glew port:ilmbase port:libraw port:giflib + +# can't compile openimageio when another version is installed, because the include path is wrong +conflicts_build ${name} + +depends_build port:txt2man +depends_skip_archcheck txt2man +# port:opencolorio + +# we need gcc atomics (clang >= 3.5 maybe?, gcc >= 4.8 works) +# tested with openimageio 1.4.6rc1: +# macports-clang-3.3 and later work +# gcc-4.2 doesn't work +# llvm-gcc-4.2 works +# macports-clang < 3.3 untested +#compiler.fallback-append macports-gcc-4.8 macports-gcc-4.9 macports-clang-3.3 macports-clang-3.4 macports-clang-3.5 +compiler.blacklist apple-gcc-4.0 apple-gcc-4.2 gcc-3.3 gcc-4.0 gcc-4.2 macports-gcc-4.0 macports-gcc-4.2 + +# The PowerPC build requires GCC >= 4.8, which doesn't recognize the -arch flag, and requires libatomic +if {${configure.build_arch} eq "ppc"} { + compiler.blacklist-append macports-gcc-4.3 macports-gcc-4.4 macports-gcc-4.5 macports-gcc-4.6 macports-gcc-4.7 macports-clang-3.3 macports-clang-3.4 macports-clang-3.5 + # the following removes the flag "-arch ppc" put by cmake-1.0 portgroup in the pre-configure phase + pre-configure { + configure.args-delete -DCMAKE_OSX_ARCHITECTURES="${configure.build_arch}" + } + # -latomic is necessary on ppc for __atomic_fetch_add_8 and __atomic_exchange_8 + configure.args-append -DCMAKE_SHARED_LINKER_FLAGS=-latomic -DCMAKE_EXE_LINKER_FLAGS=-latomic +} + +#post-extract { +# system "touch ${worksrcpath}/LICENSE ${workpath}/${worksrcdir}/LICENSE" +#} + +# Those are Debian patches, which require -p1 +#patch.pre_args -p1 +#patchfiles \ +# build_in_sources.patch +# 0001-Fix_docs_generation.patch \ +# 0002-Fix_IlmBase_issue.patch \ +# 0003-Fix_multiarch_paths.patch \ +# 0004-Fix_FTBFS_on_atomic_operations.patch \ + +patch.pre_args -p1 +patchfiles \ + oiio-x86intrin.patch \ + oiio-sha1.patch + +cmake.out_of_source yes + +configure.args-append \ + -DOIIO_BUILD_TESTS:BOOL=FALSE \ + -DBOOST_ROOT=${prefix} \ + -DUSE_QT:BOOL=FALSE \ + -DUSE_TBB:BOOL=FALSE \ + -DUSE_PYTHON:BOOL=FALSE \ + -DUSE_PYTHON3:BOOL=FALSE \ + -DUSE_FIELD3D:BOOL=FALSE \ + -DUSE_FFMPEG:BOOL=FALSE \ + -DUSE_OPENJPEG:BOOL=FALSE \ + -DUSE_OCIO:BOOL=FALSE \ + -DUSE_OPENCV:BOOL=FALSE \ + -DUSE_OPENSSL:BOOL=FALSE \ + -DUSE_FREETYPE:BOOL=FALSE \ + -DUSE_GIF:BOOL=TRUE \ + -DUSE_PTEX:BOOL=FALSE \ + -DUSE_LIBRAW:BOOL=TRUE \ + -DSTOP_ON_WARNING:BOOL=FALSE + +default_variants +opencolorio +openjpeg +qt4 +freetype + +variant opencolorio description {Add OpenColorIO support.} { + depends_lib-append port:opencolorio + configure.args-delete -DUSE_OCIO:BOOL=FALSE + configure.args-append -DUSE_OCIO:BOOL=TRUE +} + +variant ffmpeg description {Add FFmpeg support.} { + depends_lib-append port:ffmpeg + configure.args-delete -DUSE_FFMPEG:BOOL=FALSE + configure.args-append -DUSE_FFMPEG:BOOL=TRUE +} + +variant openjpeg description {Add OpenJPEG support.} { + depends_lib-append port:openjpeg15 + configure.args-delete -DUSE_OPENJPEG:BOOL=FALSE + configure.args-append -DUSE_OPENJPEG:BOOL=TRUE -DOPENJPEG_INCLUDE_DIR=${prefix}/include/openjpeg-1.5 +} + +variant python26 conflicts python27 description {Add Python 2.6 bindings.} { + depends_lib-append port:python26 + configure.args-delete -DUSE_PYTHON:BOOL=FALSE + configure.args-append -DUSE_PYTHON:BOOL=TRUE \ + -DPYTHON_VERSION=2.6 \ + -DPYTHON_EXECUTABLE=${prefix}/bin/python2.6 \ + -DPYTHON_LIBRARY=${prefix}/lib/libpython2.6.dylib \ + -DPYTHON_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/2.6/Headers \ + -DPYTHON_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/2.6/lib/python2.6/site-packages +} + +variant python27 conflicts python26 description {Add Python 2.7 bindings.} { + depends_lib-append port:python27 + configure.args-delete -DUSE_PYTHON:BOOL=FALSE + configure.args-append -DUSE_PYTHON:BOOL=TRUE \ + -DPYTHON_VERSION=2.7 \ + -DPYTHON_EXECUTABLE=${prefix}/bin/python2.7 \ + -DPYTHON_LIBRARY=${prefix}/lib/libpython2.7.dylib \ + -DPYTHON_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/2.7/Headers \ + -DPYTHON_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages +} + +variant qt4 description {Build the Qt-based image viewer.} { + configure.args-delete -DUSE_QT:BOOL=FALSE + configure.args-append -DUSE_QT:BOOL=TRUE + depends_lib-append port:qt4-mac +} + +variant field3d description {Use Field3D.} { + configure.args-delete -DUSE_FIELD3D:BOOL=FALSE + configure.args-append -DUSE_FIELD3D:BOOL=TRUE + depends_lib-append port:field3d +} + +variant freetype description {Use FreeType.} { + configure.args-delete -DUSE_FREETYPE:BOOL=FALSE + configure.args-append -DUSE_FREETYPE:BOOL=TRUE -DFREETYPE_INCLUDE_PATH=${prefix}/include/freetype2 + depends_lib-append port:freetype +} + +variant natron require field3d description {Compile a version to be included in Natron} { +} +#configure.args --enable-bsdtar=shared --enable-bsdcpio=shared \ +# --without-lzmadec --without-lzma +#use_autoreconf yes diff --git a/tools/MacOSX/ports/graphics/openimageio/files/oiio-1.5.22-exrthreads.patch b/tools/MacOSX/ports/graphics/openimageio/files/oiio-1.5.22-exrthreads.patch new file mode 100644 index 0000000000..c6515b8770 --- /dev/null +++ b/tools/MacOSX/ports/graphics/openimageio/files/oiio-1.5.22-exrthreads.patch @@ -0,0 +1,117 @@ +diff --git a/src/doc/imageioapi.tex b/src/doc/imageioapi.tex +index 63425b2..66603ff 100644 +--- a/src/doc/imageioapi.tex ++++ b/src/doc/imageioapi.tex +@@ -805,11 +805,31 @@ attribute is a string), the attribute will not be modified, and {\cf + \vspace{10pt} + \index{threads} \label{sec:attribute:threads} + Some \product operations can be accelerated if allowed to spawn multiple +-threads to parallelize the task. (Examples: decompressing multiple +-simultaneously-read OpenEXR scanlines, or many \ImageBuf operations.) +-This attribute sets the maximum number of threads that will be spawned. +-The default is 1. If set to 0, it means that it should use as many ++threads to parallelize the task. (Examples: simultaneous format conversions ++of multiple scanlines read together, or many \ImageBufAlgo operations.) ++This attribute sets the default number of threads that will be spawned ++for these operations (the ``fan out''). ++The default is 0, which means that it should spawn as many + threads as there are hardware cores present on the system. ++ ++Situations where the main application logic is essentially single threaded ++(i.e., one top-level call into OIIO at a time) should leave this at the ++default value, or some reasonable number of cores, thus allowing lots of ++threads to fill the cores when OIIO has big tasks to complete. But ++situations where you have many threads at the application level, each of ++which is expected to be making separate OIIO calls simultaneously, should ++set this to 1, thus having each calling thread do its own work inside of ++OIIO rather than spawning new threads with a high overall ``fan out.'' ++\apiend ++ ++\apiitem{int exr_threads} ++\vspace{10pt} ++\index{exr_threads} ++\NEW % 1.6 ++Sets the internal OpenEXR thread pool size. The default is to use as many ++threads as the amount of hardware concurrency detected. ++Note that this is separate from the OIIO ++\qkw{threads} attribute. + \apiend + + \apiitem{string plugin_searchpath} +diff --git a/src/libOpenImageIO/imageio.cpp b/src/libOpenImageIO/imageio.cpp +index 3fc2118..56d6054 100644 +--- a/src/libOpenImageIO/imageio.cpp ++++ b/src/libOpenImageIO/imageio.cpp +@@ -51,6 +51,7 @@ OIIO_NAMESPACE_BEGIN + namespace pvt { + recursive_mutex imageio_mutex; + atomic_int oiio_threads (boost::thread::hardware_concurrency()); ++atomic_int oiio_exr_threads (boost::thread::hardware_concurrency()); + atomic_int oiio_read_chunk (256); + ustring plugin_searchpath (OIIO_DEFAULT_PLUGIN_SEARCHPATH); + std::string format_list; // comma-separated list of all formats +@@ -121,7 +122,7 @@ namespace { + // Private global OIIO data. + + static spin_mutex attrib_mutex; +-static const int maxthreads = 64; // reasonable maximum for sanity check ++static const int maxthreads = 256; // reasonable maximum for sanity check + + }; + +@@ -146,6 +147,10 @@ attribute (string_view name, TypeDesc type, const void *val) + plugin_searchpath = ustring (*(const char **)val); + return true; + } ++ if (name == "exr_threads" && type == TypeDesc::TypeInt) { ++ oiio_exr_threads = Imath::clamp (*(const int *)val, 0, maxthreads); ++ return true; ++ } + return false; + } + +@@ -179,6 +184,10 @@ getattribute (string_view name, TypeDesc type, void *val) + *(ustring *)val = ustring(extension_list); + return true; + } ++ if (name == "exr_threads" && type == TypeDesc::TypeInt) { ++ *(int *)val = oiio_exr_threads; ++ return true; ++ } + return false; + } + +diff --git a/src/oiiotool/oiiotool.cpp b/src/oiiotool/oiiotool.cpp +index c484877..e7ca210 100644 +--- a/src/oiiotool/oiiotool.cpp ++++ b/src/oiiotool/oiiotool.cpp +@@ -328,7 +328,9 @@ static int + set_threads (int argc, const char *argv[]) + { + ASSERT (argc == 2); +- OIIO::attribute ("threads", atoi(argv[1])); ++ int nthreads = atoi(argv[1]); ++ OIIO::attribute ("threads", nthreads); ++ OIIO::attribute ("exr_threads", nthreads); + return 0; + } + +diff --git a/src/openexr.imageio/exrinput.cpp b/src/openexr.imageio/exrinput.cpp +index 00c6145..40efba2 100644 +--- a/src/openexr.imageio/exrinput.cpp ++++ b/src/openexr.imageio/exrinput.cpp +@@ -316,12 +316,12 @@ void set_exr_threads () + static spin_mutex exr_threads_mutex; + + int oiio_threads = 1; +- OIIO::getattribute ("threads", oiio_threads); ++ OIIO::getattribute ("exr_threads", oiio_threads); + + spin_lock lock (exr_threads_mutex); + if (exr_threads != oiio_threads) { + exr_threads = oiio_threads; +- Imf::setGlobalThreadCount (exr_threads == 1 ? 0 : exr_threads); ++ Imf::setGlobalThreadCount (exr_threads); + } + } + diff --git a/tools/Windows/common.sh b/tools/Windows/common.sh index 8e451f09c2..ea865e8674 100644 --- a/tools/Windows/common.sh +++ b/tools/Windows/common.sh @@ -41,7 +41,7 @@ PACKAGES=$NATRON_PKG,$CORELIBS_PKG,$PROFILES_PKG,$IOPLUG_PKG,$MISCPLUG_PKG,$AREN # bump number when OpenColorIO-Configs changes GIT_OCIO_CONFIG_TAR=https://github.com/MrKepzie/OpenColorIO-Configs/archive/Natron-v2.0.tar.gz -COLOR_PROFILES_VERSION=2.0 +COLOR_PROFILES_VERSION=2.0.0 # SDK @@ -120,7 +120,7 @@ GLEW_TAR=glew-1.12.0.tgz BOOST_TAR=boost_1_55_0.tar.gz CAIRO_TAR=cairo-1.14.2.tar.xz OCIO_TAR=OpenColorIO-1.0.9.tar.gz -OIIO_TAR=oiio-Release-1.6.9.tar.gz +OIIO_TAR=oiio-Release-1.5.23.tar.gz PYSIDE_TAR=pyside-qt4.8+1.2.2.tar.bz2 SHIBOK_TAR=shiboken-1.2.2.tar.bz2 LIBXML_TAR=libxml2-2.9.2.tar.gz @@ -133,8 +133,7 @@ MAGICK_TAR=ImageMagick-6.9.2-10.tar.xz GIF_TAR=giflib-5.1.1.tar.gz #SSL_TAR=openssl-1.0.0r.tar.gz JASP_TAR=jasper-1.900.1.zip -INSTALLER32_BIN_TAR=natron-win32-installer-extra.zip -INSTALLER64_BIN_TAR=natron-win64-installer-extra.zip +INSTALLER_BIN_TAR=natron-windows-installer.zip FFMPEG_MXE_BIN_64_GPL_TAR=ffmpeg-2.8.3-windows-x86_64-shared-GPLv2.tar.xz FFMPEG_MXE_BIN_32_GPL_TAR=ffmpeg-2.8.3-windows-i686-shared-GPLv2.tar.xz diff --git a/tools/Windows/include/patches/OpenImageIO/oiio-exrthreads.patch b/tools/Windows/include/patches/OpenImageIO/oiio-exrthreads.patch new file mode 100644 index 0000000000..c6515b8770 --- /dev/null +++ b/tools/Windows/include/patches/OpenImageIO/oiio-exrthreads.patch @@ -0,0 +1,117 @@ +diff --git a/src/doc/imageioapi.tex b/src/doc/imageioapi.tex +index 63425b2..66603ff 100644 +--- a/src/doc/imageioapi.tex ++++ b/src/doc/imageioapi.tex +@@ -805,11 +805,31 @@ attribute is a string), the attribute will not be modified, and {\cf + \vspace{10pt} + \index{threads} \label{sec:attribute:threads} + Some \product operations can be accelerated if allowed to spawn multiple +-threads to parallelize the task. (Examples: decompressing multiple +-simultaneously-read OpenEXR scanlines, or many \ImageBuf operations.) +-This attribute sets the maximum number of threads that will be spawned. +-The default is 1. If set to 0, it means that it should use as many ++threads to parallelize the task. (Examples: simultaneous format conversions ++of multiple scanlines read together, or many \ImageBufAlgo operations.) ++This attribute sets the default number of threads that will be spawned ++for these operations (the ``fan out''). ++The default is 0, which means that it should spawn as many + threads as there are hardware cores present on the system. ++ ++Situations where the main application logic is essentially single threaded ++(i.e., one top-level call into OIIO at a time) should leave this at the ++default value, or some reasonable number of cores, thus allowing lots of ++threads to fill the cores when OIIO has big tasks to complete. But ++situations where you have many threads at the application level, each of ++which is expected to be making separate OIIO calls simultaneously, should ++set this to 1, thus having each calling thread do its own work inside of ++OIIO rather than spawning new threads with a high overall ``fan out.'' ++\apiend ++ ++\apiitem{int exr_threads} ++\vspace{10pt} ++\index{exr_threads} ++\NEW % 1.6 ++Sets the internal OpenEXR thread pool size. The default is to use as many ++threads as the amount of hardware concurrency detected. ++Note that this is separate from the OIIO ++\qkw{threads} attribute. + \apiend + + \apiitem{string plugin_searchpath} +diff --git a/src/libOpenImageIO/imageio.cpp b/src/libOpenImageIO/imageio.cpp +index 3fc2118..56d6054 100644 +--- a/src/libOpenImageIO/imageio.cpp ++++ b/src/libOpenImageIO/imageio.cpp +@@ -51,6 +51,7 @@ OIIO_NAMESPACE_BEGIN + namespace pvt { + recursive_mutex imageio_mutex; + atomic_int oiio_threads (boost::thread::hardware_concurrency()); ++atomic_int oiio_exr_threads (boost::thread::hardware_concurrency()); + atomic_int oiio_read_chunk (256); + ustring plugin_searchpath (OIIO_DEFAULT_PLUGIN_SEARCHPATH); + std::string format_list; // comma-separated list of all formats +@@ -121,7 +122,7 @@ namespace { + // Private global OIIO data. + + static spin_mutex attrib_mutex; +-static const int maxthreads = 64; // reasonable maximum for sanity check ++static const int maxthreads = 256; // reasonable maximum for sanity check + + }; + +@@ -146,6 +147,10 @@ attribute (string_view name, TypeDesc type, const void *val) + plugin_searchpath = ustring (*(const char **)val); + return true; + } ++ if (name == "exr_threads" && type == TypeDesc::TypeInt) { ++ oiio_exr_threads = Imath::clamp (*(const int *)val, 0, maxthreads); ++ return true; ++ } + return false; + } + +@@ -179,6 +184,10 @@ getattribute (string_view name, TypeDesc type, void *val) + *(ustring *)val = ustring(extension_list); + return true; + } ++ if (name == "exr_threads" && type == TypeDesc::TypeInt) { ++ *(int *)val = oiio_exr_threads; ++ return true; ++ } + return false; + } + +diff --git a/src/oiiotool/oiiotool.cpp b/src/oiiotool/oiiotool.cpp +index c484877..e7ca210 100644 +--- a/src/oiiotool/oiiotool.cpp ++++ b/src/oiiotool/oiiotool.cpp +@@ -328,7 +328,9 @@ static int + set_threads (int argc, const char *argv[]) + { + ASSERT (argc == 2); +- OIIO::attribute ("threads", atoi(argv[1])); ++ int nthreads = atoi(argv[1]); ++ OIIO::attribute ("threads", nthreads); ++ OIIO::attribute ("exr_threads", nthreads); + return 0; + } + +diff --git a/src/openexr.imageio/exrinput.cpp b/src/openexr.imageio/exrinput.cpp +index 00c6145..40efba2 100644 +--- a/src/openexr.imageio/exrinput.cpp ++++ b/src/openexr.imageio/exrinput.cpp +@@ -316,12 +316,12 @@ void set_exr_threads () + static spin_mutex exr_threads_mutex; + + int oiio_threads = 1; +- OIIO::getattribute ("threads", oiio_threads); ++ OIIO::getattribute ("exr_threads", oiio_threads); + + spin_lock lock (exr_threads_mutex); + if (exr_threads != oiio_threads) { + exr_threads = oiio_threads; +- Imf::setGlobalThreadCount (exr_threads == 1 ? 0 : exr_threads); ++ Imf::setGlobalThreadCount (exr_threads); + } + } + diff --git a/tools/Windows/include/patches/OpenImageIO/fix-mingw-w64.diff b/tools/Windows/include/patches/fix-mingw-w64-16.diff similarity index 100% rename from tools/Windows/include/patches/OpenImageIO/fix-mingw-w64.diff rename to tools/Windows/include/patches/fix-mingw-w64-16.diff diff --git a/tools/Windows/include/patches/fix-mingw-w64-16.patch b/tools/Windows/include/patches/fix-mingw-w64-16.patch new file mode 100644 index 0000000000..10225429b6 --- /dev/null +++ b/tools/Windows/include/patches/fix-mingw-w64-16.patch @@ -0,0 +1,204 @@ +--- a/src/include/OpenImageIO/missing_math.h ++++ b/src/include/OpenImageIO/missing_math.h +@@ -106,7 +106,7 @@ + + OIIO_NAMESPACE_ENTER { + +-#ifdef _WIN32 ++#if defined(_WIN32) && !defined(__GNUC__) + // Windows doesn't define these functions from math.h + #define hypotf _hypotf + #define copysign(x,y) _copysign(x,y) +--- a/src/include/OpenImageIO/osdep.h ++++ b/src/include/OpenImageIO/osdep.h +@@ -33,7 +33,9 @@ + #ifdef _WIN32 + # define WIN32_LEAN_AND_MEAN + # define VC_EXTRALEAN ++# ifndef __MINGW32__ + # define NOMINMAX ++# endif + # include + #endif + + +--- a/src/libOpenImageIO/CMakeLists.txt ++++ b/src/libOpenImageIO/CMakeLists.txt +@@ -258,7 +261,7 @@ + + + if (WIN32) +- target_link_libraries (OpenImageIO psapi.lib) ++ target_link_libraries (OpenImageIO psapi ws2_32) + endif () + link_ilmbase (OpenImageIO) + add_dependencies (OpenImageIO "${CMAKE_CURRENT_SOURCE_DIR}/libOpenImageIO.map") +--- a/src/libOpenImageIO/imageinput.cpp ++++ b/src/libOpenImageIO/imageinput.cpp +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + #include "dassert.h" + #include "typedesc.h" +--- a/src/libtexture/imagecache.cpp ++++ b/src/libtexture/imagecache.cpp +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + #include + + #include +--- a/src/libtexture/texturesys.cpp ++++ b/src/libtexture/texturesys.cpp +@@ -30,6 +30,7 @@ + + + #include ++#include + #include + #include + #include +--- a/src/libutil/argparse.cpp ++++ b/src/libutil/argparse.cpp +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + + #include "strutil.h" + #include "sysutil.h" +--- a/src/libutil/filesystem.cpp ++++ b/src/libutil/filesystem.cpp +@@ -288,7 +288,7 @@ + FILE* + Filesystem::fopen (const std::string &path, const std::string &mode) + { +-#ifdef _WIN32 ++#if defined(_WIN32) && !defined(__GNUC__) + // on Windows fopen does not accept UTF-8 paths, so we convert to wide char + std::wstring wpath = Strutil::utf8_to_utf16 (path); + std::wstring wmode = Strutil::utf8_to_utf16 (mode); +@@ -307,7 +307,7 @@ + const std::string &path, + std::ios_base::openmode mode) + { +-#ifdef _WIN32 ++#if defined(_WIN32) && !defined(__GNUC__) + // Windows std::ifstream accepts non-standard wchar_t* + std::wstring wpath = Strutil::utf8_to_utf16(path); + stream.open (wpath.c_str(), mode); +@@ -324,7 +324,7 @@ + const std::string &path, + std::ios_base::openmode mode) + { +-#ifdef _WIN32 ++#if defined(_WIN32) && !defined(__GNUC__) + // Windows std::ofstream accepts non-standard wchar_t* + std::wstring wpath = Strutil::utf8_to_utf16 (path); + stream.open (wpath.c_str(), mode); +--- a/src/libutil/plugin.cpp ++++ b/src/libutil/plugin.cpp +@@ -93,7 +93,7 @@ dlclose (Handle plugin_handle) + void * + dlsym (Handle plugin_handle, const char *symbol_name) + { +- return GetProcAddress ((HMODULE)plugin_handle, symbol_name); ++ return (void *)GetProcAddress ((HMODULE)plugin_handle, symbol_name); + } + + + +--- a/src/libutil/sysutil.cpp ++++ b/src/libutil/sysutil.cpp +@@ -137,7 +137,7 @@ Sysutil::get_local_time (const time_t *time, struct tm *converted_time) + #ifdef _MSC_VER + localtime_s (converted_time, time); + #else +- localtime_r (time, converted_time); ++ *converted_time = *localtime(time); + #endif + } + + +--- a/src/ptex.imageio/ptex/PtexCache.cpp ++++ b/src/ptex.imageio/ptex/PtexCache.cpp +@@ -224,12 +224,21 @@ public: + // split into dirs + _searchdirs.clear(); + char* buff = strdup(path); +- char* pos = 0; +- char* token = strtok_r(buff, ":", &pos); +- while (token) { +- if (token[0]) _searchdirs.push_back(token); +- token = strtok_r(0, ":", &pos); +- } ++ char* pos = buff; ++ ++ do { ++ char *token = pos; ++ pos = strstr(pos, ":"); ++ ++ if (pos) { ++ pos[0] = '\0'; ++ pos++; ++ } ++ ++ if (token[0]) _searchdirs.push_back(token); ++ ++ } while(pos); ++ + free(buff); + } + + +--- a/src/ptex.imageio/ptex/PtexPlatform.h ++++ b/src/ptex.imageio/ptex/PtexPlatform.h +@@ -79,11 +79,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + // missing functions on Windows + #ifdef WINDOWS ++#if !defined(__GNUC__) + #define snprintf sprintf_s + #define strtok_r strtok_s ++#endif + typedef __int64 FilePos; ++#if !defined(__GNUC__) + #define fseeko _fseeki64 + #define ftello _ftelli64 ++#else ++#define fseeko fseek ++#define ftello ftell ++#endif + + inline double log2(double x) { + return log(x) * 1.4426950408889634; +--- a/src/rla.imageio/rlaoutput.cpp ++++ b/src/rla.imageio/rlaoutput.cpp +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + #include "dassert.h" + #include "typedesc.h" +--- a/src/cmake/modules/FindOpenJpeg.cmake 2013-12-29 23:51:59.071600000 +0400 ++++ b/src/cmake/modules/FindOpenJpeg.cmake 2013-12-29 23:52:34.998400000 +0400 +@@ -78,7 +78,9 @@ + ${OPENJPEG_HOME}/lib64) + set (OpenJpeg_include_paths + ${OpenJpeg_include_paths} +- ${OPENJPEG_HOME}/include) ++ ${OPENJPEG_HOME}/include ++ ${OPENJPEG_HOME}/include/openjpeg ++ ${OPENJPEG_HOME}/include/openjpeg-1.5) + endif() + + + diff --git a/tools/Windows/include/patches/fix-mingw-w64.patch b/tools/Windows/include/patches/fix-mingw-w64.patch new file mode 100644 index 0000000000..3dc2e7271b --- /dev/null +++ b/tools/Windows/include/patches/fix-mingw-w64.patch @@ -0,0 +1,251 @@ +--- a/src/cmake/externalpackages.cmake ++++ b/src/cmake/externalpackages.cmake +@@ -149,6 +149,8 @@ else () + endif () + endif () + ++add_definitions("-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB") ++ + if (VERBOSE) + message (STATUS "Boost found ${Boost_FOUND} ") + message (STATUS "Boost version ${Boost_VERSION}") +--- a/src/include/OpenImageIO/missing_math.h ++++ b/src/include/OpenImageIO/missing_math.h +@@ -106,7 +106,7 @@ + + OIIO_NAMESPACE_ENTER { + +-#ifdef _WIN32 ++#if defined(_WIN32) && !defined(__GNUC__) + // Windows doesn't define these functions from math.h + #define hypotf _hypotf + #define copysign(x,y) _copysign(x,y) +--- a/src/include/OpenImageIO/osdep.h ++++ b/src/include/OpenImageIO/osdep.h +@@ -33,7 +33,9 @@ + #ifdef _WIN32 + # define WIN32_LEAN_AND_MEAN + # define VC_EXTRALEAN ++# ifndef __MINGW32__ + # define NOMINMAX ++# endif + # include + #endif + +--- a/src/include/OpenImageIO/thread.h ++++ b/src/include/OpenImageIO/thread.h +@@ -98,6 +98,7 @@ + #endif + + #if defined(__GNUC__) && (defined(_GLIBCXX_ATOMIC_BUILTINS) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 401)) ++#include + #define USE_GCC_ATOMICS + #endif + +--- a/src/libOpenImageIO/CMakeLists.txt ++++ b/src/libOpenImageIO/CMakeLists.txt +@@ -258,7 +261,7 @@ + + + if (WIN32) +- target_link_libraries (OpenImageIO psapi.lib) ++ target_link_libraries (OpenImageIO psapi ws2_32) + endif () + link_ilmbase (OpenImageIO) + add_dependencies (OpenImageIO "${CMAKE_CURRENT_SOURCE_DIR}/libOpenImageIO.map") +--- a/src/libOpenImageIO/exif.cpp ++++ b/src/libOpenImageIO/exif.cpp +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + #include + +--- a/src/libOpenImageIO/imageinput.cpp ++++ b/src/libOpenImageIO/imageinput.cpp +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + #include "dassert.h" + #include "typedesc.h" +--- a/src/libtexture/imagecache.cpp ++++ b/src/libtexture/imagecache.cpp +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + #include + + #include +--- a/src/libtexture/texoptions.cpp ++++ b/src/libtexture/texoptions.cpp +@@ -29,6 +29,7 @@ + */ + + #include ++#include + #include + #include + using namespace std::tr1; +--- a/src/libtexture/texturesys.cpp ++++ b/src/libtexture/texturesys.cpp +@@ -30,6 +30,7 @@ + + + #include ++#include + #include + #include + #include +--- a/src/libutil/argparse.cpp ++++ b/src/libutil/argparse.cpp +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + + #include "strutil.h" + #include "sysutil.h" +--- a/src/libutil/filesystem.cpp ++++ b/src/libutil/filesystem.cpp +@@ -288,7 +288,7 @@ + FILE* + Filesystem::fopen (const std::string &path, const std::string &mode) + { +-#ifdef _WIN32 ++#if defined(_WIN32) && !defined(__GNUC__) + // on Windows fopen does not accept UTF-8 paths, so we convert to wide char + std::wstring wpath = Strutil::utf8_to_utf16 (path); + std::wstring wmode = Strutil::utf8_to_utf16 (mode); +@@ -307,7 +307,7 @@ + const std::string &path, + std::ios_base::openmode mode) + { +-#ifdef _WIN32 ++#if defined(_WIN32) && !defined(__GNUC__) + // Windows std::ifstream accepts non-standard wchar_t* + std::wstring wpath = Strutil::utf8_to_utf16(path); + stream.open (wpath.c_str(), mode); +@@ -324,7 +324,7 @@ + const std::string &path, + std::ios_base::openmode mode) + { +-#ifdef _WIN32 ++#if defined(_WIN32) && !defined(__GNUC__) + // Windows std::ofstream accepts non-standard wchar_t* + std::wstring wpath = Strutil::utf8_to_utf16 (path); + stream.open (wpath.c_str(), mode); +--- a/src/libutil/plugin.cpp ++++ b/src/libutil/plugin.cpp +@@ -93,7 +93,7 @@ dlclose (Handle plugin_handle) + void * + dlsym (Handle plugin_handle, const char *symbol_name) + { +- return GetProcAddress ((HMODULE)plugin_handle, symbol_name); ++ return (void *)GetProcAddress ((HMODULE)plugin_handle, symbol_name); + } + + +--- a/src/libutil/sysutil.cpp ++++ b/src/libutil/sysutil.cpp +@@ -137,7 +137,7 @@ Sysutil::get_local_time (const time_t *time, struct tm *converted_time) + #ifdef _MSC_VER + localtime_s (converted_time, time); + #else +- localtime_r (time, converted_time); ++ *converted_time = *localtime(time); + #endif + } + +--- a/src/ptex.imageio/ptex/PtexCache.cpp ++++ b/src/ptex.imageio/ptex/PtexCache.cpp +@@ -224,12 +224,21 @@ public: + // split into dirs + _searchdirs.clear(); + char* buff = strdup(path); +- char* pos = 0; +- char* token = strtok_r(buff, ":", &pos); +- while (token) { +- if (token[0]) _searchdirs.push_back(token); +- token = strtok_r(0, ":", &pos); +- } ++ char* pos = buff; ++ ++ do { ++ char *token = pos; ++ pos = strstr(pos, ":"); ++ ++ if (pos) { ++ pos[0] = '\0'; ++ pos++; ++ } ++ ++ if (token[0]) _searchdirs.push_back(token); ++ ++ } while(pos); ++ + free(buff); + } + +--- a/src/ptex.imageio/ptex/PtexPlatform.h ++++ b/src/ptex.imageio/ptex/PtexPlatform.h +@@ -79,11 +79,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + // missing functions on Windows + #ifdef WINDOWS ++#if !defined(__GNUC__) + #define snprintf sprintf_s + #define strtok_r strtok_s ++#endif + typedef __int64 FilePos; ++#if !defined(__GNUC__) + #define fseeko _fseeki64 + #define ftello _ftelli64 ++#else ++#define fseeko fseek ++#define ftello ftell ++#endif + + inline double log2(double x) { + return log(x) * 1.4426950408889634; +--- a/src/rla.imageio/rlaoutput.cpp ++++ b/src/rla.imageio/rlaoutput.cpp +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + #include "dassert.h" + #include "typedesc.h" +--- a/src/cmake/modules/FindOpenJpeg.cmake 2013-12-29 23:51:59.071600000 +0400 ++++ b/src/cmake/modules/FindOpenJpeg.cmake 2013-12-29 23:52:34.998400000 +0400 +@@ -78,7 +78,9 @@ + ${OPENJPEG_HOME}/lib64) + set (OpenJpeg_include_paths + ${OpenJpeg_include_paths} +- ${OPENJPEG_HOME}/include) ++ ${OPENJPEG_HOME}/include ++ ${OPENJPEG_HOME}/include/openjpeg ++ ${OPENJPEG_HOME}/include/openjpeg-1.5) + endif() + + +--- a/CMakeLists.txt 2013-12-30 01:06:13.042400000 +0400 ++++ b/CMakeLists.txt 2013-12-30 01:06:22.293200000 +0400 +@@ -423,7 +423,7 @@ + set (CPACK_GENERATOR "TGZ;STGZ;PackageMaker") + set (CPACK_SOURCE_GENERATOR "TGZ") + endif () +-if (WIN32) ++if (WIN32 AND NOT MINGW) + set (CPACK_GENERATOR "NSIS") + set(CPACK_PACKAGE_EXECUTABLES "iv" "iv - Image Viewer") + # set(CPACK_CREATE_DESCTOP_LINKS "iv" "iv - Image Viewer") diff --git a/tools/Windows/include/scripts/build-natron.sh b/tools/Windows/include/scripts/build-natron.sh index 9c0b3dfb71..a0fcf89a83 100644 --- a/tools/Windows/include/scripts/build-natron.sh +++ b/tools/Windows/include/scripts/build-natron.sh @@ -155,6 +155,8 @@ if [ ! -d "$SRC_PATH/OpenColorIO-Configs" ]; then (cd "$SRC_PATH"; tar xf OpenColorIO-Configs.tar.gz) || exit 1 rm "$SRC_PATH/OpenColorIO-Configs.tar.gz" || exit 1 mv "$SRC_PATH/OpenColorIO-Configs"* "$SRC_PATH/OpenColorIO-Configs" || exit 1 + rm -rf "$SRC_PATH/OpenColorIO-Configs/aces_1.0.1/baked" + rm -rf "$SRC_PATH/OpenColorIO-Configs/aces_1.0.1/python" fi cp -a "$SRC_PATH/OpenColorIO-Configs" "$INSTALL_PATH/share/" || exit 1 diff --git a/tools/Windows/include/scripts/build-sdk.sh b/tools/Windows/include/scripts/build-sdk.sh index 03bfb08225..6f6486d263 100644 --- a/tools/Windows/include/scripts/build-sdk.sh +++ b/tools/Windows/include/scripts/build-sdk.sh @@ -15,14 +15,12 @@ if [ "$1" = "32" ]; then PKG_PREFIX=$PKG_PREFIX32 FFMPEG_MXE_BIN_GPL=$FFMPEG_MXE_BIN_32_GPL_TAR FFMPEG_MXE_BIN_LGPL=$FFMPEG_MXE_BIN_32_LGPL_TAR - INSTALLER_BIN_TAR=$INSTALLER32_BIN_TAR elif [ "$1" = "64" ]; then BIT=64 INSTALL_PATH=$INSTALL64_PATH PKG_PREFIX=$PKG_PREFIX64 FFMPEG_MXE_BIN_GPL=$FFMPEG_MXE_BIN_64_GPL_TAR FFMPEG_MXE_BIN_LGPL=$FFMPEG_MXE_BIN_64_LGPL_TAR - INSTALLER_BIN_TAR=$INSTALLER64_BIN_TAR else echo "Usage build-sdk.sh " exit 1 @@ -137,9 +135,11 @@ if [ ! -f $INSTALL_PATH/bin/libOpenImageIO.dll ]; then cd oiio-Release-* || exit 1 OIIO_PATCHES=$CWD/include/patches/OpenImageIO patch -p1 -i ${OIIO_PATCHES}/fix-mingw-w64.patch || exit 1 - patch -p0 -i ${OIIO_PATCHES}/fix-mingw-w64.diff || exit 1 + # 1.6.x # patch -p1 -i ${OIIO_PATCHES}/fix-mingw-w64-16.patch || exit 1 + # 1.6.x # patch -p0 -i ${OIIO_PATCHES}/fix-mingw-w64-16.diff || exit 1 patch -p1 -i ${OIIO_PATCHES}/workaround-ansidecl-h-PTR-define-conflict.patch || exit 1 patch -p1 -i ${OIIO_PATCHES}/0001-MinGW-w64-include-winbase-h-early-for-TCHAR-types.patch || exit 1 + patch -p1 -i ${OIIO_PATCHES}/oiio-exrthreads.patch || exit 1 #patch -p1 -i ${OIIO_PATCHES}/0002-Also-link-to-opencv_videoio-library.patch || exit 1 rm -rf build mkdir build || exit 1 @@ -254,26 +254,12 @@ done #Make sure we have mt.exe for embedding manifests -if [ ! -f "${INSTALL_PATH}/bin/repogen.exe" ] || [ "$DOWNLOAD_INSTALLER" = "1" ]; then +if [ ! -f "${INSTALL_PATH}/bin/repogen.exe" ] || [ "$DOWNLOAD_INSTALLER" = "1" ] || [ ! -f "/mingw32/bin/dump_syms.exe" ] || [ ! -f "/mingw64/bin/dump_syms.exe" ] || [ ! -f "/mingw32/bin/mt.exe" ] || [ ! -f "/mingw64/bin/mt.exe" ]; then cd $SRC_PATH wget $THIRD_PARTY_BIN_URL/$INSTALLER_BIN_TAR -O $SRC_PATH/$INSTALLER_BIN_TAR || exit 1 unzip $CWD/src/$INSTALLER_BIN_TAR || exit 1 - cd natron-win$BIT-installer* || exit 1 - if [ -d "bin" ]; then - cd bin - fi - cp mt.exe /usr/bin || exit 1 - cp archivegen.exe $INSTALL_PATH/bin || exit 1 - cp binarycreator.exe $INSTALL_PATH/bin || exit 1 - cp installerbase.exe $INSTALL_PATH/bin || exit 1 - cp repogen.exe $INSTALL_PATH/bin || exit 1 -fi - -if [ ! -f "/mingw32/bin/dump_syms.exe" ] || [ ! -f "/mingw64/bin/dump_syms.exe" ]; then - cd $SRC_PATH || exit 1 - wget $THIRD_PARTY_BIN_URL/dump_syms.exe -O $SRC_PATH/dump_syms.exe || exit 1 - cp dump_syms.exe /mingw64/bin/ || exit 1 - cp dump_syms.exe /mingw32/bin/ || exit 1 + cp -a natron-win-installer/mingw32/bin/* /mingw32/bin/ || exit 1 + cp -a natron-win-installer/mingw64/bin/* /mingw64/bin/ || exit 1 fi echo diff --git a/tools/Windows/include/scripts/setup-msys.sh b/tools/Windows/include/scripts/setup-msys.sh index f7e5800f0d..1f701670b2 100644 --- a/tools/Windows/include/scripts/setup-msys.sh +++ b/tools/Windows/include/scripts/setup-msys.sh @@ -50,7 +50,7 @@ pacman $PKG_INSTALL_OPS ${PKG_PREFIX}pango pacman $PKG_INSTALL_OPS ${PKG_PREFIX}librsvg pacman $PKG_INSTALL_OPS ${PKG_PREFIX}libzip pacman $PKG_INSTALL_OPS ${PKG_PREFIX}cmake -pacman $PKG_INSTALL_OPS wget tar diffutils file gawk gettext grep make patch patchutils pkg-config sed unzip git bison flex rsync +pacman $PKG_INSTALL_OPS wget tar diffutils file gawk gettext grep make patch patchutils pkg-config sed unzip git bison flex rsync zip # needed by oiio if [ ! -f /mingw${1}/include/byteswap.h ]; then diff --git a/tools/linux/common.sh b/tools/linux/common.sh index 61d0454f09..c8d9661531 100644 --- a/tools/linux/common.sh +++ b/tools/linux/common.sh @@ -47,7 +47,7 @@ PACKAGES=$NATRON_PKG,$CORELIBS_PKG,$PROFILES_PKG,$IOPLUG_PKG,$MISCPLUG_PKG,$AREN # bump number when OpenColorIO-Configs changes GIT_OCIO_CONFIG_TAR=https://github.com/MrKepzie/OpenColorIO-Configs/archive/Natron-v2.0.tar.gz -COLOR_PROFILES_VERSION=2.0.0 +COLOR_PROFILES_VERSION=2.0.1 # bump timestamp on SDK changes, important! CORELIBS_VERSION=20160121 @@ -136,7 +136,7 @@ BOOST_TAR=boost_1_55_0.tar.bz2 CAIRO_TAR=cairo-1.14.6.tar.xz FFMPEG_TAR=ffmpeg-2.8.5.tar.xz OCIO_TAR=OpenColorIO-1.0.9.tar.gz -OIIO_TAR=oiio-Release-1.6.9.tar.gz +OIIO_TAR=oiio-Release-1.5.23.tar.gz PYSIDE_TAR=pyside-qt4.8+1.2.2.tar.bz2 PYSIDE2_TAR=pyside2-2.0.0.dev0.tar.gz SHIBOK_TAR=shiboken-1.2.2.tar.bz2 diff --git a/tools/linux/include/patches/OpenImageIO/oiio-exrthreads.patch b/tools/linux/include/patches/OpenImageIO/oiio-exrthreads.patch new file mode 100644 index 0000000000..c6515b8770 --- /dev/null +++ b/tools/linux/include/patches/OpenImageIO/oiio-exrthreads.patch @@ -0,0 +1,117 @@ +diff --git a/src/doc/imageioapi.tex b/src/doc/imageioapi.tex +index 63425b2..66603ff 100644 +--- a/src/doc/imageioapi.tex ++++ b/src/doc/imageioapi.tex +@@ -805,11 +805,31 @@ attribute is a string), the attribute will not be modified, and {\cf + \vspace{10pt} + \index{threads} \label{sec:attribute:threads} + Some \product operations can be accelerated if allowed to spawn multiple +-threads to parallelize the task. (Examples: decompressing multiple +-simultaneously-read OpenEXR scanlines, or many \ImageBuf operations.) +-This attribute sets the maximum number of threads that will be spawned. +-The default is 1. If set to 0, it means that it should use as many ++threads to parallelize the task. (Examples: simultaneous format conversions ++of multiple scanlines read together, or many \ImageBufAlgo operations.) ++This attribute sets the default number of threads that will be spawned ++for these operations (the ``fan out''). ++The default is 0, which means that it should spawn as many + threads as there are hardware cores present on the system. ++ ++Situations where the main application logic is essentially single threaded ++(i.e., one top-level call into OIIO at a time) should leave this at the ++default value, or some reasonable number of cores, thus allowing lots of ++threads to fill the cores when OIIO has big tasks to complete. But ++situations where you have many threads at the application level, each of ++which is expected to be making separate OIIO calls simultaneously, should ++set this to 1, thus having each calling thread do its own work inside of ++OIIO rather than spawning new threads with a high overall ``fan out.'' ++\apiend ++ ++\apiitem{int exr_threads} ++\vspace{10pt} ++\index{exr_threads} ++\NEW % 1.6 ++Sets the internal OpenEXR thread pool size. The default is to use as many ++threads as the amount of hardware concurrency detected. ++Note that this is separate from the OIIO ++\qkw{threads} attribute. + \apiend + + \apiitem{string plugin_searchpath} +diff --git a/src/libOpenImageIO/imageio.cpp b/src/libOpenImageIO/imageio.cpp +index 3fc2118..56d6054 100644 +--- a/src/libOpenImageIO/imageio.cpp ++++ b/src/libOpenImageIO/imageio.cpp +@@ -51,6 +51,7 @@ OIIO_NAMESPACE_BEGIN + namespace pvt { + recursive_mutex imageio_mutex; + atomic_int oiio_threads (boost::thread::hardware_concurrency()); ++atomic_int oiio_exr_threads (boost::thread::hardware_concurrency()); + atomic_int oiio_read_chunk (256); + ustring plugin_searchpath (OIIO_DEFAULT_PLUGIN_SEARCHPATH); + std::string format_list; // comma-separated list of all formats +@@ -121,7 +122,7 @@ namespace { + // Private global OIIO data. + + static spin_mutex attrib_mutex; +-static const int maxthreads = 64; // reasonable maximum for sanity check ++static const int maxthreads = 256; // reasonable maximum for sanity check + + }; + +@@ -146,6 +147,10 @@ attribute (string_view name, TypeDesc type, const void *val) + plugin_searchpath = ustring (*(const char **)val); + return true; + } ++ if (name == "exr_threads" && type == TypeDesc::TypeInt) { ++ oiio_exr_threads = Imath::clamp (*(const int *)val, 0, maxthreads); ++ return true; ++ } + return false; + } + +@@ -179,6 +184,10 @@ getattribute (string_view name, TypeDesc type, void *val) + *(ustring *)val = ustring(extension_list); + return true; + } ++ if (name == "exr_threads" && type == TypeDesc::TypeInt) { ++ *(int *)val = oiio_exr_threads; ++ return true; ++ } + return false; + } + +diff --git a/src/oiiotool/oiiotool.cpp b/src/oiiotool/oiiotool.cpp +index c484877..e7ca210 100644 +--- a/src/oiiotool/oiiotool.cpp ++++ b/src/oiiotool/oiiotool.cpp +@@ -328,7 +328,9 @@ static int + set_threads (int argc, const char *argv[]) + { + ASSERT (argc == 2); +- OIIO::attribute ("threads", atoi(argv[1])); ++ int nthreads = atoi(argv[1]); ++ OIIO::attribute ("threads", nthreads); ++ OIIO::attribute ("exr_threads", nthreads); + return 0; + } + +diff --git a/src/openexr.imageio/exrinput.cpp b/src/openexr.imageio/exrinput.cpp +index 00c6145..40efba2 100644 +--- a/src/openexr.imageio/exrinput.cpp ++++ b/src/openexr.imageio/exrinput.cpp +@@ -316,12 +316,12 @@ void set_exr_threads () + static spin_mutex exr_threads_mutex; + + int oiio_threads = 1; +- OIIO::getattribute ("threads", oiio_threads); ++ OIIO::getattribute ("exr_threads", oiio_threads); + + spin_lock lock (exr_threads_mutex); + if (exr_threads != oiio_threads) { + exr_threads = oiio_threads; +- Imf::setGlobalThreadCount (exr_threads == 1 ? 0 : exr_threads); ++ Imf::setGlobalThreadCount (exr_threads); + } + } + diff --git a/tools/linux/include/scripts/build-natron.sh b/tools/linux/include/scripts/build-natron.sh index 8e08d79dc6..035bdf522e 100644 --- a/tools/linux/include/scripts/build-natron.sh +++ b/tools/linux/include/scripts/build-natron.sh @@ -194,6 +194,8 @@ if [ ! -d "$SRC_PATH/OpenColorIO-Configs" ]; then (cd "$SRC_PATH"; tar xf OpenColorIO-Configs.tar.gz) || exit 1 rm "$SRC_PATH/OpenColorIO-Configs.tar.gz" || exit 1 mv "$SRC_PATH/OpenColorIO-Configs"* "$SRC_PATH/OpenColorIO-Configs" || exit 1 + rm -rf "$SRC_PATH/OpenColorIO-Configs/aces_1.0.1/baked" + rm -rf "$SRC_PATH/OpenColorIO-Configs/aces_1.0.1/python" fi cp -a $SRC_PATH/OpenColorIO-Configs $INSTALL_PATH/share/ || exit 1 diff --git a/tools/linux/include/scripts/build-sdk.sh b/tools/linux/include/scripts/build-sdk.sh index 023c6e4099..f140881029 100644 --- a/tools/linux/include/scripts/build-sdk.sh +++ b/tools/linux/include/scripts/build-sdk.sh @@ -844,10 +844,10 @@ if [ ! -f $INSTALL_PATH/lib/libOpenImageIO.so ]; then fi tar xvf $SRC_PATH/$OIIO_TAR || exit 1 cd oiio-Release-* || exit 1 - #patch -p1 -i $INC_PATH/patches/OpenImageIO/oiio-exrthreads.patch || exit 1 + patch -p1 -i $INC_PATH/patches/OpenImageIO/oiio-exrthreads.patch || exit 1 mkdir build || exit 1 cd build || exit 1 - env CFLAGS="$BF" CXXFLAGS="$BF" CPPFLAGS="-I${INSTALL_PATH}/include" LDFLAGS="-L${INSTALL_PATH}/lib" CXXFLAGS="-fPIC" cmake -DUSE_OPENCV:BOOL=FALSE -DUSE_OPENSSL:BOOL=FALSE -DOPENEXR_HOME=$INSTALL_PATH -DILMBASE_HOME=$INSTALL_PATH -DTHIRD_PARTY_TOOLS_HOME=$INSTALL_PATH -DUSE_QT:BOOL=FALSE -DUSE_TBB:BOOL=FALSE -DUSE_PYTHON:BOOL=FALSE -DUSE_FIELD3D:BOOL=FALSE -DOIIO_BUILD_TESTS=0 -DOIIO_BUILD_TOOLS=0 -DUSE_LIB_RAW=1 -DLIBRAW_PATH=$INSTALL_PATH -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DBOOST_ROOT=$INSTALL_PATH -DSTOP_ON_WARNING:BOOL=FALSE -DUSE_GIF:BOOL=TRUE -DUSE_FREETYPE:BOOL=TRUE -DFREETYPE_INCLUDE_PATH=$INSTALL_PATH/include -DUSE_FFMPEG:BOOL=FALSE -DLINKSTATIC=0 -DBUILDSTATIC=0 -DOPENJPEG_HOME=$INSTALL_PATH -DOPENJPEG_INCLUDE_DIR=$INSTALL_PATH/include/openjpeg-1.5 -DOPENJPEG_LIBRARIES=$INSTALL_PATH/lib -DUSE_OPENJPEG:BOOL=TRUE .. || exit 1 + env CFLAGS="$BF" CXXFLAGS="$BF" CPPFLAGS="-I${INSTALL_PATH}/include" LDFLAGS="-L${INSTALL_PATH}/lib" CXXFLAGS="-fPIC" cmake -DUSE_OPENCV:BOOL=FALSE -DUSE_OPENSSL:BOOL=FALSE -DOPENEXR_HOME=$INSTALL_PATH -DILMBASE_HOME=$INSTALL_PATH -DTHIRD_PARTY_TOOLS_HOME=$INSTALL_PATH -DUSE_QT:BOOL=FALSE -DUSE_TBB:BOOL=FALSE -DUSE_PYTHON:BOOL=FALSE -DUSE_FIELD3D:BOOL=FALSE -DOIIO_BUILD_TESTS=0 -DOIIO_BUILD_TOOLS=1 -DUSE_LIB_RAW=1 -DLIBRAW_PATH=$INSTALL_PATH -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DBOOST_ROOT=$INSTALL_PATH -DSTOP_ON_WARNING:BOOL=FALSE -DUSE_GIF:BOOL=TRUE -DUSE_FREETYPE:BOOL=TRUE -DFREETYPE_INCLUDE_PATH=$INSTALL_PATH/include -DUSE_FFMPEG:BOOL=FALSE -DLINKSTATIC=0 -DBUILDSTATIC=0 -DOPENJPEG_HOME=$INSTALL_PATH -DOPENJPEG_INCLUDE_DIR=$INSTALL_PATH/include/openjpeg-1.5 -DOPENJPEG_LIBRARIES=$INSTALL_PATH/lib -DUSE_OPENJPEG:BOOL=TRUE .. || exit 1 make -j${MKJOBS} || exit 1 make install || exit 1 if [ "$DDIR" != "" ]; then