diff --git a/.github/workflows/build_installer.yml b/.github/workflows/build_installer.yml index 7c2207b7d5..9b9ddee8d1 100644 --- a/.github/workflows/build_installer.yml +++ b/.github/workflows/build_installer.yml @@ -4,6 +4,10 @@ on: workflow_dispatch: {} push: +env: + NATRON_BUILD_WORKSPACE: 'D:/nbw' + CI: 'True' + jobs: win-installer: name: Windows Installer @@ -11,12 +15,10 @@ jobs: defaults: run: shell: msys2 {0} - env: - CI: 'True' steps: - name: Checkout branch - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.1 with: submodules: recursive @@ -29,19 +31,12 @@ jobs: - name: Install Natron pacman repository run: | - mkdir ${GITHUB_WORKSPACE}/natron_pacman_repo - cd ${GITHUB_WORKSPACE}/natron_pacman_repo - wget https://github.com/NatronGitHub/Natron/releases/download/windows-mingw-package-repo/natron_package_repo.zip - unzip natron_package_repo.zip - NATRON_REPO_PATH=`cygpath -u $GITHUB_WORKSPACE` - echo -e "#NATRON_REPO_START\n[natron]\nSigLevel = Optional TrustAll\nServer = file://${NATRON_REPO_PATH}/natron_pacman_repo/\n#NATRON_REPO_END" >> /etc/pacman.conf - pacman -Syl natron + ${GITHUB_WORKSPACE}/.github/workflows/install_natron_pacman_repo.sh ${GITHUB_WORKSPACE} ${GITHUB_WORKSPACE}/natron_pacman_repo pacman -S --needed --noconfirm mingw-w64-x86_64-natron-build-deps-qt5 - name: Build id: build run: | - NATRON_BUILD_WORKSPACE=${GITHUB_WORKSPACE}/natron_build NATRON_BUILD_WORKSPACE_UNIX=$(cygpath -u ${NATRON_BUILD_WORKSPACE}) mkdir ${NATRON_BUILD_WORKSPACE_UNIX} @@ -64,8 +59,24 @@ jobs: echo "INSTALLER_NAME=${INSTALLER_NAME}" >> $GITHUB_OUTPUT echo "INSTALLER_DIR=$(cygpath -m ${INSTALLER_DIR})" >> $GITHUB_OUTPUT + - name: Build verify_plugin_loads binary + run: | + g++ -DWINDOWS -o verify_plugin_loads .github/workflows/verify_plugin_loads.cpp libs/OpenFX/HostSupport/src/ofxhBinary.cpp libs/OpenFX/HostSupport/src/ofxhUtilities.cpp -I libs/OpenFX/HostSupport/include/ -I libs/OpenFX/include/ + + - name: Uninstall Natron dependencies + run: | + pacman -Rs --noconfirm mingw-w64-x86_64-natron-build-deps-qt5 + + - name: Verify plugin loading + run: | + INSTALLER_DIR=$(cygpath -u '${{ steps.build.outputs.INSTALLER_DIR }}')/${{ steps.build.outputs.INSTALLER_NAME }} + for x in $(find ${INSTALLER_DIR}/Plugins -name *.ofx); do + echo "Testing $(basename ${x}) ..." + PATH=${INSTALLER_DIR}/bin ./verify_plugin_loads.exe "${x}" + done + - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4.3.1 with: name: ${{ steps.build.outputs.INSTALLER_NAME }} path: ${{ steps.build.outputs.INSTALLER_DIR }} @@ -76,12 +87,10 @@ jobs: defaults: run: shell: msys2 {0} - env: - CI: 'True' steps: - name: Checkout branch - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.1 with: submodules: recursive @@ -94,19 +103,12 @@ jobs: - name: Install Natron pacman repository run: | - mkdir ${GITHUB_WORKSPACE}/natron_pacman_repo - cd ${GITHUB_WORKSPACE}/natron_pacman_repo - wget https://github.com/NatronGitHub/Natron/releases/download/windows-mingw-package-repo/natron_package_repo.zip - unzip natron_package_repo.zip - NATRON_REPO_PATH=`cygpath -u $GITHUB_WORKSPACE` - echo -e "#NATRON_REPO_START\n[natron]\nSigLevel = Optional TrustAll\nServer = file://${NATRON_REPO_PATH}/natron_pacman_repo/\n#NATRON_REPO_END" >> /etc/pacman.conf - pacman -Syl natron + ${GITHUB_WORKSPACE}/.github/workflows/install_natron_pacman_repo.sh ${GITHUB_WORKSPACE} ${GITHUB_WORKSPACE}/natron_pacman_repo pacman -S --needed --noconfirm mingw-w64-x86_64-natron-build-deps-qt5 - name: Build id: build run: | - NATRON_BUILD_WORKSPACE=${GITHUB_WORKSPACE}/natron_build NATRON_BUILD_WORKSPACE_UNIX=$(cygpath -u ${NATRON_BUILD_WORKSPACE}) mkdir ${NATRON_BUILD_WORKSPACE_UNIX} @@ -139,14 +141,30 @@ jobs: echo "SYMBOLS_NAME=${SYMBOLS_NAME}" >> $GITHUB_OUTPUT echo "SYMBOLS_DIR=$(cygpath -m ${SYMBOLS_DIR})" >> $GITHUB_OUTPUT + - name: Build verify_plugin_loads binary + run: | + g++ -DWINDOWS -o verify_plugin_loads .github/workflows/verify_plugin_loads.cpp libs/OpenFX/HostSupport/src/ofxhBinary.cpp libs/OpenFX/HostSupport/src/ofxhUtilities.cpp -I libs/OpenFX/HostSupport/include/ -I libs/OpenFX/include/ + + - name: Uninstall Natron dependencies + run: | + pacman -Rs --noconfirm mingw-w64-x86_64-natron-build-deps-qt5 + + - name: Verify plugin loading + run: | + INSTALLER_DIR=$(cygpath -u '${{ steps.build.outputs.INSTALLER_DIR }}')/${{ steps.build.outputs.INSTALLER_NAME }} + for x in $(find ${INSTALLER_DIR}/Plugins -name *.ofx); do + echo "Testing $(basename ${x}) ..." + PATH=${INSTALLER_DIR}/bin ./verify_plugin_loads.exe "${x}" + done + - name: Upload installer - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4.3.1 with: name: ${{ steps.build.outputs.INSTALLER_NAME }} path: ${{ steps.build.outputs.INSTALLER_DIR }} - name: Upload symbols - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4.3.1 with: name: ${{ steps.build.outputs.SYMBOLS_NAME }} path: ${{ steps.build.outputs.SYMBOLS_DIR }} diff --git a/.github/workflows/build_pacman_repo.yml b/.github/workflows/build_pacman_repo.yml index d99acb21fc..71a9bbc493 100644 --- a/.github/workflows/build_pacman_repo.yml +++ b/.github/workflows/build_pacman_repo.yml @@ -27,7 +27,7 @@ jobs: shell: msys2 {0} steps: - name: Checkout branch - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.1 with: submodules: recursive - name: Setup MinGW environment @@ -39,32 +39,37 @@ jobs: - name: Install Inno Setup run: choco install innosetup shell: pwsh + - name: Prep MinGW package version list + run: | + pacman -Sl mingw64 msys > mingw-package-version-list.txt - name: Restore natron repo directory from cache id: restore-natron-repo-cache - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4.0.0 with: - path: tools/MINGW-packages/natron_repo - key: ${{ env.cache-name }}-${{ hashFiles('tools/MINGW-packages/**/PKGBUILD') }} + path: natron_repo + key: ${{ env.cache-name }}-${{ hashFiles('mingw-package-version-list.txt', 'tools/MINGW-packages/**/PKGBUILD') }} - name: Build natron package repo id: build-package-repo # Allow continuing after error so cache gets updated and makes reruns faster. continue-on-error: true run: | - cd tools/MINGW-packages - ./build_natron_package_repo.sh natron_repo + tools/MINGW-packages/build_natron_package_repo.sh natron_repo + + REPO_VERSION=`cat ${GITHUB_WORKSPACE}/tools/MINGW-packages/windows_pacman_repo_version.txt` + echo "REPO_VERSION=${REPO_VERSION}" >> "$GITHUB_OUTPUT" - name: Save natron repo directory to cache id: save-natron-repo-cache - uses: actions/cache/save@v3 + uses: actions/cache/save@v4.0.0 # save even if build fails. if: always() with: - path: tools/MINGW-packages/natron_repo - key: ${{ env.cache-name }}-${{ hashFiles('tools/MINGW-packages/**/PKGBUILD') }} + path: natron_repo + key: ${{ env.cache-name }}-${{ hashFiles('mingw-package-version-list.txt', 'tools/MINGW-packages/**/PKGBUILD') }} - name: Upload natron_package_repo artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4.3.1 with: - name: natron_package_repo - path: tools/MINGW-packages/natron_repo + name: natron_package_repo-${{ steps.build-package-repo.outputs.REPO_VERSION }} + path: natron_repo - name: Check on failures if: steps.build-package-repo.outcome != 'success' run: exit 1 \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41bc38f7f1..116eafaeb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,6 @@ on: branches: - RB-2.5 - RB-2.6 - - fix-ci # For testing. Remove before commit. paths-ignore: - Documentation pull_request: @@ -40,7 +39,7 @@ jobs: python-version: '3.10' steps: - name: Checkout branch - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.1 with: submodules: recursive - name: Install Linux system packages @@ -66,34 +65,49 @@ jobs: tar xzf Natron-v${OCIO_CONFIG_VERSION}.tar.gz mv OpenColorIO-Configs-Natron-v${OCIO_CONFIG_VERSION} OpenColorIO-Configs - - name: Build Unix + - name: Download Plugins run: | - mkdir build && cd build - cmake ../ + mkdir Plugins && cd Plugins + wget https://github.com/NatronGitHub/openfx-io/releases/download/natron_testing/openfx-io-build-ubuntu_22-testing.zip + unzip openfx-io-build-ubuntu_22-testing.zip + cd .. + + - name: Build Unix (debug) + run: | + mkdir debug && cd debug + cmake -DCMAKE_BUILD_TYPE=Debug ../ make -j2 - - name: Run Unix Tests - id: run-unix-tests + - name: Run Unix Tests (debug) + id: run-unix-tests-debug # Allow continuing after error so logs can be uploaded. continue-on-error: true run: | - cd build + cd debug + OFX_PLUGIN_PATH=$PWD/../Plugins OCIO=$PWD/../OpenColorIO-Configs/blender/config.ocio ctest -V - mkdir Plugins && cd Plugins - wget https://github.com/NatronGitHub/openfx-io/releases/download/natron_testing/openfx-io-build-ubuntu_22-testing.zip - unzip openfx-io-build-ubuntu_22-testing.zip - cd .. + - name: Build Unix (release) + run: | + mkdir release && cd release + cmake ../ + make -j2 - OFX_PLUGIN_PATH=$PWD/Plugins OCIO=$PWD/../OpenColorIO-Configs/blender/config.ocio ctest -V + - name: Run Unix Tests (release) + id: run-unix-tests-release + # Allow continuing after error so logs can be uploaded. + continue-on-error: true + run: | + cd release + OFX_PLUGIN_PATH=$PWD/../Plugins OCIO=$PWD/../OpenColorIO-Configs/blender/config.ocio ctest -V - name: Upload ${{ matrix.os }} Test Log artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4.3.1 with: name: ${{ matrix.os }} Test Logs - path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log + path: ${{ github.workspace }}/release/Testing/Temporary/LastTest.log - name: Check for test failures - if: steps.run-unix-tests.outcome == 'failure' + if: steps.run-unix-tests-debug.outcome == 'failure' || steps.run-unix-tests-release.outcome == 'failure' run: exit 1 win-test: @@ -115,7 +129,7 @@ jobs: python-version: ['3.10'] steps: - name: Checkout branch - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.1 with: submodules: recursive @@ -124,10 +138,12 @@ jobs: with: msystem: mingw64 update: true - install: git base-devel mingw-w64-x86_64-cc mingw-w64-x86_64-qt5-base mingw-w64-x86_64-pyside2 - mingw-w64-x86_64-shiboken2 mingw-w64-x86_64-python-qtpy mingw-w64-x86_64-ninja - mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-cairo mingw-w64-x86_64-expat - mingw-w64-x86_64-wget unzip + install: git mingw-w64-x86_64-wget unzip mingw-w64-x86_64-ninja mingw-w64-x86_64-cmake + + - name: Install Natron pacman repository + run: | + ${GITHUB_WORKSPACE}/.github/workflows/install_natron_pacman_repo.sh ${GITHUB_WORKSPACE} ${GITHUB_WORKSPACE}/natron_pacman_repo + pacman -S --needed --noconfirm mingw-w64-x86_64-natron-build-deps-qt5 - name: Download OpenColorIO-Configs run: | @@ -156,7 +172,7 @@ jobs: PYTHONHOME=/mingw64 OFX_PLUGIN_PATH=$PWD/Plugins OCIO=$PWD/../OpenColorIO-Configs/blender/config.ocio ctest -V - name: Upload ${{ matrix.os }} Test Log artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4.3.1 with: name: ${{ matrix.os }} Test Logs path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log diff --git a/.github/workflows/install_natron_pacman_repo.sh b/.github/workflows/install_natron_pacman_repo.sh new file mode 100644 index 0000000000..0812f9ad01 --- /dev/null +++ b/.github/workflows/install_natron_pacman_repo.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +NATRON_DIR= +NATRON_REPO_DIR= +if [[ -z $1 || -z $2 ]]; then + echo "Usage: $(basename $0) " + exit 1 +else + NATRON_DIR=$(realpath $1) + NATRON_REPO_DIR=$(realpath $2) +fi + +source ${NATRON_DIR}/tools/MINGW-packages/natron_repo_common.sh + +if [[ ! -d ${NATRON_REPO_DIR} ]]; then + mkdir ${NATRON_REPO_DIR} +fi + +cd ${NATRON_REPO_DIR} + +WINDOWS_PACMAN_REPO_VERSION=`cat ${NATRON_DIR}/tools/MINGW-packages/windows_pacman_repo_version.txt` +ZIP_FILENAME="natron_package_repo-${WINDOWS_PACMAN_REPO_VERSION}.zip" +wget https://github.com/NatronGitHub/Natron/releases/download/windows-mingw-package-repo/${ZIP_FILENAME} + +if [[ -e ${ZIP_FILENAME} ]]; then + unzip ${ZIP_FILENAME} +else + echo "Failed to fetch ${ZIP_FILENAME}" + + echo "Building pacman repo locally." + + # install necessary dependencies for building pacman repo. + pacman -S --needed --noconfirm git base-devel + + ${NATRON_DIR}/tools/MINGW-packages/build_natron_package_repo.sh ${NATRON_REPO_DIR} +fi + +UNIX_NATRON_REPO_DIR=`cygpath -u ${NATRON_REPO_DIR}` +natron_repo_init ${UNIX_NATRON_REPO_DIR} diff --git a/.github/workflows/verify_plugin_loads.cpp b/.github/workflows/verify_plugin_loads.cpp new file mode 100644 index 0000000000..6bc1dbd609 --- /dev/null +++ b/.github/workflows/verify_plugin_loads.cpp @@ -0,0 +1,58 @@ + +#include "ofxhBinary.h" +#include "ofxhPluginCache.h" + +int +main(int argc, const char* argv[]) +{ + if (argc < 2) { + std::cerr << "Usage: " << argv[0] << " \n"; + return 1; + } + + const char* const binaryPath = argv[1]; + + // TODO: Change code to _dlHandle = dlopen(_binaryPath.c_str(), RTLD_NOW|RTLD_LOCAL); + OFX::Binary bin(binaryPath); + + if (bin.isInvalid()) { + std::cerr << "error: '" << binaryPath << "' is invalid.\n"; + return 1; + } + + bin.load(); + + if (!bin.isLoaded()) { + std::cerr << "error: '" << binaryPath << "' failed to load.\n"; + return 1; + } + + auto* getNumberOfPlugins = (OFX::Host::OfxGetNumberOfPluginsFunc)bin.findSymbol("OfxGetNumberOfPlugins"); + auto* getPluginFunc = (OFX::Host::OfxGetPluginFunc)bin.findSymbol("OfxGetPlugin"); + + if (getNumberOfPlugins == nullptr || getPluginFunc == nullptr) { + std::cerr << "error: '" << binaryPath << "' missing required symbols.\n"; + return 1; + } + + const int numPlugins = getNumberOfPlugins(); + + std::cout << "numPlugins: " << numPlugins << "\n"; + + if (numPlugins <= 0) { + std::cerr << "error: unexpected number of plugins.\n"; + return 1; + } + + for (int i = 0; i < numPlugins; ++i) { + auto* plugin = getPluginFunc(i); + if (plugin == nullptr) { + std::cerr << "Failed to get plugin " << i << "\n"; + return 1; + } + + std::cout << "plugin[" << i << "] : " << plugin->pluginIdentifier << " v" << plugin->pluginVersionMajor << "." << plugin->pluginVersionMinor << "\n"; + } + + return 0; +} \ No newline at end of file diff --git a/.readthedocs.yaml b/.readthedocs.yaml index a8b824030d..89f857dd46 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -6,14 +6,14 @@ version: 2 # Set the version of Python and other tools you might need -# build: -# os: ubuntu-20.04 -# tools: -# python: "3" -# # You can also specify other tool versions: -# # nodejs: "16" -# # rust: "1.55" -# # golang: "1.17" +build: + os: ubuntu-22.04 + tools: + python: "3.12" + # You can also specify other tool versions: + # nodejs: "20" + # rust: "1.70" + # golang: "1.20" # Build documentation in the docs/ directory with Sphinx sphinx: diff --git a/Documentation/source/conf.py b/Documentation/source/conf.py index b11d67b294..118ababa50 100644 --- a/Documentation/source/conf.py +++ b/Documentation/source/conf.py @@ -136,12 +136,7 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] -# https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html -html_context = { - 'css_files': [ - '_static/theme_overrides.css', # override wide tables in RTD theme - ], - } +html_css_files = ['theme_overrides.css'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff --git a/Documentation/source/guide/getstarted-about-mainconcepts.rst b/Documentation/source/guide/getstarted-about-mainconcepts.rst index 3898dc6743..21f401cb56 100644 --- a/Documentation/source/guide/getstarted-about-mainconcepts.rst +++ b/Documentation/source/guide/getstarted-about-mainconcepts.rst @@ -16,9 +16,9 @@ Image Layers and Channels ######################### In natron an image is only a stack of black and white images called channels. channels are grouped in layers. -The Color layer is the base layer. Color layer has channels R,G,B,A -R,G,B codes the color of the pixels in Red Green blue -A codes the transparency of the pixel called Alpha. When A=0 the pixel is transparent. When A=1 the pixel is transparent +The Color layer is the base layer. Color layer has channels R,G,B,A. +R,G,B codes the color of the pixels in Red Green blue. +A codes the transparency of the pixel called Alpha. When A=0 the pixel is transparent. When A=1 the pixel is opaque The image can have as many layers as you want describing, the motion, the depth of your image or whatever else you want .. note:: You cannot see the stacking of the layers as in as in Photoshop or After Effects. In Natron you will have different branches of your node tree that are Merged together. The Merge node is the good way to stack layers. diff --git a/Engine/Bezier.cpp b/Engine/Bezier.cpp index 471bb8c38f..1b30f5be8a 100644 --- a/Engine/Bezier.cpp +++ b/Engine/Bezier.cpp @@ -337,7 +337,7 @@ bezierSegmentBboxUpdate(bool useGuiCurves, const BezierCP & last, double time, ViewIdx view, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const Transform::Matrix3x3& transform, RectD* bbox) ///< input/output { @@ -372,8 +372,8 @@ bezierSegmentBboxUpdate(bool useGuiCurves, p2.y = p2M.y / p2M.z; p3.y = p3M.y / p3M.z; - if (mipMapLevel > 0) { - int pot = 1 << mipMapLevel; + if (mipmapLevel > 0) { + int pot = 1 << mipmapLevel; p0.x /= pot; p0.y /= pot; @@ -396,7 +396,7 @@ Bezier::bezierSegmentListBboxUpdate(bool useGuiCurves, bool isOpenBezier, double time, ViewIdx view, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const Transform::Matrix3x3& transform, RectD* bbox) ///< input/output { @@ -428,7 +428,7 @@ Bezier::bezierSegmentListBboxUpdate(bool useGuiCurves, } next = points.begin(); } - bezierSegmentBboxUpdate(useGuiCurves, *(*it), *(*next), time, view, mipMapLevel, transform, bbox); + bezierSegmentBboxUpdate(useGuiCurves, *(*it), *(*next), time, view, mipmapLevel, transform, bbox); // increment for next iteration if ( next != points.end() ) { @@ -717,7 +717,7 @@ bezierSegmentEval(bool useGuiCurves, const BezierCP & last, double time, ViewIdx view, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -752,8 +752,8 @@ bezierSegmentEval(bool useGuiCurves, p3.x = p3M.x / p3M.z; p3.y = p3M.y / p3M.z; - if (mipMapLevel > 0) { - int pot = 1 << mipMapLevel; + if (mipmapLevel > 0) { + int pot = 1 << mipmapLevel; p0.x /= pot; p0.y /= pot; @@ -2539,7 +2539,7 @@ Bezier::deCastelJau(bool isOpenBezier, bool useGuiCurves, const std::list& cps, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, bool finished, int nBPointsPerSegment, const Transform::Matrix3x3& transform, @@ -2572,7 +2572,7 @@ Bezier::deCastelJau(bool isOpenBezier, if (points) { std::list segmentPoints; - bezierSegmentEval(useGuiCurves, *(*it), *(*next), time, ViewIdx(0), mipMapLevel, nBPointsPerSegment, transform, &segmentPoints, bbox); + bezierSegmentEval(useGuiCurves, *(*it), *(*next), time, ViewIdx(0), mipmapLevel, nBPointsPerSegment, transform, &segmentPoints, bbox); // If we are a closed bezier or we are not on the last segment, remove the last point so we don't add duplicates if (isClosed || !isLastSegment) { @@ -2583,7 +2583,7 @@ Bezier::deCastelJau(bool isOpenBezier, points->push_back(segmentPoints); } else { assert(pointsSingleList); - bezierSegmentEval(useGuiCurves, *(*it), *(*next), time, ViewIdx(0), mipMapLevel, nBPointsPerSegment, transform, pointsSingleList, bbox); + bezierSegmentEval(useGuiCurves, *(*it), *(*next), time, ViewIdx(0), mipmapLevel, nBPointsPerSegment, transform, pointsSingleList, bbox); // If we are a closed bezier or we are not on the last segment, remove the last point so we don't add duplicates if (isClosed || !isLastSegment) { if (!pointsSingleList->empty()) { @@ -2605,7 +2605,7 @@ Bezier::deCastelJau(bool isOpenBezier, void Bezier::evaluateAtTime_DeCasteljau(bool useGuiPoints, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -2614,7 +2614,7 @@ Bezier::evaluateAtTime_DeCasteljau(bool useGuiPoints, std::list >* points, RectD* bbox) const { - evaluateAtTime_DeCasteljau_internal(useGuiPoints, time, mipMapLevel, + evaluateAtTime_DeCasteljau_internal(useGuiPoints, time, mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE nbPointsPerSegment, #else @@ -2626,7 +2626,7 @@ Bezier::evaluateAtTime_DeCasteljau(bool useGuiPoints, void Bezier::evaluateAtTime_DeCasteljau(bool useGuiPoints, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -2635,7 +2635,7 @@ Bezier::evaluateAtTime_DeCasteljau(bool useGuiPoints, std::list* pointsSingleList, RectD* bbox) const { - evaluateAtTime_DeCasteljau_internal(useGuiPoints, time, mipMapLevel, + evaluateAtTime_DeCasteljau_internal(useGuiPoints, time, mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE nbPointsPerSegment, #else @@ -2647,7 +2647,7 @@ Bezier::evaluateAtTime_DeCasteljau(bool useGuiPoints, void Bezier::evaluateAtTime_DeCasteljau_internal(bool useGuiCurves, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -2662,7 +2662,7 @@ Bezier::evaluateAtTime_DeCasteljau_internal(bool useGuiCurves, getTransformAtTime(time, &transform); QMutexLocker l(&itemMutex); - deCastelJau(isOpenBezier(), useGuiCurves, _imp->points, time, mipMapLevel, _imp->finished, + deCastelJau(isOpenBezier(), useGuiCurves, _imp->points, time, mipmapLevel, _imp->finished, #ifdef ROTO_BEZIER_EVAL_ITERATIVE nbPointsPerSegment, #else @@ -2674,11 +2674,11 @@ Bezier::evaluateAtTime_DeCasteljau_internal(bool useGuiCurves, void Bezier::evaluateAtTime_DeCasteljau_autoNbPoints(bool useGuiPoints, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, std::list >* points, RectD* bbox) const { - evaluateAtTime_DeCasteljau(useGuiPoints, time, mipMapLevel, + evaluateAtTime_DeCasteljau(useGuiPoints, time, mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE -1, #else @@ -2690,7 +2690,7 @@ Bezier::evaluateAtTime_DeCasteljau_autoNbPoints(bool useGuiPoints, void Bezier::evaluateFeatherPointsAtTime_DeCasteljau(bool useGuiCurves, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -2700,7 +2700,7 @@ Bezier::evaluateFeatherPointsAtTime_DeCasteljau(bool useGuiCurves, std::list* points, RectD* bbox) const { - evaluateFeatherPointsAtTime_DeCasteljau_internal(useGuiCurves, time, mipMapLevel, + evaluateFeatherPointsAtTime_DeCasteljau_internal(useGuiCurves, time, mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE nbPointsPerSegment, #else @@ -2712,7 +2712,7 @@ Bezier::evaluateFeatherPointsAtTime_DeCasteljau(bool useGuiCurves, void Bezier::evaluateFeatherPointsAtTime_DeCasteljau_internal(bool useGuiPoints, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -2760,7 +2760,7 @@ Bezier::evaluateFeatherPointsAtTime_DeCasteljau_internal(bool useGuiPoints, } if (points) { std::list segmentPoints; - bezierSegmentEval(useGuiPoints, *(*it), *(*next), time, ViewIdx(0), mipMapLevel, + bezierSegmentEval(useGuiPoints, *(*it), *(*next), time, ViewIdx(0), mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE nbPointsPerSegment, #else @@ -2777,7 +2777,7 @@ Bezier::evaluateFeatherPointsAtTime_DeCasteljau_internal(bool useGuiPoints, points->push_back(segmentPoints); } else { assert(pointsSingleList); - bezierSegmentEval(useGuiPoints, *(*it), *(*next), time, ViewIdx(0), mipMapLevel, + bezierSegmentEval(useGuiPoints, *(*it), *(*next), time, ViewIdx(0), mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE nbPointsPerSegment, #else @@ -2809,7 +2809,7 @@ Bezier::evaluateFeatherPointsAtTime_DeCasteljau_internal(bool useGuiPoints, void Bezier::evaluateFeatherPointsAtTime_DeCasteljau(bool useGuiPoints, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -2819,7 +2819,7 @@ Bezier::evaluateFeatherPointsAtTime_DeCasteljau(bool useGuiPoints, std::list >* points, ///< output RectD* bbox) const ///< output { - evaluateFeatherPointsAtTime_DeCasteljau_internal(useGuiPoints, time, mipMapLevel, + evaluateFeatherPointsAtTime_DeCasteljau_internal(useGuiPoints, time, mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE nbPointsPerSegment, #else diff --git a/Engine/Bezier.h b/Engine/Bezier.h index 27fe7b2ac3..3cd4cf6460 100644 --- a/Engine/Bezier.h +++ b/Engine/Bezier.h @@ -360,7 +360,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON static void deCastelJau(bool isOpenBezier, bool useGuiCurves, - const std::list& cps, double time, unsigned int mipMapLevel, + const std::list& cps, double time, unsigned int mipmapLevel, bool finished, int nBPointsPerSegment, const Transform::Matrix3x3& transform, @@ -378,7 +378,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON **/ void evaluateAtTime_DeCasteljau(bool useGuiCurves, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -389,7 +389,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON void evaluateAtTime_DeCasteljau(bool useGuiCurves, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -402,7 +402,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON void evaluateAtTime_DeCasteljau_internal(bool useGuiCurves, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -419,7 +419,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON **/ void evaluateAtTime_DeCasteljau_autoNbPoints(bool useGuiCurves, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, std::list >* points, RectD* bbox) const; @@ -429,7 +429,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON **/ void evaluateFeatherPointsAtTime_DeCasteljau(bool useGuiCurves, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -441,7 +441,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON void evaluateFeatherPointsAtTime_DeCasteljau(bool useGuiCurves, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -455,7 +455,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON void evaluateFeatherPointsAtTime_DeCasteljau_internal(bool useGuiCurves, double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, #ifdef ROTO_BEZIER_EVAL_ITERATIVE int nbPointsPerSegment, #else @@ -479,7 +479,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON bool isOpenBezier, double time, ViewIdx view, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const Transform::Matrix3x3& transform, RectD* bbox); diff --git a/Engine/DiskCacheNode.cpp b/Engine/DiskCacheNode.cpp index d777f48768..cf398433ab 100644 --- a/Engine/DiskCacheNode.cpp +++ b/Engine/DiskCacheNode.cpp @@ -221,7 +221,7 @@ DiskCacheNode::render(const RenderActionArgs& args) if (!srcImg) { return eStatusFailed; } - if ( srcImg->getMipMapLevel() != output.second->getMipMapLevel() ) { + if ( srcImg->getMipmapLevel() != output.second->getMipmapLevel() ) { throw std::runtime_error("Host gave image with wrong scale"); } if ( ( srcImg->getComponents() != output.second->getComponents() ) || ( srcImg->getBitDepth() != output.second->getBitDepth() ) ) { diff --git a/Engine/EffectInstance.cpp b/Engine/EffectInstance.cpp index 968793e8a7..ecbeceb227 100644 --- a/Engine/EffectInstance.cpp +++ b/Engine/EffectInstance.cpp @@ -814,7 +814,7 @@ EffectInstance::getImage(int inputNb, /* * These are the data fields stored in the TLS from the on-going render action or instance changed action */ - unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); + unsigned int mipmapLevel = scale.toMipmapLevel(); RoIMap inputsRoI; bool isIdentity = false; EffectInstancePtr identityInput; @@ -964,15 +964,15 @@ EffectInstance::getImage(int inputNb, ///Does this node supports images at a scale different than 1 - bool renderFullScaleThenDownscale = (!supportsRenderScale() && mipMapLevel != 0 && returnStorage == eStorageModeRAM); + bool renderFullScaleThenDownscale = (!supportsRenderScale() && mipmapLevel != 0 && returnStorage == eStorageModeRAM); ///Do we want to render the graph upstream at scale 1 or at the requested render scale ? (user setting) bool renderScaleOneUpstreamIfRenderScaleSupportDisabled = false; - unsigned int renderMappedMipMapLevel = mipMapLevel; + unsigned int renderMappedMipmapLevel = mipmapLevel; if (renderFullScaleThenDownscale) { renderScaleOneUpstreamIfRenderScaleSupportDisabled = node->useScaleOneImagesWhenRenderScaleSupportIsDisabled(); if (renderScaleOneUpstreamIfRenderScaleSupportDisabled) { - renderMappedMipMapLevel = 0; + renderMappedMipmapLevel = 0; } } @@ -991,7 +991,7 @@ EffectInstance::getImage(int inputNb, } - RectI pixelRoI = roi.toPixelEnclosing(renderScaleOneUpstreamIfRenderScaleSupportDisabled ? 0 : mipMapLevel, par); + RectI pixelRoI = roi.toPixelEnclosing(renderScaleOneUpstreamIfRenderScaleSupportDisabled ? 0 : mipmapLevel, par); ImagePtr inputImg; @@ -1001,7 +1001,7 @@ EffectInstance::getImage(int inputNb, assert(attachedStroke); if (attachedStroke) { if (duringPaintStroke) { - inputImg = node->getOrRenderLastStrokeImage(mipMapLevel, par, components, depth); + inputImg = node->getOrRenderLastStrokeImage(mipmapLevel, par, components, depth); } else { RectD rotoSrcRod; if (inputIsRotoBrush) { @@ -1018,7 +1018,7 @@ EffectInstance::getImage(int inputNb, } inputImg = attachedStroke->renderMaskFromStroke(components, - time, view, depth, mipMapLevel, rotoSrcRod); + time, view, depth, mipmapLevel, rotoSrcRod); if ( roto->isDoingNeatRender() ) { getApp()->updateStrokeImage(inputImg, 0, false); @@ -1065,7 +1065,7 @@ EffectInstance::getImage(int inputNb, std::map inputImages; RenderRoIRetCode retCode = inputEffect->renderRoI(RenderRoIArgs(time, scale, - renderMappedMipMapLevel, + renderMappedMipmapLevel, view, byPassCache, pixelRoI, @@ -1104,19 +1104,19 @@ EffectInstance::getImage(int inputNb, if (roiPixel) { *roiPixel = pixelRoI; } - unsigned int inputImgMipMapLevel = inputImg->getMipMapLevel(); + unsigned int inputImgMipmapLevel = inputImg->getMipmapLevel(); ///If the plug-in doesn't support the render scale, but the image is downscaled, up-scale it. ///Note that we do NOT cache it because it is really low def! ///For OpenGL textures, we do not do it because GL_TEXTURE_2D uses normalized texture coordinates anyway, so any OpenGL plug-in should support render scale. - if (!dontUpscale && renderFullScaleThenDownscale && (inputImgMipMapLevel != 0) && returnStorage == eStorageModeRAM) { - assert(inputImgMipMapLevel != 0); + if (!dontUpscale && renderFullScaleThenDownscale && (inputImgMipmapLevel != 0) && returnStorage == eStorageModeRAM) { + assert(inputImgMipmapLevel != 0); ///Resize the image according to the requested scale ImageBitDepthEnum bitdepth = inputImg->getBitDepth(); const RectI bounds = inputImg->getRoD().toPixelEnclosing(0, par); ImagePtr rescaledImg = std::make_shared( inputImg->getComponents(), inputImg->getRoD(), bounds, 0, par, bitdepth, inputImg->getPremultiplication(), inputImg->getFieldingOrder() ); - inputImg->upscaleMipMap( inputImg->getBounds(), inputImgMipMapLevel, 0, rescaledImg.get() ); + inputImg->upscaleMipmap( inputImg->getBounds(), inputImgMipmapLevel, 0, rescaledImg.get() ); if (roiPixel) { if (!inputRoDSet) { bool isProjectFormat; @@ -1124,7 +1124,7 @@ EffectInstance::getImage(int inputNb, Q_UNUSED(st); } - pixelRoI = pixelRoI.toNewMipMapLevel(inputImgMipMapLevel, 0, par, inputRoD); + pixelRoI = pixelRoI.toNewMipmapLevel(inputImgMipmapLevel, 0, par, inputRoD); *roiPixel = pixelRoI; } @@ -1176,10 +1176,10 @@ EffectInstance::calcDefaultRegionOfDefinition(U64 /*hash*/, RectD *rod) { - unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); + unsigned int mipmapLevel = scale.toMipmapLevel(); RectI format = getOutputFormat(); double par = getAspectRatio(-1); - *rod = format.toCanonical_noClipping(mipMapLevel, par); + *rod = format.toCanonical_noClipping(mipmapLevel, par); } StatusEnum @@ -1258,7 +1258,7 @@ EffectInstance::ifInfiniteApplyHeuristic(U64 hash, bool isProjectFormat; RenderScale inputScale = scale; if (input->supportsRenderScaleMaybe() == eSupportsNo) { - inputScale.x = inputScale.y = 1.; + inputScale = RenderScale::identity; } StatusEnum st = input->getRegionOfDefinition_public(hash, time, inputScale, view, &inputRod, &isProjectFormat); if (st != eStatusFailed) { @@ -1281,8 +1281,8 @@ EffectInstance::ifInfiniteApplyHeuristic(U64 hash, RectI format = getOutputFormat(); assert(!format.isNull()); double par = getAspectRatio(-1); - unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); - canonicalFormat = format.toCanonical_noClipping(mipMapLevel, par); + unsigned int mipmapLevel = scale.toMipmapLevel(); + canonicalFormat = format.toCanonical_noClipping(mipmapLevel, par); } // BE CAREFUL: @@ -1351,7 +1351,7 @@ EffectInstance::getRegionsOfInterest(double time, //Tiles not supported: get the RoD as RoI RectD rod; bool isPF; - RenderScale inpScale(input->supportsRenderScale() ? scale.x : 1.); + RenderScale inpScale = (input->supportsRenderScale() ? scale : RenderScale::identity); StatusEnum stat = input->getRegionOfDefinition_public(input->getRenderHash(), time, inpScale, view, &rod, &isPF); if (stat == eStatusFailed) { return; @@ -1617,7 +1617,7 @@ EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/, StorageModeEnum storage, StorageModeEnum returnStorage, const ImageKey & key, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const RectI* boundsParam, const RectD* rodParam, const RectI& roi, @@ -1665,7 +1665,7 @@ EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/, ImagePtr imageToConvert; for (ImageList::iterator it = cachedImages.begin(); it != cachedImages.end(); ++it) { - unsigned int imgMMlevel = (*it)->getMipMapLevel(); + unsigned int imgMMlevel = (*it)->getMipmapLevel(); const ImagePlaneDesc & imgComps = (*it)->getComponents(); ImageBitDepthEnum imgDepth = (*it)->getBitDepth(); @@ -1692,26 +1692,26 @@ EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/, }*/ bool convertible = (imgComps.isColorPlane() && components.isColorPlane()) || (imgComps == components); - if ( (imgMMlevel == mipMapLevel) && convertible && + if ( (imgMMlevel == mipmapLevel) && convertible && ( getSizeOfForBitDepth(imgDepth) >= getSizeOfForBitDepth(bitdepth) ) /* && imgComps == components && imgDepth == bitdepth*/ ) { ///We found a matching image *image = *it; break; } else { - if ( (*it)->getStorageMode() != eStorageModeRAM || (imgMMlevel >= mipMapLevel) || !convertible || + if ( (*it)->getStorageMode() != eStorageModeRAM || (imgMMlevel >= mipmapLevel) || !convertible || ( getSizeOfForBitDepth(imgDepth) < getSizeOfForBitDepth(bitdepth) ) ) { ///Either smaller resolution or not enough components or bit-depth is not as deep, don't use the image continue; } - assert(imgMMlevel < mipMapLevel); + assert(imgMMlevel < mipmapLevel); if (!imageToConvert) { imageToConvert = *it; } else { ///We found an image which scale is closer to the requested mipmap level we want, use it instead - if ( imgMMlevel > imageToConvert->getMipMapLevel() ) { + if ( imgMMlevel > imageToConvert->getMipmapLevel() ) { imageToConvert = *it; } } @@ -1723,10 +1723,10 @@ EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/, (imageToConvert)->allocateMemory(); - if (imageToConvert->getMipMapLevel() != mipMapLevel) { + if (imageToConvert->getMipmapLevel() != mipmapLevel) { ImageParamsPtr oldParams = imageToConvert->getParams(); - assert(imageToConvert->getMipMapLevel() < mipMapLevel); + assert(imageToConvert->getMipmapLevel() < mipmapLevel); //This is the bounds of the upscaled image RectI imgToConvertBounds = imageToConvert->getBounds(); @@ -1734,7 +1734,7 @@ EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/, //The rodParam might be different of oldParams->getRoD() simply because the RoD is dependent on the mipmap level const RectD & rod = rodParam ? *rodParam : oldParams->getRoD(); - RectI downscaledBounds = rod.toPixelEnclosing(mipMapLevel, imageToConvert->getPixelAspectRatio()); + RectI downscaledBounds = rod.toPixelEnclosing(mipmapLevel, imageToConvert->getPixelAspectRatio()); if (boundsParam) { downscaledBounds.merge(*boundsParam); @@ -1743,7 +1743,7 @@ EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/, ImageParamsPtr imageParams = Image::makeParams(rod, downscaledBounds, oldParams->getPixelAspectRatio(), - mipMapLevel, + mipmapLevel, oldParams->isRodProjectFormat(), oldParams->getComponents(), oldParams->getBitDepth(), @@ -1752,8 +1752,6 @@ EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/, eStorageModeRAM); - imageParams->setMipMapLevel(mipMapLevel); - ImagePtr img; getOrCreateFromCacheInternal(key, imageParams, imageToConvert->usesBitMap(), &img); @@ -1768,16 +1766,16 @@ EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/, of the downscale image, clip it against the bounds of the downscale image, re-upscale it to the original mipmap level and ensure that it lies into the original image bounds */ - int downscaleLevels = img->getMipMapLevel() - imageToConvert->getMipMapLevel(); + int downscaleLevels = img->getMipmapLevel() - imageToConvert->getMipmapLevel(); RectI dstRoi = imgToConvertBounds.downscalePowerOfTwoSmallestEnclosing(downscaleLevels); dstRoi.clipIfOverlaps(downscaledBounds); dstRoi = dstRoi.upscalePowerOfTwo(downscaleLevels); dstRoi.clipIfOverlaps(imgToConvertBounds); if (imgToConvertBounds.area() > 1) { - imageToConvert->downscaleMipMap( rod, + imageToConvert->downscaleMipmap( rod, dstRoi, - imageToConvert->getMipMapLevel(), img->getMipMapLevel(), + imageToConvert->getMipmapLevel(), img->getMipmapLevel(), imageToConvert->usesBitMap(), img.get() ); } else { @@ -2060,10 +2058,11 @@ EffectInstance::transformInputRois(const EffectInstance* self, invertTransform = Transform::matInverse(*it->second.cat, det); } - Transform::Matrix3x3 canonicalToPixel = Transform::matCanonicalToPixel(par, scale.x, - scale.y, false); - Transform::Matrix3x3 pixelToCanonical = Transform::matPixelToCanonical(par, scale.x, - scale.y, false); + const auto scalePt = scale.toOfxPointD(); + Transform::Matrix3x3 canonicalToPixel = Transform::matCanonicalToPixel(par, scalePt.x, + scalePt.y, false); + Transform::Matrix3x3 pixelToCanonical = Transform::matPixelToCanonical(par, scalePt.x, + scalePt.y, false); invertTransform = Transform::matMul(Transform::matMul(pixelToCanonical, invertTransform), canonicalToPixel); Transform::transformRegionFromRoD(foundRoI->second, invertTransform, transformedRenderWindow); @@ -2084,7 +2083,7 @@ EffectInstance::renderInputImagesForRoI(const FrameViewRequest* request, const RectD & rod, const RectD & canonicalRenderWindow, const InputMatrixMapPtr& inputTransforms, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const RenderScale & renderMappedScale, bool useScaleOneInputImages, bool byPassCache, @@ -2111,7 +2110,7 @@ EffectInstance::renderInputImagesForRoI(const FrameViewRequest* request, inputTransforms, useTransforms, renderStorageMode, - mipMapLevel, + mipmapLevel, time, view, NodePtr(), @@ -2145,8 +2144,8 @@ EffectInstance::Implementation::tiledRenderingFunctor(EffectInstance::Implementa args.firstFrame, args.lastFrame, args.preferredInput, - args.mipMapLevel, - args.renderMappedMipMapLevel, + args.mipmapLevel, + args.renderMappedMipmapLevel, args.rod, args.time, args.view, @@ -2172,8 +2171,8 @@ EffectInstance::Implementation::tiledRenderingFunctor(const RectToRender & rectT const int firstFrame, const int lastFrame, const int preferredInput, - const unsigned int mipMapLevel, - const unsigned int renderMappedMipMapLevel, + const unsigned int mipmapLevel, + const unsigned int renderMappedMipmapLevel, const RectD & rod, const double time, const ViewIdx view, @@ -2207,15 +2206,15 @@ EffectInstance::Implementation::tiledRenderingFunctor(const RectToRender & rectT RectI renderMappedRectToRender = rectToRender.rect; /* - * downscaledRectToRender is in the mipMapLevel + * downscaledRectToRender is in the mipmapLevel */ RectI downscaledRectToRender = renderMappedRectToRender; ///Upscale the RoI to a region in the full scale image so it is in canonical coordinates if (renderFullScaleThenDownscale) { - assert(mipMapLevel > 0 && renderMappedMipMapLevel != mipMapLevel); - downscaledRectToRender = renderMappedRectToRender.toNewMipMapLevel(renderMappedMipMapLevel, mipMapLevel, par, rod); + assert(mipmapLevel > 0 && renderMappedMipmapLevel != mipmapLevel); + downscaledRectToRender = renderMappedRectToRender.toNewMipmapLevel(renderMappedMipmapLevel, mipmapLevel, par, rod); } // at this point, it may be unnecessary to call render because it was done a long time ago => check the bitmap here! @@ -2275,10 +2274,10 @@ EffectInstance::Implementation::tiledRenderingFunctor(const RectToRender & rectT } #ifndef NDEBUG - RenderScale scale( Image::getScaleFromMipMapLevel(mipMapLevel) ); + RenderScale scale = RenderScale::fromMipmapLevel(mipmapLevel); // check the dimensions of all input and output images const RectD & dstRodCanonical = firstPlaneToRender.renderMappedImage->getRoD(); - const RectI dstBounds = dstRodCanonical.toPixelEnclosing(firstPlaneToRender.renderMappedImage->getMipMapLevel(), par); // compute dstRod at level 0 + const RectI dstBounds = dstRodCanonical.toPixelEnclosing(firstPlaneToRender.renderMappedImage->getMipmapLevel(), par); // compute dstRod at level 0 if (!frameArgs->tilesSupported) { const RectI dstRealBounds = firstPlaneToRender.renderMappedImage->getBounds(); assert(dstRealBounds.x1 == dstBounds.x1); @@ -2292,7 +2291,7 @@ EffectInstance::Implementation::tiledRenderingFunctor(const RectToRender & rectT ++it) { for (ImageList::const_iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) { const RectD & srcRodCanonical = (*it2)->getRoD(); - const RectI srcBounds = srcRodCanonical.toPixelEnclosing( (*it2)->getMipMapLevel(), (*it2)->getPixelAspectRatio() ); // compute srcRod at level 0 + const RectI srcBounds = srcRodCanonical.toPixelEnclosing( (*it2)->getMipmapLevel(), (*it2)->getPixelAspectRatio() ); // compute srcRod at level 0 if (!frameArgs->tilesSupported) { // http://openfx.sourceforge.net/Documentation/1.3/ofxProgrammingReference.html#kOfxImageEffectPropSupportsTiles @@ -2305,7 +2304,7 @@ EffectInstance::Implementation::tiledRenderingFunctor(const RectToRender & rectT * Blur will actually retrieve the image from the cache and downscale it rather than recompute it. * Since the Writer does not support tiles, the Blur image is the full image and not a tile, which can be veryfied by * - * bounds = blurCachedImage->getRod().toPixelEnclosing(blurCachedImage->getMipMapLevel(), blurCachedImage->getPixelAspectRatio()) + * bounds = blurCachedImage->getRod().toPixelEnclosing(blurCachedImage->getMipmapLevel(), blurCachedImage->getPixelAspectRatio()) * * Since the Blur RoD changed (the RoD at mmlevel 0 is different than the ROD at mmlevel 1), * the resulting bounds of the downscaled image are not necessarily exactly result of the new downscaled RoD to the enclosing pixel @@ -2336,13 +2335,13 @@ EffectInstance::Implementation::tiledRenderingFunctor(const RectToRender & rectT } //end for if (_publicInterface->supportsRenderScaleMaybe() == eSupportsNo) { - assert(firstPlaneToRender.renderMappedImage->getMipMapLevel() == 0); - assert(renderMappedMipMapLevel == 0); + assert(firstPlaneToRender.renderMappedImage->getMipmapLevel() == 0); + assert(renderMappedMipmapLevel == 0); } #endif // !NDEBUG RenderingFunctorRetEnum handlerRet = renderHandler(tls, - mipMapLevel, + mipmapLevel, renderFullScaleThenDownscale, isSequentialRender, isRenderResponseToUserInteraction, @@ -2365,7 +2364,7 @@ EffectInstance::Implementation::tiledRenderingFunctor(const RectToRender & rectT EffectInstance::RenderingFunctorRetEnum EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, - const unsigned int mipMapLevel, + const unsigned int mipmapLevel, const bool renderFullScaleThenDownscale, const bool isSequentialRender, const bool isRenderResponseToUserInteraction, @@ -2401,10 +2400,9 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, RenderActionArgs actionArgs; actionArgs.byPassCache = byPassCache; actionArgs.processChannels = processChannels; - actionArgs.mappedScale.x = actionArgs.mappedScale.y = Image::getScaleFromMipMapLevel( firstPlane.renderMappedImage->getMipMapLevel() ); + actionArgs.mappedScale = RenderScale::fromMipmapLevel(firstPlane.renderMappedImage->getMipmapLevel()); assert(isSupportedRenderScale(_publicInterface->supportsRenderScaleMaybe(), actionArgs.mappedScale)); - actionArgs.originalScale.x = Image::getScaleFromMipMapLevel(mipMapLevel); - actionArgs.originalScale.y = actionArgs.originalScale.x; + actionArgs.originalScale = RenderScale::fromMipmapLevel(mipmapLevel); actionArgs.draftMode = frameArgs->draftMode; actionArgs.useOpenGL = planes.useOpenGL; @@ -2458,7 +2456,7 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, // scoped_ptr std::unique_ptr renderArgs( new EffectInstance::RenderRoIArgs(tls->currentRenderArgs.identityTime, actionArgs.originalScale, - mipMapLevel, + mipmapLevel, view, false, downscaledRectToRender, @@ -2501,7 +2499,7 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, std::map::iterator idIt = identityPlanes.begin(); for (std::map::iterator it = planes.planes.begin(); it != planes.planes.end(); ++it, ++idIt) { - if ( renderFullScaleThenDownscale && ( idIt->second->getMipMapLevel() > it->second.fullscaleImage->getMipMapLevel() ) ) { + if ( renderFullScaleThenDownscale && ( idIt->second->getMipmapLevel() > it->second.fullscaleImage->getMipmapLevel() ) ) { // We cannot be rendering using OpenGL in this case assert(!planes.useOpenGL); @@ -2517,7 +2515,7 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, sourceImage = std::make_shared(it->second.fullscaleImage->getComponents(), idIt->second->getRoD(), idIt->second->getBounds(), - idIt->second->getMipMapLevel(), + idIt->second->getMipmapLevel(), idIt->second->getPixelAspectRatio(), it->second.fullscaleImage->getBitDepth(), idIt->second->getPremultiplication(), @@ -2533,17 +2531,17 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, ///then upscale const RectD & rod = sourceImage->getRoD(); - const RectI bounds = rod.toPixelEnclosing(it->second.renderMappedImage->getMipMapLevel(), it->second.renderMappedImage->getPixelAspectRatio()); + const RectI bounds = rod.toPixelEnclosing(it->second.renderMappedImage->getMipmapLevel(), it->second.renderMappedImage->getPixelAspectRatio()); ImagePtr inputPlane = std::make_shared(it->first, rod, bounds, - it->second.renderMappedImage->getMipMapLevel(), + it->second.renderMappedImage->getMipmapLevel(), it->second.renderMappedImage->getPixelAspectRatio(), it->second.renderMappedImage->getBitDepth(), it->second.renderMappedImage->getPremultiplication(), it->second.renderMappedImage->getFieldingOrder(), false); - sourceImage->upscaleMipMap( sourceImage->getBounds(), sourceImage->getMipMapLevel(), inputPlane->getMipMapLevel(), inputPlane.get() ); + sourceImage->upscaleMipmap( sourceImage->getBounds(), sourceImage->getMipmapLevel(), inputPlane->getMipmapLevel(), inputPlane.get() ); it->second.fullscaleImage->pasteFrom(*inputPlane, renderMappedRectToRender, false); } else { if ( !idIt->second->getBounds().contains(downscaledRectToRender) ) { @@ -2592,7 +2590,7 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, it->second.tmpImage = std::make_shared(prefComp, it->second.renderMappedImage->getRoD(), actionArgs.roi, - it->second.renderMappedImage->getMipMapLevel(), + it->second.renderMappedImage->getMipmapLevel(), it->second.renderMappedImage->getPixelAspectRatio(), outputClipPrefDepth, it->second.renderMappedImage->getPremultiplication(), @@ -2776,19 +2774,19 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, assert(!planes.useOpenGL); ///copy the rectangle rendered in the full scale image to the downscaled output - assert(mipMapLevel != 0); + assert(mipmapLevel != 0); assert(it->second.fullscaleImage != it->second.downscaleImage && it->second.renderMappedImage == it->second.fullscaleImage); ImagePtr mappedOriginalInputImage = originalInputImage; - if ( originalInputImage && (originalInputImage->getMipMapLevel() != 0) ) { + if ( originalInputImage && (originalInputImage->getMipmapLevel() != 0) ) { bool mustCopyUnprocessedChannels = it->second.tmpImage->canCallCopyUnProcessedChannels(processChannels); if (mustCopyUnprocessedChannels || useMaskMix) { ///there is some processing to be done by copyUnProcessedChannels or applyMaskMix - ///but originalInputImage is not in the correct mipMapLevel, upscale it - assert(originalInputImage->getMipMapLevel() > it->second.tmpImage->getMipMapLevel() && - originalInputImage->getMipMapLevel() == mipMapLevel); + ///but originalInputImage is not in the correct mipmapLevel, upscale it + assert(originalInputImage->getMipmapLevel() > it->second.tmpImage->getMipmapLevel() && + originalInputImage->getMipmapLevel() == mipmapLevel); ImagePtr tmp = std::make_shared(it->second.tmpImage->getComponents(), it->second.tmpImage->getRoD(), renderMappedRectToRender, @@ -2798,7 +2796,7 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, it->second.tmpImage->getPremultiplication(), it->second.tmpImage->getFieldingOrder(), false); - originalInputImage->upscaleMipMap( downscaledRectToRender, originalInputImage->getMipMapLevel(), 0, tmp.get() ); + originalInputImage->upscaleMipmap( downscaledRectToRender, originalInputImage->getMipmapLevel(), 0, tmp.get() ); mappedOriginalInputImage = tmp; } } @@ -2818,7 +2816,7 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, ImagePtr tmp( new Image(it->second.fullscaleImage->getComponents(), it->second.tmpImage->getRoD(), renderMappedRectToRender, - mipMapLevel, + mipmapLevel, it->second.tmpImage->getPixelAspectRatio(), it->second.fullscaleImage->getBitDepth(), it->second.fullscaleImage->getPremultiplication(), @@ -2828,7 +2826,7 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, ImagePtr tmp = std::make_shared(it->second.fullscaleImage->getComponents(), it->second.tmpImage->getRoD(), renderMappedRectToRender, - mipMapLevel, + mipmapLevel, it->second.tmpImage->getPixelAspectRatio(), it->second.fullscaleImage->getBitDepth(), it->second.fullscaleImage->getPremultiplication(), @@ -2840,15 +2838,15 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, _publicInterface->getApp()->getDefaultColorSpaceForBitDepth( it->second.tmpImage->getBitDepth() ), _publicInterface->getApp()->getDefaultColorSpaceForBitDepth( it->second.fullscaleImage->getBitDepth() ), -1, false, unPremultRequired, tmp.get() ); - tmp->downscaleMipMap( it->second.tmpImage->getRoD(), - renderMappedRectToRender, 0, mipMapLevel, false, it->second.downscaleImage.get() ); + tmp->downscaleMipmap( it->second.tmpImage->getRoD(), + renderMappedRectToRender, 0, mipmapLevel, false, it->second.downscaleImage.get() ); it->second.fullscaleImage->pasteFrom(*tmp, renderMappedRectToRender, false); } else { /* * Downscaling required only */ - it->second.tmpImage->downscaleMipMap( it->second.tmpImage->getRoD(), - actionArgs.roi, 0, mipMapLevel, false, it->second.downscaleImage.get() ); + it->second.tmpImage->downscaleMipmap( it->second.tmpImage->getRoD(), + actionArgs.roi, 0, mipmapLevel, false, it->second.downscaleImage.get() ); if (it->second.tmpImage != it->second.fullscaleImage) { it->second.fullscaleImage->pasteFrom(*(it->second.tmpImage), renderMappedRectToRender, false); } @@ -2938,7 +2936,7 @@ EffectInstance::allocateImagePlaneAndSetInThreadLocalStorage(const ImagePlaneDes img->getPremultiplication(), img->getFieldingOrder(), img->getPixelAspectRatio(), - img->getMipMapLevel(), + img->getMipmapLevel(), false, img->getParams()->getStorageInfo().mode, useCache, @@ -2958,7 +2956,7 @@ EffectInstance::allocateImagePlaneAndSetInThreadLocalStorage(const ImagePlaneDes p.tmpImage.reset( new Image(p.renderMappedImage->getComponents(), p.renderMappedImage->getRoD(), tls->currentRenderArgs.renderWindowPixel, - p.renderMappedImage->getMipMapLevel(), + p.renderMappedImage->getMipmapLevel(), p.renderMappedImage->getPixelAspectRatio(), p.renderMappedImage->getBitDepth(), p.renderMappedImage->getPremultiplication(), @@ -2969,7 +2967,7 @@ EffectInstance::allocateImagePlaneAndSetInThreadLocalStorage(const ImagePlaneDes p.tmpImage = std::make_shared(p.renderMappedImage->getComponents(), p.renderMappedImage->getRoD(), tls->currentRenderArgs.renderWindowPixel, - p.renderMappedImage->getMipMapLevel(), + p.renderMappedImage->getMipmapLevel(), p.renderMappedImage->getPixelAspectRatio(), p.renderMappedImage->getBitDepth(), p.renderMappedImage->getPremultiplication(), @@ -3303,7 +3301,7 @@ EffectInstance::drawOverlay_public(double time, RenderScale actualScale; if ( !canHandleRenderScaleForOverlays() ) { - actualScale.x = actualScale.y = 1.; + actualScale = RenderScale::identity; } else { actualScale = renderScale; } @@ -3335,7 +3333,7 @@ EffectInstance::onOverlayPenDown_public(double time, RenderScale actualScale; if ( !canHandleRenderScaleForOverlays() ) { - actualScale.x = actualScale.y = 1.; + actualScale = RenderScale::identity; } else { actualScale = renderScale; } @@ -3379,7 +3377,7 @@ EffectInstance::onOverlayPenDoubleClicked_public(double time, RenderScale actualScale; if ( !canHandleRenderScaleForOverlays() ) { - actualScale.x = actualScale.y = 1.; + actualScale = RenderScale::identity; } else { actualScale = renderScale; } @@ -3425,7 +3423,7 @@ EffectInstance::onOverlayPenMotion_public(double time, RenderScale actualScale; if ( !canHandleRenderScaleForOverlays() ) { - actualScale.x = actualScale.y = 1.; + actualScale = RenderScale::identity; } else { actualScale = renderScale; } @@ -3471,7 +3469,7 @@ EffectInstance::onOverlayPenUp_public(double time, RenderScale actualScale; if ( !canHandleRenderScaleForOverlays() ) { - actualScale.x = actualScale.y = 1.; + actualScale = RenderScale::identity; } else { actualScale = renderScale; } @@ -3515,7 +3513,7 @@ EffectInstance::onOverlayKeyDown_public(double time, RenderScale actualScale; if ( !canHandleRenderScaleForOverlays() ) { - actualScale.x = actualScale.y = 1.; + actualScale = RenderScale::identity; } else { actualScale = renderScale; } @@ -3551,7 +3549,7 @@ EffectInstance::onOverlayKeyUp_public(double time, RenderScale actualScale; if ( !canHandleRenderScaleForOverlays() ) { - actualScale.x = actualScale.y = 1.; + actualScale = RenderScale::identity; } else { actualScale = renderScale; } @@ -3587,7 +3585,7 @@ EffectInstance::onOverlayKeyRepeat_public(double time, RenderScale actualScale; if ( !canHandleRenderScaleForOverlays() ) { - actualScale.x = actualScale.y = 1.; + actualScale = RenderScale::identity; } else { actualScale = renderScale; } @@ -3620,7 +3618,7 @@ EffectInstance::onOverlayFocusGained_public(double time, RenderScale actualScale; if ( !canHandleRenderScaleForOverlays() ) { - actualScale.x = actualScale.y = 1.; + actualScale = RenderScale::identity; } else { actualScale = renderScale; } @@ -3654,7 +3652,7 @@ EffectInstance::onOverlayFocusLost_public(double time, RenderScale actualScale; if ( !canHandleRenderScaleForOverlays() ) { - actualScale.x = actualScale.y = 1.; + actualScale = RenderScale::identity; } else { actualScale = renderScale; } @@ -3815,8 +3813,8 @@ EffectInstance::getRegionOfDefinitionFromCache(U64 hash, RectD* rod, bool* isProjectFormat) { - unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); - bool foundInCache = _imp->actionsCache->getRoDResult(hash, time, view, mipMapLevel, rod); + unsigned int mipmapLevel = scale.toMipmapLevel(); + bool foundInCache = _imp->actionsCache->getRoDResult(hash, time, view, mipmapLevel, rod); if (foundInCache) { if (isProjectFormat) { @@ -3844,8 +3842,8 @@ EffectInstance::getRegionOfDefinition_public(U64 hash, return eStatusFailed; } - unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); - bool foundInCache = _imp->actionsCache->getRoDResult(hash, time, view, mipMapLevel, rod); + unsigned int mipmapLevel = scale.toMipmapLevel(); + bool foundInCache = _imp->actionsCache->getRoDResult(hash, time, view, mipmapLevel, rod); if (foundInCache) { if (isProjectFormat) { *isProjectFormat = false; @@ -3881,18 +3879,17 @@ EffectInstance::getRegionOfDefinition_public(U64 hash, } StatusEnum ret; - RenderScale scaleOne(1.); { RECURSIVE_ACTION(); - ret = getRegionOfDefinition(hash, time, supportsRenderScaleMaybe() == eSupportsNo ? scaleOne : scale, view, rod); + ret = getRegionOfDefinition(hash, time, supportsRenderScaleMaybe() == eSupportsNo ? RenderScale::identity : scale, view, rod); if ( (ret != eStatusOK) && (ret != eStatusReplyDefault) ) { // rod is not valid //if (!isDuringStrokeCreation) { _imp->actionsCache->invalidateAll(hash); - _imp->actionsCache->setRoDResult( hash, time, view, mipMapLevel, RectD() ); + _imp->actionsCache->setRoDResult( hash, time, view, mipmapLevel, RectD() ); // } return ret; @@ -3900,7 +3897,7 @@ EffectInstance::getRegionOfDefinition_public(U64 hash, if ( rod->isNull() ) { // RoD is empty, which means output is black and transparent - _imp->actionsCache->setRoDResult( hash, time, view, mipMapLevel, RectD() ); + _imp->actionsCache->setRoDResult( hash, time, view, mipmapLevel, RectD() ); return ret; } @@ -3914,7 +3911,7 @@ EffectInstance::getRegionOfDefinition_public(U64 hash, assert(rod->x1 <= rod->x2 && rod->y1 <= rod->y2); //if (!isDuringStrokeCreation) { - _imp->actionsCache->setRoDResult(hash, time, view, mipMapLevel, *rod); + _imp->actionsCache->setRoDResult(hash, time, view, mipmapLevel, *rod); //} return ret; @@ -3940,11 +3937,11 @@ FramesNeededMap EffectInstance::getFramesNeeded_public(U64 hash, double time, ViewIdx view, - unsigned int mipMapLevel) + unsigned int mipmapLevel) { NON_RECURSIVE_ACTION(); FramesNeededMap framesNeeded; - bool foundInCache = _imp->actionsCache->getFramesNeededResult(hash, time, view, mipMapLevel, &framesNeeded); + bool foundInCache = _imp->actionsCache->getFramesNeededResult(hash, time, view, mipmapLevel, &framesNeeded); if (foundInCache) { return framesNeeded; } @@ -3957,7 +3954,7 @@ EffectInstance::getFramesNeeded_public(U64 hash, } } - _imp->actionsCache->setFramesNeededResult(hash, time, view, mipMapLevel, framesNeeded); + _imp->actionsCache->setFramesNeededResult(hash, time, view, mipmapLevel, framesNeeded); return framesNeeded; } @@ -4643,11 +4640,10 @@ EffectInstance::redrawOverlayInteract() RenderScale EffectInstance::getOverlayInteractRenderScale() const { - RenderScale renderScale(1.); + RenderScale renderScale; if (isDoingInteractAction() && _imp->overlaysViewport) { - unsigned int mmLevel = _imp->overlaysViewport->getCurrentRenderScale(); - renderScale.x = renderScale.y = Image::getScaleFromMipMapLevel(mmLevel); + renderScale = RenderScale::fromMipmapLevel(_imp->overlaysViewport->getCurrentMipmapLevel()); } return renderScale; @@ -5070,7 +5066,6 @@ EffectInstancePtr EffectInstance::getNearestNonIdentity(double time) { U64 hash = getRenderHash(); - RenderScale scale(1.); Format frmt; getApp()->getProject()->getProjectDefaultFormat(&frmt); @@ -5078,7 +5073,7 @@ EffectInstance::getNearestNonIdentity(double time) double inputTimeIdentity; int inputNbIdentity; ViewIdx inputView; - if ( !isIdentity_public(true, hash, time, scale, frmt, ViewIdx(0), &inputTimeIdentity, &inputView, &inputNbIdentity) ) { + if ( !isIdentity_public(true, hash, time, RenderScale::identity, frmt, ViewIdx(0), &inputTimeIdentity, &inputView, &inputNbIdentity) ) { return shared_from_this(); } else { if (inputNbIdentity < 0) { diff --git a/Engine/EffectInstance.h b/Engine/EffectInstance.h index b50e56c580..613b5c9821 100644 --- a/Engine/EffectInstance.h +++ b/Engine/EffectInstance.h @@ -39,6 +39,7 @@ #include "Engine/Knob.h" // for KnobHolder #include "Engine/RectD.h" #include "Engine/RectI.h" +#include "Engine/RenderScale.h" #include "Engine/RenderStats.h" #include "Engine/EngineFwd.h" #include "Engine/ParallelRenderArgs.h" @@ -133,7 +134,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON double time; //< the time at which to render RenderScale scale; //< the scale at which to render - unsigned int mipMapLevel; //< the mipmap level (redundant with the scale, stored here to avoid refetching it everytimes) + unsigned int mipmapLevel; //< the mipmap level (redundant with the scale, stored here to avoid refetching it everytimes) ViewIdx view; //< the view to render RectI roi; //< the renderWindow (in pixel coordinates) , watch out OpenFX action getRegionsOfInterest expects canonical coords! RectD preComputedRoD; //< pre-computed region of definition in canonical coordinates for this effect to speed-up the call to renderRoi @@ -158,8 +159,8 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON RenderRoIArgs() : time(0) - , scale(1.) - , mipMapLevel(0) + , scale() + , mipmapLevel(0) , view(0) , roi() , preComputedRoD() @@ -177,7 +178,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON RenderRoIArgs( double time_, const RenderScale & scale_, - unsigned int mipMapLevel_, + unsigned int mipmapLevel_, ViewIdx view_, bool byPassCache_, const RectI & roi_, @@ -191,7 +192,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON const EffectInstance::InputImagesMap & inputImages = EffectInstance::InputImagesMap() ) : time(time_) , scale(scale_) - , mipMapLevel(mipMapLevel_) + , mipmapLevel(mipmapLevel_) , view(view_) , roi(roi_) , preComputedRoD(preComputedRoD_) @@ -579,7 +580,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON StorageModeEnum storage, StorageModeEnum returnStorage, const ImageKey & key, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const RectI* boundsParam, const RectD* rodParam, const RectI& roi, @@ -686,7 +687,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON static StatusEnum getInputsRoIsFunctor(bool useTransforms, double time, ViewIdx view, - unsigned originalMipMapLevel, + unsigned originalMipmapLevel, const NodePtr & node, const NodePtr& callerNode, const NodePtr & treeRoot, @@ -700,7 +701,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON **/ static StatusEnum computeRequestPass(double time, ViewIdx view, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const RectD & renderWindow, const NodePtr & treeRoot, FrameRequestMap & request); @@ -713,7 +714,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON const InputMatrixMapPtr & reroutesMap, bool useTransforms, // roi functor specific StorageModeEnum renderStorageMode, // The storage of the image returned by the current Render - unsigned int originalMipMapLevel, // roi functor specific + unsigned int originalMipmapLevel, // roi functor specific double time, ViewIdx view, const NodePtr & treeRoot, @@ -1132,7 +1133,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON **/ static bool isSupportedRenderScale(SupportsEnum supportsRS, const RenderScale renderScale) { - return (supportsRS != eSupportsNo) || (renderScale.x == 1. && renderScale.y == 1.); + return (supportsRS != eSupportsNo) || (renderScale == RenderScale::identity); } public: @@ -1161,7 +1162,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON ViewIdx view, RoIMap* ret); - FramesNeededMap getFramesNeeded_public(U64 hash, double time, ViewIdx view, unsigned int mipMapLevel) WARN_UNUSED_RETURN; + FramesNeededMap getFramesNeeded_public(U64 hash, double time, ViewIdx view, unsigned int mipmapLevel) WARN_UNUSED_RETURN; void getFrameRange_public(U64 hash, double *first, double *last, bool bypasscache = false); @@ -2122,7 +2123,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON * @brief The internal of renderRoI, mainly it calls render and handles the thread safety of the effect. * @param time The time at which to render * @param scale The scale at which to render - * @param mipMapLevel Redundant with scale + * @param mipmapLevel Redundant with scale * @param view The view on which to render * @param renderWindow The rectangle to render of the image, in pixel coordinates * @param cachedImgParams The parameters of the image to render as they are in the cache. @@ -2147,7 +2148,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON double time, const ParallelRenderArgsPtr & frameArgs, RenderSafetyEnum safety, - unsigned int mipMapLevel, + unsigned int mipmapLevel, ViewIdx view, const RectD & rod, //!< rod in canonical coordinates const double par, @@ -2172,7 +2173,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON const RectD & rod, const RectD & canonicalRenderWindow, const InputMatrixMapPtr & transformMatrix, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const RenderScale & renderMappedScale, bool useScaleOneInputImages, bool byPassCache, diff --git a/Engine/EffectInstancePrivate.cpp b/Engine/EffectInstancePrivate.cpp index 11c6fda279..06c5bdf2ec 100644 --- a/Engine/EffectInstancePrivate.cpp +++ b/Engine/EffectInstancePrivate.cpp @@ -116,7 +116,7 @@ ActionsCache::getIdentityResult(U64 hash, ActionKey key; key.time = time; key.view = view; - key.mipMapLevel = 0; + key.mipmapLevel = 0; IdentityCacheMap::const_iterator found = it->_identityCache.find(key); if ( found != it->_identityCache.end() ) { @@ -148,7 +148,7 @@ ActionsCache::setIdentityResult(U64 hash, key.time = time; key.view = view; - key.mipMapLevel = 0; + key.mipmapLevel = 0; IdentityResults & v = cache._identityCache[key]; v.inputIdentityNb = inputNbIdentity; @@ -167,7 +167,7 @@ ActionsCache::getComponentsNeededResults(U64 hash, double time, ViewIdx view, Ef ActionKey key; key.time = time; key.view = view; - key.mipMapLevel = 0; + key.mipmapLevel = 0; ComponentsNeededCacheMap::const_iterator found = it->_componentsNeededCache.find(key); if ( found != it->_componentsNeededCache.end() ) { @@ -200,7 +200,7 @@ ActionsCache::setComponentsNeededResults(U64 hash, double time, ViewIdx view, co key.time = time; key.view = view; - key.mipMapLevel = 0; + key.mipmapLevel = 0; ComponentsNeededResults & v = cache._componentsNeededCache[key]; v.neededComps = neededComps; @@ -217,7 +217,7 @@ bool ActionsCache::getRoDResult(U64 hash, double time, ViewIdx view, - unsigned int mipMapLevel, + unsigned int mipmapLevel, RectD* rod) { QMutexLocker l(&_cacheMutex); @@ -227,7 +227,7 @@ ActionsCache::getRoDResult(U64 hash, ActionKey key; key.time = time; key.view = view; - key.mipMapLevel = mipMapLevel; + key.mipmapLevel = mipmapLevel; RoDCacheMap::const_iterator found = it->_rodCache.find(key); if ( found != it->_rodCache.end() ) { @@ -247,7 +247,7 @@ void ActionsCache::setRoDResult(U64 hash, double time, ViewIdx view, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const RectD & rod) { QMutexLocker l(&_cacheMutex); @@ -256,7 +256,7 @@ ActionsCache::setRoDResult(U64 hash, key.time = time; key.view = view; - key.mipMapLevel = mipMapLevel; + key.mipmapLevel = mipmapLevel; cache._rodCache[key] = rod; } @@ -265,7 +265,7 @@ bool ActionsCache::getFramesNeededResult(U64 hash, double time, ViewIdx view, - unsigned int mipMapLevel, + unsigned int mipmapLevel, FramesNeededMap* framesNeeded) { QMutexLocker l(&_cacheMutex); @@ -275,7 +275,7 @@ ActionsCache::getFramesNeededResult(U64 hash, ActionKey key; key.time = time; key.view = view; - key.mipMapLevel = mipMapLevel; + key.mipmapLevel = mipmapLevel; FramesNeededCacheMap::const_iterator found = it->_framesNeededCache.find(key); if ( found != it->_framesNeededCache.end() ) { @@ -295,7 +295,7 @@ void ActionsCache::setFramesNeededResult(U64 hash, double time, ViewIdx view, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const FramesNeededMap & framesNeeded) { QMutexLocker l(&_cacheMutex); @@ -304,7 +304,7 @@ ActionsCache::setFramesNeededResult(U64 hash, key.time = time; key.view = view; - key.mipMapLevel = mipMapLevel; + key.mipmapLevel = mipmapLevel; cache._framesNeededCache[key] = framesNeeded; } diff --git a/Engine/EffectInstancePrivate.h b/Engine/EffectInstancePrivate.h index 6dc3b3a657..5f767ff6a1 100644 --- a/Engine/EffectInstancePrivate.h +++ b/Engine/EffectInstancePrivate.h @@ -56,7 +56,7 @@ struct ActionKey { double time; ViewIdx view; - unsigned int mipMapLevel; + unsigned int mipmapLevel; }; struct IdentityResults @@ -85,9 +85,9 @@ struct CompareActionsCacheKeys if (lhs.time < rhs.time) { return true; } else if (lhs.time == rhs.time) { - if (lhs.mipMapLevel < rhs.mipMapLevel) { + if (lhs.mipmapLevel < rhs.mipmapLevel) { return true; - } else if (lhs.mipMapLevel == rhs.mipMapLevel) { + } else if (lhs.mipmapLevel == rhs.mipmapLevel) { if (lhs.view < rhs.view) { return true; } else { @@ -135,13 +135,13 @@ class ActionsCache void setComponentsNeededResults(U64 hash, double time, ViewIdx view, const EffectInstance::ComponentsNeededMap& neededComps, std::bitset<4> processChannels, bool processAll, const std::list& passThroughPlanes,int passThroughInputNb, ViewIdx passThroughView, double passThroughTime); - bool getRoDResult(U64 hash, double time, ViewIdx view, unsigned int mipMapLevel, RectD* rod); + bool getRoDResult(U64 hash, double time, ViewIdx view, unsigned int mipmapLevel, RectD* rod); - void setRoDResult(U64 hash, double time, ViewIdx view, unsigned int mipMapLevel, const RectD & rod); + void setRoDResult(U64 hash, double time, ViewIdx view, unsigned int mipmapLevel, const RectD & rod); - bool getFramesNeededResult(U64 hash, double time, ViewIdx view, unsigned int mipMapLevel, FramesNeededMap* framesNeeded); + bool getFramesNeededResult(U64 hash, double time, ViewIdx view, unsigned int mipmapLevel, FramesNeededMap* framesNeeded); - void setFramesNeededResult(U64 hash, double time, ViewIdx view, unsigned int mipMapLevel, const FramesNeededMap & framesNeeded); + void setFramesNeededResult(U64 hash, double time, ViewIdx view, unsigned int mipmapLevel, const FramesNeededMap & framesNeeded); bool getTimeDomainResult(U64 hash, double *first, double* last); @@ -280,11 +280,11 @@ class EffectInstance::Implementation - OfxClipInstance::getImage * * We don't provide these datas for the getRegionOfDefinition with these render args because this action can be called way - * prior we have all the other parameters. getRegionOfDefinition only needs the current render view and mipMapLevel if it is + * prior we have all the other parameters. getRegionOfDefinition only needs the current render view and mipmapLevel if it is * called on a render thread or during an analysis. We provide it by setting those 2 parameters directly on a thread-storage * object local to the clip. * - * For getImage, all the ScopedRenderArgs are active (except for analysis). The view and mipMapLevel parameters will be retrieved + * For getImage, all the ScopedRenderArgs are active (except for analysis). The view and mipmapLevel parameters will be retrieved * on the clip that needs the image. All the other parameters will be retrieved in EffectInstance::getImage on the ScopedRenderArgs. * * During an analysis effect we don't set any ScopedRenderArgs and call some actions recursively if needed. @@ -330,8 +330,8 @@ class EffectInstance::Implementation int firstFrame; int lastFrame; int preferredInput; - unsigned int mipMapLevel; - unsigned int renderMappedMipMapLevel; + unsigned int mipmapLevel; + unsigned int renderMappedMipmapLevel; RectD rod; double time; ViewIdx view; @@ -353,8 +353,8 @@ class EffectInstance::Implementation const bool isRenderResponseToUserInteraction, const int firstFrame, const int lastFrame, const int preferredInput, - const unsigned int mipMapLevel, - const unsigned int renderMappedMipMapLevel, + const unsigned int mipmapLevel, + const unsigned int renderMappedMipmapLevel, const RectD & rod, const double time, const ViewIdx view, @@ -389,7 +389,7 @@ class EffectInstance::Implementation /// * renderMappedImage points to fullScaleMappedImage /// * We render in fullScaledMappedImage, then convert into "image" and then downscale into downscaledImage. RenderingFunctorRetEnum renderHandler(const EffectTLSDataPtr& tls, - const unsigned int mipMapLevel, + const unsigned int mipmapLevel, const bool renderFullScaleThenDownscale, const bool isSequentialRender, const bool isRenderResponseToUserInteraction, diff --git a/Engine/EffectInstanceRenderRoI.cpp b/Engine/EffectInstanceRenderRoI.cpp index f6cf358752..42c0802593 100644 --- a/Engine/EffectInstanceRenderRoI.cpp +++ b/Engine/EffectInstanceRenderRoI.cpp @@ -183,7 +183,7 @@ EffectInstance::convertPlanesFormatsIfNeeded(const AppInstancePtr& app, ImagePtr tmp( new Image(targetComponents, inputImage->getRoD(), bounds, - inputImage->getMipMapLevel(), + inputImage->getMipmapLevel(), inputImage->getPixelAspectRatio(), targetDepth, inputImage->getPremultiplication(), @@ -193,7 +193,7 @@ EffectInstance::convertPlanesFormatsIfNeeded(const AppInstancePtr& app, ImagePtr tmp = std::make_shared(targetComponents, inputImage->getRoD(), bounds, - inputImage->getMipMapLevel(), + inputImage->getMipmapLevel(), inputImage->getPixelAspectRatio(), targetDepth, inputImage->getPremultiplication(), @@ -374,19 +374,19 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, const double par = getAspectRatio(-1); const ImageFieldingOrderEnum fieldingOrder = getFieldingOrder(); const ImagePremultiplicationEnum thisEffectOutputPremult = getPremult(); - const unsigned int mipMapLevel = args.mipMapLevel; + const unsigned int mipmapLevel = args.mipmapLevel; SupportsEnum supportsRS = supportsRenderScaleMaybe(); - ///This flag is relevant only when the mipMapLevel is different than 0. We use it to determine + ///This flag is relevant only when the mipmapLevel is different than 0. We use it to determine ///whether the plug-in should render in the full scale image, and then we downscale afterwards or ///if the plug-in can just use the downscaled image to render. - bool renderFullScaleThenDownscale = (supportsRS == eSupportsNo && mipMapLevel != 0); - unsigned int renderMappedMipMapLevel; + bool renderFullScaleThenDownscale = (supportsRS == eSupportsNo && mipmapLevel != 0); + unsigned int renderMappedMipmapLevel; if (renderFullScaleThenDownscale) { - renderMappedMipMapLevel = 0; + renderMappedMipmapLevel = 0; } else { - renderMappedMipMapLevel = args.mipMapLevel; + renderMappedMipmapLevel = args.mipmapLevel; } - RenderScale renderMappedScale( Image::getScaleFromMipMapLevel(renderMappedMipMapLevel) ); + RenderScale renderMappedScale( RenderScale::fromMipmapLevel(renderMappedMipmapLevel) ); assert(isSupportedRenderScale(supportsRS, renderMappedScale)); @@ -421,13 +421,13 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, //Nothing to render return eRenderRoIRetCodeOk; } - if ( (supportsRS == eSupportsMaybe) && (renderMappedMipMapLevel != 0) ) { + if ( (supportsRS == eSupportsMaybe) && (renderMappedMipmapLevel != 0) ) { // supportsRenderScaleMaybe may have changed, update it supportsRS = supportsRenderScaleMaybe(); - renderFullScaleThenDownscale = (supportsRS == eSupportsNo && mipMapLevel != 0); + renderFullScaleThenDownscale = (supportsRS == eSupportsNo && mipmapLevel != 0); if (renderFullScaleThenDownscale) { - renderMappedScale.x = renderMappedScale.y = 1.; - renderMappedMipMapLevel = 0; + renderMappedScale = RenderScale::identity; + renderMappedMipmapLevel = 0; } } } @@ -547,7 +547,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, ViewIdx inputIdentityView(args.view); assert(isSupportedRenderScale(supportsRS, renderMappedScale)); bool identity; - const RectI pixelRod = rod.toPixelEnclosing(args.mipMapLevel, par); + const RectI pixelRod = rod.toPixelEnclosing(args.mipmapLevel, par); ViewInvarianceLevel viewInvariance = isViewInvariant(); if ( (args.view != 0) && (viewInvariance == eViewInvarianceAllViewsInvariant) ) { @@ -569,11 +569,11 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, } } - if ( (supportsRS == eSupportsMaybe) && (mipMapLevel != 0) ) { + if ( (supportsRS == eSupportsMaybe) && (mipmapLevel != 0) ) { // supportsRenderScaleMaybe may have changed, update it renderFullScaleThenDownscale = true; - renderMappedScale.x = renderMappedScale.y = 1.; - renderMappedMipMapLevel = 0; + renderMappedScale = RenderScale::identity; + renderMappedMipmapLevel = 0; } if (identity) { @@ -728,40 +728,46 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////// Compute RoI depending on render scale /////////////////////////////////////////////////// - RectI downscaledImageBoundsNc = rod.toPixelEnclosing(args.mipMapLevel, par); + RectI downscaledImageBoundsNc = rod.toPixelEnclosing(args.mipmapLevel, par); RectI upscaledImageBoundsNc = rod.toPixelEnclosing(0, par); RectI roi; if (renderFullScaleThenDownscale) { //We cache 'image', hence the RoI should be expressed in its coordinates //renderRoIInternal should check the bitmap of 'image' and not downscaledImage! - roi = args.roi.toNewMipMapLevel(args.mipMapLevel, 0, par, rod); + roi = args.roi.toNewMipmapLevel(args.mipmapLevel, 0, par, rod); - if (frameArgs->tilesSupported && !roi.clipIfOverlaps(upscaledImageBoundsNc)) { - return eRenderRoIRetCodeOk; + if (frameArgs->tilesSupported) { + roi.clip(upscaledImageBoundsNc); + if (roi.isNull()) { + return eRenderRoIRetCodeOk; + } + assert(upscaledImageBoundsNc.contains(roi)); } - assert( upscaledImageBoundsNc.contains(roi)); } else { roi = args.roi; - if (frameArgs->tilesSupported && !roi.clipIfOverlaps(downscaledImageBoundsNc)) { - return eRenderRoIRetCodeOk; + if (frameArgs->tilesSupported) { + roi.clip(downscaledImageBoundsNc); + if (roi.isNull()) { + return eRenderRoIRetCodeOk; + } + assert(downscaledImageBoundsNc.contains(roi)); } - assert(downscaledImageBoundsNc.contains(roi)); } /* * Keep in memory what the user has requested, and change the roi to the full bounds if the effect doesn't support tiles */ const RectI originalRoI = roi; - // Store the mipMapLevel for originalRoI here because renderFullScaleThenDownscale may change later and we'll lose + // Store the mipmapLevel for originalRoI here because renderFullScaleThenDownscale may change later and we'll lose // the ability to recover this information when we potentially need it for a downscale operation later. - const unsigned int originalRoIMipMapLevel = renderFullScaleThenDownscale ? 0 : args.mipMapLevel; + const unsigned int originalRoIMipmapLevel = renderFullScaleThenDownscale ? 0 : args.mipmapLevel; if (frameArgs->tilesSupported) { #ifndef NATRON_ALWAYS_ALLOCATE_FULL_IMAGE_BOUNDS ///just allocate the roi - const RectI upscaledRoI = renderFullScaleThenDownscale ? roi : roi.toNewMipMapLevel(args.mipMapLevel, 0, par, rod); + const RectI upscaledRoI = renderFullScaleThenDownscale ? roi : roi.toNewMipmapLevel(args.mipmapLevel, 0, par, rod); upscaledImageBoundsNc.clipIfOverlaps(upscaledRoI); downscaledImageBoundsNc.clipIfOverlaps(args.roi); #endif @@ -771,7 +777,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, const RectI & downscaledImageBounds = downscaledImageBoundsNc; const RectI & upscaledImageBounds = upscaledImageBoundsNc; - const RectD canonicalRoI = roi.toCanonical(renderFullScaleThenDownscale ? 0 : args.mipMapLevel, par, rod); + const RectD canonicalRoI = roi.toCanonical(renderFullScaleThenDownscale ? 0 : args.mipmapLevel, par, rod); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////// End Compute RoI ///////////////////////////////////////////////////////////////////////// @@ -837,11 +843,11 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, // OpenGL renders always support render scale... if (renderFullScaleThenDownscale) { renderFullScaleThenDownscale = false; - renderMappedMipMapLevel = args.mipMapLevel; - renderMappedScale.x = renderMappedScale.y = Image::getScaleFromMipMapLevel(renderMappedMipMapLevel); + renderMappedMipmapLevel = args.mipmapLevel; + renderMappedScale = RenderScale::fromMipmapLevel(renderMappedMipmapLevel); if (frameArgs->tilesSupported) { - roi = args.roi; - if ( !roi.clipIfOverlaps(downscaledImageBoundsNc) ) { + roi = args.roi.intersect(downscaledImageBoundsNc); + if ( roi.isNull() ) { return eRenderRoIRetCodeOk; } } else { @@ -880,7 +886,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, args.view, 1., draftModeSupported && frameArgs->draftMode, - renderMappedMipMapLevel == 0 && !renderScaleOneUpstreamIfRenderScaleSupportDisabled) ); + renderMappedMipmapLevel == 0 && !renderScaleOneUpstreamIfRenderScaleSupportDisabled) ); std::unique_ptr nonDraftKey( new ImageKey(getNode().get(), nodeHash, isFrameVaryingOrAnimated, @@ -888,7 +894,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, args.view, 1., false, - renderMappedMipMapLevel == 0 && !renderScaleOneUpstreamIfRenderScaleSupportDisabled) ); + renderMappedMipmapLevel == 0 && !renderScaleOneUpstreamIfRenderScaleSupportDisabled) ); bool isDuringPaintStroke = isDuringPaintStrokeCreationThreadLocal(); @@ -940,9 +946,9 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, // If the node doesn't support render scale, first lookup the cache with requested level, if not cached then lookup // with full scale - unsigned int lookupMipMapLevel = (renderMappedMipMapLevel != mipMapLevel && !isDuringPaintStroke)? mipMapLevel : renderMappedMipMapLevel; + unsigned int lookupMipmapLevel = (renderMappedMipmapLevel != mipmapLevel && !isDuringPaintStroke)? mipmapLevel : renderMappedMipmapLevel; for (int n = 0; n < nLookups; ++n) { - getImageFromCacheAndConvertIfNeeded(createInCache, storage, args.returnStorage, n == 0 ? *nonDraftKey : *key, lookupMipMapLevel, + getImageFromCacheAndConvertIfNeeded(createInCache, storage, args.returnStorage, n == 0 ? *nonDraftKey : *key, lookupMipmapLevel, &downscaledImageBounds, &rod, args.roi, args.bitdepth, *it, @@ -956,7 +962,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, appPTR->removeFromNodeCache( key->getHash() ); plane.fullscaleImage.reset(); } - } else if (renderMappedMipMapLevel != mipMapLevel) { + } else if (renderMappedMipmapLevel != mipmapLevel) { // Only keep the cached image if it covers the roi std::list restToRender; plane.fullscaleImage->getRestToRender(args.roi, restToRender); @@ -964,17 +970,17 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, plane.fullscaleImage.reset(); } else { renderFullScaleThenDownscale = false; - renderMappedMipMapLevel = mipMapLevel; + renderMappedMipmapLevel = mipmapLevel; roi = args.roi; } } break; } } - if (!plane.fullscaleImage && renderMappedMipMapLevel != lookupMipMapLevel) { + if (!plane.fullscaleImage && renderMappedMipmapLevel != lookupMipmapLevel) { // Not found at requested mipmap level, look at full scale for (int n = 0; n < nLookups; ++n) { - getImageFromCacheAndConvertIfNeeded(createInCache, storage, args.returnStorage, n == 0 ? *nonDraftKey : *key, renderMappedMipMapLevel, + getImageFromCacheAndConvertIfNeeded(createInCache, storage, args.returnStorage, n == 0 ? *nonDraftKey : *key, renderMappedMipmapLevel, &upscaledImageBounds, &rod, roi, args.bitdepth, *it, @@ -1057,7 +1063,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, if (requestPassData) { *framesNeeded = requestPassData->globalData.frameViewsNeeded; } else { - *framesNeeded = getFramesNeeded_public(nodeHash, args.time, args.view, renderMappedMipMapLevel); + *framesNeeded = getFramesNeeded_public(nodeHash, args.time, args.view, renderMappedMipmapLevel); } } @@ -1091,7 +1097,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, lastStrokeRoD = getApp()->getLastPaintStrokeBbox(); node->clearLastPaintStrokeRoD(); // qDebug() << getScriptName_mt_safe().c_str() << "last stroke RoD: " << lastStrokeRoD.x1 << lastStrokeRoD.y1 << lastStrokeRoD.x2 << lastStrokeRoD.y2; - lastStrokePixelRoD = lastStrokeRoD.toPixelEnclosing(mipMapLevel, par); + lastStrokePixelRoD = lastStrokeRoD.toPixelEnclosing(mipmapLevel, par); } } @@ -1227,7 +1233,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, are identity over one of the input effect, thus avoiding pixels to render. */ if ( inputsIntersectionSet && (hasMask || hasDifferentRods) ) { - inputsRoDIntersectionPixel = inputsIntersection.toPixelEnclosing(mipMapLevel, par); + inputsRoDIntersectionPixel = inputsIntersection.toPixelEnclosing(mipmapLevel, par); tryIdentityOptim = true; } } @@ -1298,7 +1304,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, } RenderRoIRetCode inputCode; { - const RectD canonicalRoI = it->rect.toCanonical(renderFullScaleThenDownscale ? 0 : args.mipMapLevel, par, rod); + const RectD canonicalRoI = it->rect.toCanonical(renderFullScaleThenDownscale ? 0 : args.mipmapLevel, par, rod); inputCode = renderInputImagesForRoI(requestPassData, useTransforms, @@ -1308,7 +1314,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, rod, canonicalRoI, tls->currentRenderArgs.transformRedirections, - args.mipMapLevel, + args.mipmapLevel, renderMappedScale, renderScaleOneUpstreamIfRenderScaleSupportDisabled, byPassCache, @@ -1391,7 +1397,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, planesToRender->outputPremult, fieldingOrder, par, - args.mipMapLevel, + args.mipmapLevel, renderFullScaleThenDownscale, storage, createInCache, @@ -1448,19 +1454,19 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, it->second.fullscaleImage->clearBitmap(lastStrokePixelRoD); } - if ( renderFullScaleThenDownscale && (it->second.fullscaleImage->getMipMapLevel() == 0) ) { - const RectI bounds = rod.toPixelEnclosing(args.mipMapLevel, par); + if ( renderFullScaleThenDownscale && (it->second.fullscaleImage->getMipmapLevel() == 0) ) { + const RectI bounds = rod.toPixelEnclosing(args.mipmapLevel, par); it->second.downscaleImage = std::make_shared(*components, rod, downscaledImageBounds, - args.mipMapLevel, + args.mipmapLevel, it->second.fullscaleImage->getPixelAspectRatio(), outputDepth, planesToRender->outputPremult, fieldingOrder, true); - it->second.fullscaleImage->downscaleMipMap( rod, it->second.fullscaleImage->getBounds(), 0, args.mipMapLevel, true, it->second.downscaleImage.get() ); + it->second.fullscaleImage->downscaleMipmap( rod, it->second.fullscaleImage->getBounds(), 0, args.mipmapLevel, true, it->second.downscaleImage.get() ); } } @@ -1470,7 +1476,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, ///Subsequently the image and downscaled image are different only if the plug-in ///does not support the render scale and the proxy mode is turned on. assert( (it->second.fullscaleImage == it->second.downscaleImage && !renderFullScaleThenDownscale) || - ( ( it->second.fullscaleImage != it->second.downscaleImage || it->second.fullscaleImage->getMipMapLevel() == it->second.downscaleImage->getMipMapLevel() ) && renderFullScaleThenDownscale ) ); + ( ( it->second.fullscaleImage != it->second.downscaleImage || it->second.fullscaleImage->getMipmapLevel() == it->second.downscaleImage->getMipmapLevel() ) && renderFullScaleThenDownscale ) ); } // for each plane #if NATRON_ENABLE_TRIMAP @@ -1543,7 +1549,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, ///For eRenderSafetyFullySafe, don't take any lock, the image already has a lock on itself so we're sure it can't be written to by 2 different threads. if ( frameArgs->stats && frameArgs->stats->isInDepthProfilingEnabled() ) { - frameArgs->stats->setGlobalRenderInfosForNode(getNode(), rod, planesToRender->outputPremult, processChannels, frameArgs->tilesSupported, !renderFullScaleThenDownscale, renderMappedMipMapLevel); + frameArgs->stats->setGlobalRenderInfosForNode(getNode(), rod, planesToRender->outputPremult, processChannels, frameArgs->tilesSupported, !renderFullScaleThenDownscale, renderMappedMipmapLevel); } # ifdef DEBUG @@ -1580,7 +1586,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, args.time, frameArgs, safety, - args.mipMapLevel, + args.mipmapLevel, args.view, rod, par, @@ -1660,7 +1666,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, if (!frameArgs->tilesSupported) { //assert that bounds are consistent with the RoD if tiles are not supported const RectD & srcRodCanonical = renderFullScaleThenDownscale ? it->second.fullscaleImage->getRoD() : it->second.downscaleImage->getRoD(); - const RectI srcBounds = srcRodCanonical.toPixelEnclosing(renderFullScaleThenDownscale ? it->second.fullscaleImage->getMipMapLevel() : it->second.downscaleImage->getMipMapLevel(), par); + const RectI srcBounds = srcRodCanonical.toPixelEnclosing(renderFullScaleThenDownscale ? it->second.fullscaleImage->getMipmapLevel() : it->second.downscaleImage->getMipmapLevel(), par); const RectI srcRealBounds = renderFullScaleThenDownscale ? it->second.fullscaleImage->getBounds() : it->second.downscaleImage->getBounds(); assert(srcRealBounds.x1 == srcBounds.x1); assert(srcRealBounds.x2 == srcBounds.x2); @@ -1719,14 +1725,14 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, //We have to return the downscale image, so make sure it has been computed if ( (renderRetCode != eRenderRoIStatusRenderFailed) && renderFullScaleThenDownscale && - ( it->second.fullscaleImage->getMipMapLevel() != mipMapLevel && it->second.fullscaleImage->getStorageMode() != eStorageModeGLTex) && + ( it->second.fullscaleImage->getMipmapLevel() != mipmapLevel && it->second.fullscaleImage->getStorageMode() != eStorageModeGLTex) && !hasSomethingToRender ) { - assert(it->second.fullscaleImage->getMipMapLevel() == 0); + assert(it->second.fullscaleImage->getMipmapLevel() == 0); if (it->second.downscaleImage == it->second.fullscaleImage) { it->second.downscaleImage = std::make_shared(it->second.fullscaleImage->getComponents(), it->second.fullscaleImage->getRoD(), downscaledImageBounds, - args.mipMapLevel, + args.mipmapLevel, it->second.fullscaleImage->getPixelAspectRatio(), it->second.fullscaleImage->getBitDepth(), it->second.fullscaleImage->getPremultiplication(), @@ -1735,7 +1741,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, it->second.downscaleImage->setKey(it->second.fullscaleImage->getKey()); } - it->second.fullscaleImage->downscaleMipMap( it->second.fullscaleImage->getRoD(), originalRoI, 0, args.mipMapLevel, false, it->second.downscaleImage.get() ); + it->second.fullscaleImage->downscaleMipmap( it->second.fullscaleImage->getRoD(), originalRoI, 0, args.mipmapLevel, false, it->second.downscaleImage.get() ); } const ImagePlaneDesc* comp = 0; @@ -1753,7 +1759,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, assert(comp); ///The image might need to be converted to fit the original requested format if (comp) { - const RectI downscaledOriginalRoI = originalRoI.toNewMipMapLevel(originalRoIMipMapLevel, args.mipMapLevel, par, rod); + const RectI downscaledOriginalRoI = originalRoI.toNewMipmapLevel(originalRoIMipmapLevel, args.mipmapLevel, par, rod); it->second.downscaleImage = convertPlanesFormatsIfNeeded(getApp(), it->second.downscaleImage, downscaledOriginalRoI, *comp, args.bitdepth, useAlpha0ForRGBToRGBAConversion, planesToRender->outputPremult, -1); assert(it->second.downscaleImage->getComponents() == *comp && it->second.downscaleImage->getBitDepth() == args.bitdepth); @@ -1782,7 +1788,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, } #ifdef DEBUG - const RectI renderedImageBounds = rod.toPixelEnclosing(args.mipMapLevel, par); + const RectI renderedImageBounds = rod.toPixelEnclosing(args.mipmapLevel, par); const RectI expectedContainedRoI = args.roi.intersect(renderedImageBounds); if ( !it->second.downscaleImage->getBounds().contains(expectedContainedRoI) ) { qDebug() << "[WARNING]:" << getScriptName_mt_safe().c_str() << "rendered an image with an RoI that fell outside its bounds."; @@ -1821,7 +1827,7 @@ EffectInstance::renderRoIInternal(EffectInstance* self, double time, const ParallelRenderArgsPtr & frameArgs, RenderSafetyEnum safety, - unsigned int mipMapLevel, + unsigned int mipmapLevel, ViewIdx view, const RectD & rod, //!< effect rod in canonical coords const double par, @@ -1855,16 +1861,16 @@ EffectInstance::renderRoIInternal(EffectInstance* self, self->getApp()->getProject()->setOrAddProjectFormat(frmt); } - unsigned int renderMappedMipMapLevel = 0; + unsigned int renderMappedMipmapLevel = 0; for (std::map::iterator it = planesToRender->planes.begin(); it != planesToRender->planes.end(); ++it) { it->second.renderMappedImage = renderFullScaleThenDownscale ? it->second.fullscaleImage : it->second.downscaleImage; if ( it == planesToRender->planes.begin() ) { - renderMappedMipMapLevel = it->second.renderMappedImage->getMipMapLevel(); + renderMappedMipmapLevel = it->second.renderMappedImage->getMipmapLevel(); } } - RenderScale renderMappedScale( Image::getScaleFromMipMapLevel(renderMappedMipMapLevel) ); + RenderScale renderMappedScale( RenderScale::fromMipmapLevel(renderMappedMipmapLevel) ); RenderingFunctorRetEnum renderStatus = eRenderingFunctorRetOK; if ( planesToRender->rectsToRender.empty() ) { retCode = EffectInstance::eRenderRoIStatusImageAlreadyRendered; @@ -1932,8 +1938,8 @@ EffectInstance::renderRoIInternal(EffectInstance* self, tiledArgs->firstFrame = firstFrame; tiledArgs->lastFrame = lastFrame; tiledArgs->preferredInput = preferredInput; - tiledArgs->mipMapLevel = mipMapLevel; - tiledArgs->renderMappedMipMapLevel = renderMappedMipMapLevel; + tiledArgs->mipmapLevel = mipmapLevel; + tiledArgs->renderMappedMipmapLevel = renderMappedMipmapLevel; tiledArgs->rod = rod; tiledArgs->time = time; tiledArgs->view = view; @@ -1981,7 +1987,7 @@ EffectInstance::renderRoIInternal(EffectInstance* self, } } else { for (std::list::const_iterator it = planesToRender->rectsToRender.begin(); it != planesToRender->rectsToRender.end(); ++it) { - RenderingFunctorRetEnum functorRet = self->_imp->tiledRenderingFunctor(*it, renderFullScaleThenDownscale, isSequentialRender, isRenderMadeInResponseToUserInteraction, firstFrame, lastFrame, preferredInput, mipMapLevel, renderMappedMipMapLevel, rod, time, view, par, byPassCache, outputClipPrefDepth, outputClipPrefsComps, compsNeeded, processChannels, planesToRender); + RenderingFunctorRetEnum functorRet = self->_imp->tiledRenderingFunctor(*it, renderFullScaleThenDownscale, isSequentialRender, isRenderMadeInResponseToUserInteraction, firstFrame, lastFrame, preferredInput, mipmapLevel, renderMappedMipmapLevel, rod, time, view, par, byPassCache, outputClipPrefDepth, outputClipPrefsComps, compsNeeded, processChannels, planesToRender); if ( (functorRet == eRenderingFunctorRetFailed) || (functorRet == eRenderingFunctorRetAborted) || (functorRet == eRenderingFunctorRetOutOfGPUMemory) ) { renderStatus = functorRet; diff --git a/Engine/Engine.pro b/Engine/Engine.pro index 221cb7e25e..748d7be8e9 100644 --- a/Engine/Engine.pro +++ b/Engine/Engine.pro @@ -173,6 +173,7 @@ SOURCES += \ ReadNode.cpp \ RectD.cpp \ RectI.cpp \ + RenderScale.cpp \ RenderStats.cpp \ RotoContext.cpp \ RotoDrawableItem.cpp \ @@ -343,6 +344,7 @@ HEADERS += \ RectDSerialization.h \ RectI.h \ RectISerialization.h \ + RenderScale.h \ RenderStats.h \ RotoContext.h \ RotoContextPrivate.h \ diff --git a/Engine/EngineFwd.h b/Engine/EngineFwd.h index f3a53c1c6c..55f1bf6fbb 100644 --- a/Engine/EngineFwd.h +++ b/Engine/EngineFwd.h @@ -233,6 +233,7 @@ class ProjectSerialization; class RectD; class RectI; class RenderEngine; +class RenderScale; class RenderStats; class RenderingFlagSetter; class RotoContext; diff --git a/Engine/FrameEntrySerialization.h b/Engine/FrameEntrySerialization.h index 1e66e28f77..0f984c4fa7 100644 --- a/Engine/FrameEntrySerialization.h +++ b/Engine/FrameEntrySerialization.h @@ -76,7 +76,7 @@ FrameKey::serialize(Archive & ar, ar & ::boost::serialization::make_nvp("Channels", _channels); ar & ::boost::serialization::make_nvp("View", _view); ar & ::boost::serialization::make_nvp("TextureRect", _textureRect); - ar & ::boost::serialization::make_nvp("LoD", _mipMapLevel); + ar & ::boost::serialization::make_nvp("LoD", _mipmapLevel); if (version >= FRAME_KEY_INTRODUCES_INPUT_NAME) { ar & ::boost::serialization::make_nvp("InputName", _inputName); diff --git a/Engine/FrameKey.cpp b/Engine/FrameKey.cpp index 1412d41114..4565651fce 100644 --- a/Engine/FrameKey.cpp +++ b/Engine/FrameKey.cpp @@ -43,7 +43,7 @@ FrameKey::FrameKey() , _channels(0) , _view(0) , _textureRect() - , _mipMapLevel(0) + , _mipmapLevel(0) , _layer() , _alphaChannelFullName() , _useShaders(false) @@ -61,7 +61,7 @@ FrameKey::FrameKey(const CacheEntryHolder* holder, int channels, ViewIdx view, const TextureRect & textureRect, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const std::string & inputName, const ImagePlaneDesc& layer, const std::string& alphaChannelFullName, @@ -77,7 +77,7 @@ FrameKey::FrameKey(const CacheEntryHolder* holder, , _channels(channels) , _view(view) , _textureRect(textureRect) - , _mipMapLevel(mipMapLevel) + , _mipmapLevel(mipmapLevel) , _inputName(inputName) , _layer(layer) , _alphaChannelFullName(alphaChannelFullName) @@ -104,7 +104,7 @@ FrameKey::fillHash(Hash64* hash) const hash->append(_textureRect.x2); hash->append(_textureRect.y2); hash->append(_textureRect.closestPo2); - hash->append(_mipMapLevel); + hash->append(_mipmapLevel); Hash64_appendQString( hash, QString::fromUtf8( _layer.getPlaneID().c_str() ) ); const std::vector& channels = _layer.getChannels(); for (std::size_t i = 0; i < channels.size(); ++i) { @@ -130,7 +130,7 @@ FrameKey::operator==(const FrameKey & other) const _channels == other._channels && _view == other._view && _textureRect == other._textureRect && - _mipMapLevel == other._mipMapLevel && + _mipmapLevel == other._mipmapLevel && _inputName == other._inputName && _layer == other._layer && _alphaChannelFullName == other._alphaChannelFullName && diff --git a/Engine/FrameKey.h b/Engine/FrameKey.h index 3ab0602c12..90c4afb1eb 100644 --- a/Engine/FrameKey.h +++ b/Engine/FrameKey.h @@ -52,7 +52,7 @@ class FrameKey int channels, ViewIdx view, const TextureRect & textureRect, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const std::string & inputName, const ImagePlaneDesc& layer, const std::string& alphaChannelFullName, @@ -103,9 +103,9 @@ class FrameKey return _view; } - unsigned int getMipMapLevel() const + unsigned int getMipmapLevel() const { - return _mipMapLevel; + return _mipmapLevel; } const std::string & getInputName() const WARN_UNUSED_RETURN @@ -132,7 +132,7 @@ class FrameKey // picks a new value in dropdown on the GUI int /*ViewIdx*/ _view; // The view of the frame, store it locally as an int for easier serialization TextureRect _textureRect; // texture rectangle definition (bounds in the original image + width and height) - unsigned int _mipMapLevel; // The scale of the image from which this texture was made + unsigned int _mipmapLevel; // The scale of the image from which this texture was made std::string _inputName; // The name of the input node used (to not mix up input 1, 2, 3 etc...) ImagePlaneDesc _layer; // The Layer of the image std::string _alphaChannelFullName; /// e.g: color.a , only used if _channels if A diff --git a/Engine/GenericSchedulerThreadWatcher.cpp b/Engine/GenericSchedulerThreadWatcher.cpp index 964364e632..59dddd7cfa 100644 --- a/Engine/GenericSchedulerThreadWatcher.cpp +++ b/Engine/GenericSchedulerThreadWatcher.cpp @@ -180,7 +180,7 @@ GenericWatcher::scheduleBlockingTask(int taskID, } { - QMutexLocker(&_imp->tasksMutex); + QMutexLocker k(&_imp->tasksMutex); GenericWatcherPrivate::Task t; t.id = taskID; t.args = args; diff --git a/Engine/HistogramCPU.cpp b/Engine/HistogramCPU.cpp index 95d45f5687..e58d0702cb 100644 --- a/Engine/HistogramCPU.cpp +++ b/Engine/HistogramCPU.cpp @@ -88,7 +88,7 @@ struct FinishedHistogram int binsCount; int pixelsCount; double vmin, vmax; - unsigned int mipMapLevel; + unsigned int mipmapLevel; FinishedHistogram() : histogram1() @@ -99,7 +99,7 @@ struct FinishedHistogram , pixelsCount(0) , vmin(0) , vmax(0) - , mipMapLevel(0) + , mipmapLevel(0) { } }; @@ -199,7 +199,7 @@ HistogramCPU::getMostRecentlyProducedHistogram(std::vector* histogram1, int* mode, double* vmin, double* vmax, - unsigned int* mipMapLevel) + unsigned int* mipmapLevel) { assert(histogram1 && histogram2 && histogram3 && binsCount && pixelsCount && mode && vmin && vmax); @@ -218,7 +218,7 @@ HistogramCPU::getMostRecentlyProducedHistogram(std::vector* histogram1, *mode = h->mode; *vmin = h->vmin; *vmax = h->vmax; - *mipMapLevel = h->mipMapLevel; + *mipmapLevel = h->mipmapLevel; _imp->produced.pop_back(); return true; @@ -417,7 +417,7 @@ HistogramCPU::run() ret->mode = request.mode; ret->vmin = request.vmin; ret->vmax = request.vmax; - ret->mipMapLevel = request.image->getMipMapLevel(); + ret->mipmapLevel = request.image->getMipmapLevel(); switch (request.mode) { diff --git a/Engine/HistogramCPU.h b/Engine/HistogramCPU.h index 7622e9f3d6..4a9b961d2b 100644 --- a/Engine/HistogramCPU.h +++ b/Engine/HistogramCPU.h @@ -75,7 +75,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON unsigned int* binsCount, unsigned int* pixelsCount, int* mode, - double* vmin, double* vmax, unsigned int* mipMapLevel); + double* vmin, double* vmax, unsigned int* mipmapLevel); void quitAnyComputation(); diff --git a/Engine/Image.cpp b/Engine/Image.cpp index a56efba90f..52b319a4c1 100644 --- a/Engine/Image.cpp +++ b/Engine/Image.cpp @@ -463,8 +463,11 @@ RectI Bitmap::minimalNonMarkedBbox(const RectI & roi) const { RectI realRoi = roi; - if (_dirtyZoneSet && !realRoi.clipIfOverlaps(_dirtyZone)) { - return RectI(); + if (_dirtyZoneSet) { + realRoi.clip(_dirtyZone); + if (realRoi.isNull()) { + return RectI(); + } } return minimalNonMarkedBbox_internal<0>(realRoi, _bounds, _map, NULL); @@ -475,8 +478,11 @@ Bitmap::minimalNonMarkedRects(const RectI & roi, std::list& ret) const { RectI realRoi = roi; - if (_dirtyZoneSet && !realRoi.clipIfOverlaps(_dirtyZone)) { - return; + if (_dirtyZoneSet) { + realRoi.clip(_dirtyZone); + if (realRoi.isNull()) { + return; + } } minimalNonMarkedRects_internal<0>(realRoi, _bounds, _map, ret, NULL); } @@ -487,9 +493,12 @@ Bitmap::minimalNonMarkedBbox_trimap(const RectI & roi, bool* isBeingRenderedElsewhere) const { RectI realRoi = roi; - if (_dirtyZoneSet && !realRoi.clipIfOverlaps(_dirtyZone)) { - *isBeingRenderedElsewhere = false; - return RectI(); + if (_dirtyZoneSet) { + realRoi.clip(_dirtyZone); + if (realRoi.isNull()) { + *isBeingRenderedElsewhere = false; + return RectI(); + } } return minimalNonMarkedBbox_internal<1>(realRoi, _bounds, _map, isBeingRenderedElsewhere); @@ -501,9 +510,12 @@ Bitmap::minimalNonMarkedRects_trimap(const RectI & roi, bool* isBeingRenderedElsewhere) const { RectI realRoi = roi; - if (_dirtyZoneSet && !realRoi.clipIfOverlaps(_dirtyZone)) { - *isBeingRenderedElsewhere = false; - return; + if (_dirtyZoneSet) { + realRoi.clip(_dirtyZone); + if (realRoi.isNull()) { + *isBeingRenderedElsewhere = false; + return; + } } minimalNonMarkedRects_internal<1>(realRoi, _bounds, _map, ret, isBeingRenderedElsewhere); } @@ -694,7 +706,7 @@ Image::Image(const ImageKey & key, Image::Image(const ImagePlaneDesc& components, const RectD & regionOfDefinition, //!< rod in canonical coordinates const RectI & bounds, //!< bounds in pixel coordinates - unsigned int mipMapLevel, + unsigned int mipmapLevel, double par, ImageBitDepthEnum bitdepth, ImagePremultiplicationEnum premult, @@ -709,7 +721,7 @@ Image::Image(const ImagePlaneDesc& components, #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES ImageParamsPtr( new ImageParams(regionOfDefinition, par, - mipMapLevel, + mipmapLevel, bounds, bitdepth, fielding, @@ -721,7 +733,7 @@ Image::Image(const ImagePlaneDesc& components, #else std::make_shared(regionOfDefinition, par, - mipMapLevel, + mipmapLevel, bounds, bitdepth, fielding, @@ -793,7 +805,7 @@ Image::makeKey(const CacheEntryHolder* holder, ImageParamsPtr Image::makeParams(const RectD & rod, const double par, - unsigned int mipMapLevel, + unsigned int mipmapLevel, bool isRoDProjectFormat, const ImagePlaneDesc& components, ImageBitDepthEnum bitdepth, @@ -802,12 +814,12 @@ Image::makeParams(const RectD & rod, StorageModeEnum storage, U32 textureTarget) { - const RectI bounds = rod.toPixelEnclosing(mipMapLevel, par); + const RectI bounds = rod.toPixelEnclosing(mipmapLevel, par); #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES return ImageParamsPtr( new ImageParams(rod, par, - mipMapLevel, + mipmapLevel, bounds, bitdepth, fielding, @@ -819,7 +831,7 @@ Image::makeParams(const RectD & rod, #else return std::make_shared(rod, par, - mipMapLevel, + mipmapLevel, bounds, bitdepth, fielding, @@ -835,7 +847,7 @@ ImageParamsPtr Image::makeParams(const RectD & rod, // the image rod in canonical coordinates const RectI& bounds, const double par, - unsigned int mipMapLevel, + unsigned int mipmapLevel, bool isRoDProjectFormat, const ImagePlaneDesc& components, ImageBitDepthEnum bitdepth, @@ -846,7 +858,7 @@ Image::makeParams(const RectD & rod, // the image rod in canonical coordinate { #ifdef DEBUG RectI pixelRod; - rod.toPixelEnclosing(mipMapLevel, par, &pixelRod); + rod.toPixelEnclosing(mipmapLevel, par, &pixelRod); assert( bounds.left() >= pixelRod.left() && bounds.right() <= pixelRod.right() && bounds.bottom() >= pixelRod.bottom() && bounds.top() <= pixelRod.top() ); #endif @@ -854,7 +866,7 @@ Image::makeParams(const RectD & rod, // the image rod in canonical coordinate #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES return ImageParamsPtr( new ImageParams(rod, par, - mipMapLevel, + mipmapLevel, bounds, bitdepth, fielding, @@ -866,7 +878,7 @@ Image::makeParams(const RectD & rod, // the image rod in canonical coordinate #else return std::make_shared(rod, par, - mipMapLevel, + mipmapLevel, bounds, bitdepth, fielding, @@ -905,13 +917,10 @@ Image::pasteFromForDepth(const Image & srcImg, assert( !srcBounds.isNull() ); // only copy the intersection of roi, bounds and otherBounds - RectI roi = srcRoi; - if (!roi.clipIfOverlaps(bounds)) { - // no intersection between roi and the bounds of this image - return; - } - if (!roi.clipIfOverlaps(srcBounds)) { - // no intersection between roi and the bounds of the other image + const RectI roi = srcRoi.intersect(bounds).intersect(srcBounds); + if (roi.isNull()) { + // no intersection between srcRoi and the bounds of this image or + // the bounds of the other image. return; } @@ -966,7 +975,7 @@ Image::resizeInternal(const Image* srcImg, *outputImage = std::make_shared( srcImg->getComponents(), srcImg->getRoD(), merge, - srcImg->getMipMapLevel(), + srcImg->getMipmapLevel(), srcImg->getPixelAspectRatio(), srcImg->getBitDepth(), srcImg->getPremultiplication(), @@ -1229,17 +1238,14 @@ Image::pasteFrom(const Image & src, glCheckError(); } else if ( (thisStorage == eStorageModeGLTex) && (otherStorage != eStorageModeGLTex) ) { // RAM image to OpenGL texture - RectI dstBounds = getBounds(); - RectI srcBounds = src.getBounds(); + const RectI& dstBounds = getBounds(); + const RectI& srcBounds = src.getBounds(); // only copy the intersection of roi, bounds and otherBounds - RectI roi = srcRoi; - if (!roi.clipIfOverlaps(dstBounds)) { - // no intersection between roi and the bounds of this image - return; - } - if (!roi.clipIfOverlaps(srcBounds)) { - // no intersection between roi and the bounds of the other image + const RectI roi = srcRoi.intersect(dstBounds).intersect(srcBounds); + if (roi.isNull()) { + // no intersection between srcRoi and the bounds of this image or + // the bounds of the other image return; } GLuint pboID = glContext->getPBOId(); @@ -1301,17 +1307,14 @@ Image::pasteFrom(const Image & src, } else if ( (thisStorage != eStorageModeGLTex) && (otherStorage == eStorageModeGLTex) ) { // OpenGL texture to RAM image - RectI dstBounds = getBounds(); - RectI srcBounds = src.getBounds(); + const RectI& dstBounds = getBounds(); + const RectI& srcBounds = src.getBounds(); // only copy the intersection of roi, bounds and otherBounds - RectI roi = srcRoi; - if (!roi.clipIfOverlaps(dstBounds)) { - // no intersection between roi and the bounds of this image - return; - } - if (!roi.clipIfOverlaps(srcBounds)) { - // no intersection between roi and the bounds of the other image + const RectI roi = srcRoi.intersect(dstBounds).intersect(srcBounds); + if (roi.isNull()) { + // no intersection between srcRoi and the bounds of this image or + // the bounds of the other image return; } @@ -1385,8 +1388,8 @@ Image::fillForDepthForComponents(const RectI & roi_, { assert( (getBitDepth() == eImageBitDepthByte && sizeof(PIX) == 1) || (getBitDepth() == eImageBitDepthShort && sizeof(PIX) == 2) || (getBitDepth() == eImageBitDepthFloat && sizeof(PIX) == 4) ); - RectI roi = roi_; - if (!roi.clipIfOverlaps(_bounds)) { + const RectI roi = roi_.intersect(_bounds); + if (roi.isNull()) { // no intersection between roi and the bounds of the image return; } @@ -1454,8 +1457,8 @@ Image::fill(const RectI & roi, QWriteLocker k(&_entryLock); if (getStorageMode() == eStorageModeGLTex) { - RectI realRoI = roi; - if (!realRoI.clipIfOverlaps(_bounds)) { + const RectI realRoI = roi.intersect(_bounds); + if (realRoI.isNull()) { // no intersection between roi and the bounds of the image return; } @@ -1788,6 +1791,7 @@ Image::halveRoIForDepth(const RectI & roi, bool copyBitMap, Image* output) const { + assert( _bounds.contains(roi) ); assert( (getBitDepth() == eImageBitDepthByte && sizeof(PIX) == 1) || (getBitDepth() == eImageBitDepthShort && sizeof(PIX) == 2) || (getBitDepth() == eImageBitDepthFloat && sizeof(PIX) == 4) ); @@ -1823,8 +1827,7 @@ Image::halveRoIForDepth(const RectI & roi, assert( getComponents() == output->getComponents() ); RectI dstRoI; - RectI srcRoI = roi; - srcRoI.clipIfOverlaps(srcBounds); // intersect srcRoI with the region of definition + const RectI srcRoI = roi.intersect(srcBounds); // intersect RoI with the region of definition #ifdef DEBUG_NAN assert(!checkForNaNsNoLock(srcRoI)); #endif @@ -1951,6 +1954,7 @@ Image::halveRoI(const RectI & roi, bool copyBitMap, Image* output) const { + assert( _bounds.contains(roi) ); switch ( getBitDepth() ) { case eImageBitDepthByte: halveRoIForDepth(roi, copyBitMap, output); @@ -1980,6 +1984,7 @@ Image::halve1DImageForDepth(const RectI & roi, assert(width == 1 || height == 1); /// must be 1D assert( output->getComponents() == getComponents() ); + assert( _bounds.contains(roi) ); /// Take the lock for both bitmaps since we're about to read/write from them! QWriteLocker k1(&output->_entryLock); @@ -2063,7 +2068,7 @@ Image::halve1DImage(const RectI & roi, // code proofread and fixed by @devernay on 8/8/2014 void -Image::downscaleMipMap(const RectD& dstRod, +Image::downscaleMipmap(const RectD& dstRod, const RectI & roi, unsigned int fromLevel, unsigned int toLevel, @@ -2075,8 +2080,7 @@ Image::downscaleMipMap(const RectD& dstRod, ///You should not call this function with a level equal to 0. assert(toLevel > fromLevel); - assert(_bounds.x1 <= roi.x1 && roi.x2 <= _bounds.x2 && - _bounds.y1 <= roi.y1 && roi.y2 <= _bounds.y2); + assert(_bounds.contains(roi)); double par = getPixelAspectRatio(); unsigned int downscaleLvls = toLevel - fromLevel; @@ -2085,7 +2089,7 @@ Image::downscaleMipMap(const RectD& dstRod, RectI dstRoI = roi.downscalePowerOfTwoSmallestEnclosing(downscaleLvls); ImagePtr tmpImg = std::make_shared( getComponents(), dstRod, dstRoI, toLevel, par, getBitDepth(), getPremultiplication(), getFieldingOrder(), true); - buildMipMapLevel( dstRod, roi, downscaleLvls, copyBitMap, tmpImg.get() ); + buildMipmapLevel( dstRod, roi, downscaleLvls, copyBitMap, tmpImg.get() ); // check that the downscaled mipmap is inside the output image (it may not be equal to it) assert(dstRoI.x1 >= output->_bounds.x1); @@ -2165,7 +2169,7 @@ Image::checkForNaNsNoLock(const RectI& roi) const // code proofread and fixed by @devernay on 8/8/2014 template void -Image::upscaleMipMapForDepth(const RectI & roi, +Image::upscaleMipmapForDepth(const RectI & roi, unsigned int fromLevel, unsigned int toLevel, Image* output) const @@ -2181,7 +2185,7 @@ Image::upscaleMipMapForDepth(const RectI & roi, const RectI & srcRoi = roi; // The source rectangle, intersected to this image region of definition in pixels and the output bounds. - RectI dstRoi = roi.toNewMipMapLevel(fromLevel, toLevel, _par, getRoD()); + RectI dstRoi = roi.toNewMipmapLevel(fromLevel, toLevel, _par, getRoD()); dstRoi.clipIfOverlaps(output->_bounds); //output may be a bit smaller than the upscaled RoI int scale = 1 << (fromLevel - toLevel); @@ -2242,11 +2246,11 @@ Image::upscaleMipMapForDepth(const RectI & roi, std::copy(dstLineBatchStart, dstLineBatchStart + dstRowSize, dstLineStart); } } -} // upscaleMipMapForDepth +} // upscaleMipmapForDepth // code proofread and fixed by @devernay on 8/8/2014 void -Image::upscaleMipMap(const RectI & roi, +Image::upscaleMipmap(const RectI & roi, unsigned int fromLevel, unsigned int toLevel, Image* output) const @@ -2255,16 +2259,16 @@ Image::upscaleMipMap(const RectI & roi, switch ( getBitDepth() ) { case eImageBitDepthByte: - upscaleMipMapForDepth(roi, fromLevel, toLevel, output); + upscaleMipmapForDepth(roi, fromLevel, toLevel, output); break; case eImageBitDepthShort: - upscaleMipMapForDepth(roi, fromLevel, toLevel, output); + upscaleMipmapForDepth(roi, fromLevel, toLevel, output); break; case eImageBitDepthHalf: assert(false); break; case eImageBitDepthFloat: - upscaleMipMapForDepth(roi, fromLevel, toLevel, output); + upscaleMipmapForDepth(roi, fromLevel, toLevel, output); break; case eImageBitDepthNone: break; @@ -2273,12 +2277,14 @@ Image::upscaleMipMap(const RectI & roi, // code proofread and fixed by @devernay on 8/8/2014 void -Image::buildMipMapLevel(const RectD& dstRoD, +Image::buildMipmapLevel(const RectD& dstRoD, const RectI & roi, unsigned int level, bool copyBitMap, Image* output) const { + assert(_bounds.contains(roi)); + ///The last mip map level we will make with closestPo2 RectI lastLevelRoI = roi.downscalePowerOfTwoSmallestEnclosing(level); @@ -2304,7 +2310,7 @@ Image::buildMipMapLevel(const RectD& dstRoD, RectI halvedRoI = previousRoI.downscalePowerOfTwoSmallestEnclosing(1); ///Allocate an image with half the size of the source image - dstImg = new Image( getComponents(), dstRoD, halvedRoI, getMipMapLevel() + i, getPixelAspectRatio(), getBitDepth(), getPremultiplication(), getFieldingOrder(), true); + dstImg = new Image( getComponents(), dstRoD, halvedRoI, getMipmapLevel() + i, getPixelAspectRatio(), getBitDepth(), getPremultiplication(), getFieldingOrder(), true); ///Half the source image into dstImg. ///We pass the closestPo2 roi which might not be the entire size of the source image @@ -2331,13 +2337,7 @@ Image::buildMipMapLevel(const RectD& dstRoD, if (mustFreeSrc) { delete srcImg; } -} // buildMipMapLevel - -double -Image::getScaleFromMipMapLevel(unsigned int level) -{ - return 1. / (1 << level); -} +} // buildMipmapLevel #ifndef M_LN2 #define M_LN2 0.693147180559945309417232121458176568 /* loge(2) */ diff --git a/Engine/Image.h b/Engine/Image.h index 4449f5531c..36469b2d5d 100644 --- a/Engine/Image.h +++ b/Engine/Image.h @@ -189,7 +189,7 @@ class Image Image(const ImagePlaneDesc& components, const RectD & regionOfDefinition, //!< rod in canonical coordinates const RectI & bounds, //!< bounds in pixel coordinates - unsigned int mipMapLevel, + unsigned int mipmapLevel, double par, ImageBitDepthEnum bitdepth, ImagePremultiplicationEnum premult, @@ -222,7 +222,7 @@ class Image bool fullScaleWithDownscaleInputs); static ImageParamsPtr makeParams(const RectD & rod, // the image rod in canonical coordinates const double par, - unsigned int mipMapLevel, + unsigned int mipmapLevel, bool isRoDProjectFormat, const ImagePlaneDesc& components, ImageBitDepthEnum bitdepth, @@ -233,7 +233,7 @@ class Image static ImageParamsPtr makeParams(const RectD & rod, // the image rod in canonical coordinates const RectI& bounds, const double par, - unsigned int mipMapLevel, + unsigned int mipmapLevel, bool isRoDProjectFormat, const ImagePlaneDesc& components, ImageBitDepthEnum bitdepth, @@ -289,7 +289,7 @@ class Image /** * @brief Returns the bounds where data is in the image. - * This is equivalent to calling getRoD().mipMapLevel(getMipMapLevel()); + * This is equivalent to calling getRoD().mipmapLevel(getMipmapLevel()); * but slightly faster since it is stored as a member of the image. **/ RectI getBounds() const @@ -317,14 +317,9 @@ class Image return size(); } - unsigned int getMipMapLevel() const + unsigned int getMipmapLevel() const { - return this->_params->getMipMapLevel(); - } - - double getScale() const - { - return getScaleFromMipMapLevel( getMipMapLevel() ); + return this->_params->getMipmapLevel(); } unsigned int getComponentsCount() const; @@ -753,7 +748,7 @@ class Image * given mipmap level, * and then computes the mipmap of the given level of that rectangle. **/ - void downscaleMipMap(const RectD& rod, + void downscaleMipmap(const RectD& rod, const RectI & roi, unsigned int fromLevel, unsigned int toLevel, bool copyBitMap, @@ -763,10 +758,9 @@ class Image * @brief Upscales a portion of this image into output. * If the upscaled roi does not fit into output's bounds, it is cropped first. **/ - void upscaleMipMap(const RectI & roi, unsigned int fromLevel, unsigned int toLevel, Image* output) const; + void upscaleMipmap(const RectI & roi, unsigned int fromLevel, unsigned int toLevel, Image* output) const; - static double getScaleFromMipMapLevel(unsigned int level); static unsigned int getLevelFromScale(double s); /** @@ -983,7 +977,7 @@ class Image * function computes the mip map of this image in the given roi. * If roi is NOT a power of 2, then it will be rounded to the closest power of 2. **/ - void buildMipMapLevel(const RectD& dstRoD, const RectI & roiCanonical, unsigned int level, bool copyBitMap, + void buildMipmapLevel(const RectD& dstRoD, const RectI & roiCanonical, unsigned int level, bool copyBitMap, Image* output) const; @@ -1009,7 +1003,7 @@ class Image void halve1DImageForDepth(const RectI & roi, Image* output) const; template - void upscaleMipMapForDepth(const RectI & roi, unsigned int fromLevel, unsigned int toLevel, Image* output) const; + void upscaleMipmapForDepth(const RectI & roi, unsigned int fromLevel, unsigned int toLevel, Image* output) const; template void pasteFromForDepth(const Image & src, const RectI & srcRoi, bool copyBitmap = true, bool takeSrcLock = true); diff --git a/Engine/ImageConvert.cpp b/Engine/ImageConvert.cpp index 77cb347f8a..a12ad661e9 100644 --- a/Engine/ImageConvert.cpp +++ b/Engine/ImageConvert.cpp @@ -115,6 +115,9 @@ lutFromColorspace(ViewerColorSpaceEnum cs) case eViewerColorSpaceRec709: lut = Color::LutManager::Rec709Lut(); break; + case eViewerColorSpaceBT1886: + lut = Color::LutManager::BT1886Lut(); + break; case eViewerColorSpaceLinear: default: lut = 0; diff --git a/Engine/ImageCopyChannels.cpp b/Engine/ImageCopyChannels.cpp index 8da69c8d1d..55c0179853 100644 --- a/Engine/ImageCopyChannels.cpp +++ b/Engine/ImageCopyChannels.cpp @@ -609,8 +609,8 @@ Image::copyUnProcessedChannels(const RectI& roi, } - if ( originalImage && ( getMipMapLevel() != originalImage->getMipMapLevel() ) ) { - qDebug() << "WARNING: attempting to call copyUnProcessedChannels on images with different mipMapLevel"; + if ( originalImage && ( getMipmapLevel() != originalImage->getMipmapLevel() ) ) { + qDebug() << "WARNING: attempting to call copyUnProcessedChannels on images with different mipmapLevel"; return; } diff --git a/Engine/ImageKey.cpp b/Engine/ImageKey.cpp index 1d7efc6ba6..fa5ad8444b 100644 --- a/Engine/ImageKey.cpp +++ b/Engine/ImageKey.cpp @@ -36,7 +36,7 @@ ImageKey::ImageKey() : KeyHelper() , _nodeHashKey(0) , _time(0) -//, _mipMapLevel(0) +//, _mipmapLevel(0) , _pixelAspect(1) , _view(0) , _draftMode(false) @@ -49,7 +49,7 @@ ImageKey::ImageKey(const CacheEntryHolder* holder, U64 nodeHashKey, bool frameVaryingOrAnimated, double time, - //unsigned int mipMapLevel, //< Store different mipmapLevels under the same key + //unsigned int mipmapLevel, //< Store different mipmapLevels under the same key ViewIdx view, double pixelAspect, bool draftMode, diff --git a/Engine/ImageParams.h b/Engine/ImageParams.h index 06c8c29e82..0c05593c4b 100644 --- a/Engine/ImageParams.h +++ b/Engine/ImageParams.h @@ -111,7 +111,7 @@ class ImageParams , _bitdepth(eImageBitDepthFloat) , _fielding(eImageFieldingOrderNone) , _premult(eImagePremultiplicationPremultiplied) - , _mipMapLevel(0) + , _mipmapLevel(0) , _isRoDProjectFormat(false) { } @@ -124,14 +124,14 @@ class ImageParams , _bitdepth(other._bitdepth) , _fielding(other._fielding) , _premult(other._premult) - , _mipMapLevel(other._mipMapLevel) + , _mipmapLevel(other._mipmapLevel) , _isRoDProjectFormat(other._isRoDProjectFormat) { } ImageParams(const RectD & rod, const double par, - const unsigned int mipMapLevel, + const unsigned int mipmapLevel, const RectI & bounds, ImageBitDepthEnum bitdepth, ImageFieldingOrderEnum fielding, @@ -147,7 +147,7 @@ class ImageParams , _bitdepth(bitdepth) , _fielding(fielding) , _premult(premult) - , _mipMapLevel(mipMapLevel) + , _mipmapLevel(mipmapLevel) , _isRoDProjectFormat(isRoDProjectFormat) { CacheEntryStorageInfo& info = getStorageInfo(); @@ -229,14 +229,9 @@ class ImageParams _par = par; } - unsigned int getMipMapLevel() const + unsigned int getMipmapLevel() const { - return _mipMapLevel; - } - - void setMipMapLevel(unsigned int mmlvl) - { - _mipMapLevel = mmlvl; + return _mipmapLevel; } template @@ -251,7 +246,7 @@ class ImageParams return _rod == other._rod && _components == other._components && _bitdepth == other._bitdepth - && _mipMapLevel == other._mipMapLevel + && _mipmapLevel == other._mipmapLevel && _premult == other._premult && _fielding == other._fielding; } @@ -269,7 +264,7 @@ class ImageParams ImageBitDepthEnum _bitdepth; ImageFieldingOrderEnum _fielding; ImagePremultiplicationEnum _premult; - unsigned int _mipMapLevel; + unsigned int _mipmapLevel; /// if true then when retrieving the associated image from cache /// the caller should update the rod to the current project format. /// This is because the project format might have changed since this image was cached. diff --git a/Engine/ImageParamsSerialization.h b/Engine/ImageParamsSerialization.h index 0dff96dcd4..2dad07268b 100644 --- a/Engine/ImageParamsSerialization.h +++ b/Engine/ImageParamsSerialization.h @@ -115,7 +115,7 @@ ImageParams::serialize(Archive & ar, // ar & ::boost::serialization::make_nvp("FramesNeeded",f); //} ar & ::boost::serialization::make_nvp("Components", _components); - ar & ::boost::serialization::make_nvp("MMLevel", _mipMapLevel); + ar & ::boost::serialization::make_nvp("MMLevel", _mipmapLevel); ar & ::boost::serialization::make_nvp("Premult", _premult); ar & ::boost::serialization::make_nvp("Fielding", _fielding); } diff --git a/Engine/Knob.h b/Engine/Knob.h index 022a9d33a7..0c1e57dafd 100644 --- a/Engine/Knob.h +++ b/Engine/Knob.h @@ -1069,7 +1069,6 @@ class KnobI virtual double getScreenPixelRatio() const OVERRIDE = 0; #endif virtual void getBackgroundColour(double &r, double &g, double &b) const OVERRIDE = 0; - virtual unsigned int getCurrentRenderScale() const OVERRIDE FINAL { return 0; } virtual RectD getViewportRect() const OVERRIDE = 0; virtual void getCursorPosition(double& x, double& y) const OVERRIDE = 0; diff --git a/Engine/KnobGuiI.h b/Engine/KnobGuiI.h index b14a6d53a7..46791b1813 100644 --- a/Engine/KnobGuiI.h +++ b/Engine/KnobGuiI.h @@ -60,7 +60,6 @@ class KnobGuiI virtual bool isGuiFrozenForPlayback() const = 0; virtual void saveOpenGLContext() OVERRIDE = 0; virtual void restoreOpenGLContext() OVERRIDE = 0; - virtual unsigned int getCurrentRenderScale() const OVERRIDE { return 0; } virtual CurvePtr getCurve(ViewSpec view, int dimension) const = 0; virtual bool getAllDimensionsVisible() const = 0; diff --git a/Engine/Lut.cpp b/Engine/Lut.cpp index f3aa4ba60b..beb113935c 100644 --- a/Engine/Lut.cpp +++ b/Engine/Lut.cpp @@ -167,11 +167,12 @@ LutManager::~LutManager() } } -static bool -clip(RectI* what, - const RectI & to) +static RectI +clip2(const RectI& what, + const RectI& srcBounds, + const RectI& dstBounds) { - return what->clipIfOverlaps(to); + return what.intersect(srcBounds).intersect(dstBounds); } #ifdef DEAD_CODE @@ -445,9 +446,9 @@ Lut::to_byte_packed(unsigned char* to, bool premult) const { ///clip the conversion rect to srcBounds and dstBounds - RectI rect = conversionRect; + const RectI rect = clip2(conversionRect, srcBounds, dstBounds); - if ( !clip(&rect, srcBounds) || !clip(&rect, dstBounds) ) { + if ( rect.isNull() ) { return; } @@ -546,9 +547,8 @@ Lut::to_float_packed(float* to, bool premult) const { ///clip the conversion rect to srcBounds and dstBounds - RectI rect = conversionRect; - - if ( !clip(&rect, srcBounds) || !clip(&rect, dstBounds) ) { + const RectI rect = clip2(conversionRect, srcBounds, dstBounds); + if ( rect.isNull()) { return; } @@ -658,8 +658,8 @@ Lut::from_byte_packed(float* to, } ///clip the conversion rect to srcBounds and dstBounds - RectI rect = conversionRect; - if ( !clip(&rect, srcBounds) || !clip(&rect, dstBounds) ) { + const RectI rect = clip2(conversionRect, srcBounds, dstBounds); + if ( rect.isNull() ) { return; } @@ -752,8 +752,8 @@ Lut::from_float_packed(float* to, } ///clip the conversion rect to srcBounds and dstBounds - RectI rect = conversionRect; - if ( !clip(&rect, srcBounds) || !clip(&rect, dstBounds) ) { + const RectI rect = clip2(conversionRect, srcBounds, dstBounds); + if ( rect.isNull() ) { return; } @@ -863,8 +863,8 @@ from_byte_packed(float *to, } ///clip the conversion rect to srcBounds and dstBounds - RectI rect = conversionRect; - if ( !clip(&rect, srcBounds) || !clip(&rect, dstBounds) ) { + const RectI rect = clip2(conversionRect, srcBounds, dstBounds); + if ( rect.isNull() ) { return; } @@ -933,8 +933,8 @@ from_float_packed(float *to, ///clip the conversion rect to srcBounds and dstBounds - RectI rect = conversionRect; - if ( !clip(&rect, srcBounds) || !clip(&rect, dstBounds) ) { + const RectI rect = clip2(conversionRect, srcBounds, dstBounds); + if ( rect.isNull()) { return; } @@ -1132,8 +1132,8 @@ to_byte_packed(unsigned char* to, } ///clip the conversion rect to srcBounds and dstBounds - RectI rect = conversionRect; - if ( !clip(&rect, srcBounds) || !clip(&rect, dstBounds) ) { + const RectI rect = clip2(conversionRect, srcBounds, dstBounds); + if ( rect.isNull() ) { return; } @@ -1241,8 +1241,8 @@ to_float_packed(float* to, } ///clip the conversion rect to srcBounds and dstBounds - RectI rect = conversionRect; - if ( !clip(&rect, srcBounds) || !clip(&rect, dstBounds) ) { + const RectI rect = clip2(conversionRect, srcBounds, dstBounds); + if ( rect.isNull() ) { return; } @@ -1293,6 +1293,12 @@ LutManager::sRGBLut() return LutManager::m_instance.getLut("sRGB", from_func_srgb, to_func_srgb); } +const Lut* +LutManager::BT1886Lut() +{ + return LutManager::m_instance.getLut("BT1886", from_func_bt1886, to_func_bt1886); +} + // Rec.709 and Rec.2020 share the same transfer function (and illuminant), except that // Rec.2020 is more precise. // https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2020-0-201208-S!!PDF-E.pdf diff --git a/Engine/Lut.h b/Engine/Lut.h index 6064a9f9bc..a1359c2e35 100644 --- a/Engine/Lut.h +++ b/Engine/Lut.h @@ -89,6 +89,7 @@ class LutManager ///buit-ins color-spaces static const Lut* sRGBLut(); static const Lut* Rec709Lut(); + static const Lut* BT1886Lut(); static const Lut* CineonLut(); static const Lut* Gamma1_8Lut(); static const Lut* Gamma2_2Lut(); @@ -496,6 +497,18 @@ to_func_srgb(float v) } } +inline float +from_func_bt1886(float v) +{ + return std::pow(v, 2.4); +} + +inline float +to_func_bt1886(float v) +{ + return std::pow(v, 1.0/2.4); +} + // r,g,b values are from 0 to 1 // h = [0,NATRON_COLOR_HUE_CIRCLE], s = [0,1], v = [0,1] // if s == 0, then h = 0 (undefined) diff --git a/Engine/Node.cpp b/Engine/Node.cpp index 117aebe80a..aa0a905d5e 100644 --- a/Engine/Node.cpp +++ b/Engine/Node.cpp @@ -522,7 +522,7 @@ Node::getLastPaintStrokePoints(double time, } ImagePtr -Node::getOrRenderLastStrokeImage(unsigned int mipMapLevel, +Node::getOrRenderLastStrokeImage(unsigned int mipmapLevel, double par, const ImagePlaneDesc& components, ImageBitDepthEnum depth) const @@ -544,7 +544,7 @@ Node::getOrRenderLastStrokeImage(unsigned int mipMapLevel, double distNextIn = 0.; ImagePtr strokeImage; getApp()->getRenderStrokeData(&lastStrokeBbox, &lastStrokePoints, &distNextIn, &strokeImage); - double distToNextOut = stroke->renderSingleStroke(lastStrokeBbox, lastStrokePoints, mipMapLevel, par, components, depth, distNextIn, &strokeImage); + double distToNextOut = stroke->renderSingleStroke(lastStrokeBbox, lastStrokePoints, mipmapLevel, par, components, depth, distNextIn, &strokeImage); getApp()->updateStrokeImage(strokeImage, distToNextOut, true); @@ -1641,12 +1641,11 @@ Node::makeInfoForInput(int inputNumber) const ss << "" << tr("Frame range:").toStdString() << " " << first << " - " << last << "
"; } { - RenderScale scale(1.); RectD rod; bool isProjectFormat; StatusEnum stat = input->getRegionOfDefinition_public(getHashValue(), time, - scale, ViewIdx(0), &rod, &isProjectFormat); + RenderScale::identity, ViewIdx(0), &rod, &isProjectFormat); if (stat != eStatusFailed) { ss << "" << tr("Region of Definition (at t=%1):").arg(time).toStdString() << " "; ss << tr("left = %1 bottom = %2 right = %3 top = %4").arg(rod.x1).arg(rod.y1).arg(rod.x2).arg(rod.y2).toStdString() << "
"; @@ -3301,7 +3300,6 @@ Node::makePreviewImage(SequenceTime time, ComputingPreviewSetter_RAII computingPreviewRAII( _imp.get() ); RectD rod; bool isProjectFormat; - RenderScale scale(1.); U64 nodeHash = getHashValue(); EffectInstance* effect = 0; NodeGroup* isGroup = dynamic_cast( _imp->effect.get() ); @@ -3317,7 +3315,7 @@ Node::makePreviewImage(SequenceTime time, effect->clearPersistentMessage(false); - StatusEnum stat = effect->getRegionOfDefinition_public(nodeHash, time, scale, ViewIdx(0), &rod, &isProjectFormat); + StatusEnum stat = effect->getRegionOfDefinition_public(nodeHash, time, RenderScale::identity, ViewIdx(0), &rod, &isProjectFormat); if ( (stat == eStatusFailed) || rod.isNull() ) { return false; } @@ -3327,13 +3325,12 @@ Node::makePreviewImage(SequenceTime time, double closestPowerOf2X = xZoomFactor >= 1 ? 1 : ipow( 2, (int)-std::ceil( std::log(xZoomFactor) / M_LN2 ) ); double closestPowerOf2Y = yZoomFactor >= 1 ? 1 : ipow( 2, (int)-std::ceil( std::log(yZoomFactor) / M_LN2 ) ); int closestPowerOf2 = std::max(closestPowerOf2X, closestPowerOf2Y); - unsigned int mipMapLevel = std::min(std::log( (double)closestPowerOf2 ) / std::log(2.), 5.); + unsigned int mipmapLevel = std::min(std::log( (double)closestPowerOf2 ) / std::log(2.), 5.); - scale.x = Image::getScaleFromMipMapLevel(mipMapLevel); - scale.y = scale.x; + const RenderScale scale = RenderScale::fromMipmapLevel(mipmapLevel); const double par = effect->getAspectRatio(-1); - const RectI renderWindow = rod.toPixelEnclosing(mipMapLevel, par); + const RectI renderWindow = rod.toPixelEnclosing(mipmapLevel, par); NodePtr thisNode = shared_from_this(); RenderingFlagSetter flagIsRendering(thisNode); @@ -3360,7 +3357,7 @@ Node::makePreviewImage(SequenceTime time, true, // isDraft RenderStatsPtr() ); FrameRequestMap request; - stat = EffectInstance::computeRequestPass(time, ViewIdx(0), mipMapLevel, rod, thisNode, request); + stat = EffectInstance::computeRequestPass(time, ViewIdx(0), mipmapLevel, rod, thisNode, request); if (stat == eStatusFailed) { return false; } @@ -3382,7 +3379,7 @@ Node::makePreviewImage(SequenceTime time, try { std::unique_ptr renderArgs( new EffectInstance::RenderRoIArgs(time, scale, - mipMapLevel, + mipmapLevel, ViewIdx(0), //< preview only renders view 0 (left) false, renderWindow, @@ -4439,7 +4436,7 @@ Node::unlock(const ImagePtr & image) ImagePtr Node::getImageBeingRendered(double time, - unsigned int mipMapLevel, + unsigned int mipmapLevel, ViewIdx view) { QMutexLocker l(&_imp->imagesBeingRenderedMutex); @@ -4447,7 +4444,7 @@ Node::getImageBeingRendered(double time, for (std::list::iterator it = _imp->imagesBeingRendered.begin(); it != _imp->imagesBeingRendered.end(); ++it) { const ImageKey &key = (*it)->getKey(); - if ( (key._view == view) && ( (*it)->getMipMapLevel() == mipMapLevel ) && (key._time == time) ) { + if ( (key._view == view) && ( (*it)->getMipmapLevel() == mipmapLevel ) && (key._time == time) ) { return *it; } } @@ -4811,7 +4808,6 @@ Node::onRefreshIdentityStateRequestReceived() ProjectPtr project = getApp()->getProject(); double time = project->currentFrame(); - RenderScale scale(1.); double inputTime = 0; U64 hash = getHashValue(); bool viewAware = _imp->effect->isViewAware(); @@ -4834,7 +4830,7 @@ Node::onRefreshIdentityStateRequestReceived() for (int i = 0; i < nViews; ++i) { int identityInputNb = -1; ViewIdx identityView; - bool isViewIdentity = _imp->effect->isIdentity_public(true, hash, time, scale, frmt, ViewIdx(i), &inputTime, &identityView, &identityInputNb); + bool isViewIdentity = _imp->effect->isIdentity_public(true, hash, time, RenderScale::identity, frmt, ViewIdx(i), &inputTime, &identityView, &identityInputNb); if ( (i > 0) && ( (isViewIdentity != isIdentity) || (identityInputNb != inputNb) || (identityView.value() != i) ) ) { isIdentity = false; inputNb = -1; @@ -5167,7 +5163,6 @@ Node::Implementation::onLayerChanged(int inputNb, } if (!isRefreshingInputRelatedData) { ///Clip preferences have changed - RenderScale s(1.); effect->refreshMetadata_public(true); } if ( !enabledChan[0].lock() ) { @@ -5273,7 +5268,6 @@ Node::Implementation::onMaskSelectorChanged(int inputNb, if (!isRefreshingInputRelatedData) { ///Clip preferences have changed - RenderScale s(1.); effect->refreshMetadata_public(true); } } @@ -5819,7 +5813,6 @@ addIdentityNodesRecursively(const Node* caller, /* Very unlikely that there's no request pass. But we still check */ - RenderScale scale(1.); double inputTimeId; ViewIdx identityView; int inputNbId; @@ -5829,7 +5822,7 @@ addIdentityNodesRecursively(const Node* caller, RectI format = node->getEffectInstance()->getOutputFormat(); - isIdentity = node->getEffectInstance()->isIdentity_public(true, renderHash, time, scale, format, view, &inputTimeId, &identityView, &inputNbId); + isIdentity = node->getEffectInstance()->isIdentity_public(true, renderHash, time, RenderScale::identity, format, view, &inputTimeId, &identityView, &inputNbId); } @@ -6111,14 +6104,12 @@ Node::refreshAllInputRelatedData(bool /*canChangeValues*/, } double time = (double)getApp()->getTimeLine()->currentFrame(); - RenderScale scaleOne(1.); ///Render scale support might not have been set already because getRegionOfDefinition could have failed until all non optional inputs were connected if (_imp->effect->supportsRenderScaleMaybe() == EffectInstance::eSupportsMaybe) { RectD rod; - StatusEnum stat = _imp->effect->getRegionOfDefinition(getHashValue(), time, scaleOne, ViewIdx(0), &rod); + StatusEnum stat = _imp->effect->getRegionOfDefinition(getHashValue(), time, RenderScale::identity, ViewIdx(0), &rod); if (stat != eStatusFailed) { - RenderScale scale(0.5); - stat = _imp->effect->getRegionOfDefinition(getHashValue(), time, scale, ViewIdx(0), &rod); + stat = _imp->effect->getRegionOfDefinition(getHashValue(), time, RenderScale::fromMipmapLevel(1), ViewIdx(0), &rod); if (stat != eStatusFailed) { _imp->effect->setSupportsRenderScaleMaybe(EffectInstance::eSupportsYes); } else { @@ -7262,7 +7253,6 @@ Node::addUserComponents(const ImagePlaneDesc& comps) } if (!_imp->isRefreshingInputRelatedData) { ///Clip preferences have changed - RenderScale s(1.); getEffectInstance()->refreshMetadata_public(true); } { diff --git a/Engine/Node.h b/Engine/Node.h index 589bf3786a..f5e433b754 100644 --- a/Engine/Node.h +++ b/Engine/Node.h @@ -494,7 +494,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON unsigned int mipmapLevel, std::list > >* strokes, int* strokeIndex) const; - ImagePtr getOrRenderLastStrokeImage(unsigned int mipMapLevel, + ImagePtr getOrRenderLastStrokeImage(unsigned int mipmapLevel, double par, const ImagePlaneDesc& components, ImageBitDepthEnum depth) const; @@ -904,7 +904,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON * @brief DO NOT EVER USE THIS FUNCTION. This is provided for compatibility with plug-ins that * do not respect the OpenFX specification. **/ - ImagePtr getImageBeingRendered(double time, unsigned int mipMapLevel, ViewIdx view); + ImagePtr getImageBeingRendered(double time, unsigned int mipmapLevel, ViewIdx view); void beginInputEdition(); diff --git a/Engine/NodeInputs.cpp b/Engine/NodeInputs.cpp index 1be52f2e64..7af97bcf18 100644 --- a/Engine/NodeInputs.cpp +++ b/Engine/NodeInputs.cpp @@ -627,12 +627,11 @@ checkCanConnectNoMultiRes(const Node* output, { //http://openfx.sourceforge.net/Documentation/1.3/ofxProgrammingReference.html#kOfxImageEffectPropSupportsMultiResolution //Check that the input has the same RoD that another input and that its rod is set to 0,0 - RenderScale scale(1.); RectD rod; bool isProjectFormat; StatusEnum stat = input->getEffectInstance()->getRegionOfDefinition_public(input->getHashValue(), output->getApp()->getTimeLine()->currentFrame(), - scale, + RenderScale::identity, ViewIdx(0), &rod, &isProjectFormat); @@ -660,7 +659,7 @@ checkCanConnectNoMultiRes(const Node* output, RectD inputRod; stat = inputNode->getEffectInstance()->getRegionOfDefinition_public(inputNode->getHashValue(), output->getApp()->getTimeLine()->currentFrame(), - scale, + RenderScale::identity, ViewIdx(0), &inputRod, &isProjectFormat); if ( (stat == eStatusFailed) && !inputRod.isNull() ) { diff --git a/Engine/OSGLContext_win.cpp b/Engine/OSGLContext_win.cpp index 3665c4c03e..b9b78ff280 100644 --- a/Engine/OSGLContext_win.cpp +++ b/Engine/OSGLContext_win.cpp @@ -693,7 +693,6 @@ static std::string GetGPUInfoAMDInternal_string(const OSGLContext_wgl_data* wglI static bool GetGPUInfoAMDInternal_int(const OSGLContext_wgl_data* wglInfo, UINT gpuID, int info, int* value) { - std::vector data; int totalSize = 0; @@ -719,6 +718,36 @@ static bool GetGPUInfoAMDInternal_int(const OSGLContext_wgl_data* wglInfo, UINT return true; } +namespace { +class ScopedGLContext { +public: + ScopedGLContext(const GLRendererID& gid) { + assert(!OSGLContext_win::threadHasACurrentContext()); + try { + _context = std::make_unique(FramebufferConfig(), GLVersion.major, GLVersion.minor, false, gid, nullptr); + } catch (const std::exception& e) { + std::cerr << "Failed to create GL context : " << e.what() << std::endl; + return; + } + + if (!OSGLContext_win::makeContextCurrent(_context.get())) { + _context.reset(); + } + } + + ~ScopedGLContext() { + if (_context) { + OSGLContext_win::makeContextCurrent(nullptr); + } + } + + explicit operator bool() const { return (bool)_context; } + +private: + std::unique_ptr _context; +}; +} // namespace + void OSGLContext_win::getGPUInfos(std::list& renderers) { @@ -749,37 +778,27 @@ OSGLContext_win::getGPUInfos(std::list& renderers) for (std::size_t i = 0; i < gpuHandles.size(); ++i) { OpenGLRendererInfo info; info.rendererID.rendererHandle = (void*)gpuHandles[i]; + { + ScopedGLContext scopedContext(info.rendererID); + if (!scopedContext) { + continue; + } - std::unique_ptr context; - try { - GLRendererID gid; - gid.rendererHandle = info.rendererID.rendererHandle; - context.reset( new OSGLContext_win(FramebufferConfig(), GLVersion.major, GLVersion.minor, false, gid, 0) ); - } catch (const std::exception& e) { - continue; - } - - if ( !makeContextCurrent( context.get() ) ) { - continue; - } + try { + OSGLContext::checkOpenGLVersion(); + } catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + continue; + } - try { - OSGLContext::checkOpenGLVersion(); - } catch (const std::exception& e) { - std::cerr << e.what() << std::endl; - makeContextCurrent(nullptr); - continue; + info.vendorName = std::string( (const char *) glGetString(GL_VENDOR) ); + info.rendererName = std::string( (const char *) glGetString(GL_RENDERER) ); + info.glVersionString = std::string( (const char *) glGetString(GL_VERSION) ); + info.glslVersionString = std::string( (const char*)glGetString (GL_SHADING_LANGUAGE_VERSION) ); + info.maxMemBytes = nvx_get_GPU_mem_info(); + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &info.maxTextureSize); + renderers.push_back(info); } - - info.vendorName = std::string( (const char *) glGetString(GL_VENDOR) ); - info.rendererName = std::string( (const char *) glGetString(GL_RENDERER) ); - info.glVersionString = std::string( (const char *) glGetString(GL_VERSION) ); - info.glslVersionString = std::string( (const char*)glGetString (GL_SHADING_LANGUAGE_VERSION) ); - info.maxMemBytes = nvx_get_GPU_mem_info(); - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &info.maxTextureSize); - renderers.push_back(info); - - makeContextCurrent(nullptr); } } else if (wglInfo->AMD_gpu_association && !isApplication32Bits()) { //https://www.opengl.org/registry/specs/AMD/wgl_gpu_association.txt @@ -798,62 +817,52 @@ OSGLContext_win::getGPUInfos(std::list& renderers) UINT gpuID = gpuIDs[index]; OpenGLRendererInfo info; - info.rendererName = GetGPUInfoAMDInternal_string(wglInfo, gpuID, WGL_GPU_RENDERER_STRING_AMD); - if (info.rendererName.empty()) { - continue; - } - - info.vendorName = GetGPUInfoAMDInternal_string(wglInfo, gpuID, WGL_GPU_VENDOR_AMD); - if (info.vendorName.empty()) { - continue; - } + info.rendererID.renderID = gpuID; - info.glVersionString = GetGPUInfoAMDInternal_string(wglInfo, gpuID, WGL_GPU_OPENGL_VERSION_STRING_AMD); - if (info.glVersionString.empty()) { - continue; - } + { + ScopedGLContext scopedContext(info.rendererID); + if (!scopedContext) { + continue; + } - // note: cannot retrieve GL_SHADING_LANGUAGE_VERSION + info.rendererName = GetGPUInfoAMDInternal_string(wglInfo, gpuID, WGL_GPU_RENDERER_STRING_AMD); + if (info.rendererName.empty()) { + continue; + } - info.maxMemBytes = 0; - if (!isApplication32Bits()) { - int ramMB = 0; - // AMD drivers are f*** up in 32 bits, they read a wrong buffer size. - // It works fine in 64 bits mode - if (!GetGPUInfoAMDInternal_int(wglInfo, gpuID, WGL_GPU_RAM_AMD, &ramMB)) { + info.vendorName = GetGPUInfoAMDInternal_string(wglInfo, gpuID, WGL_GPU_VENDOR_AMD); + if (info.vendorName.empty()) { continue; } - info.maxMemBytes = ramMB * 1e6; - } - info.rendererID.renderID = gpuID; - - std::unique_ptr context; + info.glVersionString = GetGPUInfoAMDInternal_string(wglInfo, gpuID, WGL_GPU_OPENGL_VERSION_STRING_AMD); + if (info.glVersionString.empty()) { + continue; + } - GLRendererID gid; - gid.renderID = info.rendererID.renderID; - try { - context.reset( new OSGLContext_win(FramebufferConfig(), GLVersion.major, GLVersion.minor, false, gid, 0) ); - } catch (const std::exception& e) { - continue; - } + // note: cannot retrieve GL_SHADING_LANGUAGE_VERSION + + info.maxMemBytes = 0; + if (!isApplication32Bits()) { + int ramMB = 0; + // AMD drivers are f*** up in 32 bits, they read a wrong buffer size. + // It works fine in 64 bits mode + if (!GetGPUInfoAMDInternal_int(wglInfo, gpuID, WGL_GPU_RAM_AMD, &ramMB)) { + continue; + } + info.maxMemBytes = ramMB * 1e6; + } - if ( !makeContextCurrent( context.get() ) ) { - continue; - } + try { + OSGLContext::checkOpenGLVersion(); + } catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + continue; + } - try { - OSGLContext::checkOpenGLVersion(); - } catch (const std::exception& e) { - std::cerr << e.what() << std::endl; - makeContextCurrent(nullptr); - continue; + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &info.maxTextureSize); + renderers.push_back(info); } - - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &info.maxTextureSize); - renderers.push_back(info); - - makeContextCurrent(nullptr); } } } @@ -863,38 +872,29 @@ OSGLContext_win::getGPUInfos(std::list& renderers) } if (defaultFallback) { // No extension, use default - std::unique_ptr context; - try { - context.reset( new OSGLContext_win(FramebufferConfig(), GLVersion.major, GLVersion.minor, false, GLRendererID(), 0) ); - } catch (const std::exception& e) { - std::cerr << e.what() << std::endl; - - return; - } + { + ScopedGLContext scopedContext{GLRendererID()}; + if (!scopedContext) { + return; + } - if ( !makeContextCurrent( context.get() ) ) { - return; - } + try { + OSGLContext::checkOpenGLVersion(); + } catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return; + } - try { - OSGLContext::checkOpenGLVersion(); - } catch (const std::exception& e) { - std::cerr << e.what() << std::endl; - makeContextCurrent(nullptr); - return; + OpenGLRendererInfo info; + info.vendorName = std::string( (const char *) glGetString(GL_VENDOR) ); + info.rendererName = std::string( (const char *) glGetString(GL_RENDERER) ); + info.glVersionString = std::string( (const char *) glGetString(GL_VERSION) ); + info.glslVersionString = std::string( (const char *) glGetString (GL_SHADING_LANGUAGE_VERSION) ); + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &info.maxTextureSize); + // We don't have any way to get memory size, set it to 0 + info.maxMemBytes = nvx_get_GPU_mem_info(); + renderers.push_back(info); } - - OpenGLRendererInfo info; - info.vendorName = std::string( (const char *) glGetString(GL_VENDOR) ); - info.rendererName = std::string( (const char *) glGetString(GL_RENDERER) ); - info.glVersionString = std::string( (const char *) glGetString(GL_VERSION) ); - info.glslVersionString = std::string( (const char *) glGetString (GL_SHADING_LANGUAGE_VERSION) ); - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &info.maxTextureSize); - // We don't have any way to get memory size, set it to 0 - info.maxMemBytes = nvx_get_GPU_mem_info(); - renderers.push_back(info); - - makeContextCurrent(nullptr); } } // OSGLContext_win::getGPUInfos diff --git a/Engine/OfxClipInstance.cpp b/Engine/OfxClipInstance.cpp index a266a1b9bd..f794631568 100644 --- a/Engine/OfxClipInstance.cpp +++ b/Engine/OfxClipInstance.cpp @@ -601,7 +601,7 @@ OfxClipInstance::getRegionOfDefinitionInternal(OfxTime time, bool isProjectFormat; U64 nodeHash = associatedNode->getRenderHash(); RectD rod; - RenderScale scale( Image::getScaleFromMipMapLevel(mipmapLevel) ); + const RenderScale scale = RenderScale::fromMipmapLevel(mipmapLevel); StatusEnum st = associatedNode->getRegionOfDefinition_public(nodeHash, time, scale, view, &rod, &isProjectFormat); if (st == eStatusFailed) { ret->x1 = 0.; @@ -643,8 +643,8 @@ OfxClipInstance::getRegionOfDefinition(OfxTime time, mipmapLevel = 0; } else { ClipDataTLSPtr tls = _imp->tlsData->getOrCreateTLSData(); - if ( !tls->mipMapLevel.empty() ) { - mipmapLevel = tls->mipMapLevel.back(); + if ( !tls->mipmapLevel.empty() ) { + mipmapLevel = tls->mipmapLevel.back(); } else { mipmapLevel = 0; } @@ -679,8 +679,8 @@ OfxClipInstance::getRegionOfDefinition(OfxTime time) const if ( !tls->view.empty() ) { view = tls->view.back(); } - if ( !tls->mipMapLevel.empty() ) { - mipmapLevel = tls->mipMapLevel.back(); + if ( !tls->mipmapLevel.empty() ) { + mipmapLevel = tls->mipmapLevel.back(); } else { mipmapLevel = 0; } @@ -894,7 +894,7 @@ OfxClipInstance::getInputImageInternal(const OfxTime time, } - unsigned int mipMapLevel = 0; + unsigned int mipmapLevel = 0; // Get mipmaplevel and view from the TLS #ifdef DEBUG if ( !tls || tls->view.empty() ) { @@ -918,10 +918,10 @@ OfxClipInstance::getInputImageInternal(const OfxTime time, view = ViewIdx( viewParam.value() ); } - if ( tls->mipMapLevel.empty() ) { - mipMapLevel = 0; + if ( tls->mipmapLevel.empty() ) { + mipmapLevel = 0; } else { - mipMapLevel = tls->mipMapLevel.back(); + mipmapLevel = tls->mipmapLevel.back(); } } else { if ( viewParam.isCurrent() ) { @@ -946,7 +946,7 @@ OfxClipInstance::getInputImageInternal(const OfxTime time, } bool sameComponents = (mapImageToClipPref && (*it)->getComponentsString() == thisClipComponents) || (!mapImageToClipPref && (*it)->getComponentsString() == *ofxPlane); - if ( sameComponents && (internalImage->getMipMapLevel() == mipMapLevel) && + if ( sameComponents && (internalImage->getMipmapLevel() == mipmapLevel) && ( time == internalImage->getTime() ) && ( view == internalImage->getKey().getView() ) ) { if (retImage) { @@ -971,7 +971,7 @@ OfxClipInstance::getInputImageInternal(const OfxTime time, } - RenderScale renderScale( Image::getScaleFromMipMapLevel(mipMapLevel) ); + const RenderScale renderScale = RenderScale::fromMipmapLevel(mipmapLevel); RectD bounds; if (optionalBounds) { bounds.x1 = optionalBounds->x1; @@ -1368,8 +1368,8 @@ OfxImageCommon::OfxImageCommon(OFX::Host::ImageEffect::ImageBase* ofxImageBase, assert(internalImage); - unsigned int mipMapLevel = internalImage->getMipMapLevel(); - RenderScale scale( NATRON_NAMESPACE::Image::getScaleFromMipMapLevel(mipMapLevel) ); + const unsigned int mipmapLevel = internalImage->getMipmapLevel(); + const OfxPointD scale = RenderScale::fromMipmapLevel(mipmapLevel).toOfxPointD(); ofxImageBase->setDoubleProperty(kOfxImageEffectPropRenderScale, scale.x, 0); ofxImageBase->setDoubleProperty(kOfxImageEffectPropRenderScale, scale.y, 1); @@ -1466,7 +1466,7 @@ OfxImageCommon::OfxImageCommon(OFX::Host::ImageEffect::ImageBase* ofxImageBase, // " An image's region of definition, in *PixelCoordinates,* is the full frame area of the image plane that the image covers." // Image::getRoD() is in *CANONICAL* coordinates // OFX::Image RoD is in *PIXEL* coordinates - const RectI pixelRod = rod.toPixelEnclosing(mipMapLevel, internalImage->getPixelAspectRatio()); + const RectI pixelRod = rod.toPixelEnclosing(mipmapLevel, internalImage->getPixelAspectRatio()); ofxImageBase->setIntProperty(kOfxImagePropRegionOfDefinition, pixelRod.left(), 0); ofxImageBase->setIntProperty(kOfxImagePropRegionOfDefinition, pixelRod.bottom(), 1); ofxImageBase->setIntProperty(kOfxImagePropRegionOfDefinition, pixelRod.right(), 2); @@ -1580,7 +1580,7 @@ OfxClipInstance::setClipTLS(ViewIdx view, assert(tls); tls->view.push_back(view); - tls->mipMapLevel.push_back(mipmapLevel); + tls->mipmapLevel.push_back(mipmapLevel); RenderActionDataPtr d( new RenderActionData() ); d->clipComponents = components; tls->renderData.push_back(d); @@ -1599,9 +1599,9 @@ OfxClipInstance::invalidateClipTLS() if ( !tls->view.empty() ) { tls->view.pop_back(); } - assert( !tls->mipMapLevel.empty() ); - if ( !tls->mipMapLevel.empty() ) { - tls->mipMapLevel.pop_back(); + assert( !tls->mipmapLevel.empty() ); + if ( !tls->mipmapLevel.empty() ) { + tls->mipmapLevel.pop_back(); } assert( !tls->renderData.empty() ); if ( !tls->renderData.empty() ) { diff --git a/Engine/OfxClipInstance.h b/Engine/OfxClipInstance.h index a4f95e7a92..4b016025e8 100644 --- a/Engine/OfxClipInstance.h +++ b/Engine/OfxClipInstance.h @@ -261,7 +261,7 @@ class OfxClipInstance //View may be involved in a recursive action std::list view; //mipmaplevel may be involved in a recursive action - std::list mipMapLevel; + std::list mipmapLevel; ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// @@ -279,7 +279,7 @@ class OfxClipInstance ClipTLSData() : view() - , mipMapLevel() + , mipmapLevel() , componentsPresent() , unmappedComponents() { @@ -287,7 +287,7 @@ class OfxClipInstance ClipTLSData(const ClipTLSData& other) : view(other.view) - , mipMapLevel(other.mipMapLevel) + , mipmapLevel(other.mipmapLevel) , renderData() , componentsPresent(other.componentsPresent) , unmappedComponents(other.unmappedComponents) diff --git a/Engine/OfxEffectInstance.cpp b/Engine/OfxEffectInstance.cpp index 2b36ae9d8c..6defbc2cb9 100644 --- a/Engine/OfxEffectInstance.cpp +++ b/Engine/OfxEffectInstance.cpp @@ -694,9 +694,6 @@ OfxEffectInstance::tryInitializeOverlayInteracts() OfxPluginEntryPoint *overlayEntryPoint = _imp->effect->getOverlayInteractMainEntry(); if (overlayEntryPoint) { _imp->overlayInteract.reset( new OfxOverlayInteract(*_imp->effect, 8, true) ); - double sx, sy; - effectInstance()->getRenderScaleRecursive(sx, sy); - RenderScale s(sx, sy); { ClipsThreadStorageSetter clipSetter(effectInstance(), @@ -1209,7 +1206,7 @@ OfxEffectInstance::onInputChanged(int inputNo) OfxClipInstance* clip = getClipCorrespondingToInput(inputNo); assert(clip); double time = getApp()->getTimeLine()->currentFrame(); - RenderScale s(1.); + const OfxPointD scale = {1., 1.}; { @@ -1222,7 +1219,7 @@ OfxEffectInstance::onInputChanged(int inputNo) assert(_imp->effect); _imp->effect->beginInstanceChangedAction(kOfxChangeUserEdited); - _imp->effect->clipInstanceChangedAction(clip->getName(), kOfxChangeUserEdited, time, s); + _imp->effect->clipInstanceChangedAction(clip->getName(), kOfxChangeUserEdited, time, scale); _imp->effect->endInstanceChangedAction(kOfxChangeUserEdited); } } @@ -1397,12 +1394,12 @@ OfxEffectInstance::getRegionOfDefinition(U64 /*hash*/, assert(_imp->effect); - unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); + unsigned int mipmapLevel = scale.toMipmapLevel(); // getRegionOfDefinition may be the first action with renderscale called on any effect. // it may have to check for render scale support. SupportsEnum supportsRS = supportsRenderScaleMaybe(); - bool scaleIsOne = (scale.x == 1. && scale.y == 1.); + bool scaleIsOne = scale == RenderScale::identity; if ( (supportsRS == eSupportsNo) && !scaleIsOne ) { qDebug() << "getRegionOfDefinition called with render scale != 1, but effect does not support render scale!"; @@ -1415,15 +1412,15 @@ OfxEffectInstance::getRegionOfDefinition(U64 /*hash*/, { ClipsThreadStorageSetter clipSetter(effectInstance(), view, - mipMapLevel); + mipmapLevel); assert(_imp->effect); if (getRecursionLevel() > 1) { - stat = _imp->effect->getRegionOfDefinitionAction(time, scale, view, ofxRod); + stat = _imp->effect->getRegionOfDefinitionAction(time, scale.toOfxPointD(), view, ofxRod); } else { ///Take the preferences lock so that it cannot be modified throughout the action. QReadLocker preferencesLocker(&_imp->preferencesLock); - stat = _imp->effect->getRegionOfDefinitionAction(time, scale, view, ofxRod); + stat = _imp->effect->getRegionOfDefinitionAction(time, scale.toOfxPointD(), view, ofxRod); } if (supportsRS == eSupportsMaybe) { OfxRectD tmpRod; @@ -1537,7 +1534,7 @@ OfxEffectInstance::calcDefaultRegionOfDefinition(U64 /*hash*/, throw std::runtime_error("OfxEffectInstance not initialized"); } - unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); + unsigned int mipmapLevel = scale.toMipmapLevel(); OfxRectD ofxRod; { @@ -1548,7 +1545,7 @@ OfxEffectInstance::calcDefaultRegionOfDefinition(U64 /*hash*/, if (getRecursionLevel() == 0) { ClipsThreadStorageSetter clipSetter(effectInstance(), view, - mipMapLevel); + mipmapLevel); // from http://openfx.sourceforge.net/Documentation/1.3/ofxProgrammingReference.html#kOfxImageEffectActionGetRegionOfDefinition @@ -1560,9 +1557,9 @@ OfxEffectInstance::calcDefaultRegionOfDefinition(U64 /*hash*/, // the following ofxh function does the job QReadLocker preferencesLocker(&_imp->preferencesLock); - ofxRod = _imp->effect->calcDefaultRegionOfDefinition(time, scale, view); + ofxRod = _imp->effect->calcDefaultRegionOfDefinition(time, scale.toOfxPointD(), view); } else { - ofxRod = _imp->effect->calcDefaultRegionOfDefinition(time, scale, view); + ofxRod = _imp->effect->calcDefaultRegionOfDefinition(time, scale.toOfxPointD(), view); } } rod->x1 = ofxRod.x1; @@ -1603,20 +1600,20 @@ OfxEffectInstance::getRegionsOfInterest(double time, OfxStatus stat; ///before calling getRoIaction set the relevant info on the clips - unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); + unsigned int mipmapLevel = scale.toMipmapLevel(); { SET_CAN_SET_VALUE(false); ClipsThreadStorageSetter clipSetter(effectInstance(), view, - mipMapLevel); + mipmapLevel); OfxRectD roi; rectToOfxRectD(renderWindow, &roi); ///Take the preferences lock so that it cannot be modified throughout the action. QReadLocker preferencesLocker(&_imp->preferencesLock); assert(_imp->effect); - stat = _imp->effect->getRegionOfInterestAction( (OfxTime)time, scale, view, + stat = _imp->effect->getRegionOfInterestAction( (OfxTime)time, scale.toOfxPointD(), view, roi, inputRois ); } @@ -1834,7 +1831,7 @@ OfxEffectInstance::isIdentity(double time, throw std::logic_error("isIdentity called with an unsupported RenderScale"); } - unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); + unsigned int mipmapLevel = scale.toMipmapLevel(); OfxStatus stat; { @@ -1843,7 +1840,7 @@ OfxEffectInstance::isIdentity(double time, ClipsThreadStorageSetter clipSetter(effectInstance(), view, - mipMapLevel); + mipmapLevel); OfxRectI ofxRoI; ofxRoI.x1 = renderWindow.left(); ofxRoI.x2 = renderWindow.right(); @@ -1855,11 +1852,11 @@ OfxEffectInstance::isIdentity(double time, int identityView = view; string identityPlane = kFnOfxImagePlaneColour; if (getRecursionLevel() > 1) { - stat = _imp->effect->isIdentityAction(inputTimeOfx, field, ofxRoI, scale, identityView, identityPlane, inputclip); + stat = _imp->effect->isIdentityAction(inputTimeOfx, field, ofxRoI, scale.toOfxPointD(), identityView, identityPlane, inputclip); } else { ///Take the preferences lock so that it cannot be modified throughout the action. QReadLocker preferencesLocker(&_imp->preferencesLock); - stat = _imp->effect->isIdentityAction(inputTimeOfx, field, ofxRoI, scale, identityView, identityPlane, inputclip); + stat = _imp->effect->isIdentityAction(inputTimeOfx, field, ofxRoI, scale.toOfxPointD(), identityView, identityPlane, inputclip); } if (identityView != view || identityPlane != kFnOfxImagePlaneColour) { //#pragma message WARN("can Natron RB2-multiplane2 handle isIdentity across views and planes?") @@ -1946,11 +1943,11 @@ OfxEffectInstance::beginSequenceRender(double first, assert(isSupportedRenderScale(supportsRenderScaleMaybe(), scale)); OfxStatus stat; - unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); + unsigned int mipmapLevel = scale.toMipmapLevel(); { ClipsThreadStorageSetter clipSetter(effectInstance(), view, - mipMapLevel); + mipmapLevel); SET_CAN_SET_VALUE(false); @@ -1960,7 +1957,7 @@ OfxEffectInstance::beginSequenceRender(double first, ///Take the preferences lock so that it cannot be modified throughout the action. QReadLocker preferencesLocker(&_imp->preferencesLock); stat = effectInstance()->beginRenderAction(first, last, step, - interactive, scale, + interactive, scale.toOfxPointD(), isSequentialRender, isRenderResponseToUserInteraction, isOpenGLRender, oglData, draftMode, view); } @@ -1988,11 +1985,11 @@ OfxEffectInstance::endSequenceRender(double first, assert(isSupportedRenderScale(supportsRenderScaleMaybe(), scale)); OfxStatus stat; - unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); + unsigned int mipmapLevel = scale.toMipmapLevel(); { ClipsThreadStorageSetter clipSetter(effectInstance(), view, - mipMapLevel); + mipmapLevel); SET_CAN_SET_VALUE(false); OfxGLContextEffectData* isOfxGLData = dynamic_cast( glContextData.get() ); @@ -2001,7 +1998,7 @@ OfxEffectInstance::endSequenceRender(double first, ///Take the preferences lock so that it cannot be modified throughout the action. QReadLocker preferencesLocker(&_imp->preferencesLock); stat = effectInstance()->endRenderAction(first, last, step, - interactive, scale, + interactive, scale.toOfxPointD(), isSequentialRender, isRenderResponseToUserInteraction, isOpenGLRender, oglData, draftMode, view); } @@ -2078,7 +2075,7 @@ OfxEffectInstance::render(const RenderActionArgs& args) RenderThreadStorageSetter clipSetter(effectInstance(), args.view, - Image::getLevelFromScale(args.originalScale.x), + args.originalScale.toMipmapLevel(), firstPlane.first, args.inputImages); OfxGLContextEffectData* isOfxGLData = dynamic_cast( args.glContextData.get() ); @@ -2089,7 +2086,7 @@ OfxEffectInstance::render(const RenderActionArgs& args) stat = _imp->effect->renderAction( (OfxTime)args.time, field, ofxRoI, - args.mappedScale, + args.mappedScale.toOfxPointD(), args.isSequentialRender, args.isRenderResponseToUserInteraction, args.useOpenGL, @@ -2203,7 +2200,7 @@ OfxEffectInstance::drawOverlay(double time, } if (_imp->overlayInteract) { SET_CAN_SET_VALUE(false); - _imp->overlayInteract->drawAction(time, renderScale, view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0); + _imp->overlayInteract->drawAction(time, renderScale.toOfxPointD(), view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0); } } @@ -2238,7 +2235,7 @@ OfxEffectInstance::onOverlayPenDown(double time, SET_CAN_SET_VALUE(true); - OfxStatus stat = _imp->overlayInteract->penDownAction(time, renderScale, view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, penPos, penPosViewport, pressure); + OfxStatus stat = _imp->overlayInteract->penDownAction(time, renderScale.toOfxPointD(), view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, penPos, penPosViewport, pressure); if ( (getRecursionLevel() == 1) && checkIfOverlayRedrawNeeded() ) { @@ -2279,7 +2276,7 @@ OfxEffectInstance::onOverlayPenMotion(double time, OfxStatus stat; SET_CAN_SET_VALUE(true); - stat = _imp->overlayInteract->penMotionAction(time, renderScale, view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, penPos, penPosViewport, pressure); + stat = _imp->overlayInteract->penMotionAction(time, renderScale.toOfxPointD(), view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, penPos, penPosViewport, pressure); if ( (getRecursionLevel() == 1) && checkIfOverlayRedrawNeeded() ) { stat = _imp->overlayInteract->redraw(); @@ -2315,7 +2312,7 @@ OfxEffectInstance::onOverlayPenUp(double time, penPosViewport.y = viewportPos.y(); SET_CAN_SET_VALUE(true); - OfxStatus stat = _imp->overlayInteract->penUpAction(time, renderScale, view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, penPos, penPosViewport, pressure); + OfxStatus stat = _imp->overlayInteract->penUpAction(time, renderScale.toOfxPointD(), view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, penPos, penPosViewport, pressure); if ( (getRecursionLevel() == 1) && checkIfOverlayRedrawNeeded() ) { stat = _imp->overlayInteract->redraw(); @@ -2345,7 +2342,7 @@ OfxEffectInstance::onOverlayKeyDown(double time, if (_imp->overlayInteract) { QByteArray keyStr; SET_CAN_SET_VALUE(true); - OfxStatus stat = _imp->overlayInteract->keyDownAction( time, renderScale, view,_imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, (int)key, keyStr.data() ); + OfxStatus stat = _imp->overlayInteract->keyDownAction( time, renderScale.toOfxPointD(), view,_imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, (int)key, keyStr.data() ); if ( (getRecursionLevel() == 1) && checkIfOverlayRedrawNeeded() ) { stat = _imp->overlayInteract->redraw(); @@ -2373,7 +2370,7 @@ OfxEffectInstance::onOverlayKeyUp(double time, if (_imp->overlayInteract) { QByteArray keyStr; SET_CAN_SET_VALUE(true); - OfxStatus stat = _imp->overlayInteract->keyUpAction( time, renderScale, view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, (int)key, keyStr.data() ); + OfxStatus stat = _imp->overlayInteract->keyUpAction( time, renderScale.toOfxPointD(), view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, (int)key, keyStr.data() ); if ( (getRecursionLevel() == 1) && checkIfOverlayRedrawNeeded() ) { stat = _imp->overlayInteract->redraw(); @@ -2404,7 +2401,7 @@ OfxEffectInstance::onOverlayKeyRepeat(double time, QByteArray keyStr; SET_CAN_SET_VALUE(true); - OfxStatus stat = _imp->overlayInteract->keyRepeatAction( time, renderScale, view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, (int)key, keyStr.data() ); + OfxStatus stat = _imp->overlayInteract->keyRepeatAction( time, renderScale.toOfxPointD(), view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0, (int)key, keyStr.data() ); if ( (getRecursionLevel() == 1) && checkIfOverlayRedrawNeeded() ) { stat = _imp->overlayInteract->redraw(); @@ -2430,7 +2427,7 @@ OfxEffectInstance::onOverlayFocusGained(double time, if (_imp->overlayInteract) { OfxStatus stat; SET_CAN_SET_VALUE(true); - stat = _imp->overlayInteract->gainFocusAction(time, renderScale, view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0); + stat = _imp->overlayInteract->gainFocusAction(time, renderScale.toOfxPointD(), view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0); if (stat == kOfxStatOK) { return true; } @@ -2450,7 +2447,7 @@ OfxEffectInstance::onOverlayFocusLost(double time, if (_imp->overlayInteract) { OfxStatus stat; SET_CAN_SET_VALUE(true); - stat = _imp->overlayInteract->loseFocusAction(time, renderScale, view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0); + stat = _imp->overlayInteract->loseFocusAction(time, renderScale.toOfxPointD(), view, _imp->overlayInteract->hasColorPicker() ? &_imp->overlayInteract->getLastColorPickerColor() : /*colourPicker=*/0); if (stat == kOfxStatOK) { return true; } @@ -2606,19 +2603,19 @@ OfxEffectInstance::knobChanged(KnobI* k, ViewIdx v = ( view.isAll() || view.isCurrent() ) ? ViewIdx(0) : ViewIdx(view); ClipsThreadStorageSetter clipSetter( effect, v, - Image::getLevelFromScale(renderScale.x) ); + renderScale.toMipmapLevel() ); ///This action as all the overlay interacts actions can trigger recursive actions, such as ///getClipPreferences() so we don't take the clips preferences lock for read here otherwise we would ///create a deadlock. This code then assumes that the instance changed action of the plug-in doesn't require ///the clip preferences to stay the same throughout the action. - stat = effect->paramInstanceChangedAction(k->getOriginalName(), ofxReason, (OfxTime)time, renderScale); + stat = effect->paramInstanceChangedAction(k->getOriginalName(), ofxReason, (OfxTime)time, renderScale.toOfxPointD()); } else { ///This action as all the overlay interacts actions can trigger recursive actions, such as ///getClipPreferences() so we don't take the clips preferences lock for read here otherwise we would ///create a deadlock. This code then assumes that the instance changed action of the plug-in doesn't require ///the clip preferences to stay the same throughout the action. - stat = effect->paramInstanceChangedAction(k->getOriginalName(), ofxReason, (OfxTime)time, renderScale); + stat = effect->paramInstanceChangedAction(k->getOriginalName(), ofxReason, (OfxTime)time, renderScale.toOfxPointD()); } if ( (stat != kOfxStatOK) && (stat != kOfxStatReplyDefault) ) { @@ -2994,10 +2991,10 @@ OfxEffectInstance::getTransform(double time, ClipsThreadStorageSetter clipSetter( effectInstance(), view, - Image::getLevelFromScale(renderScale.x) ); + renderScale.toMipmapLevel() ); try { - stat = effectInstance()->getTransformAction( (OfxTime)time, field, renderScale, draftRender, view, clipName, tmpTransform ); + stat = effectInstance()->getTransformAction( (OfxTime)time, field, renderScale.toOfxPointD(), draftRender, view, clipName, tmpTransform ); } catch (...) { return eStatusFailed; } diff --git a/Engine/OfxImageEffectInstance.cpp b/Engine/OfxImageEffectInstance.cpp index 3e78fe085a..e5bda6ad39 100644 --- a/Engine/OfxImageEffectInstance.cpp +++ b/Engine/OfxImageEffectInstance.cpp @@ -442,9 +442,9 @@ OfxImageEffectInstance::getRenderScaleRecursive(double &x, ///get the render scale of the 1st viewer if ( !attachedViewers.empty() ) { ViewerInstance* first = attachedViewers.front(); - int mipMapLevel = first->getMipMapLevel(); - x = Image::getScaleFromMipMapLevel( (unsigned int)mipMapLevel ); - y = x; + const auto scale = RenderScale::fromMipmapLevel(first->getMipmapLevel()).toOfxPointD(); + x = scale.x; + y = scale.y; } else { x = 1.; y = 1.; diff --git a/Engine/OpenGLViewerI.h b/Engine/OpenGLViewerI.h index 45a0ebded8..6ef7a9de92 100644 --- a/Engine/OpenGLViewerI.h +++ b/Engine/OpenGLViewerI.h @@ -75,10 +75,10 @@ class OpenGLViewerI * @brief Given the region of definition of an image, must return the portion of that image which is * actually displayed on the viewport. (It cannot be bigger than the rod) **/ - virtual RectI getImageRectangleDisplayed(const RectI & pixelRod, const double par, unsigned int mipMapLevel) = 0; - virtual RectI getImageRectangleDisplayedRoundedToTileSize(int texIndex, const RectD & rod, const double par, unsigned int mipMapLevel, + virtual RectI getImageRectangleDisplayed(const RectI & pixelRod, const double par, unsigned int mipmapLevel) = 0; + virtual RectI getImageRectangleDisplayedRoundedToTileSize(int texIndex, const RectD & rod, const double par, unsigned int mipmapLevel, std::vector* tiles, std::vector* tilesRounded, int *tileSize, RectI* roiNotRounded) = 0; - virtual RectI getExactImageRectangleDisplayed(int texIndex, const RectD & rod, const double par, unsigned int mipMapLevel) = 0; + virtual RectI getExactImageRectangleDisplayed(int texIndex, const RectD & rod, const double par, unsigned int mipmapLevel) = 0; /** * @brief Must return the bit depth of the texture used to render. (Byte, half or float) @@ -123,7 +123,7 @@ class OpenGLViewerI const RectD& rod, double par, ImageBitDepthEnum depth, - unsigned int mipMapLevel, + unsigned int mipmapLevel, ImagePremultiplicationEnum premult, double gain, double gamma, diff --git a/Engine/OutputEffectInstance.cpp b/Engine/OutputEffectInstance.cpp index 1df1d2c203..00a5914835 100644 --- a/Engine/OutputEffectInstance.cpp +++ b/Engine/OutputEffectInstance.cpp @@ -491,7 +491,7 @@ OutputEffectInstance::reportStats(int time, ofile << std::endl; ofile << "Mipmap level(s) rendered: "; - for (std::set::const_iterator it2 = it->second.getMipMapLevelsRendered().begin(); it2 != it->second.getMipMapLevelsRendered().end(); ++it2) { + for (std::set::const_iterator it2 = it->second.getMipmapLevelsRendered().begin(); it2 != it->second.getMipmapLevelsRendered().end(); ++it2) { ofile << *it2 << ' '; } ofile << std::endl; diff --git a/Engine/OutputSchedulerThread.cpp b/Engine/OutputSchedulerThread.cpp index c1dee7c0af..49d7910bcf 100644 --- a/Engine/OutputSchedulerThread.cpp +++ b/Engine/OutputSchedulerThread.cpp @@ -1085,11 +1085,10 @@ OutputSchedulerThread::startRender() } SequentialPreferenceEnum pref = effect->getSequentialPreference(); if ( (pref == eSequentialPreferenceOnlySequential) || (pref == eSequentialPreferencePreferSequential) ) { - RenderScale scaleOne(1.); if (effect->beginSequenceRender_public( firstFrame, lastFrame, frameStep, false, - scaleOne, true, + RenderScale::identity, true, true, false, ViewIdx(0), @@ -1176,11 +1175,10 @@ OutputSchedulerThread::stopRender() firstFrame = args->firstFrame; lastFrame = args->lastFrame; - RenderScale scaleOne(1.); ignore_result( effect->endSequenceRender_public( firstFrame, lastFrame, 1, !appPTR->isBackground(), - scaleOne, true, + RenderScale::identity, true, !appPTR->isBackground(), false, ViewIdx(0), @@ -2245,8 +2243,8 @@ class DefaultRenderFrameRunnable try { ////Writers always render at scale 1. - int mipMapLevel = 0; - RenderScale scale(1.); + const int mipmapLevel = 0; + const RenderScale scale = RenderScale::fromMipmapLevel(mipmapLevel); RectD rod; bool isProjectFormat; @@ -2323,7 +2321,7 @@ class DefaultRenderFrameRunnable { FrameRequestMap request; - stat = EffectInstance::computeRequestPass(time, viewsToRender[view], mipMapLevel, rod, activeInputNode, request); + stat = EffectInstance::computeRequestPass(time, viewsToRender[view], mipmapLevel, rod, activeInputNode, request); if (stat == eStatusFailed) { _imp->scheduler->notifyRenderFailure("Error caught while rendering"); @@ -2335,7 +2333,7 @@ class DefaultRenderFrameRunnable std::map planes; std::unique_ptr renderArgs( new EffectInstance::RenderRoIArgs(time, //< the time at which to render scale, //< the scale at which to render - mipMapLevel, //< the mipmap level (redundant with the scale) + mipmapLevel, //< the mipmap level (redundant with the scale) viewsToRender[view], //< the view to render false, renderWindow, //< the region of interest (in pixel coordinates) @@ -2406,8 +2404,6 @@ DefaultScheduler::processFrame(const BufferedFrames& frames) //Only consider the first frame, we shouldn't have multiple view here anyway. const BufferedFrame& frame = frames.front(); - ///Writers render to scale 1 always - RenderScale scale(1.); OutputEffectInstancePtr effect = _effect.lock(); U64 hash = effect->getHash(); bool isProjectFormat; @@ -2444,6 +2440,8 @@ DefaultScheduler::processFrame(const BufferedFrames& frames) false, it->stats); RectD rod; + ///Writers render to scale 1 always + const RenderScale scale; ignore_result( effect->getRegionOfDefinition_public(hash, it->time, scale, it->view, &rod, &isProjectFormat) ); const RectI roi = rod.toPixelEnclosing(0, par); diff --git a/Engine/OverlaySupport.h b/Engine/OverlaySupport.h index cc78dba58b..e03fe06165 100644 --- a/Engine/OverlaySupport.h +++ b/Engine/OverlaySupport.h @@ -98,7 +98,7 @@ class OverlaySupport /** * @brief Get the current mipmapLevel applied by the viewer **/ - virtual unsigned int getCurrentRenderScale() const = 0; + virtual unsigned int getCurrentMipmapLevel() const { return 0; } /** * @brief Returns whether the given rectangle in canonical coords is visible in the viewport diff --git a/Engine/ParallelRenderArgs.cpp b/Engine/ParallelRenderArgs.cpp index 8043e7ede9..8d9093520f 100644 --- a/Engine/ParallelRenderArgs.cpp +++ b/Engine/ParallelRenderArgs.cpp @@ -51,7 +51,7 @@ EffectInstance::treeRecurseFunctor(bool isRenderFunctor, const InputMatrixMapPtr& reroutesMap, bool useTransforms, // roi functor specific StorageModeEnum renderStorageMode, // if the render of this node is in OpenGL - unsigned int originalMipMapLevel, // roi functor specific + unsigned int originalMipmapLevel, // roi functor specific double time, ViewIdx view, const NodePtr& treeRoot, @@ -232,7 +232,7 @@ EffectInstance::treeRecurseFunctor(bool isRenderFunctor, StatusEnum stat = EffectInstance::getInputsRoIsFunctor(useTransforms, f, viewIt->first, - originalMipMapLevel, + originalMipmapLevel, inputNode, node, treeRoot, @@ -246,9 +246,6 @@ EffectInstance::treeRecurseFunctor(bool isRenderFunctor, ///Do not count frames pre-fetched in RoI functor mode, it is harmless and may ///limit calculations that will be done later on anyway. } else { - RenderScale scaleOne(1.); - RenderScale scale( Image::getScaleFromMipMapLevel(originalMipMapLevel) ); - ///Render the input image with the bit depth of its preference ImageBitDepthEnum inputPrefDepth = inputEffect->getBitDepth(-1); @@ -260,16 +257,16 @@ EffectInstance::treeRecurseFunctor(bool isRenderFunctor, frameArgs->request->getFrameViewCanonicalRoI(f, viewIt->first, &roi); } - const unsigned int upstreamMipMapLevel = useScaleOneInputs ? 0 : originalMipMapLevel; - const RenderScale & upstreamScale = useScaleOneInputs ? scaleOne : scale; - const RectI inputRoIPixelCoords = roi.toPixelEnclosing(upstreamMipMapLevel, inputPar); + const unsigned int upstreamMipmapLevel = useScaleOneInputs ? 0 : originalMipmapLevel; + const RenderScale upstreamScale = useScaleOneInputs ? RenderScale::identity : RenderScale::fromMipmapLevel(originalMipmapLevel); + const RectI inputRoIPixelCoords = roi.toPixelEnclosing(upstreamMipmapLevel, inputPar); std::map inputImgs; { std::unique_ptr renderArgs; renderArgs.reset( new EffectInstance::RenderRoIArgs( f, //< time upstreamScale, //< scale - upstreamMipMapLevel, //< mipmapLevel (redundant with the scale) + upstreamMipmapLevel, //< mipmapLevel (redundant with the scale) viewIt->first, //< view byPassCache, inputRoIPixelCoords, //< roi in pixel coordinates @@ -314,7 +311,7 @@ StatusEnum EffectInstance::getInputsRoIsFunctor(bool useTransforms, double time, ViewIdx view, - unsigned originalMipMapLevel, + unsigned originalMipmapLevel, const NodePtr& node, const NodePtr& /*callerNode*/, const NodePtr& treeRoot, @@ -336,7 +333,7 @@ EffectInstance::getInputsRoIsFunctor(bool useTransforms, assert(effect->supportsRenderScaleMaybe() == EffectInstance::eSupportsNo || effect->supportsRenderScaleMaybe() == EffectInstance::eSupportsYes); bool supportsRs = effect->supportsRenderScale(); - unsigned int mappedLevel = supportsRs ? originalMipMapLevel : 0; + unsigned int mappedLevel = supportsRs ? originalMipmapLevel : 0; FrameRequestMap::iterator foundNode = requests.find(node); if ( foundNode != requests.end() ) { nodeRequest = foundNode->second; @@ -344,7 +341,7 @@ EffectInstance::getInputsRoIsFunctor(bool useTransforms, ///Setup global data for the node for the whole frame render NodeFrameRequestPtr tmp = std::make_shared(); - tmp->mappedScale.x = tmp->mappedScale.y = Image::getScaleFromMipMapLevel(mappedLevel); + tmp->mappedScale = RenderScale::fromMipmapLevel(mappedLevel); tmp->nodeHash = effect->getRenderHash(); std::pair ret = requests.insert( std::make_pair(node, tmp) ); @@ -444,7 +441,7 @@ EffectInstance::getInputsRoIsFunctor(bool useTransforms, StatusEnum stat = getInputsRoIsFunctor(useTransforms, fvRequest->globalData.inputIdentityTime, inputView, - originalMipMapLevel, + originalMipmapLevel, node, node, treeRoot, @@ -465,7 +462,7 @@ EffectInstance::getInputsRoIsFunctor(bool useTransforms, StatusEnum stat = getInputsRoIsFunctor(useTransforms, fvRequest->globalData.inputIdentityTime, fvRequest->globalData.identityView, - originalMipMapLevel, + originalMipmapLevel, inputIdentityNode, node, treeRoot, @@ -523,7 +520,7 @@ EffectInstance::getInputsRoIsFunctor(bool useTransforms, fvRequest->globalData.transforms, useTransforms, eStorageModeRAM /*returnStorage*/, - originalMipMapLevel, + originalMipmapLevel, time, view, treeRoot, @@ -542,7 +539,7 @@ EffectInstance::getInputsRoIsFunctor(bool useTransforms, StatusEnum EffectInstance::computeRequestPass(double time, ViewIdx view, - unsigned int mipMapLevel, + unsigned int mipmapLevel, const RectD& renderWindow, const NodePtr& treeRoot, FrameRequestMap& request) @@ -551,7 +548,7 @@ EffectInstance::computeRequestPass(double time, StatusEnum stat = getInputsRoIsFunctor(doTransforms, time, view, - mipMapLevel, + mipmapLevel, treeRoot, treeRoot, treeRoot, diff --git a/Engine/ParallelRenderArgs.h b/Engine/ParallelRenderArgs.h index 04881cc4aa..ca75b53dfc 100644 --- a/Engine/ParallelRenderArgs.h +++ b/Engine/ParallelRenderArgs.h @@ -35,6 +35,7 @@ #include "Global/GlobalDefines.h" #include "Engine/RectD.h" +#include "Engine/RenderScale.h" #include "Engine/ViewIdx.h" #include "Engine/EngineFwd.h" diff --git a/Engine/Project.cpp b/Engine/Project.cpp index 4b30403bce..1f4ffc4b0a 100644 --- a/Engine/Project.cpp +++ b/Engine/Project.cpp @@ -1001,6 +1001,7 @@ Project::initializeKnobs() colorSpaces.push_back(ChoiceOption("Linear","","")); colorSpaces.push_back(ChoiceOption("sRGB","","")); colorSpaces.push_back(ChoiceOption("Rec.709","","")); + colorSpaces.push_back(ChoiceOption("BT1886","","")); _imp->colorSpace8u = AppManager::createKnob( this, tr("8-Bit LUT") ); _imp->colorSpace8u->setName("defaultColorSpace8u"); diff --git a/Engine/PyNode.cpp b/Engine/PyNode.cpp index f1071c1cf4..3b84c3c470 100644 --- a/Engine/PyNode.cpp +++ b/Engine/PyNode.cpp @@ -967,9 +967,8 @@ Effect::getRegionOfDefinition(double time, return rod; } U64 hash = getInternalNode()->getHashValue(); - RenderScale s(1.); bool isProject; - StatusEnum stat = getInternalNode()->getEffectInstance()->getRegionOfDefinition_public(hash, time, s, ViewIdx(view), &rod, &isProject); + StatusEnum stat = getInternalNode()->getEffectInstance()->getRegionOfDefinition_public(hash, time, RenderScale::identity, ViewIdx(view), &rod, &isProject); if (stat != eStatusOK) { return RectD(); } diff --git a/Engine/Qt4/NatronEngine/rectd_wrapper.cpp b/Engine/Qt4/NatronEngine/rectd_wrapper.cpp index 4c561a2063..b3b3ade866 100644 --- a/Engine/Qt4/NatronEngine/rectd_wrapper.cpp +++ b/Engine/Qt4/NatronEngine/rectd_wrapper.cpp @@ -384,8 +384,11 @@ static PyObject* Sbk_RectDFunc_intersect(PyObject* self, PyObject* args) // intersect(RectD,RectD*)const // Begin code injection - RectD t; - cppSelf->intersect(*cppArg0,&t); + // Original: + //RectD t; + //cppSelf->intersect(*cppArg0,&t); + // Fix after https://github.com/NatronGitHub/Natron/pull/914 : + RectD t = cppSelf->intersect(*cppArg0); pyResult = Shiboken::Conversions::copyToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_RECTD_IDX], &t); return pyResult; @@ -410,8 +413,11 @@ static PyObject* Sbk_RectDFunc_intersect(PyObject* self, PyObject* args) // intersect(double,double,double,double,RectD*)const // Begin code injection - RectD t; - cppSelf->intersect(cppArg0,cppArg1,cppArg2,cppArg3,&t); + // Original: + //RectD t; + //cppSelf->intersect(cppArg0,cppArg1,cppArg2,cppArg3,&t); + // Fix after https://github.com/NatronGitHub/Natron/pull/914 : + RectD t = cppSelf->intersect(cppArg0,cppArg1,cppArg2,cppArg3); pyResult = Shiboken::Conversions::copyToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_RECTD_IDX], &t); return pyResult; diff --git a/Engine/Qt4/NatronEngine/recti_wrapper.cpp b/Engine/Qt4/NatronEngine/recti_wrapper.cpp index 7afb3c550f..6b8b924f86 100644 --- a/Engine/Qt4/NatronEngine/recti_wrapper.cpp +++ b/Engine/Qt4/NatronEngine/recti_wrapper.cpp @@ -377,8 +377,12 @@ static PyObject* Sbk_RectIFunc_intersect(PyObject* self, PyObject* args) // intersect(RectI,RectI*)const // Begin code injection - RectI t; - cppSelf->intersect(*cppArg0,&t); + // Original: + //RectI t; + //cppSelf->intersect(*cppArg0,&t); + // Fix after https://github.com/NatronGitHub/Natron/pull/914 : + RectI t = cppSelf->intersect(*cppArg0); + pyResult = Shiboken::Conversions::copyToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_RECTI_IDX], &t); return pyResult; @@ -403,8 +407,11 @@ static PyObject* Sbk_RectIFunc_intersect(PyObject* self, PyObject* args) // intersect(int,int,int,int,RectI*)const // Begin code injection - RectI t; - cppSelf->intersect(cppArg0,cppArg1,cppArg2,cppArg3,&t); + // Original: + //RectI t; + //cppSelf->intersect(cppArg0,cppArg1,cppArg2,cppArg3,&t); + // Fix after https://github.com/NatronGitHub/Natron/pull/914 : + RectI t = cppSelf->intersect(cppArg0,cppArg1,cppArg2,cppArg3); pyResult = Shiboken::Conversions::copyToPython((SbkObjectType*)SbkNatronEngineTypes[SBK_RECTI_IDX], &t); return pyResult; diff --git a/Engine/RectD.cpp b/Engine/RectD.cpp index 5d8e67c0a9..f6718859ce 100644 --- a/Engine/RectD.cpp +++ b/Engine/RectD.cpp @@ -30,24 +30,22 @@ #include #include "Engine/RectI.h" +#include "Engine/RenderScale.h" NATRON_NAMESPACE_ENTER RectI -RectD::toPixelEnclosing(const RenderScale& scale, +RectD::toPixelEnclosing(const RenderScale& renderScale, double par) const { - return RectI(std::floor(x1 * scale.x / par), - std::floor(y1 * scale.y), - std::ceil(x2 * scale.x / par), - std::ceil(y2 * scale.y)); + return toPixelEnclosing(renderScale.toMipmapLevel(), par); } RectI -RectD::toPixelEnclosing(unsigned int mipMapLevel, +RectD::toPixelEnclosing(unsigned int mipmapLevel, double par) const { - const double scale = 1. / (1 << mipMapLevel); + const double scale = 1. / (1 << mipmapLevel); return RectI(std::floor(x1 * scale / par), std::floor(y1 * scale), std::ceil(x2 * scale / par), diff --git a/Engine/RectD.h b/Engine/RectD.h index e33778ea8b..5ef81d4eaf 100644 --- a/Engine/RectD.h +++ b/Engine/RectD.h @@ -265,14 +265,23 @@ class RectD return intersect(RectD(l, b, r, t)); } + /** + * @brief Updates this rectangle to the intersection of this rectangle and |rect|. If there is no overlap, this rectangle is cleared so it represents a + * null rectangle. + **/ + void clip(const RectD& rect) { + if (!intersectInternal(rect, this)) { + // |rect| does not intersect with *this so clear this object so it becomes a null rectangle. + clear(); + } + } + /** * @brief Updates this rectangle to the intersection rectangle if this rectangle overlaps with rect. If there is no overlap then this rectangle remains unchanged. - * - * @returns True if the rectangles overlap and this rectangle was clipped. **/ - bool clipIfOverlaps(const RectD& rect) + void clipIfOverlaps(const RectD& rect) { - return intersectInternal(rect, this); + intersectInternal(rect, this); } /// returns true if the rect passed as parameter is intersects this one @@ -337,7 +346,7 @@ class RectD RectI toPixelEnclosing(const RenderScale & scale, double par) const; - RectI toPixelEnclosing(unsigned int mipMapLevel, + RectI toPixelEnclosing(unsigned int mipmapLevel, double par) const; static void ofxRectDToRectD(const OfxRectD & r, diff --git a/Engine/RectI.cpp b/Engine/RectI.cpp index 27a80e1908..406f0ec2f0 100644 --- a/Engine/RectI.cpp +++ b/Engine/RectI.cpp @@ -135,7 +135,7 @@ RectI::toCanonical_noClipping(unsigned int thisLevel, } RectI -RectI::toNewMipMapLevel(unsigned int fromLevel, unsigned int toLevel, double par, const RectD& rod) const +RectI::toNewMipmapLevel(unsigned int fromLevel, unsigned int toLevel, double par, const RectD& rod) const { return toCanonical(fromLevel, par, rod).toPixelEnclosing(toLevel, par); } diff --git a/Engine/RectI.h b/Engine/RectI.h index 6220d5a643..bcdc8c053f 100644 --- a/Engine/RectI.h +++ b/Engine/RectI.h @@ -190,7 +190,7 @@ class RectI * @param rod The region of definition to clip this rectangle to when converting it to canonical coordinates. * **/ - RectI toNewMipMapLevel(unsigned int fromLevel, unsigned int toLevel, double par, const RectD& rod) const; + RectI toNewMipmapLevel(unsigned int fromLevel, unsigned int toLevel, double par, const RectD& rod) const; // the following should never be used: only canonical coordinates may be downscaled /** @@ -405,14 +405,23 @@ class RectI return intersect(RectI(x1_, y1_, x2_, y2_)); } + /** + * @brief Updates this rectangle to the intersection of this rectangle and |rect|. If there is no overlap, this rectangle is cleared so it represents a + * null rectangle. + **/ + void clip(const RectI& rect) { + if (!intersectInternal(rect, this)) { + // |rect| does not intersect with *this so clear this object so it becomes a null rectangle. + clear(); + } + } + /** * @brief Updates this rectangle to the intersection rectangle if this rectangle overlaps with rect. If there is no overlap then this rectangle remains unchanged. - * - * @returns True if the rectangles overlap and this rectangle was clipped. **/ - bool clipIfOverlaps(const RectI& rect) + void clipIfOverlaps(const RectI& rect) { - return intersectInternal(rect, this); + intersectInternal(rect, this); } /// returns true if the rect passed as parameter intersects this one diff --git a/Engine/RenderScale.cpp b/Engine/RenderScale.cpp new file mode 100644 index 0000000000..6b5fea9920 --- /dev/null +++ b/Engine/RenderScale.cpp @@ -0,0 +1,31 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * This file is part of Natron , + * (C) 2018-2023 The Natron developers + * (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat + * + * Natron is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Natron is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Natron. If not, see + * ***** END LICENSE BLOCK ***** */ + +#include "RenderScale.h" + +#include "Global/Macros.h" + +#include "Engine/Image.h" + +NATRON_NAMESPACE_ENTER + +// static +const RenderScale RenderScale::identity; + +NATRON_NAMESPACE_EXIT diff --git a/Engine/RenderScale.h b/Engine/RenderScale.h new file mode 100644 index 0000000000..3a09eb8c6c --- /dev/null +++ b/Engine/RenderScale.h @@ -0,0 +1,60 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * This file is part of Natron , + * (C) 2018-2023 The Natron developers + * (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat + * + * Natron is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Natron is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Natron. If not, see + * ***** END LICENSE BLOCK ***** */ + +#ifndef RENDERSCALE_H +#define RENDERSCALE_H + +#include + +#include "Global/Macros.h" + +#include "ofxCore.h" + +NATRON_NAMESPACE_ENTER + +class RenderScale { +public: + // Default constructed object has x & y scale set to 1. + constexpr RenderScale() = default; + + // Named constant where x & y scale are both 1. (i.e the identity scale factor in both directions.) + static const RenderScale identity; + + bool operator==(const RenderScale& rhs) const { return mipmapLevel == rhs.mipmapLevel; } + bool operator!=(const RenderScale& rhs) const { return !(*this == rhs); } + + OfxPointD toOfxPointD() const + { + assert(mipmapLevel < 8 * sizeof(mipmapLevel)); + const double scale = 1. / (1 << mipmapLevel); + return { scale, scale }; + } + + static RenderScale fromMipmapLevel(unsigned int mipmapLevel) { return RenderScale(mipmapLevel); } + unsigned int toMipmapLevel() const { return mipmapLevel; } + +private: + RenderScale(unsigned int mipmapLevel_) : mipmapLevel(mipmapLevel_) {} + + unsigned int mipmapLevel = 0; +}; + +NATRON_NAMESPACE_EXIT + +#endif // RENDERSCALE_H diff --git a/Engine/RenderStats.cpp b/Engine/RenderStats.cpp index 8c34785f91..4f6b779566 100644 --- a/Engine/RenderStats.cpp +++ b/Engine/RenderStats.cpp @@ -207,13 +207,13 @@ NodeRenderStats::getIdentityRectangles() const } void -NodeRenderStats::addMipMapLevelRendered(unsigned int level) +NodeRenderStats::addMipmapLevelRendered(unsigned int level) { _imp->mipmapLevelsAccessed.insert(level); } const std::set& -NodeRenderStats::getMipMapLevelsRendered() const +NodeRenderStats::getMipmapLevelsRendered() const { return _imp->mipmapLevelsAccessed; } @@ -397,7 +397,7 @@ RenderStats::setGlobalRenderInfosForNode(const NodePtr& node, stats.setOutputPremult(outputPremult); stats.setTilesSupported(tilesSupported); stats.setRenderScaleSupported(renderScaleSupported); - stats.addMipMapLevelRendered(mipmapLevel); + stats.addMipmapLevelRendered(mipmapLevel); stats.setChannelsRendered(channelsRendered); stats.setRoD(rod); } diff --git a/Engine/RenderStats.h b/Engine/RenderStats.h index 562eb9a976..57553f091e 100644 --- a/Engine/RenderStats.h +++ b/Engine/RenderStats.h @@ -73,8 +73,8 @@ class NodeRenderStats void addIdentityRectangle(const NodePtr& identity, const RectI& rectangle); std::list > getIdentityRectangles() const; - void addMipMapLevelRendered(unsigned int level); - const std::set& getMipMapLevelsRendered() const; + void addMipmapLevelRendered(unsigned int level); + const std::set& getMipmapLevelsRendered() const; void addPlaneRendered(const std::string& plane); const std::set& getPlanesRendered() const; diff --git a/Engine/RotoContext.cpp b/Engine/RotoContext.cpp index 8be90e4fc1..d1f850fc4b 100644 --- a/Engine/RotoContext.cpp +++ b/Engine/RotoContext.cpp @@ -2546,7 +2546,7 @@ RotoStrokeItem::renderSingleStroke(const RectD& pointsBbox, ImageFieldingOrderEnum fielding = node->getEffectInstance()->getFieldingOrder(); ImagePremultiplicationEnum premult = node->getEffectInstance()->getPremult(); bool copyFromImage = false; - bool mipMapLevelChanged = false; + bool mipmapLevelChanged = false; if (!source) { source.reset( new Image(components, pointsBbox, @@ -2559,11 +2559,11 @@ RotoStrokeItem::renderSingleStroke(const RectD& pointsBbox, false) ); *image = source; } else { - if ( (*image)->getMipMapLevel() > mipmapLevel ) { - mipMapLevelChanged = true; + if ( (*image)->getMipmapLevel() > mipmapLevel ) { + mipmapLevelChanged = true; RectD otherRoD = (*image)->getRoD(); - const RectI oldBounds = otherRoD.toPixelEnclosing( (*image)->getMipMapLevel(), par); + const RectI oldBounds = otherRoD.toPixelEnclosing( (*image)->getMipmapLevel(), par); RectD mergeRoD = pointsBbox; mergeRoD.merge(otherRoD); const RectI mergeBounds = mergeRoD.toPixelEnclosing(mipmapLevel, par); @@ -2579,13 +2579,13 @@ RotoStrokeItem::renderSingleStroke(const RectD& pointsBbox, fielding, false) ); source->fillZero(pixelPointsBbox); - (*image)->upscaleMipMap( oldBounds, (*image)->getMipMapLevel(), source->getMipMapLevel(), source.get() ); + (*image)->upscaleMipmap( oldBounds, (*image)->getMipmapLevel(), source->getMipmapLevel(), source.get() ); *image = source; - } else if ( (*image)->getMipMapLevel() < mipmapLevel ) { - mipMapLevelChanged = true; + } else if ( (*image)->getMipmapLevel() < mipmapLevel ) { + mipmapLevelChanged = true; RectD otherRoD = (*image)->getRoD(); - const RectI oldBounds = otherRoD.toPixelEnclosing( (*image)->getMipMapLevel(), par ); + const RectI oldBounds = otherRoD.toPixelEnclosing( (*image)->getMipmapLevel(), par ); RectD mergeRoD = pointsBbox; mergeRoD.merge(otherRoD); const RectI mergeBounds = mergeRoD.toPixelEnclosing(mipmapLevel, par); @@ -2601,7 +2601,7 @@ RotoStrokeItem::renderSingleStroke(const RectD& pointsBbox, fielding, false) ); source->fillZero(pixelPointsBbox); - (*image)->downscaleMipMap( pointsBbox, oldBounds, (*image)->getMipMapLevel(), source->getMipMapLevel(), false, source.get() ); + (*image)->downscaleMipmap( pointsBbox, oldBounds, (*image)->getMipmapLevel(), source->getMipmapLevel(), false, source.get() ); *image = source; } else { RectD otherRoD = (*image)->getRoD(); @@ -2676,7 +2676,7 @@ RotoStrokeItem::renderSingleStroke(const RectD& pointsBbox, QMutexLocker k(&_imp->strokeDotPatternsMutex); std::vector dotPatterns = getPatternCache(); - if (mipMapLevelChanged) { + if (mipmapLevelChanged) { for (std::size_t i = 0; i < dotPatterns.size(); ++i) { if (dotPatterns[i]) { cairo_pattern_destroy(dotPatterns[i]); diff --git a/Engine/RotoPaint.cpp b/Engine/RotoPaint.cpp index 7879edd999..61f965861d 100644 --- a/Engine/RotoPaint.cpp +++ b/Engine/RotoPaint.cpp @@ -1531,10 +1531,10 @@ RotoPaint::render(const RenderActionArgs& args) copyChannels[i] = _imp->enabledKnobs[i].lock()->getValue(); } - unsigned int mipMapLevel = Image::getLevelFromScale(args.mappedScale.x); + unsigned int mipmapLevel = args.mappedScale.toMipmapLevel(); RenderRoIArgs rotoPaintArgs(args.time, args.mappedScale, - mipMapLevel, + mipmapLevel, args.view, args.byPassCache, args.roi, diff --git a/Engine/RotoSmear.cpp b/Engine/RotoSmear.cpp index 32e90791f3..b6dbc2d89a 100644 --- a/Engine/RotoSmear.cpp +++ b/Engine/RotoSmear.cpp @@ -213,7 +213,7 @@ RotoSmear::render(const RenderActionArgs& args) assert(context); bool duringPainting = isDuringPaintStrokeCreationThreadLocal(); - unsigned int mipmapLevel = Image::getLevelFromScale(args.originalScale.x); + unsigned int mipmapLevel = args.originalScale.toMipmapLevel(); std::list > > strokes; int strokeIndex; node->getLastPaintStrokePoints(args.time, mipmapLevel, &strokes, &strokeIndex); @@ -310,7 +310,7 @@ RotoSmear::render(const RenderActionArgs& args) for (std::list >::const_iterator plane = args.outputPlanes.begin(); plane != args.outputPlanes.end(); ++plane) { - assert(plane->second->getMipMapLevel() == mipmapLevel); + assert(plane->second->getMipmapLevel() == mipmapLevel); distToNext = 0.; int nComps = plane->first.getNumComponents(); diff --git a/Engine/RotoStrokeItem.cpp b/Engine/RotoStrokeItem.cpp index dda3ac6a89..12cf842e96 100644 --- a/Engine/RotoStrokeItem.cpp +++ b/Engine/RotoStrokeItem.cpp @@ -122,7 +122,7 @@ evaluateStrokeInternal(const KeyFrameSet& xCurve, const KeyFrameSet& yCurve, const KeyFrameSet& pCurve, const Transform::Matrix3x3& transform, - unsigned int mipMapLevel, + unsigned int mipmapLevel, double halfBrushSize, bool pressureAffectsSize, std::list >* points, @@ -156,7 +156,7 @@ evaluateStrokeInternal(const KeyFrameSet& xCurve, } - int pot = 1 << mipMapLevel; + int pot = 1 << mipmapLevel; if ( (xCurve.size() == 1) && ( xIt != xCurve.end() ) && ( yIt != yCurve.end() ) && ( pIt != pCurve.end() ) ) { assert( xNext == xCurve.end() && yNext == yCurve.end() && pNext == pCurve.end() ); @@ -839,7 +839,7 @@ RotoStrokeItem::getYControlPoints() const } void -RotoStrokeItem::evaluateStroke(unsigned int mipMapLevel, +RotoStrokeItem::evaluateStroke(unsigned int mipmapLevel, double time, std::list > >* strokes, RectD* bbox) const @@ -864,7 +864,7 @@ RotoStrokeItem::evaluateStroke(unsigned int mipMapLevel, std::list > points; RectD strokeBbox; - evaluateStrokeInternal(xSet, ySet, pSet, transform, mipMapLevel, brushSize, pressureAffectsSize, &points, &strokeBbox); + evaluateStrokeInternal(xSet, ySet, pSet, transform, mipmapLevel, brushSize, pressureAffectsSize, &points, &strokeBbox); if (bbox) { if (bboxSet) { bbox->merge(strokeBbox); diff --git a/Engine/RotoStrokeItem.h b/Engine/RotoStrokeItem.h index c7da170f1e..b816fe10ee 100644 --- a/Engine/RotoStrokeItem.h +++ b/Engine/RotoStrokeItem.h @@ -136,7 +136,7 @@ class RotoStrokeItem ///bbox is in canonical coords - void evaluateStroke(unsigned int mipMapLevel, double time, + void evaluateStroke(unsigned int mipmapLevel, double time, std::list > >* strokes, RectD* bbox = 0) const; diff --git a/Engine/Settings.cpp b/Engine/Settings.cpp index 7435a3e539..02c52afec0 100644 --- a/Engine/Settings.cpp +++ b/Engine/Settings.cpp @@ -2491,7 +2491,7 @@ Settings::isAutoProxyEnabled() const } unsigned int -Settings::getAutoProxyMipMapLevel() const +Settings::getAutoProxyMipmapLevel() const { return (unsigned int)_autoProxyLevel->getValue() + 1; } diff --git a/Engine/Settings.h b/Engine/Settings.h index 731ae7b318..61fa7b582b 100644 --- a/Engine/Settings.h +++ b/Engine/Settings.h @@ -252,7 +252,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON void getCheckerboardColor2(double* r, double* g, double* b, double* a) const; bool isAutoWipeEnabled() const; bool isAutoProxyEnabled() const; - unsigned int getAutoProxyMipMapLevel() const; + unsigned int getAutoProxyMipmapLevel() const; int getMaxOpenedNodesViewerContext() const; bool viewerNumberKeys() const; bool viewerOverlaysPath() const; diff --git a/Engine/TrackMarker.cpp b/Engine/TrackMarker.cpp index 6f3a946e74..eb98dcd132 100644 --- a/Engine/TrackMarker.cpp +++ b/Engine/TrackMarker.cpp @@ -743,11 +743,9 @@ TrackMarker::resetCenter() NodePtr input = context->getNode()->getInput(0); if (input) { SequenceTime time = input->getApp()->getTimeLine()->currentFrame(); - RenderScale scale; - scale.x = scale.y = 1; RectD rod; bool isProjectFormat; - StatusEnum stat = input->getEffectInstance()->getRegionOfDefinition_public(input->getHashValue(), time, scale, ViewIdx(0), &rod, &isProjectFormat); + StatusEnum stat = input->getEffectInstance()->getRegionOfDefinition_public(input->getHashValue(), time, RenderScale::identity, ViewIdx(0), &rod, &isProjectFormat); Point center; center.x = 0; center.y = 0; @@ -1197,10 +1195,8 @@ TrackMarker::getMarkerImage(int time, true, //isAnalysis false, //draftMode RenderStatsPtr() ); - RenderScale scale; - scale.x = scale.y = 1.; EffectInstance::RenderRoIArgs args( time, - scale, + RenderScale::identity, mipmapLevel, //mipmaplevel ViewIdx(0), false, diff --git a/Engine/TrackerContextPrivate.cpp b/Engine/TrackerContextPrivate.cpp index d8f40aaf7c..57ba0f20fc 100644 --- a/Engine/TrackerContextPrivate.cpp +++ b/Engine/TrackerContextPrivate.cpp @@ -1499,7 +1499,7 @@ TrackerContextPrivate::getInputRoDAtTime(double time) const if (!input) { useProjFormat = true; } else { - StatusEnum stat = input->getEffectInstance()->getRegionOfDefinition_public(input->getHashValue(), time, RenderScale(1.), ViewIdx(0), &ret, 0); + StatusEnum stat = input->getEffectInstance()->getRegionOfDefinition_public(input->getHashValue(), time, RenderScale::identity, ViewIdx(0), &ret, 0); if (stat == eStatusFailed) { useProjFormat = true; } else { diff --git a/Engine/TrackerFrameAccessor.cpp b/Engine/TrackerFrameAccessor.cpp index e2ec226569..3f2b3a6334 100644 --- a/Engine/TrackerFrameAccessor.cpp +++ b/Engine/TrackerFrameAccessor.cpp @@ -52,7 +52,7 @@ namespace { struct FrameAccessorCacheKey { int frame; - int mipMapLevel; + unsigned int mipmapLevel; mv::FrameAccessor::InputMode mode; }; @@ -66,9 +66,9 @@ struct CacheKey_compare_less } else if (lhs.frame > rhs.frame) { return false; } else { - if (lhs.mipMapLevel < rhs.mipMapLevel) { + if (lhs.mipmapLevel < rhs.mipmapLevel) { return true; - } else if (lhs.mipMapLevel > rhs.mipMapLevel) { + } else if (lhs.mipmapLevel > rhs.mipmapLevel) { return false; } else { if ( (int)lhs.mode < (int)rhs.mode ) { @@ -292,10 +292,10 @@ TrackerFrameAccessor::GetImage(int /*clip*/, // other case(s) when they get integrated into libmv. assert(input_mode == mv::FrameAccessor::MONO); - + const unsigned int mipmapLevel = static_cast(downscale); FrameAccessorCacheKey key; key.frame = frame; - key.mipMapLevel = downscale; + key.mipmapLevel = mipmapLevel; key.mode = input_mode; /* @@ -335,8 +335,7 @@ TrackerFrameAccessor::GetImage(int /*clip*/, } // Not in accessor cache, call renderRoI - RenderScale scale; - scale.y = scale.x = Image::getScaleFromMipMapLevel( (unsigned int)downscale ); + const RenderScale scale = RenderScale::fromMipmapLevel(mipmapLevel); RectD precomputedRoD; @@ -347,7 +346,7 @@ TrackerFrameAccessor::GetImage(int /*clip*/, return (mv::FrameAccessor::Key)0; } double par = effect->getAspectRatio(-1); - roi = precomputedRoD.toPixelEnclosing( (unsigned int)downscale, par); + roi = precomputedRoD.toPixelEnclosing(mipmapLevel, par); } std::list components; @@ -375,7 +374,7 @@ TrackerFrameAccessor::GetImage(int /*clip*/, RenderStatsPtr() ); // Stats EffectInstance::RenderRoIArgs args( frame, scale, - downscale, + mipmapLevel, ViewIdx(0), false, roi, diff --git a/Engine/TrackerNode.cpp b/Engine/TrackerNode.cpp index 9a55edd213..4b00076106 100644 --- a/Engine/TrackerNode.cpp +++ b/Engine/TrackerNode.cpp @@ -2217,9 +2217,8 @@ TrackerNode::onOverlayPenMotion(double time, if (prevDist != 0) { double dist = std::sqrt( ( pos.x() - centerPoint.x) * ( pos.x() - centerPoint.x) + ( pos.y() - centerPoint.y) * ( pos.y() - centerPoint.y) ); double ratio = dist / prevDist; - _imp->ui->selectedMarkerScale.x *= ratio; - _imp->ui->selectedMarkerScale.x = MathUtils::clamp(_imp->ui->selectedMarkerScale.x, 0.05, 1.); - _imp->ui->selectedMarkerScale.y = _imp->ui->selectedMarkerScale.x; + + _imp->ui->selectedMarkerScale = MathUtils::clamp(_imp->ui->selectedMarkerScale * ratio, 0.05, 1.); didSomething = true; } break; @@ -2235,8 +2234,8 @@ TrackerNode::onOverlayPenMotion(double time, } double x = centerKnob->getValueAtTime(time, 0); double y = centerKnob->getValueAtTime(time, 1); - double dx = delta.x * _imp->ui->selectedMarkerScale.x; - double dy = delta.y * _imp->ui->selectedMarkerScale.y; + double dx = delta.x * _imp->ui->selectedMarkerScale; + double dy = delta.y * _imp->ui->selectedMarkerScale; x += dx; y += dy; centerKnob->setValuesAtTime(time, x, y, view, eValueChangedReasonPluginEdited); diff --git a/Engine/TrackerNodeInteract.cpp b/Engine/TrackerNodeInteract.cpp index fd129e6854..493d4e0cc7 100644 --- a/Engine/TrackerNodeInteract.cpp +++ b/Engine/TrackerNodeInteract.cpp @@ -90,11 +90,10 @@ TrackerNodeInteract::TrackerNodeInteract(TrackerNodePrivate* p) , pboID(0) , imageGetterWatcher() , showMarkerTexture(false) - , selectedMarkerScale() + , selectedMarkerScale(1.) , selectedMarkerImg() , isTracking(false) { - selectedMarkerScale.x = selectedMarkerScale.y = 1.; } TrackerNodeInteract::~TrackerNodeInteract() @@ -920,7 +919,7 @@ TrackerNodeInteract::drawSelectedMarkerTexture(const std::pair& topLeftTex.x = texCoords.x1; topLeftTex.y = texCoords.y2; topRightTex.x = texCoords.x2; topRightTex.y = texCoords.y2; btmRightTex.x = texCoords.x2; btmRightTex.y = texCoords.y1; - Transform::Matrix3x3 m = Transform::matTransformCanonical(0, 0, selectedMarkerScale.x, selectedMarkerScale.y, 0, 0, false, 0, xCenterPercent, yCenterPercent); + Transform::Matrix3x3 m = Transform::matTransformCanonical(0, 0, selectedMarkerScale, selectedMarkerScale, 0, 0, false, 0, xCenterPercent, yCenterPercent); btmLeftTex = Transform::matApply(m, btmLeftTex); topLeftTex = Transform::matApply(m, topLeftTex); btmRightTex = Transform::matApply(m, btmRightTex); diff --git a/Engine/TrackerNodeInteract.h b/Engine/TrackerNodeInteract.h index c5eac580e0..cbef0c1b9e 100644 --- a/Engine/TrackerNodeInteract.h +++ b/Engine/TrackerNodeInteract.h @@ -375,7 +375,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON GLuint pboID; TrackWatcherPtr imageGetterWatcher; bool showMarkerTexture; - RenderScale selectedMarkerScale; + double selectedMarkerScale; ImageWPtr selectedMarkerImg; bool isTracking; diff --git a/Engine/UpdateViewerParams.h b/Engine/UpdateViewerParams.h index 6957198797..87a954cb59 100644 --- a/Engine/UpdateViewerParams.h +++ b/Engine/UpdateViewerParams.h @@ -74,7 +74,7 @@ class UpdateViewerParams , gain(1.) , gamma(1.) , offset(0.) - , mipMapLevel(0) + , mipmapLevel(0) , lut(eViewerColorSpaceSRGB) , layer() , alphaLayer() @@ -122,7 +122,7 @@ class UpdateViewerParams double gain; // viewer gain double gamma; // viewer gamma double offset; // viewer offset - unsigned int mipMapLevel; // viewer mipmaplevel + unsigned int mipmapLevel; // viewer mipmaplevel ViewerColorSpaceEnum lut; // the viewer colorspace lut ImagePlaneDesc layer; // the image layer ImagePlaneDesc alphaLayer; // the alpha layer diff --git a/Engine/ViewerInstance.cpp b/Engine/ViewerInstance.cpp index d948953463..75f86ff27c 100644 --- a/Engine/ViewerInstance.cpp +++ b/Engine/ViewerInstance.cpp @@ -140,6 +140,9 @@ ViewerInstance::lutFromColorspace(ViewerColorSpaceEnum cs) case eViewerColorSpaceRec709: lut = Color::LutManager::Rec709Lut(); break; + case eViewerColorSpaceBT1886: + lut = Color::LutManager::BT1886Lut(); + break; case eViewerColorSpaceLinear: default: lut = 0; @@ -450,7 +453,7 @@ ViewerInstance::getViewerArgsAndRenderViewer(SequenceTime time, roi.x2 = args[i]->params->textureRect.x2; roi.y2 = args[i]->params->textureRect.y2; } - status[i] = EffectInstance::computeRequestPass(time, view, args[i]->params->mipMapLevel, roi, thisNode, request); + status[i] = EffectInstance::computeRequestPass(time, view, args[i]->params->mipmapLevel, roi, thisNode, request); if (status[i] == eStatusFailed) { continue; }*/ @@ -834,7 +837,7 @@ ViewerInstance::setupMinimalUpdateViewerParams(const SequenceTime time, { QMutexLocker l(&_imp->viewerParamsMutex); - outArgs->mipmapLevelWithoutDraft = (unsigned int)_imp->viewerMipMapLevel; + outArgs->mipmapLevelWithoutDraft = _imp->viewerMipmapLevel; } assert(_imp->uiContext); @@ -851,20 +854,20 @@ ViewerInstance::setupMinimalUpdateViewerParams(const SequenceTime time, if (isFullFrameProcessingEnabled()) { outArgs->mipmapLevelWithoutDraft = 0; } else { - int zoomMipMapLevel; + unsigned int zoomMipmapLevel; { double closestPowerOf2 = zoomFactor >= 1 ? 1 : ipow( 2, (int)-std::ceil(std::log(zoomFactor) / M_LN2) ); - zoomMipMapLevel = std::log(closestPowerOf2) / M_LN2; + zoomMipmapLevel = std::log(closestPowerOf2) / M_LN2; } - outArgs->mipmapLevelWithoutDraft = (unsigned int)std::max( (int)outArgs->mipmapLevelWithoutDraft, (int)zoomMipMapLevel ); + outArgs->mipmapLevelWithoutDraft = std::max(outArgs->mipmapLevelWithoutDraft, zoomMipmapLevel); } - outArgs->mipMapLevelWithDraft = outArgs->mipmapLevelWithoutDraft; + outArgs->mipmapLevelWithDraft = outArgs->mipmapLevelWithoutDraft; outArgs->draftModeEnabled = getApp()->isDraftRenderEnabled(); // If draft mode is enabled, compute the mipmap level according to the auto-proxy setting in the preferences if ( outArgs->draftModeEnabled && appPTR->getCurrentSettings()->isAutoProxyEnabled() ) { - unsigned int autoProxyLevel = appPTR->getCurrentSettings()->getAutoProxyMipMapLevel(); + unsigned int autoProxyLevel = appPTR->getCurrentSettings()->getAutoProxyMipmapLevel(); if (zoomFactor > 1) { //Decrease draft mode at each inverse mipmaplevel level taken unsigned int invLevel = Image::getLevelFromScale(1. / zoomFactor); @@ -874,7 +877,7 @@ ViewerInstance::setupMinimalUpdateViewerParams(const SequenceTime time, autoProxyLevel = 0; } } - outArgs->mipMapLevelWithDraft = (unsigned int)std::max( (int)outArgs->mipmapLevelWithoutDraft, (int)autoProxyLevel ); + outArgs->mipmapLevelWithDraft = std::max(outArgs->mipmapLevelWithoutDraft, autoProxyLevel); } @@ -1000,7 +1003,8 @@ ViewerInstance::getViewerRoIAndTexture(const RectD& rod, for (std::list::iterator it = partialRects.begin(); it != partialRects.end(); ++it) { RectI pixelRect = it->toPixelEnclosing(mipmapLevel, outArgs->params->pixelAspectRatio); ///Intersect to the RoI - if ( pixelRect.clipIfOverlaps(outArgs->params->roi) ) { + pixelRect.clip(outArgs->params->roi); + if ( !pixelRect.isNull() ) { tile.rect.set(pixelRect); tile.rectRounded = pixelRect; tile.rect.closestPo2 = 1 << mipmapLevel; @@ -1059,7 +1063,7 @@ ViewerInstance::getViewerRoIAndTexture(const RectD& rod, outArgs->params->rod = rod; - outArgs->params->mipMapLevel = mipmapLevel; + outArgs->params->mipmapLevel = mipmapLevel; std::string inputToRenderName = outArgs->activeInputToRender->getNode()->getScriptName_mt_safe(); @@ -1156,10 +1160,8 @@ ViewerInstance::getRoDAndLookupCache(const bool useOnlyRoDCache, // zillions of textures in the cache, each a few pixels different. const bool useTextureCache = !outArgs->userRoIEnabled && !outArgs->autoContrast && !rotoPaintNode.get() && !outArgs->isDoingPartialUpdates; - // If it's eSupportsMaybe and mipMapLevel!=0, don't forget to update + // If it's eSupportsMaybe and mipmapLevel!=0, don't forget to update // this after the first call to getRegionOfDefinition(). - const RenderScale scaleOne(1.); - // This may be eSupportsMaybe EffectInstance::SupportsEnum supportsRS = outArgs->activeInputToRender->supportsRenderScaleMaybe(); @@ -1168,9 +1170,8 @@ ViewerInstance::getRoDAndLookupCache(const bool useOnlyRoDCache, const int nLookups = outArgs->draftModeEnabled ? 2 : 1; for (int lookup = 0; lookup < nLookups; ++lookup) { - const unsigned mipMapLevel = lookup == 0 ? outArgs->mipmapLevelWithoutDraft : outArgs->mipMapLevelWithDraft; - RenderScale scale; - scale.x = scale.y = Image::getScaleFromMipMapLevel(mipMapLevel); + const unsigned mipmapLevel = lookup == 0 ? outArgs->mipmapLevelWithoutDraft : outArgs->mipmapLevelWithDraft; + RenderScale scale = RenderScale::fromMipmapLevel(mipmapLevel); RectD rod; @@ -1193,7 +1194,7 @@ ViewerInstance::getRoDAndLookupCache(const bool useOnlyRoDCache, } else { stat = outArgs->activeInputToRender->getRegionOfDefinition_public(outArgs->activeInputHash, outArgs->params->time, - supportsRS == eSupportsNo ? scaleOne : scale, + supportsRS == eSupportsNo ? RenderScale::identity : scale, outArgs->params->view, &rod, 0 /*isProjectFormat*/); @@ -1204,7 +1205,7 @@ ViewerInstance::getRoDAndLookupCache(const bool useOnlyRoDCache, } // update scale after the first call to getRegionOfDefinition - if ( (supportsRS == eSupportsMaybe) && (mipMapLevel != 0) ) { + if ( (supportsRS == eSupportsMaybe) && (mipmapLevel != 0) ) { supportsRS = (outArgs->activeInputToRender)->supportsRenderScaleMaybe(); } @@ -1215,7 +1216,7 @@ ViewerInstance::getRoDAndLookupCache(const bool useOnlyRoDCache, Q_UNUSED(isRodProjectFormat); // Ok we go the RoD, we can actually compute the RoI and look-up the cache - ViewerRenderRetCode retCode = getViewerRoIAndTexture(rod, viewerHash, useTextureCache, lookup == 1, mipMapLevel, stats, outArgs); + ViewerRenderRetCode retCode = getViewerRoIAndTexture(rod, viewerHash, useTextureCache, lookup == 1, mipmapLevel, stats, outArgs); if (retCode != eViewerRenderRetCodeRender) { return retCode; } @@ -1399,10 +1400,10 @@ ViewerInstance::renderViewer_internal(ViewIdx view, if (useTLS) { - const RectD canonicalRoi = roi.toCanonical(inArgs.params->mipMapLevel, inArgs.params->pixelAspectRatio, inArgs.params->rod); + const RectD canonicalRoi = roi.toCanonical(inArgs.params->mipmapLevel, inArgs.params->pixelAspectRatio, inArgs.params->rod); FrameRequestMap requestPassData; - StatusEnum stat = EffectInstance::computeRequestPass(inArgs.params->time, view, inArgs.params->mipMapLevel, canonicalRoi, getNode(), requestPassData); + StatusEnum stat = EffectInstance::computeRequestPass(inArgs.params->time, view, inArgs.params->mipmapLevel, canonicalRoi, getNode(), requestPassData); if (stat == eStatusFailed) { return eViewerRenderRetCodeFail; } @@ -1498,7 +1499,7 @@ ViewerInstance::renderViewer_internal(ViewIdx view, channelsRendered[3] = true; break; } - stats->setGlobalRenderInfosForNode(getNode(), inArgs.params->rod, inArgs.params->srcPremult, channelsRendered, true, true, inArgs.params->mipMapLevel); + stats->setGlobalRenderInfosForNode(getNode(), inArgs.params->rod, inArgs.params->srcPremult, channelsRendered, true, true, inArgs.params->mipmapLevel); } //#pragma message WARN("Implement Viewer so it accepts OpenGL Textures in input") @@ -1517,8 +1518,8 @@ ViewerInstance::renderViewer_internal(ViewIdx view, { std::unique_ptr renderArgs; renderArgs.reset( new EffectInstance::RenderRoIArgs(inArgs.params->time, - Image::getScaleFromMipMapLevel(inArgs.params->mipMapLevel), - inArgs.params->mipMapLevel, + RenderScale::fromMipmapLevel(inArgs.params->mipmapLevel), + inArgs.params->mipmapLevel, view, inArgs.forceRender, splitRoi[rectIndex], @@ -1659,7 +1660,7 @@ ViewerInstance::renderViewer_internal(ViewIdx view, bool canUseOldTex = _imp->lastRenderParams[updateParams->textureIndex] && - updateParams->mipMapLevel == _imp->lastRenderParams[updateParams->textureIndex]->mipMapLevel && + updateParams->mipmapLevel == _imp->lastRenderParams[updateParams->textureIndex]->mipmapLevel && tile.rect.contains(_imp->lastRenderParams[updateParams->textureIndex]->tiles.front().rect); if (!canUseOldTex) { @@ -1671,7 +1672,7 @@ ViewerInstance::renderViewer_internal(ViewIdx view, //Overwrite the RoI to only the last portion rendered RectD lastPaintBbox = getApp()->getLastPaintStrokeBbox(); - lastPaintBboxPixel = lastPaintBbox.toPixelEnclosing(updateParams->mipMapLevel, par); + lastPaintBboxPixel = lastPaintBbox.toPixelEnclosing(updateParams->mipmapLevel, par); //The last buffer must be valid @@ -1721,7 +1722,7 @@ ViewerInstance::renderViewer_internal(ViewIdx view, // For the viewer, we need the enclosing rectangle to avoid black borders. // Do this here to avoid infinity values. - const RectI bounds = updateParams->rod.toPixelEnclosing(updateParams->mipMapLevel, updateParams->pixelAspectRatio); + const RectI bounds = updateParams->rod.toPixelEnclosing(updateParams->mipmapLevel, updateParams->pixelAspectRatio); const RectI tileBounds(0, 0, inArgs.params->tileSize, inArgs.params->tileSize); assert(!tileBounds.isNull()); @@ -1746,7 +1747,7 @@ ViewerInstance::renderViewer_internal(ViewIdx view, inArgs.channels, inArgs.params->view, it->rect, - inArgs.params->mipMapLevel, + inArgs.params->mipmapLevel, inputToRenderName, inArgs.params->layer, inArgs.params->alphaLayer.getPlaneID() + inArgs.params->alphaChannelName, @@ -2927,7 +2928,7 @@ ViewerInstance::ViewerInstancePrivate::updateViewer(UpdateViewerParamsPtr params } } - uiContext->endTransferBufferFromRAMToGPU(params->textureIndex, texture, originalImage, params->time, params->rod, params->pixelAspectRatio, depth, params->mipMapLevel, params->srcPremult, params->gain, params->gamma, params->offset, params->lut, params->recenterViewport, params->viewportCenter, params->isPartialRect); + uiContext->endTransferBufferFromRAMToGPU(params->textureIndex, texture, originalImage, params->time, params->rod, params->pixelAspectRatio, depth, params->mipmapLevel, params->srcPremult, params->gain, params->gamma, params->offset, params->lut, params->recenterViewport, params->viewportCenter, params->isPartialRect); if (!isDrawing) { uiContext->updateColorPicker(params->textureIndex); @@ -3017,25 +3018,17 @@ ViewerInstance::onGainChanged(double exp) } } -unsigned int -ViewerInstance::getViewerMipMapLevel() const -{ - QMutexLocker l(&_imp->viewerParamsMutex); - - return _imp->viewerMipMapLevel; -} - void -ViewerInstance::onMipMapLevelChanged(int level) +ViewerInstance::onMipmapLevelChanged(unsigned int level) { // always running in the main thread assert( qApp && qApp->thread() == QThread::currentThread() ); { QMutexLocker l(&_imp->viewerParamsMutex); - if (_imp->viewerMipMapLevel == (unsigned int)level) { + if (_imp->viewerMipmapLevel == level) { return; } - _imp->viewerMipMapLevel = level; + _imp->viewerMipmapLevel = level; } } @@ -3220,14 +3213,14 @@ ViewerInstance::getGain() const return _imp->viewerParamsGain; } -int -ViewerInstance::getMipMapLevel() const +unsigned int +ViewerInstance::getMipmapLevel() const { // MT-SAFE: called from main thread and Serialization (pooled) thread QMutexLocker l(&_imp->viewerParamsMutex); - return _imp->viewerMipMapLevel; + return _imp->viewerMipmapLevel; } DisplayChannelsEnum @@ -3405,8 +3398,8 @@ ViewerInstance::getTimelineBounds(int* first, } } -int -ViewerInstance::getMipMapLevelFromZoomFactor() const +unsigned int +ViewerInstance::getMipmapLevelFromZoomFactor() const { double zoomFactor = _imp->uiContext->getZoomFactor(); double closestPowerOf2 = zoomFactor >= 1 ? 1 : std::pow( 2, -std::ceil(std::log(zoomFactor) / M_LN2) ); diff --git a/Engine/ViewerInstance.h b/Engine/ViewerInstance.h index 5b34833838..acf6caa7c3 100644 --- a/Engine/ViewerInstance.h +++ b/Engine/ViewerInstance.h @@ -50,7 +50,7 @@ class ViewerArgs UpdateViewerParamsPtr params; RenderingFlagSetterPtr isRenderingFlag; bool draftModeEnabled; - unsigned int mipMapLevelWithDraft, mipmapLevelWithoutDraft; + unsigned int mipmapLevelWithDraft, mipmapLevelWithoutDraft; bool autoContrast; DisplayChannelsEnum channels; bool userRoIEnabled; @@ -148,7 +148,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON /** - * @brief Get the RoI from the Viewer and lookup the cache for a texture at the given mipMapLevel. + * @brief Get the RoI from the Viewer and lookup the cache for a texture at the given mipmapLevel. * setupMinimalUpdateViewerParams(...) MUST have been called before. * When returning this function, the UpdateViewerParams will have been filled entirely * and if the texture was found in the cache, the shared pointer outArgs->params->cachedFrame will be valid. @@ -231,9 +231,9 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON double getGain() const WARN_UNUSED_RETURN; - int getMipMapLevel() const WARN_UNUSED_RETURN; + unsigned int getMipmapLevel() const WARN_UNUSED_RETURN; - int getMipMapLevelFromZoomFactor() const WARN_UNUSED_RETURN; + unsigned int getMipmapLevelFromZoomFactor() const WARN_UNUSED_RETURN; DisplayChannelsEnum getChannels(int texIndex) const WARN_UNUSED_RETURN; @@ -326,12 +326,10 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON bool isViewerPaused(int texIndex) const; - unsigned int getViewerMipMapLevel() const; - public Q_SLOTS: - void onMipMapLevelChanged(int level); + void onMipmapLevelChanged(unsigned int level); /** diff --git a/Engine/ViewerInstancePrivate.h b/Engine/ViewerInstancePrivate.h index 768fa16e11..7fa3ec0ca7 100644 --- a/Engine/ViewerInstancePrivate.h +++ b/Engine/ViewerInstancePrivate.h @@ -140,7 +140,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON , viewerParamsLayer( ImagePlaneDesc::getRGBAComponents() ) , viewerParamsAlphaLayer( ImagePlaneDesc::getRGBAComponents() ) , viewerParamsAlphaChannelName("a") - , viewerMipMapLevel(0) + , viewerMipmapLevel(0) , fullFrameProcessingEnabled(false) , activateInputChangedFromViewer(false) , gammaLookupMutex() @@ -387,7 +387,7 @@ public Q_SLOTS: ImagePlaneDesc viewerParamsLayer; ImagePlaneDesc viewerParamsAlphaLayer; std::string viewerParamsAlphaChannelName; - unsigned int viewerMipMapLevel; //< the mipmap level the viewer should render at (0 == no downscaling) + unsigned int viewerMipmapLevel; //< the mipmap level the viewer should render at (0 == no downscaling) bool fullFrameProcessingEnabled; ///Only accessed from MT diff --git a/Global/Enums.h b/Global/Enums.h index d8c50a453d..fbcb456ffa 100644 --- a/Global/Enums.h +++ b/Global/Enums.h @@ -441,7 +441,8 @@ enum ViewerColorSpaceEnum { eViewerColorSpaceSRGB = 0, eViewerColorSpaceLinear, - eViewerColorSpaceRec709 + eViewerColorSpaceRec709, + eViewerColorSpaceBT1886 }; enum ImageBitDepthEnum diff --git a/Global/GlobalDefines.h b/Global/GlobalDefines.h index 1b5adc02ae..3fe45350de 100644 --- a/Global/GlobalDefines.h +++ b/Global/GlobalDefines.h @@ -26,6 +26,7 @@ #include // ***** END PYTHON BLOCK ***** +#include #include #if defined(_WIN32) #include @@ -47,9 +48,6 @@ #undef isalpha #undef isalnum -#if !defined(Q_MOC_RUN) && !defined(SBK_RUN) -#include -#endif #include #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #include @@ -75,18 +73,6 @@ typedef std::uint16_t U16; NATRON_NAMESPACE_ENTER typedef int SequenceTime; - -struct RenderScale - : public OfxPointD -{ - RenderScale() { x = y = 1.; } - - RenderScale(double scale) { x = y = scale; } - - RenderScale(double scaleX, - double scaleY) { x = scaleX; y = scaleY; } -}; - typedef OfxPointD Point; typedef OfxRGBAColourF RGBAColourF; typedef OfxRGBAColourD RGBAColourD; diff --git a/Gui/CurveWidget.cpp b/Gui/CurveWidget.cpp index d1ea4db6af..a57ede41dc 100644 --- a/Gui/CurveWidget.cpp +++ b/Gui/CurveWidget.cpp @@ -694,7 +694,7 @@ CurveWidget::paintGL() //GLProtectAttrib a(GL_COLOR_BUFFER_BIT | GL_LINE_BIT | GL_CURRENT_BIT | GL_ENABLE_BIT); GLProtectAttrib a(GL_LINE_BIT | GL_CURRENT_BIT | GL_ENABLE_BIT); - RenderScale scale(1.); + const OfxPointD scale = {1., 1.}; customInteract->setCallingViewport(this); customInteract->drawAction(0, scale, 0, customInteract->hasColorPicker() ? &customInteract->getLastColorPickerColor() : 0); glCheckErrorIgnoreOSXBug(); diff --git a/Gui/CurveWidget.h b/Gui/CurveWidget.h index f6a935c080..0842983091 100644 --- a/Gui/CurveWidget.h +++ b/Gui/CurveWidget.h @@ -136,7 +136,6 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON * @brief Returns the colour of the background (i.e: clear color) of the viewport. **/ virtual void getBackgroundColour(double &r, double &g, double &b) const OVERRIDE FINAL; - virtual unsigned int getCurrentRenderScale() const OVERRIDE FINAL { return 0; } virtual RectD getViewportRect() const OVERRIDE FINAL WARN_UNUSED_RETURN; virtual void getCursorPosition(double& x, double& y) const OVERRIDE FINAL; diff --git a/Gui/CustomParamInteract.h b/Gui/CustomParamInteract.h index 4f3c50ab51..c1511c8046 100644 --- a/Gui/CustomParamInteract.h +++ b/Gui/CustomParamInteract.h @@ -84,7 +84,6 @@ class CustomParamInteract virtual void getBackgroundColour(double &r, double &g, double &b) const OVERRIDE FINAL; virtual void saveOpenGLContext() OVERRIDE FINAL; virtual void restoreOpenGLContext() OVERRIDE FINAL; - virtual unsigned int getCurrentRenderScale() const OVERRIDE FINAL { return 0; } virtual RectD getViewportRect() const OVERRIDE FINAL WARN_UNUSED_RETURN; virtual void getCursorPosition(double& x, double& y) const OVERRIDE FINAL; diff --git a/Gui/DopeSheetView.cpp b/Gui/DopeSheetView.cpp index ba3e343937..8e40a05df7 100644 --- a/Gui/DopeSheetView.cpp +++ b/Gui/DopeSheetView.cpp @@ -2817,17 +2817,6 @@ DopeSheetView::restoreOpenGLContext() running_in_main_thread(); } -/** - * @brief DopeSheetView::getCurrentRenderScale - * - * - */ -unsigned int -DopeSheetView::getCurrentRenderScale() const -{ - return 0; -} - void DopeSheetView::onSelectedAllTriggered() { diff --git a/Gui/DopeSheetView.h b/Gui/DopeSheetView.h index 933255f5b7..d6283ac062 100644 --- a/Gui/DopeSheetView.h +++ b/Gui/DopeSheetView.h @@ -137,7 +137,6 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON void getBackgroundColour(double &r, double &g, double &b) const OVERRIDE FINAL; void saveOpenGLContext() OVERRIDE FINAL; void restoreOpenGLContext() OVERRIDE FINAL; - unsigned int getCurrentRenderScale() const OVERRIDE FINAL; virtual RectD getViewportRect() const OVERRIDE FINAL WARN_UNUSED_RETURN; virtual void getCursorPosition(double& x, double& y) const OVERRIDE FINAL; diff --git a/Gui/Histogram.cpp b/Gui/Histogram.cpp index a4271f25ca..9c5f713c80 100644 --- a/Gui/Histogram.cpp +++ b/Gui/Histogram.cpp @@ -138,7 +138,7 @@ struct HistogramPrivate , vmin(0) , vmax(0) , binsCount(0) - , mipMapLevel(0) + , mipmapLevel(0) , hasImage(false) #endif , sizeH() @@ -279,7 +279,7 @@ struct HistogramPrivate unsigned int pixelsCount; double vmin, vmax; //< the x range of the histogram unsigned int binsCount; - unsigned int mipMapLevel; + unsigned int mipmapLevel; bool hasImage; #endif // !NATRON_HISTOGRAM_USING_OPENGL @@ -510,20 +510,20 @@ ImagePtr HistogramPrivate::getHistogramImage(RectI* imagePortion) const ImagePtr image; if (viewer) { - image = viewer->getViewer()->getLastRenderedImageByMipMapLevel( textureIndex, viewer->getInternalNode()->getMipMapLevelFromZoomFactor() ); + image = viewer->getViewer()->getLastRenderedImageByMipmapLevel( textureIndex, viewer->getInternalNode()->getMipmapLevelFromZoomFactor() ); } if (!useImageRoD) { if (viewer) { RectI bounds; double par = 1.; - unsigned int mipMapLevel = 0; + unsigned int mipmapLevel = 0; if (image) { bounds = image->getBounds(); par = image->getPixelAspectRatio(); - mipMapLevel = image->getMipMapLevel(); + mipmapLevel = image->getMipmapLevel(); } - *imagePortion = viewer->getViewer()->getImageRectangleDisplayed(bounds, par, mipMapLevel); + *imagePortion = viewer->getViewer()->getImageRectangleDisplayed(bounds, par, mipmapLevel); } } else { if (image) { @@ -1575,7 +1575,7 @@ Histogram::onCPUHistogramComputed() assert( qApp && qApp->thread() == QThread::currentThread() ); int mode; - bool success = _imp->histogramThread.getMostRecentlyProducedHistogram(&_imp->histogram1, &_imp->histogram2, &_imp->histogram3, &_imp->binsCount, &_imp->pixelsCount, &mode, &_imp->vmin, &_imp->vmax, &_imp->mipMapLevel); + bool success = _imp->histogramThread.getMostRecentlyProducedHistogram(&_imp->histogram1, &_imp->histogram2, &_imp->histogram3, &_imp->binsCount, &_imp->pixelsCount, &mode, &_imp->vmin, &_imp->vmax, &_imp->mipmapLevel); assert(success); if (success) { _imp->hasImage = true; @@ -1703,7 +1703,7 @@ HistogramPrivate::drawWarnings() // always running in the main thread assert( qApp && qApp->thread() == QThread::currentThread() ); assert( QOpenGLContext::currentContext() == widget->context() ); - if (mipMapLevel > 0) { + if (mipmapLevel > 0) { QFontMetrics fm(*_textFont); QString str( tr("Image downscaled") ); #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) diff --git a/Gui/ProjectGui.cpp b/Gui/ProjectGui.cpp index 1278e9e5f4..8640f946b8 100644 --- a/Gui/ProjectGui.cpp +++ b/Gui/ProjectGui.cpp @@ -380,7 +380,7 @@ loadNodeGuiSerialization(Gui* gui, tab->setUserRoI(found->second.userRoI); tab->setClipToProject(found->second.isClippedToProject); tab->setRenderScaleActivated(found->second.renderScaleActivated); - tab->setMipMapLevel(found->second.mipMapLevel); + tab->setMipmapLevel(found->second.mipmapLevel); tab->setCompositingOperator( (ViewerCompositingOperatorEnum)found->second.wipeCompositingOp ); tab->setZoomOrPannedSinceLastFit(found->second.zoomOrPanSinceLastFit); tab->setTopToolbarVisible(found->second.topToolbarVisible); diff --git a/Gui/ProjectGuiSerialization.cpp b/Gui/ProjectGuiSerialization.cpp index 2382c8037b..f596877cfb 100644 --- a/Gui/ProjectGuiSerialization.cpp +++ b/Gui/ProjectGuiSerialization.cpp @@ -103,7 +103,7 @@ ProjectGuiSerialization::initialize(const ProjectGui* projectGui) viewerData.colorSpace = tab->getColorSpace(); viewerData.channels = tab->getChannelsString(); viewerData.renderScaleActivated = tab->getRenderScaleActivated(); - viewerData.mipMapLevel = tab->getMipMapLevel(); + viewerData.mipmapLevel = tab->getMipmapLevel(); viewerData.zoomOrPanSinceLastFit = tab->getZoomOrPannedSinceLastFit(); viewerData.wipeCompositingOp = (int)tab->getCompositingOperator(); viewerData.leftToolbarVisible = tab->isLeftToolbarVisible(); diff --git a/Gui/ProjectGuiSerialization.h b/Gui/ProjectGuiSerialization.h index baabf086b4..5354c41ce5 100644 --- a/Gui/ProjectGuiSerialization.h +++ b/Gui/ProjectGuiSerialization.h @@ -113,7 +113,7 @@ struct ViewerData double gain; double gamma; bool renderScaleActivated; - int mipMapLevel; + unsigned int mipmapLevel; std::string colorSpace; std::string channels; std::string layerName, alphaLayerName; @@ -164,7 +164,7 @@ struct ViewerData } ar & ::boost::serialization::make_nvp("Channels", channels); ar & ::boost::serialization::make_nvp("RenderScaleActivated", renderScaleActivated); - ar & ::boost::serialization::make_nvp("MipMapLevel", mipMapLevel); + ar & ::boost::serialization::make_nvp("MipMapLevel", mipmapLevel); if (version >= VIEWER_DATA_INTRODUCES_WIPE_COMPOSITING) { ar & ::boost::serialization::make_nvp("ZoomOrPanSinceFit", zoomOrPanSinceLastFit); diff --git a/Gui/PyGuiApp.cpp b/Gui/PyGuiApp.cpp index 5704c1d4ec..d5f01a1172 100644 --- a/Gui/PyGuiApp.cpp +++ b/Gui/PyGuiApp.cpp @@ -849,7 +849,7 @@ PyViewer::setProxyIndex(int index) if ( !getInternalNode()->isActivated() ) { return; } - _viewer->setMipMapLevel(index + 1); + _viewer->setMipmapLevel(index + 1); } int @@ -859,7 +859,7 @@ PyViewer::getProxyIndex() const return 0; } - return _viewer->getMipMapLevel() - 1; + return _viewer->getMipmapLevel() - 1; } void diff --git a/Gui/RenderStatsDialog.cpp b/Gui/RenderStatsDialog.cpp index 4b6dd58f0f..f8901044f9 100644 --- a/Gui/RenderStatsDialog.cpp +++ b/Gui/RenderStatsDialog.cpp @@ -321,7 +321,7 @@ class StatsTableModel item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); } assert(item); - const std::set& mm = stats.getMipMapLevelsRendered(); + const std::set& mm = stats.getMipmapLevelsRendered(); for (std::set::const_iterator it = mm.begin(); it != mm.end(); ++it) { str.append( QString::number(*it) ); str.append( QLatin1Char(' ') ); diff --git a/Gui/Shaders.cpp b/Gui/Shaders.cpp index bfeb855ce2..5fe11d0c62 100644 --- a/Gui/Shaders.cpp +++ b/Gui/Shaders.cpp @@ -42,21 +42,31 @@ const char* fragRGB = "float linear_to_rec709(float c) {" " return (c<0.018) ? (4.500*c) : (1.099*pow(c,0.45) - 0.099);\n" "}\n" - "void main(){\n" + "float linear_to_bt1886(float c) {" + " return pow(c,1.0/2.4);\n" + "}\n" + "void main() {\n" " vec4 color_tmp = texture2D(Tex,gl_TexCoord[0].st);\n" " color_tmp.rgb = (color_tmp.rgb * gain) + offset;\n" - " if(lut == 0){ // srgb\n" + " if (lut == 0) { // srgb\n" // << TO SRGB " color_tmp.r = linear_to_srgb(color_tmp.r);\n" " color_tmp.g = linear_to_srgb(color_tmp.g);\n" " color_tmp.b = linear_to_srgb(color_tmp.b);\n" // << END TO SRGB - " }\n" - " else if (lut == 2){ // Rec 709\n" // << TO REC 709 + " } else if (lut == 2) { // Rec 709\n" +// << TO REC 709 " color_tmp.r = linear_to_rec709(color_tmp.r);\n" " color_tmp.g = linear_to_rec709(color_tmp.g);\n" " color_tmp.b = linear_to_rec709(color_tmp.b);\n" - " }\n" // << END TO REC 709 +// << END TO REC 709 + " } else if (lut == 3) { // BT1886\n" +// << TO BT1886 + " color_tmp.r = linear_to_bt1886(color_tmp.r);\n" + " color_tmp.g = linear_to_bt1886(color_tmp.g);\n" + " color_tmp.b = linear_to_bt1886(color_tmp.b);\n" +// << END TO BT1886 + " }\n" " if (gamma <= 0.) {\n" " color_tmp.r = (color_tmp.r >= 1.) ? 1. : 0.;\n" " color_tmp.g = (color_tmp.g >= 1.) ? 1. : 0.;\n" diff --git a/Gui/ViewerGL.cpp b/Gui/ViewerGL.cpp index 234906da8c..b8aaf3f122 100644 --- a/Gui/ViewerGL.cpp +++ b/Gui/ViewerGL.cpp @@ -203,7 +203,7 @@ ViewerGL::resizeGL(int w, bool zoomSinceLastFit; double oldWidth, oldHeight; { - QMutexLocker(&_imp->zoomCtxMutex); + QMutexLocker l(&_imp->zoomCtxMutex); oldWidth = _imp->zoomCtx.screenWidth(); oldHeight = _imp->zoomCtx.screenHeight(); _imp->zoomCtx.setScreenSize(zoomWidth, zoomHeight, /*alignTop=*/ true, /*alignRight=*/ false); @@ -404,7 +404,7 @@ ViewerGL::paintGL() case eViewerCompositingOperatorNone: { if (drawTexture[0]) { BlendSetter b(checkerboard ? premultA : eImagePremultiplicationOpaque); - _imp->drawRenderingVAO(_imp->displayTextures[0].mipMapLevel, 0, eDrawPolygonModeWhole, true); + _imp->drawRenderingVAO(_imp->displayTextures[0].mipmapLevel, 0, eDrawPolygonModeWhole, true); } break; } @@ -412,16 +412,16 @@ ViewerGL::paintGL() case eViewerCompositingOperatorStackUnder: { if (drawTexture[0] && !stack) { BlendSetter b(checkerboard ? premultA : eImagePremultiplicationOpaque); - _imp->drawRenderingVAO(_imp->displayTextures[0].mipMapLevel, 0, eDrawPolygonModeWipeLeft, true); + _imp->drawRenderingVAO(_imp->displayTextures[0].mipmapLevel, 0, eDrawPolygonModeWipeLeft, true); } if (drawTexture[0]) { BlendSetter b(premultA); - _imp->drawRenderingVAO(_imp->displayTextures[0].mipMapLevel, 0, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); + _imp->drawRenderingVAO(_imp->displayTextures[0].mipmapLevel, 0, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); } if (drawTexture[1]) { glEnable(GL_BLEND); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); - _imp->drawRenderingVAO(_imp->displayTextures[1].mipMapLevel, 1, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); + _imp->drawRenderingVAO(_imp->displayTextures[1].mipmapLevel, 1, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); glDisable(GL_BLEND); } @@ -431,17 +431,17 @@ ViewerGL::paintGL() case eViewerCompositingOperatorStackOver: { if (drawTexture[0] && !stack) { BlendSetter b(checkerboard ? premultA : eImagePremultiplicationOpaque); - _imp->drawRenderingVAO(_imp->displayTextures[0].mipMapLevel, 0, eDrawPolygonModeWipeLeft, true); + _imp->drawRenderingVAO(_imp->displayTextures[0].mipmapLevel, 0, eDrawPolygonModeWipeLeft, true); } if (drawTexture[1]) { glEnable(GL_BLEND); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); - _imp->drawRenderingVAO(_imp->displayTextures[1].mipMapLevel, 1, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); + _imp->drawRenderingVAO(_imp->displayTextures[1].mipmapLevel, 1, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); glDisable(GL_BLEND); } if (drawTexture[0]) { BlendSetter b(premultA); - _imp->drawRenderingVAO(_imp->displayTextures[0].mipMapLevel, 0, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); + _imp->drawRenderingVAO(_imp->displayTextures[0].mipmapLevel, 0, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); } break; @@ -450,17 +450,17 @@ ViewerGL::paintGL() case eViewerCompositingOperatorStackMinus: { if (drawTexture[0] && !stack) { BlendSetter b(checkerboard ? premultA : eImagePremultiplicationOpaque); - _imp->drawRenderingVAO(_imp->displayTextures[0].mipMapLevel, 0, eDrawPolygonModeWipeLeft, true); + _imp->drawRenderingVAO(_imp->displayTextures[0].mipmapLevel, 0, eDrawPolygonModeWipeLeft, true); } if (drawTexture[0]) { BlendSetter b(premultA); - _imp->drawRenderingVAO(_imp->displayTextures[0].mipMapLevel, 0, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); + _imp->drawRenderingVAO(_imp->displayTextures[0].mipmapLevel, 0, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); } if (drawTexture[1]) { glEnable(GL_BLEND); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE); glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); - _imp->drawRenderingVAO(_imp->displayTextures[1].mipMapLevel, 1, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); + _imp->drawRenderingVAO(_imp->displayTextures[1].mipmapLevel, 1, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); glDisable(GL_BLEND); } break; @@ -469,17 +469,17 @@ ViewerGL::paintGL() case eViewerCompositingOperatorStackOnionSkin: { if (drawTexture[0] && !stack) { BlendSetter b(checkerboard ? premultA : eImagePremultiplicationOpaque); - _imp->drawRenderingVAO(_imp->displayTextures[0].mipMapLevel, 0, eDrawPolygonModeWipeLeft, true); + _imp->drawRenderingVAO(_imp->displayTextures[0].mipmapLevel, 0, eDrawPolygonModeWipeLeft, true); } if (drawTexture[0]) { BlendSetter b(premultA); - _imp->drawRenderingVAO(_imp->displayTextures[0].mipMapLevel, 0, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); + _imp->drawRenderingVAO(_imp->displayTextures[0].mipmapLevel, 0, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); } if (drawTexture[1]) { glEnable(GL_BLEND); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE); //glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); - _imp->drawRenderingVAO(_imp->displayTextures[1].mipMapLevel, 1, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); + _imp->drawRenderingVAO(_imp->displayTextures[1].mipmapLevel, 1, stack ? eDrawPolygonModeWhole : eDrawPolygonModeWipeRight, false); glDisable(GL_BLEND); } break; @@ -490,7 +490,7 @@ ViewerGL::paintGL() const TextureRect &r = _imp->partialUpdateTextures[i].texture->getTextureRect(); RectI texRect(r.x1, r.y1, r.x2, r.y2); const double par = r.par; - const RectD canonicalTexRect = texRect.toCanonical_noClipping(_imp->partialUpdateTextures[i].mipMapLevel, par); + const RectD canonicalTexRect = texRect.toCanonical_noClipping(_imp->partialUpdateTextures[i].mipmapLevel, par); glActiveTexture(GL_TEXTURE0); glBindTexture( GL_TEXTURE_2D, _imp->partialUpdateTextures[i].texture->getTexID() ); @@ -511,7 +511,7 @@ ViewerGL::paintGL() glCheckError(); if (_imp->overlay) { - drawOverlay( getCurrentRenderScale() ); + drawOverlay(getCurrentMipmapLevel()); } else { const QFont& f = font(); QFontMetrics fm(f); @@ -603,7 +603,7 @@ ViewerGL::centerWipe() } void -ViewerGL::drawOverlay(unsigned int mipMapLevel) +ViewerGL::drawOverlay(unsigned int mipmapLevel) { // always running in the main thread assert( qApp && qApp->thread() == QThread::currentThread() ); @@ -722,13 +722,12 @@ ViewerGL::drawOverlay(unsigned int mipMapLevel) glCheckError(); glColor4f(1., 1., 1., 1.); - double scale = 1. / (1 << mipMapLevel); /* Draw the overlays corresponding to the image displayed on the viewer, not the current timeline's time */ double time = getCurrentlyDisplayedTime(); - _imp->viewerTab->drawOverlays( time, RenderScale(scale) ); + _imp->viewerTab->drawOverlays( time, RenderScale::fromMipmapLevel(mipmapLevel) ); glCheckErrorIgnoreOSXBug(); @@ -1077,10 +1076,10 @@ ViewerGL::drawPickerPixel(double screenPixelRatio) } QPointF pos = _imp->lastPickerPos; - unsigned int mipMapLevel = getInternalNode()->getMipMapLevel(); + unsigned int mipmapLevel = getInternalNode()->getMipmapLevel(); - if (mipMapLevel != 0) { - pos *= (1 << mipMapLevel); + if (mipmapLevel != 0) { + pos *= (1 << mipmapLevel); } glColor3f(0.9, 0.7, 0.); glPointSize(zoomFactor * screenPixelRatio); @@ -1295,7 +1294,7 @@ ViewerGL::getZoomFactor() const RectI ViewerGL::getImageRectangleDisplayed(const RectI & imageRoDPixel, // in pixel coordinates const double par, - unsigned int mipMapLevel) + unsigned int mipmapLevel) { // MT-SAFE RectD visibleArea; @@ -1313,9 +1312,9 @@ ViewerGL::getImageRectangleDisplayed(const RectI & imageRoDPixel, // in pixel co visibleArea.y1 = bottomRight.y(); } - if (mipMapLevel != 0) { + if (mipmapLevel != 0) { // for the viewer, we need the smallest enclosing rectangle at the mipmap level, in order to avoid black borders - ret = visibleArea.toPixelEnclosing(mipMapLevel, par); + ret = visibleArea.toPixelEnclosing(mipmapLevel, par); } else { ret.x1 = std::floor(visibleArea.x1 / par); ret.x2 = std::ceil(visibleArea.x2 / par); @@ -1338,7 +1337,7 @@ ViewerGL::getImageRectangleDisplayed(const RectI & imageRoDPixel, // in pixel co } if (userRoiEnabled) { ///If the user roi is enabled, we want to render the smallest enclosing rectangle in order to avoid black borders. - const RectI userRoIpixel = userRoI.toPixelEnclosing(mipMapLevel, par); + const RectI userRoIpixel = userRoI.toPixelEnclosing(mipmapLevel, par); ///If the user roi doesn't intersect the actually visible portion on the viewer, return an empty rectangle. ret = ret.intersect(userRoIpixel); @@ -1351,19 +1350,19 @@ RectI ViewerGL::getExactImageRectangleDisplayed(int texIndex, const RectD & rod, const double par, - unsigned int mipMapLevel) + unsigned int mipmapLevel) { bool clipToFormat = isClippingImageToFormat(); const RectD clippedRod = clipToFormat ? rod.intersect(_imp->displayTextures[texIndex].format) : rod; - const RectI bounds = clippedRod.toPixelEnclosing(mipMapLevel, par); - return getImageRectangleDisplayed(bounds, par, mipMapLevel); + const RectI bounds = clippedRod.toPixelEnclosing(mipmapLevel, par); + return getImageRectangleDisplayed(bounds, par, mipmapLevel); } RectI ViewerGL::getImageRectangleDisplayedRoundedToTileSize(int texIndex, const RectD & rod, const double par, - unsigned int mipMapLevel, + unsigned int mipmapLevel, std::vector* tiles, std::vector* tilesRounded, int *viewerTileSize, @@ -1371,8 +1370,8 @@ ViewerGL::getImageRectangleDisplayedRoundedToTileSize(int texIndex, { bool clipToProject = isClippingImageToFormat(); const RectD clippedRod = clipToProject ? rod.intersect(_imp->displayTextures[texIndex].format) : rod; - const RectI bounds = clippedRod.toPixelEnclosing(mipMapLevel, par); - const RectI roi = getImageRectangleDisplayed(bounds, par, mipMapLevel); + const RectI bounds = clippedRod.toPixelEnclosing(mipmapLevel, par); + const RectI roi = getImageRectangleDisplayed(bounds, par, mipmapLevel); ////Texrect is the coordinates of the 4 corners of the texture in the bounds with the current zoom ////factor taken into account. @@ -1509,7 +1508,7 @@ ViewerGL::endTransferBufferFromRAMToGPU(int textureIndex, const RectD& rod, double par, ImageBitDepthEnum depth, - unsigned int mipMapLevel, + unsigned int mipmapLevel, ImagePremultiplicationEnum premult, double gain, double gamma, @@ -1532,7 +1531,7 @@ ViewerGL::endTransferBufferFromRAMToGPU(int textureIndex, info.gain = gain; info.gamma = gamma; info.offset = offset; - info.mipMapLevel = mipMapLevel; + info.mipmapLevel = mipmapLevel; info.premult = premult; info.time = time; info.memoryHeldByLastRenderedImages = 0; @@ -1548,7 +1547,7 @@ ViewerGL::endTransferBufferFromRAMToGPU(int textureIndex, _imp->displayTextures[textureIndex].gain = gain; _imp->displayTextures[textureIndex].gamma = gamma; _imp->displayTextures[textureIndex].offset = offset; - _imp->displayTextures[textureIndex].mipMapLevel = mipMapLevel; + _imp->displayTextures[textureIndex].mipmapLevel = mipmapLevel; _imp->displayingImageLut = (ViewerColorSpaceEnum)lut; _imp->displayTextures[textureIndex].premult = premult; _imp->displayTextures[textureIndex].time = time; @@ -1563,7 +1562,7 @@ ViewerGL::endTransferBufferFromRAMToGPU(int textureIndex, _imp->viewerTab->setImageFormat(textureIndex, image->getComponents(), depth); { QMutexLocker k(&_imp->lastRenderedImageMutex); - _imp->displayTextures[textureIndex].lastRenderedTiles[mipMapLevel] = image; + _imp->displayTextures[textureIndex].lastRenderedTiles[mipmapLevel] = image; } _imp->displayTextures[textureIndex].memoryHeldByLastRenderedImages = 0; _imp->displayTextures[textureIndex].memoryHeldByLastRenderedImages += image->size(); @@ -1571,7 +1570,7 @@ ViewerGL::endTransferBufferFromRAMToGPU(int textureIndex, internalNode->registerPluginMemory(_imp->displayTextures[textureIndex].memoryHeldByLastRenderedImages); Q_EMIT imageChanged(textureIndex, true); } else { - if ( !_imp->displayTextures[textureIndex].lastRenderedTiles[mipMapLevel] ) { + if ( !_imp->displayTextures[textureIndex].lastRenderedTiles[mipmapLevel] ) { Q_EMIT imageChanged(textureIndex, false); } else { Q_EMIT imageChanged(textureIndex, true); @@ -1881,9 +1880,7 @@ ViewerGL::mousePressEvent(QMouseEvent* e) if (!overlaysCaught && (_imp->ms == eMouseStateUndefined) && _imp->overlay) { - unsigned int mipMapLevel = getCurrentRenderScale(); - double scale = 1. / (1 << mipMapLevel); - overlaysCaught = _imp->viewerTab->notifyOverlaysPenDown( RenderScale(scale), _imp->pointerTypeOnPress, QMouseEventLocalPos(e), zoomPos, _imp->pressureOnPress, currentTimeForEvent(e) ); + overlaysCaught = _imp->viewerTab->notifyOverlaysPenDown(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), _imp->pointerTypeOnPress, QMouseEventLocalPos(e), zoomPos, _imp->pressureOnPress, currentTimeForEvent(e)); if (overlaysCaught) { mustRedraw = true; } @@ -2083,9 +2080,7 @@ ViewerGL::mouseReleaseEvent(QMouseEvent* e) QMutexLocker l(&_imp->zoomCtxMutex); zoomPos = _imp->zoomCtx.toZoomCoordinates( e->x(), e->y() ); } - unsigned int mipMapLevel = getCurrentRenderScale(); - double scale = 1. / (1 << mipMapLevel); - if ( _imp->viewerTab->notifyOverlaysPenUp(RenderScale(scale), QMouseEventLocalPos(e), zoomPos, currentTimeForEvent(e), _imp->pressureOnRelease) ) { + if ( _imp->viewerTab->notifyOverlaysPenUp(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), QMouseEventLocalPos(e), zoomPos, currentTimeForEvent(e), _imp->pressureOnRelease) ) { mustRedraw = true; } if (mustRedraw) { @@ -2508,10 +2503,8 @@ ViewerGL::penMotionInternal(int x, }; break; default: { QPointF localPos(x, y); - unsigned int mipMapLevel = getCurrentRenderScale(); - double scale = 1. / (1 << mipMapLevel); if ( _imp->overlay && - _imp->viewerTab->notifyOverlaysPenMotion(RenderScale(scale), localPos, zoomPos, pressure, timestamp) ) { + _imp->viewerTab->notifyOverlaysPenMotion(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), localPos, zoomPos, pressure, timestamp)) { mustRedraw = true; overlaysCaughtByPlugin = true; } @@ -2539,15 +2532,12 @@ ViewerGL::penMotionInternal(int x, void ViewerGL::mouseDoubleClickEvent(QMouseEvent* e) { - unsigned int mipMapLevel = getCurrentRenderScale(); QPointF pos_opengl; { QMutexLocker l(&_imp->zoomCtxMutex); pos_opengl = _imp->zoomCtx.toZoomCoordinates( e->x(), e->y() ); } - double scale = 1. / (1 << mipMapLevel); - - if ( _imp->viewerTab->notifyOverlaysPenDoubleClick(RenderScale(scale), QMouseEventLocalPos(e), pos_opengl) ) { + if ( _imp->viewerTab->notifyOverlaysPenDoubleClick(RenderScale::fromMipmapLevel(getCurrentMipmapLevel()), QMouseEventLocalPos(e), pos_opengl) ) { update(); } QOpenGLWidget::mouseDoubleClickEvent(e); @@ -2722,13 +2712,13 @@ bool ViewerGL::checkIfViewPortRoIValidOrRenderForInput(int texIndex) { - unsigned int mipMapLevel = (unsigned int)std::max((int)getInternalNode()->getMipMapLevelFromZoomFactor(), (int)getInternalNode()->getViewerMipMapLevel()); - int closestPo2 = 1 << mipMapLevel; + unsigned int mipmapLevel = std::max(getInternalNode()->getMipmapLevelFromZoomFactor(), getInternalNode()->getMipmapLevel()); + int closestPo2 = 1 << mipmapLevel; if (closestPo2 != _imp->displayTextures[texIndex].texture->getTextureRect().closestPo2) { return false; } RectI roiNotRounded; - RectI roi = getImageRectangleDisplayedRoundedToTileSize(texIndex, _imp->displayTextures[texIndex].rod, _imp->displayTextures[texIndex].texture->getTextureRect().par, mipMapLevel, 0, 0, 0, &roiNotRounded); + RectI roi = getImageRectangleDisplayedRoundedToTileSize(texIndex, _imp->displayTextures[texIndex].rod, _imp->displayTextures[texIndex].texture->getTextureRect().par, mipmapLevel, 0, 0, 0, &roiNotRounded); const RectI& currentTexRoi = _imp->displayTextures[texIndex].texture->getTextureRect(); if (!currentTexRoi.contains(roi)) { return false; @@ -2815,7 +2805,7 @@ ViewerGL::wheelEvent(QWheelEvent* e) gui->selectNode(nodeGui); double zoomFactor; - unsigned int oldMipMapLevel, newMipMapLevel; + unsigned int oldMipmapLevel, newMipmapLevel; #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) double scaleFactor = std::pow( NATRON_WHEEL_ZOOM_PER_DELTA, e->angleDelta().y() ); #else @@ -2830,14 +2820,14 @@ ViewerGL::wheelEvent(QWheelEvent* e) #endif zoomFactor = _imp->zoomCtx.factor(); - //oldMipMapLevel = std::log( zoomFactor >= 1 ? 1 : ipow( 2, -std::ceil(std::log(zoomFactor) / M_LN2) ) ) / M_LN2; - oldMipMapLevel = zoomFactor >= 1 ? 0 : -std::ceil(std::log(zoomFactor) / M_LN2); + //oldMipmapLevel = std::log( zoomFactor >= 1 ? 1 : ipow( 2, -std::ceil(std::log(zoomFactor) / M_LN2) ) ) / M_LN2; + oldMipmapLevel = zoomFactor >= 1 ? 0 : -std::ceil(std::log(zoomFactor) / M_LN2); _imp->zoomCtx.zoom(zoomCenter.x(), zoomCenter.y(), scaleFactor); zoomFactor = _imp->zoomCtx.factor(); } - //newMipMapLevel = std::log( zoomFactor >= 1 ? 1 : std::pow( 2, -std::ceil(std::log(zoomFactor) / M_LN2) ) ) / M_LN2; - newMipMapLevel = zoomFactor >= 1 ? 0 : -std::ceil(std::log(zoomFactor) / M_LN2); + //newMipmapLevel = std::log( zoomFactor >= 1 ? 1 : std::pow( 2, -std::ceil(std::log(zoomFactor) / M_LN2) ) ) / M_LN2; + newMipmapLevel = zoomFactor >= 1 ? 0 : -std::ceil(std::log(zoomFactor) / M_LN2); _imp->zoomOrPannedSinceLastFit = true; int zoomValue = (int)(100 * zoomFactor); if (zoomValue == 0) { @@ -2855,7 +2845,7 @@ ViewerGL::wheelEvent(QWheelEvent* e) ///Clear green cached line so the user doesn't expect to see things in the cache ///since we're changing the zoom factor - if (oldMipMapLevel != newMipMapLevel) { + if (oldMipmapLevel != newMipmapLevel) { _imp->viewerTab->clearTimelineCacheLine(); } update(); @@ -2875,15 +2865,15 @@ ViewerGL::zoomSlot(int v) assert(v > 0); double newZoomFactor = v / 100.; - unsigned int oldMipMapLevel, newMipMapLevel; - //newMipMapLevel = std::log( newZoomFactor >= 1 ? 1 : + unsigned int oldMipmapLevel, newMipmapLevel; + //newMipmapLevel = std::log( newZoomFactor >= 1 ? 1 : // std::pow( 2, -std::ceil(std::log(newZoomFactor) / M_LN2) ) ) / M_LN2; - newMipMapLevel = newZoomFactor >= 1 ? 0 : -std::ceil(std::log(newZoomFactor) / M_LN2); + newMipmapLevel = newZoomFactor >= 1 ? 0 : -std::ceil(std::log(newZoomFactor) / M_LN2); { QMutexLocker l(&_imp->zoomCtxMutex); - //oldMipMapLevel = std::log( _imp->zoomCtx.factor() >= 1 ? 1 : + //oldMipmapLevel = std::log( _imp->zoomCtx.factor() >= 1 ? 1 : // std::pow( 2, -std::ceil(std::log( _imp->zoomCtx.factor() ) / M_LN2) ) ) / M_LN2; - oldMipMapLevel = _imp->zoomCtx.factor() >= 1 ? 0 : -std::ceil(std::log( _imp->zoomCtx.factor() ) / M_LN2); + oldMipmapLevel = _imp->zoomCtx.factor() >= 1 ? 0 : -std::ceil(std::log( _imp->zoomCtx.factor() ) / M_LN2); double scale = newZoomFactor / _imp->zoomCtx.factor(); double centerX = ( _imp->zoomCtx.left() + _imp->zoomCtx.right() ) / 2.; double centerY = ( _imp->zoomCtx.top() + _imp->zoomCtx.bottom() ) / 2.; @@ -2892,7 +2882,7 @@ ViewerGL::zoomSlot(int v) } ///Clear green cached line so the user doesn't expect to see things in the cache ///since we're changing the zoom factor - if (newMipMapLevel != oldMipMapLevel) { + if (newMipmapLevel != oldMipmapLevel) { _imp->viewerTab->clearTimelineCacheLine(); } @@ -2919,13 +2909,13 @@ ViewerGL::fitImageToFormat() double old_zoomFactor; double zoomFactor; - unsigned int oldMipMapLevel, newMipMapLevel; + unsigned int oldMipmapLevel, newMipmapLevel; { - QMutexLocker(&_imp->zoomCtxMutex); + QMutexLocker l(&_imp->zoomCtxMutex); old_zoomFactor = _imp->zoomCtx.factor(); - //oldMipMapLevel = std::log( old_zoomFactor >= 1 ? 1 : + //oldMipmapLevel = std::log( old_zoomFactor >= 1 ? 1 : // std::pow( 2, -std::ceil(std::log(old_zoomFactor) / M_LN2) ) ) / M_LN2; - oldMipMapLevel = old_zoomFactor >= 1 ? 0 : -std::ceil(std::log(old_zoomFactor) / M_LN2); + oldMipmapLevel = old_zoomFactor >= 1 ? 0 : -std::ceil(std::log(old_zoomFactor) / M_LN2); // set the PAR first //_imp->zoomCtx.setZoom(0., 0., 1., 1.); @@ -2934,9 +2924,9 @@ ViewerGL::fitImageToFormat() zoomFactor = _imp->zoomCtx.factor(); } _imp->zoomOrPannedSinceLastFit = false; - //newMipMapLevel = std::log( zoomFactor >= 1 ? 1 : + //newMipmapLevel = std::log( zoomFactor >= 1 ? 1 : // std::pow( 2, -std::ceil(std::log(zoomFactor) / M_LN2) ) ) / M_LN2; - newMipMapLevel = zoomFactor >= 1 ? 0 : -std::ceil(std::log(zoomFactor) / M_LN2); + newMipmapLevel = zoomFactor >= 1 ? 0 : -std::ceil(std::log(zoomFactor) / M_LN2); _imp->oldClick = QPoint(); // reset mouse posn @@ -2952,7 +2942,7 @@ ViewerGL::fitImageToFormat() _imp->viewerTab->synchronizeOtherViewersProjection(); } - if (newMipMapLevel != oldMipMapLevel) { + if (newMipmapLevel != oldMipmapLevel) { ///Clear green cached line so the user doesn't expect to see things in the cache ///since we're changing the zoom factor _imp->viewerTab->clearTimelineCacheLine(); @@ -3139,8 +3129,7 @@ ViewerGL::focusInEvent(QFocusEvent* e) if ( !_imp->viewerTab->getGui() ) { return; } - double scale = 1. / ( 1 << getCurrentRenderScale() ); - if ( _imp->viewerTab->notifyOverlaysFocusGained( RenderScale(scale) ) ) { + if ( _imp->viewerTab->notifyOverlaysFocusGained(RenderScale::fromMipmapLevel(getCurrentMipmapLevel())) ) { update(); } QOpenGLWidget::focusInEvent(e); @@ -3156,8 +3145,7 @@ ViewerGL::focusOutEvent(QFocusEvent* e) return; } - double scale = 1. / ( 1 << getCurrentRenderScale() ); - if ( _imp->viewerTab->notifyOverlaysFocusLost( RenderScale(scale) ) ) { + if ( _imp->viewerTab->notifyOverlaysFocusLost(RenderScale::fromMipmapLevel(getCurrentMipmapLevel())) ) { update(); } QOpenGLWidget::focusOutEvent(e); @@ -3479,7 +3467,7 @@ ViewerGL::setUserRoIEnabled(bool b) // always running in the main thread assert( qApp && qApp->thread() == QThread::currentThread() ); { - QMutexLocker(&_imp->userRoIMutex); + QMutexLocker l(&_imp->userRoIMutex); _imp->userRoIEnabled = b; } if (!b) { @@ -3580,7 +3568,7 @@ bool ViewerGL::isUserRegionOfInterestEnabled() const { // MT-SAFE - QMutexLocker(&_imp->userRoIMutex); + QMutexLocker l(&_imp->userRoIMutex); return _imp->userRoIEnabled; } @@ -3589,7 +3577,7 @@ RectD ViewerGL::getUserRegionOfInterest() const { // MT-SAFE - QMutexLocker(&_imp->userRoIMutex); + QMutexLocker l(&_imp->userRoIMutex); return _imp->userRoI; } @@ -3598,7 +3586,7 @@ void ViewerGL::setUserRoI(const RectD & r) { // MT-SAFE - QMutexLocker(&_imp->userRoIMutex); + QMutexLocker l(&_imp->userRoIMutex); _imp->userRoI = r; } @@ -4199,8 +4187,8 @@ ViewerGL::getLastRenderedImage(int textureIndex) const } ImagePtr -ViewerGL::getLastRenderedImageByMipMapLevel(int textureIndex, - unsigned int mipMapLevel) const +ViewerGL::getLastRenderedImageByMipmapLevel(int textureIndex, + unsigned int mipmapLevel) const { // always running in the main thread assert( qApp && qApp->thread() == QThread::currentThread() ); @@ -4210,16 +4198,16 @@ ViewerGL::getLastRenderedImageByMipMapLevel(int textureIndex, } QMutexLocker l(&_imp->lastRenderedImageMutex); - assert(_imp->displayTextures[textureIndex].lastRenderedTiles.size() > mipMapLevel); + assert(_imp->displayTextures[textureIndex].lastRenderedTiles.size() > mipmapLevel); - ImagePtr mipmap = _imp->displayTextures[textureIndex].lastRenderedTiles[mipMapLevel]; + ImagePtr mipmap = _imp->displayTextures[textureIndex].lastRenderedTiles[mipmapLevel]; if (mipmap) { return mipmap; } //Find an image at higher scale - if (mipMapLevel > 0) { - for (int i = (int)mipMapLevel - 1; i >= 0; --i) { + if (mipmapLevel > 0) { + for (int i = (int)mipmapLevel - 1; i >= 0; --i) { mipmap = _imp->displayTextures[textureIndex].lastRenderedTiles[i]; if (mipmap) { return mipmap; @@ -4228,7 +4216,7 @@ ViewerGL::getLastRenderedImageByMipMapLevel(int textureIndex, } //Find an image at lower scale - for (U32 i = mipMapLevel + 1; i < _imp->displayTextures[textureIndex].lastRenderedTiles.size(); ++i) { + for (U32 i = mipmapLevel + 1; i < _imp->displayTextures[textureIndex].lastRenderedTiles.size(); ++i) { mipmap = _imp->displayTextures[textureIndex].lastRenderedTiles[i]; if (mipmap) { return mipmap; @@ -4241,13 +4229,13 @@ ViewerGL::getLastRenderedImageByMipMapLevel(int textureIndex, #ifndef M_LN2 #define M_LN2 0.693147180559945309417232121458176568 /* loge(2) */ #endif -int -ViewerGL::getMipMapLevelCombinedToZoomFactor() const +unsigned int +ViewerGL::getMipmapLevelCombinedToZoomFactor() const { if (!getInternalNode()) { return 0; } - int mmLvl = getInternalNode()->getMipMapLevel(); + unsigned int mmLvl = getInternalNode()->getMipmapLevel(); double factor = getZoomFactor(); if (factor > 1) { @@ -4259,9 +4247,9 @@ ViewerGL::getMipMapLevelCombinedToZoomFactor() const } unsigned int -ViewerGL::getCurrentRenderScale() const +ViewerGL::getCurrentMipmapLevel() const { - return getMipMapLevelCombinedToZoomFactor(); + return getMipmapLevelCombinedToZoomFactor(); } template @@ -4351,8 +4339,8 @@ ViewerGL::getColorAt(double x, assert(textureIndex == 0 || textureIndex == 1); - unsigned int mipMapLevel = (unsigned int)getMipMapLevelCombinedToZoomFactor(); - ImagePtr image = getLastRenderedImageByMipMapLevel(textureIndex, mipMapLevel); + unsigned int mipmapLevel = (unsigned int)getMipmapLevelCombinedToZoomFactor(); + ImagePtr image = getLastRenderedImageByMipmapLevel(textureIndex, mipmapLevel); if (!image) { @@ -4394,7 +4382,7 @@ ViewerGL::getColorAt(double x, } const double par = image->getPixelAspectRatio(); - double scale = 1. / ( 1 << image->getMipMapLevel() ); + double scale = 1. / ( 1 << image->getMipmapLevel() ); ///Convert to pixel coords int xPixel = std::floor(x * scale / par); @@ -4429,7 +4417,7 @@ ViewerGL::getColorAt(double x, gotval = false; break; } - *imgMmlevel = image->getMipMapLevel(); + *imgMmlevel = image->getMipmapLevel(); return gotval; } // getColorAt @@ -4449,20 +4437,20 @@ ViewerGL::getColorAtRect(const RectD &rect, // rectangle in canonical coordinate assert(r && g && b && a); assert(textureIndex == 0 || textureIndex == 1); - unsigned int mipMapLevel = (unsigned int)getMipMapLevelCombinedToZoomFactor(); - ImagePtr image = getLastRenderedImageByMipMapLevel(textureIndex, mipMapLevel); + unsigned int mipmapLevel = (unsigned int)getMipmapLevelCombinedToZoomFactor(); + ImagePtr image = getLastRenderedImageByMipmapLevel(textureIndex, mipmapLevel); if (image) { - mipMapLevel = image->getMipMapLevel(); - *imgMm = mipMapLevel; + mipmapLevel = image->getMipmapLevel(); + *imgMm = mipmapLevel; } ///Convert to pixel coords RectI rectPixel; - rectPixel.x1 = int( std::floor( rect.left() ) ) >> mipMapLevel; - rectPixel.y1 = int( std::floor( rect.bottom() ) ) >> mipMapLevel; - rectPixel.x2 = int( std::floor( rect.right() ) ) >> mipMapLevel; - rectPixel.y2 = int( std::floor( rect.top() ) ) >> mipMapLevel; + rectPixel.x1 = int( std::floor( rect.left() ) ) >> mipmapLevel; + rectPixel.y1 = int( std::floor( rect.bottom() ) ) >> mipmapLevel; + rectPixel.x2 = int( std::floor( rect.right() ) ) >> mipmapLevel; + rectPixel.y2 = int( std::floor( rect.top() ) ) >> mipmapLevel; assert( rect.bottom() <= rect.top() && rect.left() <= rect.right() ); assert( rectPixel.y1 <= rectPixel.y2 && rectPixel.x1 <= rectPixel.x2 ); double rSum = 0.; diff --git a/Gui/ViewerGL.h b/Gui/ViewerGL.h index 374d884354..1dc11c04d9 100644 --- a/Gui/ViewerGL.h +++ b/Gui/ViewerGL.h @@ -128,9 +128,9 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON /** * @brief Returns the rectangle of the image displayed by the viewer **/ - virtual RectI getImageRectangleDisplayed(const RectI & imageRoD, const double par, unsigned int mipMapLevel) OVERRIDE FINAL; - virtual RectI getExactImageRectangleDisplayed(int texIndex, const RectD & rod, const double par, unsigned int mipMapLevel) OVERRIDE FINAL; - virtual RectI getImageRectangleDisplayedRoundedToTileSize(int texIndex, const RectD & rod, const double par, unsigned int mipMapLevel, std::vector* tiles, std::vector* tilesRounded, int *tileSize, RectI* roiNotRounded) OVERRIDE FINAL WARN_UNUSED_RETURN; + virtual RectI getImageRectangleDisplayed(const RectI & imageRoD, const double par, unsigned int mipmapLevel) OVERRIDE FINAL; + virtual RectI getExactImageRectangleDisplayed(int texIndex, const RectD & rod, const double par, unsigned int mipmapLevel) OVERRIDE FINAL; + virtual RectI getImageRectangleDisplayedRoundedToTileSize(int texIndex, const RectD & rod, const double par, unsigned int mipmapLevel, std::vector* tiles, std::vector* tilesRounded, int *tileSize, RectI* roiNotRounded) OVERRIDE FINAL WARN_UNUSED_RETURN; /** *@brief Set the pointer to the InfoViewerWidget. This is called once after creation * of the ViewerGL. @@ -181,7 +181,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON const RectD& rod, double par, ImageBitDepthEnum depth, - unsigned int mipMapLevel, + unsigned int mipmapLevel, ImagePremultiplicationEnum premult, double gain, double gamma, @@ -426,7 +426,7 @@ public Q_SLOTS: **/ ImagePtr getLastRenderedImage(int textureIndex) const; - ImagePtr getLastRenderedImageByMipMapLevel(int textureIndex, unsigned int mipMapLevel) const; + ImagePtr getLastRenderedImageByMipmapLevel(int textureIndex, unsigned int mipmapLevel) const; /** * @brief Get the color of the currently displayed image at position x,y. @@ -437,17 +437,17 @@ public Q_SLOTS: * @return true if the point is inside the image and colors were set **/ bool getColorAt(double x, double y, bool forceLinear, int textureIndex, float* r, - float* g, float* b, float* a, unsigned int* mipMapLevel) WARN_UNUSED_RETURN; + float* g, float* b, float* a, unsigned int* mipmapLevel) WARN_UNUSED_RETURN; // same as getColor, but computes the mean over a given rectangle bool getColorAtRect(const RectD &rect, // rectangle in canonical coordinates - bool forceLinear, int textureIndex, float* r, float* g, float* b, float* a, unsigned int* mipMapLevel); + bool forceLinear, int textureIndex, float* r, float* g, float* b, float* a, unsigned int* mipmapLevel); - virtual unsigned int getCurrentRenderScale() const OVERRIDE FINAL; + virtual unsigned int getCurrentMipmapLevel() const OVERRIDE FINAL; - ///same as getMipMapLevel but with the zoomFactor taken into account - int getMipMapLevelCombinedToZoomFactor() const WARN_UNUSED_RETURN; + ///same as getMipmapLevel but with the zoomFactor taken into account + unsigned int getMipmapLevelCombinedToZoomFactor() const WARN_UNUSED_RETURN; virtual int getCurrentlyDisplayedTime() const OVERRIDE FINAL WARN_UNUSED_RETURN; @@ -562,7 +562,7 @@ public Q_SLOTS: /** *@brief Called inside paintGL(). It will draw all the overlays. **/ - void drawOverlay(unsigned int mipMapLevel); + void drawOverlay(unsigned int mipmapLevel); /** * @brief Called by drawOverlay to draw the user region of interest. diff --git a/Gui/ViewerGLPrivate.cpp b/Gui/ViewerGLPrivate.cpp index 6ec3d5b9a6..72deb4f23c 100644 --- a/Gui/ViewerGLPrivate.cpp +++ b/Gui/ViewerGLPrivate.cpp @@ -230,7 +230,7 @@ static const GLubyte triangleStrip[28] = { // |/ |/ |/ | // 12--13--14--15 void -ViewerGL::Implementation::drawRenderingVAO(unsigned int mipMapLevel, +ViewerGL::Implementation::drawRenderingVAO(unsigned int mipmapLevel, int textureIndex, ViewerGL::DrawPolygonModeEnum polygonMode, bool background) @@ -250,8 +250,8 @@ ViewerGL::Implementation::drawRenderingVAO(unsigned int mipMapLevel, ///This is the coordinates in the image being rendered where datas are valid, this is in pixel coordinates ///at the time we initialize it but we will convert it later to canonical coordinates. See 1) const double par = roiRounded.par; - const RectD canonicalRoIRoundedToTileSize = roiRounded.toCanonical_noClipping(mipMapLevel, par); - const RectD canonicalRoINotRounded = roiNotRounded.toCanonical_noClipping(mipMapLevel, par); + const RectD canonicalRoIRoundedToTileSize = roiRounded.toCanonical_noClipping(mipmapLevel, par); + const RectD canonicalRoINotRounded = roiNotRounded.toCanonical_noClipping(mipmapLevel, par); ///the RoD of the image in canonical coords. RectD rod = _this->getRoD(textureIndex); @@ -294,7 +294,8 @@ ViewerGL::Implementation::drawRenderingVAO(unsigned int mipMapLevel, { QMutexLocker l(&this->userRoIMutex); //if the userRoI isn't intersecting the rod, just don't render anything - if ( !rod.clipIfOverlaps(this->userRoI) ) { + rod.clip(this->userRoI); + if ( rod.isNull() ) { return; } } diff --git a/Gui/ViewerGLPrivate.h b/Gui/ViewerGLPrivate.h index 4acf4e9cbe..5e034df35d 100644 --- a/Gui/ViewerGLPrivate.h +++ b/Gui/ViewerGLPrivate.h @@ -109,7 +109,7 @@ struct TextureInfo , gain(1.) , gamma(1.) , offset(0.) - , mipMapLevel(0) + , mipmapLevel(0) , premult(eImagePremultiplicationOpaque) , time(0) , rod() @@ -127,7 +127,7 @@ struct TextureInfo double gain; double gamma; double offset; - unsigned int mipMapLevel; + unsigned int mipmapLevel; ImagePremultiplicationEnum premult; SequenceTime time; RectD rod; @@ -240,7 +240,7 @@ struct ViewerGL::Implementation *@brief Fill the rendering VAO with vertices and texture coordinates * that depends upon the currently displayed texture. **/ - void drawRenderingVAO(unsigned int mipMapLevel, int textureIndex, DrawPolygonModeEnum polygonMode, bool background); + void drawRenderingVAO(unsigned int mipmapLevel, int textureIndex, DrawPolygonModeEnum polygonMode, bool background); void initializeGL(); diff --git a/Gui/ViewerTab.cpp b/Gui/ViewerTab.cpp index 42a31876a0..8d8b7cd9cd 100644 --- a/Gui/ViewerTab.cpp +++ b/Gui/ViewerTab.cpp @@ -528,6 +528,7 @@ ViewerTab::ViewerTab(const std::list & existingNodesContext, _imp->viewerColorSpace->addItem( QString::fromUtf8("Linear(None)") ); _imp->viewerColorSpace->addItem( QString::fromUtf8("sRGB") ); _imp->viewerColorSpace->addItem( QString::fromUtf8("Rec.709") ); + _imp->viewerColorSpace->addItem( QString::fromUtf8("BT1886") ); _imp->viewerColorSpace->setCurrentIndex(1); QPixmap pixCheckerboardEnabled, pixCheckerboardDisabld; diff --git a/Gui/ViewerTab.h b/Gui/ViewerTab.h index da50aff7c2..d6480031d0 100644 --- a/Gui/ViewerTab.h +++ b/Gui/ViewerTab.h @@ -162,9 +162,9 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON void setAutoContrastEnabled(bool b); - void setMipMapLevel(int level); + void setMipmapLevel(unsigned int level); - int getMipMapLevel() const; + unsigned int getMipmapLevel() const; void setRenderScaleActivated(bool act); diff --git a/Gui/ViewerTab10.cpp b/Gui/ViewerTab10.cpp index 6cf09378af..3832f4c2fc 100644 --- a/Gui/ViewerTab10.cpp +++ b/Gui/ViewerTab10.cpp @@ -76,6 +76,8 @@ ViewerTab::onColorSpaceComboBoxChanged(int v) colorspace = eViewerColorSpaceSRGB; } else if (v == 2) { colorspace = eViewerColorSpaceRec709; + } else if (v == 3) { + colorspace = eViewerColorSpaceBT1886; } else { assert(false); throw std::logic_error("ViewerTab::onColorSpaceComboBoxChanged(): unknown colorspace"); @@ -617,11 +619,11 @@ ViewerTab::keyPressEvent(QKeyEvent* e) bool accept = true; Qt::KeyboardModifiers modifiers = e->modifiers(); Qt::Key key = (Qt::Key)Gui::handleNativeKeys( e->key(), e->nativeScanCode(), e->nativeVirtualKey() ); - double scale = 1. / ( 1 << _imp->viewer->getCurrentRenderScale() ); - if ( e->isAutoRepeat() && notifyOverlaysKeyRepeat(RenderScale(scale), e) ) { + const unsigned int mipmapLevel = _imp->viewer->getCurrentMipmapLevel(); + if ( e->isAutoRepeat() && notifyOverlaysKeyRepeat(RenderScale::fromMipmapLevel(mipmapLevel), e) ) { update(); - } else if ( notifyOverlaysKeyDown(RenderScale(scale), e) ) { + } else if ( notifyOverlaysKeyDown(RenderScale::fromMipmapLevel(mipmapLevel), e) ) { update(); } else if ( isKeybind(kShortcutGroupViewer, kShortcutIDActionLuminance, modifiers, key) ) { int currentIndex = _imp->viewerChannels->activeIndex(); @@ -901,8 +903,8 @@ ViewerTab::keyReleaseEvent(QKeyEvent* e) if ( !getGui() ) { return QWidget::keyPressEvent(e); } - double scale = 1. / ( 1 << _imp->viewer->getCurrentRenderScale() ); - if ( notifyOverlaysKeyUp(RenderScale(scale), e) ) { + const unsigned int mipmapLevel = _imp->viewer->getCurrentMipmapLevel(); + if ( notifyOverlaysKeyUp(RenderScale::fromMipmapLevel(mipmapLevel), e) ) { _imp->viewer->redraw(); } else { handleUnCaughtKeyUpEvent(e); diff --git a/Gui/ViewerTab30.cpp b/Gui/ViewerTab30.cpp index f60c6a4bcb..330d495068 100644 --- a/Gui/ViewerTab30.cpp +++ b/Gui/ViewerTab30.cpp @@ -89,8 +89,11 @@ ViewerTab::getColorSpace() const return "Rec.709"; break; - default: + case eViewerColorSpaceBT1886: + return "BT1886"; + break; + default: return ""; break; } @@ -194,20 +197,20 @@ ViewerTab::getGamma() const } void -ViewerTab::setMipMapLevel(int level) +ViewerTab::setMipmapLevel(unsigned int level) { if (level > 0) { _imp->renderScaleCombo->setCurrentIndex(level - 1); } - _imp->viewerNode->onMipMapLevelChanged(level); + _imp->viewerNode->onMipmapLevelChanged(level); _imp->viewer->checkIfViewPortRoIValidOrRender(); } -int -ViewerTab::getMipMapLevel() const +unsigned int +ViewerTab::getMipmapLevel() const { - return _imp->viewerNode->getMipMapLevel(); + return _imp->viewerNode->getMipmapLevel(); } void @@ -219,7 +222,7 @@ ViewerTab::setRenderScaleActivated(bool act) bool ViewerTab::getRenderScaleActivated() const { - return _imp->viewerNode->getMipMapLevel() != 0; + return _imp->viewerNode->getMipmapLevel() != 0; } void @@ -327,14 +330,14 @@ ViewerTab::onAutoContrastChanged(bool b) void ViewerTab::onRenderScaleComboIndexChanged(int index) { - int level; + unsigned int level; if (_imp->renderScaleActive) { level = index + 1; } else { level = 0; } - _imp->viewerNode->onMipMapLevelChanged(level); + _imp->viewerNode->onMipmapLevelChanged(level); _imp->viewer->checkIfViewPortRoIValidOrRender(); } diff --git a/Gui/ViewerTabPrivate.cpp b/Gui/ViewerTabPrivate.cpp index 8ee10c5625..10e9e35706 100644 --- a/Gui/ViewerTabPrivate.cpp +++ b/Gui/ViewerTabPrivate.cpp @@ -174,7 +174,6 @@ ViewerTabPrivate::getOverlayTransform(double time, if ( currentNode == targetNode ) { return true; } - RenderScale s(1.); EffectInstancePtr input; StatusEnum stat = eStatusReplyDefault; Transform::Matrix3x3 mat; @@ -186,7 +185,7 @@ ViewerTabPrivate::getOverlayTransform(double time, if ( !currentNode->getNode()->isNodeDisabled() /*&& currentNode->getNode()->getCurrentCanTransform()*/ ) { // Always use draft mode to draw overlay (so that transforms are applied, // even in case of motion blur, see Transform3x3Plugin::getTransform() ) - stat = currentNode->getTransform_public(time, s, /*draftRender=*/true, view, &input, &mat); + stat = currentNode->getTransform_public(time, RenderScale::identity, /*draftRender=*/true, view, &input, &mat); } if (stat == eStatusFailed) { return false; diff --git a/Tests/FileSystemModel_Test.cpp b/Tests/FileSystemModel_Test.cpp index 9ea83ab404..9d7e09b3fb 100644 --- a/Tests/FileSystemModel_Test.cpp +++ b/Tests/FileSystemModel_Test.cpp @@ -249,10 +249,8 @@ TEST(FileSystemModelTest, CleanPath) { expectedOutput = testCase.input; } #endif - // Make sure the expectation was actually set to something. - assert(!expectedOutput.isNull()); - - const auto output = FileSystemModel::cleanPath(input).toStdString(); - EXPECT_EQ(expectedOutput, output) << " input '" << testCase.input << "'"; + const QString output = FileSystemModel::cleanPath(input); + ASSERT_TRUE(!output.isNull()); + EXPECT_EQ(expectedOutput, output.toStdString()) << " input '" << testCase.input << "'"; } } \ No newline at end of file diff --git a/tools/MINGW-packages/build_natron_package_repo.sh b/tools/MINGW-packages/build_natron_package_repo.sh index ae87d01efc..dc08294d51 100644 --- a/tools/MINGW-packages/build_natron_package_repo.sh +++ b/tools/MINGW-packages/build_natron_package_repo.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e #set -x -CWD=$(pwd) +BUILD_SCRIPT_DIR=$(realpath $(dirname "${BASH_SOURCE[0]}")) PKGS=" mingw-w64-natron-setup @@ -21,7 +21,7 @@ mingw-w64-dump_syms mingw-w64-natron-build-deps-qt5 " -source ./natron_repo_common.sh +source "${BUILD_SCRIPT_DIR}/natron_repo_common.sh" trap natron_repo_cleanup EXIT @@ -37,7 +37,7 @@ natron_repo_init ${NATRON_REPO_DIR} for pkg_dir in ${PKGS}; do echo -e "\n\nEntering package directory ${pkg_dir}." - cd "${CWD}/${pkg_dir}" + cd "${BUILD_SCRIPT_DIR}/${pkg_dir}" PACKAGE_NAME=`makepkg --printsrcinfo | awk '/pkgname/{print $3}'` @@ -71,5 +71,5 @@ for pkg_dir in ${PKGS}; do fi echo -e "Leaving package directory ${pkg_dir}." - cd "${CWD}" + cd "${BUILD_SCRIPT_DIR}" done diff --git a/tools/MINGW-packages/mingw-w64-ffmpeg-gpl2/PKGBUILD b/tools/MINGW-packages/mingw-w64-ffmpeg-gpl2/PKGBUILD index a2cea2497e..6bbc742429 100644 --- a/tools/MINGW-packages/mingw-w64-ffmpeg-gpl2/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-ffmpeg-gpl2/PKGBUILD @@ -49,7 +49,7 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" source=(https://ffmpeg.org/releases/${_realname}-${pkgver}.tar.xz https://github.com/FFmpeg/FFmpeg/commit/effadce6c756247ea8bae32dc13bb3e6f464f0eb.patch) sha256sums=('6c5b6c195e61534766a0b5fe16acc919170c883362612816d0a1c7f4f947006e' - '206f4d8437b21f6197ffc444c86d0504892a5c2137cb227b4af1c1e8bf2c426c') + '8fad5f253bcda7a17523dbfcbfcfd60b3db23783dcdb65998005cddc7c7776c3') prepare() { cd "${srcdir}/${_realname}-${pkgver}" diff --git a/tools/MINGW-packages/mingw-w64-imath/PKGBUILD b/tools/MINGW-packages/mingw-w64-imath/PKGBUILD index adc25be926..a1948bca6d 100644 --- a/tools/MINGW-packages/mingw-w64-imath/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-imath/PKGBUILD @@ -3,7 +3,7 @@ _realname=imath pkgbase=mingw-w64-natron_${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-natron_${_realname}") -pkgver=3.1.9 +pkgver=3.1.10 pkgrel=99.1 pkgdesc='A C++ and python library of 2D and 3D vector, matrix, and math operations for computer graphics (mingw-w64)' url='https://www.openexr.com/' @@ -11,10 +11,10 @@ arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64') license=('spdx:BSD-3-Clause') depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs") -makedepends=("${MINGW_PACKAGE_PREFIX}-boost" - "${MINGW_PACKAGE_PREFIX}-cc" +makedepends=("${MINGW_PACKAGE_PREFIX}-cc" "${MINGW_PACKAGE_PREFIX}-cmake" "${MINGW_PACKAGE_PREFIX}-ninja" + "${MINGW_PACKAGE_PREFIX}-boost" "${MINGW_PACKAGE_PREFIX}-python" "${MINGW_PACKAGE_PREFIX}-python-numpy") optdepends=("${MINGW_PACKAGE_PREFIX}-python: python bindings" @@ -22,7 +22,7 @@ optdepends=("${MINGW_PACKAGE_PREFIX}-python: python bindings" source=("https://github.com/AcademySoftwareFoundation/Imath/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz" 0001-cmake-libs-name.patch 0002-fix-openexr-clang-build.patch) -sha256sums=('f1d8aacd46afed958babfced3190d2d3c8209b66da451f556abd6da94c165cf3' +sha256sums=('f2943e86bfb694e216c60b9a169e5356f8a90f18fbd34d7b6e3450be14f60b10' '2dc2de52e2475cc9d725ff443466d3ac247a405018f1d9b0caeb03a9d5116d9b' '0eea3c7b57d5b59887f963d696c2afdcfb1976a3913f161995e19b13d6a65086') @@ -35,7 +35,6 @@ prepare() { } build() { - [[ -d "${srcdir}/build-${MSYSTEM}" ]] && rm -rf "${srcdir}/build-${MSYSTEM}" mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}" declare -a _extra_config diff --git a/tools/MINGW-packages/mingw-w64-natron-build-deps-qt5/PKGBUILD b/tools/MINGW-packages/mingw-w64-natron-build-deps-qt5/PKGBUILD index 0355962517..88940a8b6c 100644 --- a/tools/MINGW-packages/mingw-w64-natron-build-deps-qt5/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-natron-build-deps-qt5/PKGBUILD @@ -15,6 +15,12 @@ depends=( "${MINGW_PACKAGE_PREFIX}-qt5-base" "${MINGW_PACKAGE_PREFIX}-pyside2" "${MINGW_PACKAGE_PREFIX}-shiboken2" + # Clang is needed by shiboken2 for now because shiboken2 can't seem to find g++. It appears + # shiboken2 includes hard-coded paths to the g++ binary that is used when shiboken2 is built for msys2. + # Remove this dependency when the shiboken2 package is fixed so it works w/o clang or updates its pkg deps. + # The following change to msys2 made adding this clang dependency necessary. + # https://github.com/msys2/MINGW-packages/commit/c21027404c9d8776ad7dad94973a209bdc3aede2 + "${MINGW_PACKAGE_PREFIX}-clang" "${MINGW_PACKAGE_PREFIX}-python-qtpy" # openfx-misc deps "${MINGW_PACKAGE_PREFIX}-osmesa" @@ -35,7 +41,7 @@ depends=( # installer "zip" "unzip" - "${MINGW_PACKAGE_PREFIX}-firebird2-git" + "${MINGW_PACKAGE_PREFIX}-firebird" "${MINGW_PACKAGE_PREFIX}-breakpad-git" "${MINGW_PACKAGE_PREFIX}-python-sphinx" "${MINGW_PACKAGE_PREFIX}-python-sphinx_rtd_theme" diff --git a/tools/MINGW-packages/mingw-w64-openexr/0006-cmake-soversion.patch b/tools/MINGW-packages/mingw-w64-openexr/0006-cmake-soversion.patch index 23e600e306..34bc71db3d 100644 --- a/tools/MINGW-packages/mingw-w64-openexr/0006-cmake-soversion.patch +++ b/tools/MINGW-packages/mingw-w64-openexr/0006-cmake-soversion.patch @@ -17,8 +17,8 @@ Description: OpenEXR image library Version: @OPENEXR_VERSION@ --Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR${libsuffix} -lOpenEXRUtil${libsuffix} -lOpenEXRCore${libsuffix} -lIex${libsuffix} -lIlmThread${libsuffix} -+Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR -lOpenEXRUtil -lOpenEXRCore -lIex -lIlmThread +-Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR${libsuffix} -lOpenEXRUtil${libsuffix} -lOpenEXRCore${libsuffix} -lIex${libsuffix} -lIlmThread${libsuffix} @EXR_DEFLATE_LDFLAGS@ ++Libs: @exr_pthread_libs@ -L${libdir} -lOpenEXR -lOpenEXRUtil -lOpenEXRCore -lIex -lIlmThread @EXR_DEFLATE_LDFLAGS@ Cflags: -I${includedir} -I${OpenEXR_includedir} @exr_pthread_cflags@ Requires: Imath Libs.private: @zlib_link@ diff --git a/tools/MINGW-packages/mingw-w64-openexr/0007-export-TypedAttribute-value.patch b/tools/MINGW-packages/mingw-w64-openexr/0007-export-TypedAttribute-value.patch new file mode 100644 index 0000000000..f5367144fd --- /dev/null +++ b/tools/MINGW-packages/mingw-w64-openexr/0007-export-TypedAttribute-value.patch @@ -0,0 +1,19 @@ +--- a/src/lib/OpenEXR/ImfAttribute.h ++++ b/src/lib/OpenEXR/ImfAttribute.h +@@ -215,14 +215,14 @@ + } + + template +-inline T& ++T& + TypedAttribute::value () + { + return _value; + } + + template +-inline const T& ++const T& + TypedAttribute::value () const + { + return _value; diff --git a/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD b/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD index e06f3be48a..dfc2776271 100644 --- a/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD @@ -3,16 +3,16 @@ _realname=openexr pkgbase=mingw-w64-natron_${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-natron_${_realname}") -pkgver=3.1.8 +pkgver=3.2.1 pkgrel=99.1 pkgdesc='A high dynamic-range image file format library (mingw-w64)' arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64') url="https://www.openexr.com/" -license=('BSD') +license=('spdx:BSD-3-Clause') depends=("${MINGW_PACKAGE_PREFIX}-natron_imath" - "${MINGW_PACKAGE_PREFIX}-libwinpthread-git" - "${MINGW_PACKAGE_PREFIX}-zlib") + "${MINGW_PACKAGE_PREFIX}-libdeflate" + "${MINGW_PACKAGE_PREFIX}-libwinpthread-git") makedepends=("${MINGW_PACKAGE_PREFIX}-cc" "${MINGW_PACKAGE_PREFIX}-cmake" "${MINGW_PACKAGE_PREFIX}-ninja") @@ -26,9 +26,11 @@ replaces=( "${MINGW_PACKAGE_PREFIX}-pyilmbase" ) source=("https://github.com/openexr/openexr/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz" - 0006-cmake-soversion.patch) -sha256sums=('3ff47111ef7e5da6f69330e66e1e90ae620b79df1cedf2512bb9bffe86c2c617' - 'e65852ac2e5545472ad90830c97e964aa2c71e1795979a8b9867155d578d45ed') + 0006-cmake-soversion.patch + 0007-export-TypedAttribute-value.patch) +sha256sums=('61e175aa2203399fb3c8c2288752fbea3c2637680d50b6e306ea5f8ffdd46a9b' + 'a5ce463815e8d05c879dbe6a255e9f8ac2697cd3ef4242dac1e5cb331f78ed02' + '204777b48cde1c4d390789f10c5e429d5295be701f68a7937a90d0ecf271c048') # Helper macros to help make tasks easier # apply_patch_with_msg() { @@ -43,7 +45,8 @@ prepare(){ cd "${srcdir}/${_realname}-${pkgver}" apply_patch_with_msg \ - 0006-cmake-soversion.patch + 0006-cmake-soversion.patch \ + 0007-export-TypedAttribute-value.patch } build() { @@ -70,7 +73,6 @@ build() { -DBUILD_SHARED_LIBS=ON \ -DBUILD_TESTING=OFF \ -DOPENEXR_INSTALL_EXAMPLES=OFF \ - -DOPENEXR_INSTALL_PKG_CONFIG=ON \ ../${_realname}-${pkgver} ${MINGW_PREFIX}/bin/cmake --build . diff --git a/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD b/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD index 3a7cc69c86..25373a17ce 100644 --- a/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD @@ -35,7 +35,7 @@ source=(${_realname}-${pkgver}.tar.gz::https://github.com/OpenImageIO/oiio/archi oiio-2.2.14-libraw.diff oiio-2.4.13.0-thread-shutdown.patch # Remove when updating to a future 2.5 release that has these changes. ) -sha256sums=('72b7d2d5edd1049bb7fc09becad4d8be64a9918cdf79bae98b4b32e1fda762cd' +sha256sums=('bb10a7ab6dff5dae2c6d854e9da38136546232235913237e8b1b3c99abb7dd0b' 'SKIP' 'e8aec185fd20a6e5cdf77a7155fcaedb301c07bd806f73bd30dfc75af721ac83' 'd9c2e066ce0e94404d31fd649341cc0ee03faf9b4023dfcdf5cf59fbbf466127' @@ -44,7 +44,7 @@ sha256sums=('72b7d2d5edd1049bb7fc09becad4d8be64a9918cdf79bae98b4b32e1fda762cd' ) prepare() { - cd ${srcdir}/oiio-${pkgver} + cd ${srcdir}/OpenImageIO-${pkgver} #patch -p0 -i ${srcdir}/oiio-2.1.10-boost.diff patch -p1 -i ${srcdir}/oiio-2.0.8-invalidatespec.patch patch -p0 -i ${srcdir}/oiio-2.2.14-libraw.diff @@ -92,7 +92,7 @@ build() { -DCMAKE_CXX_STANDARD=14 \ -DCMAKE_SHARED_LINKER_FLAGS=" -Wl,--export-all-symbols -Wl,--enable-auto-import " \ ${extra_config} \ - ../oiio-${pkgver} + ../OpenImageIO-${pkgver} make } diff --git a/tools/MINGW-packages/windows_pacman_repo_version.txt b/tools/MINGW-packages/windows_pacman_repo_version.txt new file mode 100644 index 0000000000..e0492b582e --- /dev/null +++ b/tools/MINGW-packages/windows_pacman_repo_version.txt @@ -0,0 +1 @@ +20240201-1 diff --git a/tools/MacPorts/devel/gnutls/Portfile b/tools/MacPorts/devel/gnutls/Portfile index 3467702d77..0f5376110e 100644 --- a/tools/MacPorts/devel/gnutls/Portfile +++ b/tools/MacPorts/devel/gnutls/Portfile @@ -36,12 +36,12 @@ subport ${name} { subport ${name}-devel { conflicts ${name} - version 3.8.1 + version 3.8.2 revision 0 - checksums rmd160 d9a09dec344ec897e7abaf408ba93e25e91ca2ad \ - sha256 ba8b9e15ae20aba88f44661978f5b5863494316fe7e722ede9d069fe6294829c \ - size 6447056 + checksums rmd160 94154bab53fef5b66365cb8ebd9caa616e3ed741 \ + sha256 e765e5016ffa9b9dd243e363a0460d577074444ee2491267db2e96c9c2adef77 \ + size 6456540 patchfiles patch-lib-system-certs.c.diff } diff --git a/tools/MacPorts/devel/gnutls/Portfile.orig b/tools/MacPorts/devel/gnutls/Portfile.orig index b9b1c28c14..c2cce9f666 100644 --- a/tools/MacPorts/devel/gnutls/Portfile.orig +++ b/tools/MacPorts/devel/gnutls/Portfile.orig @@ -36,12 +36,12 @@ subport ${name} { subport ${name}-devel { conflicts ${name} - version 3.8.1 + version 3.8.2 revision 0 - checksums rmd160 d9a09dec344ec897e7abaf408ba93e25e91ca2ad \ - sha256 ba8b9e15ae20aba88f44661978f5b5863494316fe7e722ede9d069fe6294829c \ - size 6447056 + checksums rmd160 94154bab53fef5b66365cb8ebd9caa616e3ed741 \ + sha256 e765e5016ffa9b9dd243e363a0460d577074444ee2491267db2e96c9c2adef77 \ + size 6456540 patchfiles patch-lib-system-certs.c.diff } diff --git a/tools/MacPorts/graphics/ImageMagick/Portfile b/tools/MacPorts/graphics/ImageMagick/Portfile index 4fcfe2d9cc..3ba8f860a4 100644 --- a/tools/MacPorts/graphics/ImageMagick/Portfile +++ b/tools/MacPorts/graphics/ImageMagick/Portfile @@ -13,7 +13,7 @@ name ImageMagick # 6.9.11-61 changes the major version of libMagickCore which will # require increasing the revision of all ports that link with it. version 6.9.11-60 -revision 10 +revision 11 checksums rmd160 1c293ba06fd43833be35efb4476e559bf137ccef \ sha256 ba0fa683b0721d1f22b0ccb364e4092e9a7a34ffd3bd6348c82b50fd93b1d7ba \ size 9167220 diff --git a/tools/MacPorts/graphics/ImageMagick/Portfile.orig b/tools/MacPorts/graphics/ImageMagick/Portfile.orig index 2659c68888..2ec061881d 100644 --- a/tools/MacPorts/graphics/ImageMagick/Portfile.orig +++ b/tools/MacPorts/graphics/ImageMagick/Portfile.orig @@ -12,7 +12,7 @@ name ImageMagick # 6.9.11-61 changes the major version of libMagickCore which will # require increasing the revision of all ports that link with it. version 6.9.11-60 -revision 10 +revision 11 checksums rmd160 1c293ba06fd43833be35efb4476e559bf137ccef \ sha256 ba0fa683b0721d1f22b0ccb364e4092e9a7a34ffd3bd6348c82b50fd93b1d7ba \ size 9167220 diff --git a/tools/MacPorts/graphics/libraw/Portfile.orig b/tools/MacPorts/graphics/libraw/Portfile.orig index c7939c92fc..8f08294ede 100644 --- a/tools/MacPorts/graphics/libraw/Portfile.orig +++ b/tools/MacPorts/graphics/libraw/Portfile.orig @@ -3,12 +3,12 @@ PortSystem 1.0 name libraw -version 0.21.1 +version 0.21.2 revision 0 -checksums rmd160 be36d8709eb2e8578f07b63ea8632eb6ed1d7775 \ - sha256 630a6bcf5e65d1b1b40cdb8608bdb922316759bfb981c65091fec8682d1543cd \ - size 1638461 +checksums rmd160 7fe2461241ec66e0b63fdeffdc76d2033ade2b48 \ + sha256 fe7288013206854baf6e4417d0fb63ba4ed7227bf36fff021992671c2dd34b03 \ + size 1639305 description Library for RAW image manipulation long_description A library for reading RAW files obtained from digital photo \ @@ -29,6 +29,7 @@ depends_lib port:jasper \ port:lcms2 use_autoreconf yes +autoreconf.args -fvi # libraw_datastream.h:125:8: error: no template named 'unique_ptr' in namespace 'std' compiler.cxx_standard 2011 diff --git a/tools/MacPorts/graphics/libraw/Portfile.patch b/tools/MacPorts/graphics/libraw/Portfile.patch index a803fecbc7..951f971289 100644 --- a/tools/MacPorts/graphics/libraw/Portfile.patch +++ b/tools/MacPorts/graphics/libraw/Portfile.patch @@ -1,18 +1,18 @@ ---- Portfile.orig 2023-01-28 18:14:47.000000000 -0800 -+++ Portfile 2023-01-28 18:14:55.000000000 -0800 -@@ -3,47 +3,67 @@ +--- Portfile.orig 2024-01-03 03:22:07 ++++ Portfile 2023-07-04 02:43:05 +@@ -3,50 +3,69 @@ PortSystem 1.0 name libraw --version 0.21.1 +-version 0.21.2 -revision 0 -- --checksums rmd160 be36d8709eb2e8578f07b63ea8632eb6ed1d7775 \ -- sha256 630a6bcf5e65d1b1b40cdb8608bdb922316759bfb981c65091fec8682d1543cd \ -- size 1638461 +version 0.18.13 +set demosaicversion 0.18.8 +-checksums rmd160 7fe2461241ec66e0b63fdeffdc76d2033ade2b48 \ +- sha256 fe7288013206854baf6e4417d0fb63ba4ed7227bf36fff021992671c2dd34b03 \ +- size 1639305 +- description Library for RAW image manipulation long_description A library for reading RAW files obtained from digital photo \ cameras (CRW/CR2, NEF, RAF, DNG, and others). @@ -50,6 +50,7 @@ port:lcms2 -use_autoreconf yes +-autoreconf.args -fvi - -# libraw_datastream.h:125:8: error: no template named 'unique_ptr' in namespace 'std' -compiler.cxx_standard 2011 @@ -70,8 +71,8 @@ + reinplace -E {s|-lstdc|-lc|g} ${destroot}${prefix}/lib/pkgconfig/libraw.pc + reinplace -E {s|-lstdc|-lc|g} ${destroot}${prefix}/lib/pkgconfig/libraw_r.pc + } -+} -+ + } + +variant gpl2 description {Enable GPL demosaic pack, license will be GPL-2+} { + distfiles-append \ + LibRaw-demosaic-pack-GPL2-${demosaicversion}${extract.suffix} \ @@ -84,6 +85,8 @@ + LibRaw-demosaic-pack-GPL3-${demosaicversion}${extract.suffix} + + license GPL-3+ - } - ++} ++ livecheck.type regex + livecheck.url ${homepage}/download/ + livecheck.regex "LibRaw-(\\d+(?:\\.\\d+)*)${extract.suffix}" diff --git a/tools/MacPorts/graphics/opencolorio/Portfile b/tools/MacPorts/graphics/opencolorio/Portfile index d39a5c3622..83517e9326 100644 --- a/tools/MacPorts/graphics/opencolorio/Portfile +++ b/tools/MacPorts/graphics/opencolorio/Portfile @@ -87,7 +87,7 @@ if {${configure.build_arch} in [list ppc ppc64]} { # OpenColorIO intentially installs Python module in lib # see https://github.com/imageworks/OpenColorIO/blob/15e96c1f579d3640947a5fcb5ec831383cc3956e/src/pyglue/CMakeLists.txt#L85 -variant python27 description {Build the Python 2.7 bindings} conflicts python36 python37 python38 python39 python310 python311 { +variant python27 description {Build the Python 2.7 bindings} conflicts python38 python39 python310 python311 { depends_lib-append port:python27 port:py27-pybind11 configure.args-append \ -DOCIO_PYTHON_VERSION=2.7 \ @@ -101,35 +101,7 @@ variant python27 description {Build the Python 2.7 bindings} conflicts python36 } } -variant python36 description {Build the Python 3.6 bindings} conflicts python27 python37 python38 python39 python310 python311 { - depends_lib-append port:python36 port:py36-pybind11 - configure.args-append \ - -DOCIO_PYTHON_VERSION=3.6 \ - -DPYTHON=${prefix}/bin/python3.6 - post-destroot { - xinstall -d -m 0755 \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.6/lib/python3.6/site-packages - ln -s \ - ${prefix}/lib/python3.6/site-packages/PyOpenColorIO.so \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.6/lib/python3.6/site-packages/ - } -} - -variant python37 description {Build the Python 3.7 bindings} conflicts python27 python36 python38 python39 python310 python311 { - depends_lib-append port:python37 port:py37-pybind11 - configure.args-append \ - -DOCIO_PYTHON_VERSION=3.7 \ - -DPYTHON=${prefix}/bin/python3.7 - post-destroot { - xinstall -d -m 0755 \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.7/lib/python3.7/site-packages - ln -s \ - ${prefix}/lib/python3.7/site-packages/PyOpenColorIO.so \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.7/lib/python3.7/site-packages/ - } -} - -variant python38 description {Build the Python 3.8 bindings} conflicts python27 python36 python37 python39 python310 python311 { +variant python38 description {Build the Python 3.8 bindings} conflicts python27 python39 python310 python311 { depends_lib-append port:python38 port:py38-pybind11 configure.args-append \ -DOCIO_PYTHON_VERSION=3.8 \ @@ -143,7 +115,7 @@ variant python38 description {Build the Python 3.8 bindings} conflicts python27 } } -variant python39 description {Build the Python 3.9 bindings} conflicts python27 python36 python37 python38 python310 python311 { +variant python39 description {Build the Python 3.9 bindings} conflicts python27 python38 python310 python311 { depends_lib-append port:python39 port:py39-pybind11 configure.args-append \ -DOCIO_PYTHON_VERSION=3.9 \ @@ -157,7 +129,7 @@ variant python39 description {Build the Python 3.9 bindings} conflicts python27 } } -variant python310 description {Build the Python 3.10 bindings} conflicts python27 python36 python37 python38 python39 python311 { +variant python310 description {Build the Python 3.10 bindings} conflicts python27 python38 python39 python311 { depends_lib-append port:python310 port:py310-pybind11 configure.args-append \ -DOCIO_PYTHON_VERSION=3.10 \ @@ -172,7 +144,7 @@ variant python310 description {Build the Python 3.10 bindings} conflicts python2 } -variant python311 description {Build the Python 3.11 bindings} conflicts python27 python36 python37 python38 python39 python310 { +variant python311 description {Build the Python 3.11 bindings} conflicts python27 python38 python39 python310 { depends_lib-append port:python311 port:py311-pybind11 configure.args-append \ -DOCIO_PYTHON_VERSION=3.11 \ @@ -186,11 +158,11 @@ variant python311 description {Build the Python 3.11 bindings} conflicts python2 } } -if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { +if {![variant_isset python27] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { default_variants +python311 } -if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { +if {![variant_isset python27] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { configure.args-append \ -DOCIO_BUILD_PYTHON=OFF \ -DOCIO_BUILD_PYGLUE=OFF diff --git a/tools/MacPorts/graphics/opencolorio/Portfile.orig b/tools/MacPorts/graphics/opencolorio/Portfile.orig index da0f81d923..4aef71ac06 100644 --- a/tools/MacPorts/graphics/opencolorio/Portfile.orig +++ b/tools/MacPorts/graphics/opencolorio/Portfile.orig @@ -106,7 +106,7 @@ if {${configure.build_arch} in [list ppc ppc64]} { # OpenColorIO intentially installs Python module in lib # see https://github.com/imageworks/OpenColorIO/blob/15e96c1f579d3640947a5fcb5ec831383cc3956e/src/pyglue/CMakeLists.txt#L85 -variant python27 description {Build the Python 2.7 bindings} conflicts python36 python37 python38 python39 python310 python311 { +variant python27 description {Build the Python 2.7 bindings} conflicts python38 python39 python310 python311 { depends_lib-append port:python27 configure.args-append \ -DPYTHON=${prefix}/bin/python2.7 @@ -119,33 +119,7 @@ variant python27 description {Build the Python 2.7 bindings} conflicts python36 } } -variant python36 description {Build the Python 3.6 bindings} conflicts python27 python37 python38 python39 python310 python311 { - depends_lib-append port:python36 - configure.args-append \ - -DPYTHON=${prefix}/bin/python3.6 - post-destroot { - xinstall -d -m 0755 \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.6/lib/python3.6/site-packages - ln -s \ - ${prefix}/lib/python3.6/site-packages/PyOpenColorIO.so \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.6/lib/python3.6/site-packages/ - } -} - -variant python37 description {Build the Python 3.7 bindings} conflicts python27 python36 python38 python39 python310 python311 { - depends_lib-append port:python37 - configure.args-append \ - -DPYTHON=${prefix}/bin/python3.7 - post-destroot { - xinstall -d -m 0755 \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.7/lib/python3.7/site-packages - ln -s \ - ${prefix}/lib/python3.7/site-packages/PyOpenColorIO.so \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.7/lib/python3.7/site-packages/ - } -} - -variant python38 description {Build the Python 3.8 bindings} conflicts python27 python36 python37 python39 python310 python311 { +variant python38 description {Build the Python 3.8 bindings} conflicts python27 python39 python310 python311 { depends_lib-append port:python38 configure.args-append \ -DPYTHON=${prefix}/bin/python3.8 @@ -158,7 +132,7 @@ variant python38 description {Build the Python 3.8 bindings} conflicts python27 } } -variant python39 description {Build the Python 3.9 bindings} conflicts python27 python36 python37 python38 python310 python311 { +variant python39 description {Build the Python 3.9 bindings} conflicts python27 python38 python310 python311 { depends_lib-append port:python39 configure.args-append \ -DPYTHON=${prefix}/bin/python3.9 @@ -171,7 +145,7 @@ variant python39 description {Build the Python 3.9 bindings} conflicts python27 } } -variant python310 description {Build the Python 3.10 bindings} conflicts python27 python36 python37 python38 python39 python311 { +variant python310 description {Build the Python 3.10 bindings} conflicts python27 python38 python39 python311 { depends_lib-append port:python310 configure.args-append \ -DPYTHON=${prefix}/bin/python3.10 @@ -185,7 +159,7 @@ variant python310 description {Build the Python 3.10 bindings} conflicts python2 } -variant python311 description {Build the Python 3.11 bindings} conflicts python27 python36 python37 python38 python39 python310 { +variant python311 description {Build the Python 3.11 bindings} conflicts python27 python38 python39 python310 { depends_lib-append port:python311 configure.args-append \ -DPYTHON=${prefix}/bin/python3.11 @@ -198,11 +172,11 @@ variant python311 description {Build the Python 3.11 bindings} conflicts python2 } } -if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { +if {![variant_isset python27] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { default_variants +python311 } -if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { +if {![variant_isset python27] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { configure.args-append \ -DOCIO_BUILD_PYGLUE=OFF } diff --git a/tools/MacPorts/graphics/opencolorio/Portfile.patch b/tools/MacPorts/graphics/opencolorio/Portfile.patch index 7222366f9b..1e0bb59921 100644 --- a/tools/MacPorts/graphics/opencolorio/Portfile.patch +++ b/tools/MacPorts/graphics/opencolorio/Portfile.patch @@ -1,5 +1,5 @@ ---- Portfile.orig 2023-08-29 21:57:17 -+++ Portfile 2023-08-29 21:58:24 +--- Portfile.orig 2023-11-28 15:59:17.000000000 +0100 ++++ Portfile 2023-11-28 16:02:49.000000000 +0100 @@ -7,7 +7,7 @@ boost.depends_type build @@ -22,7 +22,7 @@ # Exclude pre-releases from livecheck github.livecheck.regex {([0-9.]+)} -@@ -31,31 +31,9 @@ +@@ -31,30 +31,8 @@ configure.args-append \ -DCMAKE_CONFIGURATION_TYPES=MacPorts @@ -31,9 +31,7 @@ -if {${os.platform} eq "darwin" && ${os.major} < 20} { - github.setup AcademySoftwareFoundation OpenColorIO 1.1.1 v - revision 3 -+patchfiles-append \ -+ patch-OCIOZArchive.diff - +- - checksums rmd160 81534822cb8350e1b7ba171c91226de996494d02 \ - sha256 b7def3b5383c9b35dc9c0bdd26da74e2199c2b283d52bb84847aa307f70a0bc4 \ - size 13830493 @@ -52,10 +50,11 @@ - - livecheck.type none -} -- ++patchfiles-append \ ++ patch-OCIOZArchive.diff + # source assumes C++11 compiler compiler.cxx_standard 2011 - configure.cxxflags-append \ @@ -93,6 +71,9 @@ port:tinyxml @@ -69,7 +68,7 @@ @@ -107,8 +88,9 @@ # see https://github.com/imageworks/OpenColorIO/blob/15e96c1f579d3640947a5fcb5ec831383cc3956e/src/pyglue/CMakeLists.txt#L85 - variant python27 description {Build the Python 2.7 bindings} conflicts python36 python37 python38 python39 python310 python311 { + variant python27 description {Build the Python 2.7 bindings} conflicts python38 python39 python310 python311 { - depends_lib-append port:python27 + depends_lib-append port:python27 port:py27-pybind11 configure.args-append \ @@ -80,29 +79,7 @@ @@ -120,8 +102,9 @@ } - variant python36 description {Build the Python 3.6 bindings} conflicts python27 python37 python38 python39 python310 python311 { -- depends_lib-append port:python36 -+ depends_lib-append port:python36 port:py36-pybind11 - configure.args-append \ -+ -DOCIO_PYTHON_VERSION=3.6 \ - -DPYTHON=${prefix}/bin/python3.6 - post-destroot { - xinstall -d -m 0755 \ -@@ -133,8 +116,9 @@ - } - - variant python37 description {Build the Python 3.7 bindings} conflicts python27 python36 python38 python39 python310 python311 { -- depends_lib-append port:python37 -+ depends_lib-append port:python37 port:py37-pybind11 - configure.args-append \ -+ -DOCIO_PYTHON_VERSION=3.7 \ - -DPYTHON=${prefix}/bin/python3.7 - post-destroot { - xinstall -d -m 0755 \ -@@ -146,8 +130,9 @@ - } - - variant python38 description {Build the Python 3.8 bindings} conflicts python27 python36 python37 python39 python310 python311 { + variant python38 description {Build the Python 3.8 bindings} conflicts python27 python39 python310 python311 { - depends_lib-append port:python38 + depends_lib-append port:python38 port:py38-pybind11 configure.args-append \ @@ -110,10 +87,10 @@ -DPYTHON=${prefix}/bin/python3.8 post-destroot { xinstall -d -m 0755 \ -@@ -159,8 +144,9 @@ +@@ -133,8 +116,9 @@ } - variant python39 description {Build the Python 3.9 bindings} conflicts python27 python36 python37 python38 python310 python311 { + variant python39 description {Build the Python 3.9 bindings} conflicts python27 python38 python310 python311 { - depends_lib-append port:python39 + depends_lib-append port:python39 port:py39-pybind11 configure.args-append \ @@ -121,10 +98,10 @@ -DPYTHON=${prefix}/bin/python3.9 post-destroot { xinstall -d -m 0755 \ -@@ -172,8 +158,9 @@ +@@ -146,8 +130,9 @@ } - variant python310 description {Build the Python 3.10 bindings} conflicts python27 python36 python37 python38 python39 python311 { + variant python310 description {Build the Python 3.10 bindings} conflicts python27 python38 python39 python311 { - depends_lib-append port:python310 + depends_lib-append port:python310 port:py310-pybind11 configure.args-append \ @@ -132,10 +109,10 @@ -DPYTHON=${prefix}/bin/python3.10 post-destroot { xinstall -d -m 0755 \ -@@ -186,8 +173,9 @@ +@@ -160,8 +145,9 @@ - variant python311 description {Build the Python 3.11 bindings} conflicts python27 python36 python37 python38 python39 python310 { + variant python311 description {Build the Python 3.11 bindings} conflicts python27 python38 python39 python310 { - depends_lib-append port:python311 + depends_lib-append port:python311 port:py311-pybind11 configure.args-append \ @@ -143,9 +120,9 @@ -DPYTHON=${prefix}/bin/python3.11 post-destroot { xinstall -d -m 0755 \ -@@ -204,6 +192,7 @@ +@@ -178,6 +164,7 @@ - if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { + if {![variant_isset python27] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { configure.args-append \ + -DOCIO_BUILD_PYTHON=OFF \ -DOCIO_BUILD_PYGLUE=OFF diff --git a/tools/MacPorts/graphics/openimageio/Portfile b/tools/MacPorts/graphics/openimageio/Portfile index c999f44d4d..33ef5a800c 100644 --- a/tools/MacPorts/graphics/openimageio/Portfile +++ b/tools/MacPorts/graphics/openimageio/Portfile @@ -16,11 +16,11 @@ long_description OpenImageIO is a library for reading and writing images, related classes, utilities, and applications. platforms darwin -github.setup OpenImageIO oiio 2.4.14.0 v +github.setup OpenImageIO oiio 2.4.17.0 v revision 100 -checksums rmd160 f0c51d041627f1867b3de2b322edaef21ba8ca0e \ - sha256 92ad4b107394b273397baa1abe90207e1f8ef9fd52ffbfc23b46e3b0005d4439 \ - size 47890322 +checksums rmd160 e593d35b8a4d62c0277622267c43911836eebd61 \ + sha256 7fe81d8e5bce30cc4a212f020ac3cc4344e6b7c1c0842475e3a048515099c65c \ + size 47900800 github.tarball_from archive diff --git a/tools/MacPorts/graphics/openimageio/Portfile.orig b/tools/MacPorts/graphics/openimageio/Portfile.orig index a1266c038f..5685a8b997 100644 --- a/tools/MacPorts/graphics/openimageio/Portfile.orig +++ b/tools/MacPorts/graphics/openimageio/Portfile.orig @@ -26,13 +26,13 @@ if {${os.platform} eq "darwin" && ${os.major} >= 20} { if {${port_latest}} { github.setup OpenImageIO oiio 2.4.5.0 v - revision 7 + revision 8 checksums rmd160 32b2b0f0b01268a91fc98cfca948a71e89d8e54b \ sha256 21177a9665021a99123885cd8383116d15013b6610b4b09bcf209612423fedc5 \ size 31938357 } else { github.setup OpenImageIO oiio 2.1.20.0 v - revision 12 + revision 13 checksums rmd160 d10c488b93ab2335d53545d8a1b35ba4c1babb98 \ sha256 75222543286d3a12473aa03fdb4e6c9f98760c5ad1ad89d3cf82a5da41385ae0 \ size 29115990 diff --git a/tools/MacPorts/graphics/openimageio/Portfile.patch b/tools/MacPorts/graphics/openimageio/Portfile.patch index d3699d10d2..5a03bd5628 100644 --- a/tools/MacPorts/graphics/openimageio/Portfile.patch +++ b/tools/MacPorts/graphics/openimageio/Portfile.patch @@ -1,5 +1,5 @@ ---- Portfile.orig 2023-08-10 19:07:00.000000000 +0200 -+++ Portfile 2023-08-10 19:51:16.000000000 +0200 +--- Portfile.orig 2023-09-20 19:26:42 ++++ Portfile 2024-01-03 06:38:40 @@ -2,7 +2,6 @@ PortSystem 1.0 @@ -8,7 +8,7 @@ PortGroup cmake 1.1 PortGroup active_variants 1.1 PortGroup compiler_blacklist_versions 1.0 -@@ -15,50 +14,24 @@ +@@ -15,51 +14,25 @@ description a library for reading and writing images long_description OpenImageIO is a library for reading and writing images, and a bunch of \ related classes, utilities, and applications. @@ -21,58 +21,59 @@ -} else { - set port_latest no -} -- ++github.setup OpenImageIO oiio 2.4.17.0 v ++revision 100 ++checksums rmd160 e593d35b8a4d62c0277622267c43911836eebd61 \ ++ sha256 7fe81d8e5bce30cc4a212f020ac3cc4344e6b7c1c0842475e3a048515099c65c \ ++ size 47900800 + -if {${port_latest}} { - github.setup OpenImageIO oiio 2.4.5.0 v -- revision 7 +- revision 8 - checksums rmd160 32b2b0f0b01268a91fc98cfca948a71e89d8e54b \ - sha256 21177a9665021a99123885cd8383116d15013b6610b4b09bcf209612423fedc5 \ - size 31938357 -} else { - github.setup OpenImageIO oiio 2.1.20.0 v -- revision 12 +- revision 13 - checksums rmd160 d10c488b93ab2335d53545d8a1b35ba4c1babb98 \ - sha256 75222543286d3a12473aa03fdb4e6c9f98760c5ad1ad89d3cf82a5da41385ae0 \ - size 29115990 - - livecheck.type none -} -+github.setup OpenImageIO oiio 2.4.14.0 v -+revision 100 -+checksums rmd160 f0c51d041627f1867b3de2b322edaef21ba8ca0e \ -+ sha256 92ad4b107394b273397baa1abe90207e1f8ef9fd52ffbfc23b46e3b0005d4439 \ -+ size 47890322 - +- github.tarball_from archive -if {${port_latest}} { - patchfiles-append patch-enforce-clang14.diff - patchfiles-append patch-2.4.5-cmake-disable-wall-werror.diff -- ++depends_lib-append port:imath \ ++ port:openexr + - depends_lib-append port:imath \ - port:openexr -} else { - patchfiles-append patch-FindOpenJpeg.cmake.diff - patchfiles-append patch-libraw-0.21.0.diff - patchfiles-append patch-2.1.20-cmake-disable-wall-werror.diff -- -- depends_lib-append port:field3d \ -- port:openexr2 -+depends_lib-append port:imath \ -+ port:openexr - -- configure.pkg_config_path-prepend \ -- ${prefix}/libexec/openexr2/lib/pkgconfig --} +patchfiles-append oiio-2.0.8-invalidatespec.patch +patchfiles-append oiio-2.0.8-atomic-load.patch +patchfiles-append oiio-2.3.20-strnlen.patch +patchfiles-append oiio-2.4.6-sysutil.patch +patchfiles-append oiio-2.4.6-filesystem.patch +- depends_lib-append port:field3d \ +- port:openexr2 +- +- configure.pkg_config_path-prepend \ +- ${prefix}/libexec/openexr2/lib/pkgconfig +-} +- # error: multiple overloads of 'address' instantiate to the same signature 'const_pointer (const_reference) const noexcept' # http://lists.llvm.org/pipermail/llvm-bugs/2013-November/031552.html -@@ -101,11 +74,78 @@ + # Seen on OSX 10.9 and older. +@@ -101,12 +74,79 @@ port:squish \ port:${port_libfmt} @@ -146,14 +147,15 @@ -# -DUSE_QT=OFF -qt5.min_version 5.6 +default_variants +opencolorio +openjpeg +freetype -+ + +variant natron conflicts ffmpeg qt5 dicom openvdb ptex dicom requires opencolorio openjpeg freetype description {Natron version} { + if {${configure.cxx_stdlib} eq "libstdc++"} { + } +} - ++ configure.args-append -DUSE_PYTHON=OFF + set pythons_suffixes {27 36 37 38 39 310 311} @@ -147,26 +187,46 @@ } diff --git a/tools/MacPorts/graphics/openimageio18/work b/tools/MacPorts/graphics/openimageio18/work deleted file mode 120000 index 9399d5abf3..0000000000 --- a/tools/MacPorts/graphics/openimageio18/work +++ /dev/null @@ -1 +0,0 @@ -/Volumes/opt/local-libc++/var/macports/build/_Volumes_opt_MacPorts-Natron_graphics_openimageio/openimageio/work \ No newline at end of file diff --git a/tools/MacPorts/lang/libomp/Portfile.orig b/tools/MacPorts/lang/libomp/Portfile.orig index a417389801..2fa9161927 100644 --- a/tools/MacPorts/lang/libomp/Portfile.orig +++ b/tools/MacPorts/lang/libomp/Portfile.orig @@ -30,7 +30,7 @@ subport libomp-devel {} if {${os.platform} eq "darwin" && ${configure.cxx_stdlib} ne "libstdc++"} { - version 16.0.6 + version 17.0.3 revision 0 if { ${subport} eq "libomp-devel" } { @@ -46,13 +46,13 @@ if {${os.platform} eq "darwin" && ${configure.cxx_stdlib} ne "libstdc++"} { checksums \ openmp-${version}.src.tar.xz \ - rmd160 de7bc41e8207077aee79e3ff45c782f489f8f383 \ - sha256 a2536f06373774f2829d892b72eea5f97bab20e69b26b03042d947f992eb8e38 \ - size 1278072 \ + rmd160 a79350f38202f4e9819373a433b1b19cef631eb2 \ + sha256 e04172c067f256d06cd8112abb49bc65f4e1d986a4b49b36cd837dfee3cdd274 \ + size 1273276 \ cmake-${version}.src.tar.xz \ - rmd160 94ead500d749de031894e9a14c51ed17951c8fd7 \ - sha256 39d342a4161095d2f28fb1253e4585978ac50521117da666e2b1f6f28b62f514 \ - size 9008 + rmd160 2f419efae4d3f8c9d87943cf1873031468a19bd7 \ + sha256 54fc534f0da09088adbaa6c3bfc9899a500153b96e60c2fb9322a7aa37b1027a \ + size 8712 if {${os.major} <= 12} { # kmp_alloc.c includes but libc++ is not the default on @@ -86,8 +86,14 @@ if {${os.platform} eq "darwin" && ${configure.cxx_stdlib} ne "libstdc++"} { worksrcdir openmp-${version}/final/runtime version 3.8.1 checksums rmd160 a41054068a127ef84610afef8090109078cb6c46 \ - sha256 4c46b5946fe9b2a701661746d11c7c85c51a7f18673194a7ebd2a43470948a34 + sha256 4c46b5946fe9b2a701661746d11c7c85c51a7f18673194a7ebd2a43470948a34 \ + size 5587986 set rtpath "./" + + # use cmake-bootstrap to minimize dependencies. + depends_build-replace \ + path:bin/cmake:cmake port:cmake-bootstrap + configure.cmd ${prefix}/libexec/cmake-bootstrap/bin/cmake } livecheck.type none } @@ -98,6 +104,18 @@ cmake.out_of_source yes # According to documentation builds with clang >= 3.3 compiler.blacklist-append {clang < 500} *gcc* +# https://trac.macports.org/ticket/68490# +# Use clang-11-bootstrap on OSX10.11 and older +if {${os.major} <= 15} { + configure.compiler.add_deps no + depends_build-append port:clang-11-bootstrap + depends_skip_archcheck-append clang-11-bootstrap + pre-configure { + configure.cc ${prefix}/libexec/clang-11-bootstrap/bin/clang + configure.cxx ${prefix}/libexec/clang-11-bootstrap/bin/clang++ + } +} + if {${os.major} <= 17} { default_variants +universal } diff --git a/tools/MacPorts/lang/libomp/Portfile.patch b/tools/MacPorts/lang/libomp/Portfile.patch index 83df784f52..8390d060c3 100644 --- a/tools/MacPorts/lang/libomp/Portfile.patch +++ b/tools/MacPorts/lang/libomp/Portfile.patch @@ -1,5 +1,5 @@ ---- Portfile.orig 2023-07-03 17:37:19.000000000 -0700 -+++ Portfile 2023-04-04 12:02:53.000000000 -0700 +--- Portfile.orig 2023-11-28 15:57:54.000000000 +0100 ++++ Portfile 2023-11-04 17:46:40.000000000 +0100 @@ -1,7 +1,7 @@ # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 @@ -23,7 +23,7 @@ if {${os.platform} eq "darwin" && ${configure.cxx_stdlib} ne "libstdc++"} { - -- version 16.0.6 +- version 17.0.3 - revision 0 - if { ${subport} eq "libomp-devel" } { @@ -48,18 +48,18 @@ - - checksums \ - openmp-${version}.src.tar.xz \ -- rmd160 de7bc41e8207077aee79e3ff45c782f489f8f383 \ -- sha256 a2536f06373774f2829d892b72eea5f97bab20e69b26b03042d947f992eb8e38 \ -- size 1278072 \ +- rmd160 a79350f38202f4e9819373a433b1b19cef631eb2 \ +- sha256 e04172c067f256d06cd8112abb49bc65f4e1d986a4b49b36cd837dfee3cdd274 \ +- size 1273276 \ - cmake-${version}.src.tar.xz \ -- rmd160 94ead500d749de031894e9a14c51ed17951c8fd7 \ -- sha256 39d342a4161095d2f28fb1253e4585978ac50521117da666e2b1f6f28b62f514 \ -- size 9008 +- rmd160 2f419efae4d3f8c9d87943cf1873031468a19bd7 \ +- sha256 54fc534f0da09088adbaa6c3bfc9899a500153b96e60c2fb9322a7aa37b1027a \ +- size 8712 + revision 0 if {${os.major} <= 12} { # kmp_alloc.c includes but libc++ is not the default on -@@ -62,34 +53,40 @@ +@@ -62,40 +53,40 @@ # Build requires std::atomic configure.cxxflags-append -std=c++11 @@ -106,8 +106,14 @@ - worksrcdir openmp-${version}/final/runtime - version 3.8.1 - checksums rmd160 a41054068a127ef84610afef8090109078cb6c46 \ -- sha256 4c46b5946fe9b2a701661746d11c7c85c51a7f18673194a7ebd2a43470948a34 +- sha256 4c46b5946fe9b2a701661746d11c7c85c51a7f18673194a7ebd2a43470948a34 \ +- size 5587986 - set rtpath "./" +- +- # use cmake-bootstrap to minimize dependencies. +- depends_build-replace \ +- path:bin/cmake:cmake port:cmake-bootstrap +- configure.cmd ${prefix}/libexec/cmake-bootstrap/bin/cmake + worksrcdir openmp-${version}/final/runtime + version 3.8.1 + checksums \ @@ -120,7 +126,26 @@ } depends_build-append port:perl5 -@@ -115,14 +112,8 @@ +@@ -104,18 +95,6 @@ + # According to documentation builds with clang >= 3.3 + compiler.blacklist-append {clang < 500} *gcc* + +-# https://trac.macports.org/ticket/68490# +-# Use clang-11-bootstrap on OSX10.11 and older +-if {${os.major} <= 15} { +- configure.compiler.add_deps no +- depends_build-append port:clang-11-bootstrap +- depends_skip_archcheck-append clang-11-bootstrap +- pre-configure { +- configure.cc ${prefix}/libexec/clang-11-bootstrap/bin/clang +- configure.cxx ${prefix}/libexec/clang-11-bootstrap/bin/clang++ +- } +-} +- + if {${os.major} <= 17} { + default_variants +universal + } +@@ -133,14 +112,8 @@ # With this, cmake sets the correct library name in the dylibs for the # final destination we move them to configure.args-append -DCMAKE_INSTALL_RPATH=${prefix}/lib/libomp \ @@ -137,7 +162,7 @@ variant top_level description \ "Install (links to) omp.h and libs into ${prefix}/(include|lib)" {} -@@ -131,30 +122,22 @@ +@@ -149,30 +122,22 @@ # Patch tool for build with CMAKE_INSTALL_PREFIX reinplace "/bulk.*compatibility/s/s\+/s+.*/" \ ${rtpath}tools/check-depends.pl @@ -172,7 +197,7 @@ foreach p {libiomp5.dylib libomp.dylib libgomp.dylib} { system -W ${instdest}/lib/ \ "ln -s libomp/${p}" -@@ -162,8 +145,8 @@ +@@ -180,8 +145,8 @@ } set fpath ${worksrcpath}/${rtpath} diff --git a/tools/MacPorts/multimedia/ffmpeg/Portfile b/tools/MacPorts/multimedia/ffmpeg/Portfile index 6270de8f0c..5bd1d1fe77 100644 --- a/tools/MacPorts/multimedia/ffmpeg/Portfile +++ b/tools/MacPorts/multimedia/ffmpeg/Portfile @@ -19,7 +19,7 @@ conflicts ffmpeg-devel # Please increase the revision of mpv whenever ffmpeg's version is updated. version 4.4.4 -revision 1 +revision 4 epoch 1 license LGPL-2.1+ @@ -121,6 +121,12 @@ patchfiles-append patch-issue-9439-non-b-frame-encoding.diff # Fixed via upstream commit: 031f1561cd286596cdb374da32f8aa816ce3b135 patchfiles-append patch-libavcodec-libsvtav1-ten_bit_format.diff +# Patch for building docs with texinfo >= 7 +# https://trac.macports.org/ticket/68747 +# https://trac.ffmpeg.org/ticket/10636 +# Fixed via upstream commit: f01fdedb69e4accb1d1555106d8f682ff1f1ddc7 +patchfiles-append patch-texinfo-7.diff + # enable auto configure of asm optimizations # requires Xcode 3.1 or better on Leopard minimum_xcodeversions {9 3.1} @@ -308,16 +314,21 @@ platform darwin { port:svt-av1 } - # Available on 10.6+ - if {(${os.major} >= 10) && (${configure.build_arch} ne "ppc")} { - # Only enable 'rav1e', for non-slim installation - if {![variant_isset slim]} { - configure.args-append \ - --enable-librav1e - depends_lib-append \ - port:rav1e + # rav1e available on 10.6+ + if {(${os.major} < 10) || (${configure.build_arch} eq "ppc")} { + if {[variant_isset rav1e]} { + error "Variant rav1e not supported for macOS 10.5 and earlier, or PPC" } } + + # due to the new linker (which was introduced in Xcode 15: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes), + # this port requires '-ld_classic' to build successfully with the toolchains from Xcode 15 or Command Line Tools 15. + # + # TODO: This is a temporary solution, the classic linker will be removed in a future release by Apple. + if { ( [vercmp ${xcodeversion} 15 ] >= 0 ) || ( [vercmp ${xcodecltversion} 15 ] >= 0 ) } { + configure.ldflags-append \ + -Wl,-ld_classic + } } platform powerpc { @@ -576,50 +587,44 @@ variant nonfree description {enable nonfree code, libraries and binaries will no port:libfdk-aac } -variant slim description {Trim dependencies slightly, without significantly impacting overall feature set} {} +variant rav1e description {Enable codec rav1e} { + configure.args-append \ + --enable-librav1e + depends_lib-append \ + port:rav1e +} + +if {![variant_isset rav1e]} { + notes-append "Support for rav1e now disabled by default; enable via +rav1e" +} if {[variant_isset nonfree]} { -notes " +notes-append " This build of ${name} includes nonfree code as follows: libfdk-aac The following libraries and binaries may not be redistributed: - ffmpeg - libavcodec - libavdevice - libavfilter - libavformat - libavutil + ffmpeg libavcodec libavdevice libavfilter libavformat libavutil To remove this restriction remove the variant +nonfree " } elseif {[variant_isset gpl3]} { -notes " -This build of ${name} includes GPLed code and is therefore licensed under GPL v3 or later. +notes-append " +This build of ${name} includes GPLed code and is therefore licensed under GPL v3 or later.\ The following modules are GPLed: - postproc - libsambaclient - libvidstab - libx264 - libx265 - libxvid -To include all nonfree, GPLed and LGPL code use variant +nonfree. + libsambaclient libvidstab libx264 libx265 libxvid postproc +To include all nonfree, GPLed and LGPL code use variant +nonfree.\ To remove nonfree and GPLed code leaving only LGPL code remove the +gpl2 and +gpl3 variants. " } elseif {[variant_isset gpl2]} { -notes " -This build of ${name} includes GPLed code and is therefore licensed under GPL v2 or later. +notes-append " +This build of ${name} includes GPLed code and is therefore licensed under GPL v2 or later.\ The following modules are GPLed: - postproc - libvidstab - libx264 - libx265 - libxvid -To include all nonfree, GPLed and LGPL code use variant +nonfree. + libvidstab libx264 libx265 libxvid postproc +To include all nonfree, GPLed and LGPL code use variant +nonfree.\ To remove nonfree and GPLed code leaving only LGPL code remove the +gpl2 variant. " } else { -notes " -This build of ${name} includes no GPLed or nonfree code\ -and is therefore licensed under LGPL v2.1 or later. +notes-append " +This build of ${name} includes no GPLed or nonfree code and is therefore licensed under LGPL v2.1 or later. " } diff --git a/tools/MacPorts/multimedia/ffmpeg/Portfile.orig b/tools/MacPorts/multimedia/ffmpeg/Portfile.orig index d2fbb4aaee..5b975558f2 100644 --- a/tools/MacPorts/multimedia/ffmpeg/Portfile.orig +++ b/tools/MacPorts/multimedia/ffmpeg/Portfile.orig @@ -19,7 +19,7 @@ conflicts ffmpeg-devel # Please increase the revision of mpv whenever ffmpeg's version is updated. version 4.4.4 -revision 1 +revision 4 epoch 1 license LGPL-2.1+ @@ -119,6 +119,12 @@ patchfiles-append patch-issue-9439-non-b-frame-encoding.diff # Fixed via upstream commit: 031f1561cd286596cdb374da32f8aa816ce3b135 patchfiles-append patch-libavcodec-libsvtav1-ten_bit_format.diff +# Patch for building docs with texinfo >= 7 +# https://trac.macports.org/ticket/68747 +# https://trac.ffmpeg.org/ticket/10636 +# Fixed via upstream commit: f01fdedb69e4accb1d1555106d8f682ff1f1ddc7 +patchfiles-append patch-texinfo-7.diff + # enable auto configure of asm optimizations # requires Xcode 3.1 or better on Leopard minimum_xcodeversions {9 3.1} @@ -296,16 +302,21 @@ platform darwin { port:svt-av1 } - # Available on 10.6+ - if {(${os.major} >= 10) && (${configure.build_arch} ne "ppc")} { - # Only enable 'rav1e', for non-slim installation - if {![variant_isset slim]} { - configure.args-append \ - --enable-librav1e - depends_lib-append \ - port:rav1e + # rav1e available on 10.6+ + if {(${os.major} < 10) || (${configure.build_arch} eq "ppc")} { + if {[variant_isset rav1e]} { + error "Variant rav1e not supported for macOS 10.5 and earlier, or PPC" } } + + # due to the new linker (which was introduced in Xcode 15: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes), + # this port requires '-ld_classic' to build successfully with the toolchains from Xcode 15 or Command Line Tools 15. + # + # TODO: This is a temporary solution, the classic linker will be removed in a future release by Apple. + if { ( [vercmp ${xcodeversion} 15 ] >= 0 ) || ( [vercmp ${xcodecltversion} 15 ] >= 0 ) } { + configure.ldflags-append \ + -Wl,-ld_classic + } } platform powerpc { @@ -476,50 +487,44 @@ variant nonfree description {enable nonfree code, libraries and binaries will no port:libfdk-aac } -variant slim description {Trim dependencies slightly, without significantly impacting overall feature set} {} +variant rav1e description {Enable codec rav1e} { + configure.args-append \ + --enable-librav1e + depends_lib-append \ + port:rav1e +} + +if {![variant_isset rav1e]} { + notes-append "Support for rav1e now disabled by default; enable via +rav1e" +} if {[variant_isset nonfree]} { -notes " +notes-append " This build of ${name} includes nonfree code as follows: libfdk-aac The following libraries and binaries may not be redistributed: - ffmpeg - libavcodec - libavdevice - libavfilter - libavformat - libavutil + ffmpeg libavcodec libavdevice libavfilter libavformat libavutil To remove this restriction remove the variant +nonfree " } elseif {[variant_isset gpl3]} { -notes " -This build of ${name} includes GPLed code and is therefore licensed under GPL v3 or later. +notes-append " +This build of ${name} includes GPLed code and is therefore licensed under GPL v3 or later.\ The following modules are GPLed: - postproc - libsambaclient - libvidstab - libx264 - libx265 - libxvid -To include all nonfree, GPLed and LGPL code use variant +nonfree. + libsambaclient libvidstab libx264 libx265 libxvid postproc +To include all nonfree, GPLed and LGPL code use variant +nonfree.\ To remove nonfree and GPLed code leaving only LGPL code remove the +gpl2 and +gpl3 variants. " } elseif {[variant_isset gpl2]} { -notes " -This build of ${name} includes GPLed code and is therefore licensed under GPL v2 or later. +notes-append " +This build of ${name} includes GPLed code and is therefore licensed under GPL v2 or later.\ The following modules are GPLed: - postproc - libvidstab - libx264 - libx265 - libxvid -To include all nonfree, GPLed and LGPL code use variant +nonfree. + libvidstab libx264 libx265 libxvid postproc +To include all nonfree, GPLed and LGPL code use variant +nonfree.\ To remove nonfree and GPLed code leaving only LGPL code remove the +gpl2 variant. " } else { -notes " -This build of ${name} includes no GPLed or nonfree code\ -and is therefore licensed under LGPL v2.1 or later. +notes-append " +This build of ${name} includes no GPLed or nonfree code and is therefore licensed under LGPL v2.1 or later. " } diff --git a/tools/MacPorts/multimedia/ffmpeg/files/patch-texinfo-7.diff b/tools/MacPorts/multimedia/ffmpeg/files/patch-texinfo-7.diff new file mode 100644 index 0000000000..8b8652ca2d --- /dev/null +++ b/tools/MacPorts/multimedia/ffmpeg/files/patch-texinfo-7.diff @@ -0,0 +1,207 @@ +Backported from the below upstream commit. + +From f01fdedb69e4accb1d1555106d8f682ff1f1ddc7 Mon Sep 17 00:00:00 2001 +From: Frank Plowman +Date: Wed, 8 Nov 2023 07:55:18 +0000 +Subject: [PATCH 1/1] doc/html: support texinfo 7.0 + +Resolves trac ticket #10636 (http://trac.ffmpeg.org/ticket/10636). + +Texinfo 7.0, released in November 2022, changed the names of various +functions. Compiling docs with Texinfo 7.0 resulted in warnings and +improperly formatted documentation. More old names appear to have +been removed in Texinfo 7.1, released October 2023, which causes docs +compilation to fail. + +This commit addresses the issue by adding logic to switch between the old +and new function names depending on the Texinfo version. Texinfo 6.8 +produces identical documentation before and after the patch. + +CC +https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1938238.html +https://bugs.gentoo.org/916104 + +Signed-off-by: Frank Plowman +--- + doc/t2h.pm | 106 ++++++++++++++++++++++++++++++++++++++++++----------- + 1 file changed, 85 insertions(+), 21 deletions(-) + +diff --git a/doc/t2h.pm b/doc/t2h.pm +index d07d974286..b7485e1f1e 100644 +--- doc/t2h.pm 2023-04-12 14:01:50 ++++ doc/t2h.pm 2023-11-21 13:32:35 +@@ -20,8 +20,45 @@ + # License along with FFmpeg; if not, write to the Free Software + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + ++# Texinfo 7.0 changed the syntax of various functions. ++# Provide a shim for older versions. ++sub ff_set_from_init_file($$) { ++ my $key = shift; ++ my $value = shift; ++ if (exists &{'texinfo_set_from_init_file'}) { ++ texinfo_set_from_init_file($key, $value); ++ } else { ++ set_from_init_file($key, $value); ++ } ++} ++ ++sub ff_get_conf($) { ++ my $key = shift; ++ if (exists &{'texinfo_get_conf'}) { ++ texinfo_get_conf($key); ++ } else { ++ get_conf($key); ++ } ++} ++ ++sub get_formatting_function($$) { ++ my $obj = shift; ++ my $func = shift; ++ ++ my $sub = $obj->can('formatting_function'); ++ if ($sub) { ++ return $obj->formatting_function($func); ++ } else { ++ return $obj->{$func}; ++ } ++} ++ ++# determine texinfo version ++my $program_version_num = version->declare(ff_get_conf('PACKAGE_VERSION'))->numify; ++my $program_version_6_8 = $program_version_num >= 6.008000; ++ + # no navigation elements +-set_from_init_file('HEADERS', 0); ++ff_set_from_init_file('HEADERS', 0); + + sub ffmpeg_heading_command($$$$$) + { +@@ -55,7 +92,7 @@ sub ffmpeg_heading_command($$$$$) + $element = $command->{'parent'}; + } + if ($element) { +- $result .= &{$self->{'format_element_header'}}($self, $cmdname, ++ $result .= &{get_formatting_function($self, 'format_element_header')}($self, $cmdname, + $command, $element); + } + +@@ -112,7 +149,11 @@ sub ffmpeg_heading_command($$$$$) + $cmdname + = $Texinfo::Common::level_to_structuring_command{$cmdname}->[$heading_level]; + } +- $result .= &{$self->{'format_heading_text'}}( ++ # format_heading_text expects an array of headings for texinfo >= 7.0 ++ if ($program_version_num >= 7.000000) { ++ $heading = [$heading]; ++ } ++ $result .= &{get_formatting_function($self,'format_heading_text')}( + $self, $cmdname, $heading, + $heading_level + + $self->get_conf('CHAPTER_HEADER_LEVEL') - 1, $command); +@@ -127,14 +168,14 @@ foreach my $command (keys(%Texinfo::Common::sectioning + } + + # print the TOC where @contents is used +-set_from_init_file('INLINE_CONTENTS', 1); ++ff_set_from_init_file('INLINE_CONTENTS', 1); + + # make chapters

+-set_from_init_file('CHAPTER_HEADER_LEVEL', 2); ++ff_set_from_init_file('CHAPTER_HEADER_LEVEL', 2); + + # Do not add
+-set_from_init_file('DEFAULT_RULE', ''); +-set_from_init_file('BIG_RULE', ''); ++ff_set_from_init_file('DEFAULT_RULE', ''); ++ff_set_from_init_file('BIG_RULE', ''); + + # Customized file beginning + sub ffmpeg_begin_file($$$) +@@ -151,7 +192,18 @@ sub ffmpeg_begin_file($$$) + my ($title, $description, $encoding, $date, $css_lines, + $doctype, $bodytext, $copying_comment, $after_body_open, + $extra_head, $program_and_version, $program_homepage, +- $program, $generator) = $self->_file_header_informations($command); ++ $program, $generator); ++ if ($program_version_num >= 7.000000) { ++ ($title, $description, $encoding, $date, $css_lines, ++ $doctype, $bodytext, $copying_comment, $after_body_open, ++ $extra_head, $program_and_version, $program_homepage, ++ $program, $generator) = $self->_file_header_information($command); ++ } else { ++ ($title, $description, $encoding, $date, $css_lines, ++ $doctype, $bodytext, $copying_comment, $after_body_open, ++ $extra_head, $program_and_version, $program_homepage, ++ $program, $generator) = $self->_file_header_informations($command); ++ } + + my $links = $self->_get_links ($filename, $element); + +@@ -207,7 +259,7 @@ sub ffmpeg_end_file($) + sub ffmpeg_end_file($) + { + my $self = shift; +- my $program_string = &{$self->{'format_program_string'}}($self); ++ my $program_string = &{get_formatting_function($self,'format_program_string')}($self); + my $program_text = < + $program_string +@@ -224,7 +276,7 @@ texinfo_register_formatting_function('end_file', \&ffm + + # Dummy title command + # Ignore title. Title is handled through ffmpeg_begin_file(). +-set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1); ++ff_set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1); + sub ffmpeg_title($$$$) + { + return ''; +@@ -242,8 +294,14 @@ sub ffmpeg_float($$$$$) + my $args = shift; + my $content = shift; + +- my ($caption, $prepended) = Texinfo::Common::float_name_caption($self, +- $command); ++ my ($caption, $prepended); ++ if ($program_version_num >= 7.000000) { ++ ($caption, $prepended) = Texinfo::Convert::Converter::float_name_caption($self, ++ $command); ++ } else { ++ ($caption, $prepended) = Texinfo::Common::float_name_caption($self, ++ $command); ++ } + my $caption_text = ''; + my $prepended_text; + my $prepended_save = ''; +@@ -315,8 +373,13 @@ sub ffmpeg_float($$$$$) + $caption->{'args'}->[0], 'float caption'); + } + if ($prepended_text.$caption_text ne '') { +- $prepended_text = $self->_attribute_class('div','float-caption'). '>' +- . $prepended_text; ++ if ($program_version_num >= 7.000000) { ++ $prepended_text = $self->html_attribute_class('div',['float-caption']). '>' ++ . $prepended_text; ++ } else { ++ $prepended_text = $self->_attribute_class('div','float-caption'). '>' ++ . $prepended_text; ++ } + $caption_text .= ''; + } + my $html_class = ''; +@@ -329,8 +392,13 @@ sub ffmpeg_float($$$$$) + $prepended_text = ''; + $caption_text = ''; + } +- return $self->_attribute_class('div', $html_class). '>' . "\n" . +- $prepended_text . $caption_text . $content . ''; ++ if ($program_version_num >= 7.000000) { ++ return $self->html_attribute_class('div', [$html_class]). '>' . "\n" . ++ $prepended_text . $caption_text . $content . ''; ++ } else { ++ return $self->_attribute_class('div', $html_class). '>' . "\n" . ++ $prepended_text . $caption_text . $content . ''; ++ } + } + + texinfo_register_command_formatting('float', diff --git a/tools/MacPorts/multimedia/libvpx/Portfile b/tools/MacPorts/multimedia/libvpx/Portfile index 1b6f8da30a..6538d5abad 100644 --- a/tools/MacPorts/multimedia/libvpx/Portfile +++ b/tools/MacPorts/multimedia/libvpx/Portfile @@ -7,8 +7,8 @@ PortGroup muniversal 1.0 name libvpx conflicts libvpx-devel set my_name libvpx -version 1.13.0 -revision 1 +version 1.13.1 +revision 0 categories multimedia license Permissive diff --git a/tools/MacPorts/multimedia/libvpx/Portfile.orig b/tools/MacPorts/multimedia/libvpx/Portfile.orig index 089f19b3cd..ecbf5bac35 100644 --- a/tools/MacPorts/multimedia/libvpx/Portfile.orig +++ b/tools/MacPorts/multimedia/libvpx/Portfile.orig @@ -7,8 +7,8 @@ PortGroup muniversal 1.0 name libvpx conflicts libvpx-devel set my_name libvpx -version 1.13.0 -revision 1 +version 1.13.1 +revision 0 categories multimedia license Permissive diff --git a/tools/MacPorts/net/curl/Portfile b/tools/MacPorts/net/curl/Portfile index 126b707d8c..76bec67d0c 100644 --- a/tools/MacPorts/net/curl/Portfile +++ b/tools/MacPorts/net/curl/Portfile @@ -6,10 +6,10 @@ PortGroup clang_dependency 1.0 # Increase the revision of p5-www-curl whenever the version of curl gets updated. name curl -version 8.2.1 -checksums rmd160 b8486b2903708f892bdff05a4f9a593c776a3ec6 \ - sha256 dd322f6bd0a20e6cebdfd388f69e98c3d183bed792cf4713c8a7ef498cba4894 \ - size 2631932 +version 8.5.0 +checksums rmd160 47b80f4a164c18d95a9af6ffc42576ebe546ea85 \ + sha256 42ab8db9e20d8290a3b633e7fbb3cec15db34df65fd1015ef8ac1e4723750eeb \ + size 2658520 categories net www platforms darwin freebsd @@ -46,7 +46,6 @@ if {${name} eq ${subport}} { port:zstd patchfiles configure.patch - patchfiles-append SCDynamicStoreCopyProxies.patch configure.args --disable-silent-rules \ --enable-ipv6 \ @@ -57,7 +56,6 @@ if {${name} eq ${subport}} { --without-libssh2 \ --without-mbedtls \ --without-nghttp2 \ - --without-nss \ --without-openssl \ --without-ssl \ --without-secure-transport \ @@ -122,30 +120,51 @@ if {${name} eq ${subport}} { RELEASE-NOTES \ ${destroot}${docdir} xinstall -m 0644 -W ${worksrcpath}/docs \ + ALTSVC.md \ BINDINGS.md \ + BUFREF.md \ BUGS.md \ + CIPHERS.md \ CODE_OF_CONDUCT.md \ CODE_STYLE.md \ + CONNECTION-FILTERS.md \ CONTRIBUTE.md \ + CURL-DISABLE.md \ + DEPRECATE.md \ + DYNBUF.md \ FAQ \ FEATURES.md \ GOVERNANCE.md \ HELP-US.md \ HISTORY.md \ + HSTS.md \ HTTP-COOKIES.md \ - HTTP2.md \ INTERNALS.md \ KNOWN_BUGS \ MAIL-ETIQUETTE \ + PARALLEL-TRANSFERS.md \ ROADMAP.md \ - SECURITY-PROCESS.md \ + SECURITY-ADVISORY.md \ SSL-PROBLEMS.md \ SSLCERTS.md \ THANKS \ TODO \ TheArtOfHttpScripting.md \ + URL-SYNTAX.md \ VERSIONS.md \ + WEBSOCKET.md \ + VULN-DISCLOSURE-POLICY.md \ ${destroot}${docdir} + if {[variant_isset http2]} { + xinstall -m 0644 -W ${worksrcpath}/docs \ + HTTP2.md \ + ${destroot}${docdir} + } + if {[variant_isset http3]} { + xinstall -m 0644 -W ${worksrcpath}/docs \ + HTTP3.md \ + ${destroot}${docdir} + } xinstall -m 0644 ${worksrcpath}/docs/libcurl/libcurl.m4 \ ${destroot}${prefix}/share/aclocal/ } diff --git a/tools/MacPorts/net/curl/Portfile.orig b/tools/MacPorts/net/curl/Portfile.orig index 76ee022c9e..2ec11d3441 100644 --- a/tools/MacPorts/net/curl/Portfile.orig +++ b/tools/MacPorts/net/curl/Portfile.orig @@ -6,10 +6,10 @@ PortGroup clang_dependency 1.0 # Increase the revision of p5-www-curl whenever the version of curl gets updated. name curl -version 8.2.1 -checksums rmd160 b8486b2903708f892bdff05a4f9a593c776a3ec6 \ - sha256 dd322f6bd0a20e6cebdfd388f69e98c3d183bed792cf4713c8a7ef498cba4894 \ - size 2631932 +version 8.5.0 +checksums rmd160 47b80f4a164c18d95a9af6ffc42576ebe546ea85 \ + sha256 42ab8db9e20d8290a3b633e7fbb3cec15db34df65fd1015ef8ac1e4723750eeb \ + size 2658520 categories net www platforms darwin freebsd @@ -46,7 +46,6 @@ if {${name} eq ${subport}} { port:zstd patchfiles configure.patch - patchfiles-append SCDynamicStoreCopyProxies.patch configure.args --disable-silent-rules \ --enable-ipv6 \ @@ -57,7 +56,6 @@ if {${name} eq ${subport}} { --without-libssh2 \ --without-mbedtls \ --without-nghttp2 \ - --without-nss \ --without-openssl \ --without-ssl \ --without-secure-transport \ @@ -118,30 +116,51 @@ if {${name} eq ${subport}} { RELEASE-NOTES \ ${destroot}${docdir} xinstall -m 0644 -W ${worksrcpath}/docs \ + ALTSVC.md \ BINDINGS.md \ + BUFREF.md \ BUGS.md \ + CIPHERS.md \ CODE_OF_CONDUCT.md \ CODE_STYLE.md \ + CONNECTION-FILTERS.md \ CONTRIBUTE.md \ + CURL-DISABLE.md \ + DEPRECATE.md \ + DYNBUF.md \ FAQ \ FEATURES.md \ GOVERNANCE.md \ HELP-US.md \ HISTORY.md \ + HSTS.md \ HTTP-COOKIES.md \ - HTTP2.md \ INTERNALS.md \ KNOWN_BUGS \ MAIL-ETIQUETTE \ + PARALLEL-TRANSFERS.md \ ROADMAP.md \ - SECURITY-PROCESS.md \ + SECURITY-ADVISORY.md \ SSL-PROBLEMS.md \ SSLCERTS.md \ THANKS \ TODO \ TheArtOfHttpScripting.md \ + URL-SYNTAX.md \ VERSIONS.md \ + WEBSOCKET.md \ + VULN-DISCLOSURE-POLICY.md \ ${destroot}${docdir} + if {[variant_isset http2]} { + xinstall -m 0644 -W ${worksrcpath}/docs \ + HTTP2.md \ + ${destroot}${docdir} + } + if {[variant_isset http3]} { + xinstall -m 0644 -W ${worksrcpath}/docs \ + HTTP3.md \ + ${destroot}${docdir} + } xinstall -m 0644 ${worksrcpath}/docs/libcurl/libcurl.m4 \ ${destroot}${prefix}/share/aclocal/ } diff --git a/tools/MacPorts/net/curl/files/configure.patch b/tools/MacPorts/net/curl/files/configure.patch index 03887d25a2..2168572f16 100644 --- a/tools/MacPorts/net/curl/files/configure.patch +++ b/tools/MacPorts/net/curl/files/configure.patch @@ -1,8 +1,8 @@ Prevent curl-config from telling curl's dependents that they have to link with all of curl's dependencies as well. ---- configure.orig 2023-07-23 16:00:43.000000000 -0500 -+++ configure 2023-07-27 00:52:12.000000000 -0500 -@@ -14497,7 +14497,7 @@ +--- configure.orig 2023-09-13 08:41:45 ++++ configure 2023-09-13 08:42:48 +@@ -14477,7 +14477,7 @@ else whole_archive_flag_spec='' fi diff --git a/tools/MacPorts/net/curl/files/patch-sonoma.patch b/tools/MacPorts/net/curl/files/patch-sonoma.patch new file mode 100644 index 0000000000..5e0381da2f --- /dev/null +++ b/tools/MacPorts/net/curl/files/patch-sonoma.patch @@ -0,0 +1,20 @@ +--- configure ++++ configure +@@ -21732,7 +21732,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if test "x$build_for_macos" != xno; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + printf "%s\n" "yes" >&6; } +- LDFLAGS="$LDFLAGS -framework CoreFoundation -framework SystemConfiguration" ++ LDFLAGS="$LDFLAGS -framework CoreFoundation -framework CoreServices -framework SystemConfiguration" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + printf "%s\n" "no" >&6; } +@@ -26234,7 +26234,7 @@ printf "%s\n" "#define USE_SECTRANSP 1" >>confdefs.h + ssl_msg="Secure Transport" + test secure-transport != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes + SECURETRANSPORT_ENABLED=1 +- LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security" ++ LDFLAGS="$LDFLAGS -framework CoreFoundation -framework CoreServices -framework Security" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + printf "%s\n" "no" >&6; } diff --git a/tools/MacPorts/print/ghostscript/Portfile b/tools/MacPorts/print/ghostscript/Portfile index 7f8f64cfae..91c06743a6 100644 --- a/tools/MacPorts/print/ghostscript/Portfile +++ b/tools/MacPorts/print/ghostscript/Portfile @@ -4,8 +4,9 @@ PortSystem 1.0 PortGroup muniversal 1.0 name ghostscript -version 10.01.2 +version 10.02.1 revision 1 + categories print license AGPL-3 BSD maintainers nomaintainer @@ -13,8 +14,8 @@ description GPL Ghostscript, An interpreter for PostScript and PDF long_description Ghostscript is the well-known PostScript interpreter which \ is available for all common and most esoteric platforms and \ supports many different printers and some displays. - homepage https://www.ghostscript.com/ + master_sites https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs[strsed ${version} {g/\.//}]:source \ sourceforge:project/gs-fonts/gs-fonts/6.0%20%28misc%2C%20AFPL%29/:otherfonts \ sourceforge:project/gs-fonts/gs-fonts/8.11%20%28base%2035%2C%20GPL%29/:stdfonts \ @@ -32,15 +33,10 @@ distfiles ${distname}.tar.gz:source \ ghostscript-fonts-std-8.11.tar.gz:stdfonts \ ${mappingresources_commit}.zip:misc -patchfiles patch-base_unix-dll.mak.diff \ - patch-base_unixinst.mak.diff \ - patch-base_gspaint.diff \ - patch-psi_imainarg.c.diff - checksums ${distname}.tar.gz \ - rmd160 1a21460fb6ec98858a723cd6570a1b98e9f2124a \ - sha256 ee76cb526f5b6683e2adcb65398a1f333f7972289cec960b67aaa227c0d72e88 \ - size 96848797 \ + rmd160 4a8dd188fe10e5f16f4a7f3c5866e2923e3d7b3c \ + sha256 25399af0ef5bb94f2a13c91dc785c128d14f16744c4c92fa7c86e011c23151d8 \ + size 98194756 \ ghostscript-fonts-other-6.0.tar.gz \ rmd160 ab60dbf71e7d91283a106c3df381cadfe173082f \ sha256 4fa051e341167008d37fe34c19d241060cd17b13909932cd7ca7fe759243c2de \ @@ -54,27 +50,6 @@ checksums ${distname}.tar.gz \ sha256 e3971985977cee4b75f6b49f6e43842d3b699c4255d010adb82796073e98fbfe \ size 1601563 -depends_lib port:fontconfig \ - port:freetype \ - port:jbig2dec \ - path:include/turbojpeg.h:libjpeg-turbo \ - port:libiconv \ - port:libidn \ - port:libpaper \ - port:libpng \ - port:openjpeg \ - port:tiff \ - port:zlib \ - port:lcms2 - -depends_build port:pkgconfig - -# tell ghostscript it's OK to use the system pkg-config even when cross-compiling -# see https://trac.macports.org/ticket/66627 -configure.env-append PKGCONFIG=${prefix}/bin/pkg-config - -depends_run port:perl5 - extract.only ${distname}.tar.gz \ ghostscript-fonts-other-6.0.tar.gz \ ghostscript-fonts-std-8.11.tar.gz @@ -95,9 +70,14 @@ post-extract { copy -force {*}[glob ${workpath}/mapping-resources-pdf-${mappingresources_commit}/pdf2other/*] ${worksrcpath}/Resource/CMap } +patchfiles-append patch-base_unix-dll.mak.diff +patchfiles-append patch-base_unixinst.mak.diff + post-patch { - reinplace s|__PREFIX__|${prefix}| ${worksrcpath}/base/unix-dll.mak - reinplace s|ZLIBDIR=src|ZLIBDIR=${prefix}/include| ${worksrcpath}/configure.ac + reinplace "s|__PREFIX__|${prefix}|" \ + ${worksrcpath}/base/unix-dll.mak + reinplace "s|ZLIBDIR=src|ZLIBDIR=${prefix}/include|" \ + ${worksrcpath}/configure.ac # Ensure that MacPorts perl is used everywhere fs-traverse f ${worksrcpath} { @@ -107,28 +87,55 @@ post-patch { } } -# https://trac.macports.org/ticket/56137 -configure.ldflags-prepend \ - -Lsobin +depends_build-append \ + port:pkgconfig + +depends_lib-append \ + port:fontconfig \ + port:freetype \ + port:jbig2dec \ + port:lcms2 \ + port:libiconv \ + port:libidn \ + path:include/turbojpeg.h:libjpeg-turbo \ + port:libpaper \ + port:libpng \ + port:openjpeg \ + port:tiff \ + port:zlib + +depends_run-append \ + port:perl5 use_autoreconf yes autoreconf.args -fv configure.checks.implicit_function_declaration.whitelist-append strchr +# tell ghostscript it's OK to use the system pkg-config even when cross-compiling +# see https://trac.macports.org/ticket/66627 +configure.env-append \ + PKGCONFIG=${prefix}/bin/pkg-config + +# https://trac.macports.org/ticket/56137 +configure.ldflags-prepend \ + -Lsobin + # Make included OpenJPEG uses its own headers rather than the system ones configure.cppflags-replace \ -I${prefix}/include \ -isystem${prefix}/include -configure.args --disable-compile-inits \ +configure.args-append \ + --disable-compile-inits \ --disable-cups \ --disable-dbus \ --disable-gtk \ - --without-pcl \ - --without-xps \ + --with-system-libtiff \ --without-gpdl \ + --without-pcl \ + --without-tesseract \ --without-x \ - --with-system-libtiff + --without-xps build.target so diff --git a/tools/MacPorts/print/ghostscript/Portfile.orig b/tools/MacPorts/print/ghostscript/Portfile.orig index 958d860d9c..bbc24ae953 100644 --- a/tools/MacPorts/print/ghostscript/Portfile.orig +++ b/tools/MacPorts/print/ghostscript/Portfile.orig @@ -4,8 +4,9 @@ PortSystem 1.0 PortGroup muniversal 1.0 name ghostscript -version 10.01.2 +version 10.02.1 revision 1 + categories print license AGPL-3 BSD maintainers nomaintainer @@ -13,8 +14,8 @@ description GPL Ghostscript, An interpreter for PostScript and PDF long_description Ghostscript is the well-known PostScript interpreter which \ is available for all common and most esoteric platforms and \ supports many different printers and some displays. - homepage https://www.ghostscript.com/ + master_sites https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs[strsed ${version} {g/\.//}]:source \ sourceforge:project/gs-fonts/gs-fonts/6.0%20%28misc%2C%20AFPL%29/:otherfonts \ sourceforge:project/gs-fonts/gs-fonts/8.11%20%28base%2035%2C%20GPL%29/:stdfonts \ @@ -32,15 +33,10 @@ distfiles ${distname}.tar.gz:source \ ghostscript-fonts-std-8.11.tar.gz:stdfonts \ ${mappingresources_commit}.zip:misc -patchfiles patch-base_unix-dll.mak.diff \ - patch-base_unixinst.mak.diff \ - patch-base_gspaint.diff \ - patch-psi_imainarg.c.diff - checksums ${distname}.tar.gz \ - rmd160 1a21460fb6ec98858a723cd6570a1b98e9f2124a \ - sha256 ee76cb526f5b6683e2adcb65398a1f333f7972289cec960b67aaa227c0d72e88 \ - size 96848797 \ + rmd160 4a8dd188fe10e5f16f4a7f3c5866e2923e3d7b3c \ + sha256 25399af0ef5bb94f2a13c91dc785c128d14f16744c4c92fa7c86e011c23151d8 \ + size 98194756 \ ghostscript-fonts-other-6.0.tar.gz \ rmd160 ab60dbf71e7d91283a106c3df381cadfe173082f \ sha256 4fa051e341167008d37fe34c19d241060cd17b13909932cd7ca7fe759243c2de \ @@ -54,27 +50,6 @@ checksums ${distname}.tar.gz \ sha256 e3971985977cee4b75f6b49f6e43842d3b699c4255d010adb82796073e98fbfe \ size 1601563 -depends_lib port:fontconfig \ - port:freetype \ - port:jbig2dec \ - path:include/turbojpeg.h:libjpeg-turbo \ - port:libiconv \ - port:libidn \ - port:libpaper \ - port:libpng \ - port:openjpeg \ - port:tiff \ - port:zlib \ - port:lcms2 - -depends_build port:pkgconfig - -# tell ghostscript it's OK to use the system pkg-config even when cross-compiling -# see https://trac.macports.org/ticket/66627 -configure.env-append PKGCONFIG=${prefix}/bin/pkg-config - -depends_run port:perl5 - extract.only ${distname}.tar.gz \ ghostscript-fonts-other-6.0.tar.gz \ ghostscript-fonts-std-8.11.tar.gz @@ -95,9 +70,14 @@ post-extract { copy -force {*}[glob ${workpath}/mapping-resources-pdf-${mappingresources_commit}/pdf2other/*] ${worksrcpath}/Resource/CMap } +patchfiles-append patch-base_unix-dll.mak.diff +patchfiles-append patch-base_unixinst.mak.diff + post-patch { - reinplace s|__PREFIX__|${prefix}| ${worksrcpath}/base/unix-dll.mak - reinplace s|ZLIBDIR=src|ZLIBDIR=${prefix}/include| ${worksrcpath}/configure.ac + reinplace "s|__PREFIX__|${prefix}|" \ + ${worksrcpath}/base/unix-dll.mak + reinplace "s|ZLIBDIR=src|ZLIBDIR=${prefix}/include|" \ + ${worksrcpath}/configure.ac # Ensure that MacPorts perl is used everywhere fs-traverse f ${worksrcpath} { @@ -107,28 +87,55 @@ post-patch { } } -# https://trac.macports.org/ticket/56137 -configure.ldflags-prepend \ - -Lsobin +depends_build-append \ + port:pkgconfig + +depends_lib-append \ + port:fontconfig \ + port:freetype \ + port:jbig2dec \ + port:lcms2 \ + port:libiconv \ + port:libidn \ + path:include/turbojpeg.h:libjpeg-turbo \ + port:libpaper \ + port:libpng \ + port:openjpeg \ + port:tiff \ + port:zlib + +depends_run-append \ + port:perl5 use_autoreconf yes autoreconf.args -fv configure.checks.implicit_function_declaration.whitelist-append strchr +# tell ghostscript it's OK to use the system pkg-config even when cross-compiling +# see https://trac.macports.org/ticket/66627 +configure.env-append \ + PKGCONFIG=${prefix}/bin/pkg-config + +# https://trac.macports.org/ticket/56137 +configure.ldflags-prepend \ + -Lsobin + # Make included OpenJPEG uses its own headers rather than the system ones configure.cppflags-replace \ -I${prefix}/include \ -isystem${prefix}/include -configure.args --disable-compile-inits \ +configure.args-append \ + --disable-compile-inits \ --disable-cups \ --disable-dbus \ --disable-gtk \ - --without-pcl \ - --without-xps \ + --with-system-libtiff \ --without-gpdl \ + --without-pcl \ + --without-tesseract \ --without-x \ - --with-system-libtiff + --without-xps build.target so diff --git a/tools/MacPorts/print/ghostscript/files/patch-base_unixinst.mak.diff b/tools/MacPorts/print/ghostscript/files/patch-base_unixinst.mak.diff index 9cfb41c02b..d5c4908281 100644 --- a/tools/MacPorts/print/ghostscript/files/patch-base_unixinst.mak.diff +++ b/tools/MacPorts/print/ghostscript/files/patch-base_unixinst.mak.diff @@ -1,5 +1,5 @@ ---- base/unixinst.mak.orig 2019-03-26 09:13:42.000000000 +0000 -+++ base/unixinst.mak 2020-04-28 01:05:01.000000000 -0700 +--- base/unixinst.mak.orig 2023-09-12 14:40:30 ++++ base/unixinst.mak 2023-09-14 17:45:24 @@ -78,6 +78,8 @@ PSEXDIR=$(PSLIBDIR)/../examples PSMANDIR=$(PSLIBDIR)/../man @@ -9,19 +9,17 @@ install-data: install-libdata install-resdata$(COMPILE_INITS) install-iccdata$(COMPILE_INITS) install-doc install-man # There's no point in providing a complete dependency list: we include -@@ -157,7 +159,9 @@ - - DOC_PAGE_IMAGES=Artifex_logo.png favicon.png ghostscript_logo.png hamburger-light.png x-light.png - --install-doc: $(PSDOCDIR)/News.htm +@@ -148,13 +150,30 @@ + # install html documentation + DOC_PAGES=index.html News.html COPYING Ghostscript.pdf \ + GS9_Color_Management.pdf +GPDL_DOC_PAGES=ghostpdl.pdf ghostpdl.txt -+ -+install-doc: $(PSDOCDIR)/News.htm install-doc-$(PCL_TARGET) install-doc-$(XPS_TARGET) install-doc-$(GPDL_TARGET) + +-install-doc: $(PSDOCDIR)/News.html ++install-doc: $(PSDOCDIR)/News.html install-doc-$(PCL_TARGET) install-doc-$(XPS_TARGET) install-doc-$(GPDL_TARGET) -mkdir -p $(DESTDIR)$(docdir) - -mkdir -p $(DESTDIR)$(docdir)/images $(SH) -c 'for f in $(DOC_PAGES) ;\ -@@ -167,6 +171,22 @@ - do if ( test -f $(PSDOCDIR)/images/$$f ); then $(INSTALL_DATA) $(PSDOCDIR)/images/$$f $(DESTDIR)$(docdir)/images; fi;\ + do if ( test -f $(PSDOCDIR)/$$f ); then $(INSTALL_DATA) $(PSDOCDIR)/$$f $(DESTDIR)$(docdir); fi;\ done' +install-doc-gpcl6: install-doc-gpdl @@ -41,9 +39,9 @@ + $(NO_OP) + # install the man pages for each locale - MAN_LCDIRS=. de + MAN_LCDIRS=. MAN1_LINKS_PS2PS=eps2eps -@@ -201,7 +221,7 @@ +@@ -189,7 +208,7 @@ done' # install the example files @@ -52,10 +50,11 @@ -mkdir -p $(DESTDIR)$(exdir) for f in \ alphabet.ps colorcir.ps escher.ps grayalph.ps snowflak.ps \ -@@ -217,6 +237,20 @@ +@@ -204,6 +223,20 @@ + all_ag1.ps all_aj2.ps article9.ps gscjk_ag.ps gscjk_ak.ps iso2022v.ps ;\ do $(INSTALL_DATA) $(PSEXDIR)/cjk/$$f $(DESTDIR)$(exdir)/cjk ;\ done - ++ +install-examples-gpcl6: + -mkdir -p $(DESTDIR)$(exdir)/pcl + for f in \ @@ -69,7 +68,6 @@ +# Dummy target +install-examples-: + $(NO_OP) -+ + install-shared: $(GS_SHARED_OBJS) -mkdir -p $(DESTDIR)$(gssharedir) - $(SH) -c 'for obj in $(GS_SHARED_OBJS); do \ diff --git a/tools/MacPorts/python/py-pyside2/Portfile.orig b/tools/MacPorts/python/py-pyside2/Portfile.orig index 0f21fa2d37..4850bd5a9e 100644 --- a/tools/MacPorts/python/py-pyside2/Portfile.orig +++ b/tools/MacPorts/python/py-pyside2/Portfile.orig @@ -4,7 +4,7 @@ PortSystem 1.0 PortGroup python 1.0 name py-pyside2 -version 5.15.10 +version 5.15.12 revision 0 categories-append devel aqua platforms darwin @@ -18,14 +18,15 @@ master_sites https://download.qt.io/official_releases/QtForPython/pys distname pyside-setup-opensource-src-${version} use_xz yes -checksums rmd160 492396a82a4140e86a81e4235cafa6a781766714 \ - sha256 2af691d3613a41f83a60439b46568fc2c696dbfae42f7cd7b07152d115ead33a \ - size 3583764 +checksums rmd160 6490e24dcc3ec3195003f8fd48b2b5ca0c8092ac \ + sha256 9c53a111ca5779064593e690db0da43ce0d5dad25369931b7a4f593886259ff4 \ + size 3585204 -python.versions 37 38 39 310 +python.versions 37 38 39 310 311 +python.pep517 no -set llvm_version 16 +set llvm_version 17 if {${name} ne ${subport}} { PortGroup qt5 1.0 @@ -39,9 +40,6 @@ if {${name} ne ${subport}} { # Needed for generating shiboken2 documentation qt5.depends_build_component sqlite-plugin - # undeclared identifier NPY_ARRAY_UPDATEIFCOPY - patchfiles-append patch-shiboken2-numpy-1.23.0.diff - depends_build-append \ path:bin/cmake:cmake \ port:py${python.version}-setuptools \ diff --git a/tools/MacPorts/python/py-pyside2/Portfile b/tools/MacPorts/python/py-pyside2/Portfile~2024-01-03 similarity index 87% rename from tools/MacPorts/python/py-pyside2/Portfile rename to tools/MacPorts/python/py-pyside2/Portfile~2024-01-03 index 6eb342a70b..11cc1d166b 100644 --- a/tools/MacPorts/python/py-pyside2/Portfile +++ b/tools/MacPorts/python/py-pyside2/Portfile~2024-01-03 @@ -4,7 +4,7 @@ PortSystem 1.0 PortGroup python 1.0 name py-pyside2 -version 5.15.10 +version 5.15.12 revision 0 categories-append devel aqua platforms darwin @@ -18,14 +18,15 @@ master_sites https://download.qt.io/official_releases/QtForPython/pys distname pyside-setup-opensource-src-${version} use_xz yes -checksums rmd160 492396a82a4140e86a81e4235cafa6a781766714 \ - sha256 2af691d3613a41f83a60439b46568fc2c696dbfae42f7cd7b07152d115ead33a \ - size 3583764 +checksums rmd160 6490e24dcc3ec3195003f8fd48b2b5ca0c8092ac \ + sha256 9c53a111ca5779064593e690db0da43ce0d5dad25369931b7a4f593886259ff4 \ + size 3585204 -python.versions 37 38 39 310 +python.versions 37 38 39 310 311 +python.pep517 no -set llvm_version 16 +set llvm_version 17 if {${name} ne ${subport}} { PortGroup qt5 1.0 @@ -39,9 +40,6 @@ if {${name} ne ${subport}} { # Needed for generating shiboken2 documentation qt5.depends_build_component sqlite-plugin - # undeclared identifier NPY_ARRAY_UPDATEIFCOPY - patchfiles-append patch-shiboken2-numpy-1.23.0.diff - depends_build-append \ path:bin/cmake:cmake \ port:py${python.version}-setuptools \ diff --git a/tools/jenkins/build-OSX-installer.sh b/tools/jenkins/build-OSX-installer.sh index e9d6d1e99b..d95490f7b1 100755 --- a/tools/jenkins/build-OSX-installer.sh +++ b/tools/jenkins/build-OSX-installer.sh @@ -42,6 +42,7 @@ updateBuildOptions echo "*** macOS version:" macosx=$(uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|') case "${macosx}" in +23) echo "macOS 14.x Sonoma";; 22) echo "macOS 13.x Ventura";; 21) echo "macOS 12.x Monterey";; 20) echo "macOS 11.x Big Sur";; diff --git a/tools/jenkins/build-Windows-installer.sh b/tools/jenkins/build-Windows-installer.sh index d021db062e..b70c9a071c 100755 --- a/tools/jenkins/build-Windows-installer.sh +++ b/tools/jenkins/build-Windows-installer.sh @@ -131,14 +131,27 @@ $GSED -e "s/_VERSION_/${NATRON_VERSION_FULL}/;s#_RBVERSION_#${NATRON_GIT_BRANCH} cp "$INC_PATH/config/"*.png "$INSTALLER_PATH/config/" # make sure we have mt and qtifw -if [ ! -f "$SDK_HOME/bin/mt.exe" ] || [ ! -f "$SDK_HOME/bin/binarycreator.exe" ]; then - if [ ! -d "$SRC_PATH/natron-windows-installer" ]; then - ( cd "$SRC_PATH"; - $CURL "$THIRD_PARTY_BIN_URL/natron-windows-installer.zip" --output "$SRC_PATH/natron-windows-installer.zip" - unzip natron-windows-installer.zip - ) + +if ! which mt.exe; then + # Add Windows SDK to path so that mt.exe is available. + WIN_SDK_MAJOR_VERSION=10 + WIN_SDK_BASE_PATH="/c/Program Files (x86)/Windows Kits/${WIN_SDK_MAJOR_VERSION}/bin" + WIN_SDK_VERSION=$(ls "${WIN_SDK_BASE_PATH}" | grep "${WIN_SDK_MAJOR_VERSION}." | sort -n | tail -1) + PATH="${WIN_SDK_BASE_PATH}/${WIN_SDK_VERSION}/x64/":${PATH} + + if ! which mt.exe; then + echo "Failed to find mt.exe" + exit 1 + fi +fi + +if ! which binarycreator.exe && [ ! -f "/Setup.exe" ]; then + pacman -S mingw-w64-x86_64-qt-installer-framework + + if ! which binarycreator.exe; then + echo "Failed to find binarycreator.exe" + exit 1 fi - cp "$SRC_PATH/natron-windows-installer/mingw$BITS/bin/"{archivegen.exe,binarycreator.exe,installerbase.exe,installerbase.manifest,repogen.exe,mt.exe} "$SDK_HOME/bin/" fi function installPlugin() { diff --git a/tools/jenkins/build-natron.sh b/tools/jenkins/build-natron.sh index 25c398d12c..c69ed54f97 100755 --- a/tools/jenkins/build-natron.sh +++ b/tools/jenkins/build-natron.sh @@ -173,11 +173,11 @@ if [ "$QT_VERSION_MAJOR" = 5 ]; then esac rm Engine/Qt${QT_VERSION_MAJOR}/NatronEngine/* Gui/Qt${QT_VERSION_MAJOR}/NatronGui/* || true - SHIBOKEN_INCLUDE_PATHS=".:./Engine:./Global:libs/OpenFX/include:${UNIX_SDK_HOME}/include:${QTDIR}/include:${UNIX_PYTHON_HOME}/include/python${PYVER}:${UNIX_PYTHON_HOME}/include/PySide2:${UNIX_PYTHON_HOME}/lib/python${PYVER}/site-packages/PySide2/include" - SHIBOKEN_TYPESYSTEM_PATHS="${UNIX_PYTHON_HOME}/share/PySide2/typesystems:${UNIX_PYTHON_HOME}/lib/python${PYVER}/site-packages/PySide2/typesystems" - shiboken2 --avoid-protected-hack --enable-pyside-extensions --include-paths=${SHIBOKEN_INCLUDE_PATHS} --typesystem-paths=${SHIBOKEN_TYPESYSTEM_PATHS} --output-directory=Engine/Qt${QT_VERSION_MAJOR} Engine/Pyside2_Engine_Python.h Engine/typesystem_engine.xml + SHIBOKEN_INCLUDE_PATHS="-I. -I./Engine -I./Global -Ilibs/OpenFX/include -I${UNIX_SDK_HOME}/include -I${QTDIR}/include -I${UNIX_PYTHON_HOME}/include/python${PYVER} -I${UNIX_PYTHON_HOME}/include/PySide2 -I${UNIX_PYTHON_HOME}/lib/python${PYVER}/site-packages/PySide2/include" + SHIBOKEN_TYPESYSTEM_PATHS="-T${UNIX_PYTHON_HOME}/share/PySide2/typesystems -T${UNIX_PYTHON_HOME}/lib/python${PYVER}/site-packages/PySide2/typesystems" + shiboken2 --avoid-protected-hack --enable-pyside-extensions ${SHIBOKEN_INCLUDE_PATHS} ${SHIBOKEN_TYPESYSTEM_PATHS} --output-directory=Engine/Qt${QT_VERSION_MAJOR} Engine/Pyside2_Engine_Python.h Engine/typesystem_engine.xml - shiboken2 --avoid-protected-hack --enable-pyside-extensions --include-paths=${SHIBOKEN_INCLUDE_PATHS}:${QTDIR}/include/QtWidgets:${QTDIR}/include/QtCore --typesystem-paths=${SHIBOKEN_TYPESYSTEM_PATHS}:./Engine:./Shiboken --output-directory=Gui/Qt${QT_VERSION_MAJOR} Gui/Pyside2_Gui_Python.h Gui/typesystem_natronGui.xml + shiboken2 --avoid-protected-hack --enable-pyside-extensions ${SHIBOKEN_INCLUDE_PATHS} -I${QTDIR}/include/QtWidgets -I${QTDIR}/include/QtCore ${SHIBOKEN_TYPESYSTEM_PATHS} -T./Engine -T./Shiboken --output-directory=Gui/Qt${QT_VERSION_MAJOR} Gui/Pyside2_Gui_Python.h Gui/typesystem_natronGui.xml tools/utils/runPostShiboken2.sh Engine/Qt${QT_VERSION_MAJOR}/NatronEngine natronengine tools/utils/runPostShiboken2.sh Gui/Qt${QT_VERSION_MAJOR}/NatronGui natrongui diff --git a/tools/jenkins/common.sh b/tools/jenkins/common.sh index f85973f759..496c3ef9b9 100644 --- a/tools/jenkins/common.sh +++ b/tools/jenkins/common.sh @@ -380,7 +380,9 @@ else OSMESA_PATH="$SDK_HOME/osmesa" fi -if [ -d "$SDK_HOME/llvm" ]; then +if [ -n "${LLVM_PREFIX:-}" ]; then + LLVM_PATH="${LLVM_PREFIX}" +elif [ -d "$SDK_HOME/llvm" ]; then LLVM_PATH="$SDK_HOME/llvm" elif [ -d "/opt/llvm" ]; then LLVM_PATH="/opt/llvm" diff --git a/tools/jenkins/genDllVersions.sh b/tools/jenkins/genDllVersions.sh index 1e5a428145..6503dda634 100755 --- a/tools/jenkins/genDllVersions.sh +++ b/tools/jenkins/genDllVersions.sh @@ -254,6 +254,8 @@ catDll libdatrie- catDll libsnappy #catDll libpugixml catDll libheif +catDll libkvazaar- +catDll libcryptopp catDll rav1e catDll libde265- catDll libx265 diff --git a/tools/jenkins/include/scripts/build-Linux-sdk.sh b/tools/jenkins/include/scripts/build-Linux-sdk.sh index fea06a8bcc..a3531157cb 100755 --- a/tools/jenkins/include/scripts/build-Linux-sdk.sh +++ b/tools/jenkins/include/scripts/build-Linux-sdk.sh @@ -194,7 +194,7 @@ EOF fi # Note: perl-version added for qt4webkit, see https://github.com/NatronGitHub/Natron/issues/351#issuecomment-524068232 # perl-Encode and perl-Data-Dumper needed to build texinfo before perl - YUM_PKGS="ca-certificates make util-linux git tar bzip2 wget glibc-devel diffutils patch zip unzip alsa-lib-devel libX11-devel mesa-libGL-devel mesa-libGLU-devel libXrender-devel libSM-devel libICE-devel libXcursor-devel libXrender-devel libXrandr-devel libXinerama-devel libXi-devel libXv-devel libXfixes-devel libXvMC-devel libXxf86vm-devel libxkbcommon-devel libxkbfile-devel libXdamage-devel libXp-devel libXScrnSaver-devel libXcomposite-devel libXp-devel libXres-devel libXtst-devel xorg-x11-proto-devel libXxf86dga-devel libXpm-devel perl-Digest-MD5 perl-version perl-Encode perl-Data-Dumper" + YUM_PKGS="ca-certificates make util-linux git tar bzip2 wget glibc-devel diffutils patch zip unzip alsa-lib-devel libX11-devel mesa-libGL-devel mesa-libEGL-devel mesa-libGLU-devel libXrender-devel libSM-devel libICE-devel libXcursor-devel libXrender-devel libXrandr-devel libXinerama-devel libXi-devel libXv-devel libXfixes-devel libXvMC-devel libXxf86vm-devel libxkbcommon-devel libxkbfile-devel libXdamage-devel libXp-devel libXScrnSaver-devel libXcomposite-devel libXp-devel libXres-devel libXtst-devel xorg-x11-proto-devel libXxf86dga-devel libXpm-devel perl-Digest-MD5 perl-version perl-Encode perl-Data-Dumper" SDKPREP="RUN ${PREYUM}${DTSYUM}yum -y install ${YUM_PKGS} ${YUM_DEVEL_EXTRA} && yum -y clean all" cat <&2 echo "Error: X11/Xlib.h not available (on CentOS, do 'yum install alsa-lib-devel libICE-devel libSM-devel libX11-devel libXScrnSaver-devel libXcomposite-devel libXcursor-devel libXdamage-devel libXfixes-devel libXi-devel libXinerama-devel libXp-devel libXp-devel libXpm-devel libXrandr-devel libXrender-devel libXres-devel libXtst-devel libXv-devel libXvMC-devel libXxf86dga-devel libXxf86vm-devel libxkbfile-devel mesa-libGL-devel mesa-libGLU-devel ${YUM_DEVEL_EXTRA}')") + (>&2 echo "Error: X11/Xlib.h not available (on CentOS, do 'yum install alsa-lib-devel libICE-devel libSM-devel libX11-devel libXScrnSaver-devel libXcomposite-devel libXcursor-devel libXdamage-devel libXfixes-devel libXi-devel libXinerama-devel libXp-devel libXp-devel libXpm-devel libXrandr-devel libXrender-devel libXres-devel libXtst-devel libXv-devel libXvMC-devel libXxf86dga-devel libXxf86vm-devel libxkbfile-devel mesa-libGL-devel mesa-libEGL-devel mesa-libGLU-devel ${YUM_DEVEL_EXTRA}')") error=true fi diff --git a/tools/jenkins/zip-python.sh b/tools/jenkins/zip-python.sh index 74edf4943c..906f0f6832 100755 --- a/tools/jenkins/zip-python.sh +++ b/tools/jenkins/zip-python.sh @@ -14,10 +14,14 @@ if [ "$PYV" = 3 ]; then mv site-packages lib-dynload config-${PYVER}-* _sysconfigdata*.py* .. cd .. PYVERFULL="$(python3 -c "import platform; print('.'.join(platform.python_version_tuple()))")" - if [ "$PYVERFULL" = 3.9.14 ] || [ "$PYVERFULL" = 3.9.15 ]; then - # 3.9.14 and 3.9.15 don't have embedded zips + if [ "$PYVER" = 3.9 ] && version_gt "$PYVERFULL" 3.9.13; then + # 3.9.14 and later don't have embedded zips PYVERFULL=3.9.13 fi + if [ "$PYVER" = 3.10 ] && version_gt "$PYVERFULL" 3.10.11; then + # 3.10.12 and later don't have embedded zips + PYVERFULL=3.10.11 + fi wget "https://www.python.org/ftp/python/${PYVERFULL}/python-${PYVERFULL}-embed-amd64.zip" unzip "python-${PYVERFULL}-embed-amd64.zip" "python${PYVERNODOT}.zip" rm "python-${PYVERFULL}-embed-amd64.zip"