From fa521922c96644c375e82ef76a9712229761999c Mon Sep 17 00:00:00 2001 From: Doug Walker Date: Tue, 30 Jan 2024 02:11:35 -0500 Subject: [PATCH] Create RB-2.3.2 release (#1940) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix ssse3 detection typo (#1929) Signed-off-by: Mark Reid (cherry picked from commit 003b6a19e6d6bc6574fe5c7e1e2eb833d09f3451) Signed-off-by: Doug Walker * fix: use system `include pystring.h` for `ConfigUtils.cpp` (#1921) Signed-off-by: Rui Chen Co-authored-by: Doug Walker (cherry picked from commit e747e9c0bdf3c827f7e6f97fdfd2105016bd6034) Signed-off-by: Doug Walker * Fix narrowing conversion error on riscv64 (#1924) Signed-off-by: phancb Co-authored-by: Doug Walker (cherry picked from commit a95febc70ee964b337a8e4a79c909ab425b2e8fb) Signed-off-by: Doug Walker * Add manylinux_2_28 Python wheels (#1933) Signed-off-by: Rémi Achard Co-authored-by: Michael Dolan Co-authored-by: Doug Walker (cherry picked from commit f9250992eb8bf48b082dee0c1a2610adc6bbda22) Signed-off-by: Doug Walker * Enhance ociochecklut to print the output after each step in a multi-t… (#1925) * Enhance ociochecklut to print the output after each step in a multi-transform LUT Signed-off-by: pylee * Review feedback to enable printe of transforms list when using -s flag. Signed-off-by: pylee * Print transform description for each step instead. Signed-off-by: pylee --------- Signed-off-by: pylee Co-authored-by: Doug Walker (cherry picked from commit aadf595946ed8a27d69ad0e338d0a8b779465707) Signed-off-by: Doug Walker * Fix AVX instructions used on CPUs that don't support them (#1935) * Fix AVX instructions used on CPUs that don't support them It's supposed to check all bits are enabled, not just one of them. This causes a crash using OpenColorIO on older CPUs. Thanks to Ray Molenkamp for help tracking this down. Signed-off-by: Brecht Van Lommel * Fix another case pointed out in review Signed-off-by: Brecht Van Lommel --------- Signed-off-by: Brecht Van Lommel (cherry picked from commit 0c90ded16687b1b63f3e24ef417789c89b1dc509) Signed-off-by: Doug Walker * Increment library version to 2.3.2 Signed-off-by: Doug Walker --------- Signed-off-by: Mark Reid Signed-off-by: Doug Walker Signed-off-by: Rui Chen Signed-off-by: phancb Signed-off-by: Rémi Achard Signed-off-by: pylee Signed-off-by: Brecht Van Lommel Co-authored-by: Mark Reid Co-authored-by: Rui Chen Co-authored-by: phanium <91544758+phanen@users.noreply.github.com> Co-authored-by: Rémi Achard Co-authored-by: Michael Dolan Co-authored-by: PenneLee Co-authored-by: Brecht Van Lommel --- .github/workflows/wheel_workflow.yml | 69 +++++++-- CMakeLists.txt | 2 +- pyproject.toml | 4 - share/cmake/utils/CheckSupportSSSE3.cmake | 2 +- src/OpenColorIO/CPUInfo.cpp | 6 +- src/OpenColorIO/ConfigUtils.cpp | 3 +- src/apps/ociochecklut/main.cpp | 179 ++++++++++++++++------ tests/utils/StringUtils_tests.cpp | 2 +- 8 files changed, 196 insertions(+), 71 deletions(-) diff --git a/.github/workflows/wheel_workflow.yml b/.github/workflows/wheel_workflow.yml index 5dff59df1d..022c30496a 100644 --- a/.github/workflows/wheel_workflow.yml +++ b/.github/workflows/wheel_workflow.yml @@ -78,45 +78,84 @@ jobs: matrix: include: # ------------------------------------------------------------------- - # CPython 64 bits + # CPython 64 bits manylinux_2_28 # ------------------------------------------------------------------- - - build: CPython 3.7 64 bits + - build: CPython 3.7 64 bits manylinux_2_28 + manylinux: manylinux_2_28 python: cp37-manylinux* arch: x86_64 - - build: CPython 3.8 64 bits + - build: CPython 3.8 64 bits manylinux_2_28 + manylinux: manylinux_2_28 python: cp38-manylinux* arch: x86_64 - - build: CPython 3.9 64 bits + - build: CPython 3.9 64 bits manylinux_2_28 + manylinux: manylinux_2_28 python: cp39-manylinux* arch: x86_64 - - build: CPython 3.10 64 bits + - build: CPython 3.10 64 bits manylinux_2_28 + manylinux: manylinux_2_28 python: cp310-manylinux* arch: x86_64 - - build: CPython 3.11 64 bits + - build: CPython 3.11 64 bits manylinux_2_28 + manylinux: manylinux_2_28 python: cp311-manylinux* arch: x86_64 - - build: CPython 3.12 64 bits + - build: CPython 3.12 64 bits manylinux_2_28 + manylinux: manylinux_2_28 python: cp312-manylinux* arch: x86_64 # ------------------------------------------------------------------- - # CPython ARM 64 bits + # CPython 64 bits manylinux2014 # ------------------------------------------------------------------- - - build: CPython 3.7 ARM 64 bits + - build: CPython 3.7 64 bits manylinux2014 + manylinux: manylinux2014 + python: cp37-manylinux* + arch: x86_64 + - build: CPython 3.8 64 bits manylinux2014 + manylinux: manylinux2014 + python: cp38-manylinux* + arch: x86_64 + - build: CPython 3.9 64 bits manylinux2014 + manylinux: manylinux2014 + python: cp39-manylinux* + arch: x86_64 + - build: CPython 3.10 64 bits manylinux2014 + manylinux: manylinux2014 + python: cp310-manylinux* + arch: x86_64 + - build: CPython 3.11 64 bits manylinux2014 + manylinux: manylinux2014 + python: cp311-manylinux* + arch: x86_64 + - build: CPython 3.12 64 bits manylinux2014 + manylinux: manylinux2014 + python: cp312-manylinux* + arch: x86_64 + # ------------------------------------------------------------------- + # CPython ARM 64 bits manylinux2014 + # ------------------------------------------------------------------- + - build: CPython 3.7 ARM 64 bits manylinux2014 + manylinux: manylinux2014 python: cp37-manylinux* arch: aarch64 - - build: CPython 3.8 ARM 64 bits + - build: CPython 3.8 ARM 64 bits manylinux2014 + manylinux: manylinux2014 python: cp38-manylinux* arch: aarch64 - - build: CPython 3.9 ARM 64 bits + - build: CPython 3.9 ARM 64 bits manylinux2014 + manylinux: manylinux2014 python: cp39-manylinux* arch: aarch64 - - build: CPython 3.10 ARM 64 bits + - build: CPython 3.10 ARM 64 bits manylinux2014 + manylinux: manylinux2014 python: cp310-manylinux* arch: aarch64 - - build: CPython 3.11 ARM 64 bits + - build: CPython 3.11 ARM 64 bits manylinux2014 + manylinux: manylinux2014 python: cp311-manylinux* arch: aarch64 - - build: CPython 3.12 ARM 64 bits + - build: CPython 3.12 ARM 64 bits manylinux2014 + manylinux: manylinux2014 python: cp312-manylinux* arch: aarch64 @@ -138,6 +177,8 @@ jobs: env: CIBW_BUILD: ${{ matrix.python }} CIBW_ARCHS: ${{ matrix.arch }} + CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }} + CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux }} - uses: actions/upload-artifact@v3 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b62a993c1..1315886035 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ endif() # Project definition. project(OpenColorIO - VERSION 2.3.1 + VERSION 2.3.2 DESCRIPTION "OpenColorIO (OCIO) is a complete color management solution" HOMEPAGE_URL https://github.com/AcademySoftwareFoundation/OpenColorIO LANGUAGES CXX C) diff --git a/pyproject.toml b/pyproject.toml index 337ae4a4f6..df4058a1c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,10 +26,6 @@ test-command = [ "ociocheck" ] -manylinux-x86_64-image = "manylinux2014" -manylinux-i686-image = "manylinux2014" -manylinux-aarch64-image = "manylinux2014" - [tool.cibuildwheel.linux] before-build = "share/ci/scripts/linux/yum/install_docs_env.sh" diff --git a/share/cmake/utils/CheckSupportSSSE3.cmake b/share/cmake/utils/CheckSupportSSSE3.cmake index 9efea27eea..ffa114a729 100644 --- a/share/cmake/utils/CheckSupportSSSE3.cmake +++ b/share/cmake/utils/CheckSupportSSSE3.cmake @@ -13,7 +13,7 @@ endif() # MSVC doesn't have flags if(USE_GCC OR USE_CLANG) - set(CMAKE_CXX_FLAGS "-w -msse3") + set(CMAKE_CXX_FLAGS "-w -mssse3") endif() if (APPLE AND __universal_build) diff --git a/src/OpenColorIO/CPUInfo.cpp b/src/OpenColorIO/CPUInfo.cpp index 28fcd9477e..c0d7c02899 100644 --- a/src/OpenColorIO/CPUInfo.cpp +++ b/src/OpenColorIO/CPUInfo.cpp @@ -107,10 +107,10 @@ CPUInfo::CPUInfo() flags |= X86_CPU_FLAG_SSE42; /* Check OSXSAVE and AVX bits */ - if (info.reg.ecx & 0x18000000) + if ((info.reg.ecx & 0x18000000) == 0x18000000) { xcr = xgetbv(); - if(xcr & 0x6) { + if((xcr & 0x6) == 0x6) { flags |= X86_CPU_FLAG_AVX; if(info.reg.ecx & 0x20000000) { @@ -129,7 +129,7 @@ CPUInfo::CPUInfo() /* OPMASK/ZMM state */ if ((xcr & 0xe0) == 0xe0) { - if ((flags & X86_CPU_FLAG_AVX2) && (info.reg.ebx & 0xd0030000)) + if ((flags & X86_CPU_FLAG_AVX2) && ((info.reg.ebx & 0xd0030000) == 0xd0030000)) flags |= X86_CPU_FLAG_AVX512; } } diff --git a/src/OpenColorIO/ConfigUtils.cpp b/src/OpenColorIO/ConfigUtils.cpp index 2e774726f4..0b45b04de8 100644 --- a/src/OpenColorIO/ConfigUtils.cpp +++ b/src/OpenColorIO/ConfigUtils.cpp @@ -1,9 +1,10 @@ // SPDX-License-Identifier: BSD-3-Clause // Copyright Contributors to the OpenColorIO Project. +#include + #include "ConfigUtils.h" #include "MathUtils.h" -#include "pystring/pystring.h" #include "utils/StringUtils.h" namespace OCIO_NAMESPACE diff --git a/src/apps/ociochecklut/main.cpp b/src/apps/ociochecklut/main.cpp index 3a17fb473e..9469090a15 100644 --- a/src/apps/ociochecklut/main.cpp +++ b/src/apps/ociochecklut/main.cpp @@ -50,12 +50,16 @@ class ProcessorWrapper void setGPU(OCIO::ConstGPUProcessorRcPtr gpu) { m_gpu = gpu; - m_oglApp = OCIO::OglApp::CreateOglApp("ociochecklut", 256, 20); - - if (m_verbose) + if (!m_oglApp) { - m_oglApp->printGLInfo(); + m_oglApp = OCIO::OglApp::CreateOglApp("ociochecklut", 256, 20); + + if (m_verbose) + { + m_oglApp->printGLInfo(); + } } + m_oglApp->setPrintShader(m_verbose); float image[4]{ 0.f, 0.f, 0.f, 0.f }; m_oglApp->initImage(1, 1, OCIO::OglApp::COMPONENTS_RGBA, image); @@ -191,6 +195,7 @@ int main (int argc, const char* argv[]) bool usegpu = false; bool usegpuLegacy = false; bool outputgpuInfo = false; + bool stepInfo = false; ArgParse ap; ap.options("ociochecklut -- check any LUT file and optionally convert a pixel\n\n" @@ -199,6 +204,7 @@ int main (int argc, const char* argv[]) "", "Options:", "-t", &test, "Test a set a predefined RGB values", "-v", &verbose, "Verbose", + "-s", &stepInfo, "Print the output after each step in a multi - transform LUT", "--help", &help, "Print help message", "--inv", &invlut, "Apply LUT in inverse direction", "--gpu", &usegpu, "Use GPU instead of CPU", @@ -346,7 +352,7 @@ int main (int argc, const char* argv[]) 0.f, 1.f, 0.f, 0.f, 0.f, 1.f }; - if (verbose) + if (verbose || stepInfo) { std::cout << std::endl; } @@ -357,59 +363,140 @@ int main (int argc, const char* argv[]) { std::vector pixel = { input[curPix], input[curPix+1], input[curPix+2], comp == 3 ? 0.0f : input[curPix + 3] }; - try - { - proc.apply(pixel); - } - catch (const OCIO::Exception & e) - { - std::cerr << "ERROR: Processing pixel: " << e.what() << std::endl; - return 1; - } - catch (...) - { - std::cerr << "ERROR: Unknown error encountered while processing pixel." << std::endl; - return 1; - } - - // Print to string so that in & out values can be aligned if needed. - std::vector out; - ToString(out, pixel, 0, comp); - - if (verbose) + if (stepInfo) { - std::vector in; - ToString(in, input, curPix, comp); - - std::cout << "Input [R G B"; - if (comp == 4) + // Process each step in a multi - transform LUT + try { - std::cout << " A"; + // Create GroupTransform so that each can be processed one at a time. + auto processor = config->getProcessor(t); + auto transform = processor->createGroupTransform(); + std::vector inputPixel = pixel; + std::vector outputPixel = pixel; + const auto numTransforms = transform->getNumTransforms(); + + std::cout << std::endl; + + for (int i = 0; i < numTransforms; ++i) + { + auto transformStep = transform->getTransform(i); + auto processorStep = config->getProcessor(transformStep); + + if (usegpu || usegpuLegacy) + { + proc.setGPU(usegpuLegacy ? processorStep->getOptimizedLegacyGPUProcessor(OCIO::OPTIMIZATION_DEFAULT, 32) + : processorStep->getDefaultGPUProcessor()); + } + else + { + proc.setCPU(processorStep->getDefaultCPUProcessor()); + } + + // Process the pixel + proc.apply(outputPixel); + + // Print the input/output pixel + std::vector in; + ToString(in, inputPixel, 0, comp); + + std::vector out; + ToString(out, outputPixel, 0, comp); + + std::cout << "\n" << *(transform->getTransform(i)) << std::endl; + std::cout << "Input [R G B"; + if (comp == 4) + { + std::cout << " A"; + } + std::cout << "]: ["; + PrintAlignedVec(in, out, comp); + std::cout << "]" << std::endl; + + std::cout << "Output [R G B"; + if (comp == 4) + { + std::cout << " A"; + } + std::cout << "]: ["; + PrintAlignedVec(out, in, comp); + std::cout << "]" << std::endl; + + inputPixel = outputPixel; + } } - std::cout << "]: ["; - PrintAlignedVec(in, out, comp); - std::cout << "]" << std::endl; - - std::cout << "Output [R G B"; - if (comp == 4) + catch (const OCIO::Exception& exception) { - std::cout << " A"; + std::cerr << "ERROR: " << exception.what() << std::endl; + return 1; } - std::cout << "]: ["; - PrintAlignedVec(out, in, comp); - std::cout << "]" << std::endl; + catch (...) + { + std::cerr << "ERROR: Unknown error encountered while processing single step operator." << std::endl; + return 1; + } + + curPix += comp; } else { - std::cout << out[0] << " " << out[1] << " " << out[2]; - if (comp == 4) + // Process in a single step + try + { + proc.apply(pixel); + } + catch (const OCIO::Exception& e) + { + std::cerr << "ERROR: Processing pixel: " << e.what() << std::endl; + return 1; + } + catch (...) { - std::cout << " " << out[3]; + std::cerr << "ERROR: Unknown error encountered while processing pixel." << std::endl; + return 1; } + + // Print to string so that in & out values can be aligned if needed. + + std::vector out; + ToString(out, pixel, 0, comp); + std::cout << std::endl; - } - curPix += comp; + + if (verbose) + { + std::vector in; + ToString(in, input, curPix, comp); + + std::cout << "Input [R G B"; + if (comp == 4) + { + std::cout << " A"; + } + std::cout << "]: ["; + PrintAlignedVec(in, out, comp); + std::cout << "]" << std::endl; + + std::cout << "Output [R G B"; + if (comp == 4) + { + std::cout << " A"; + } + std::cout << "]: ["; + PrintAlignedVec(out, in, comp); + std::cout << "]" << std::endl; + } + else + { + std::cout << out[0] << " " << out[1] << " " << out[2]; + if (comp == 4) + { + std::cout << " " << out[3]; + } + std::cout << std::endl; + } + curPix += comp; + } } else if (test) { diff --git a/tests/utils/StringUtils_tests.cpp b/tests/utils/StringUtils_tests.cpp index 0154a4fc18..e258832b17 100644 --- a/tests/utils/StringUtils_tests.cpp +++ b/tests/utils/StringUtils_tests.cpp @@ -53,7 +53,7 @@ OCIO_ADD_TEST(StringUtils, trim) { // Test that no assert happens when the Trim argument is not an unsigned char (see issue #1874). - constexpr char ref2[]{ -1, -2, -3, '\0' }; + constexpr char ref2[]{ char(-1), char(-2), char(-3), '\0' }; const std::string str = StringUtils::Trim(ref2); } }