├── .clang-format ├── .travis-coverity-scan-build.sh ├── .travis.yml.disabled ├── CMakeLists.txt ├── EXR ├── Info.plist ├── Makefile ├── ReadEXR.cpp ├── WriteEXR.cpp ├── fr.inria.openfx.ReadEXR.png ├── fr.inria.openfx.ReadEXR.svg ├── fr.inria.openfx.WriteEXR.png └── fr.inria.openfx.WriteEXR.svg ├── FFmpeg ├── FFmpegFile.cpp ├── FFmpegFile.h ├── Info.plist ├── Makefile ├── PixelFormat.cpp ├── PixelFormat.h ├── ReadFFmpeg.cpp ├── TODO.txt ├── WriteFFmpeg.cpp ├── fr.inria.openfx.ReadFFmpeg.png ├── fr.inria.openfx.ReadFFmpeg.svg ├── fr.inria.openfx.WriteFFmpeg.png └── fr.inria.openfx.WriteFFmpeg.svg ├── INRIA.IO.manifest ├── IO.xcodeproj └── project.pbxproj ├── IO ├── Info.plist └── Makefile ├── IOPluginProperty.props ├── IOSupport ├── GenericOCIO.cpp ├── GenericOCIO.h ├── GenericOCIOOpenGL.cpp ├── GenericReader.cpp ├── GenericReader.h ├── GenericWriter.cpp ├── GenericWriter.h ├── IOUtility.h ├── glsl.README.txt ├── glsl.cpp └── glsl.h ├── LICENSE ├── Makefile ├── Makefile.master ├── OCIO ├── Info.plist ├── Makefile ├── OCIOCDLTransform.cpp ├── OCIOColorSpace.cpp ├── OCIODisplay.cpp ├── OCIOFileTransform.cpp ├── OCIOLogConvert.cpp ├── OCIOLookTransform.cpp ├── OCIOPluginBase.cpp ├── OCIOPluginBase.h ├── fr.inria.openfx.OCIOCDLTransform.png ├── fr.inria.openfx.OCIOColorSpace.png ├── fr.inria.openfx.OCIODisplay.png ├── fr.inria.openfx.OCIOFileTransform.png ├── fr.inria.openfx.OCIOLogConvert.png └── fr.inria.openfx.OCIOLookTransform.png ├── OIIO ├── Info.plist ├── Makefile ├── OIIOGlobal.cpp ├── OIIOGlobal.h ├── OIIOResize.cpp ├── OIIOText.cpp ├── ReadOIIO.cpp ├── WriteOIIO.cpp ├── fr.inria.openfx.OIIOResize.png ├── fr.inria.openfx.OIIOResize.svg ├── fr.inria.openfx.OIIOText.png ├── fr.inria.openfx.OIIOText.svg ├── fr.inria.openfx.ReadOIIO.png ├── fr.inria.openfx.ReadOIIO.svg ├── fr.inria.openfx.WriteOIIO.png └── fr.inria.openfx.WriteOIIO.svg ├── PFM ├── Info.plist ├── Makefile ├── ReadPFM.cpp ├── WritePFM.cpp ├── fr.inria.openfx.ReadPFM.png ├── fr.inria.openfx.ReadPFM.svg ├── fr.inria.openfx.WritePFM.png └── fr.inria.openfx.WritePFM.svg ├── PNG ├── Info.plist ├── Makefile ├── ReadPNG.cpp ├── WritePNG.cpp ├── fr.inria.openfx.ReadPNG.png ├── fr.inria.openfx.ReadPNG.svg ├── fr.inria.openfx.WritePNG.png └── fr.inria.openfx.WritePNG.svg ├── README.md ├── RunScript ├── Info.plist ├── Makefile ├── RunScript.cpp ├── RunScript.h ├── fr.inria.openfx.RunScript.png ├── fr.inria.openfx.RunScript.svg └── pstream.h ├── SeExpr ├── Info.plist ├── Makefile ├── SeExpr.cpp ├── SeGrain.cpp ├── SeNoise.cpp ├── fr.inria.openfx.SeExpr.png ├── fr.inria.openfx.SeExpr.svg ├── fr.inria.openfx.SeExprSimple.png └── fr.inria.openfx.SeExprSimple.svg ├── cmake └── Modules │ ├── FindFFmpeg.cmake │ ├── FindLibRaw.cmake │ ├── FindOpenColorIO.cmake │ ├── FindOpenEXR.cmake │ ├── FindOpenImageIO.cmake │ └── FindSeExpr2.cmake └── gpl-header-c.txt /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: WebKit 2 | AlignAfterOpenBracket: Align 3 | AlwaysBreakAfterDefinitionReturnType: TopLevel 4 | WhitespaceSensitiveMacros: ['CLANG_DIAG_ON', 'CLANG_DIAG_OFF', 'GCC_DIAG_ON', 'GCC_DIAG_OFF', 'MSVC_DIAG_ON', 'MSVC_DIAG_OFF'] 5 | 6 | -------------------------------------------------------------------------------- /.travis-coverity-scan-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Modified coverity scan build script 3 | # Original script available at https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh 4 | # Additions (see corresponding sections below): 5 | # - Verify Coverity Scan run condition 6 | # - Verify Coverity Scan script test mode 7 | # - set TOOL_BASE to a writable directory with more than 1Gb free space 8 | 9 | set -e 10 | 11 | # Environment check 12 | echo -e "\033[33;1mNote: COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN are available on Project Settings page on scan.coverity.com\033[0m" 13 | [ -z "$COVERITY_SCAN_PROJECT_NAME" ] && echo "ERROR: COVERITY_SCAN_PROJECT_NAME must be set" && exit 1 14 | [ -z "$COVERITY_SCAN_NOTIFICATION_EMAIL" ] && echo "ERROR: COVERITY_SCAN_NOTIFICATION_EMAIL must be set" && exit 1 15 | [ -z "$COVERITY_SCAN_BRANCH_PATTERN" ] && echo "ERROR: COVERITY_SCAN_BRANCH_PATTERN must be set" && exit 1 16 | [ -z "$COVERITY_SCAN_BUILD_COMMAND" ] && echo "ERROR: COVERITY_SCAN_BUILD_COMMAND must be set" && exit 1 17 | [ -z "$COVERITY_SCAN_TOKEN" ] && echo "ERROR: COVERITY_SCAN_TOKEN must be set" && exit 1 18 | 19 | PLATFORM=`uname` 20 | TOOL_ARCHIVE=/tmp/cov-analysis-${PLATFORM}.tgz 21 | TOOL_URL=https://scan.coverity.com/download/${PLATFORM} 22 | #TOOL_BASE=/tmp/coverity-scan-analysis 23 | TOOL_BASE=/home/travis/coverity-scan-analysis 24 | UPLOAD_URL="https://scan.coverity.com/builds" 25 | SCAN_URL="https://scan.coverity.com" 26 | 27 | # Verify Coverity Scan run condition 28 | COVERITY_SCAN_RUN_CONDITION=${coverity_scan_run_condition:-true} 29 | echo -ne "\033[33;1mTesting '${COVERITY_SCAN_RUN_CONDITION}' condition... " 30 | if eval [ $COVERITY_SCAN_RUN_CONDITION ]; then 31 | echo -e "True.\033[0m" 32 | else 33 | echo -e "False. Exit.\033[0m" 34 | exit 1 35 | fi 36 | 37 | # Do not run on pull requests 38 | if [ "${TRAVIS_PULL_REQUEST}" = "true" ]; then 39 | echo -e "\033[33;1mINFO: Skipping Coverity Analysis: branch is a pull request.\033[0m" 40 | exit 0 41 | fi 42 | 43 | # Verify this branch should run 44 | IS_COVERITY_SCAN_BRANCH=`ruby -e "puts '${TRAVIS_BRANCH}' =~ /\\A$COVERITY_SCAN_BRANCH_PATTERN\\z/ ? 1 : 0"` 45 | if [ "$IS_COVERITY_SCAN_BRANCH" = "1" ]; then 46 | echo -e "\033[33;1mCoverity Scan configured to run on branch ${TRAVIS_BRANCH}\033[0m" 47 | else 48 | echo -e "\033[33;1mCoverity Scan NOT configured to run on branch ${TRAVIS_BRANCH}\033[0m" 49 | exit 1 50 | fi 51 | 52 | # Verify upload is permitted 53 | AUTH_RES=`curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted` 54 | if [ "$AUTH_RES" = "Access denied" ]; then 55 | echo -e "\033[33;1mCoverity Scan API access denied. Check COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN.\033[0m" 56 | exit 1 57 | else 58 | AUTH=`echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['upload_permitted']"` 59 | if [ "$AUTH" = "true" ]; then 60 | echo -e "\033[33;1mCoverity Scan analysis authorized per quota.\033[0m" 61 | else 62 | WHEN=`echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['next_upload_permitted_at']"` 63 | echo -e "\033[33;1mCoverity Scan analysis NOT authorized until $WHEN.\033[0m" 64 | exit 0 65 | fi 66 | fi 67 | 68 | if [ ! -d $TOOL_BASE ]; then 69 | # Download Coverity Scan Analysis Tool 70 | if [ ! -e $TOOL_ARCHIVE ]; then 71 | echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m" 72 | wget -nv -O $TOOL_ARCHIVE $TOOL_URL --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN" 73 | fi 74 | 75 | # Extract Coverity Scan Analysis Tool 76 | echo -e "\033[33;1mExtracting Coverity Scan Analysis Tool...\033[0m" 77 | mkdir -p $TOOL_BASE 78 | pushd $TOOL_BASE 79 | tar xzf $TOOL_ARCHIVE 80 | popd 81 | fi 82 | 83 | TOOL_DIR=`find $TOOL_BASE -type d -name 'cov-analysis*'` 84 | export PATH=$TOOL_DIR/bin:$PATH 85 | 86 | # Build 87 | echo -e "\033[33;1mRunning Coverity Scan Analysis Tool...\033[0m" 88 | COV_BUILD_OPTIONS="" 89 | #COV_BUILD_OPTIONS="--return-emit-failures 8 --parse-error-threshold 85" 90 | RESULTS_DIR="cov-int" 91 | eval "${COVERITY_SCAN_BUILD_COMMAND_PREPEND}" 92 | COVERITY_UNSUPPORTED=1 cov-build --dir $RESULTS_DIR $COV_BUILD_OPTIONS $COVERITY_SCAN_BUILD_COMMAND 93 | cov-import-scm --dir $RESULTS_DIR --scm git --log $RESULTS_DIR/scm_log.txt 2>&1 94 | 95 | # Upload results 96 | echo -e "\033[33;1mTarring Coverity Scan Analysis results...\033[0m" 97 | RESULTS_ARCHIVE=analysis-results.tgz 98 | tar czf $RESULTS_ARCHIVE $RESULTS_DIR 99 | SHA=`git rev-parse --short HEAD` 100 | 101 | # Verify Coverity Scan script test mode 102 | if [ "$coverity_scan_script_test_mode" = true ]; then 103 | echo -e "\033[33;1mCoverity Scan configured in script test mode. Exit.\033[0m" 104 | exit 1 105 | fi 106 | 107 | echo -e "\033[33;1mUploading Coverity Scan Analysis results...\033[0m" 108 | response=$(curl \ 109 | --silent --write-out "\n%{http_code}\n" \ 110 | --form project=$COVERITY_SCAN_PROJECT_NAME \ 111 | --form token=$COVERITY_SCAN_TOKEN \ 112 | --form email=$COVERITY_SCAN_NOTIFICATION_EMAIL \ 113 | --form file=@$RESULTS_ARCHIVE \ 114 | --form version=$SHA \ 115 | --form description="Travis CI build" \ 116 | $UPLOAD_URL) 117 | status_code=$(echo "$response" | sed -n '$p') 118 | if [ "$status_code" != "201" ]; then 119 | TEXT=$(echo "$response" | sed '$d') 120 | echo -e "\033[33;1mCoverity Scan upload failed: $TEXT.\033[0m" 121 | exit 1 122 | fi 123 | -------------------------------------------------------------------------------- /.travis.yml.disabled: -------------------------------------------------------------------------------- 1 | env: 2 | global: 3 | # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created 4 | # via the "travis encrypt" command using the project repo's public key 5 | - secure: "NgEwy72/AUwS5fc2MhuEakGq2c76rjyJRM8k6wLFLUFAcniwLI/Unl52TKA0dt+gX3ypBfJtOB5OZop3pOgGNf/aYrVQOlZTe7S/agyN9KQgLPRTfpwcxtaibF4/6mA9sG5vbQc/IkqQYMczcZUM8L5wXvL7vqIfwHhi8nASWB1rv8DaID42EL/V6adO7iq/ln9MHAjOMRdPwb9/UR20v/nC1G+iMIiXQA6YjvgiJN2FbqDHDwAYnfc2Ln0N5HGgFB38ducaPHKi/66Siayd4tJ9uCQ/mM16+zT0ZlSNFwfxcnXv0bAlh39S2C+vysLmsRmaZneYHgTboWWbCEJxpJ1HM1nwNYKkDt/IMV5CFjqW/f7icZWOvtaYmxaH/NDHG9ZTKZ60+gvyCFO87E0rwj+Wlm3kHMeoENj8dYyjlmVAtPPK4CJ6YjnI+Wr1BaR3TYM5mkkrhhnhqZYZ0ZuX+i04jJPTpwZpEEY7m7y0LMno2IOdMqpSyCJurP6HWqL63oEVQzwrTiDy+hxZP4SAV+tahypxyhf9YypKnpe8ug3LyTW+NSZlPsCj/qzeCGsp/Pb4Gyr1P15jyD4SKxuD4HFpqicSeTtzD84znv8mZ/Lf5/typGkfuSFPkAUSUfcu2PmGOhAh5sdfoWaA9y4Lmnogc5ddVz6Qcx4LYCi0+1Y=" 6 | # Coverity run condition (avoid matrix multiple runs), need customized 7 | # build script. Need an update if new matrix cases. 8 | - coverity_scan_run_condition='"$CC" = gcc -a "$TRAVIS_OS_NAME" != osx' 9 | # Coverity script test mode (if true no uploading, avoid reaching the quota) 10 | # usual processing: false. 11 | - coverity_scan_script_test_mode=false 12 | # Travis CI has 1.5 cores per VM, take advantage of it 13 | - MAKEFLAGSPARALLEL="-j 2" 14 | 15 | language: cpp 16 | 17 | matrix: 18 | include: 19 | - os: linux 20 | dist: bionic 21 | sudo: required 22 | compiler: gcc 23 | - os: linux 24 | dist: bionic 25 | sudo: required 26 | compiler: clang 27 | exclude: 28 | - os: osx 29 | compiler: gcc 30 | fast_finish: true 31 | 32 | # requires boost >= 1.49 to compile in C++11 mode 33 | # see http://stackoverflow.com/questions/11302758/error-while-copy-constructing-boostshared-ptr-using-c11 34 | # we use the irie/boost ppa for that purpose 35 | 36 | # we get libyaml-cpp-dev from kubuntu backports 37 | 38 | before_install: 39 | - date -u 40 | - uname -a 41 | - export J='-j3' 42 | - if [ ${TRAVIS_OS_NAME} = "linux" ]; then 43 | echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- ; 44 | fi 45 | - git submodule update --init --recursive 46 | # - sudo add-apt-repository -y ppa:george-edison55/cmake-3.x 47 | # - sudo add-apt-repository -y ppa:archivematica/externals 48 | # - sudo add-apt-repository -y ppa:jon-severinsson/ffmpeg 49 | # - sudo add-apt-repository -y ppa:spvkgn/ffmpeg-dev 50 | - sudo add-apt-repository -y ppa:jonathonf/ffmpeg-4 51 | # - sudo add-apt-repository -y ppa:irie/boost 52 | - sudo add-apt-repository -y ppa:kubuntu-ppa/backports 53 | - sudo apt-get update -qq 54 | # - sudo apt-get upgrade 55 | - sudo apt-get install -y --allow-unauthenticated libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libswresample-dev 56 | - if [ ${TRAVIS_OS_NAME} = "linux" -a "$CC" = "gcc" ]; 57 | then 58 | if [ "$BUILDDOC" = 1 ]; then 59 | sudo apt-get install doxygen xsltproc; 60 | fi; 61 | sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; 62 | sudo apt-get update; 63 | sudo apt-get install gcc-8 g++-8; 64 | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 90; 65 | sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90; 66 | fi 67 | 68 | install: 69 | - if [[ ${COVERITY_BUILD_DISABLED} == 1 ]]; 70 | then 71 | exit 0; 72 | fi 73 | # OpenColorIO 74 | - sudo apt-get install cmake libtinyxml-dev liblcms2-dev libyaml-cpp-dev libboost-dev 75 | - if [ ! -d "$HOME/ocio/lib" ]; then 76 | wget https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v1.1.1.tar.gz -O /tmp/ocio.tgz; 77 | tar -xvzf /tmp/ocio.tgz -C $HOME; 78 | pushd $HOME/OpenColorIO-1.1.1; 79 | find . -name CMakeLists.txt -exec sed -e s/-Werror// -i {} \; ; 80 | mkdir _build && cd _build; 81 | cmake -DCMAKE_INSTALL_PREFIX=$HOME/ocio -DCMAKE_BUILD_TYPE=Release -DOCIO_BUILD_JNIGLUE=OFF -DOCIO_BUILD_NUKE=OFF -DOCIO_BUILD_SHARED=ON -DOCIO_BUILD_STATIC=OFF -DOCIO_STATIC_JNIGLUE=OFF -DOCIO_BUILD_TRUELIGHT=OFF -DUSE_EXTERNAL_LCMS=ON -DUSE_EXTERNAL_TINYXML=ON -DUSE_EXTERNAL_YAML=ON -DOCIO_BUILD_APPS=OFF -DOCIO_USE_BOOST_PTR=ON -DOCIO_BUILD_TESTS=OFF -DOCIO_BUILD_PYGLUE=OFF ..; 82 | make $MAKEFLAGSPARALLEL && make install; 83 | popd; 84 | else 85 | echo 'Using cached OpenColorIO'; 86 | fi 87 | # OpenEXR (2.0 is required for OIIO 1.8) 88 | # see https://github.com/PixarAnimationStudios/USD/blob/master/.travis.yml 89 | - if [ ! -d "$HOME/openexr/lib" ]; then 90 | wget https://github.com/openexr/openexr/releases/download/v2.3.0/ilmbase-2.3.0.tar.gz -O /tmp/ilmbase.tgz; 91 | tar -xvzf /tmp/ilmbase.tgz -C $HOME; 92 | pushd $HOME/ilmbase-2.3.0; 93 | ./configure --prefix=$HOME/openexr; 94 | make && make install; 95 | popd; 96 | wget https://github.com/openexr/openexr/releases/download/v2.3.0/openexr-2.3.0.tar.gz -O /tmp/openexr.tgz; 97 | tar -xvzf /tmp/openexr.tgz -C $HOME; 98 | pushd $HOME/openexr-2.3.0; 99 | ./configure --prefix=$HOME/openexr --with-pkg-config=no LDFLAGS="-Wl,-rpath -Wl,$HOME/openexr/lib"; 100 | make $MAKEFLAGSPARALLEL && make install; 101 | popd; 102 | else 103 | echo 'Using cached OpenEXR'; 104 | fi 105 | # OpenImageIO (for some reason, freetype is not recognized) 106 | # see https://github.com/PixarAnimationStudios/USD/blob/master/.travis.yml 107 | - sudo apt-get install libopenjp2-7-dev libtiff-dev libjpeg-dev libpng-dev libraw-dev libboost-filesystem-dev libboost-regex-dev libboost-thread-dev libboost-system-dev libwebp-dev libfreetype6-dev libssl-dev 108 | - if [ ! -d "$HOME/oiio/lib" ]; then 109 | wget https://github.com/OpenImageIO/oiio/archive/Release-2.2.15.1.tar.gz -O /tmp/oiio.tgz; 110 | tar -xvzf /tmp/oiio.tgz -C $HOME; 111 | pushd $HOME/oiio-Release-2.2.15.1; 112 | mkdir _build && cd _build; 113 | cmake -DCMAKE_INSTALL_PREFIX=$HOME/oiio -DILMBASE_ROOT_DIR=$HOME/openexr -DOPENEXR_ROOT_DIR=$HOME/openexr -DOCIO_HOME=$HOME/ocio -DUSE_QT=OFF -DUSE_PYTHON=OFF -DUSE_PYTHON3=OFF -DUSE_FIELD3D=OFF -DUSE_FFMPEG=OFF -DUSE_OPENJPEG=ON -DUSE_OCIO=ON -DUSE_OPENCV=OFF -DUSE_OPENSSL=OFF -DUSE_FREETYPE=ON -DUSE_GIF=OFF -DUSE_PTEX=OFF -DUSE_LIBRAW=ON -DOIIO_BUILD_TESTS=OFF -DOIIO_BUILD_TOOLS=OFF -DSTOP_ON_WARNING:BOOL=OFF ..; 114 | make $MAKEFLAGSPARALLEL && make install; 115 | popd; 116 | else 117 | echo 'Using cached OpenImageIO'; 118 | fi 119 | # FFmpeg 120 | - sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libavutil-dev 121 | # SeExpr 122 | - if [ ! -d "$HOME/seexpr/lib" ]; then 123 | wget https://github.com/wdas/SeExpr/archive/v2.11.tar.gz -O /tmp/seexpr.tgz; 124 | tar -xvzf /tmp/seexpr.tgz -C $HOME; 125 | pushd $HOME/SeExpr-2.11; 126 | sed -i -e '/SeExprEditor/d' -e '/demos/d' -e '/tests/d' ./CMakeLists.txt; 127 | mkdir _build && cd _build; 128 | cmake -DCMAKE_INSTALL_PREFIX=$HOME/seexpr ..; 129 | make $MAKEFLAGSPARALLEL && make install; 130 | popd; 131 | else 132 | echo 'Using cached SeExpr'; 133 | fi 134 | 135 | cache: 136 | directories: 137 | - $HOME/openexr 138 | - $HOME/ocio 139 | - $HOME/oiio 140 | - $HOME/seexpr 141 | 142 | script: 143 | - if [[ ${COVERITY_SCAN_BRANCH} == 1 ]]; 144 | then 145 | echo "Don't build on coverty_scan branch."; 146 | exit 0; 147 | fi 148 | #- pkg-config --cflags libraw_r 149 | #- dpkg-query -L libraw-dev 150 | #- env PKG_CONFIG_PATH=$HOME/ocio/lib/pkgconfig:$HOME/openexr/lib/pkgconfig pkg-config --cflags libraw_r 151 | #- ls $HOME/openexr/lib/pkgconfig 152 | #- ls $HOME/openexr/include/OpenEXR 153 | - env PKG_CONFIG_PATH=$HOME/oiio/lib/pkgconfig:$HOME/ocio/lib/pkgconfig:$HOME/openexr/lib/pkgconfig make $J V=1 CXXFLAGS_EXTRA=-std=c++11 CONFIG=debug SEEXPR_HOME=$HOME/seexpr 154 | - env PKG_CONFIG_PATH=$HOME/oiio/lib/pkgconfig:$HOME/ocio/lib/pkgconfig:$HOME/openexr/lib/pkgconfig make $J V=1 CXXFLAGS_EXTRA=-std=c++11 CONFIG=debug SEEXPR_HOME=$HOME/seexpr nomulti 155 | - make clean 156 | # without OCIO OpenGL support 157 | - env PKG_CONFIG_PATH=$HOME/oiio/lib/pkgconfig:$HOME/ocio/lib/pkgconfig:$HOME/openexr/lib/pkgconfig make $J V=1 CXXFLAGS_EXTRA=-std=c++11 CONFIG=debug SEEXPR_HOME=$HOME/seexpr OCIO_OPENGL_CXXFLAGS= OCIO_OPENGL_LINKFLAGS= 158 | - make clean 159 | # without OCIO 160 | - env PKG_CONFIG_PATH=$HOME/oiio/lib/pkgconfig:$HOME/openexr/lib/pkgconfig make $J V=1 CXXFLAGS_EXTRA=-std=c++11 CONFIG=debug SEEXPR_HOME=$HOME/seexpr OCIO_CXXFLAGS= OCIO_LINKFLAGS= 161 | 162 | addons: 163 | apt: 164 | sources: 165 | # - boost-latest # precise only 166 | # kubuntu-ppa/backports contains OpenCV 167 | - kubuntu-backports 168 | # the PPA xorg-edgers contains cairo 1.12 (required for rotoscoping) 169 | - ppa:xorg-edgers/ppa 170 | # ubuntu-toolchain-r/test contains recent versions of gcc 171 | - ubuntu-toolchain-r-test 172 | # get a recent ffmpeg (>=2.5) for precise from ppa:archivematica/externals(2.5.1) or ppa:pavlyshko/precise(2.6.1) or ppa:spvkgn/ffmpeg-dev(2.8.6) 173 | # NOT WHITELISTED 174 | #- sourceline: 'ppa:spvkgn/ffmpeg-dev' 175 | # this one is for trusty ffmpeg 176 | - sourceline: 'ppa:jonathonf/ffmpeg-4' 177 | # - kalakris-cmake 178 | packages: 179 | - ca-certificates 180 | #- gcc-4.9 181 | #- g++-4.9 182 | #- gcc-5 183 | #- g++-5 184 | #- gcc-6 185 | #- g++-6 186 | #- gcc-7 187 | #- g++-7 188 | - gcc-8 189 | - g++-8 190 | #- libavcodec-dev 191 | #- libavformat-dev 192 | #- libswscale-dev 193 | #- libavutil-dev 194 | #- libswresample-dev 195 | - libtinyxml-dev 196 | - liblcms2-dev 197 | - libyaml-cpp-dev 198 | #- libboost-dev 199 | #- libopenexr-dev 200 | #- libilmbase-dev 201 | - libopenjp2-7-dev 202 | - libtiff-dev 203 | - libjpeg-dev 204 | - libpng-dev 205 | - libraw-dev 206 | - libboost-filesystem-dev 207 | - libboost-regex-dev 208 | - libboost-thread-dev 209 | - libboost-system-dev 210 | - libwebp-dev 211 | - libfreetype6-dev 212 | - libssl-dev 213 | - libgl-dev 214 | coverity_scan: 215 | # customized build script URL 216 | # TRAVIS_REPO_SLUG: owner_name/repo_name of repository currently being built 217 | # TRAVIS_BRANCH: name of the branch currently being built 218 | build_script_url: https://raw.githubusercontent.com/$TRAVIS_REPO_SLUG/$TRAVIS_BRANCH/.travis-coverity-scan-build.sh 219 | # project metadata 220 | project: 221 | name: $TRAVIS_REPO_SLUG 222 | # Where email notification of build analysis results will be sent 223 | notification_email: frederic.devernay@m4x.org 224 | # Commands to prepare for build_command 225 | #build_command_prepend: ./configure 226 | # This command will be added as an argument to "cov-build" to compile 227 | # the project for analysis 228 | build_command: "env PKG_CONFIG_PATH=$HOME/oiio/lib/pkgconfig:$HOME/ocio/lib/pkgconfig:$HOME/openexr/lib/pkgconfig make $J CXXFLAGS_EXTRA=-std=c++11 CONFIG=debug SEEXPR_HOME=$HOME/seexpr" 229 | # Pattern to match selecting branches that will run analysis 230 | branch_pattern: coverity_scan 231 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ***** BEGIN LICENSE BLOCK ***** 2 | # This file is part of openfx-io , 3 | # (C) 2018-2021 The Natron Developers 4 | # (C) 2013-2018 INRIA 5 | # 6 | # openfx-io is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # openfx-io is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with openfx-io. If not, see 18 | # ***** END LICENSE BLOCK ***** 19 | 20 | ######################################################################## 21 | if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) 22 | message(FATAL_ERROR "Prevented in-tree built. This is bad practice.") 23 | endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) 24 | 25 | ######################################################################## 26 | # Project setup 27 | ######################################################################## 28 | cmake_minimum_required(VERSION 3.1) 29 | project(OpenFXIO CXX) 30 | enable_testing() 31 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") 32 | 33 | # ========================== build platform ========================== 34 | 35 | message(STATUS " Platform:") 36 | message(STATUS " Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR}) 37 | if(CMAKE_CROSSCOMPILING) 38 | message(STATUS " Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}) 39 | endif() 40 | message(STATUS " CMake:" ${CMAKE_VERSION}) 41 | message(STATUS " CMake generator:" ${CMAKE_GENERATOR}) 42 | message(STATUS " CMake build tool:" ${CMAKE_BUILD_TOOL}) 43 | if(MSVC) 44 | message(STATUS " MSVC:" ${MSVC_VERSION}) 45 | endif() 46 | if(CMAKE_GENERATOR MATCHES Xcode) 47 | message(STATUS " Xcode:" ${XCODE_VERSION}) 48 | endif() 49 | if(NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio") 50 | message(STATUS " Configuration:" ${CMAKE_BUILD_TYPE}) 51 | endif() 52 | 53 | include(FindOpenGL REQUIRED) 54 | find_package(OpenImageIO) 55 | find_package(PNG) 56 | find_package(OpenColorIO) 57 | find_package(FFmpeg) 58 | find_package(OpenEXR) 59 | find_package(LibRaw) 60 | find_package(SeExpr2) 61 | 62 | if(NOT ${OpenImageIO_VERSION} VERSION_LESS 2.3) 63 | # C++14 required for OpenImageIO >= 2.3 64 | set(CMAKE_CXX_STANDARD 14) 65 | endif() 66 | 67 | # Use -Ofast when applicable (implies -ffast-math) 68 | if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") 69 | set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Wextra -Ofast -DNDEBUG") 70 | set(CMAKE_C_FLAGS_RELEASE "-Wall -Wextra -Ofast -DNDEBUG") 71 | elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") 72 | set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Ofast -DNDEBUG") 73 | set(CMAKE_C_FLAGS_RELEASE "-Wall -Ofast -DNDEBUG") 74 | elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 75 | set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Wextra -Ofast -DNDEBUG") 76 | set(CMAKE_C_FLAGS_RELEASE "-Wall -Wextra -Ofast -DNDEBUG") 77 | endif() 78 | set(OPENFX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/openfx) 79 | 80 | # Check that submodule have been initialized and updated 81 | if(NOT EXISTS ${PROJECT_SOURCE_DIR}/openfx/include) 82 | message(FATAL_ERROR 83 | "\n submodule(s) are missing, please update your repository:\n" 84 | " > git submodule update -i\n") 85 | endif() 86 | 87 | # C++ Include directories 88 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 89 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/SupportExt) 90 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/SupportExt/glad) 91 | include_directories(${OPENFX_PATH}/include) 92 | include_directories(${OPENFX_PATH}/Support/include) 93 | include_directories(${OPENFX_PATH}/Support/Plugins/include) 94 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/IOSupport) 95 | 96 | # Define "DEBUG" on debug builds 97 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") 98 | 99 | # /MP on MSVC 100 | add_compile_options($<$:/MP>) 101 | 102 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") 103 | 104 | set(OFX_SUPPORT_HEADER_DIR "${OPENFX_PATH}/Support/include") 105 | set(OFX_SUPPORT_LIBRARY_DIR "${OPENFX_PATH}/Support/Library") 106 | 107 | file(GLOB SUPPORT_SOURCES 108 | "${OFX_SUPPORT_HEADER_DIR}/*.h" 109 | 110 | "${OFX_SUPPORT_LIBRARY_DIR}/ofxsCore.cpp" 111 | "${OFX_SUPPORT_LIBRARY_DIR}/ofxsImageEffect.cpp" 112 | "${OFX_SUPPORT_LIBRARY_DIR}/ofxsInteract.cpp" 113 | "${OFX_SUPPORT_LIBRARY_DIR}/ofxsLog.cpp" 114 | "${OFX_SUPPORT_LIBRARY_DIR}/ofxsMultiThread.cpp" 115 | "${OFX_SUPPORT_LIBRARY_DIR}/ofxsParams.cpp" 116 | "${OFX_SUPPORT_LIBRARY_DIR}/ofxsProperty.cpp" 117 | "${OFX_SUPPORT_LIBRARY_DIR}/ofxsPropertyValidation.cpp" 118 | "${OFX_SUPPORT_LIBRARY_DIR}/*.h" 119 | ) 120 | 121 | #add_library(Support STATIC ) 122 | #target_compile_definitions(Support PRIVATE OFX_SUPPORTS_OPENGLRENDER OFX_EXTENSIONS_TUTTLE OFX_EXTENSIONS_NUKE OFX_EXTENSIONS_NATRON OFX_EXTENSIONS_VEGAS NOMINMAX) 123 | 124 | file(GLOB IO_SOURCES_EXR 125 | "EXR/*.cpp" 126 | ) 127 | file(GLOB IO_SOURCES_FFMPEG 128 | "FFmpeg/*.cpp" 129 | ) 130 | file(GLOB IO_SOURCES_OPENCOLORIO 131 | "OCIO/*.cpp" 132 | ) 133 | file(GLOB IO_SOURCES_OPENIMAGEIO 134 | "OIIO/*.cpp" 135 | "SupportExt/ofxsOGLTextRenderer.cpp" 136 | "SupportExt/ofxsOGLFontData.cpp" 137 | ) 138 | file(GLOB IO_SOURCES_PNG 139 | "PNG/*.cpp" 140 | "SupportExt/ofxsLut.cpp" 141 | ) 142 | file(GLOB IO_SOURCES_SEEXPR 143 | "SeExpr/*.cpp" 144 | "SupportExt/ofxsOGLFontData.cpp" 145 | "SupportExt/ofxsOGLTextRenderer.cpp" 146 | "SupportExt/ofxsOGLUtilities.cpp" 147 | "SupportExt/ofxsRamp.cpp" 148 | "SupportExt/ofxsRectangleInteract.cpp" 149 | "SupportExt/ofxsShutter.cpp" 150 | "SupportExt/ofxsTransform3x3.cpp" 151 | "SupportExt/ofxsTransformInteract.cpp" 152 | ) 153 | file(GLOB IO_SOURCES 154 | "PFM/*.cpp" 155 | "IOSupport/*.cpp" 156 | "IOSupport/*.h" 157 | "IOSupport/SequenceParsing/*.cpp" 158 | "IOSupport/SequenceParsing/*.h" 159 | "SupportExt/tinythread.cpp" 160 | "SupportExt/ofxsThreadSuite.cpp" 161 | "SupportExt/ofxsFileOpen.cpp" 162 | # "SupportExt/ofxsGenerator.cpp" 163 | "SupportExt/ofxsMultiPlane.cpp" 164 | "SupportExt/ofxsOGLUtilities.cpp" 165 | # "SupportExt/ofxsTracking.cpp" 166 | "SupportExt/*.h" 167 | "SupportExt/glad/*.cpp" 168 | "SupportExt/glad/*.h" 169 | ) 170 | 171 | file(GLOB IO_RESOURCES_EXR 172 | "EXR/fr.inria.openfx.ReadEXR.png" 173 | "EXR/fr.inria.openfx.ReadEXR.svg" 174 | "EXR/fr.inria.openfx.WriteEXR.png" 175 | "EXR/fr.inria.openfx.WriteEXR.svg" 176 | ) 177 | file(GLOB IO_RESOURCES_FFMPEG 178 | "FFmpeg/fr.inria.openfx.ReadFFmpeg.png" 179 | "FFmpeg/fr.inria.openfx.ReadFFmpeg.svg" 180 | "FFmpeg/fr.inria.openfx.WriteFFmpeg.png" 181 | "FFmpeg/fr.inria.openfx.WriteFFmpeg.svg" 182 | ) 183 | file(GLOB IO_RESOURCES_OPENCOLORIO 184 | "OCIO/fr.inria.openfx.OCIOCDLTransform.png" 185 | "OCIO/fr.inria.openfx.OCIOColorSpace.png" 186 | "OCIO/fr.inria.openfx.OCIODisplay.png" 187 | "OCIO/fr.inria.openfx.OCIOFileTransform.png" 188 | "OCIO/fr.inria.openfx.OCIOLogConvert.png" 189 | "OCIO/fr.inria.openfx.OCIOLookTransform.png" 190 | ) 191 | file(GLOB IO_RESOURCES_OPENIMAGEIO 192 | "OIIO/fr.inria.openfx.OIIOResize.png" 193 | "OIIO/fr.inria.openfx.OIIOResize.svg" 194 | "OIIO/fr.inria.openfx.OIIOText.png" 195 | "OIIO/fr.inria.openfx.OIIOText.svg" 196 | "OIIO/fr.inria.openfx.ReadOIIO.png" 197 | "OIIO/fr.inria.openfx.ReadOIIO.svg" 198 | "OIIO/fr.inria.openfx.WriteOIIO.png" 199 | "OIIO/fr.inria.openfx.WriteOIIO.svg" 200 | ) 201 | file(GLOB IO_RESOURCES_PNG 202 | "PNG/fr.inria.openfx.ReadPNG.png" 203 | "PNG/fr.inria.openfx.ReadPNG.svg" 204 | "PNG/fr.inria.openfx.WritePNG.png" 205 | "PNG/fr.inria.openfx.WritePNG.svg" 206 | ) 207 | file(GLOB IO_RESOURCES_SEEXPR 208 | "SeExpr/fr.inria.openfx.SeExpr.png" 209 | "SeExpr/fr.inria.openfx.SeExpr.svg" 210 | "SeExpr/fr.inria.openfx.SeExprSimple.png" 211 | "SeExpr/fr.inria.openfx.SeExprSimple.svg" 212 | ) 213 | file(GLOB IO_RESOURCES 214 | "PFM/fr.inria.openfx.ReadPFM.png" 215 | "PFM/fr.inria.openfx.ReadPFM.svg" 216 | "PFM/fr.inria.openfx.WritePFM.png" 217 | "PFM/fr.inria.openfx.WritePFM.svg" 218 | "RunScript/fr.inria.openfx.RunScript.png" 219 | "RunScript/fr.inria.openfx.RunScript.svg" 220 | ) 221 | 222 | if(${OPENEXR_FOUND}) 223 | list(APPEND IO_RESOURCES ${IO_RESOURCES_EXR}) 224 | list(APPEND IO_SOURCES ${IO_SOURCES_EXR}) 225 | endif() 226 | 227 | if(${OPENCOLORIO_FOUND}) 228 | list(APPEND IO_RESOURCES ${IO_RESOURCES_OPENCOLORIO}) 229 | list(APPEND IO_SOURCES ${IO_SOURCES_OPENCOLORIO}) 230 | endif() 231 | 232 | if(${OPENIMAGEIO_FOUND}) 233 | list(APPEND IO_RESOURCES ${IO_RESOURCES_OPENIMAGEIO}) 234 | list(APPEND IO_SOURCES ${IO_SOURCES_OPENIMAGEIO}) 235 | endif() 236 | 237 | if(${FFMPEG_FOUND}) 238 | list(APPEND IO_RESOURCES ${IO_RESOURCES_FFMPEG}) 239 | list(APPEND IO_SOURCES ${IO_SOURCES_FFMPEG}) 240 | endif() 241 | 242 | if(${PNG_FOUND}) 243 | list(APPEND IO_RESOURCES ${IO_RESOURCES_PNG}) 244 | list(APPEND IO_SOURCES ${IO_SOURCES_PNG}) 245 | endif() 246 | 247 | if(${SEEXPR2_FOUND}) 248 | list(APPEND IO_RESOURCES ${IO_RESOURCES_SEEXPR}) 249 | list(APPEND IO_SOURCES ${IO_SOURCES_SEEXPR}) 250 | endif() 251 | 252 | add_library(IO SHARED ${IO_SOURCES} ${SUPPORT_SOURCES}) 253 | SET_TARGET_PROPERTIES(IO PROPERTIES PREFIX "") 254 | SET_TARGET_PROPERTIES(IO PROPERTIES SUFFIX ".ofx") 255 | 256 | # Add extra flags to the link step of the plugin 257 | if(APPLE) 258 | set_target_properties(IO PROPERTIES LINK_FLAGS "-fvisibility=hidden -exported_symbols_list,${OFX_SUPPORT_HEADER_DIR}/osxSymbols") 259 | set_target_properties(IO PROPERTIES INSTALL_RPATH "@loader_path/../Frameworks;@loader_path/../Libraries") 260 | elseif(MINGW) 261 | set_target_properties(IO PROPERTIES LINK_FLAGS "-shared -fvisibility=hidden -Xlinker --version-script=${OFX_SUPPORT_HEADER_DIR}/linuxSymbols") 262 | elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 263 | # Linux & FreeBSD 264 | set_target_properties(IO PROPERTIES LINK_FLAGS "-Wl,-fvisibility=hidden,--version-script=${OFX_SUPPORT_HEADER_DIR}/linuxSymbols") 265 | set_target_properties(IO PROPERTIES INSTALL_RPATH "$ORIGIN/../../Libraries") 266 | endif() 267 | 268 | target_compile_definitions(IO 269 | PRIVATE 270 | OFX_EXTENSIONS_VEGAS 271 | OFX_EXTENSIONS_NUKE 272 | OFX_EXTENSIONS_NATRON 273 | OFX_EXTENSIONS_TUTTLE 274 | OFX_SUPPORTS_OPENGLRENDER 275 | NOMINMAX) 276 | target_include_directories(IO 277 | PUBLIC 278 | ${CMAKE_INSTALL_FULL_INCLUDEDIR} 279 | ) 280 | target_link_libraries(IO 281 | PUBLIC 282 | ${OPENGL_gl_LIBRARY} 283 | ) 284 | 285 | message(STATUS "External library support:") 286 | 287 | if(${OPENCOLORIO_FOUND}) 288 | message(STATUS " Adding OpenColorIO nodes") 289 | target_compile_definitions(IO PRIVATE OFX_IO_USING_OCIO ${OPENCOLORIO_DEFINITIONS}) 290 | target_include_directories(IO 291 | PUBLIC 292 | ${OPENCOLORIO_INCLUDES} 293 | ) 294 | target_link_libraries(IO 295 | PUBLIC 296 | ${OPENCOLORIO_LIBRARIES} 297 | ) 298 | else() 299 | message(STATUS " Not adding OpenColorIO nodes") 300 | endif() 301 | 302 | if(${OPENEXR_FOUND}) 303 | message(STATUS " Adding OpenEXR nodes") 304 | target_include_directories(IO 305 | PUBLIC 306 | ${OPENEXR_INCLUDES} ${ILMBASE_INCLUDES} 307 | ) 308 | target_link_libraries(IO 309 | PUBLIC 310 | # For OpenEXR/Imath 3.x: 311 | $<$:OpenEXR::OpenEXR> 312 | $<$:Imath::Imath> 313 | $<$:Imath::Half> 314 | # For OpenEXR >= 2.4/2.5 with reliable exported targets 315 | $<$:OpenEXR::IlmImf> 316 | $<$:IlmBase::Imath> 317 | $<$:IlmBase::Half> 318 | $<$:IlmBase::IlmThread> 319 | $<$:IlmBase::Iex> 320 | # These two are for OpenEXR <= 2.3: ${OPENEXR_LIBRARIES} ${ILMBASE_LIBRARIES} 321 | ) 322 | else() 323 | message(STATUS " Not adding OpenEXR nodes") 324 | endif() 325 | 326 | if(${OPENIMAGEIO_FOUND}) 327 | message(STATUS " Adding OpenImageIO nodes") 328 | target_include_directories(IO 329 | PUBLIC 330 | ${OPENIMAGEIO_INCLUDES} 331 | ) 332 | target_link_libraries(IO 333 | PUBLIC 334 | ${OPENIMAGEIO_LIBRARIES} 335 | ) 336 | if(LibRaw_VERSION_STRING) 337 | target_compile_definitions(IO PRIVATE OFX_IO_USING_LIBRAW ${LibRaw_r_DEFINITIONS}) 338 | target_include_directories(IO 339 | PUBLIC 340 | ${LibRaw_INCLUDE_DIR}/libraw 341 | ) 342 | target_link_libraries(IO 343 | PUBLIC 344 | ${LibRaw_r_LIBRARIES} 345 | ) 346 | endif() 347 | else() 348 | message(STATUS " Not adding OpenImageIO nodes") 349 | endif() 350 | 351 | if(${FFMPEG_FOUND}) 352 | message(STATUS " Adding FFmpeg nodes") 353 | target_compile_definitions(IO PRIVATE OFX_IO_MT_FFMPEG) 354 | target_include_directories(IO 355 | PUBLIC 356 | ${FFMPEG_INCLUDES} 357 | ) 358 | target_link_libraries(IO 359 | PUBLIC 360 | ${FFMPEG_LIBRARIES} 361 | ) 362 | else() 363 | message(STATUS " Not adding FFmpeg nodes") 364 | endif() 365 | 366 | if(${PNG_FOUND}) 367 | message(STATUS " Adding PNG nodes") 368 | target_compile_definitions(IO PRIVATE ${PNG_DEFINITIONS}) 369 | target_include_directories(IO 370 | PUBLIC 371 | ${PNG_INCLUDE_DIRS} 372 | ) 373 | target_link_libraries(IO 374 | PUBLIC 375 | ${PNG_LIBRARIES} 376 | ) 377 | else() 378 | message(STATUS " Not adding PNG nodes") 379 | endif() 380 | 381 | if(${SEEXPR2_FOUND}) 382 | message(STATUS " Adding SeExpr nodes") 383 | target_include_directories(IO 384 | PUBLIC 385 | ${SEEXPR2_INCLUDES} 386 | ) 387 | target_link_libraries(IO 388 | PUBLIC 389 | ${SEEXPR2_LIBRARIES} 390 | ) 391 | else() 392 | message(STATUS " Not adding SeExpr nodes") 393 | endif() 394 | 395 | 396 | # Find and set the arch name. 397 | # http://openeffects.org/documentation/reference/ch02s02.html 398 | set(OFX_ARCH UNKNOWN) 399 | # Win 400 | if(MINGW) 401 | set(OFX_ARCH "Win32") 402 | if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") 403 | set(OFX_ARCH "Win64") 404 | endif() 405 | # Visual Studio 406 | elseif(MSVC) 407 | set(OFX_ARCH "Win32") 408 | if((${CMAKE_SYSTEM_PROCESSOR} STREQUAL "IA64") OR (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")) 409 | set(OFX_ARCH "Win64") 410 | endif() 411 | # FreeBSD 412 | elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") 413 | set(OFX_ARCH "FreeBSD-x86") 414 | if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") 415 | set(OFX_ARCH "FreeBSD-x86-64") 416 | endif() 417 | if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") 418 | if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 419 | set(OFX_ARCH FreeBSD-arm-64) 420 | else() 421 | set(OFX_ARCH FreeBSD-arm) 422 | endif() 423 | endif() 424 | # MacOS 425 | elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") 426 | set(OFX_ARCH "MacOS") 427 | # Linux 428 | elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 429 | set(OFX_ARCH "Linux-x86") 430 | if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") 431 | set(OFX_ARCH "Linux-x86-64") 432 | endif() 433 | if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") 434 | if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 435 | set(OFX_ARCH Linux-arm-64) 436 | else() 437 | set(OFX_ARCH Linux-arm) 438 | endif() 439 | endif() 440 | endif() 441 | 442 | set(OFX_ARCH_NAME ${OFX_ARCH} CACHE STRING "OpenFX target OS and architecture") 443 | if("${OFX_ARCH_NAME}" EQUAL "UNKNOWN") 444 | message(SEND_ERROR "OFX_ARCH_NAME was not detected. Install targets will be unavailable. See http://openeffects.org/documentation/reference/ch02s02.html to pick an arch name.") 445 | else() 446 | install(TARGETS IO 447 | RUNTIME DESTINATION IO.ofx.bundle/Contents/${OFX_ARCH_NAME} 448 | LIBRARY DESTINATION IO.ofx.bundle/Contents/${OFX_ARCH_NAME} 449 | ) 450 | 451 | install(FILES ${IO_RESOURCES} 452 | DESTINATION IO.ofx.bundle/Contents/Resources 453 | ) 454 | 455 | install(FILES IO/Info.plist 456 | DESTINATION IO.ofx.bundle/Contents 457 | ) 458 | endif() 459 | -------------------------------------------------------------------------------- /EXR/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | EXR.ofx 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | BNDL 13 | CFBundleSignature 14 | ???? 15 | CFBundleVersion 16 | 0.0.1d1 17 | CSResourcesFileMapped 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /EXR/Makefile: -------------------------------------------------------------------------------- 1 | PLUGINOBJECTS = \ 2 | ReadEXR.o WriteEXR.o \ 3 | GenericReader.o GenericWriter.o GenericOCIO.o SequenceParsing.o ofxsMultiPlane.o 4 | PLUGINNAME = EXR 5 | RESOURCES = fr.inria.openfx.WriteEXR.png \ 6 | fr.inria.openfx.WriteEXR.svg \ 7 | fr.inria.openfx.ReadEXR.png \ 8 | fr.inria.openfx.ReadEXR.svg 9 | 10 | TOP_SRCDIR = .. 11 | include $(TOP_SRCDIR)/Makefile.master 12 | 13 | CXXFLAGS += $(OCIO_CXXFLAGS) $(OPENEXR_CXXFLAGS) 14 | LINKFLAGS += $(OCIO_LINKFLAGS) $(OPENEXR_LINKFLAGS) 15 | -------------------------------------------------------------------------------- /EXR/WriteEXR.cpp: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * This file is part of openfx-io , 3 | * (C) 2018-2021 The Natron Developers 4 | * (C) 2013-2018 INRIA 5 | * 6 | * openfx-io is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * openfx-io is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with openfx-io. If not, see 18 | * ***** END LICENSE BLOCK ***** */ 19 | 20 | /* 21 | * OFX exr Writer plugin. 22 | * Writes a an output image using the OpenEXR library. 23 | */ 24 | 25 | #include 26 | 27 | #include "ofxsFileOpen.h" 28 | #include "ofxsMacros.h" 29 | 30 | GCC_DIAG_OFF(deprecated) 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | GCC_DIAG_ON(deprecated) 41 | 42 | #include "GenericOCIO.h" 43 | #include "GenericWriter.h" 44 | 45 | using namespace OFX; 46 | using namespace OFX::IO; 47 | #ifdef OFX_IO_USING_OCIO 48 | namespace OCIO = OCIO_NAMESPACE; 49 | #endif 50 | 51 | using std::string; 52 | using std::vector; 53 | 54 | OFXS_NAMESPACE_ANONYMOUS_ENTER 55 | 56 | #define kPluginName "WriteEXR" 57 | #define kPluginGrouping "Image/Writers" 58 | #define kPluginDescription "Write images using OpenEXR." 59 | #define kPluginIdentifier "fr.inria.openfx.WriteEXR" 60 | #define kPluginVersionMajor 1 // Incrementing this number means that you have broken backwards compatibility of the plug-in. 61 | #define kPluginVersionMinor 0 // Increment this when you have fixed a bug or made it faster. 62 | #define kPluginEvaluation 10 // plugin quality from 0 (bad) to 100 (perfect) or -1 if not evaluated 63 | 64 | #define kParamWriteEXRCompression "compression" 65 | #define kParamWriteEXRDataType "dataType" 66 | 67 | #ifndef OPENEXR_IMF_NAMESPACE 68 | #define OPENEXR_IMF_NAMESPACE Imf 69 | #endif 70 | 71 | #define kSupportsRGBA true 72 | #define kSupportsRGB true 73 | #define kSupportsAlpha true 74 | #define kSupportsXY false 75 | 76 | namespace Imf_ = OPENEXR_IMF_NAMESPACE; 77 | 78 | namespace Exr { 79 | static const char* compressionNames[6] = { 80 | "No compression", 81 | "Zip (1 scanline)", 82 | "Zip (16 scanlines)", 83 | "PIZ Wavelet (32 scanlines)", 84 | "RLE", 85 | "B44" 86 | }; 87 | static const char* compressionEnums[6] = { 88 | "no", 89 | "zips", 90 | "zip", 91 | "piz", 92 | "rle", 93 | "b44" 94 | }; 95 | static Imf_::Compression 96 | stringToCompression(const string& str) 97 | { 98 | if (str == compressionNames[0]) { 99 | return Imf_::NO_COMPRESSION; 100 | } else if (str == compressionNames[1]) { 101 | return Imf_::ZIPS_COMPRESSION; 102 | } else if (str == compressionNames[2]) { 103 | return Imf_::ZIP_COMPRESSION; 104 | } else if (str == compressionNames[3]) { 105 | return Imf_::PIZ_COMPRESSION; 106 | } else if (str == compressionNames[4]) { 107 | return Imf_::RLE_COMPRESSION; 108 | } else { 109 | return Imf_::B44_COMPRESSION; 110 | } 111 | } 112 | 113 | static const char* depthNames[2] = { 114 | "16 bit half", "32 bit float" 115 | }; 116 | static const char* depthEnums[2] = { 117 | "16f", "32f" 118 | }; 119 | static int 120 | depthNameToInt(const string& name) 121 | { 122 | if (name == depthNames[0]) { 123 | return 16; 124 | } else { 125 | return 32; 126 | } 127 | } 128 | } 129 | 130 | class WriteEXRPlugin 131 | : public GenericWriterPlugin { 132 | public: 133 | WriteEXRPlugin(OfxImageEffectHandle handle, const vector& extensions); 134 | 135 | virtual ~WriteEXRPlugin(); 136 | 137 | // virtual void changedParam(const InstanceChangedArgs &args, const string ¶mName); 138 | 139 | private: 140 | virtual void encode(const string& filename, 141 | const OfxTime time, 142 | const string& viewName, 143 | const float* pixelData, 144 | const OfxRectI& bounds, 145 | const float pixelAspectRatio, 146 | const int pixelDataNComps, 147 | const int dstNCompsStartIndex, 148 | const int dstNComps, 149 | const int rowBytes) OVERRIDE FINAL; 150 | virtual bool isImageFile(const string& fileExtension) const OVERRIDE FINAL; 151 | virtual PreMultiplicationEnum getExpectedInputPremultiplication() const OVERRIDE FINAL { return eImagePreMultiplied; } 152 | 153 | virtual void onOutputFileChanged(const string& newFile, bool setColorSpace) OVERRIDE FINAL; 154 | 155 | /** 156 | * @brief Does the given filename support alpha channel. 157 | **/ 158 | virtual bool supportsAlpha(const std::string&) const OVERRIDE FINAL { return kSupportsRGBA; } 159 | 160 | ChoiceParam* _compression; 161 | ChoiceParam* _bitDepth; 162 | }; 163 | 164 | WriteEXRPlugin::WriteEXRPlugin(OfxImageEffectHandle handle, 165 | const vector& extensions) 166 | : GenericWriterPlugin(handle, extensions, kSupportsRGBA, kSupportsRGB, kSupportsXY, kSupportsAlpha) 167 | , _compression(NULL) 168 | , _bitDepth(NULL) 169 | { 170 | _compression = fetchChoiceParam(kParamWriteEXRCompression); 171 | _bitDepth = fetchChoiceParam(kParamWriteEXRDataType); 172 | } 173 | 174 | WriteEXRPlugin::~WriteEXRPlugin() 175 | { 176 | } 177 | 178 | // void WriteEXRPlugin::changedParam(const InstanceChangedArgs &/*args*/, const string ¶mName) 179 | //{ 180 | // } 181 | 182 | void 183 | WriteEXRPlugin::encode(const string& filename, 184 | const OfxTime /*time*/, 185 | const string& /*viewName*/, 186 | const float* pixelData, 187 | const OfxRectI& bounds, 188 | const float pixelAspectRatio, 189 | const int pixelDataNComps, 190 | const int /*dstNCompsStartIndex*/, 191 | const int /*dstNComps*/, 192 | const int rowBytes) 193 | { 194 | /// FIXME: WriteEXR should not disregard dstNComps 195 | 196 | if ((pixelDataNComps != 4) && (pixelDataNComps != 3) && (pixelDataNComps != 1)) { 197 | setPersistentMessage(Message::eMessageError, "", "EXR: can only write RGBA, RGB, or Alpha components images"); 198 | throwSuiteStatusException(kOfxStatErrFormat); 199 | 200 | return; 201 | } 202 | 203 | assert(pixelDataNComps); 204 | 205 | // If the file exists (which means "overwrite" was checked), remove it first. 206 | // See https://github.com/NatronGitHub/Natron/issues/666 207 | if (OFX::exists_utf8(filename.c_str())) { 208 | OFX::remove_utf8(filename.c_str()); 209 | } 210 | 211 | try { 212 | int compressionIndex; 213 | _compression->getValue(compressionIndex); 214 | 215 | Imf_::Compression compression(Exr::stringToCompression(Exr::compressionNames[compressionIndex])); 216 | 217 | int depthIndex; 218 | _bitDepth->getValue(depthIndex); 219 | 220 | int depth = Exr::depthNameToInt(Exr::depthNames[depthIndex]); 221 | Imath::Box2i exrDataW; 222 | 223 | exrDataW.min.x = bounds.x1; 224 | exrDataW.min.y = bounds.y1; 225 | exrDataW.max.x = bounds.x2 - 1; 226 | exrDataW.max.y = bounds.y2 - 1; 227 | 228 | Imath::Box2i exrDispW; 229 | exrDispW.min.x = 0; 230 | exrDispW.min.y = 0; 231 | exrDispW.max.x = (bounds.x2 - bounds.x1); 232 | exrDispW.max.y = (bounds.y2 - bounds.y1); 233 | 234 | Imf_::Header exrheader(exrDispW, exrDataW, pixelAspectRatio, 235 | Imath::V2f(0, 0), 1, Imf_::INCREASING_Y, compression); 236 | 237 | Imf_::PixelType pixelType; 238 | if (depth == 32) { 239 | pixelType = Imf_::FLOAT; 240 | } else { 241 | assert(depth == 16); 242 | pixelType = Imf_::HALF; 243 | } 244 | 245 | const char* chanNames[4] = { "R", "G", "B", "A" }; 246 | if (pixelDataNComps == 1) { 247 | chanNames[0] = chanNames[3]; 248 | } 249 | for (int chan = 0; chan < pixelDataNComps; ++chan) { 250 | exrheader.channels().insert(chanNames[chan], Imf_::Channel(pixelType)); 251 | } 252 | 253 | Imf_::OutputFile outputFile(filename.c_str(), exrheader); 254 | 255 | for (int y = bounds.y1; y < bounds.y2; ++y) { 256 | /*First we create a row that will serve as the output buffer. 257 | We copy the scan-line (with y inverted) in the inputImage to the row.*/ 258 | int exrY = bounds.y2 - y - 1; 259 | float* src_pixels = (float*)((char*)pixelData + (exrY - bounds.y1) * rowBytes); 260 | 261 | /*we create the frame buffer*/ 262 | Imf_::FrameBuffer fbuf; 263 | if (depth == 32) { 264 | for (int chan = 0; chan < pixelDataNComps; ++chan) { 265 | fbuf.insert(chanNames[chan], Imf_::Slice(Imf_::FLOAT, (char*)src_pixels + chan, sizeof(float) * pixelDataNComps, 0)); 266 | } 267 | } else { 268 | Imf_::Array2D halfwriterow(pixelDataNComps, bounds.x2 - bounds.x1); 269 | 270 | for (int chan = 0; chan < pixelDataNComps; ++chan) { 271 | fbuf.insert(chanNames[chan], 272 | Imf_::Slice(Imf_::HALF, 273 | (char*)(&halfwriterow[chan][0] - exrDataW.min.x), 274 | sizeof(halfwriterow[chan][0]), 0)); 275 | const float* from = src_pixels + chan; 276 | for (int i = exrDataW.min.x, f = exrDataW.min.x; i < exrDataW.max.x; ++i, f += pixelDataNComps) { 277 | halfwriterow[chan][i - exrDataW.min.x] = from[f]; 278 | } 279 | } 280 | } 281 | outputFile.setFrameBuffer(fbuf); 282 | outputFile.writePixels(1); 283 | } 284 | } catch (const std::exception& e) { 285 | setPersistentMessage(Message::eMessageError, "", string("OpenEXR error") + ": " + e.what()); 286 | throwSuiteStatusException(kOfxStatFailed); 287 | 288 | return; 289 | } 290 | } // WriteEXRPlugin::encode 291 | 292 | bool 293 | WriteEXRPlugin::isImageFile(const string& /*fileExtension*/) const 294 | { 295 | return true; 296 | } 297 | 298 | void 299 | WriteEXRPlugin::onOutputFileChanged(const string& /*filename*/, 300 | bool setColorSpace) 301 | { 302 | if (setColorSpace) { 303 | #ifdef OFX_IO_USING_OCIO 304 | // Unless otherwise specified, exr files are assumed to be linear. 305 | _ocio->setOutputColorspace(OCIO::ROLE_SCENE_LINEAR); 306 | #endif 307 | } 308 | } 309 | 310 | mDeclareWriterPluginFactory(WriteEXRPluginFactory, ;, false); 311 | void 312 | WriteEXRPluginFactory::load() 313 | { 314 | _extensions.clear(); 315 | _extensions.push_back("exr"); 316 | } 317 | 318 | void 319 | WriteEXRPluginFactory::unload() 320 | { 321 | // Kill all threads 322 | IlmThread::ThreadPool::globalThreadPool().setNumThreads(0); 323 | } 324 | 325 | /** @brief The basic describe function, passed a plugin descriptor */ 326 | void 327 | WriteEXRPluginFactory::describe(ImageEffectDescriptor& desc) 328 | { 329 | GenericWriterDescribe(desc, eRenderFullySafe, _extensions, kPluginEvaluation, false, false); 330 | // basic labels 331 | desc.setLabel(kPluginName); 332 | desc.setPluginDescription(kPluginDescription); 333 | 334 | desc.setIsDeprecated(true); // This plugin was superseeded by WriteOIIO 335 | } 336 | 337 | /** @brief The describe in context function, passed a plugin descriptor and a context */ 338 | void 339 | WriteEXRPluginFactory::describeInContext(ImageEffectDescriptor& desc, 340 | ContextEnum context) 341 | { 342 | // make some pages and to things in 343 | PageParamDescriptor* page = GenericWriterDescribeInContextBegin(desc, context, 344 | kSupportsRGBA, kSupportsRGB, kSupportsXY, kSupportsAlpha, 345 | "scene_linear", "scene_linear", false); 346 | 347 | /////////Compression 348 | { 349 | ChoiceParamDescriptor* param = desc.defineChoiceParam(kParamWriteEXRCompression); 350 | param->setAnimates(true); 351 | for (int i = 0; i < 6; ++i) { 352 | param->appendOption(Exr::compressionNames[i], "", Exr::compressionEnums[i]); 353 | } 354 | param->setDefault(3); 355 | if (page) { 356 | page->addChild(*param); 357 | } 358 | } 359 | 360 | ////////Data type 361 | { 362 | ChoiceParamDescriptor* param = desc.defineChoiceParam(kParamWriteEXRDataType); 363 | param->setAnimates(true); 364 | for (int i = 0; i < 2; ++i) { 365 | param->appendOption(Exr::depthNames[i], "", Exr::depthEnums[i]); 366 | } 367 | param->setDefault(1); 368 | if (page) { 369 | page->addChild(*param); 370 | } 371 | } 372 | 373 | GenericWriterDescribeInContextEnd(desc, context, page); 374 | } 375 | 376 | /** @brief The create instance function, the plugin must return an object derived from the \ref ImageEffect class */ 377 | ImageEffect* 378 | WriteEXRPluginFactory::createInstance(OfxImageEffectHandle handle, 379 | ContextEnum /*context*/) 380 | { 381 | WriteEXRPlugin* ret = new WriteEXRPlugin(handle, _extensions); 382 | 383 | ret->restoreStateFromParams(); 384 | 385 | return ret; 386 | } 387 | 388 | static WriteEXRPluginFactory p(kPluginIdentifier, kPluginVersionMajor, kPluginVersionMinor); 389 | mRegisterPluginFactoryInstance(p) 390 | 391 | OFXS_NAMESPACE_ANONYMOUS_EXIT 392 | -------------------------------------------------------------------------------- /EXR/fr.inria.openfx.ReadEXR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/EXR/fr.inria.openfx.ReadEXR.png -------------------------------------------------------------------------------- /EXR/fr.inria.openfx.ReadEXR.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /EXR/fr.inria.openfx.WriteEXR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/EXR/fr.inria.openfx.WriteEXR.png -------------------------------------------------------------------------------- /EXR/fr.inria.openfx.WriteEXR.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /FFmpeg/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | FFmpeg.ofx 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | BNDL 13 | CFBundleSignature 14 | ???? 15 | CFBundleVersion 16 | 0.0.1d1 17 | CSResourcesFileMapped 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /FFmpeg/Makefile: -------------------------------------------------------------------------------- 1 | PLUGINOBJECTS = \ 2 | ReadFFmpeg.o FFmpegFile.o WriteFFmpeg.o PixelFormat.o \ 3 | GenericReader.o GenericWriter.o GenericOCIO.o SequenceParsing.o ofxsMultiPlane.o 4 | PLUGINNAME = FFmpeg 5 | 6 | TOP_SRCDIR = .. 7 | include $(TOP_SRCDIR)/Makefile.master 8 | 9 | RESOURCES = \ 10 | fr.inria.openfx.ReadFFmpeg.png \ 11 | fr.inria.openfx.ReadFFmpeg.svg \ 12 | fr.inria.openfx.WriteFFmpeg.png \ 13 | fr.inria.openfx.WriteFFmpeg.svg 14 | 15 | CXXFLAGS += $(OCIO_CXXFLAGS) $(FFMPEG_CXXFLAGS) 16 | LINKFLAGS += $(OCIO_LINKFLAGS) $(FFMPEG_LINKFLAGS) 17 | -------------------------------------------------------------------------------- /FFmpeg/PixelFormat.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * This file is part of openfx-io , 3 | * (C) 2018-2021 The Natron Developers 4 | * (C) 2013-2018 INRIA 5 | * 6 | * openfx-io is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * openfx-io is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with openfx-io. If not, see 18 | * ***** END LICENSE BLOCK ***** */ 19 | 20 | #ifndef PixelFormat_h 21 | #define PixelFormat_h 22 | 23 | extern "C" { 24 | #include 25 | } 26 | 27 | namespace OFX { 28 | namespace FFmpeg { 29 | 30 | // these are ordered 31 | enum PixelCodingEnum { 32 | ePixelCodingNone = 0, 33 | ePixelCodingGray, // Grayscale 34 | ePixelCodingPalette, // Palette (color-capable) 35 | ePixelCodingBayer, // Bayer mosaic 36 | ePixelCodingYUV410, // 1 Cr & Cb sample per 4x4 Y samples 37 | ePixelCodingYUV411, // 1 Cr & Cb sample per 4x1 Y samples 38 | ePixelCodingYUV420, // 1 Cr & Cb sample per 2x2 Y samples 39 | ePixelCodingYUV422, // 1 Cr & Cb sample per 2x1 Y samples 40 | ePixelCodingYUV440 = ePixelCodingYUV422, // 1 Cr & Cb sample per 1x2 Y samples 41 | ePixelCodingYUV444, // 1 Cr & Cb sample per 1x1 Y samples 42 | ePixelCodingRGB, // RGB 43 | ePixelCodingXYZ, // XYZ 44 | }; 45 | 46 | bool pixelFormatIsYUV(AVPixelFormat pixelFormat); 47 | int pixelFormatBitDepth(AVPixelFormat pixelFormat); 48 | int pixelFormatBPP(AVPixelFormat pixelFormat); 49 | PixelCodingEnum pixelFormatCoding(AVPixelFormat pixelFormat); 50 | bool pixelFormatAlpha(AVPixelFormat pixelFormat); 51 | 52 | int pixelFormatBPPFromSpec(PixelCodingEnum coding, int bitdepth, bool alpha); 53 | 54 | } 55 | } 56 | 57 | #endif /* defined(PixelFormat_h) */ 58 | -------------------------------------------------------------------------------- /FFmpeg/TODO.txt: -------------------------------------------------------------------------------- 1 | # ReadFFmpeg 2 | 3 | rewrite from ffplay.c, see http://github.com/devernay/ffplay 4 | 5 | # WriteFFmpeg 6 | 7 | ## libopenjpeg DCI-compatible output 8 | 9 | See http://www.dcimovies.com/archives/spec_v1_2_No_Errata_Incorporated/ 10 | 11 | see http://www.michaelcinquin.com/ressources/ffmpeg 12 | and ffmpeg -h encoder=libopenjpeg 13 | 14 | possible cinama_mode values: 15 | 16 | "disable" 17 | 18 | { "2k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA2K_24) }, 0, 0, VE, "cinema_mode" }, 19 | { "2k_48", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA2K_48) }, 0, 0, VE, "cinema_mode" }, 20 | { "4k_24", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = OPJ(CINEMA4K_24) }, 0, 0, VE, "cinema_mode" }, 21 | 22 | -cinema2K <24|48> 23 | 24 | Cinema2K profile.This option generates a codestream compliant to the Digital cinema specifications for a 2K resolution content. The value given is the frame rate which can be 24 or 48 fps. The main specifications of the JPEG Profile-3 (2K Digital Cinema Profile) are * Image size = 2048 x 1080 (at least one of the dimensions should match 2048 x 1080) * Single tile * Wavelet transform levels = Maximum of 5 * Wavelet filter = 9-7 filter * Codeblock size = 32 x 32 * Precinct size = 128 x 128 (Lowest frequency subband), 256 x 256 (other subbands) * Maximum Bit rate for entire frame = 1302083 bytes for 24 fps, 651041 bytes for 48fps * Maximum Bit rate for each color component= 1041666 bytes for 24 fps, 520833 bytes for 48fps * Tile parts = 3; Each tile part contains data necessary to decompress one 2K color component * 12 bits per component. 25 | 26 | -cinema4K 27 | 28 | Cinema4K profile. This option generates a codestream compliant to the Digital cinema specifications for a 4K resolution content. The value for frame rate should not be specified. Value is initialized to 24fps. The main specifications of the JPEG Profile-4 (4K Digital Cinema Profile) are * Image size = 4096 x 2160 (at least one of the dimensions must match 4096 x 2160) * Single tile * Wavelet transform levels = Maximum of 6 and minimum of 1 * Wavelet filter = 9-7 filter * Codeblock size = 32 x 32 * Precinct size = 128 x 128 (Lowest frequency subband), 256 x 256 (other subbands) * Maximum Bit rate for entire frame = 1302083 bytes for 24 fps * Maximum Bit rate for each color component= 1041666 bytes for 24 fps * Tile parts = 6; Each of first 3 tile parts contains data necessary to decompress one 2K color component, and each of last 3 tile parts contains data necessary to decompress one 4K color component. * 12 bits per component 29 | 30 | 31 | the pixel format is always AV_PIX_FMT_XYZ12 in cinema mode 32 | -------------------------------------------------------------------------------- /FFmpeg/fr.inria.openfx.ReadFFmpeg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/FFmpeg/fr.inria.openfx.ReadFFmpeg.png -------------------------------------------------------------------------------- /FFmpeg/fr.inria.openfx.ReadFFmpeg.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /FFmpeg/fr.inria.openfx.WriteFFmpeg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/FFmpeg/fr.inria.openfx.WriteFFmpeg.png -------------------------------------------------------------------------------- /FFmpeg/fr.inria.openfx.WriteFFmpeg.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /INRIA.IO.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /IO/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | IO.ofx 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | BNDL 13 | CFBundleSignature 14 | ???? 15 | CFBundleVersion 16 | 0.0.1d1 17 | CSResourcesFileMapped 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /IO/Makefile: -------------------------------------------------------------------------------- 1 | TOP_SRCDIR = .. 2 | 3 | PLUGINOBJECTS = ofxsThreadSuite.o tinythread.o \ 4 | ofxsFileOpen.o \ 5 | ofxsOGLTextRenderer.o \ 6 | ofxsOGLFontData.o \ 7 | ofxsRamp.o \ 8 | ofxsGenerator.o \ 9 | ofxsTransformInteract.o \ 10 | ofxsMultiPlane.o \ 11 | ofxsRectangleInteract.o \ 12 | ofxsLut.o \ 13 | GenericReader.o GenericWriter.o SequenceParsing.o \ 14 | SeExpr.o \ 15 | SeGrain.o \ 16 | SeNoise.o \ 17 | OCIOPluginBase.o GenericOCIO.o $(OCIO_OPENGL_OBJS) \ 18 | ReadEXR.o WriteEXR.o \ 19 | ReadFFmpeg.o FFmpegFile.o WriteFFmpeg.o PixelFormat.o \ 20 | ReadOIIO.o WriteOIIO.o \ 21 | OIIOGlobal.o \ 22 | OIIOText.o \ 23 | OIIOResize.o \ 24 | ReadPFM.o WritePFM.o \ 25 | ReadPNG.o WritePNG.o \ 26 | OCIOColorSpace.o \ 27 | OCIODisplay.o \ 28 | OCIOCDLTransform.o \ 29 | OCIOFileTransform.o \ 30 | OCIOLogConvert.o \ 31 | OCIOLookTransform.o \ 32 | 33 | OCIO_OPENGL_OBJS = GenericOCIOOpenGL.o glsl.o glad.o gladegl.o ofxsOGLUtilities.o 34 | 35 | ifeq ($(OS),$(filter $(OS),Linux FreeBSD Darwin)) 36 | PLUGINOBJECTS += RunScript.o 37 | endif 38 | 39 | PLUGINNAME = IO 40 | 41 | # ls */*png */*svg|sed -e 's!^!../!' -e 's!$! \\!'|sort 42 | RESOURCES = \ 43 | $(TOP_SRCDIR)/EXR/fr.inria.openfx.ReadEXR.png \ 44 | $(TOP_SRCDIR)/EXR/fr.inria.openfx.ReadEXR.svg \ 45 | $(TOP_SRCDIR)/EXR/fr.inria.openfx.WriteEXR.png \ 46 | $(TOP_SRCDIR)/EXR/fr.inria.openfx.WriteEXR.svg \ 47 | $(TOP_SRCDIR)/FFmpeg/fr.inria.openfx.ReadFFmpeg.png \ 48 | $(TOP_SRCDIR)/FFmpeg/fr.inria.openfx.ReadFFmpeg.svg \ 49 | $(TOP_SRCDIR)/FFmpeg/fr.inria.openfx.WriteFFmpeg.png \ 50 | $(TOP_SRCDIR)/FFmpeg/fr.inria.openfx.WriteFFmpeg.svg \ 51 | $(TOP_SRCDIR)/OCIO/fr.inria.openfx.OCIOCDLTransform.png \ 52 | $(TOP_SRCDIR)/OCIO/fr.inria.openfx.OCIOColorSpace.png \ 53 | $(TOP_SRCDIR)/OCIO/fr.inria.openfx.OCIODisplay.png \ 54 | $(TOP_SRCDIR)/OCIO/fr.inria.openfx.OCIOFileTransform.png \ 55 | $(TOP_SRCDIR)/OCIO/fr.inria.openfx.OCIOLogConvert.png \ 56 | $(TOP_SRCDIR)/OCIO/fr.inria.openfx.OCIOLookTransform.png \ 57 | $(TOP_SRCDIR)/OIIO/fr.inria.openfx.OIIOText.png \ 58 | $(TOP_SRCDIR)/OIIO/fr.inria.openfx.OIIOText.svg \ 59 | $(TOP_SRCDIR)/OIIO/fr.inria.openfx.ReadOIIO.png \ 60 | $(TOP_SRCDIR)/OIIO/fr.inria.openfx.ReadOIIO.svg \ 61 | $(TOP_SRCDIR)/OIIO/fr.inria.openfx.OIIOResize.png \ 62 | $(TOP_SRCDIR)/OIIO/fr.inria.openfx.OIIOResize.svg \ 63 | $(TOP_SRCDIR)/SeExpr/fr.inria.openfx.SeExpr.png \ 64 | $(TOP_SRCDIR)/SeExpr/fr.inria.openfx.SeExpr.svg \ 65 | $(TOP_SRCDIR)/OIIO/fr.inria.openfx.WriteOIIO.png \ 66 | $(TOP_SRCDIR)/OIIO/fr.inria.openfx.WriteOIIO.svg \ 67 | $(TOP_SRCDIR)/PFM/fr.inria.openfx.ReadPFM.png \ 68 | $(TOP_SRCDIR)/PFM/fr.inria.openfx.ReadPFM.svg \ 69 | $(TOP_SRCDIR)/PFM/fr.inria.openfx.WritePFM.png \ 70 | $(TOP_SRCDIR)/PFM/fr.inria.openfx.WritePFM.svg \ 71 | $(TOP_SRCDIR)/PNG/fr.inria.openfx.ReadPNG.png \ 72 | $(TOP_SRCDIR)/PNG/fr.inria.openfx.ReadPNG.svg \ 73 | $(TOP_SRCDIR)/PNG/fr.inria.openfx.WritePNG.png \ 74 | $(TOP_SRCDIR)/PNG/fr.inria.openfx.WritePNG.svg 75 | 76 | ifeq ($(OS),$(filter $(OS),Linux FreeBSD Darwin)) 77 | RESOURCES += ../RunScript/fr.inria.openfx.RunScript.png \ 78 | ../RunScript/fr.inria.openfx.RunScript.svg 79 | endif 80 | 81 | VPATH += \ 82 | $(TOP_SRCDIR)/EXR \ 83 | $(TOP_SRCDIR)/FFmpeg \ 84 | $(TOP_SRCDIR)/OCIO \ 85 | $(TOP_SRCDIR)/OIIO \ 86 | $(TOP_SRCDIR)/PFM \ 87 | $(TOP_SRCDIR)/PNG \ 88 | $(TOP_SRCDIR)/SeExpr \ 89 | $(TOP_SRCDIR)/IOSupport/SequenceParsing 90 | 91 | ifeq ($(OS),$(filter $(OS),Linux FreeBSD Darwin)) 92 | VPATH += $(TOP_SRCDIR)/RunScript 93 | endif 94 | 95 | include $(TOP_SRCDIR)/Makefile.master 96 | 97 | CXXFLAGS += -I$(TOP_SRCDIR)/EXR -I$(TOP_SRCDIR)/FFmpeg -I$(TOP_SRCDIR)/OIIO -I$(TOP_SRCDIR)/PFM -I$(TOP_SRCDIR)/OCIO -I$(TOP_SRCDIR)/SeExpr -I$(TOP_SRCDIR)/PNG 98 | 99 | ifeq ($(OS),$(filter $(OS),Linux FreeBSD Darwin)) 100 | CXXFLAGS += -I$(TOP_SRCDIR)/RunScript 101 | endif 102 | 103 | CXXFLAGS += $(OCIO_CXXFLAGS) $(SEEXPR_CXXFLAGS) $(OPENEXR_CXXFLAGS) $(FFMPEG_CXXFLAGS) $(OIIO_CXXFLAGS) $(PNG_CXXFLAGS) 104 | LINKFLAGS += $(OCIO_LINKFLAGS) $(SEEXPR_LINKFLAGS) $(OPENEXR_LINKFLAGS) $(FFMPEG_LINKFLAGS) $(OIIO_LINKFLAGS) $(PNG_LINKFLAGS) 105 | -------------------------------------------------------------------------------- /IOPluginProperty.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | ..\;..\openfx\Support\Plugins\include;..\openfx\Support\include;..\openfx\include;..\openfx\include\natron;%(AdditionalIncludeDirectories) 9 | OFX_EXTENSIONS_NUKE;OFX_EXTENSIONS_NATRON;OFX_EXTENSIONS_VEGAS;%(PreprocessorDefinitions) 10 | 11 | 12 | $(OutDir)$(ProjectName).ofx.bundle/Contents/Win32/$(ProjectName).ofx 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /IOSupport/GenericOCIO.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * This file is part of openfx-io , 3 | * (C) 2018-2021 The Natron Developers 4 | * (C) 2013-2018 INRIA 5 | * 6 | * openfx-io is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * openfx-io is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with openfx-io. If not, see 18 | * ***** END LICENSE BLOCK ***** */ 19 | 20 | /* 21 | * OFX GenericOCIO plugin add-on. 22 | * Adds OpenColorIO functionality to any plugin. 23 | */ 24 | 25 | #ifndef IO_GenericOCIO_h 26 | #define IO_GenericOCIO_h 27 | 28 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 29 | #include 30 | #endif // defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 31 | #include 32 | #ifdef __APPLE__ 33 | #include 34 | #endif 35 | 36 | #include 37 | #include 38 | 39 | #include "ofxsImageEffect.h" 40 | #include "ofxsMultiThread.h" 41 | #include "ofxsPixelProcessor.h" 42 | #ifndef OFX_USE_MULTITHREAD_MUTEX 43 | // some OFX hosts do not have mutex handling in the MT-Suite (e.g. Sony Catalyst Edit) 44 | // prefer using the fast mutex by Marcus Geelnard http://tinythreadpp.bitsnbites.eu/ 45 | #include "fast_mutex.h" 46 | #endif 47 | 48 | // define OFX_OCIO_CHOICE to enable the colorspace choice popup menu 49 | #define OFX_OCIO_CHOICE 50 | 51 | #ifdef OFX_IO_USING_OCIO 52 | #include 53 | 54 | #if OCIO_VERSION_HEX >= 0x02000000 55 | namespace OCIO_NAMESPACE { 56 | class OpenGLBuilder; 57 | typedef OCIO_SHARED_PTR OpenGLBuilderRcPtr; 58 | } 59 | #endif 60 | #endif 61 | 62 | #include "IOUtility.h" 63 | 64 | NAMESPACE_OFX_ENTER 65 | NAMESPACE_OFX_IO_ENTER 66 | 67 | #ifdef OFX_IO_USING_OCIO 68 | #define kOCIOParamConfigFile "ocioConfigFile" 69 | #define kOCIOParamConfigFileLabel "OCIO Config File", "OpenColorIO configuration file" 70 | #define kOCIOParamInputSpace "ocioInputSpace" 71 | #define kOCIOParamInputSpaceLabel "Input Colorspace" 72 | #define kOCIOParamInputSpaceHint "Input data is taken to be in this colorspace." 73 | #define kOCIOParamOutputSpace "ocioOutputSpace" 74 | #define kOCIOParamOutputSpaceLabel "Output Colorspace" 75 | #define kOCIOParamOutputSpaceHint "Output data is taken to be in this colorspace." 76 | #ifdef OFX_OCIO_CHOICE 77 | #define kOCIOParamInputSpaceChoice "ocioInputSpaceIndex" 78 | #define kOCIOParamOutputSpaceChoice "ocioOutputSpaceIndex" 79 | #endif 80 | #define kOCIOHelpButton "ocioHelp" 81 | #define kOCIOHelpLooksButton "ocioHelpLooks" 82 | #define kOCIOHelpDisplaysButton "ocioHelpDisplays" 83 | #define kOCIOHelpButtonLabel "OCIO config help..." 84 | #define kOCIOHelpButtonHint "Help about the OpenColorIO configuration." 85 | #else 86 | #define kOCIOParamInputSpaceLabel "" 87 | #define kOCIOParamOutputSpaceLabel "" 88 | #endif 89 | 90 | #define kOCIOParamContext "Context" 91 | #define kOCIOParamContextLabel "OCIO Context" 92 | #define kOCIOParamContextHint \ 93 | "OCIO Contexts allow you to apply specific LUTs or grades to different shots.\n" \ 94 | "Here you can specify the context name (key) and its corresponding value.\n" \ 95 | "Full details of how to set up contexts and add them to your config can be found in the OpenColorIO documentation:\n" \ 96 | "http://opencolorio.org/userguide/contexts.html" 97 | 98 | #define kOCIOParamContextKey1 "key1" 99 | #define kOCIOParamContextValue1 "value1" 100 | #define kOCIOParamContextKey2 "key2" 101 | #define kOCIOParamContextValue2 "value2" 102 | #define kOCIOParamContextKey3 "key3" 103 | #define kOCIOParamContextValue3 "value3" 104 | #define kOCIOParamContextKey4 "key4" 105 | #define kOCIOParamContextValue4 "value4" 106 | 107 | #if defined(OFX_IO_USING_OCIO) 108 | class OCIOOpenGLContextData { 109 | public: 110 | #if OCIO_VERSION_HEX >= 0x02000000 111 | std::string processorCacheID; 112 | OCIO_NAMESPACE::OpenGLBuilderRcPtr glBuilder; 113 | #else 114 | std::vector procLut3D; //!< storage for the LUT3D so that the allocation of the LUT only occurs once. 115 | std::string procShaderCacheID; //!< pass a string that will be used as a key to cache the shader so that internally the function may determine if generating and compiling the shader again is required. If the shader cache ID did not change, the shader passed by shaderProgramIDParam will be used as-is. 116 | std::string procLut3DCacheID; //!< a string that will be used as a key to cache the LUT3D so that internally the function may determine if computing the LUT again is required. If the cache ID did not change, no call to glTexSubImage3D will be made 117 | unsigned int procLut3DID; //!< ID of the texture 3D that will contain the LUT3D so that its allocation occurs only once, and subsequent calls only have to call glTexSubImage3D 118 | unsigned int procShaderProgramID; //!< the ID of the shader program that will be used to do the processing so that it is only compiled once. Note that to cache the shaderProgramID, you also need to set the procShaderCacheID parameter. 119 | unsigned int procFragmentShaderID; //!< the ID of the fragment shader program that will be used by the OCIO shader program 120 | #endif 121 | 122 | public: 123 | OCIOOpenGLContextData(); 124 | 125 | ~OCIOOpenGLContextData(); 126 | }; 127 | #endif 128 | 129 | class GenericOCIO { 130 | friend class OCIOProcessor; 131 | 132 | public: 133 | GenericOCIO(OFX::ImageEffect* parent); 134 | bool isIdentity(double time) const; 135 | 136 | #if defined(OFX_IO_USING_OCIO) && defined(OFX_SUPPORTS_OPENGLRENDER) 137 | static void applyGL(const OFX::Texture* srcImg, 138 | const OCIO_NAMESPACE::ConstProcessorRcPtr& processor, 139 | OCIOOpenGLContextData* contextData); 140 | #endif 141 | 142 | void apply(double time, const OfxRectI& renderWindow, const OfxPointD& renderScale, OFX::Image* dstImg); 143 | void apply(double time, const OfxRectI& renderWindow, const OfxPointD& renderScale, float* pixelData, const OfxRectI& bounds, OFX::PixelComponentEnum pixelComponents, int pixelComponentCount, int rowBytes); 144 | void changedParam(const OFX::InstanceChangedArgs& args, const std::string& paramName); 145 | void purgeCaches(); 146 | void getInputColorspaceDefault(std::string& v) const; 147 | void getInputColorspace(std::string& v) const; 148 | void getInputColorspaceAtTime(double time, std::string& v) const; 149 | void getOutputColorspaceDefault(std::string& v) const; 150 | void getOutputColorspace(std::string& v) const; 151 | void getOutputColorspaceAtTime(double time, std::string& v) const; 152 | bool hasColorspace(const char* name) const; 153 | void setInputColorspace(const char* name); 154 | void setOutputColorspace(const char* name); 155 | #ifdef OFX_IO_USING_OCIO 156 | OCIO_NAMESPACE::ConstContextRcPtr getLocalContext(double time) const; 157 | OCIO_NAMESPACE::ConstConfigRcPtr getConfig() const { return _config; }; 158 | OCIO_NAMESPACE::ConstProcessorRcPtr getProcessor() const; 159 | OCIO_NAMESPACE::ConstProcessorRcPtr getOrCreateProcessor(double time); 160 | 161 | #endif 162 | bool configIsDefault() const; 163 | 164 | // Each of the following functions re-reads the OCIO config: Not optimal but more clear. 165 | static void describeInContextInput(OFX::ImageEffectDescriptor& desc, OFX::ContextEnum context, OFX::PageParamDescriptor* page, const char* inputSpaceNameDefault, const char* inputSpaceLabel = kOCIOParamInputSpaceLabel); 166 | static void describeInContextOutput(OFX::ImageEffectDescriptor& desc, OFX::ContextEnum context, OFX::PageParamDescriptor* page, const char* outputSpaceNameDefault, const char* outputSpaceLabel = kOCIOParamOutputSpaceLabel); 167 | static void describeInContextContext(OFX::ImageEffectDescriptor& desc, OFX::ContextEnum context, OFX::PageParamDescriptor* page); 168 | 169 | #ifdef OFX_IO_USING_OCIO 170 | void setValues(const std::string& inputSpace, const std::string& outputSpace); 171 | void setValues(const OCIO_NAMESPACE::ConstContextRcPtr& context, const std::string& inputSpace, const std::string& outputSpace); 172 | #endif 173 | 174 | // Calls inputCheck and outputCheck 175 | void refreshInputAndOutputState(double time) 176 | { 177 | inputCheck(time); 178 | outputCheck(time); 179 | } 180 | 181 | public: 182 | #ifdef OFX_USE_MULTITHREAD_MUTEX 183 | typedef OFX::MultiThread::Mutex Mutex; 184 | typedef OFX::MultiThread::AutoMutex AutoMutex; 185 | #else 186 | typedef tthread::fast_mutex Mutex; 187 | typedef OFX::MultiThread::AutoMutexT AutoMutex; 188 | #endif 189 | 190 | private: 191 | void loadConfig(); 192 | void inputCheck(double time); 193 | void outputCheck(double time); 194 | 195 | OFX::ImageEffect* _parent; 196 | bool _created; 197 | #ifdef OFX_IO_USING_OCIO 198 | std::string _ocioConfigFileName; 199 | OFX::StringParam* _ocioConfigFile; //< filepath of the OCIO config file 200 | OFX::StringParam* _inputSpace; 201 | OFX::StringParam* _outputSpace; 202 | #ifdef OFX_OCIO_CHOICE 203 | bool _choiceIsOk; //< true if the choice menu contains the right entries 204 | std::string _choiceFileName; //< the name of the OCIO config file that was used for the choice menu 205 | OFX::ChoiceParam* _inputSpaceChoice; //< the input colorspace we're converting from 206 | OFX::ChoiceParam* _outputSpaceChoice; //< the output colorspace we're converting to 207 | #endif 208 | OFX::StringParam* _contextKey1; 209 | OFX::StringParam* _contextValue1; 210 | OFX::StringParam* _contextKey2; 211 | OFX::StringParam* _contextValue2; 212 | OFX::StringParam* _contextKey3; 213 | OFX::StringParam* _contextValue3; 214 | OFX::StringParam* _contextKey4; 215 | OFX::StringParam* _contextValue4; 216 | 217 | OCIO_NAMESPACE::ConstConfigRcPtr _config; 218 | 219 | mutable Mutex _procMutex; 220 | OCIO_NAMESPACE::ConstProcessorRcPtr _proc; 221 | OCIO_NAMESPACE::ConstContextRcPtr _procContext; 222 | std::string _procInputSpace; 223 | std::string _procOutputSpace; 224 | // OCIO_NAMESPACE::ConstTransformRcPtr _procTransform; 225 | #endif 226 | }; 227 | 228 | #ifdef OFX_IO_USING_OCIO 229 | class OCIOProcessor 230 | : public OFX::PixelProcessor { 231 | public: 232 | // ctor 233 | OCIOProcessor(OFX::ImageEffect& instance) 234 | : OFX::PixelProcessor(instance) 235 | , _proc() 236 | , _instance(&instance) 237 | { 238 | } 239 | 240 | // and do some processing 241 | void multiThreadProcessImages(const OfxRectI& procWindow, const OfxPointD& rs); 242 | 243 | void setProcessor(const OCIO_NAMESPACE::ConstProcessorRcPtr& proc) 244 | { 245 | _proc = proc; 246 | } 247 | 248 | private: 249 | OCIO_NAMESPACE::ConstProcessorRcPtr _proc; 250 | OFX::ImageEffect* _instance; 251 | }; 252 | #endif 253 | 254 | // Helper class to set the C locale when doing OCIO calls. 255 | // See https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/297#issuecomment-505636123 256 | class AutoSetAndRestoreThreadLocale { 257 | public: 258 | AutoSetAndRestoreThreadLocale(); 259 | ~AutoSetAndRestoreThreadLocale(); 260 | 261 | private: 262 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 263 | std::string ssaLocale; 264 | int previousThreadConfig; 265 | #else 266 | locale_t oldLocale; 267 | locale_t currentLocale; 268 | #endif 269 | }; 270 | 271 | NAMESPACE_OFX_IO_EXIT 272 | NAMESPACE_OFX_EXIT 273 | 274 | #endif // ifndef IO_GenericOCIO_h 275 | -------------------------------------------------------------------------------- /IOSupport/GenericOCIOOpenGL.cpp: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * This file is part of openfx-io , 3 | * (C) 2018-2021 The Natron Developers 4 | * (C) 2013-2018 INRIA 5 | * 6 | * openfx-io is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * openfx-io is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with openfx-io. If not, see 18 | * ***** END LICENSE BLOCK ***** */ 19 | 20 | /* 21 | * OFX GenericOCIO plugin add-on. 22 | * Adds OpenColorIO functionality to any plugin. 23 | */ 24 | 25 | #include "GenericOCIO.h" 26 | 27 | #include 28 | #include 29 | #ifdef DEBUG 30 | #include 31 | #define DBG(x) x 32 | #else 33 | #define DBG(x) (void)0 34 | #endif 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | // Use OpenGL function directly, no need to use ofxsOGLFunctions.h directly because we don't use OSMesa 44 | #include "glad.h" 45 | 46 | #ifdef OFX_IO_USING_OCIO 47 | 48 | #if OCIO_VERSION_HEX >= 0x02000000 49 | #include "glsl.h" 50 | #endif 51 | 52 | namespace OCIO = OCIO_NAMESPACE; 53 | #endif 54 | 55 | using std::string; 56 | 57 | NAMESPACE_OFX_ENTER 58 | NAMESPACE_OFX_IO_ENTER 59 | 60 | #if defined(OFX_SUPPORTS_OPENGLRENDER) 61 | 62 | static const int LUT3D_EDGE_SIZE = 32; 63 | static const char* g_fragShaderText = "" 64 | "\n" 65 | "uniform sampler2D tex1;\n" 66 | #if OCIO_VERSION_HEX < 0x02000000 67 | "uniform sampler3D tex2;\n" 68 | #endif 69 | "\n" 70 | "void main()\n" 71 | "{\n" 72 | " vec4 col = texture2D(tex1, gl_TexCoord[0].st);\n" 73 | #if OCIO_VERSION_HEX >= 0x02000000 74 | " gl_FragColor = OCIODisplay(col);\n" 75 | #else 76 | " gl_FragColor = OCIODisplay(col, tex2);\n" 77 | #endif 78 | "}\n"; 79 | 80 | OCIOOpenGLContextData::OCIOOpenGLContextData() 81 | #if OCIO_VERSION_HEX < 0x02000000 82 | : procLut3D() 83 | , procShaderCacheID() 84 | , procLut3DCacheID() 85 | , procLut3DID(0) 86 | , procShaderProgramID(0) 87 | , procFragmentShaderID(0) 88 | #endif 89 | { 90 | if (!ofxsLoadOpenGLOnce()) { 91 | // We could use an error message here 92 | throwSuiteStatusException(kOfxStatFailed); 93 | } 94 | } 95 | 96 | OCIOOpenGLContextData::~OCIOOpenGLContextData() 97 | { 98 | #if OCIO_VERSION_HEX >= 0x02000000 99 | glBuilder.reset(); 100 | #else 101 | if (procLut3DID != 0) { 102 | glDeleteTextures(1, &procLut3DID); 103 | } 104 | if (procFragmentShaderID != 0) { 105 | glDeleteShader(procFragmentShaderID); 106 | } 107 | if (procShaderProgramID != 0) { 108 | glDeleteProgram(procShaderProgramID); 109 | } 110 | #endif 111 | } 112 | 113 | #if OCIO_VERSION_HEX < 0x02000000 114 | static GLuint 115 | compileShaderText(GLenum shaderType, 116 | const char* text) 117 | { 118 | GLuint shader; 119 | GLint stat; 120 | 121 | shader = glCreateShader(shaderType); 122 | glShaderSource(shader, 1, (const GLchar**)&text, NULL); 123 | glCompileShader(shader); 124 | glGetShaderiv(shader, GL_COMPILE_STATUS, &stat); 125 | 126 | if (!stat) { 127 | GLchar log[1000]; 128 | GLsizei len; 129 | glGetShaderInfoLog(shader, 1000, &len, log); 130 | DBG(std::fprintf(stderr, "Error: problem compiling shader: %s\n", log)); 131 | 132 | return 0; 133 | } 134 | 135 | return shader; 136 | } 137 | 138 | static GLuint 139 | linkShaders(GLuint fragShader) 140 | { 141 | if (!fragShader) { 142 | return 0; 143 | } 144 | 145 | GLuint program = glCreateProgram(); 146 | 147 | if (fragShader) { 148 | glAttachShader(program, fragShader); 149 | } 150 | 151 | glLinkProgram(program); 152 | 153 | /* check link */ 154 | { 155 | GLint stat; 156 | glGetProgramiv(program, GL_LINK_STATUS, &stat); 157 | if (!stat) { 158 | GLchar log[1000]; 159 | GLsizei len; 160 | glGetProgramInfoLog(program, 1000, &len, log); 161 | DBG(std::fprintf(stderr, "Shader link error:\n%s\n", log)); 162 | 163 | return 0; 164 | } 165 | } 166 | 167 | return program; 168 | } 169 | 170 | static void 171 | allocateLut3D(GLuint* lut3dTexID, 172 | std::vector* lut3D) 173 | { 174 | glGenTextures(1, lut3dTexID); 175 | 176 | int num3Dentries = 3 * LUT3D_EDGE_SIZE * LUT3D_EDGE_SIZE * LUT3D_EDGE_SIZE; 177 | lut3D->resize(num3Dentries); 178 | std::memset(&(*lut3D)[0], 0, sizeof(float) * num3Dentries); 179 | 180 | // https://github.com/AcademySoftwareFoundation/OpenColorIO/blame/RB-1.1/src/apps/ociodisplay/main.cpp#L234 181 | glEnable(GL_TEXTURE_3D); 182 | glActiveTexture(GL_TEXTURE1); 183 | glBindTexture(GL_TEXTURE_3D, *lut3dTexID); 184 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 185 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 186 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 187 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 188 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); 189 | glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB32F_ARB, 190 | LUT3D_EDGE_SIZE, LUT3D_EDGE_SIZE, LUT3D_EDGE_SIZE, 191 | 0, GL_RGB, GL_FLOAT, &(*lut3D)[0]); 192 | } 193 | #endif 194 | 195 | #if defined(OFX_IO_USING_OCIO) 196 | 197 | void 198 | GenericOCIO::applyGL(const Texture* srcImg, 199 | const OCIO::ConstProcessorRcPtr& processor, 200 | OCIOOpenGLContextData* contextData) 201 | { 202 | 203 | #if OCIO_VERSION_HEX >= 0x02000000 204 | // See https://github.com/imageworks/OpenColorIO/blob/master/src/apps/ociodisplay/main.cpp 205 | 206 | // Create an OpenGL helper, this should be done only once 207 | OCIO::OpenGLBuilderRcPtr glBuilder; 208 | if (contextData) { 209 | if (contextData->processorCacheID != processor->getCacheID()) { 210 | contextData->glBuilder.reset(); 211 | } 212 | glBuilder = contextData->glBuilder; 213 | } 214 | if (!glBuilder) { 215 | // Extract the shader information. 216 | bool gpulegacy = false; 217 | OCIO::ConstGPUProcessorRcPtr gpuProc; 218 | gpuProc = gpulegacy ? processor->getOptimizedLegacyGPUProcessor(OCIO::OPTIMIZATION_GOOD, LUT3D_EDGE_SIZE) 219 | : processor->getOptimizedGPUProcessor(OCIO::OPTIMIZATION_VERY_GOOD); 220 | // See https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/b2e88b195c1e1a82a51818e0a4aa2975e03b6a88/vendor/aftereffects/OpenColorIO_AE_Context.cpp#L851 221 | // Step 1: Create a GPU Shader Description 222 | OCIO::GpuShaderDescRcPtr shaderDesc = OCIO::GpuShaderDesc::CreateShaderDesc(); 223 | shaderDesc->setLanguage(OCIO::GPU_LANGUAGE_GLSL_1_2); 224 | shaderDesc->setFunctionName("OCIODisplay"); 225 | shaderDesc->setResourcePrefix("ocio_"); 226 | 227 | // Step 2: Collect the shader program information for a specific processor 228 | gpuProc->extractGpuShaderInfo(shaderDesc); 229 | 230 | // Step 3: Use the helper OpenGL builder 231 | glBuilder = OCIO::OpenGLBuilder::Create(shaderDesc); 232 | if (contextData) { 233 | contextData->processorCacheID = processor->getCacheID(); 234 | contextData->glBuilder = glBuilder; 235 | } 236 | 237 | // Step 4: Allocate & upload all the LUTs 238 | // 239 | // NB: The start index for the texture indices is 1 as one texture 240 | // was already created for the input image. 241 | // 242 | glBuilder->allocateAllTextures(1); 243 | 244 | // Step 5: Build the fragment shader program 245 | glBuilder->buildProgram(g_fragShaderText, false); 246 | } 247 | 248 | glEnable(GL_TEXTURE_2D); 249 | glActiveTexture(GL_TEXTURE0); 250 | int srcTarget = srcImg->getTarget(); 251 | glBindTexture(srcTarget, srcImg->getIndex()); 252 | glTexParameteri(srcTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 253 | glTexParameteri(srcTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 254 | glTexParameteri(srcTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 255 | glTexParameteri(srcTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 256 | 257 | // Step 6: Enable the fragment shader program, and all needed textures 258 | glBuilder->useProgram(); 259 | glUniform1i(glGetUniformLocation(glBuilder->getProgramHandle(), "tex1"), 0); // image texture 260 | 261 | // Bind textures and apply texture mapping 262 | glBuilder->useAllTextures(); // LUT textures 263 | glBuilder->useAllUniforms(); 264 | 265 | if (GL_NO_ERROR != glGetError()) { 266 | throwSuiteStatusException(kOfxStatFailed); 267 | } 268 | const OfxRectI& srcBounds = srcImg->getBounds(); 269 | 270 | glPushMatrix(); 271 | glBegin(GL_QUADS); 272 | glTexCoord2f(0.0f, 0.0f); 273 | glVertex2f(srcBounds.x1, srcBounds.y1); 274 | glTexCoord2f(0.0f, 1.0f); 275 | glVertex2f(srcBounds.x1, srcBounds.y2); 276 | glTexCoord2f(1.0f, 1.0f); 277 | glVertex2f(srcBounds.x2, srcBounds.y2); 278 | glTexCoord2f(1.0f, 0.0f); 279 | glVertex2f(srcBounds.x2, srcBounds.y1); 280 | glEnd(); 281 | glPopMatrix(); 282 | if (GL_NO_ERROR != glGetError()) { 283 | throwSuiteStatusException(kOfxStatFailed); 284 | } 285 | #else 286 | // Reference code: https://github.com/imageworks/OpenColorIO/blob/RB-1.1/src/apps/ociodisplay/main.cpp 287 | // Step 1: Create a GPU Shader Description 288 | // https://github.com/imageworks/OpenColorIO/blame/RB-1.1/src/apps/ociodisplay/main.cpp#L562 289 | OCIO::GpuShaderDesc shaderDesc; 290 | shaderDesc.setLanguage(OCIO::GPU_LANGUAGE_GLSL_1_0); 291 | shaderDesc.setFunctionName("OCIODisplay"); 292 | shaderDesc.setLut3DEdgeLen(LUT3D_EDGE_SIZE); 293 | 294 | // Allocate CPU lut + init lut 3D texture, this should be done only once 295 | GLuint lut3dTexID = 0; 296 | std::vector* lut3D = 0; 297 | if (contextData) { 298 | lut3D = &contextData->procLut3D; 299 | } else { 300 | lut3D = new std::vector; 301 | } 302 | if (contextData) { 303 | lut3dTexID = contextData->procLut3DID; 304 | } 305 | if (lut3D->size() == 0) { 306 | // The LUT was not allocated yet or the caller does not want to cache the lut 307 | // allocating at all 308 | allocateLut3D(&lut3dTexID, lut3D); 309 | if (contextData) { 310 | contextData->procLut3DCacheID = lut3dTexID; 311 | } 312 | } 313 | 314 | glEnable(GL_TEXTURE_3D); 315 | 316 | // Step 2: Compute the 3D LUT 317 | // https://github.com/imageworks/OpenColorIO/blame/RB-1.1/src/apps/ociodisplay/main.cpp#L568 318 | // The lut3D texture should be cached to avoid calling glTexSubImage3D again 319 | string lut3dCacheID = processor->getGpuLut3DCacheID(shaderDesc); 320 | 321 | if (!contextData || (contextData->procLut3DCacheID != lut3dCacheID)) { 322 | // Unfortunately the LUT3D is not cached yet, or caller does not want caching 323 | processor->getGpuLut3D(&(*lut3D)[0], shaderDesc); 324 | 325 | /*for (std::size_t i = 0; i < lut3D->size(); ++i) { 326 | assert((*lut3D)[i] == (*lut3D)[i] && (*lut3D)[i] != std::numeric_limits::infinity()); 327 | }*/ 328 | 329 | glActiveTexture(GL_TEXTURE1); 330 | glBindTexture(GL_TEXTURE_3D, lut3dTexID); 331 | glTexSubImage3D(GL_TEXTURE_3D, 0, 332 | 0, 0, 0, 333 | LUT3D_EDGE_SIZE, LUT3D_EDGE_SIZE, LUT3D_EDGE_SIZE, 334 | GL_RGB, GL_FLOAT, &(*lut3D)[0]); 335 | 336 | // update the cache ID 337 | if (contextData) { 338 | contextData->procLut3DCacheID = lut3dCacheID; 339 | } 340 | } 341 | 342 | if (!contextData) { 343 | // Ensure we free the vector if we allocated it 344 | delete lut3D; 345 | } 346 | lut3D = 0; 347 | 348 | // Step 3: Compute the Shader 349 | // https://github.com/imageworks/OpenColorIO/blame/RB-1.1/src/apps/ociodisplay/main.cpp#L584 350 | // The shader should be cached, to avoid generating it again 351 | string shaderCacheID = processor->getGpuShaderTextCacheID(shaderDesc); 352 | 353 | GLuint programID; 354 | GLuint fragShaderID; 355 | if (!contextData || (contextData->procShaderCacheID != shaderCacheID)) { 356 | // Unfortunately the shader is not cached yet, or caller does not want caching 357 | string shaderString; 358 | shaderString += processor->getGpuShaderText(shaderDesc); 359 | shaderString += "\n"; 360 | shaderString += g_fragShaderText; 361 | 362 | fragShaderID = compileShaderText(GL_FRAGMENT_SHADER, shaderString.c_str()); 363 | programID = linkShaders(fragShaderID); 364 | if (contextData) { 365 | contextData->procShaderProgramID = programID; 366 | contextData->procFragmentShaderID = fragShaderID; 367 | // update the cache ID 368 | contextData->procShaderCacheID = shaderCacheID; 369 | } 370 | } else { 371 | programID = contextData->procShaderProgramID; 372 | fragShaderID = contextData->procFragmentShaderID; 373 | } 374 | 375 | // https://github.com/imageworks/OpenColorIO/blame/RB-1.1/src/apps/ociodisplay/main.cpp#L603 376 | glUseProgram(programID); 377 | glUniform1i(glGetUniformLocation(programID, "tex1"), 0); 378 | glUniform1i(glGetUniformLocation(programID, "tex2"), 1); 379 | 380 | // https://github.com/AcademySoftwareFoundation/OpenColorIO/blame/RB-1.1/src/apps/ociodisplay/main.cpp#L192 381 | // Bind textures and apply texture mapping 382 | glEnable(GL_TEXTURE_2D); 383 | glActiveTexture(GL_TEXTURE0); 384 | int srcTarget = srcImg->getTarget(); 385 | glBindTexture(srcTarget, srcImg->getIndex()); 386 | glTexParameteri(srcTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 387 | glTexParameteri(srcTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 388 | glTexParameteri(srcTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 389 | glTexParameteri(srcTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 390 | 391 | glActiveTexture(GL_TEXTURE1); 392 | glBindTexture(GL_TEXTURE_3D, lut3dTexID); 393 | 394 | const OfxRectI& srcBounds = srcImg->getBounds(); 395 | 396 | glBegin(GL_QUADS); 397 | glTexCoord2f(0., 0.); 398 | glVertex2f(srcBounds.x1, srcBounds.y1); 399 | glTexCoord2f(0., 1.); 400 | glVertex2f(srcBounds.x1, srcBounds.y2); 401 | glTexCoord2f(1., 1.); 402 | glVertex2f(srcBounds.x2, srcBounds.y2); 403 | glTexCoord2f(1., 0.); 404 | glVertex2f(srcBounds.x2, srcBounds.y1); 405 | glEnd(); 406 | 407 | glUseProgram(0); 408 | 409 | glActiveTexture(GL_TEXTURE1); 410 | glBindTexture(GL_TEXTURE_3D, 0); 411 | glActiveTexture(GL_TEXTURE0); 412 | glBindTexture(GL_TEXTURE_2D, 0); 413 | 414 | if (!contextData) { 415 | glDeleteTextures(1, &lut3dTexID); 416 | glDeleteProgram(programID); 417 | glDeleteShader(fragShaderID); 418 | } 419 | #endif // OCIO_VERSION_HEX >= 0x02000000 420 | } // GenericOCIO::applyGL 421 | 422 | #endif // defined(OFX_IO_USING_OCIO) 423 | 424 | #endif // defined(OFX_SUPPORTS_OPENGLRENDER) 425 | 426 | NAMESPACE_OFX_IO_EXIT 427 | NAMESPACE_OFX_EXIT 428 | -------------------------------------------------------------------------------- /IOSupport/IOUtility.h: -------------------------------------------------------------------------------- 1 | /* 2 | OFX I/O utility functions. 3 | Adds OpenColorIO functionality to any plugin. 4 | 5 | Copyright (C) 2013-2018 INRIA 6 | Author: Frederic Devernay 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | 14 | Redistributions in binary form must reproduce the above copyright notice, this 15 | list of conditions and the following disclaimer in the documentation and/or 16 | other materials provided with the distribution. 17 | 18 | Neither the name of the {organization} nor the names of its 19 | contributors may be used to endorse or promote products derived from 20 | this software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 29 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | INRIA 34 | Domaine de Voluceau 35 | Rocquencourt - B.P. 105 36 | 78153 Le Chesnay Cedex - France 37 | 38 | */ 39 | 40 | #ifndef IO_Utility_h 41 | #define IO_Utility_h 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | 50 | #include "ofxsImageEffect.h" 51 | 52 | #define NAMESPACE_OFX_ENTER namespace OFX { 53 | #define NAMESPACE_OFX_EXIT } 54 | 55 | #define NAMESPACE_OFX_IO_ENTER namespace IO { 56 | #define NAMESPACE_OFX_IO_EXIT } 57 | 58 | NAMESPACE_OFX_ENTER 59 | NAMESPACE_OFX_IO_ENTER 60 | 61 | inline std::string 62 | basename(std::string const& pathname) 63 | { 64 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(WIN64) 65 | std::size_t found = pathname.find_last_of("/\\"); 66 | #else 67 | std::size_t found = pathname.find_last_of("/"); 68 | #endif 69 | 70 | return pathname.substr(found + 1); 71 | } 72 | 73 | inline std::string 74 | dirname(std::string const& pathname) 75 | { 76 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(WIN64) 77 | std::size_t found = pathname.find_last_of("/\\"); 78 | #else 79 | std::size_t found = pathname.find_last_of("/"); 80 | #endif 81 | 82 | return pathname.substr(0, found); 83 | } 84 | 85 | inline std::string 86 | extension(const std::string& filename) 87 | { 88 | std::string::const_reverse_iterator pivot = std::find(filename.rbegin(), filename.rend(), '.'); 89 | if (pivot == filename.rend()) { 90 | return ""; 91 | } 92 | std::string ext; 93 | std::locale loc; 94 | for (std::string::const_iterator it = pivot.base(); it != filename.end(); ++it) { 95 | ext.append(1, std::tolower(*it, loc)); 96 | } 97 | 98 | return ext; 99 | } 100 | 101 | /// numvals should be 256 for byte, 65536 for 16-bits, etc. 102 | template 103 | float 104 | intToFloat(int value) 105 | { 106 | return value / (float)(numvals - 1); 107 | } 108 | 109 | template 110 | int 111 | floatToInt(float value) 112 | { 113 | if (value <= 0) { 114 | return 0; 115 | } else if (value >= 1.) { 116 | return numvals - 1; 117 | } 118 | 119 | return (int)(value * (numvals - 1) + 0.5); 120 | } 121 | 122 | /** 123 | * @brief Upscales the bounds assuming this rectangle is the Nth level of mipmap 124 | **/ 125 | inline OfxRectI 126 | upscalePowerOfTwo(const OfxRectI& r, 127 | unsigned int thisLevel) 128 | { 129 | if (thisLevel == 0) { 130 | return r; 131 | } 132 | OfxRectI ret; 133 | ret.x1 = r.x1 << thisLevel; 134 | ret.x2 = r.x2 << thisLevel; 135 | ret.y1 = r.y1 << thisLevel; 136 | ret.y2 = r.y2 << thisLevel; 137 | 138 | return ret; 139 | } 140 | 141 | /** 142 | * @brief Upscales the bounds assuming this rectangle is the Nth level of mipmap 143 | **/ 144 | inline OfxRectD 145 | upscalePowerOfTwo(const OfxRectD& r, 146 | double thisLevel) 147 | { 148 | if (thisLevel == 0) { 149 | return r; 150 | } 151 | OfxRectD ret; 152 | ret.x1 = std::pow(r.x1, thisLevel); 153 | ret.x2 = std::pow(r.x2, thisLevel); 154 | ret.y1 = std::pow(r.y1, thisLevel); 155 | ret.y2 = std::pow(r.y2, thisLevel); 156 | 157 | return ret; 158 | } 159 | 160 | /** 161 | * @brief Scales down the rectangle by the given power of 2 162 | **/ 163 | inline OfxRectI 164 | downscalePowerOfTwo(const OfxRectI& r, 165 | unsigned int thisLevel) 166 | { 167 | if (thisLevel == 0) { 168 | return r; 169 | } 170 | OfxRectI ret; 171 | assert(r.x1 % (1 << thisLevel) == 0 && r.x2 % (1 << thisLevel) == 0 && r.y1 % (1 << thisLevel) == 0 && r.y2 % (1 << thisLevel) == 0); 172 | ret.x1 = r.x1 >> thisLevel; 173 | ret.x2 = r.x2 >> thisLevel; 174 | ret.y1 = r.y1 >> thisLevel; 175 | ret.y2 = r.y2 >> thisLevel; 176 | 177 | return ret; 178 | } 179 | 180 | inline bool 181 | isRectNull(const OfxRectI& r) 182 | { 183 | return (r.x2 <= r.x1) || (r.y2 <= r.y1); 184 | } 185 | 186 | inline bool 187 | intersect(const OfxRectI& r1, 188 | const OfxRectI& r2, 189 | OfxRectI* intersection) 190 | { 191 | if (isRectNull(r1) || isRectNull(r2)) { 192 | return false; 193 | } 194 | 195 | if ((r1.x1 > r2.x2) || (r2.x1 > r1.x2) || (r1.y1 > r2.y2) || (r2.y1 > r1.y2)) { 196 | return false; 197 | } 198 | 199 | intersection->x1 = (std::max)(r1.x1, r2.x1); 200 | intersection->x2 = (std::min)(r1.x2, r2.x2); 201 | intersection->y1 = (std::max)(r1.y1, r2.y1); 202 | intersection->y2 = (std::min)(r1.y2, r2.y2); 203 | 204 | return true; 205 | } 206 | 207 | /* 208 | test program for rounding integer to the next/previous pot: 209 | #include 210 | int main() 211 | { 212 | int i; 213 | int pot = 3; 214 | int scale = 1 << pot; 215 | int scalem1 = scale - 1; 216 | for(i=-100; i<100; ++i) 217 | { 218 | printf("%d => %d,%d %d,%d\n", i, i & ~scalem1, i+scalem1 & ~scalem1, (i >> pot) << pot, ((i+scalem1)>>pot) << pot); 219 | } 220 | } 221 | */ 222 | /** 223 | * @brief round the rectangle by the given power of 2, and return the largest *enclosed* (inside) rectangle 224 | **/ 225 | inline OfxRectI 226 | roundPowerOfTwoLargestEnclosed(const OfxRectI& r, 227 | unsigned int thisLevel) 228 | { 229 | if (thisLevel == 0) { 230 | return r; 231 | } 232 | OfxRectI ret; 233 | int pot = (1 << thisLevel); 234 | int pot_minus1 = pot - 1; 235 | ret.x1 = (r.x1 + pot_minus1) & ~pot_minus1; 236 | ret.x2 = r.x2 & ~pot_minus1; 237 | ret.y1 = (r.y1 + pot_minus1) & ~pot_minus1; 238 | ret.y2 = r.y2 & ~pot_minus1; 239 | // check that it's enclosed 240 | assert(ret.x1 >= r.x1 && ret.x2 <= r.x2 && ret.y1 >= r.y1 && ret.y2 <= r.y2); 241 | 242 | return ret; 243 | } 244 | 245 | /** 246 | * @brief round the rectangle by the given power of 2, and return the smallest *enclosing* rectangle 247 | **/ 248 | inline OfxRectI 249 | roundPowerOfTwoSmallestEnclosing(const OfxRectI& r, 250 | unsigned int thisLevel) 251 | { 252 | if (thisLevel == 0) { 253 | return r; 254 | } 255 | OfxRectI ret; 256 | int pot = (1 << thisLevel); 257 | int pot_minus1 = pot - 1; 258 | ret.x1 = r.x1 & ~pot_minus1; 259 | ret.x2 = (r.x2 + pot_minus1) & ~pot_minus1; 260 | ret.y1 = r.y1 & ~pot_minus1; 261 | ret.y2 = (r.y2 + pot_minus1) & ~pot_minus1; 262 | // check that it's enclosing 263 | assert(ret.x1 <= r.x1 && ret.x2 >= r.x2 && ret.y1 <= r.y1 && ret.y2 >= r.y2); 264 | 265 | return ret; 266 | } 267 | 268 | /** 269 | * @brief Scales down the rectangle by the given power of 2, and return the largest *enclosed* (inside) rectangle 270 | **/ 271 | inline OfxRectI 272 | downscalePowerOfTwoLargestEnclosed(const OfxRectI& r, 273 | unsigned int thisLevel) 274 | { 275 | if (thisLevel == 0) { 276 | return r; 277 | } 278 | OfxRectI ret; 279 | int pot = (1 << thisLevel); 280 | int pot_minus1 = pot - 1; 281 | ret.x1 = (r.x1 + pot_minus1) >> thisLevel; 282 | ret.x2 = r.x2 >> thisLevel; 283 | ret.y1 = (r.y1 + pot_minus1) >> thisLevel; 284 | ret.y2 = r.y2 >> thisLevel; 285 | // check that it's enclosed 286 | assert(ret.x1 * pot >= r.x1 && ret.x2 * pot <= r.x2 && ret.y1 * pot >= r.y1 && ret.y2 * pot <= r.y2); 287 | 288 | return ret; 289 | } 290 | 291 | /** 292 | * @brief Scales down the rectangle by the given power of 2, and return the smallest *enclosing* rectangle 293 | **/ 294 | inline OfxRectI 295 | downscalePowerOfTwoSmallestEnclosing(const OfxRectI& r, 296 | unsigned int thisLevel) 297 | { 298 | if (thisLevel == 0) { 299 | return r; 300 | } 301 | OfxRectI ret; 302 | int pot = (1 << thisLevel); 303 | int pot_minus1 = pot - 1; 304 | ret.x1 = r.x1 >> thisLevel; 305 | ret.x2 = (r.x2 + pot_minus1) >> thisLevel; 306 | ret.y1 = r.y1 >> thisLevel; 307 | ret.y2 = (r.y2 + pot_minus1) >> thisLevel; 308 | // check that it's enclosing 309 | assert(ret.x1 * pot <= r.x1 && ret.x2 * pot >= r.x2 && ret.y1 * pot <= r.y1 && ret.y2 * pot >= r.y2); 310 | 311 | return ret; 312 | } 313 | 314 | inline OfxRectI 315 | nextRectLevel(const OfxRectI& r) 316 | { 317 | OfxRectI ret = r; 318 | 319 | ret.x1 /= 2; 320 | ret.y1 /= 2; 321 | ret.x2 /= 2; 322 | ret.y2 /= 2; 323 | 324 | return ret; 325 | } 326 | 327 | inline double 328 | getScaleFromMipMapLevel(unsigned int level) 329 | { 330 | return 1. / (1 << level); 331 | } 332 | 333 | #ifndef M_LN2 334 | #define M_LN2 0.693147180559945309417232121458176568 /* loge(2) */ 335 | #endif 336 | inline unsigned int 337 | getLevelFromScale(double s) 338 | { 339 | assert(0. < s && s <= 1.); 340 | int retval = -(int)std::floor(std::log(s) / M_LN2 + 0.5); 341 | assert(retval >= 0); 342 | 343 | return retval; 344 | } 345 | 346 | /** 347 | * @brief Helper class to make fast buffers that are ensured to be deallocated in a RAII style 348 | **/ 349 | class RamBuffer { 350 | unsigned char* data; 351 | 352 | public: 353 | RamBuffer(std::size_t nBytes) 354 | : data(0) 355 | { 356 | data = (unsigned char*)malloc(nBytes); 357 | } 358 | 359 | unsigned char* getData() const 360 | { 361 | return data; 362 | } 363 | 364 | ~RamBuffer() 365 | { 366 | if (data) { 367 | free(data); 368 | } 369 | } 370 | }; 371 | 372 | NAMESPACE_OFX_IO_EXIT 373 | NAMESPACE_OFX_EXIT 374 | 375 | #endif // ifndef IO_Utility_h 376 | -------------------------------------------------------------------------------- /IOSupport/glsl.README.txt: -------------------------------------------------------------------------------- 1 | glsl.cpp and glsl.h are from OpenCOlorIO 2.1.1: 2 | https://github.com/AcademySoftwareFoundation/OpenColorIO/tree/v2.1.1/src/libutils/oglapphelpers 3 | 4 | gsls.cpp was modified to use glad.h indlead of GL/glew.h, in order to avoid using another external library. 5 | 6 | These files are Copyright Contributors to the OpenColorIO Project. 7 | They are distributed under the BSD 3-Clause License: 8 | https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/v2.1.1/LICENSE 9 | -------------------------------------------------------------------------------- /IOSupport/glsl.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: BSD-3-Clause 2 | // Copyright Contributors to the OpenColorIO Project. 3 | 4 | #ifndef INCLUDED_OCIO_GLSL_H 5 | #define INCLUDED_OCIO_GLSL_H 6 | 7 | #include 8 | 9 | #include 10 | 11 | namespace OCIO_NAMESPACE { 12 | 13 | class OpenGLBuilder; 14 | typedef OCIO_SHARED_PTR OpenGLBuilderRcPtr; 15 | 16 | // This is a reference implementation showing how to do the texture upload & allocation, 17 | // and the program compilation for the GLSL shader language. 18 | 19 | class OpenGLBuilder { 20 | struct TextureId { 21 | unsigned m_uid = -1; 22 | std::string m_textureName; 23 | std::string m_samplerName; 24 | unsigned m_type = -1; 25 | 26 | TextureId(unsigned uid, 27 | const std::string& textureName, 28 | const std::string& samplerName, 29 | unsigned type) 30 | : m_uid(uid) 31 | , m_textureName(textureName) 32 | , m_samplerName(samplerName) 33 | , m_type(type) 34 | { 35 | } 36 | }; 37 | 38 | typedef std::vector TextureIds; 39 | 40 | // Uniform are used for dynamic parameters. 41 | class Uniform { 42 | public: 43 | Uniform(const std::string& name, const GpuShaderDesc::UniformData& data); 44 | 45 | void setUp(unsigned program); 46 | 47 | void use(); 48 | 49 | private: 50 | Uniform() = delete; 51 | std::string m_name; 52 | GpuShaderDesc::UniformData m_data; 53 | 54 | unsigned m_handle; 55 | }; 56 | typedef std::vector Uniforms; 57 | 58 | public: 59 | // Create an OpenGL builder using the GPU shader information from a specific processor 60 | static OpenGLBuilderRcPtr Create(const GpuShaderDescRcPtr& gpuShader); 61 | 62 | ~OpenGLBuilder(); 63 | 64 | inline void setVerbose(bool verbose) { m_verbose = verbose; } 65 | inline bool isVerbose() const { return m_verbose; } 66 | 67 | // Allocate & upload all the needed textures 68 | // (i.e. the index is the first available index for any kind of textures). 69 | void allocateAllTextures(unsigned startIndex); 70 | void useAllTextures(); 71 | 72 | // Update all uniforms. 73 | void useAllUniforms(); 74 | 75 | // Build the complete shader program which includes the OCIO shader program 76 | // and the client shader program. 77 | unsigned buildProgram(const std::string& clientShaderProgram, bool standaloneShader); 78 | void useProgram(); 79 | unsigned getProgramHandle(); 80 | 81 | // Determine the maximum width value of a texture 82 | // depending of the graphic card and its driver. 83 | static unsigned GetTextureMaxWidth(); 84 | 85 | protected: 86 | OpenGLBuilder(const GpuShaderDescRcPtr& gpuShader); 87 | 88 | // Prepare all the needed uniforms. 89 | void linkAllUniforms(); 90 | 91 | void deleteAllTextures(); 92 | void deleteAllUniforms(); 93 | 94 | // To add the version to the fragment shader program (so that GLSL does not use the default 95 | // of 1.10 when the minimum version for OCIO is 1.20). 96 | std::string getGLSLVersionString(); 97 | 98 | private: 99 | OpenGLBuilder(); 100 | OpenGLBuilder(const OpenGLBuilder&) = delete; 101 | OpenGLBuilder& operator=(const OpenGLBuilder&) = delete; 102 | 103 | const GpuShaderDescRcPtr m_shaderDesc; // Description of the fragment shader to create 104 | unsigned m_startIndex; // Starting index for texture allocations 105 | TextureIds m_textureIds; // Texture ids of all needed textures 106 | Uniforms m_uniforms; // Vector of dynamic parameters 107 | unsigned m_fragShader; // Fragment shader identifier 108 | unsigned m_program; // Program identifier 109 | std::string m_shaderCacheID; // Current shader program key 110 | bool m_verbose; // Print shader code to std::cout for debugging purposes 111 | }; 112 | 113 | } // namespace OCIO_NAMESPACE 114 | 115 | #endif // INCLUDED_OCIO_GLSL_H 116 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # build a combined plugin that reads all formats 2 | SUBDIRS = IO 3 | 4 | SUBDIRS_NOMULTI = \ 5 | EXR \ 6 | FFmpeg \ 7 | OCIO \ 8 | OIIO \ 9 | SeExpr \ 10 | PFM \ 11 | PNG 12 | 13 | all: subdirs 14 | 15 | .PHONY: nomulti subdirs clean install install-nomulti uninstall uninstall-nomulti $(SUBDIRS) 16 | 17 | nomulti: 18 | $(MAKE) $(MFLAGS) SUBDIRS="$(SUBDIRS_NOMULTI)" 19 | 20 | subdirs: $(SUBDIRS) 21 | 22 | $(SUBDIRS): 23 | (cd $@ && $(MAKE) $(MFLAGS)) 24 | 25 | clean: 26 | @for i in $(SUBDIRS) $(SUBDIRS_NOMULTI); do \ 27 | echo "(cd $$i && $(MAKE) $(MFLAGS) $@)"; \ 28 | (cd $$i && $(MAKE) $(MFLAGS) $@); \ 29 | done 30 | 31 | install: 32 | @for i in $(SUBDIRS) ; do \ 33 | echo "(cd $$i && $(MAKE) $(MFLAGS) $@)"; \ 34 | (cd $$i && $(MAKE) $(MFLAGS) $@); \ 35 | done 36 | 37 | install-nomulti: 38 | $(MAKE) SUBDIRS="$(SUBDIRS_NOMULTI)" install 39 | 40 | uninstall: 41 | @for i in $(SUBDIRS) ; do \ 42 | echo "(cd $$i && $(MAKE) $(MFLAGS) $@)"; \ 43 | (cd $$i && $(MAKE) $(MFLAGS) $@); \ 44 | done 45 | 46 | uninstall-nomulti: 47 | $(MAKE) $(MFLAGS) SUBDIRS="$(SUBDIRS_NOMULTI)" uninstall 48 | -------------------------------------------------------------------------------- /Makefile.master: -------------------------------------------------------------------------------- 1 | # These may be changed to $(TOP_SRCDIR)/../openfx and $(TOP_SRCDIR)/../openfx-supportext if openfx and openfx-supportext are not included as submodules 2 | OFXPATH ?= $(TOP_SRCDIR)/openfx 3 | OFXSEXTPATH ?= $(TOP_SRCDIR)/SupportExt 4 | 5 | PATHTOROOT = $(OFXPATH)/Support 6 | 7 | include $(PATHTOROOT)/Plugins/Makefile.master 8 | 9 | CXXFLAGS += -DOFX_EXTENSIONS_VEGAS -DOFX_EXTENSIONS_NUKE -DOFX_EXTENSIONS_TUTTLE -DOFX_EXTENSIONS_NATRON -I$(TOP_SRCDIR)/IOSupport -I$(OFXSEXTPATH) -I$(OFXSEXTPATH)/glad 10 | VPATH += $(TOP_SRCDIR)/IOSupport $(TOP_SRCDIR)/IOSupport/SequenceParsing $(OFXSEXTPATH) $(OFXSEXTPATH)/glad 11 | 12 | # Comment the following two lines to disable OpenGL support in OpenColorIO plugins 13 | OCIO_OPENGL_CXXFLAGS += -DOFX_SUPPORTS_OPENGLRENDER 14 | # Comment the following three lines to disable OpenColorIO support 15 | OCIO_CXXFLAGS += `pkg-config --cflags OpenColorIO` -DOFX_IO_USING_OCIO $(OCIO_OPENGL_CXXFLAGS) 16 | OCIO_LINKFLAGS += `pkg-config --libs OpenColorIO` $(OCIO_OPENGL_LINKFLAGS) 17 | ifeq ($(OS),Linux) 18 | OCIO_LINKFLAGS += -Wl,-rpath,`pkg-config --variable=libdir OpenColorIO` 19 | endif 20 | ifeq ($(shell pkg-config --modversion OpenColorIO | sed -e 's/\..*//'),2) 21 | #OCIO_OPENGL_LINKFLAGS += -lOpenColorIOoglapphelpers 22 | endif 23 | 24 | # OpenEXR 25 | # OpenImageIO includes OpenEXR as #include , to we also add the 26 | # include dir itself to avoid confusion with a system-installed OpenEXR. 27 | # OpenEXR 2 has IlmBase, OpenEXR 3 has Imath, so we ask for both, but it will always cause harmless errors. 28 | OPENEXR_CXXFLAGS = -I`pkg-config --variable=prefix OpenEXR`/include `pkg-config --cflags IlmBase 2>/dev/null` `pkg-config --cflags Imath 2>/dev/null` `pkg-config --cflags OpenEXR` 29 | OPENEXR_LINKFLAGS =`pkg-config --libs IlmBase 2>/dev/null` `pkg-config --libs Imath 2>/dev/null` `pkg-config --libs OpenEXR` 30 | # Uncomment the following line to enable multithreaded EXR reading (untested, and probably does not make sense) 31 | #OPENEXR_CXXFLAGS += -DOFX_IO_MT_EXR 32 | 33 | # FFmpeg 34 | FFMPEG_CXXFLAGS = `pkg-config --cflags libavformat libavcodec libswscale libavutil` 35 | FFMPEG_LINKFLAGS = `pkg-config --libs libavformat libavcodec libswscale libavutil` 36 | # Uncomment the following line to enable multithreaded ffmpeg reading 37 | FFMPEG_CXXFLAGS += -DOFX_IO_MT_FFMPEG 38 | 39 | # OpenImageIO 40 | OIIO_CXXFLAGS = $(OCIO_CXXFLAGS) `pkg-config --cflags OpenImageIO` $(OPENEXR_CFLAGS) -DOFX_IO_USING_LIBRAW `pkg-config --cflags libraw_r libwebp libtiff-4 libopenjp2 libpng` 41 | OIIO_LINKFLAGS = $(OCIO_LINKFLAGS) `pkg-config --libs OpenImageIO` $(OPENEXR_LINKFLAGS) `pkg-config --libs libraw_r libwebp libtiff-4 libopenjp2 libpng` 42 | ifeq ($(OS),Linux) 43 | # libraw_r may be in a separate directory for licence reasons (eg in the Natron SDK) 44 | OIIO_LINKFLAGS += -Wl,-rpath,`pkg-config --variable=prefix OpenImageIO`/lib -Wl,-rpath,`pkg-config --variable=libdir libraw_r` 45 | endif 46 | 47 | #SeExpr 48 | SEEXPR_HOME ?=/usr 49 | SEEXPR_CXXFLAGS = -I$(SEEXPR_HOME)/include 50 | SEEXPR_LINKFLAGS = -L$(SEEXPR_HOME)/lib -lSeExpr 51 | ifeq ($(OS),Linux) 52 | SEEXPR_LINKFLAGS += -Wl,-rpath,$(SEEXPR_HOME)/lib 53 | endif 54 | 55 | #libPNG 56 | PNG_CXXFLAGS = `pkg-config --cflags libpng` 57 | PNG_LINKFLAGS = `pkg-config --libs libpng` -lz 58 | ifeq ($(OS),Linux) 59 | PNG_LINKFLAGS += -Wl,-rpath,`pkg-config --variable=libdir libpng` 60 | endif 61 | -------------------------------------------------------------------------------- /OCIO/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | OCIO.ofx 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | BNDL 13 | CFBundleSignature 14 | ???? 15 | CFBundleVersion 16 | 0.0.1d1 17 | CSResourcesFileMapped 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /OCIO/Makefile: -------------------------------------------------------------------------------- 1 | PLUGINOBJECTS = ofxsThreadSuite.o tinythread.o OCIOCDLTransform.o OCIOColorSpace.o OCIODisplay.o OCIOFileTransform.o OCIOLogConvert.o OCIOLookTransform.o OCIOPluginBase.o GenericOCIO.o $(OCIO_OPENGL_OBJS) 2 | OCIO_OPENGL_OBJS = GenericOCIOOpenGL.o glsl.o glad.o ofxsOGLUtilities.o 3 | PLUGINNAME = OCIO 4 | 5 | TOP_SRCDIR = .. 6 | include $(TOP_SRCDIR)/Makefile.master 7 | 8 | CXXFLAGS += $(OCIO_CXXFLAGS) 9 | LINKFLAGS += $(OCIO_LINKFLAGS) 10 | -------------------------------------------------------------------------------- /OCIO/OCIOPluginBase.cpp: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * This file is part of openfx-io , 3 | * (C) 2018-2023 The Natron Developers 4 | * (C) 2013-2018 INRIA 5 | * 6 | * openfx-io is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * openfx-io is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with openfx-io. If not, see 18 | * ***** END LICENSE BLOCK ***** */ 19 | 20 | #include "OCIOPluginBase.h" 21 | 22 | #include "IOUtility.h" 23 | #include "ofxsImageEffect.h" 24 | #include "ofxsMaskMix.h" 25 | 26 | NAMESPACE_OFX_ENTER 27 | NAMESPACE_OFX_IO_ENTER 28 | 29 | #if defined(OFX_SUPPORTS_OPENGLRENDER) 30 | #define kParamEnableGPU "enableGPU" 31 | #define kParamEnableGPULabel "Enable GPU Render" 32 | #if OCIO_VERSION_HEX >= 0x02000000 33 | #define kParamEnableGPUHint_warn "" 34 | #else 35 | // OCIO1's GPU render is not accurate enough. 36 | // see https://github.com/imageworks/OpenColorIO/issues/394 37 | // and https://github.com/imageworks/OpenColorIO/issues/456 38 | #define kParamEnableGPUHint_warn "Note that GPU render is not as accurate as CPU render, so this should be enabled with care.\n" 39 | #endif 40 | #define kParamEnableGPUHint \ 41 | "Enable GPU-based OpenGL render (only available when \"(Un)premult\" is not checked).\n" kParamEnableGPUHint_warn \ 42 | "If the checkbox is checked but is not enabled (i.e. it cannot be unchecked), GPU render can not be enabled or disabled from the plugin and is probably part of the host options.\n" \ 43 | "If the checkbox is not checked and is not enabled (i.e. it cannot be checked), GPU render is not available on this host." 44 | #endif 45 | 46 | OCIOPluginBase::OCIOPluginBase(OfxImageEffectHandle handle) 47 | : ImageEffect(handle) 48 | , _premult(fetchBooleanParam(kParamPremult)) 49 | , _premultChannel(fetchChoiceParam(kParamPremultChannel)) 50 | #if defined(OFX_SUPPORTS_OPENGLRENDER) 51 | , _enableGPU(fetchBooleanParam(kParamEnableGPU)) 52 | #endif 53 | { 54 | assert(_premult && _premultChannel); 55 | #if defined(OFX_SUPPORTS_OPENGLRENDER) 56 | assert(_enableGPU); 57 | #endif 58 | } 59 | 60 | OCIOPluginBase::~OCIOPluginBase() { } 61 | 62 | // static 63 | void 64 | OCIOPluginBase::defineEnableGPUParam(ImageEffectDescriptor& desc, PageParamDescriptor* page) 65 | { 66 | BooleanParamDescriptor* param = desc.defineBooleanParam(kParamEnableGPU); 67 | param->setLabel(kParamEnableGPULabel); 68 | param->setHint(kParamEnableGPUHint); 69 | const ImageEffectHostDescription& gHostDescription = *getImageEffectHostDescription(); 70 | // Resolve advertises OpenGL support in its host description, but never calls render with OpenGL enabled 71 | if (gHostDescription.supportsOpenGLRender && (gHostDescription.hostName != "DaVinciResolveLite")) { 72 | // OCIO's GPU render is not accurate enough. 73 | // see https://github.com/imageworks/OpenColorIO/issues/394 74 | param->setDefault(/*true*/ false); 75 | if (gHostDescription.APIVersionMajor * 100 + gHostDescription.APIVersionMinor < 104) { 76 | // Switching OpenGL render from the plugin was introduced in OFX 1.4 77 | param->setEnabled(false); 78 | } 79 | } else { 80 | param->setDefault(false); 81 | param->setEnabled(false); 82 | } 83 | 84 | if (page) { 85 | page->addChild(*param); 86 | } 87 | } 88 | 89 | void 90 | OCIOPluginBase::getPremultAndPremultChannelAtTime(double time, bool& premult, int& premultChannel) 91 | { 92 | _premult->getValueAtTime(time, premult); 93 | _premultChannel->getValueAtTime(time, premultChannel); 94 | } 95 | 96 | bool 97 | OCIOPluginBase::paramEffectsOpenGLAndTileSupport(const std::string& paramName) 98 | { 99 | return paramName == kParamEnableGPU || paramName == kParamPremult; 100 | } 101 | 102 | void 103 | OCIOPluginBase::setSupportsOpenGLAndTileInfo() 104 | { 105 | setSupportsOpenGLAndTileInfo_internal(_premult->getValue(), _enableGPU->getValue()); 106 | } 107 | 108 | void 109 | OCIOPluginBase::setSupportsOpenGLAndTileInfoAtTime(double time) 110 | { 111 | setSupportsOpenGLAndTileInfo_internal(_premult->getValueAtTime(time), _enableGPU->getValueAtTime(time)); 112 | } 113 | 114 | void 115 | OCIOPluginBase::setSupportsOpenGLAndTileInfo_internal(bool premult, bool enableGPU) 116 | { 117 | _enableGPU->setEnabled(getImageEffectHostDescription()->supportsOpenGLRender && !premult); 118 | const bool supportsGL = !premult && enableGPU; 119 | setSupportsOpenGLRender(supportsGL); 120 | setSupportsTiles(!supportsGL); 121 | } 122 | 123 | void 124 | OCIOPluginBase::changedSrcClip(Clip* srcClip) 125 | { 126 | if (srcClip->getPixelComponents() != ePixelComponentRGBA) { 127 | _premult->setValue(false); 128 | } else { 129 | switch (srcClip->getPreMultiplication()) { 130 | case eImageOpaque: 131 | _premult->setValue(false); 132 | break; 133 | case eImagePreMultiplied: 134 | _premult->setValue(true); 135 | break; 136 | case eImageUnPreMultiplied: 137 | _premult->setValue(false); 138 | break; 139 | } 140 | } 141 | } 142 | 143 | NAMESPACE_OFX_IO_EXIT 144 | NAMESPACE_OFX_EXIT 145 | -------------------------------------------------------------------------------- /OCIO/OCIOPluginBase.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * This file is part of openfx-io , 3 | * (C) 2018-2023 The Natron Developers 4 | * (C) 2013-2018 INRIA 5 | * 6 | * openfx-io is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * openfx-io is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with openfx-io. If not, see 18 | * ***** END LICENSE BLOCK ***** */ 19 | 20 | #ifndef IO_OCIOPluginBase_h 21 | #define IO_OCIOPluginBase_h 22 | 23 | #include 24 | #include 25 | 26 | #include "IOUtility.h" 27 | #include "ofxsImageEffect.h" 28 | 29 | NAMESPACE_OFX_ENTER 30 | NAMESPACE_OFX_IO_ENTER 31 | 32 | class OCIOPluginBase : public ImageEffect { 33 | public: 34 | // Defines enableGPU param in |desc| and adds it as a child of |page|. 35 | static void defineEnableGPUParam(ImageEffectDescriptor& desc, PageParamDescriptor* page); 36 | 37 | protected: 38 | OCIOPluginBase(OfxImageEffectHandle handle); 39 | virtual ~OCIOPluginBase() override; 40 | 41 | bool getPremultValueAtTime(double time) { return _premult->getValueAtTime(time); } 42 | void getPremultAndPremultChannelAtTime(double time, bool& premult, int& premultChannel); 43 | 44 | // Returns true if |paramName| is the name of a parameter that influences the 45 | // value of the SupportsOpenGLRender & SupportsTiles properties. 46 | bool paramEffectsOpenGLAndTileSupport(const std::string& paramName); 47 | 48 | // Sets SupportsOpenGLRender & SupportsTiles properties based on the 49 | // values of premult and enableGPU parameters. 50 | void setSupportsOpenGLAndTileInfo(); 51 | void setSupportsOpenGLAndTileInfoAtTime(double time); 52 | 53 | void changedSrcClip(Clip* srcClip); 54 | 55 | private: 56 | void setSupportsOpenGLAndTileInfo_internal(bool premult, bool enableGPU); 57 | 58 | BooleanParam* _premult; 59 | ChoiceParam* _premultChannel; 60 | 61 | #if defined(OFX_SUPPORTS_OPENGLRENDER) 62 | BooleanParam* _enableGPU; 63 | #endif 64 | }; 65 | 66 | NAMESPACE_OFX_IO_EXIT 67 | NAMESPACE_OFX_EXIT 68 | 69 | #endif // IO_OCIOPluginBase_h 70 | -------------------------------------------------------------------------------- /OCIO/fr.inria.openfx.OCIOCDLTransform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/OCIO/fr.inria.openfx.OCIOCDLTransform.png -------------------------------------------------------------------------------- /OCIO/fr.inria.openfx.OCIOColorSpace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/OCIO/fr.inria.openfx.OCIOColorSpace.png -------------------------------------------------------------------------------- /OCIO/fr.inria.openfx.OCIODisplay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/OCIO/fr.inria.openfx.OCIODisplay.png -------------------------------------------------------------------------------- /OCIO/fr.inria.openfx.OCIOFileTransform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/OCIO/fr.inria.openfx.OCIOFileTransform.png -------------------------------------------------------------------------------- /OCIO/fr.inria.openfx.OCIOLogConvert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/OCIO/fr.inria.openfx.OCIOLogConvert.png -------------------------------------------------------------------------------- /OCIO/fr.inria.openfx.OCIOLookTransform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/OCIO/fr.inria.openfx.OCIOLookTransform.png -------------------------------------------------------------------------------- /OIIO/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | OIIO.ofx 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | BNDL 13 | CFBundleSignature 14 | ???? 15 | CFBundleVersion 16 | 0.0.1d1 17 | CSResourcesFileMapped 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /OIIO/Makefile: -------------------------------------------------------------------------------- 1 | PLUGINOBJECTS = ofxsThreadSuite.o tinythread.o \ 2 | ReadOIIO.o WriteOIIO.o OIIOGlobal.o \ 3 | OIIOText.o OIIOResize.o \ 4 | GenericReader.o GenericWriter.o GenericOCIO.o SequenceParsing.o \ 5 | ofxsOGLTextRenderer.o ofxsOGLFontData.o ofxsMultiPlane.o 6 | 7 | PLUGINNAME = OIIO 8 | 9 | RESOURCES = \ 10 | fr.inria.openfx.OIIOText.png \ 11 | fr.inria.openfx.OIIOText.svg \ 12 | fr.inria.openfx.ReadOIIO.png \ 13 | fr.inria.openfx.ReadOIIO.svg \ 14 | fr.inria.openfx.OIIOResize.png \ 15 | fr.inria.openfx.OIIOResize.svg \ 16 | fr.inria.openfx.WriteOIIO.png \ 17 | fr.inria.openfx.WriteOIIO.svg 18 | 19 | TOP_SRCDIR = .. 20 | include $(TOP_SRCDIR)/Makefile.master 21 | 22 | CXXFLAGS += $(OCIO_CXXFLAGS) $(OPENEXR_CXXFLAGS) $(OIIO_CXXFLAGS) 23 | LINKFLAGS += $(OCIO_LINKFLAGS) $(OPENEXR_LINKFLAGS) $(OIIO_LINKFLAGS) 24 | -------------------------------------------------------------------------------- /OIIO/OIIOGlobal.cpp: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * This file is part of openfx-io , 3 | * (C) 2018-2023 The Natron Developers 4 | * (C) 2013-2018 INRIA 5 | * 6 | * openfx-io is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * openfx-io is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with openfx-io. If not, see 18 | * ***** END LICENSE BLOCK ***** */ 19 | #include "OIIOGlobal.h" 20 | 21 | #include "ofxsMacros.h" 22 | #include 23 | 24 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 25 | #include 26 | #endif 27 | 28 | // clang-format off 29 | GCC_DIAG_OFF(unused-parameter) 30 | #include 31 | #include 32 | GCC_DIAG_ON(unused-parameter) 33 | // clang-format on 34 | 35 | OIIO_NAMESPACE_USING 36 | 37 | void 38 | initOIIOThreads() 39 | { 40 | // See https://github.com/lgritz/oiio/commit/7f7934fafc127a9f3bc51b6aa5e2e77b1b8a26db 41 | // We want OpenEXR to use all threads, while we do not want OIIO to use all threads for its image 42 | // processing functionalities w/o letting the host know about it. 43 | if (!attribute("exr_threads", 0)) { 44 | // This version of OIIO does not have the exr_threads attribute, fallback on the "threads" attribute... 45 | if (!attribute("threads", 0)) { 46 | #ifdef DEBUG 47 | std::cerr << "OIIO: Failed to set exr_threads and threads attribute" << std::endl; 48 | #endif 49 | } 50 | #ifdef DEBUG 51 | else { 52 | std::cout << "Failed to set exr_threads to 0 fallback to OIIO threads=0" << std::endl; 53 | } 54 | #endif 55 | } else { 56 | // This version of OIIO has the exr_threads attribute. Set the "threads" attribute to limit image processing functions 57 | static const int oiio_threads = 0; 58 | #ifdef DEBUG 59 | std::cout << "Successfully set exr_threads to 0, setting OIIO threads=" << oiio_threads << std::endl; 60 | #endif 61 | if (!attribute("threads", oiio_threads)) { 62 | #ifdef DEBUG 63 | std::cerr << "Failed to set the threads attribute for OIIO" << std::endl; 64 | #endif 65 | } 66 | } 67 | } 68 | 69 | void 70 | shutdownOIIOThreads() 71 | { 72 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 73 | // Kill all threads otherwise when the static global thread pool joins it threads there is a deadlock on Mingw 74 | IlmThread::ThreadPool::globalThreadPool().setNumThreads(0); 75 | 76 | // TODO: Remove the code in the following #if block once all platforms have been updated to an OpenImageIO 77 | // version that defines default_thread_pool_shutdown(). 78 | #if NATRON_OIIO_HAS_DEFAULT_THREAD_POOL_SHUTDOWN != 1 && OIIO_VERSION < OIIO_MAKE_VERSION(2,5,3) 79 | // Workaround to a bug: https://github.com/OpenImageIO/oiio/issues/1795 80 | // see also https://github.com/LuxCoreRender/LuxCore/commit/607bfc9bff519ecc32c02ff3203b7ec71d201fde 81 | OIIO::attribute("threads", 1); 82 | #endif 83 | #endif 84 | 85 | // TODO: Remove #if once all platforms have been updated to an OpenImageIO version that defines 86 | // default_thread_pool_shutdown(). 87 | #if NATRON_OIIO_HAS_DEFAULT_THREAD_POOL_SHUTDOWN == 1 || OIIO_VERSION >= OIIO_MAKE_VERSION(2,5,3) 88 | default_thread_pool_shutdown(); 89 | #endif 90 | } -------------------------------------------------------------------------------- /OIIO/OIIOGlobal.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * This file is part of openfx-io , 3 | * (C) 2018-2023 The Natron Developers 4 | * (C) 2013-2018 INRIA 5 | * 6 | * openfx-io is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * openfx-io is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with openfx-io. If not, see 18 | * ***** END LICENSE BLOCK ***** */ 19 | 20 | #ifndef IO_GLOBAL_OIIO_H 21 | #define IO_GLOBAL_OIIO_H 22 | 23 | void initOIIOThreads(); 24 | void shutdownOIIOThreads(); 25 | 26 | #endif /* IO_GLOBAL_OIIO_H*/ 27 | -------------------------------------------------------------------------------- /OIIO/fr.inria.openfx.OIIOResize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/OIIO/fr.inria.openfx.OIIOResize.png -------------------------------------------------------------------------------- /OIIO/fr.inria.openfx.OIIOResize.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /OIIO/fr.inria.openfx.OIIOText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/OIIO/fr.inria.openfx.OIIOText.png -------------------------------------------------------------------------------- /OIIO/fr.inria.openfx.OIIOText.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OIIO/fr.inria.openfx.ReadOIIO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/OIIO/fr.inria.openfx.ReadOIIO.png -------------------------------------------------------------------------------- /OIIO/fr.inria.openfx.ReadOIIO.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OIIO/fr.inria.openfx.WriteOIIO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/OIIO/fr.inria.openfx.WriteOIIO.png -------------------------------------------------------------------------------- /OIIO/fr.inria.openfx.WriteOIIO.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /PFM/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | PFM.ofx 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | BNDL 13 | CFBundleSignature 14 | ???? 15 | CFBundleVersion 16 | 0.0.1d1 17 | CSResourcesFileMapped 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /PFM/Makefile: -------------------------------------------------------------------------------- 1 | PLUGINOBJECTS = \ 2 | ReadPFM.o WritePFM.o \ 3 | GenericReader.o GenericWriter.o GenericOCIO.o SequenceParsing.o ofxsMultiPlane.o ofxsFileOpen.o 4 | 5 | PLUGINNAME = PFM 6 | 7 | RESOURCES = \ 8 | fr.inria.openfx.ReadPFM.png \ 9 | fr.inria.openfx.ReadPFM.svg \ 10 | fr.inria.openfx.WritePFM.png \ 11 | fr.inria.openfx.WritePFM.svg 12 | 13 | TOP_SRCDIR = .. 14 | include $(TOP_SRCDIR)/Makefile.master 15 | 16 | CXXFLAGS += $(OCIO_CXXFLAGS) 17 | LINKFLAGS += $(OCIO_LINKFLAGS) 18 | -------------------------------------------------------------------------------- /PFM/WritePFM.cpp: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * This file is part of openfx-io , 3 | * (C) 2018-2021 The Natron Developers 4 | * (C) 2013-2018 INRIA 5 | * 6 | * openfx-io is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * openfx-io is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with openfx-io. If not, see 18 | * ***** END LICENSE BLOCK ***** */ 19 | 20 | /* 21 | * OFX PFM writer plugin. 22 | * Writes an image in the Portable Float Map (PFM) format. 23 | */ 24 | 25 | #include 26 | #include // fopen, fwrite, fprintf... 27 | #include 28 | 29 | #include "GenericOCIO.h" 30 | 31 | #include "GenericWriter.h" 32 | #include "ofxsFileOpen.h" 33 | #include "ofxsMacros.h" 34 | 35 | using namespace OFX; 36 | using namespace IO; 37 | #ifdef OFX_IO_USING_OCIO 38 | namespace OCIO = OCIO_NAMESPACE; 39 | #endif 40 | 41 | using std::string; 42 | using std::vector; 43 | 44 | OFXS_NAMESPACE_ANONYMOUS_ENTER 45 | 46 | #define kPluginName "WritePFM" 47 | #define kPluginGrouping "Image/Writers" 48 | #define kPluginDescription "Write PFM (Portable Float Map) files." 49 | #define kPluginIdentifier "fr.inria.openfx.WritePFM" 50 | #define kPluginVersionMajor 1 // Incrementing this number means that you have broken backwards compatibility of the plug-in. 51 | #define kPluginVersionMinor 0 // Increment this when you have fixed a bug or made it faster. 52 | #define kPluginEvaluation 40 // plugin quality from 0 (bad) to 100 (perfect) or -1 if not evaluated 53 | 54 | #define kSupportsRGBA true 55 | #define kSupportsRGB true 56 | #define kSupportsXY false 57 | #define kSupportsAlpha true 58 | 59 | /** 60 | \return \c false for "Little Endian", \c true for "Big Endian". 61 | **/ 62 | static inline bool 63 | endianness() 64 | { 65 | const int x = 1; 66 | 67 | return ((unsigned char*)&x)[0] ? false : true; 68 | } 69 | 70 | class WritePFMPlugin 71 | : public GenericWriterPlugin { 72 | public: 73 | WritePFMPlugin(OfxImageEffectHandle handle, const vector& extensions); 74 | 75 | virtual ~WritePFMPlugin(); 76 | 77 | private: 78 | virtual void encode(const string& filename, 79 | const OfxTime time, 80 | const string& viewName, 81 | const float* pixelData, 82 | const OfxRectI& bounds, 83 | const float pixelAspectRatio, 84 | const int pixelDataNComps, 85 | const int dstNCompsStartIndex, 86 | const int dstNComps, 87 | const int rowBytes) OVERRIDE FINAL; 88 | virtual bool isImageFile(const string& fileExtension) const OVERRIDE FINAL; 89 | virtual PreMultiplicationEnum getExpectedInputPremultiplication() const OVERRIDE FINAL { return eImageUnPreMultiplied; } 90 | 91 | virtual void onOutputFileChanged(const string& newFile, bool setColorSpace) OVERRIDE FINAL; 92 | 93 | /** 94 | * @brief Does the given filename support alpha channel. 95 | **/ 96 | virtual bool supportsAlpha(const std::string&) const OVERRIDE FINAL { return kSupportsRGBA; } 97 | }; 98 | 99 | WritePFMPlugin::WritePFMPlugin(OfxImageEffectHandle handle, 100 | const vector& extensions) 101 | : GenericWriterPlugin(handle, extensions, kSupportsRGBA, kSupportsRGB, kSupportsXY, kSupportsAlpha) 102 | { 103 | } 104 | 105 | WritePFMPlugin::~WritePFMPlugin() 106 | { 107 | } 108 | 109 | template 110 | static void 111 | copyLine(const PIX* pixelData, 112 | int rowbytes, 113 | int W, 114 | int /*H*/, 115 | int dstNCompsStartIndex, 116 | int C, 117 | int y, 118 | PIX* image) 119 | { 120 | assert(dstC == 3 || dstC == 1); 121 | 122 | const PIX* srcPix = (const PIX*)((char*)pixelData + y * rowbytes); 123 | PIX* dstPix = image; 124 | 125 | for (int x = 0; x < W; ++x) { 126 | if (srcC == 1) { 127 | // alpha/grayscale image 128 | for (int c = 0; c < (std::min)(dstC, 3); ++c) { 129 | dstPix[c] = srcPix[dstNCompsStartIndex]; 130 | } 131 | } else { 132 | // color image (if dstC == 1, only the red channel is extracted) 133 | for (int c = 0; c < (std::min)(dstC, 3); ++c) { 134 | dstPix[c] = srcPix[dstNCompsStartIndex + c]; 135 | } 136 | } 137 | 138 | srcPix += C; 139 | dstPix += dstC; 140 | } 141 | } 142 | 143 | void 144 | WritePFMPlugin::encode(const string& filename, 145 | const OfxTime /*time*/, 146 | const string& /*viewName*/, 147 | const float* pixelData, 148 | const OfxRectI& bounds, 149 | const float /*pixelAspectRatio*/, 150 | const int pixelDataNComps, 151 | const int dstNCompsStartIndex, 152 | const int dstNComps, 153 | const int rowBytes) 154 | { 155 | if ((dstNComps != 4) && (dstNComps != 3) && (dstNComps != 1)) { 156 | setPersistentMessage(Message::eMessageError, "", "PFM: can only write RGBA, RGB or Alpha components images"); 157 | throwSuiteStatusException(kOfxStatErrFormat); 158 | 159 | return; 160 | } 161 | 162 | // If the file exists (which means "overwrite" was checked), remove it first. 163 | // See https://github.com/NatronGitHub/Natron/issues/666 164 | if (OFX::exists_utf8(filename.c_str())) { 165 | OFX::remove_utf8(filename.c_str()); 166 | } 167 | 168 | std::FILE* const nfile = fopen_utf8(filename.c_str(), "wb"); 169 | if (!nfile) { 170 | setPersistentMessage(Message::eMessageError, "", "Cannot open file \"" + filename + "\""); 171 | throwSuiteStatusException(kOfxStatFailed); 172 | 173 | return; 174 | } 175 | int width = (bounds.x2 - bounds.x1); 176 | int height = (bounds.y2 - bounds.y1); 177 | const int depth = (dstNComps == 1 ? 1 : 3); 178 | const unsigned int buf_size = width * depth; 179 | vector buffer(buf_size); 180 | std::fill(buffer.begin(), buffer.end(), 0.); 181 | 182 | std::fprintf(nfile, "P%c\n%u %u\n%d.0\n", (dstNComps == 1 ? 'f' : 'F'), width, height, endianness() ? 1 : -1); 183 | 184 | for (int y = 0; y < height; ++y) { 185 | // now copy to the dstImg 186 | if (depth == 1) { 187 | assert(dstNComps == 1); 188 | copyLine(pixelData, rowBytes, width, height, dstNCompsStartIndex, pixelDataNComps, y, &buffer.front()); 189 | } else if (depth == 3) { 190 | assert(dstNComps == 3 || dstNComps == 4); 191 | if (dstNComps == 3) { 192 | copyLine(pixelData, rowBytes, width, height, dstNCompsStartIndex, pixelDataNComps, y, &buffer.front()); 193 | } else if (dstNComps == 4) { 194 | copyLine(pixelData, rowBytes, width, height, dstNCompsStartIndex, pixelDataNComps, y, &buffer.front()); 195 | } 196 | } 197 | 198 | std::fwrite(&buffer.front(), sizeof(float), buf_size, nfile); 199 | } 200 | std::fclose(nfile); 201 | } 202 | 203 | bool 204 | WritePFMPlugin::isImageFile(const string& /*fileExtension*/) const 205 | { 206 | return true; 207 | } 208 | 209 | void 210 | WritePFMPlugin::onOutputFileChanged(const string& /*filename*/, 211 | bool setColorSpace) 212 | { 213 | if (setColorSpace) { 214 | #ifdef OFX_IO_USING_OCIO 215 | // Unless otherwise specified, pfm files are assumed to be linear. 216 | _ocio->setOutputColorspace(OCIO::ROLE_SCENE_LINEAR); 217 | #endif 218 | } 219 | } 220 | 221 | mDeclareWriterPluginFactory(WritePFMPluginFactory, {}, false); 222 | void 223 | WritePFMPluginFactory::load() 224 | { 225 | _extensions.clear(); 226 | _extensions.push_back("pfm"); 227 | } 228 | 229 | /** @brief The basic describe function, passed a plugin descriptor */ 230 | void 231 | WritePFMPluginFactory::describe(ImageEffectDescriptor& desc) 232 | { 233 | GenericWriterDescribe(desc, eRenderFullySafe, _extensions, kPluginEvaluation, false, false); 234 | // basic labels 235 | desc.setLabel(kPluginName); 236 | desc.setPluginDescription(kPluginDescription); 237 | } 238 | 239 | /** @brief The describe in context function, passed a plugin descriptor and a context */ 240 | void 241 | WritePFMPluginFactory::describeInContext(ImageEffectDescriptor& desc, 242 | ContextEnum context) 243 | { 244 | // make some pages and to things in 245 | PageParamDescriptor* page = GenericWriterDescribeInContextBegin(desc, context, 246 | kSupportsRGBA, 247 | kSupportsRGB, 248 | kSupportsXY, 249 | kSupportsAlpha, 250 | "scene_linear", "scene_linear", false); 251 | 252 | GenericWriterDescribeInContextEnd(desc, context, page); 253 | } 254 | 255 | /** @brief The create instance function, the plugin must return an object derived from the \ref ImageEffect class */ 256 | ImageEffect* 257 | WritePFMPluginFactory::createInstance(OfxImageEffectHandle handle, 258 | ContextEnum /*context*/) 259 | { 260 | WritePFMPlugin* ret = new WritePFMPlugin(handle, _extensions); 261 | 262 | ret->restoreStateFromParams(); 263 | 264 | return ret; 265 | } 266 | 267 | static WritePFMPluginFactory p(kPluginIdentifier, kPluginVersionMajor, kPluginVersionMinor); 268 | mRegisterPluginFactoryInstance(p) 269 | 270 | OFXS_NAMESPACE_ANONYMOUS_EXIT 271 | -------------------------------------------------------------------------------- /PFM/fr.inria.openfx.ReadPFM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/PFM/fr.inria.openfx.ReadPFM.png -------------------------------------------------------------------------------- /PFM/fr.inria.openfx.ReadPFM.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /PFM/fr.inria.openfx.WritePFM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/PFM/fr.inria.openfx.WritePFM.png -------------------------------------------------------------------------------- /PFM/fr.inria.openfx.WritePFM.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /PNG/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | PNG.ofx 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | BNDL 13 | CFBundleSignature 14 | ???? 15 | CFBundleVersion 16 | 0.0.1d1 17 | CSResourcesFileMapped 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /PNG/Makefile: -------------------------------------------------------------------------------- 1 | PLUGINOBJECTS = \ 2 | ReadPNG.o WritePNG.o \ 3 | GenericReader.o GenericWriter.o GenericOCIO.o SequenceParsing.o ofxsMultiPlane.o ofxsFileOpen.o ofxsLut.o 4 | 5 | PLUGINNAME = PNG 6 | 7 | RESOURCES = \ 8 | fr.inria.openfx.ReadPNG.png \ 9 | fr.inria.openfx.ReadPNG.svg \ 10 | fr.inria.openfx.WritePNG.png \ 11 | fr.inria.openfx.WritePNG.svg 12 | 13 | TOP_SRCDIR = .. 14 | include $(TOP_SRCDIR)/Makefile.master 15 | 16 | CXXFLAGS += $(OCIO_CXXFLAGS) $(PNG_CXXFLAGS) 17 | LINKFLAGS += $(OCIO_LINKFLAGS) $(PNG_LINKFLAGS) 18 | -------------------------------------------------------------------------------- /PNG/fr.inria.openfx.ReadPNG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/PNG/fr.inria.openfx.ReadPNG.png -------------------------------------------------------------------------------- /PNG/fr.inria.openfx.ReadPNG.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /PNG/fr.inria.openfx.WritePNG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/PNG/fr.inria.openfx.WritePNG.png -------------------------------------------------------------------------------- /PNG/fr.inria.openfx.WritePNG.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | openfx-io [![GPL2 License](http://img.shields.io/:license-gpl2-blue.svg?style=flat-square)](https://github.com/NatronGitHub/openfx-io/blob/master/LICENSE) [![Open Hub](https://www.openhub.net/p/openfx-io/widgets/project_thin_badge?format=gif&ref=Thin+badge)](https://www.openhub.net/p/openfx-io?ref=Thin+badge) [![Build Status](https://api.travis-ci.org/NatronGitHub/openfx-io.png?branch=master)](https://travis-ci.org/NatronGitHub/openfx-io) [![Build status](https://ci.appveyor.com/api/projects/status/rnc35ji6mcwvpbip?svg=true)](https://ci.appveyor.com/project/NatronGitHub/openfx-io) 2 | ========= 3 | 4 | A set of Readers/Writers plugins written using the OpenFX standard. 5 | 6 | License 7 | ------- 8 | 9 | 10 | Copyright (C) 2013-2018 INRIA 11 | 12 | openfx-io is free software: you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation; either version 2 of the License, or 15 | (at your option) any later version. 16 | 17 | openfx-io is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with openfx-io. If not, see 24 | 25 | 26 | ## Getting the sources from github 27 | 28 | To fetch the latest sources from github, execute the following commands: 29 | 30 | git clone https://github.com/NatronGitHub/openfx-io.git 31 | cd openfx-io 32 | git submodule update -i --recursive 33 | 34 | In order to get a specific tag, corresponding to a source release, do `git tag -l` 35 | to get the list of tags, and then `git checkout tags/` 36 | to checkout a given tag. 37 | 38 | ## Compiling (Unix/Linux/FreeBSD/OS X, using Makefiles) 39 | 40 | On Unix-like systems, the plugins can be compiled by typing in a 41 | terminal: 42 | - `make [options]` to compile as a single combined plugin (see below 43 | for valid options). 44 | - `make nomulti [options]` to compile as separate plugins (useful if 45 | only a few plugins are is needed, for example). `make` can also be 46 | executed in any plugin's directory. 47 | 48 | The most common options are `CONFIG=release` to compile a release 49 | version, `CONFIG=debug` to compile a debug version. Or 50 | `CONFIG=relwithdebinfo` to compile an optimized version with debugging 51 | symbols. 52 | 53 | Another common option is `BITS=32`for compiling a 32-bits version, 54 | `BITS=64` for a 64-bits version, and `BITS=Universal` for a universal 55 | binary (OS X only). 56 | 57 | See the file `Makefile.master`in the toplevel directory for other useful 58 | flags/variables. 59 | 60 | The compiled plugins are placed in subdirectories named after the 61 | configuration, for example Linux-64-realease for a 64-bits Linux 62 | compilation. In each of these directories, a `*.bundle` directory is 63 | created, which has to be moved to the proper place 64 | (`/usr/OFX/Plugins`on Linux, or `/Library/OFX/Plugins`on OS X), using 65 | a command like the following, with the *same* options used for 66 | compiling: 67 | 68 | sudo make install [options] 69 | 70 | ## Compiling on Ubuntu 12.04 LTS 71 | 72 | ### OpenColorIO 73 | 74 | sudo apt-get install cmake libtinyxml-dev liblcms2-dev libyaml-cpp-dev libboost-dev 75 | git clone -b "v1.0.8" https://github.com/imageworks/OpenColorIO.git ocio 76 | cd ocio 77 | mkdir _build 78 | cd _build 79 | cmake .. -DCMAKE_INSTALL_PREFIX=/opt/ocio -DCMAKE_BUILD_TYPE=Release -DOCIO_BUILD_JNIGLUE=OFF -DOCIO_BUILD_NUKE=OFF -DOCIO_BUILD_SHARED=ON -DOCIO_BUILD_STATIC=OFF -DOCIO_STATIC_JNIGLUE=OFF -DOCIO_BUILD_TRUELIGHT=OFF -DUSE_EXTERNAL_LCMS=ON -DUSE_EXTERNAL_TINYXML=ON -DUSE_EXTERNAL_YAML=ON -DOCIO_BUILD_APPS=OFF -DOCIO_USE_BOOST_PTR=ON -DOCIO_BUILD_TESTS=OFF -DOCIO_BUILD_PYGLUE=OFF 80 | make && sudo make install 81 | cd ../.. 82 | 83 | ### OpenEXR 84 | 85 | sudo apt-get install libopenexr-dev libilmbase-dev 86 | 87 | ### OpenImageIO (for some reason, freetype is not recognized) 88 | 89 | sudo apt-get install libopenjpeg-dev libtiff-dev libjpeg-dev libpng-dev libboost-filesystem-dev libboost-regex-dev libboost-thread-dev libboost-system-dev libwebp-dev libfreetype6-dev libssl-dev 90 | git clone -b "RB-1.2" git://github.com/OpenImageIO/oiio.git oiio 91 | cd oiio 92 | make USE_QT=0 USE_TBB=0 USE_PYTHON=0 USE_FIELD3D=0 USE_OPENJPEG=1 USE_OCIO=1 OIIO_BUILD_TESTS=0 OIIO_BUILD_TOOLS=0 OCIO_HOME=/opt/ocio INSTALLDIR=/opt/oiio dist_dir=. cmake 93 | sudo make dist_dir=. 94 | cd .. 95 | ### FFmpeg 96 | 97 | sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libavutil-dev 98 | 99 | ### Finally 100 | 101 | env PKG_CONFIG_PATH=/opt/oiio/lib/pkgconfig make CONFIG=release 102 | 103 | ## Compiling on OS X with macports 104 | 105 | Download and install the MacPorts installer that corresponds to your Mac OS X version. 106 | Download the local portfiles archive on the bottom of [that](http://devernay.free.fr/hacks/openfx/) 107 | page, named TuttleOFX-OSX-macports.tar.gz . 108 | Uncompress the portfiles in a directory of your choice. In the following, we suppose you 109 | uncompressed it in /Users/USER_NAME/Development/dports-dev, but it can be anywhere 110 | except in the Documents directory, which has special permissions. 111 | 112 | Give read/execute permissions to the local repository: 113 | 114 | chmod 755 /Users/USER_NAME/Development/dports-dev 115 | 116 | Check that the user `nobody` can read this directory by typing the following command in a Terminal: 117 | 118 | sudo -u nobody ls /Users/USER_NAME/Development/dports-dev 119 | 120 | If it fails, then try again after having given execution permissions on your home directory 121 | using the following command: 122 | 123 | chmod o+x /Users/USER_NAME 124 | 125 | If this still fails, then something is really wrong. 126 | 127 | Edit the `sources.conf` file for MacPorts, for example using the nano editor: 128 | 129 | sudo nano /opt/local/etc/macports/sources.conf 130 | 131 | insert at the beginning of the file the configuration for a local repository 132 | (read the comments in the file), by inserting the line 133 | 134 | file:///Users/USER_NAME/Development/dports-dev 135 | 136 | Save and exit (if you're using nano, this means typing ctrl-X, Y and return). 137 | 138 | Update MacPorts: 139 | 140 | sudo port selfupdate 141 | 142 | Recreate the index in the local repository: 143 | 144 | cd /Users/USER_NAME/Development/dports-dev; portindex 145 | 146 | (no need to be root for this) 147 | 148 | Add the following line to `/opt/local/etc/macports/variants.conf`: 149 | 150 | -x11 +no_x11 +bash_completion +no_gnome +quartz 151 | 152 | (add +universal on OSX 10.5 and 10.6) 153 | 154 | * special portfiles: 155 | - graphics/openimageio 156 | - graphics/opencolorio 157 | 158 | * external libraries 159 | 160 | sudo port -v install openexr ffmpeg opencolorio openimageio 161 | 162 | Then to compile... 163 | 164 | env PKG_CONFIG_PATH=/opt/local/lib/pkgconfig make CONFIG=release OCIO_HOME=/opt/local 165 | 166 | where /opt/local is where the macports tree stores the includes and libs. 167 | 168 | ## Using Xcode on OSX 169 | 170 | In order to use the provided Xcode project file, you should add the 171 | following definitions in the Xcode preferences 172 | (Preferences/Locations/Source trees in Xcode 6): 173 | - EXR_PATH: path to OpenEXR installation prefix (e.g. /usr/local or /opt/local) 174 | - FFMPEG_PATH: path to FFmpeg installation prefix (e.g. /usr/local or /opt/local) 175 | - OCIO_PATH: path to OpenColorIO installation prefix (e.g. /usr/local or /opt/local) 176 | - OIIO_PATH: path to OpenImageIO installation prefix (e.g. /usr/local or /opt/local) 177 | - SEEXPR_PATH: path to SeExpr installation prefix (e.g. /usr/local or /opt/local) 178 | 179 | ## Compiling on MS Windows 180 | 181 | We provide pre-compiled static binaries for dependencies here: [3rdparty_windows_32_and_64bits_msvc2010.zip](https://www.dropbox.com/s/s5yuh9k3kum99jp/3rdparty_windows_32_and_64bits_msvc2010.zip) 182 | 183 | On the other hand if you want to compile them yourself, you can do so : 184 | 185 | ### OpenColorIO 186 | 187 | Clone the repository from github: 188 | 189 | git clone https://github.com/imageworks/OpenColorIO 190 | 191 | See [Compiling-OpenColorIO-static-on-Windows](https://github.com/MrKepzie/Natron/wiki/Compiling-OpenColorIO-static-on-Windows) 192 | 193 | ### OpenEXR 194 | 195 | Clone the repository from github: 196 | 197 | git clone https://github.com/openexr/openexr 198 | 199 | And follow the install instruction in IlmBase/README.win32 200 | 201 | ### OpenImageIO 202 | 203 | Clone the repository from github: 204 | 205 | git clone https://github.com/OpenImageIO/oiio 206 | 207 | Follow the instructions in the INSTALL file of the source distribution. 208 | When compiling to use the pre-compiled binaries of OpenEXR provided as the version is too 209 | old to successfully build OpenImageIO. Instead use the version you just compiled before 210 | and change the include/lib paths in the visual studio project. 211 | 212 | ### FFmpeg 213 | 214 | I can only advice you download the pre-built binaries from [Zeranoe](http://ffmpeg.zeranoe.com/builds/). 215 | You will need to download the Shared to have the dlls and the Dev to have the .lib files allowing you to link with the dlls. 216 | Note that on this website you can only get shared versions of the ffmpeg libraries. Only version 4.0 and onwards are supported. 217 | 218 | ### Boost 219 | 220 | You can download pre-built binaries for your visual studio version from [teeks99](http://boost.teeks99.com/) 221 | 222 | 223 | ### Note about the external libraries 224 | 225 | Please note that all libraries should be compiled as static libraries for the simplicity of the IO.ofx deployment. 226 | You should have all libraries as static EXCEPT ffmpeg. We will discuss at the end of the README how to deploy so the 227 | library loader can find the shared libraries at run time. 228 | 229 | ### Compile IO.sln 230 | 231 | There's a solution file in the repository whose purpose is to help building openfx-io on Windows. 232 | Note that you might have to make a few changes to the Configuration properties of the project so it can compile on your machine. 233 | You will need to change all the hardcoded path in the Additional Include directories to the ones on your machine. 234 | You will have to do the same with Additional Dependencies in the linker options. 235 | 236 | Also, some preprocessor definitions are mandatory, most notably: 237 | 238 | OFX_IO_USING_OCIO 239 | OFX_IO_USING_LIBRAW 240 | OFX_EXTENSIONS_VEGAS 241 | OFX_EXTENSIONS_TUTTLE 242 | OFX_EXTENSIONS_NUKE 243 | OFX_IO_MT_FFMPEG 244 | OpenColorIO_STATIC 245 | _WINDOWS 246 | WIN64 (if you're doing a x64 build) 247 | NOMINMAX 248 | 249 | Also note that you'll have to set the runtime library (in the Code Generation tab) to Multi-threaded (/MT). 250 | 251 | 252 | Once you compile successfully and you have your bundle, locate the IO.ofx file. 253 | We assume from now on that the only shared libraries you linked with was ffmpeg (i.e: avcodec.lib, avformat.lib avutil.lib and swscale.lib). 254 | Make a new file called INRIA.IO.manifest right next to IO.ofx in the bundle (i.e: at this location: IO.ofx.bundle/Content/Win64/INRIA.IO.manifest). 255 | In this file copy the following lines: 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | Now open the command line tool and navigate to `IO.ofx.bundle/Content/Win64/` 273 | Execute the following command: 274 | 275 | mt -manifest INRIA.IO.manifest -outputresource:IO.ofx;2 276 | 277 | This will embed the manifest into the `.ofx` file so it can now find at runtime the shared dependencies (i.e: the ffmpeg Dlls). 278 | 279 | 280 | 281 | 282 | -------------------------------------------------------------------------------- /RunScript/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | RunScript.ofx 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | BNDL 13 | CFBundleSignature 14 | ???? 15 | CFBundleVersion 16 | 0.0.1d1 17 | CSResourcesFileMapped 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /RunScript/Makefile: -------------------------------------------------------------------------------- 1 | PLUGINOBJECTS = ofxsThreadSuite.o tinythread.o RunScript.o 2 | PLUGINNAME = RunScript 3 | RESOURCES = fr.inria.openfx.RunScript.png fr.inria.openfx.RunScript.svg 4 | 5 | TOP_SRCDIR = .. 6 | include $(TOP_SRCDIR)/Makefile.master 7 | 8 | -------------------------------------------------------------------------------- /RunScript/RunScript.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * This file is part of openfx-io , 3 | * (C) 2018-2021 The Natron Developers 4 | * (C) 2013-2018 INRIA 5 | * 6 | * openfx-io is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * openfx-io is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with openfx-io. If not, see 18 | * ***** END LICENSE BLOCK ***** */ 19 | 20 | /* 21 | * OFX RunScript plugin. 22 | * Run a shell script. 23 | */ 24 | 25 | #ifndef IO_RunScript_h 26 | #define IO_RunScript_h 27 | 28 | #include "ofxsImageEffect.h" 29 | 30 | void getRunScriptPluginID(OFX::PluginFactoryArray& ids); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /RunScript/fr.inria.openfx.RunScript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/RunScript/fr.inria.openfx.RunScript.png -------------------------------------------------------------------------------- /RunScript/fr.inria.openfx.RunScript.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /SeExpr/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | SeExpr.ofx 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | BNDL 13 | CFBundleSignature 14 | ???? 15 | CFBundleVersion 16 | 0.0.1d1 17 | CSResourcesFileMapped 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /SeExpr/Makefile: -------------------------------------------------------------------------------- 1 | PLUGINOBJECTS = ofxsThreadSuite.o tinythread.o \ 2 | ofxsGenerator.o ofxsRectangleInteract.o ofxsRamp.o ofxsTransformInteract.o \ 3 | ofxsOGLTextRenderer.o ofxsOGLFontData.o \ 4 | SeExpr.o SeNoise.o SeGrain.o \ 5 | 6 | PLUGINNAME = SeExpr 7 | RESOURCES = fr.inria.openfx.SeExpr.png fr.inria.openfx.SeExpr.svg fr.inria.openfx.SeExprSimple.png fr.inria.openfx.SeExprSimple.svg 8 | 9 | TOP_SRCDIR = .. 10 | include $(TOP_SRCDIR)/Makefile.master 11 | 12 | CXXFLAGS += $(SEEXPR_CXXFLAGS) 13 | LINKFLAGS += $(SEEXPR_LINKFLAGS) 14 | -------------------------------------------------------------------------------- /SeExpr/fr.inria.openfx.SeExpr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/SeExpr/fr.inria.openfx.SeExpr.png -------------------------------------------------------------------------------- /SeExpr/fr.inria.openfx.SeExpr.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SeExpr/fr.inria.openfx.SeExprSimple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NatronGitHub/openfx-io/31ebb488d0b4aec52e92ec94cdc30da277091d30/SeExpr/fr.inria.openfx.SeExprSimple.png -------------------------------------------------------------------------------- /SeExpr/fr.inria.openfx.SeExprSimple.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /cmake/Modules/FindFFmpeg.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil) 2 | # Once done this will define 3 | # 4 | # FFmpeg_FOUND - system has ffmpeg or libav 5 | # FFMPEG_INCLUDE_DIR - the ffmpeg include directory 6 | # FFMPEG_LIBRARIES - Link these to use ffmpeg 7 | # FFMPEG_LIBAVCODEC 8 | # FFMPEG_LIBAVFORMAT 9 | # FFMPEG_LIBAVUTIL 10 | # 11 | # Original: 12 | # Copyright (c) 2008 Andreas Schneider 13 | # Modified for other libraries by Lasse Kärkkäinen 14 | # Modified for Hedgewars by Stepik777 15 | # Redistribution and use is allowed according to the terms of the New 16 | # BSD license. 17 | # 18 | # Modifications: 19 | # Copyright 2008-present Contributors to the OpenImageIO project. 20 | # SPDX-License-Identifier: BSD-3-Clause 21 | # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md 22 | 23 | if (FFMPEG_INCLUDES AND FFMPEG_LIBRARIES) 24 | set (FFmpeg_FOUND TRUE) 25 | else () 26 | 27 | # use pkg-config to get the directories and then use these values 28 | # in the FIND_PATH() and FIND_LIBRARY() calls 29 | find_package(PkgConfig) 30 | if (PKG_CONFIG_FOUND) 31 | pkg_check_modules(_FFMPEG_AVCODEC QUIET libavcodec) 32 | pkg_check_modules(_FFMPEG_AVFORMAT QUIET libavformat) 33 | pkg_check_modules(_FFMPEG_AVUTIL QUIET libavutil) 34 | pkg_check_modules(_FFMPEG_SWSCALE QUIET libswscale) 35 | endif (PKG_CONFIG_FOUND) 36 | 37 | find_path(FFMPEG_AVCODEC_INCLUDE_DIR 38 | NAMES libavcodec/version.h 39 | HINTS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} 40 | PATH_SUFFIXES ffmpeg libav 41 | ) 42 | 43 | find_library(FFMPEG_LIBAVCODEC 44 | NAMES avcodec 45 | HINTS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} ) 46 | 47 | find_library(FFMPEG_LIBAVFORMAT 48 | NAMES avformat 49 | HINTS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} ) 50 | 51 | find_library(FFMPEG_LIBAVUTIL 52 | NAMES avutil 53 | HINTS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} ) 54 | 55 | find_library(FFMPEG_LIBSWSCALE 56 | NAMES swscale 57 | HINTS ${_FFMPEG_SWSCALE_LIBRARY_DIRS} ) 58 | 59 | include (FindPackageHandleStandardArgs) 60 | find_package_handle_standard_args (FFmpeg 61 | REQUIRED_VARS FFMPEG_LIBAVCODEC 62 | FFMPEG_LIBAVFORMAT 63 | FFMPEG_AVCODEC_INCLUDE_DIR 64 | ) 65 | 66 | if (FFmpeg_FOUND) 67 | set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR}) 68 | set(FFMPEG_INCLUDES ${FFMPEG_AVCODEC_INCLUDE_DIR}) 69 | set(FFMPEG_LIBRARIES 70 | ${FFMPEG_LIBAVCODEC} 71 | ${FFMPEG_LIBAVFORMAT} 72 | ${FFMPEG_LIBAVUTIL} 73 | ${FFMPEG_LIBSWSCALE} 74 | ) 75 | endif () 76 | 77 | endif () 78 | 79 | mark_as_advanced ( 80 | FFMPEG_INCLUDES FFMPEG_LIBRARIES 81 | ) 82 | -------------------------------------------------------------------------------- /cmake/Modules/FindLibRaw.cmake: -------------------------------------------------------------------------------- 1 | # - Find LibRaw 2 | # Find the LibRaw library 3 | # This module defines 4 | # LibRaw_VERSION_STRING, the version string of LibRaw 5 | # LibRaw_INCLUDE_DIR, where to find libraw.h 6 | # LibRaw_LIBRARIES, the libraries needed to use LibRaw (non-thread-safe) 7 | # LibRaw_r_LIBRARIES, the libraries needed to use LibRaw (thread-safe) 8 | # LibRaw_DEFINITIONS, the definitions needed to use LibRaw (non-thread-safe) 9 | # LibRaw_r_DEFINITIONS, the definitions needed to use LibRaw (thread-safe) 10 | # 11 | # Copyright (c) 2013, Pino Toscano 12 | # Copyright (c) 2013, Gilles Caulier 13 | # 14 | # Redistribution and use is allowed according to the terms of the BSD license. 15 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 16 | 17 | find_package(PkgConfig) 18 | 19 | if(PKG_CONFIG_FOUND AND NOT LibRaw_ROOT AND NOT $ENV{LibRaw_ROOT}) 20 | PKG_CHECK_MODULES(PC_LIBRAW QUIET libraw) 21 | SET(LibRaw_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER}) 22 | 23 | PKG_CHECK_MODULES(PC_LIBRAW_R QUIET libraw_r) 24 | SET(LibRaw_r_DEFINITIONS ${PC_LIBRAW_R_CFLAGS_OTHER}) 25 | endif() 26 | 27 | find_path(LibRaw_INCLUDE_DIR libraw/libraw.h 28 | HINTS 29 | ${LIBRAW_INCLUDEDIR_HINT} 30 | ${PC_LIBRAW_INCLUDEDIR} 31 | ${PC_LibRaw_INCLUDE_DIRS} 32 | PATH_SUFFIXES libraw 33 | ) 34 | find_library(LibRaw_LIBRARIES NAMES raw libraw 35 | HINTS 36 | ${LIBRAW_LIBDIR_HINT} 37 | ${PC_LIBRAW_LIBDIR} 38 | ${PC_LIBRAW_LIBRARY_DIRS} 39 | ) 40 | 41 | find_library(LibRaw_r_LIBRARIES NAMES raw_r 42 | HINTS 43 | ${LIBRAW_LIBDIR_HINT} 44 | ${PC_LIBRAW_R_LIBDIR} 45 | ${PC_LIBRAW_R_LIBRARY_DIRS} 46 | ) 47 | 48 | if(WIN32) 49 | SET( LibRaw_r_LIBRARIES ${LibRaw_LIBRARIES} ) 50 | endif() 51 | 52 | if(LibRaw_INCLUDE_DIR) 53 | FILE(READ ${LibRaw_INCLUDE_DIR}/libraw/libraw_version.h _libraw_version_content) 54 | 55 | STRING(REGEX MATCH "#define LIBRAW_MAJOR_VERSION[ \t]*([0-9]*)\n" _version_major_match ${_libraw_version_content}) 56 | SET(_libraw_version_major "${CMAKE_MATCH_1}") 57 | 58 | STRING(REGEX MATCH "#define LIBRAW_MINOR_VERSION[ \t]*([0-9]*)\n" _version_minor_match ${_libraw_version_content}) 59 | SET(_libraw_version_minor "${CMAKE_MATCH_1}") 60 | 61 | STRING(REGEX MATCH "#define LIBRAW_PATCH_VERSION[ \t]*([0-9]*)\n" _version_patch_match ${_libraw_version_content}) 62 | SET(_libraw_version_patch "${CMAKE_MATCH_1}") 63 | 64 | if(_version_major_match AND _version_minor_match AND _version_patch_match) 65 | SET(LibRaw_VERSION_STRING "${_libraw_version_major}.${_libraw_version_minor}.${_libraw_version_patch}") 66 | else() 67 | if(NOT LibRaw_FIND_QUIETLY) 68 | MESSAGE(STATUS "Failed to get version information from ${LibRaw_INCLUDE_DIR}/libraw/libraw_version.h") 69 | endif() 70 | endif() 71 | endif() 72 | 73 | include(FindPackageHandleStandardArgs) 74 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibRaw 75 | REQUIRED_VARS LibRaw_LIBRARIES LibRaw_r_LIBRARIES LibRaw_INCLUDE_DIR 76 | VERSION_VAR LibRaw_VERSION_STRING 77 | ) 78 | 79 | MARK_AS_ADVANCED(LibRaw_VERSION_STRING 80 | LibRaw_INCLUDE_DIR 81 | LibRaw_LIBRARIES 82 | LibRaw_r_LIBRARIES 83 | LibRaw_DEFINITIONS 84 | LibRaw_r_DEFINITIONS 85 | ) 86 | 87 | if (LINKSTATIC) 88 | # Necessary? 89 | find_package (Jasper) 90 | if (JASPER_FOUND) 91 | set (LibRaw_r_LIBRARIES ${LibRaw_r_LIBRARIES} ${JASPER_LIBRARIES}) 92 | endif() 93 | find_library (LCMS2_LIBRARIES NAMES lcms2) 94 | if (LCMS2_LIBRARIES) 95 | set (LibRaw_r_LIBRARIES ${LibRaw_r_LIBRARIES} ${LCMS2_LIBRARIES}) 96 | endif() 97 | if (MSVC) 98 | set (LibRaw_r_DEFINITIONS ${LibRaw_r_DEFINITIONS} -DLIBRAW_NODLL) 99 | set (LibRaw_DEFINITIONS ${LibRaw_DEFINITIONS} -DLIBRAW_NODLL) 100 | endif() 101 | endif () 102 | -------------------------------------------------------------------------------- /cmake/Modules/FindOpenColorIO.cmake: -------------------------------------------------------------------------------- 1 | # Module to find OpenColorIO 2 | # 3 | # This module will first look into the directories hinted by the variables: 4 | # - OpenColorIO_ROOT, OPENCOLORIO_INCLUDE_PATH, OPENCOLORIO_LIBRARY_PATH 5 | # 6 | # This module defines the following variables: 7 | # 8 | # OPENCOLORIO_FOUND - True if OpenColorIO was found. 9 | # OPENCOLORIO_INCLUDES - where to find OpenColorIO.h 10 | # OPENCOLORIO_LIBRARIES - list of libraries to link against when using OpenColorIO 11 | # OPENCOLORIO_DEFINITIONS - Definitions needed when using OpenColorIO 12 | 13 | include (FindPackageHandleStandardArgs) 14 | include (FindPackageMessage) 15 | 16 | find_path (OPENCOLORIO_INCLUDE_DIR 17 | OpenColorIO/OpenColorIO.h 18 | HINTS 19 | ${OPENCOLORIO_INCLUDE_PATH} 20 | ENV OPENCOLORIO_INCLUDE_PATH 21 | PATHS 22 | /sw/include 23 | /opt/local/include 24 | DOC "The directory where OpenColorIO/OpenColorIO.h resides") 25 | 26 | find_library (OPENCOLORIO_LIBRARY 27 | NAMES OCIO OpenColorIO 28 | HINTS 29 | ${OPENCOLORIO_LIBRARY_PATH} 30 | ENV OPENCOLORIO_LIBRARY_PATH 31 | PATHS 32 | /usr/lib64 33 | /usr/local/lib64 34 | /sw/lib 35 | /opt/local/lib 36 | DOC "The OCIO library") 37 | 38 | if (EXISTS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h") 39 | # Search twice, because this symbol changed between OCIO 1.x and 2.x 40 | file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" TMP 41 | REGEX "^#define OCIO_VERSION_STR[ \t].*$") 42 | if (NOT TMP) 43 | file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" TMP 44 | REGEX "^#define OCIO_VERSION[ \t].*$") 45 | endif () 46 | string (REGEX MATCHALL "[0-9]+[.0-9]+" OPENCOLORIO_VERSION ${TMP}) 47 | endif () 48 | 49 | find_package_handle_standard_args (OpenColorIO 50 | REQUIRED_VARS OPENCOLORIO_INCLUDE_DIR OPENCOLORIO_LIBRARY 51 | FOUND_VAR OPENCOLORIO_FOUND 52 | VERSION_VAR OPENCOLORIO_VERSION 53 | ) 54 | 55 | if (OPENCOLORIO_FOUND) 56 | set (OPENCOLORIO_INCLUDES ${OPENCOLORIO_INCLUDE_DIR}) 57 | set (OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARY}) 58 | set (OPENCOLORIO_DEFINITIONS "") 59 | if (NOT TARGET OpenColorIO::OpenColorIO) 60 | add_library(OpenColorIO::OpenColorIO UNKNOWN IMPORTED) 61 | set_target_properties(OpenColorIO::OpenColorIO PROPERTIES 62 | INTERFACE_INCLUDE_DIRECTORIES "${OPENCOLORIO_INCLUDES}") 63 | 64 | set_property(TARGET OpenColorIO::OpenColorIO APPEND PROPERTY 65 | IMPORTED_LOCATION "${OPENCOLORIO_LIBRARIES}") 66 | if (LINKSTATIC) 67 | target_compile_definitions(OpenColorIO::OpenColorIO 68 | INTERFACE "-DOpenColorIO_STATIC") 69 | endif() 70 | endif () 71 | endif () 72 | 73 | if (OpenColorIO_FOUND AND LINKSTATIC) 74 | # Is this necessary? 75 | set (OPENCOLORIO_DEFINITIONS "-DOpenColorIO_STATIC") 76 | find_library (TINYXML_LIBRARY NAMES tinyxml) 77 | if (TINYXML_LIBRARY) 78 | set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${TINYXML_LIBRARY}" CACHE STRING "" FORCE) 79 | endif () 80 | find_library (YAML_LIBRARY NAMES yaml-cpp) 81 | if (YAML_LIBRARY) 82 | set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${YAML_LIBRARY}" CACHE STRING "" FORCE) 83 | endif () 84 | find_library (LCMS2_LIBRARY NAMES lcms2) 85 | if (LCMS2_LIBRARY) 86 | set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${LCMS2_LIBRARY}" CACHE STRING "" FORCE) 87 | endif () 88 | endif () 89 | 90 | -------------------------------------------------------------------------------- /cmake/Modules/FindOpenEXR.cmake: -------------------------------------------------------------------------------- 1 | # Module to find OpenEXR and Imath. 2 | # 3 | # I'm afraid this is a mess, due to needing to support a wide range of 4 | # OpenEXR versions. 5 | # 6 | # For OpenEXR & Imath 3.0, this will establish the following imported 7 | # targets: 8 | # 9 | # Imath::Imath 10 | # Imath::Half 11 | # OpenEXR::OpenEXR 12 | # OpenEXR::Iex 13 | # OpenEXR::IlmThread 14 | # 15 | # For OpenEXR 2.4 & 2.5, it will establish the following imported targets: 16 | # 17 | # IlmBase::Imath 18 | # IlmBase::Half 19 | # IlmBase::Iex 20 | # IlmBase::IlmThread 21 | # OpenEXR::IlmImf 22 | # 23 | # For all versions -- but for OpenEXR < 2.4 the only thing this sets -- 24 | # are the following CMake variables: 25 | # 26 | # OPENEXR_FOUND true, if found 27 | # OPENEXR_INCLUDES directory where OpenEXR headers are found 28 | # OPENEXR_LIBRARIES libraries for OpenEXR + IlmBase 29 | # OPENEXR_VERSION OpenEXR version (accurate for >= 2.0.0, 30 | # otherwise will just guess 1.6.1) 31 | # IMATH_INCLUDES directory where Imath headers are found 32 | # ILMBASE_INCLUDES directory where IlmBase headers are found 33 | # ILMBASE_LIBRARIES libraries just IlmBase 34 | # 35 | # 36 | 37 | # First, try to fine just the right config files 38 | find_package(Imath CONFIG) 39 | if (NOT TARGET Imath::Imath) 40 | # Couldn't find Imath::Imath, maybe it's older and has IlmBase? 41 | find_package(IlmBase CONFIG) 42 | endif () 43 | find_package(OpenEXR CONFIG) 44 | 45 | if (TARGET OpenEXR::OpenEXR AND TARGET Imath::Imath) 46 | # OpenEXR 3.x if both of these targets are found 47 | if (NOT OpenEXR_FIND_QUIETLY) 48 | message (STATUS "Found CONFIG for OpenEXR 3 (OPENEXR_VERSION=${OpenEXR_VERSION})") 49 | endif () 50 | 51 | # Mimic old style variables 52 | set (OPENEXR_VERSION ${OpenEXR_VERSION}) 53 | get_target_property(IMATH_INCLUDES Imath::Imath INTERFACE_INCLUDE_DIRECTORIES) 54 | get_target_property(ILMBASE_INCLUDES Imath::Imath INTERFACE_INCLUDE_DIRECTORIES) 55 | get_target_property(ILMBASE_IMATH_LIBRARY Imath::Imath INTERFACE_LINK_LIBRARIES) 56 | get_target_property(IMATH_LIBRARY Imath::Imath INTERFACE_LINK_LIBRARIES) 57 | get_target_property(OPENEXR_IEX_LIBRARY OpenEXR::Iex INTERFACE_LINK_LIBRARIES) 58 | get_target_property(OPENEXR_ILMTHREAD_LIBRARY OpenEXR::IlmThread INTERFACE_LINK_LIBRARIES) 59 | set (ILMBASE_LIBRARIES ${ILMBASE_IMATH_LIBRARY}) 60 | set (ILMBASE_FOUND true) 61 | 62 | get_target_property(OPENEXR_INCLUDES OpenEXR::OpenEXR INTERFACE_INCLUDE_DIRECTORIES) 63 | get_target_property(OPENEXR_ILMIMF_LIBRARY OpenEXR::OpenEXR INTERFACE_LINK_LIBRARIES) 64 | set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ILMBASE_LIBRARIES}) 65 | set (OPENEXR_FOUND true) 66 | 67 | # Link with pthreads if required 68 | find_package (Threads) 69 | if (CMAKE_USE_PTHREADS_INIT) 70 | list (APPEND ILMBASE_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) 71 | endif () 72 | 73 | elseif (TARGET OpenEXR::IlmImf AND TARGET IlmBase::Imath AND OPENEXR_VERSION VERSION_GREATER_EQUAL 2.4) 74 | # OpenEXR 2.4 or 2.5 with exported config 75 | if (NOT OpenEXR_FIND_QUIETLY) 76 | message (STATUS "Found CONFIG for OpenEXR 2 (OPENEXR_VERSION=${OpenEXR_VERSION})") 77 | endif () 78 | 79 | # Mimic old style variables 80 | get_target_property(ILMBASE_INCLUDES IlmBase::IlmBaseConfig INTERFACE_INCLUDE_DIRECTORIES) 81 | get_target_property(IMATH_INCLUDES IlmBase::IlmBaseConfig INTERFACE_INCLUDE_DIRECTORIES) 82 | get_target_property(ILMBASE_Imath_LIBRARY IlmBase::Imath INTERFACE_LINK_LIBRARIES) 83 | get_target_property(ILMBASE_IMATH_LIBRARY IlmBase::Imath INTERFACE_LINK_LIBRARIES) 84 | get_target_property(ILMBASE_HALF_LIBRARY IlmBase::Half INTERFACE_LINK_LIBRARIES) 85 | get_target_property(OPENEXR_IEX_LIBRARY IlmBase::Iex INTERFACE_LINK_LIBRARIES) 86 | get_target_property(OPENEXR_ILMTHREAD_LIBRARY IlmBase::IlmThread INTERFACE_LINK_LIBRARIES) 87 | set (ILMBASE_LIBRARIES ${ILMBASE_IMATH_LIBRARY} ${ILMBASE_HALF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY}) 88 | set (ILMBASE_FOUND true) 89 | 90 | get_target_property(OPENEXR_INCLUDES OpenEXR::IlmImfConfig INTERFACE_INCLUDE_DIRECTORIES) 91 | get_target_property(OPENEXR_ILMIMF_LIBRARY OpenEXR::IlmImf INTERFACE_LINK_LIBRARIES) 92 | set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${ILMBASE_LIBRARIES}) 93 | set (OPENEXR_FOUND true) 94 | 95 | # Link with pthreads if required 96 | find_package (Threads) 97 | if (CMAKE_USE_PTHREADS_INIT) 98 | list (APPEND ILMBASE_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) 99 | endif () 100 | 101 | else () 102 | # OpenEXR 2.x older versions without a config or whose configs we don't 103 | # trust. 104 | 105 | # Other standard issue macros 106 | include (FindPackageHandleStandardArgs) 107 | include (SelectLibraryConfigurations) 108 | 109 | find_package (ZLIB REQUIRED) 110 | 111 | # Link with pthreads if required 112 | find_package (Threads) 113 | if (CMAKE_USE_PTHREADS_INIT) 114 | set (ILMBASE_PTHREADS ${CMAKE_THREAD_LIBS_INIT}) 115 | endif () 116 | 117 | # Attempt to find OpenEXR with pkgconfig 118 | find_package(PkgConfig) 119 | if (PKG_CONFIG_FOUND) 120 | if (NOT Ilmbase_ROOT AND NOT ILMBASE_ROOT 121 | AND NOT DEFINED ENV{Ilmbase_ROOT} AND NOT DEFINED ENV{ILMBASE_ROOT}) 122 | pkg_check_modules(_ILMBASE QUIET IlmBase>=2.0.0) 123 | endif () 124 | if (NOT OpenEXR_ROOT AND NOT OPENEXR_ROOT 125 | AND NOT DEFINED ENV{OpenEXR_ROOT} AND NOT DEFINED ENV{OPENEXR_ROOT}) 126 | pkg_check_modules(_OPENEXR QUIET OpenEXR>=2.0.0) 127 | endif () 128 | endif (PKG_CONFIG_FOUND) 129 | 130 | # List of likely places to find the headers -- note priority override of 131 | # ${OPENEXR_ROOT}/include. 132 | # ILMBASE is needed in case ilmbase an openexr are installed in separate 133 | # directories, like NixOS does 134 | set (GENERIC_INCLUDE_PATHS 135 | ${OPENEXR_ROOT}/include 136 | $ENV{OPENEXR_ROOT}/include 137 | ${ILMBASE_ROOT}/include 138 | $ENV{ILMBASE_ROOT}/include 139 | ${_ILMBASE_INCLUDEDIR} 140 | ${_OPENEXR_INCLUDEDIR} 141 | /usr/local/include 142 | /usr/include 143 | /usr/include/${CMAKE_LIBRARY_ARCHITECTURE} 144 | /sw/include 145 | /opt/local/include ) 146 | 147 | # Find the include file locations. 148 | find_path (ILMBASE_INCLUDE_PATH OpenEXR/IlmBaseConfig.h 149 | HINTS ${ILMBASE_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIR} 150 | ${GENERIC_INCLUDE_PATHS} ) 151 | find_path (OPENEXR_INCLUDE_PATH OpenEXR/OpenEXRConfig.h 152 | HINTS ${OPENEXR_INCLUDE_DIR} 153 | ${GENERIC_INCLUDE_PATHS} ) 154 | 155 | # Try to figure out version number 156 | if (DEFINED _OPENEXR_VERSION AND NOT "${_OPENEXR_VERSION}" STREQUAL "") 157 | set (OPENEXR_VERSION "${_OPENEXR_VERSION}") 158 | string (REGEX REPLACE "([0-9]+)\\.[0-9\\.]+" "\\1" OPENEXR_VERSION_MAJOR "${_OPENEXR_VERSION}") 159 | string (REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" OPENEXR_VERSION_MINOR "${_OPENEXR_VERSION}") 160 | elseif (EXISTS "${OPENEXR_INCLUDE_PATH}/OpenEXR/ImfMultiPartInputFile.h") 161 | # Must be at least 2.0 162 | file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_STRING .*$") 163 | string (REGEX MATCHALL "[0-9]+[.0-9]+" OPENEXR_VERSION ${TMP}) 164 | file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_MAJOR .*$") 165 | string (REGEX MATCHALL "[0-9]+" OPENEXR_VERSION_MAJOR ${TMP}) 166 | file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_MINOR .*$") 167 | string (REGEX MATCHALL "[0-9]+" OPENEXR_VERSION_MINOR ${TMP}) 168 | else () 169 | # Assume an old one, predates 2.x that had versions 170 | set (OPENEXR_VERSION 1.6.1) 171 | set (OPENEXR_MAJOR 1) 172 | set (OPENEXR_MINOR 6) 173 | endif () 174 | 175 | 176 | # List of likely places to find the libraries -- note priority override of 177 | # ${OPENEXR_ROOT}/lib. 178 | set (GENERIC_LIBRARY_PATHS 179 | ${OPENEXR_ROOT}/lib 180 | ${ILMBASE_ROOT}/lib 181 | ${OPENEXR_INCLUDE_PATH}/../lib 182 | ${ILMBASE_INCLUDE_PATH}/../lib 183 | ${_ILMBASE_LIBDIR} 184 | ${_OPENEXR_LIBDIR} 185 | /usr/local/lib 186 | /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} 187 | /usr/lib 188 | /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} 189 | /sw/lib 190 | /opt/local/lib 191 | $ENV{PROGRAM_FILES}/OpenEXR/lib/static ) 192 | 193 | # message (STATUS "Generic lib paths: ${GENERIC_LIBRARY_PATHS}") 194 | 195 | # Handle request for static libs by altering CMAKE_FIND_LIBRARY_SUFFIXES. 196 | # We will restore it at the end of this file. 197 | set (_openexr_orig_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES}) 198 | if (OpenEXR_USE_STATIC_LIBS) 199 | if (WIN32) 200 | set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) 201 | else () 202 | set (CMAKE_FIND_LIBRARY_SUFFIXES .a) 203 | endif () 204 | endif () 205 | 206 | # Look for the libraries themselves, for all the components. 207 | # This is complicated because the OpenEXR libraries may or may not be 208 | # built with version numbers embedded. 209 | set (_openexr_components IlmThread IlmImf Imath Iex Half) 210 | foreach (COMPONENT ${_openexr_components}) 211 | string (TOUPPER ${COMPONENT} UPPERCOMPONENT) 212 | # First try with the version embedded 213 | find_library (OPENEXR_${UPPERCOMPONENT}_LIBRARY 214 | NAMES ${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR} 215 | ${COMPONENT} 216 | ${COMPONENT}-${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}_d 217 | ${COMPONENT}_d 218 | HINTS ${OPENEXR_LIBRARY_DIR} $ENV{OPENEXR_LIBRARY_DIR} 219 | ${GENERIC_LIBRARY_PATHS} ) 220 | endforeach () 221 | 222 | find_package_handle_standard_args (OpenEXR 223 | REQUIRED_VARS ILMBASE_INCLUDE_PATH OPENEXR_INCLUDE_PATH 224 | OPENEXR_IMATH_LIBRARY OPENEXR_ILMIMF_LIBRARY 225 | OPENEXR_IEX_LIBRARY OPENEXR_HALF_LIBRARY 226 | ) 227 | 228 | if (OPENEXR_FOUND) 229 | set (OpenEXR_VERSION ${OPENEXR_VERSION}) 230 | set (ILMBASE_FOUND TRUE) 231 | set (ILMBASE_INCLUDES ${ILMBASE_INCLUDE_PATH}) 232 | set (IMATH_INCLUDES ${ILMBASE_INCLUDE_PATH}) 233 | set (OPENEXR_INCLUDES ${OPENEXR_INCLUDE_PATH}) 234 | set (ILMBASE_INCLUDE_DIR ${ILMBASE_INCLUDE_PATH}) 235 | set (IMATH_INCLUDE_DIR ${ILMBASE_INCLUDE_PATH}) 236 | set (OPENEXR_INCLUDE_DIR ${OPENEXR_INCLUDE_PATH}) 237 | set (ILMBASE_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ILMBASE_PTHREADS} CACHE STRING "The libraries needed to use IlmBase") 238 | set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${ILMBASE_LIBRARIES} ${ZLIB_LIBRARIES} CACHE STRING "The libraries needed to use OpenEXR") 239 | set (FINDOPENEXR_FALLBACK TRUE) 240 | endif () 241 | 242 | mark_as_advanced( 243 | OPENEXR_ILMIMF_LIBRARY 244 | OPENEXR_IMATH_LIBRARY 245 | OPENEXR_IEX_LIBRARY 246 | OPENEXR_HALF_LIBRARY 247 | OPENEXR_VERSION) 248 | 249 | # Restore the original CMAKE_FIND_LIBRARY_SUFFIXES 250 | set (CMAKE_FIND_LIBRARY_SUFFIXES ${_openexr_orig_suffixes}) 251 | 252 | endif () 253 | -------------------------------------------------------------------------------- /cmake/Modules/FindOpenImageIO.cmake: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # OpenImageIO https://www.openimageio.org 3 | # Copyright 2008-present Contributors to the OpenImageIO project. 4 | # SPDX-License-Identifier: BSD-3-Clause 5 | # https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md 6 | # 7 | # For an up-to-date version of this file, see: 8 | # https://github.com/OpenImageIO/oiio/blob/master/src/cmake/Modules/FindOpenImageIO.cmake 9 | # 10 | ########################################################################### 11 | # 12 | # CMake module to find OpenImageIO 13 | # 14 | # This module will set 15 | # OpenImageIO_FOUND True, if found 16 | # OPENIMAGEIO_INCLUDES directory where headers are found 17 | # OPENIMAGEIO_LIBRARIES libraries for OIIO 18 | # OPENIMAGEIO_LIBRARY_DIRS library dirs for OIIO 19 | # OPENIMAGEIO_VERSION Version ("major.minor.patch.tweak") 20 | # OPENIMAGEIO_VERSION_MAJOR Version major number 21 | # OPENIMAGEIO_VERSION_MINOR Version minor number 22 | # OPENIMAGEIO_VERSION_PATCH Version minor patch 23 | # OPENIMAGEIO_VERSION_TWEAK Version minor tweak 24 | # OIIOTOOL_BIN Path to oiiotool executable 25 | # 26 | # Imported targets: 27 | # OpenImageIO::OpenImageIO The libOpenImageIO library. 28 | # OpenImageIO::oiiotool The oiiotool executable. 29 | # 30 | # Special inputs: 31 | # OpenImageIO_ROOT - if using CMake >= 3.12, will automatically search 32 | # this area for OIIO components. 33 | # OPENIMAGEIO_ROOT_DIR - custom "prefix" location of OIIO installation 34 | # (expecting bin, lib, include subdirectories) 35 | # This is deprecated, but will work for a while. 36 | # OpenImageIO_FIND_QUIETLY - if set, print minimal console output 37 | # OIIO_LIBNAME_SUFFIX - if set, optional nonstandard library suffix 38 | # 39 | ########################################################################### 40 | # 41 | # NOTE: This file is deprecated. 42 | # 43 | # In OIIO 2.1+, we generate OpenImageIOConfig.cmake files that are now the 44 | # preferred way for downstream projecs to find an installed OIIO. There 45 | # should be no need to copy this FindOpenImageIO.cmake file into downstream 46 | # projects, *unless* they need to work with a range of OIIO vesions that 47 | # may include <2.1, which would lack the generated config files. 48 | # 49 | ########################################################################### 50 | 51 | 52 | # If 'OPENIMAGE_HOME' not set, use the env variable of that name if available 53 | if (NOT OPENIMAGEIO_ROOT_DIR AND NOT $ENV{OPENIMAGEIO_ROOT_DIR} STREQUAL "") 54 | set (OPENIMAGEIO_ROOT_DIR $ENV{OPENIMAGEIO_ROOT_DIR}) 55 | endif () 56 | 57 | 58 | find_library ( OPENIMAGEIO_LIBRARY 59 | NAMES OpenImageIO${OIIO_LIBNAME_SUFFIX} 60 | HINTS ${OPENIMAGEIO_ROOT_DIR} 61 | PATH_SUFFIXES lib64 lib ) 62 | find_path ( OPENIMAGEIO_INCLUDE_DIR 63 | NAMES OpenImageIO/imageio.h 64 | HINTS ${OPENIMAGEIO_ROOT_DIR} ) 65 | find_program ( OIIOTOOL_BIN 66 | NAMES oiiotool 67 | HINTS ${OPENIMAGEIO_ROOT_DIR} ) 68 | 69 | # Try to figure out version number 70 | set (OIIO_VERSION_HEADER "${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO/oiioversion.h") 71 | if (EXISTS "${OIIO_VERSION_HEADER}") 72 | file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_MAJOR .*$") 73 | string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_MAJOR ${TMP}) 74 | file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_MINOR .*$") 75 | string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_MINOR ${TMP}) 76 | file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_PATCH .*$") 77 | string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_PATCH ${TMP}) 78 | file (STRINGS "${OIIO_VERSION_HEADER}" TMP REGEX "^#define OIIO_VERSION_TWEAK .*$") 79 | if (TMP) 80 | string (REGEX MATCHALL "[0-9]+" OPENIMAGEIO_VERSION_TWEAK ${TMP}) 81 | else () 82 | set (OPENIMAGEIO_VERSION_TWEAK 0) 83 | endif () 84 | set (OPENIMAGEIO_VERSION "${OPENIMAGEIO_VERSION_MAJOR}.${OPENIMAGEIO_VERSION_MINOR}.${OPENIMAGEIO_VERSION_PATCH}.${OPENIMAGEIO_VERSION_TWEAK}") 85 | endif () 86 | 87 | 88 | include (FindPackageHandleStandardArgs) 89 | find_package_handle_standard_args (OpenImageIO 90 | FOUND_VAR OpenImageIO_FOUND 91 | REQUIRED_VARS OPENIMAGEIO_INCLUDE_DIR OPENIMAGEIO_LIBRARY 92 | OPENIMAGEIO_VERSION 93 | VERSION_VAR OPENIMAGEIO_VERSION 94 | ) 95 | set (OPENIMAGEIO_FOUND ${OpenImageIO_FOUND}) # Old name 96 | 97 | if (OpenImageIO_FOUND) 98 | set (OPENIMAGEIO_INCLUDES ${OPENIMAGEIO_INCLUDE_DIR}) 99 | set (OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY}) 100 | get_filename_component (OPENIMAGEIO_LIBRARY_DIRS "${OPENIMAGEIO_LIBRARY}" DIRECTORY) 101 | if (NOT OpenImageIO_FIND_QUIETLY) 102 | message ( STATUS "OpenImageIO includes = ${OPENIMAGEIO_INCLUDE_DIR}" ) 103 | message ( STATUS "OpenImageIO libraries = ${OPENIMAGEIO_LIBRARIES}" ) 104 | message ( STATUS "OpenImageIO library_dirs = ${OPENIMAGEIO_LIBRARY_DIRS}" ) 105 | message ( STATUS "OpenImageIO oiiotool = ${OIIOTOOL_BIN}" ) 106 | endif () 107 | 108 | if (NOT TARGET OpenImageIO::OpenImageIO) 109 | add_library(OpenImageIO::OpenImageIO UNKNOWN IMPORTED) 110 | set_target_properties(OpenImageIO::OpenImageIO PROPERTIES 111 | INTERFACE_INCLUDE_DIRECTORIES "${OPENIMAGEIO_INCLUDES}") 112 | 113 | set_property(TARGET OpenImageIO::OpenImageIO APPEND PROPERTY 114 | IMPORTED_LOCATION "${OPENIMAGEIO_LIBRARIES}") 115 | endif () 116 | 117 | if (NOT TARGET OpenImageIO::oiiotool AND EXISTS "${OIIOTOOL_BIN}") 118 | add_executable(OpenImageIO::oiiotool IMPORTED) 119 | set_target_properties(OpenImageIO::oiiotool PROPERTIES 120 | IMPORTED_LOCATION "${OIIOTOOL_BIN}") 121 | endif () 122 | endif () 123 | 124 | mark_as_advanced ( 125 | OPENIMAGEIO_INCLUDE_DIR 126 | OPENIMAGEIO_LIBRARY 127 | ) 128 | -------------------------------------------------------------------------------- /cmake/Modules/FindSeExpr2.cmake: -------------------------------------------------------------------------------- 1 | include(GNUInstallDirs) 2 | 3 | find_library( 4 | SEEXPR2_LIBRARY 5 | NAMES SeExpr) 6 | 7 | find_path(SEEXPR2_INCLUDE_DIR 8 | NAMES SeExpression.h 9 | HINTS ${CMAKE_INSTALL_INCLUDEDIR} /usr/local/include) 10 | 11 | include(FindPackageHandleStandardArgs) 12 | 13 | find_package_handle_standard_args(SeExpr2 DEFAULT_MSG 14 | SEEXPR2_LIBRARY 15 | SEEXPR2_INCLUDE_DIR) 16 | 17 | mark_as_advanced(SEEXPR2_LIBRARY SEEXPR2_INCLUDE_DIR) 18 | 19 | if(SEEXPR2_FOUND AND NOT TARGET SeExpr2::SeExpr) 20 | add_library(SeExpr2::SeExpr SHARED IMPORTED) 21 | set_target_properties( 22 | SeExpr2::SeExpr 23 | PROPERTIES 24 | INTERFACE_INCLUDE_DIRECTORIES "${SEEXPR2_INCLUDE_DIR}" 25 | IMPORTED_LOCATION ${SEEXPR2_LIBRARY}) 26 | endif() 27 | -------------------------------------------------------------------------------- /gpl-header-c.txt: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * This file is part of openfx-io , 3 | * (C) 2018-2021 The Natron Developers 4 | * (C) 2013-2018 INRIA 5 | * 6 | * openfx-io is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * openfx-io is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with openfx-io. If not, see 18 | * ***** END LICENSE BLOCK ***** */ 19 | --------------------------------------------------------------------------------