diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbf2f8678f..40a2cfff30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,6 +94,7 @@ jobs: container: aswf/ci-osl:2022 vfxyear: 2022 cxx_std: 17 + opencolorio_ver: v2.2.1 python_ver: 3.9 # simd: "avx2,f16c" fmt_ver: 7.1.3 @@ -104,7 +105,7 @@ jobs: FREETYPE_VERSION=VER-2-13-0 # For icc, use fp-model precise to eliminate needless LSB errors # that make test results differ from other platforms. - - desc: icx/C++17 py3.9 exr3.1 ocio2.1 qt5.15 + - desc: icx/C++17 py3.9 exr3.1 ocio2.2 qt5.15 nametag: linux-vfx2022-icx runner: ubuntu-latest container: aswf/ci-osl:2022 @@ -112,10 +113,14 @@ jobs: cc_compiler: icx cxx_compiler: icpx cxx_std: 17 + opencolorio_ver: v2.3.2 python_ver: 3.9 - simd: "avx2,f16c" pybind11_ver: v2.9.0 + simd: "avx2,f16c" setenvs: export USE_OPENVDB=0 + OPENCOLORIO_CXX=g++ + # OCIO doesn't build with icx, so we have to force the ocio build + # to use g++. - desc: sanitizers nametag: sanitizer runner: ubuntu-latest @@ -124,6 +129,7 @@ jobs: cc_compiler: clang cxx_compiler: clang++ cxx_std: 17 + opencolorio_ver: v2.3.2 python_ver: 3.9 setenvs: export SANITIZE=address,undefined OIIO_CMAKE_FLAGS="-DSANITIZE=address,undefined -DUSE_PYTHON=0" @@ -150,42 +156,42 @@ jobs: simd: "avx2,f16c" fmt_ver: 10.1.1 pybind11_ver: v2.12.0 - - desc: oldest/hobbled gcc9.3/C++17 py3.7 exr-3.1 no-sse no-ocio - # Oldest versions of the dependencies that we can muster, and various - # things disabled (no SSE, OCIO, or OpenCV, don't embed plugins). + - desc: oldest gcc9.3/C++17 py3.7 exr-3.1 + # Oldest versions of the dependencies that we support. nametag: linux-oldest runner: ubuntu-latest container: aswf/ci-osl:2021 vfxyear: 2021 cxx_std: 17 fmt_ver: 7.0.1 + opencolorio_ver: v2.2.1 openexr_ver: v3.1.0 pybind11_ver: v2.7.0 python_ver: 3.7 setenvs: export CMAKE_VERSION=3.15.5 PTEX_VERSION=v2.3.2 - WEBP_VERSION=v1.0.0 + WEBP_VERSION=v1.1.0 depcmds: sudo rm -rf /usr/local/include/OpenEXR - - desc: hobbled gcc9.3/C++17 py3.7 exr-3.1 no-sse no-ocio + - desc: hobbled gcc9.3/C++17 py3.7 exr-3.1 no-sse # Use the oldest supported versions of required dependencies, and - # disable most optional dependencies and features (no SSE, OCIO, - # or OpenCV, don't embed plugins). + # disable most optional dependencies and features (no SSE or + # OpenCV, don't embed plugins). nametag: linux-disabled runner: ubuntu-latest container: aswf/ci-osl:2021 vfxyear: 2021 cxx_std: 17 fmt_ver: 7.0.1 + opencolorio_ver: v2.2.1 openexr_ver: v3.1.0 - pybind11_ver: v2.7.0 + pybind11_ver: v2.4.2 python_ver: 3.7 simd: 0 setenvs: export EMBEDPLUGINS=0 CMAKE_VERSION=3.15.5 PTEX_VERSION=v2.3.2 - WEBP_VERSION=v1.0.0 + WEBP_VERSION=v1.1.0 USE_JPEGTURBO=0 - USE_OPENCOLORIO=0 USE_OPENCV=0 FREETYPE_VERSION=VER-2-10-0 depcmds: sudo rm -rf /usr/local/include/OpenEXR @@ -220,6 +226,7 @@ jobs: CMAKE_CXX_STANDARD: ${{matrix.cxx_std}} USE_SIMD: ${{matrix.simd}} FMT_VERSION: ${{matrix.fmt_ver}} + OPENCOLORIO_VERSION: ${{matrix.opencolorio_ver}} OPENEXR_VERSION: ${{matrix.openexr_ver}} PYBIND11_VERSION: ${{matrix.pybind11_ver}} PYTHON_VERSION: ${{matrix.python_ver}} @@ -308,6 +315,7 @@ jobs: cxx_compiler: g++-12 cxx_std: 17 fmt_ver: 10.1.1 + opencolorio_ver: v2.3.2 openexr_ver: v3.2.4 pybind11_ver: v2.12.0 python_ver: "3.10" @@ -315,11 +323,10 @@ jobs: setenvs: export LIBJPEGTURBO_VERSION=3.0.1 LIBRAW_VERSION=0.21.2 LIBTIFF_VERSION=v4.6.0 - OPENCOLORIO_VERSION=v2.3.2 OPENJPEG_VERSION=v2.4.0 PTEX_VERSION=v2.4.2 PUGIXML_VERSION=v1.14 - WEBP_VERSION=v1.3.0 + WEBP_VERSION=v1.4.0 FREETYPE_VERSION=VER-2-13-2 EXTRA_DEP_PACKAGES="libboost-dev" - desc: bleeding edge gcc14 C++20 py3.12 OCIO/libtiff/exr-master avx2 @@ -329,6 +336,7 @@ jobs: cxx_compiler: g++-14 cxx_std: 20 fmt_ver: master + opencolorio_ver: main openexr_ver: main pybind11_ver: master python_ver: "3.12" @@ -336,7 +344,6 @@ jobs: setenvs: export LIBJPEGTURBO_VERSION=main LIBRAW_VERSION=master LIBTIFF_VERSION=master - OPENCOLORIO_VERSION=main OPENJPEG_VERSION=master PTEX_VERSION=main PUGIXML_VERSION=master @@ -367,7 +374,7 @@ jobs: OPENJPEG_VERSION=v2.4.0 PTEX_VERSION=v2.4.2 PUGIXML_VERSION=v1.14 - WEBP_VERSION=v1.3.0 + WEBP_VERSION=v1.4.0 EXTRA_DEP_PACKAGES="libboost-dev" - desc: clang14 C++20 avx2 exr3.1 ocio2.1 nametag: linux-clang14 @@ -376,12 +383,12 @@ jobs: cc_compiler: clang cxx_std: 20 fmt_ver: 10.1.1 + opencolorio_ver: v2.2.1 openexr_ver: v3.1.13 pybind11_ver: v2.12.0 python_ver: 3.8 simd: avx2,f16c setenvs: export LLVM_VERSION=14.0.0 - OPENCOLORIO_VERSION=v2.1.2 USE_OPENVDB=0 # The installed OpenVDB has a TLS conflict with Python 3.8 - desc: debug gcc9/C++17, sse4.2, exr3.1 @@ -425,7 +432,8 @@ jobs: OIIO_CMAKE_FLAGS=-DUSE_PYTHON=0 LLVM_VERSION=17.0.6 LLVM_DISTRO_NAME=ubuntu-22.04 SKIP_SYSTEM_DEPS_INSTALL=1 QT_VERSION=0 - OpenImageIO_BUILD_MISSING_DEPS=none + xOpenImageIO_BUILD_MISSING_DEPS=missing + OpenImageIO_OPTIONAL_DEPS=ALL runs-on: ${{ matrix.runner }} env: @@ -434,6 +442,7 @@ jobs: CMAKE_CXX_STANDARD: ${{matrix.cxx_std}} USE_SIMD: ${{matrix.simd}} FMT_VERSION: ${{matrix.fmt_ver}} + OPENCOLORIO_VERSION: ${{matrix.opencolorio_ver}} OPENEXR_VERSION: ${{matrix.openexr_ver}} PYBIND11_VERSION: ${{matrix.pybind11_ver}} PYTHON_VERSION: ${{matrix.python_ver}} diff --git a/CHANGES.md b/CHANGES.md index 54c25b819c..93c34ebdae 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,11 @@ Release 2.6 (Fall 2024) -- compared to 2.5 * *Robin-map*: minimum raised to 1.2.0 [#4287](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4287) (2.6.2.0) * *Pybind11*: 2.7 minimum [#4297](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4297) (2.6.2.0) * *libtiff*: 4.0 minimum (raised from 3.9) [#4296](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4296) (2.6.2.0) +* *GIF*: 5.0 minimum for giflib (from 4.0) [#4349](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4349) (2.6.3.0) +* *ffmpeg*: 4.0 minimum (from 3.0) [#4352](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4352) (2.6.3.0) +* *OpenCV*: 4.0 minimum (~2018) [#4353](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4353) (2.6.3.0) +* *WebP*: 1.1 minimum (from 0.6.1) [#4354](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4354) (2.6.3.0) +* *PNG*: 1.6.0 minimum for libPNG (from 1.5.13) [#4355](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4355) (2.6.3.0) ### ⛰️ New features and public API changes: @@ -26,7 +31,8 @@ Release 2.6 (Fall 2024) -- compared to 2.5 - `oiiotool --cryptomatte-colors` [#4093](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4093) (2.6.0.2) - New `--buildinfo` command prints build information, including version, compiler, and all library dependencies. [#4124](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4124) (2.6.0.3) [#4150](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4150) (2.6.0.3) - - *oiiotool*: Change command line embedding for oiiotool & maketx output [#4237](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4237) (2.6.2.0) + - Change command line embedding for oiiotool & maketx output [#4237](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4237) (2.6.2.0) + - Expression evaluation improvements: `BOTTOM` refers to the image on the bottom of the stack, `IMG[expression]` is now supported (previously only numeric literals were accepted as the index), check that label/variable names [#4334](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4334) (2.6.3.0) * *Utilities*: - *iv*: Implement Directory Argument Loading for iv [#4010](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4010) (by Chaitanya Sharma) (2.6.0.1) - *iv*: Split off the current image in iv into a separate window [#4017](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4017) (by Anton Dukhovnikov) (2.6.0.1) @@ -40,13 +46,19 @@ Release 2.6 (Fall 2024) -- compared to 2.5 - Only back ImageBuf with ImageCache when passed an IC [#3986](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3986) (2.6.0.1, 2.5.3.1) - Make ImageBuf::Iterator lazy in its making the image writable [#4033](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4033) (2.6.0.2) + - `IBA::perpixel_op()` is a new way to write IBA-like functions very + simply, only supplying the very inner part of the loop that operates on + one pixel. [#4299](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4299) + (2.6.3.0) * *New image file format support:* - - *JPEG XL*: Initial JPEG XL support for image input/output [#4055](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4055) (by Peter Kovář) + - *JPEG XL*: Initial JPEG XL support for image input/output [#4055](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4055) (by Peter Kovář) Exif and XML metadata support for JPEG XL [#4310](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4310) (by Vlad (Kuzmin) Erium) (2.6.3.0) - *R3D*: Add initial support to read R3D files. Note that this capability will only be enabled if OIIO is built with the R3D SDK installed and available to be found by the build system. [#4216](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4216) (by Peter Kovář) (2.6.2.0) * *TextureSystem*: Overload decode_wrapmode to support ustringhash [#4207](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4207) (by Chris Hellmuth) (2.6.1.0) -* *API Deprecations*: +* *API Deprecations*: (please see [the detailed deprecation list](docs/Deprecations-3.0.md)) - Various other minor deprecations of things that had been marked as - deprecated for a while in fmath.h [#4309](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4309) (2.6.2.0), typedesc.h [#4311](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4311) (2.6.2.0), simd.h [#4308](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4308) (2.6.2.0), assorted [#4234](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4234) (2.6.2.0). + deprecated for a while in fmath.h [#4309](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4309) (2.6.2.0), typedesc.h [#4311](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4311) (2.6.2.0), simd.h [#4308](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4308) (2.6.2.0), assorted [#4234](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4234) (2.6.2.0), texture.h [#4339](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4339) (2.6.3.0), imageio.h [#4312](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4312) (2.6.3.0), benchmark.h, bit.h, color.h, errorhandler.h [#4335](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4335), parmalist.h, parallel.h, strutil.h, sysutil.h, thread.h, tiffutils.h, ustring.h, type_traits.h [#4338](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4338) (2.6.3.0), imagebuf.h [#4341](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4341) (2.6.3.0), imagebufalgo.h [#4344](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4344) (2.6.3.0). + - The deprecated headers array_view.h and missing_math.h have been removed. [#4335](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4335) [#4338](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4338) (2.6.3.0) + - Make span::size() return size_t, not a signed type [#4332](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4332) (2.6.3.0) * *Build system dependency self-builders*: the cmake-based build system has been enhanced to give a report of what dependencies it found, what was missing, what was found but was a version too old for our requirement. @@ -57,6 +69,14 @@ Release 2.6 (Fall 2024) -- compared to 2.5 Additional dependencies will learn to self-build over time. [#4242](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4242) [#4294](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4294) +* The environment variable `OIIO_LIBRARY_PATH` that contains the search paths + for finding image file format plugins has been changed to be called + `OPENIMAGEIO_PLUGIN_PATH`. This is more consistent: all the "public API" + documented environment variables that are meant for users/sites to adjust + are named starting with `OPENIMAGEIO_`, whereas the prefix `OIIO_` is only + used for environment variables that are "unofficial" (undocumented, + temporary, or meant only for developers to use for debugging). [#4330](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4330) + (2.6.3.0) ### 🚀 Performance improvements: - *oiiotool*: `--mosaic` improvements to type conversion avoid unnecessary @@ -64,6 +84,8 @@ Release 2.6 (Fall 2024) -- compared to 2.5 - *simd*: Faster vint4 load/store with unsigned char conversion [#4071](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4071) (by Aras Pranckevičius) (2.6.0.2) - *perf/IBA*: Improve perf of IBA::channels in-place operation [#4088](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4088) (2.6.0.2) - *perf*: Overhaul of ColorConfig internals to solve perf issues [#3995](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3995) (2.6.0.1) + - *perf/TS*: Reduce TextureSystem memory by slimming down internal LevelInfo size [#4337](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4337) (by Curtis Black) (2.6.3.0) + - *TS*: Have maketx/IBA::make_texture only write full metadata to the first mip level. We presume that other than resolution and encoding-related information, other metadata should not be expected to differ between MIP levels of the same image. This saves file size and memory in the IC/TS. [#4320](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4320) (2.6.3.0) ### 🐛 Fixes and feature enhancements: - *errors*: Print unretrieved global error messages upon application exit. @@ -76,6 +98,7 @@ Release 2.6 (Fall 2024) -- compared to 2.5 - *iv*: Assume iv display gamma 2.2 [#4118](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4118) (2.6.0.3) - *dds*: DDS support more DXGI formats [#4220](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4220) (by alexguirre) (2.6.2.0) - *heic*: Don't auto-transform camera-rotated images [#4142](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4142) (2.6.0.3) [#4184](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4184) (2.6.1.0) + - *heic*: Correctly set imagespec size for heif images (by Gerrard Tai) (2.6.3.0) - *iff*: Refactor iffoutput.cpp for memory safety [#4144](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4144) (2.6.0.3) - *jpeg2000*: Include the headers we need to discern version [#4073](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4073) (2.6.0.2) - *jxl*: JPEG-XL improvements [#4252](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4252) (by Vlad (Kuzmin) Erium) (2.6.2.0) @@ -97,20 +120,22 @@ Release 2.6 (Fall 2024) -- compared to 2.5 - *psd*: Various PSD files fail to load correctly [#4302](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4302) (by Jesse Yurkovich) (2.6.2.0) - *raw*: LibRaw wavelet denoise options [#4028](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4028) (by Vlad (Kuzmin) Erium) (2.6.0.1) - *raw*: Avoid buffer overrun for flip direction cases [#4100](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4100) (2.6.0.3) + - *tiff*: Fix TIFF export with EXIF data and I/O proxy [#4300](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4300) (by jreichel-nvidia) (2.6.3.0) + - *dds/psd*: Always seek to the beginning of the ioproxy during open for DDS and PSD files [#4048](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4048) (by Jesse Yurkovich) (2.6.0.1) - *ImageBuf*: Fix crash when mutable Iterator used with read-IB [#3997](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3997) (2.6.0.1) - - *diff*: Fix issue when computing perceptual diff [#4061](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4061) (by Aura Munoz) (2.6.0.1) - - *iv*: Avoid crash with OpenGL + multi-channel images [#4087](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4087) (2.6.0.2) + - *ImageBuf*: Improve IB::nsubimages and other related fixes [#4228](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4228) (2.6.2.0) - *IBA*: IBA::to_OpenCV fails for ImageCache-backed images [#4013](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4013) (2.6.0.1) - - *dds/psd*: Always seek to the beginning of the ioproxy during open for DDS and PSD files [#4048](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4048) (by Jesse Yurkovich) (2.6.0.1) + - *diff*: Fix issue when computing perceptual diff [#4061](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4061) (by Aura Munoz) (2.6.0.1) - *fix(ImageInput)*: Only check REST arguments if the file does not exist, avoiding problems for filenames that legitimately contain a `?` character. [#4085](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4085) (by AdamMainsTL) (2.6.0.2) - *fix*: Certain int->float type conversions in TypeDesc/ParamValueList [#4132](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4132) (2.6.0.3) - *color management*: Automatically recognize some additional color space name synonyms: "srgb_texture", "lin_rec709" and "lin_ap1". Also add common permutation "srgb_tx" and "srgb texture" as additional aliases for "srgb". [#4166](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4166) - *security*: Don't use (DY)LD_LIBRARY_PATH as plugin search paths [#4245](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4245) (by Brecht Van Lommel) (2.6.2.0) - *fix*: Fix crash when no default fonts are found [#4249](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4249) (2.6.2.0) - - *TS*: Fix missing initialization in TextureOptBatch [#4226](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4226) (2.6.2.0) + - *TextureSystem*: Fix missing initialization in TextureOptBatch [#4226](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4226) (2.6.2.0) + - *iv*: Avoid crash with OpenGL + multi-channel images [#4087](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4087) (2.6.0.2) - *iv*: If OCIO env is not set or doesn't exist, have iv use built-in config [#4285](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4285) (2.6.2.0) - - *IB*: Improve IB::nsubimages and other related fixes [#4228](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4228) (2.6.2.0) - - *IC*: Simplify tile cache clearing. [#4292](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4292) (by Curtis Black) (2.6.2.0) + - *iv*: Iv should enable the ImageCache [#4326](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4326) (by Jesse Yurkovich) (2.6.3.0) + - *ImageCache*: Simplify tile cache clearing. [#4292](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4292) (by Curtis Black) (2.6.2.0) ### 🔧 Internals and developer goodies - *int*: Prevent infinite loop in bit_range_convert [#3996](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3996) (by Jesse Yurkovich) (2.6.0.1) @@ -124,6 +149,7 @@ Release 2.6 (Fall 2024) -- compared to 2.5 - *fmath.h*: One more fast_exp fix [#4275](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4275) (2.6.2.0) - *fmt.h*: Fix build break from recent fmt change [#4227](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4227) (2.6.2.0) - *hash.h*: Mismatched pragma push/pop in hash.h [#4182](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4182) (2.6.1.0) + - *imagebf.h*: Add `ImageBuf::wrapmode_name()`, inverse of wrapmode_from_string [#4340](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4340) (2.6.3.0) - *oiioversion.h*: Coalesce redundant STRINGIZE macros -> OIIO_STRINGIZE [#4121](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4121) (2.6.0.3) - *platform.h*: Belatedly change OIIO_CONSTEXPR14 to constexpr [#4153](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4153) (2.6.0.3) - *paramlist.h*: Add ParamValueSpan::get_bool() [#4303](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4303) (2.6.2.0) @@ -139,6 +165,7 @@ Release 2.6 (Fall 2024) -- compared to 2.5 - *span.h*: Span and range checking enhancements [#4125](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4125) (2.6.0.3) - *span.h*: Make span default ctr and assignment be `= default` [#4198](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4198) (2.6.1.0) - *strutil.h*: Add `Strutil::eval_as_bool()` [#4250](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4250) (2.6.2.0) + - *strutil.h*: Add `Strutil::string_is_identifier()` [#4333](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4333) (2.6.3.0) - *sysutil.h*: Deprecate Sysutil::physical_concurrency() [#4034](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4034) (2.6.0.1) - *texture.h*: Overload decode_wrapmode to support ustringhash [#4207](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4207) (by Chris Hellmuth) (2.6.1.0) - *typedesc.h*: Allow TypeDesc to have all the right POD attributes [#4162](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4162) (by Scott Wilson) (2.6.0.3) @@ -152,6 +179,7 @@ Release 2.6 (Fall 2024) -- compared to 2.5 - *fix*: Improve error messages when a font is not found [#4284](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4284) (2.6.2.0) - *refactor*: Oiiotool break out expression eval methods into separate file [#4256](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4256) (2.6.2.0) - *refactor*: Move most of imageio_pvt.h.in to just a regular .h [#4277](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4277) (2.6.2.0) + - *refactor*: Simplify openexr includes [#4304](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4304) (2.6.3.0) ### 🏗 Build/test/CI and platform ports: * CMake build system and scripts: @@ -242,6 +270,9 @@ Release 2.6 (Fall 2024) -- compared to 2.5 - *ci*: Typo in build_libtiff.bash [#4280](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4280) (2.6.2.0) - *ci*: For Windows CI, build only release of vcpkg packages [#4282](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4282) (2.6.2.0) - *ci*: New tets: oldest, hobbled, localbuilds [#4295](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4295) (2.6.2.0) + - *ci*: Fix GHA CI after they upgraded nodejs [#4324](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4324) (2.6.3.0) + - *ci*: Sanitizer new warnings about signed/unsigned offsets in openexr [#4351](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4351) (2.6.3.0) + - *ci*: Deal with CentOS 7 EOL and disappearance of yum mirrors [#4325](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4325) (2.6.3.0) * Platform support: - *win*: Fix building failed from source on Windows [#4235](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4235) (by Vic P) (2.6.2.0) @@ -269,6 +300,7 @@ Release 2.6 (Fall 2024) -- compared to 2.5 - *docs*: Update INSTALL.md for windows [#4279](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4279) (by Mel Massadian) (2.6.2.0) - *doc*: Add missing documentation of ImageBuf locking methods [#4267](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4267) (2.6.2.0) - *doc*: Fixes to formatting and sphinx warnings [#4301](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4301) (2.6.2.0) + - *security*: Document CVE-2024-40630 resolution (2.6.3.0) ### 🏢 Project Administration - *admin*: Repo rename -- fix all URL references [#3998](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3998) [#3999](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3999) @@ -278,10 +310,43 @@ Release 2.6 (Fall 2024) -- compared to 2.5 - *admin*: Add a ROADMAP document [#4161](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4161) (2.6.1.0) - *docs*: Better documentation of past CVE fixes in SECURITY.md [#4238](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4238) (2.6.2.0) - *admin*: More CLA explanation and how-to links [#4318](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4318) (2.6.2.0) + - *admin*: Add deprecation updates to the RELEASING checklist [#4345](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4345) (2.6.3.0) + - *admin*: Document my git-cliff workflow for release notes [#4319](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4319) (2.6.3.0) + --- +Release 2.5.13.1 (July 15, 2024) -- compared to 2.5.13.0 +-------------------------------------------------------- +- fix(heic): Correctly set imagespec size for heif images. + [security advisory](https://github.com/AcademySoftwareFoundation/OpenImageIO/security/advisories/GHSA-jjm9-9m4m-c8p2) CVE-2024-40630 (by Gerrard Tai) + +Release 2.5.13.0 (July 1, 2024) -- compared to 2.5.12.0 +------------------------------------------------------- +- *fix*: Various PSD files fail to load correctly [#4302](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4302) (by Jesse Yurkovich) +- *fix*: Improve error messages when a font is not found [#4284](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4284) +- *platform.h*: In platform.h, define OIIO_DEVICE macro [#4290](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4290) +- *ci*: Typo in build_libtiff.bash [#4280](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4280) +- *docs*: Update INSTALL.md for windows [#4279](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4279) (by Mel Massadian) +- *docs*: Fixes to formatting and sphinx warnings [#4301](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4301) + + +Release 2.5.12.0 (June 1, 2024) -- compared to 2.5.11.0 +------------------------------------------------------- +- *exr*: Add IOProxy support for EXR multipart output [#4263](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4263) [#4264](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4264) (by jreichel-nvidia) +- *pnm*: Improvements to pnm plugin: support for uint16 and 32-float, "pnm:bigendian" and "pnm:pfmflip" controls for output. [#4253](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4253) (by Vlad (Kuzmin) Erium) +- *ImageBuf*: Improve behavior of IB::nsubimages and other related fixes [#4228](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4228) +- *simd.h*: Fix longstanding problem with 16-wide bitcast for 8-wide HW [#4268](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4268) +- *strutil.h*: Add Strutil::eval_as_bool [#4250](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4250) +- *tests*: Add new heif test output [#4262](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4262) +- *tests*: Fix windows quoting for test [#4271](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4271) +- *build*: More warning elimination for clang18 [#4257](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4257) +- *build*: Add appropriate compiler defines and flags for SIMD with MSVC [#4266](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4266) (by Jesse Yurkovich) +- *build*: Gcc-14 support, testing, CI [#4270](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4270) +- *docs*: Fix stray references to the old repo home [#4255](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4255) + + Release 2.5.11.0 (May 1, 2024) -- compared to 2.5.10.0 ------------------------------------------------------- - *dds*: DDS support more DXGI formats [#4220](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4220) (by alexguirre) diff --git a/CMakeLists.txt b/CMakeLists.txt index aebb4eafd5..16398af606 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -265,11 +265,6 @@ if (NUKE_FOUND) add_subdirectory (src/nuke/txWriter) endif () -# Last minute site-specific instructions, if they exist -if (OIIO_SITE AND EXISTS "${PROJECT_SOURCE_DIR}/site/${OIIO_SITE}/cmake/sitecustom.cmake") - include ("${PROJECT_SOURCE_DIR}/site/${OIIO_SITE}/cmake/sitecustom.cmake") -endif () - # install pkgconfig file if (NOT MSVC) configure_file(src/build-scripts/OpenImageIO.pc.in "${CMAKE_BINARY_DIR}/OpenImageIO.pc" @ONLY) diff --git a/INSTALL.md b/INSTALL.md index db5412f8d0..91bf97d707 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -23,6 +23,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**. * **Imath >= 3.1** (tested through 3.1.x and main) * **OpenEXR >= 3.1** (tested through 3.2 and main) * **libTIFF >= 4.0** (tested through 4.6) + * **OpenColorIO >= 2.2** (tested through 2.3) * libjpeg >= 8 (tested through jpeg9e), or **libjpeg-turbo >= 2.1** (tested through 3.0) * **[fmtlib](https://github.com/fmtlib/fmt) >= 7.0** (tested through 10.2). @@ -38,10 +39,12 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**. * **Python >= 3.7** (tested through 3.12) * **pybind11 >= 2.7** (tested through 2.12) * NumPy + * If you want support for PNG files: + * **libPNG >= 1.6.0** (tested though 1.6.43) * If you want support for camera "RAW" formats: * **LibRaw >= 0.20** (tested though 0.21.2) * If you want support for a wide variety of video formats: - * ffmpeg >= 3.0 (tested through 7.0) + * **ffmpeg >= 4.0** (tested through 7.0) * If you want support for jpeg 2000 images: * OpenJpeg >= 2.0 (tested through 2.5; we recommend 2.4 or higher for multithreading support) @@ -52,10 +55,9 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**. * TBB >= 2018 (tested through 2021 and OneTBB) * If you want support for converting to and from OpenCV data structures, or for capturing images from a camera: - * OpenCV 3.x, or 4.x (tested through 4.9) + * **OpenCV 4.x** (tested through 4.10) * If you want support for GIF images: - * giflib >= 4.1 (tested through 5.2; 5.0+ is strongly recommended for - stability and thread safety) + * **giflib >= 5.0** (tested through 5.2) * If you want support for HEIF/HEIC or AVIF images: * libheif >= 1.3 (1.7 required for AVIF support, 1.16 required for correct orientation support, tested through 1.17.6) @@ -64,9 +66,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**. * If you want support for DICOM medical image files: * DCMTK >= 3.6.1 (tested through 3.6.8) * If you want support for WebP images: - * WebP >= 0.6.1 (tested through 1.4) - * If you want support for OpenColorIO color transformations: - * OpenColorIO >= 1.1 (tested through 2.3; 2.0+ is recommended) + * **WebP >= 1.1** (tested through 1.4) * If you want support for Ptex: * Ptex >= 2.3.1 (probably works for older; tested through 2.4.2) * If you want to be able to do font rendering into images: diff --git a/LICENSE-BSD.md b/LICENSE-BSD.md deleted file mode 100644 index de10a34492..0000000000 --- a/LICENSE-BSD.md +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2008-present by Contributors to the OpenImageIO project. -All Rights Reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index fdcaa2d03b..220a228cb8 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ For original code, we use the [Apache-2.0 license](LICENSE.md), and for documentation, the [Creative Commons Attribution 4.0 Unported License](http://creativecommons.org/licenses/by/4.0/). In 2023 we asked historical users to [relicense](RELICENSING.md) from the original BSD-3-clause -license to Apache-2.0, and over 99.75% of lines of code have been relicensed +license to Apache-2.0, and over 99.86% of lines of code have been relicensed to Apache-2.0. A small amount of code incorporated into this repository from other projects are covered by compatible [third-party open source licenses](THIRD-PARTY.md). diff --git a/RELEASING.md b/RELEASING.md index 64192bb2a4..1df82d3aff 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -155,7 +155,34 @@ have a heading added at the top for the *next* version. pages), and that the [INSTALL.md](../INSTALL.md) file correctly documents the version ranges that we expect to work and that we actively test. -2. Release notes: [CHANGES.md](../CHANGES.md) should be updated to reflect +2. Update deprecations: Deprecations tend to happen in stages, spread over a + few releases, taking steps forward depending on what kind of release is + occurring: + + - Tweak releases (a.b.c.d -> a.b.c.D+1): should not introduce new + deprecations. + - Monthly patch releases (a.b.c.d -> a.b.C+1.0): advertise that a function + is deprecated in its comments, documentation, and release notes. Remember + that these releases are not allowed to break ABI/link compatibility. + - Annual minor releases (a.b.c.d -> a.B+1.0.0): functions previously + marked/documented as deprecated should receive deprecation warnings by + adding `OIIO_DEPRECATED` macros to function or class declarations where + possible, if that has not already been done. Use good judgment about + whether to add these warnings, or postpone to a later release, based on + the amount of disruption that they will likely cause, and how important + it is to rapidly discourage people from using the deprecated function. + For a minor release, we don't allow backwards-incompatible API changes, + so only *remove* a function if there is another function that will accept + the same call signature in the source code. It's allowed to break ABI for + minor releases, so it's ok/encouraged to make a deprecated function from + linked to inline, for example (which might allow it to be removed later + without an ABI change). + - Major releases (a.b.c.d -> A+1.b.c.d): API compatibility breaks are + allowed here, so this is the time to completely remove any functions that + have already had a full minor release where they had been given + deprecation warning macros. + +3. Release notes: [CHANGES.md](../CHANGES.md) should be updated to reflect all the new features and fixes. Looking at the notes from older releases should provide a good example of what we're aiming for. @@ -168,7 +195,7 @@ have a heading added at the top for the *next* version. internals and developer goodies, testing/CI/ports, etc.) and ordered for readability and relevance. -3. Ensure docs are up to date: +4. Ensure docs are up to date: - [README.md](README.md): Actually read it! Make sure it all seems accurate and up to date. @@ -182,7 +209,7 @@ have a heading added at the top for the *next* version. ensure it's building correctly and doesn't have any obvious errors, especially the parts that describe new features. -4. Make sure the the top-level CMakeLists.txt file is updated: +5. Make sure the the top-level CMakeLists.txt file is updated: - The `OpenImageIO_VERSION` should be correct. - The `PROJECT_VERSION_RELEASE_TYPE` variable should be set to "alpha" or @@ -192,14 +219,14 @@ have a heading added at the top for the *next* version. - The `${PROJECT_NAME}_SUPPORTED_RELEASE` variable should be `ON` for any release branch, `OFF` for master. -5. In the https://github.com/AcademySoftwareFoundation/OpenImageIO-images project, create a branch +6. In the https://github.com/AcademySoftwareFoundation/OpenImageIO-images project, create a branch `dev-x.y` for the major/minor branch, and in the main oiio repo, update src/build-scripts/install_test_images.bash to specify `-b dev-x.y` in the checkout of oiio-images to ensure CI tests are against the set of test images corresponding to that major/minor release (just in the branch, not in master!). -6. Make sure everything passes the usual CI workflow. Also check the daily or +7. Make sure everything passes the usual CI workflow. Also check the daily or weekly "analysis" workflows to make sure there aren't any important warnings that should be fixed. diff --git a/RELICENSING.md b/RELICENSING.md index a8658d729a..c6390ca009 100644 --- a/RELICENSING.md +++ b/RELICENSING.md @@ -2,7 +2,11 @@ New code entering the OpenImageIO repository from July 1 2023 onward is subject to the [Apache 2.0 license](LICENSE.md). Code dating from earlier than July 1 2023 was contributed under the [BSD -3-clause license](LICENSE-BSD-3-Clause.md), unless relicensed below. +3-clause license](https://opensource.org/license/bsd-3-clause), unless +relicensed below. + +Stragglers who haven't relicensed yet, it's never too late, just sign onto the +PR: https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3905 The following copyright holders agree that all of their contributions originally submitted to this project under the 3-Clause BSD License are hereby @@ -137,9 +141,13 @@ the Developer Certificate of Origin, version 1.1: - Damien Courtois (ix-dcourtois) - Carl Rand (crand) - Gregor Mückl (gmueckl) +- Jep Hill (jephill) +- John Haddon (johnhaddon) +... -**Prior authors, please submit a PR against this file that adds your name -above. If, at the time of your prior contributions, you were employed by a +**Prior authors, please follow the directions for adding your name to +[this PR](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3905). +If, at the time of your prior contributions, you were employed by a company who would have owned your IP output, then please have someone from that company who is authorized to do so submit a PR to add their company’s name to the list under the statement in this file.** diff --git a/THIRD-PARTY.md b/THIRD-PARTY.md index 17f4a882bd..96e2a1523a 100644 --- a/THIRD-PARTY.md +++ b/THIRD-PARTY.md @@ -9,15 +9,15 @@ In no particular order: ------------------------------------------------------------------------- -BSD 3-Clause License +BSD 3-Clause License (https://opensource.org/license/bsd-3-clause) SPDX-License-Identifier: BSD-3-Clause * OpenImageIO prior to July 1, 2023 Code that was contributed to OpenImageIO prior to July 1 2023, and has not - yet been [relicensed](RELICENSING.md), was contributed under the [BSD - 3-clause license](LICENSE-BSD.md). Currently, this is less than 2% of the - codebase (by lines of code). + yet been [relicensed](RELICENSING.md), was contributed under the BSD + 3-clause license. Currently, less than 0.15% of the codebase (by lines of + code) remains under this license. * Gelato, Copyright (c) 2004 by NVIDIA Corp. diff --git a/docs/Deprecations-3.0.md b/docs/Deprecations-3.0.md index bef5af6f8e..3200e3ea28 100644 --- a/docs/Deprecations-3.0.md +++ b/docs/Deprecations-3.0.md @@ -138,6 +138,16 @@ about being deprecated will be removed in the final 3.0 release. been considered deprecated since OIIO 2.3. Please use task functions that do not take a thread ID parameter. +## platform.h + +* Removed macros `OIIO_CONSTEXPR`, `OIIO_CONSTEXPR14`, and + `OIIO_CONSTEXPR_OR_CONST` and deprecated `OIIO_CONSTEXPR17` (use regular C++ + `constexpr` in place of all of these). Removed macro `OIIO_NOEXCEPT` (use + C++ `noexcept`). +* Removed macro `OIIO_UNUSED_OK`, which had been deprecated since 2.0. Marked + `OIIO_MAYBE_UNUSED` as deprecated as well, now that C++17 is the minimum, + there's no reason not to directly use the C++ attribute `[[maybe_unused]]`. + ## strutil.h * Added deprecation warnings to all the old (printf-convention) string diff --git a/src/build-scripts/build_opencolorio.bash b/src/build-scripts/build_opencolorio.bash index ef37c121ad..b5018bc13c 100755 --- a/src/build-scripts/build_opencolorio.bash +++ b/src/build-scripts/build_opencolorio.bash @@ -11,7 +11,7 @@ set -ex # Which OCIO to retrieve, how to build it OPENCOLORIO_REPO=${OPENCOLORIO_REPO:=https://github.com/AcademySoftwareFoundation/OpenColorIO.git} -OPENCOLORIO_VERSION=${OPENCOLORIO_VERSION:=v2.2.1} +OPENCOLORIO_VERSION=${OPENCOLORIO_VERSION:=v2.3.2} # Where to install the final results LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext} @@ -19,6 +19,7 @@ OPENCOLORIO_SOURCE_DIR=${OPENCOLORIO_SOURCE_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO} OPENCOLORIO_BUILD_DIR=${OPENCOLORIO_BUILD_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO-build} OPENCOLORIO_INSTALL_DIR=${OPENCOLORIO_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist} OPENCOLORIO_BUILD_TYPE=${OPENCOLORIO_BUILD_TYPE:=Release} +OPENCOLORIO_CXX=${OPENCOLORIO_CXX:=g++} OPENCOLORIO_CXX_FLAGS=${OPENCOLORIO_CXX_FLAGS:="-Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"} # Just need libs: OPENCOLORIO_BUILDOPTS="-DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_NUKE=OFF \ @@ -46,6 +47,7 @@ git checkout ${OPENCOLORIO_VERSION} --force time cmake -S . -B ${OPENCOLORIO_BUILD_DIR} \ -DCMAKE_BUILD_TYPE=${OPENCOLORIO_BUILD_TYPE} \ -DCMAKE_INSTALL_PREFIX=${OPENCOLORIO_INSTALL_DIR} \ + -DCMAKE_CXX_COMPILER=${OPENCOLORIO_CXX} \ -DCMAKE_CXX_FLAGS="${OPENCOLORIO_CXX_FLAGS}" \ ${OPENCOLORIO_BUILDOPTS} time cmake --build ${OPENCOLORIO_BUILD_DIR} --config Release --target install diff --git a/src/build-scripts/build_webp.bash b/src/build-scripts/build_webp.bash index e6e3864794..8af015f683 100755 --- a/src/build-scripts/build_webp.bash +++ b/src/build-scripts/build_webp.bash @@ -11,7 +11,7 @@ set -ex # Repo and branch/tag/commit of webp to download if we don't have it yet WEBP_REPO=${WEBP_REPO:=https://github.com/webmproject/libwebp.git} -WEBP_VERSION=${WEBP_VERSION:=v1.1.0} +WEBP_VERSION=${WEBP_VERSION:=v1.4.0} # Where to put webp repo source (default to the ext area) LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext} @@ -47,7 +47,7 @@ if [[ -z $DEP_DOWNLOAD_ONLY ]]; then -DWEBP_BUILD_GIF2WEBPx=OFF \ -DWEBP_BUILD_IMG2WEBP=OFF \ -DWEBP_BUILD_EXTRAS=OFF \ - -DBUILD_SHARED_LIBS=ON \ + -DBUILD_SHARED_LIBS=${WEBP_BUILD_SHARED_LIBS:-ON} \ ${WEBP_CONFIG_OPTS} time cmake --build ${WEBP_BUILD_DIR} --target install fi diff --git a/src/build-scripts/ci-build.bash b/src/build-scripts/ci-build.bash index e5dfaf6c3f..fa5857abaf 100755 --- a/src/build-scripts/ci-build.bash +++ b/src/build-scripts/ci-build.bash @@ -43,7 +43,7 @@ cmake -S $OIIO_SRC_DIR -B $OIIO_BUILD_DIR -G "$CMAKE_GENERATOR" \ $OIIO_CMAKE_FLAGS -DVERBOSE=1 # Save a copy of the generated files for debugging broken CI builds. -mkdir ${OIIO_BUILD_DIR}/cmake-save || /bin/true +mkdir ${OIIO_BUILD_DIR}/cmake-save || true cp -r ${OIIO_BUILD_DIR}/CMake* ${OIIO_BUILD_DIR}/*.cmake ${OIIO_BUILD_DIR}/cmake-save : ${BUILDTARGET:=install} diff --git a/src/build-scripts/ci-startup.bash b/src/build-scripts/ci-startup.bash index bb49fd3311..527f29d594 100755 --- a/src/build-scripts/ci-startup.bash +++ b/src/build-scripts/ci-startup.bash @@ -44,7 +44,6 @@ export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib64:$LD_LIBRARY_PATH export DYLD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$DYLD_LIBRARY_PATH -# export OCIO="$PWD/testsuite/common/OpenColorIO/nuke-default/config.ocio" export TESTSUITE_CLEANUP_ON_SUCCESS=${TESTSUITE_CLEANUP_ON_SUCCESS:=1} # For CI, default to building missing dependencies automatically diff --git a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in index 30d4e3a5d2..2620994b38 100644 --- a/src/cmake/Config.cmake.in +++ b/src/cmake/Config.cmake.in @@ -21,6 +21,7 @@ if (NOT @BUILD_SHARED_LIBS@) # INTERFACE_LINK_LIBRARIES. If the project does not know about PNG target, it will cause # configuration error about unknown targets being linked in. find_dependency(TIFF) + find_dependency(OpenColorIO) if (@JPEG_FOUND@) find_dependency(JPEG) endif() diff --git a/src/cmake/build_OpenColorIO.cmake b/src/cmake/build_OpenColorIO.cmake index 5905eb597a..6e772245f0 100644 --- a/src/cmake/build_OpenColorIO.cmake +++ b/src/cmake/build_OpenColorIO.cmake @@ -15,6 +15,14 @@ set_cache (OpenColorIO_BUILD_SHARED_LIBS ON # it all work with the static dependencies, it just makes things complicated # downstream. +# Clear variables from the failed find_package +unset (OPENCOLORIO_LIBRARY) +unset (OPENCOLORIO_INCLUDE_DIR) +unset (FIND_PACKAGE_MESSAGE_DETAILS_OpenColorIO) +unset (OPENCOLORIO_VERSION_MAJOR) +unset (OPENCOLORIO_VERSION_MINOR) +unset (OpenColorIO_DIR) + string (MAKE_C_IDENTIFIER ${OpenColorIO_BUILD_VERSION} OpenColorIO_VERSION_IDENT) build_dependency_with_cmake(OpenColorIO @@ -35,8 +43,8 @@ build_dependency_with_cmake(OpenColorIO -D OCIO_INSTALL_EXT_PACKAGES=MISSING # Give the library a custom name and symbol namespace so it can't # conflict with any others in the system or linked into the same app. - -D OCIO_NAMESPACE=${PROJ_NAMESPACE_V}_OpenColorIO - -D OCIO_LIBNAME_SUFFIX=_v${OpenColorIO_VERSION_IDENT}_${PROJ_NAMESPACE_V} + # -D OCIO_NAMESPACE=${OpenColorIO_VERSION_IDENT}_${PROJ_NAME} + -D OCIO_LIBNAME_SUFFIX=_v${OpenColorIO_VERSION_IDENT}_${PROJ_NAME} ) # Set some things up that we'll need for a subsequent find_package to work @@ -46,8 +54,9 @@ set (OpenColorIO_ROOT ${OpenColorIO_LOCAL_INSTALL_DIR}) set (OpenColorIO_DIR ${OpenColorIO_LOCAL_INSTALL_DIR}) # Signal to caller that we need to find again at the installed location -set (OpenColorIO_REFIND TRUE) -set (OpenColorIO_REFIND_ARGS CONFIG) +# set (OpenColorIO_REFIND TRUE) +# set (OpenColorIO_REFIND_ARGS CONFIG) +find_package (OpenColorIO ${OpenColorIO_BUILD_VERSION} EXACT CONFIG REQUIRED) if (OpenColorIO_BUILD_SHARED_LIBS) install_local_dependency_libs (OpenColorIO OpenColorIO) diff --git a/src/cmake/compiler.cmake b/src/cmake/compiler.cmake index 844fce09c9..fb2b2c20ab 100644 --- a/src/cmake/compiler.cmake +++ b/src/cmake/compiler.cmake @@ -28,7 +28,7 @@ message (VERBOSE "CMAKE_CXX_COMPILE_FEATURES = ${CMAKE_CXX_COMPILE_FEATURES}") # set (CMAKE_CXX_MINIMUM 17) set (CMAKE_CXX_STANDARD 17 CACHE STRING - "C++ standard to build with (14, 17, 20, etc.) Minimum is ${CMAKE_CXX_MINIMUM}.") + "C++ standard to build with (17, 20, etc.) Minimum is ${CMAKE_CXX_MINIMUM}.") set (DOWNSTREAM_CXX_STANDARD 17 CACHE STRING "C++ minimum standard to impose on downstream clients") set (CMAKE_CXX_STANDARD_REQUIRED ON) @@ -69,13 +69,17 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER MATCHES "[Cc]lan set (CMAKE_CXX_COMPILER_ID "AppleClang") set (CMAKE_COMPILER_IS_APPLECLANG 1) string (REGEX REPLACE ".* version ([0-9]+\\.[0-9]+).*" "\\1" APPLECLANG_VERSION_STRING ${clang_full_version_string}) + set (ANY_CLANG_VERSION_STRING ${APPLECLANG_VERSION_STRING}) message (VERBOSE "The compiler is Clang: ${CMAKE_CXX_COMPILER_ID} version ${APPLECLANG_VERSION_STRING}") elseif (CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM") set (CMAKE_COMPILER_IS_INTELCLANG 1) string (REGEX MATCH "[0-9]+(\\.[0-9]+)+" INTELCLANG_VERSION_STRING ${clang_full_version_string}) + set (ANY_CLANG_VERSION_STRING ${INTELCLANG_VERSION_STRING}) message (VERBOSE "The compiler is Intel Clang: ${CMAKE_CXX_COMPILER_ID} version ${INTELCLANG_VERSION_STRING}") else () + set (CMAKE_COMPILER_IS_GENERICCLANG 1) string (REGEX REPLACE ".* version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION_STRING ${clang_full_version_string}) + set (ANY_CLANG_VERSION_STRING ${CLANG_VERSION_STRING}) message (VERBOSE "The compiler is Clang: ${CMAKE_CXX_COMPILER_ID} version ${CLANG_VERSION_STRING}") endif () elseif (CMAKE_CXX_COMPILER_ID MATCHES "Intel") diff --git a/src/cmake/dependency_utils.cmake b/src/cmake/dependency_utils.cmake index a1470a1c70..99504819db 100644 --- a/src/cmake/dependency_utils.cmake +++ b/src/cmake/dependency_utils.cmake @@ -74,57 +74,55 @@ endfunction () # Helper: Print a report about missing dependencies and give insructions on # how to turn on automatic local dependency building. function (print_package_notfound_report) - if (CFP_ALL_BUILD_DEPS_NOTFOUND OR CFP_ALL_BUILD_DEPS_BADVERSION) - message (STATUS) - message (STATUS "${ColorBoldYellow}=========================================================================${ColorReset}") - message (STATUS "${ColorBoldYellow}= Dependency report =${ColorReset}") - message (STATUS "${ColorBoldYellow}=========================================================================${ColorReset}") - message (STATUS) - if (CFP_EXTERNAL_BUILD_DEPS_FOUND) - message (STATUS "${ColorBoldWhite}The following dependencies found externally:${ColorReset}") - list (SORT CFP_EXTERNAL_BUILD_DEPS_FOUND CASE INSENSITIVE) - list (REMOVE_DUPLICATES CFP_EXTERNAL_BUILD_DEPS_FOUND) - foreach (_pkg IN LISTS CFP_EXTERNAL_BUILD_DEPS_FOUND) - message (STATUS " ${_pkg} ${${_pkg}_VERSION}") - endforeach () - endif () - if (CFP_ALL_BUILD_DEPS_BADVERSION) - message (STATUS "${ColorBoldWhite}The following dependencies were found but were too old:${ColorReset}") - list (SORT CFP_ALL_BUILD_DEPS_BADVERSION CASE INSENSITIVE) - list (REMOVE_DUPLICATES CFP_ALL_BUILD_DEPS_BADVERSION) - foreach (_pkg IN LISTS CFP_ALL_BUILD_DEPS_BADVERSION) - if (_pkg IN_LIST CFP_LOCALLY_BUILT_DEPS) - message (STATUS " ${_pkg} ${${_pkg}_NOT_FOUND_EXPLANATION} ${ColorMagenta}(${${_pkg}_VERSION} BUILT LOCALLY)${ColorReset}") - else () - message (STATUS " ${_pkg} ${${_pkg}_NOT_FOUND_EXPLANATION}") - endif () - endforeach () - endif () - if (CFP_ALL_BUILD_DEPS_NOTFOUND) - message (STATUS "${ColorBoldWhite}The following dependencies were not found:${ColorReset}") - list (SORT CFP_ALL_BUILD_DEPS_NOTFOUND CASE INSENSITIVE) - list (REMOVE_DUPLICATES CFP_ALL_BUILD_DEPS_NOTFOUND) - foreach (_pkg IN LISTS CFP_ALL_BUILD_DEPS_NOTFOUND) - if (_pkg IN_LIST CFP_LOCALLY_BUILT_DEPS) - message (STATUS " ${_pkg} ${_${_pkg}_version_range} ${${_pkg}_NOT_FOUND_EXPLANATION} ${ColorMagenta}(${${_pkg}_VERSION} BUILT LOCALLY)${ColorReset}") - else () - message (STATUS " ${_pkg} ${_${_pkg}_version_range} ${${_pkg}_NOT_FOUND_EXPLANATION}") - endif () - endforeach () - endif () - if (CFP_LOCALLY_BUILDABLE_DEPS_NOTFOUND OR CFP_LOCALLY_BUILDABLE_DEPS_BADVERSION) - message (STATUS) - message (STATUS "${ColorBoldWhite}For some of these, we can build them locally:${ColorReset}") - foreach (_pkg IN LISTS CFP_LOCALLY_BUILDABLE_DEPS_NOTFOUND CFP_LOCALLY_BUILDABLE_DEPS_BADVERSION) - message (STATUS " ${_pkg}") - endforeach () - message (STATUS "${ColorBoldWhite}To build them automatically if not found, build again with option:${ColorReset}") - message (STATUS " ${ColorBoldGreen}-D${PROJECT_NAME}_BUILD_MISSING_DEPS=all${ColorReset}") - endif () - message (STATUS) - message (STATUS "${ColorBoldYellow}=========================================================================${ColorReset}") + message (STATUS) + message (STATUS "${ColorBoldYellow}=========================================================================${ColorReset}") + message (STATUS "${ColorBoldYellow}= Dependency report =${ColorReset}") + message (STATUS "${ColorBoldYellow}=========================================================================${ColorReset}") + message (STATUS) + if (CFP_EXTERNAL_BUILD_DEPS_FOUND) + message (STATUS "${ColorBoldWhite}The following dependencies found externally:${ColorReset}") + list (SORT CFP_EXTERNAL_BUILD_DEPS_FOUND CASE INSENSITIVE) + list (REMOVE_DUPLICATES CFP_EXTERNAL_BUILD_DEPS_FOUND) + foreach (_pkg IN LISTS CFP_EXTERNAL_BUILD_DEPS_FOUND) + message (STATUS " ${_pkg} ${${_pkg}_VERSION}") + endforeach () + endif () + if (CFP_ALL_BUILD_DEPS_BADVERSION) + message (STATUS "${ColorBoldWhite}The following dependencies were found but were too old:${ColorReset}") + list (SORT CFP_ALL_BUILD_DEPS_BADVERSION CASE INSENSITIVE) + list (REMOVE_DUPLICATES CFP_ALL_BUILD_DEPS_BADVERSION) + foreach (_pkg IN LISTS CFP_ALL_BUILD_DEPS_BADVERSION) + if (_pkg IN_LIST CFP_LOCALLY_BUILT_DEPS) + message (STATUS " ${_pkg} ${${_pkg}_NOT_FOUND_EXPLANATION} ${ColorMagenta}(${${_pkg}_VERSION} BUILT LOCALLY)${ColorReset}") + else () + message (STATUS " ${_pkg} ${${_pkg}_NOT_FOUND_EXPLANATION}") + endif () + endforeach () + endif () + if (CFP_ALL_BUILD_DEPS_NOTFOUND) + message (STATUS "${ColorBoldWhite}The following dependencies were not found:${ColorReset}") + list (SORT CFP_ALL_BUILD_DEPS_NOTFOUND CASE INSENSITIVE) + list (REMOVE_DUPLICATES CFP_ALL_BUILD_DEPS_NOTFOUND) + foreach (_pkg IN LISTS CFP_ALL_BUILD_DEPS_NOTFOUND) + if (_pkg IN_LIST CFP_LOCALLY_BUILT_DEPS) + message (STATUS " ${_pkg} ${_${_pkg}_version_range} ${${_pkg}_NOT_FOUND_EXPLANATION} ${ColorMagenta}(${${_pkg}_VERSION} BUILT LOCALLY)${ColorReset}") + else () + message (STATUS " ${_pkg} ${_${_pkg}_version_range} ${${_pkg}_NOT_FOUND_EXPLANATION}") + endif () + endforeach () + endif () + if (CFP_LOCALLY_BUILDABLE_DEPS_NOTFOUND OR CFP_LOCALLY_BUILDABLE_DEPS_BADVERSION) message (STATUS) + message (STATUS "${ColorBoldWhite}For some of these, we can build them locally:${ColorReset}") + foreach (_pkg IN LISTS CFP_LOCALLY_BUILDABLE_DEPS_NOTFOUND CFP_LOCALLY_BUILDABLE_DEPS_BADVERSION) + message (STATUS " ${_pkg}") + endforeach () + message (STATUS "${ColorBoldWhite}To build them automatically if not found, build again with option:${ColorReset}") + message (STATUS " ${ColorBoldGreen}-D${PROJECT_NAME}_BUILD_MISSING_DEPS=all${ColorReset}") endif () + message (STATUS) + message (STATUS "${ColorBoldYellow}=========================================================================${ColorReset}") + message (STATUS) endfunction () diff --git a/src/cmake/externalpackages.cmake b/src/cmake/externalpackages.cmake index 14c451f62e..f4fe8320ea 100644 --- a/src/cmake/externalpackages.cmake +++ b/src/cmake/externalpackages.cmake @@ -118,7 +118,7 @@ endif () # Dependencies for optional formats and features. If these are not found, # we will continue building, but the related functionality will be disabled. -checked_find_package (PNG) +checked_find_package (PNG VERSION_MIN 1.6.0) checked_find_package (BZip2) # Used by ffmpeg and freetype if (NOT BZIP2_FOUND) @@ -129,27 +129,17 @@ checked_find_package (Freetype VERSION_MIN 2.10.0 DEFINITIONS USE_FREETYPE=1 ) -checked_find_package (OpenColorIO - VERSION_MIN 1.1 +checked_find_package (OpenColorIO REQUIRED + VERSION_MIN 2.2 VERSION_MAX 2.9 - NO_FP_RANGE_CHECK - DEFINITIONS USE_OCIO=1 USE_OPENCOLORIO=1 - ) -if (OpenColorIO_FOUND) - option (OIIO_DISABLE_BUILTIN_OCIO_CONFIGS - "For deveoper debugging/testing ONLY! Disable OCIO 2.2 builtin configs." OFF) - if (OIIO_DISABLE_BUILTIN_OCIO_CONFIGS OR "$ENV{OIIO_DISABLE_BUILTIN_OCIO_CONFIGS}") - add_compile_definitions(OIIO_DISABLE_BUILTIN_OCIO_CONFIGS) - endif () - if (NOT OPENCOLORIO_INCLUDES) - get_target_property(OPENCOLORIO_INCLUDES OpenColorIO::OpenColorIO INTERFACE_INCLUDE_DIRECTORIES) - endif () -else () - set (OpenColorIO_FOUND 0) + PREFER_CONFIG + ) +if (NOT OPENCOLORIO_INCLUDES) + get_target_property(OPENCOLORIO_INCLUDES OpenColorIO::OpenColorIO INTERFACE_INCLUDE_DIRECTORIES) endif () include_directories(BEFORE ${OPENCOLORIO_INCLUDES}) -checked_find_package (OpenCV 3.0 +checked_find_package (OpenCV 4.0 DEFINITIONS USE_OPENCV=1) # Intel TBB @@ -161,11 +151,9 @@ checked_find_package (TBB 2017 # DCMTK is used to read DICOM images checked_find_package (DCMTK CONFIG VERSION_MIN 3.6.1) -checked_find_package (FFmpeg VERSION_MIN 3.0) -checked_find_package (GIF - VERSION_MIN 4 - RECOMMEND_MIN 5.0 - RECOMMEND_MIN_REASON "for stability and thread safety") +checked_find_package (FFmpeg VERSION_MIN 4.0) + +checked_find_package (GIF VERSION_MIN 5.0) # For HEIF/HEIC/AVIF formats checked_find_package (Libheif VERSION_MIN 1.3 @@ -199,9 +187,7 @@ if (NOT Ptex_FOUND OR NOT Ptex_VERSION) checked_find_package (Ptex) endif () -checked_find_package (WebP) -# Note: When WebP 1.1 (released late 2019) is our minimum, we can use their -# exported configs and remove our FindWebP.cmake module. +checked_find_package (WebP VERSION_MIN 1.1) option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF) checked_find_package (R3DSDK NO_RECORD_NOTFOUND) # RED camera diff --git a/src/cmake/modules/FindOpenColorIO.cmake b/src/cmake/modules/FindOpenColorIO.cmake deleted file mode 100644 index 474813917b..0000000000 --- a/src/cmake/modules/FindOpenColorIO.cmake +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright Contributors to the OpenImageIO project. -# SPDX-License-Identifier: Apache-2.0 -# https://github.com/AcademySoftwareFoundation/OpenImageIO - -# Module to find OpenColorIO -# -# This module will first look into the directories hinted by the variables: -# - OpenColorIO_ROOT -# -# This module defines the following targets: -# -# - OpenColorIO::OpenColorIO -# -# Old style CMake, this module also defines the following variables: -# -# OpenColorIO_FOUND - True if OpenColorIO was found. -# OPENCOLORIO_INCLUDES - where to find OpenColorIO.h -# OPENCOLORIO_LIBRARIES - list of libraries to link against when using OpenColorIO -# OPENCOLORIO_DEFINITIONS - Definitions needed when using OpenColorIO -# -# Hints and overrides: -# -# - OPENCOLORIO_INTERFACE_LINK_LIBRARIES - override for interface link -# libraries on the OpenColorIO::OpenColorIO target. -# - OPENCOLORIO_NO_CONFIG - if ON, this module will be used even if an -# OCIO >= 2.1 cmake config is found. If OFF (the default), a config file -# will be preferred if found. -# -# OpenColorIO 2.1 exports proper cmake config files on its own. -# Once OCIO 2.1 is our new minimum, this FindOpenColorIO.cmake will -# eventually be deprecated and disappear. -# - -if (NOT OPENCOLORIO_NO_CONFIG) - find_package(OpenColorIO CONFIG) -endif () - -if (TARGET OpenColorIO::OpenColorIO) - if (OPENCOLORIO_INTERFACE_LINK_LIBRARIES) - set_target_properties(OpenColorIO::OpenColorIO PROPERTIES - INTERFACE_LINK_LIBRARIES "${OPENCOLORIO_INTERFACE_LINK_LIBRARIES}") - endif () - -else () -# vvvv the rest is if no OCIO exported config file is found - -include (FindPackageHandleStandardArgs) -include (FindPackageMessage) - -find_path (OPENCOLORIO_INCLUDE_DIR - OpenColorIO/OpenColorIO.h - HINTS - ${OPENCOLORIO_INCLUDE_PATH} - ENV OPENCOLORIO_INCLUDE_PATH - PATHS - /sw/include - /opt/local/include - DOC "The directory where OpenColorIO/OpenColorIO.h resides") - -if (EXISTS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h") - # Search twice, because this symbol changed between OCIO 1.x and 2.x - file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" TMP - REGEX "^#define OCIO_VERSION_STR[ \t].*$") - if (NOT TMP) - file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" TMP - REGEX "^#define OCIO_VERSION[ \t].*$") - endif () - string (REGEX MATCHALL "([0-9]+)\\.([0-9]+)\\.[0-9]+" OPENCOLORIO_VERSION ${TMP}) - set (OPENCOLORIO_VERSION_MAJOR ${CMAKE_MATCH_1}) - set (OPENCOLORIO_VERSION_MINOR ${CMAKE_MATCH_2}) -endif () - -find_library (OPENCOLORIO_LIBRARY - NAMES - OpenColorIO - OpenColorIO_${OPENCOLORIO_VERSION_MAJOR}_${OPENCOLORIO_VERSION_MINOR} - HINTS - ${OPENCOLORIO_LIBRARY_PATH} - ENV OPENCOLORIO_LIBRARY_PATH - PATHS - /usr/lib64 - /usr/local/lib64 - /sw/lib - /opt/local/lib - DOC "The OCIO library") - -find_package_handle_standard_args (OpenColorIO - REQUIRED_VARS OPENCOLORIO_INCLUDE_DIR OPENCOLORIO_LIBRARY - FOUND_VAR OpenColorIO_FOUND - VERSION_VAR OPENCOLORIO_VERSION - ) - -if (OpenColorIO_FOUND) - set (OpenColorIO_VERSION ${OPENCOLORIO_VERSION}) - set (OPENCOLORIO_INCLUDES ${OPENCOLORIO_INCLUDE_DIR}) - set (OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARY}) - set (OPENCOLORIO_DEFINITIONS "") - if (NOT TARGET OpenColorIO::OpenColorIO) - add_library(OpenColorIO::OpenColorIO UNKNOWN IMPORTED) - set_target_properties(OpenColorIO::OpenColorIO PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${OPENCOLORIO_INCLUDES}") - - set_property(TARGET OpenColorIO::OpenColorIO APPEND PROPERTY - IMPORTED_LOCATION "${OPENCOLORIO_LIBRARIES}") - if (OPENCOLORIO_INTERFACE_LINK_LIBRARIES) - set_target_properties(OpenColorIO::OpenColorIO PROPERTIES - INTERFACE_LINK_LIBRARIES "${OPENCOLORIO_INTERFACE_LINK_LIBRARIES}") - endif () - if (LINKSTATIC) - target_compile_definitions(OpenColorIO::OpenColorIO - INTERFACE "-DOpenColorIO_STATIC") - endif() - endif () - if (NOT TARGET OpenColorIO::OpenColorIOHeaders) - add_library(OpenColorIO::OpenColorIOHeaders INTERFACE IMPORTED) - set_target_properties(OpenColorIO::OpenColorIOHeaders PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${OPENCOLORIO_INCLUDES}") - endif () -endif () - -if (OpenColorIO_FOUND AND LINKSTATIC) - # Is this necessary? - set (OPENCOLORIO_DEFINITIONS "OpenColorIO_STATIC") - find_library (TINYXML_LIBRARY NAMES tinyxml) - if (TINYXML_LIBRARY) - set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${TINYXML_LIBRARY}" CACHE STRING "" FORCE) - endif () - find_library (YAML_LIBRARY NAMES yaml-cpp) - if (YAML_LIBRARY) - set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${YAML_LIBRARY}" CACHE STRING "" FORCE) - endif () - find_library (LCMS2_LIBRARY NAMES lcms2) - if (LCMS2_LIBRARY) - set (OPENCOLORIO_LIBRARIES "${OPENCOLORIO_LIBRARIES};${LCMS2_LIBRARY}" CACHE STRING "" FORCE) - endif () -endif () - -endif() diff --git a/src/cmake/modules/FindWebP.cmake b/src/cmake/modules/FindWebP.cmake deleted file mode 100644 index 38c53c6e49..0000000000 --- a/src/cmake/modules/FindWebP.cmake +++ /dev/null @@ -1,77 +0,0 @@ -# Module to find Webp -# -# Copyright Contributors to the OpenImageIO project. -# SPDX-License-Identifier: Apache-2.0 -# https://github.com/AcademySoftwareFoundation/OpenImageIO -# -# This module will first look into the directories defined by the variables: -# - Webp_ROOT, WEBP_INCLUDE_PATH, WEBP_LIBRARY_PATH -# -# This module defines the following variables: -# -# WebP_FOUND True if Webp was found. -# WEBP_INCLUDES Where to find Webp headers -# WEBP_LIBRARIES List of libraries to link against when using Webp -# -# This doesn't work, because the webp headers don't seem to include any -# definitions giving the version: -# WEBP_VERSION Version of Webp (e.g., 3.6.2) - -# Try the config for newer WebP versions. -find_package(WebP CONFIG) - -if (NOT TARGET WebP::webp) -# If not found, roll our own. -# Note: When WebP 1.1 (released late 2019) is our minimum, we can use their -# exported configs and remove our FindWebP.cmake module. - -include (FindPackageHandleStandardArgs) - -find_path (WEBP_INCLUDE_DIR webp/encode.h - HINTS - ${WEBP_INCLUDE_PATH} - ENV WEBP_INCLUDE_PATH - DOC "The directory where Webp headers reside") - -find_library (WEBP_LIBRARY webp - HINTS - ${WEBP_LIBRARY_PATH} - ENV WEBP_LIBRARY_PATH) -find_library (WEBPDEMUX_LIBRARY webpdemux - HINTS - ${WEBP_LIBRARY_PATH} - ENV WEBP_LIBRARY_PATH) - -include (FindPackageHandleStandardArgs) -find_package_handle_standard_args (WebP - REQUIRED_VARS WEBP_INCLUDE_DIR - WEBP_LIBRARY WEBPDEMUX_LIBRARY - ) - -if (WebP_FOUND) - set (WEBP_INCLUDES "${WEBP_INCLUDE_DIR}") - set (WEBP_LIBRARIES ${WEBP_LIBRARY} ${WEBPDEMUX_LIBRARY}) - - if (NOT TARGET WebP::webp) - add_library(WebP::webp UNKNOWN IMPORTED) - set_target_properties(WebP::webp PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES ${WEBP_INCLUDES}) - set_property(TARGET WebP::webp APPEND PROPERTY - IMPORTED_LOCATION ${WEBP_LIBRARY}) - endif () - if (NOT TARGET WebP::webpdemux) - add_library(WebP::webpdemux UNKNOWN IMPORTED) - set_target_properties(WebP::webpdemux PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES ${WEBP_INCLUDES}) - set_property(TARGET WebP::webpdemux APPEND PROPERTY - IMPORTED_LOCATION ${WEBPDEMUX_LIBRARY}) - endif () -endif () - -mark_as_advanced ( - WEBP_INCLUDE_DIR - WEBP_LIBRARY - WEBPDEMUX_LIBRARY - ) - -endif () diff --git a/src/cmake/testing.cmake b/src/cmake/testing.cmake index 49ffa8af09..cf348a3cee 100644 --- a/src/cmake/testing.cmake +++ b/src/cmake/testing.cmake @@ -69,17 +69,9 @@ macro (oiio_add_tests) set (_test_disabled 1) endif () endforeach () - if (OpenColorIO_VERSION VERSION_GREATER_EQUAL 2.2 - AND NOT (OIIO_DISABLE_BUILTIN_OCIO_CONFIGS OR "$ENV{OIIO_DISABLE_BUILTIN_OCIO_CONFIGS}")) - # For OCIO 2.2+, have the testsuite use the default built-in config - list (APPEND _ats_ENVIRONMENT "OCIO=ocio://default" - "OIIO_TESTSUITE_OCIOCONFIG=ocio://default") - else () - # For OCIO 2.1 and earlier, have the testsuite use one we have in - # the testsuite directory. - list (APPEND _ats_ENVIRONMENT "OCIO=../common/OpenColorIO/nuke-default/config.ocio" - "OIIO_TESTSUITE_OCIOCONFIG=../common/OpenColorIO/nuke-default/config.ocio") - endif () + # For OCIO 2.2+, have the testsuite use the default built-in config + list (APPEND _ats_ENVIRONMENT "OCIO=ocio://default" + "OIIO_TESTSUITE_OCIOCONFIG=ocio://default") if (_test_disabled) message (STATUS "Skipping test(s) ${_ats_UNPARSED_ARGUMENTS} because of disabled ${_ats_ENABLEVAR}") elseif (_ats_IMAGEDIR AND NOT EXISTS ${_ats_testdir}) diff --git a/src/doc/builtinplugins.rst b/src/doc/builtinplugins.rst index 1c795a739c..5743de5890 100644 --- a/src/doc/builtinplugins.rst +++ b/src/doc/builtinplugins.rst @@ -1077,6 +1077,10 @@ control aspects of the writing itself: - ptr - Pointer to a ``Filesystem::IOProxy`` that will handle the I/O, for example by writing to a memory buffer. + * - ``jpeg:iptc`` + - int (1) + - If zero, will suppress writing the IPTC metadata block to the + JPEG file. * - ``jpeg:progressive`` - int - If nonzero, will write a progressive JPEG file. @@ -2062,7 +2066,23 @@ options are supported: - If nonzero, will use libraw's exposure correction. (Default: 0) * - ``raw:use_camera_wb`` - int - - If 1, use libraw's camera white balance adjustment. (Default: 1) + - If 1, use libraw's camera white balance adjustment. Takes precedence + over ``raw:use_auto_wb``, ``raw:greybox``, ``raw:user_mul``. + (Default: 1) + * - ``raw:use_auto_wb`` + - int + - If 1, white balance automatically by averaging over the entire image. + Only applies if ``raw:use_camera_wb`` is not equal to 0. Takes + precedence over ``raw:greybox``, ``raw:user_mul``. + (Default: 0) + * - ``raw:greybox`` + - int[4] + - White balance by averaging over the given box. The four values are the + X and Y coordinate of the top-left corner, the width and the height. + Only applies if the size is non-zero, and ``raw:use_camera_wb`` is not + equal to 0, ``raw:use_auto_wb`` is not equal to 0. Takes + precedence over ``raw:user_mul``. + (Default: 0, 0, 0, 0; meaning no correction.) * - ``raw:use_camera_matrix`` - int - Whether to use the embedded color profile, if it's present: 0 = @@ -2070,6 +2090,10 @@ options are supported: * - ``raw:adjust_maximum_thr`` - float - If nonzero, auto-adjusting maximum value. (Default:0.0) + * - ``raw:user_black`` + - int + - If not negative, sets the camera minimum value that will be normalized to + appear 0. (Default: -1) * - ``raw:user_sat`` - int - If nonzero, sets the camera maximum value that will be normalized to @@ -2086,7 +2110,8 @@ options are supported: * - ``raw:user_mul`` - float[4] - Sets user white balance coefficients. Only applies if ``raw:use_camera_wb`` - is not equal to 0. + is not equal to 0, ``raw:use_auto_wb`` is not equal to 0, and the + ``raw:greybox`` box is zero size. * - ``raw:ColorSpace`` - string - Which color primaries to use for the returned pixel values: ``raw``, diff --git a/src/doc/imageioapi.rst b/src/doc/imageioapi.rst index 4f0623675d..0adcba25ca 100644 --- a/src/doc/imageioapi.rst +++ b/src/doc/imageioapi.rst @@ -370,10 +370,10 @@ inside the source code. take precedence. If neither is set, the default will be 0, which means to use as many threads as there are physical cores on the machine. -``OIIOTOOL_METADATA_HISTORY`` +``OPENIMAGEIO_METADATA_HISTORY`` - If set to a nonzero integer value, `oiiotool` will by default write the - command line into the ImageHistory and Software metadata fields of any + If set to a nonzero integer value, `oiiotool` and `maketx` will by default + write the command line into the ImageHistory and Software metadata fields of any images it outputs. The default if this is not set is to only write the name and version of the software and an indecipherable hash of the command line, but not the full human-readable command line. (This was added in diff --git a/src/doc/oiiotool.rst b/src/doc/oiiotool.rst index ed14ff5a82..cfda570a1e 100644 --- a/src/doc/oiiotool.rst +++ b/src/doc/oiiotool.rst @@ -273,11 +273,12 @@ The usual programming constructs are supported: * Iteration : `--for` *variable* *range* *commands...* `--endfor` The range is a sequence of one to three comma-separated numbers: *begin*, - *end*, and *step*; *begin* and *end* (step is assumed to be 1); or just - *end* (begin assumed to be 0, step assumed to be 1). As in Python, the range - has an "exclusive end" -- when the *variable* is equal to *end*, the loop - will terminate, without actually running the commands for the *end* value - itself. + *end*, and *step*; *begin* and *end* (step is assumed to be 1 if *begin* + `<`` *end*, or -1 if *begin* `>` *end); or just *end* (begin assumed to be + 0, step assumed to be 1 or -1, depending on the relationship between *begin* + and *end*). As in Python, the range has an "exclusive end" -- when the + *variable* is equal to *end*, the loop will terminate, without actually + running the commands for the *end* value itself. Section :ref:`sec-oiiotool-control-flow-commands` contains more detailed descriptions of these commands and some examples to more clearly illustrate @@ -1023,11 +1024,12 @@ output each one to a different file, with names `sub0001.tif`, for each iteration. The range may be one, two, or three numbers separated by commas, indicating - - *end* : Iterate from 0 to *end*, incrementing by 1 each time. - - *begin* ``,`` *end* : Iterate from *begin* to *end*, incrementing - by 1 each time. + - *end* : Iterate from 0 to *end*, incrementing by 1 each iteration (or + decrementing, if *end* `<` 0). + - *begin* ``,`` *end* : Iterate from *begin* to *end*, incrementing by + 1 each iteration (or decrementing by 1, if *end* `<` *begin*). - *begin* ``,`` *end* ``,`` *step* : Iterate from *begin* to *end*, - incrementing by *step* each time. + adding *step* to the value after each iteration. Note that the *end* value is "exclusive," that is, the loop will terminate once the value is equal to end, and the loop body will @@ -1054,6 +1056,13 @@ output each one to a different file, with names `sub0001.tif`, 7 9 + $ oiiotool --for i 5,0,-1 --echo "i = {i}" --endfor + 5 + 4 + 3 + 2 + 1 + .. option:: --while commands... --endwhile If the *condition* is true, execute *commands*, and keep doing that @@ -1982,7 +1991,7 @@ current top image. image to potentially reveal any proprietary information that might have been present in the command line arguments. - If the `OIIOTOOL_METADATA_HISTORY` environment variable is set to a + If the `OPENIMAGEIO_METADATA_HISTORY` environment variable is set to a nonzero integer value, the `--history` option will be enabled by default, but can be disabled on the command line with `--no-history`. @@ -1993,7 +2002,7 @@ current top image. Prior to OpenImageIO 2.5.11, the full information was always written, but could be overridden with `--nosoftwareattrib`. Beginning with 2.5.11, the default changed to only write the software name and version (unless the - `OIIOTOOL_METADATA_HISTORY` environment variable is set), and require the + `OPENIMAGEIO_METADATA_HISTORY` environment variable is set), and require the new `--history` option to cause the command line arguments to be written as metadata. @@ -2230,10 +2239,16 @@ current top image. :program:`oiiotool` commands that adjust the image stack ======================================================== -.. option:: --pop +.. option:: --label - Pop the image stack, discarding the current image and thereby making the - next image on the stack into the new current image. + Gives a name to (and saves) the current image at the top of the stack. + Thereafter, the label name may be used to refer to that saved image, in + the usual manner that an ordinary input image would be specified by + filename. + + The name of the label must be in the form of an "identifier" (a sequence + of alphanumeric characters and underscores, starting with a letter or + underscore). .. option:: --dup @@ -2245,16 +2260,31 @@ current top image. Swap the current image and the next one on the stack. -.. option:: --label +.. option:: --pop - Gives a name to (and saves) the current image at the top of the stack. - Thereafter, the label name may be used to refer to that saved image, in - the usual manner that an ordinary input image would be specified by - filename. + Pop the image stack, discarding the current image and thereby making the + next image on the stack into the new current image. - The name of the label must be in the form of an "identifier" (a sequence - of alphanumeric characters and underscores, starting with a letter or - underscore). +.. option:: --popbottom + + Remove and discard the bottom image from the image stack. + (Added in OIIO 3.0.) + +.. option:: --stackreverse + + Reverse the order of the entire stack, i.e. making the top be the new + bottom and the old bottom be the new top. (Added in OIIO 3.0.) + +.. option:: --stackextract + + Move the indexed item (0 for the top of the stack, 1 for the next item + down, etc.) to the top of the stack, preserving the relative order of all + other items. (Added in OIIO 3.0.) + +.. option:: --stackclear + + Remove all items from the stack, leaving it empty and with no "current" + image. (Added in OIIO 3.0.) :program:`oiiotool` commands that make entirely new images diff --git a/src/ffmpeg.imageio/ffmpeginput.cpp b/src/ffmpeg.imageio/ffmpeginput.cpp index 926cfbe3d7..a36027f1e7 100644 --- a/src/ffmpeg.imageio/ffmpeginput.cpp +++ b/src/ffmpeg.imageio/ffmpeginput.cpp @@ -2,16 +2,12 @@ // SPDX-License-Identifier: BSD-3-Clause and Apache-2.0 // https://github.com/AcademySoftwareFoundation/OpenImageIO -extern "C" { // ffmpeg is a C api #include + +extern "C" { // ffmpeg is a C api #include #include #include -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 24, 100) -# error "OIIO FFmpeg support requires FFmpeg >= 3.0" -#endif -#include -} // It's hard to figure out FFMPEG versions from what they give us, so // record some of the milestones once and for all for easy reference. @@ -29,6 +25,12 @@ extern "C" { // ffmpeg is a C api #define USE_FFMPEG_4_3 (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58, 91, 100)) #define USE_FFMPEG_4_4 (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58, 134, 100)) +#if !USE_FFMPEG_4_0 +# error "OIIO FFmpeg support requires FFmpeg >= 4.0" +#endif + +#include +} inline int @@ -41,9 +43,9 @@ avpicture_fill(AVFrame* picture, uint8_t* ptr, enum AVPixelFormat pix_fmt, } -#if USE_FFMPEG_3_1 -// AVStream::codec was changed to AVStream::codecpar -# define stream_codec(ix) m_format_context->streams[(ix)]->codecpar +#define stream_codec(ix) m_format_context->streams[(ix)]->codecpar + + // avcodec_decode_video2 was deprecated. // This now works by sending `avpkt` to the decoder, which buffers the // decoded image in `avctx`. Then `avcodec_receive_frame` will copy the @@ -65,16 +67,6 @@ receive_frame(AVCodecContext* avctx, AVFrame* picture, AVPacket* avpkt) return 1; } -#else -# define stream_codec(ix) m_format_context->streams[(ix)]->codec -inline int -receive_frame(AVCodecContext* avctx, AVFrame* picture, AVPacket* avpkt) -{ - int ret; - avcodec_decode_video2(avctx, picture, &ret, avpkt); - return ret; -} -#endif @@ -265,7 +257,6 @@ FFmpegInput::open(const std::string& name, ImageSpec& spec) } // codec context for videostream -#if USE_FFMPEG_3_1 AVCodecParameters* par = stream_codec(m_video_stream); m_codec = avcodec_find_decoder(par->codec_id); @@ -287,15 +278,6 @@ FFmpegInput::open(const std::string& name, ImageSpec& spec) errorfmt("\"{}\" unsupported codec", file_name); return false; } -#else - m_codec_context = stream_codec(m_video_stream); - - m_codec = avcodec_find_decoder(m_codec_context->codec_id); - if (!m_codec) { - errorfmt("\"{}\" unsupported codec", file_name); - return false; - } -#endif if (avcodec_open2(m_codec_context, m_codec, NULL) < 0) { errorfmt("\"{}\" could not open codec", file_name); diff --git a/src/gif.imageio/gifinput.cpp b/src/gif.imageio/gifinput.cpp index e95f7096d9..45cd33cc9e 100644 --- a/src/gif.imageio/gifinput.cpp +++ b/src/gif.imageio/gifinput.cpp @@ -19,7 +19,7 @@ // for older giflib versions #ifndef GIFLIB_MAJOR -# define GIFLIB_MAJOR 4 +# error "GIFLIB 5.0 minimum required" #endif #ifndef DISPOSAL_UNSPECIFIED @@ -132,12 +132,8 @@ OIIO_EXPORT const char* gif_input_extensions[] = { "gif", NULL }; OIIO_EXPORT const char* gif_imageio_library_version() { -#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && defined(GIFLIB_RELEASE) return "gif_lib " OIIO_STRINGIZE(GIFLIB_MAJOR) "." OIIO_STRINGIZE( GIFLIB_MINOR) "." OIIO_STRINGIZE(GIFLIB_RELEASE); -#else - return "gif_lib unknown version"; -#endif } OIIO_PLUGIN_EXPORTS_END @@ -408,20 +404,12 @@ GIFInput::seek_subimage(int subimage, int miplevel) if (!m_gif_file) { if (!ioproxy_use_or_open(m_filename)) return false; -#if GIFLIB_MAJOR >= 5 int giflib_error; m_gif_file = DGifOpen(this, readFunc, &giflib_error); if (!m_gif_file) { errorfmt("{}", GifErrorString(giflib_error)); return false; } -#else - m_gif_file = DGifOpen(this, readFunc); - if (!m_gif_file) { - errorfmt("Error opening GIF"); - return false; - } -#endif m_subimage = -1; m_canvas.resize(m_gif_file->SWidth * m_gif_file->SHeight * 4); } @@ -459,27 +447,12 @@ GIFInput::seek_subimage(int subimage, int miplevel) -static spin_mutex gif_error_mutex; - - void GIFInput::report_last_error(void) { - // N.B. Only GIFLIB_MAJOR >= 5 looks properly thread-safe, in that the - // error is guaranteed to be specific to this open file. We use a spin - // mutex to prevent a thread clash for older versions, but it still - // appears to be a global call, so we can't be absolutely sure that the - // error was for *this* file. So if you're using giflib prior to - // version 5, beware. -#if GIFLIB_MAJOR >= 5 + // GIFLIB_MAJOR >= 5 looks properly thread-safe, in that the error is + // guaranteed to be specific to this open file. errorfmt("{}", GifErrorString(m_gif_file->Error)); -#elif GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2 - spin_lock lock(gif_error_mutex); - errorfmt("{}", GifErrorString()); -#else - spin_lock lock(gif_error_mutex); - errorfmt("GIF error {}", GifLastError()); -#endif } diff --git a/src/iconvert/iconvert.cpp b/src/iconvert/iconvert.cpp index d98a2dfd49..66b513c381 100644 --- a/src/iconvert/iconvert.cpp +++ b/src/iconvert/iconvert.cpp @@ -1,5 +1,5 @@ // Copyright Contributors to the OpenImageIO project. -// SPDX-License-Identifier: BSD-3-Clause and Apache-2.0 +// SPDX-License-Identifier: Apache-2.0 // https://github.com/AcademySoftwareFoundation/OpenImageIO diff --git a/src/iff.imageio/noproxy-iff_pvt.h b/src/iff.imageio/noproxy-iff_pvt.h index 7e6dc0a4fb..de78e39d47 100644 --- a/src/iff.imageio/noproxy-iff_pvt.h +++ b/src/iff.imageio/noproxy-iff_pvt.h @@ -145,7 +145,7 @@ class IffInput final : public ImageInput { try { close(); } catch (const std::exception& e) { - OIIO::pvt::errorfmt("{}", e.what()); + OIIO::errorfmt("{}", e.what()); } } const char* format_name(void) const override { return "iff"; } @@ -228,7 +228,7 @@ class IffOutput final : public ImageOutput { try { close(); } catch (const std::exception& e) { - OIIO::pvt::errorfmt("{}", e.what()); + OIIO::errorfmt("{}", e.what()); } } const char* format_name(void) const override { return "iff"; } diff --git a/src/include/OpenImageIO/imagebufalgo.h b/src/include/OpenImageIO/imagebufalgo.h index dd5403f348..fcc78e1aa9 100644 --- a/src/include/OpenImageIO/imagebufalgo.h +++ b/src/include/OpenImageIO/imagebufalgo.h @@ -580,8 +580,8 @@ bool OIIO_API circular_shift (ImageBuf &dst, const ImageBuf &src, /// /// Rotate the `src` image by the `angle` (in radians, with positive angles /// clockwise). When `center_x` and `center_y` are supplied, they denote the -/// center of rotation; in their absence, the rotation will be about the -/// center of the image's display window. +/// center of rotation, in pixel coordinates; in their absence, the rotation +/// will be about the center of the image's display window. /// /// Only the pixels (and channels) of `dst` that are specified by `roi` will /// be copied from the rotated `src`; the default `roi` is to alter all the diff --git a/src/include/OpenImageIO/imagecache.h b/src/include/OpenImageIO/imagecache.h index fedc3f3041..2cb7bb89ad 100644 --- a/src/include/OpenImageIO/imagecache.h +++ b/src/include/OpenImageIO/imagecache.h @@ -257,6 +257,8 @@ class OIIO_API ImageCache { /// all files referenced by calls to the ImageCache. (The /// array is of `ustring` or `char*`.) /// + /// - `int64 stat:cache_footprint` : + /// Total bytes used by image cache. /// - `int64 stat:cache_memory_used` : /// Total bytes used by tile cache. /// diff --git a/src/include/OpenImageIO/imageio.h b/src/include/OpenImageIO/imageio.h index 071d9805c0..af233d0d0f 100644 --- a/src/include/OpenImageIO/imageio.h +++ b/src/include/OpenImageIO/imageio.h @@ -36,11 +36,13 @@ #include #include #include +#include OIIO_NAMESPACE_BEGIN class DeepData; class ImageBuf; +class Timer; /// Type we use for stride lengths between pixels, scanlines, or image @@ -1883,6 +1885,9 @@ class OIIO_API ImageInput { std::unique_ptr m_impl; void append_error(string_view message) const; // add to error message + + /// declare a friend heapsize definition + template friend size_t pvt::heapsize(const T&); }; @@ -2787,10 +2792,26 @@ class OIIO_API ImageOutput { std::unique_ptr m_impl; void append_error(string_view message) const; // add to m_errmessage + + /// declare a friend heapsize definition + template friend size_t pvt::heapsize(const T&); }; +/// Memory tracking. Specializes the base memory tracking functions from memory.h. + +// heapsize specialization for `ImageSpec` +template <> OIIO_API size_t pvt::heapsize(const ImageSpec&); + +// heapsize specialization for `ImageInput` +template <> OIIO_API size_t pvt::heapsize(const ImageInput&); + +// heapsize specialization for `ImageOutput` +template <> OIIO_API size_t pvt::heapsize(const ImageOutput&); + + + // Utility functions /// `OIIO::shutdown` prepares OpenImageIO for shutdown. Before exiting an @@ -3363,7 +3384,22 @@ void debugfmt (const char* fmt, Args&&... args) Strutil::debug(fmt, std::forward(args)...); } +namespace pvt { +// For internal use - use errorfmt() below for a nicer interface. +OIIO_API void append_error(string_view message); +} + +/// error logging (mostly for OIIO internals) with `std::format` conventions. +template +inline void errorfmt(const char* fmt, Args&&... args) +{ + pvt::append_error(string_view(Strutil::fmt::format(fmt, args...))); +} +/// Internal function to log time recorded by an OIIO::timer(). It will only +/// trigger a read of the time if the "log_times" attribute is set or the +/// OPENIMAGEIO_LOG_TIMES env variable is set. +OIIO_API void log_time(string_view key, const Timer& timer, int count = 1); // to force correct linkage on some systems OIIO_API void _ImageIO_force_link (); diff --git a/src/include/OpenImageIO/memory.h b/src/include/OpenImageIO/memory.h new file mode 100644 index 0000000000..cae5f34b5e --- /dev/null +++ b/src/include/OpenImageIO/memory.h @@ -0,0 +1,117 @@ +// Copyright Contributors to the OpenImageIO project. +// SPDX-License-Identifier: Apache-2.0 +// https://github.com/AcademySoftwareFoundation/OpenImageIO + + +///////////////////////////////////////////////////////////////////////// +/// @file memory.h +/// +/// @brief Utilities for memory tracking. +///////////////////////////////////////////////////////////////////////// + + +#pragma once + +#define OPENIMAGEIO_MEMORY_H + +#include +#include +#include + +OIIO_NAMESPACE_BEGIN + +namespace pvt { + +/// Return the total heap memory allocated by `object`. +/// The template specialization can be used to give improved results for non trivial types +/// that perform heap allocation, and to include members allocations recursively. +template +inline size_t +heapsize(const T& t) +{ + return 0; +} + +/// Return the total memory footprint of `object`. If possible, including any heap +/// allocations done by any constituent parts. The default implementation just reduces +/// to sizeof(object), given that heapsize(object) would return 0. +/// The template specialization can be used to give improved results for non trivial types +/// that perform heap allocation. +template +inline size_t +footprint(const T& t) +{ + return sizeof(T) + heapsize(t); +} + +template +inline size_t +footprint(const T* t) +{ + return sizeof(T) + (t ? footprint(*t) : 0); +} + +/// Specializations for common STL types + + +// heapsize specialization for std::string +template<> +inline size_t +heapsize(const std::string& s) +{ + // accounts for small string optimization that does not + // use any heap allocations + const char* const sbegin = (const char*)&s; + const char* const send = sbegin + sizeof(std::string); + const char* const sdata = s.data(); + const bool is_small = sdata >= sbegin && sdata < send; + return is_small ? 0 : s.capacity(); +} + +// heapsize specialization for std::vector +template +inline size_t +heapsize(const std::vector& vec) +{ + size_t size = 0; + for (const T& elem : vec) + size += footprint(elem); + return size; +} + +// heapsize specialization for std::shared_ptr +template +inline size_t +heapsize(const std::shared_ptr& ref) +{ + return ref ? footprint(*ref.get()) : 0; +} + +// footprint specialization for std::shared_ptr +template +inline size_t +footprint(const std::shared_ptr& ref) +{ + return sizeof(std::shared_ptr) + heapsize(ref); +} + +// heapsize specialization for std::unique_ptr +template +inline size_t +heapsize(const std::unique_ptr& ref) +{ + return ref ? footprint(*ref.get()) : 0; +} + +// footprint specialization for std::unique_ptr +template +inline size_t +footprint(const std::unique_ptr& ref) +{ + return sizeof(std::unique_ptr) + heapsize(ref); +} + +} // namespace pvt + + +OIIO_NAMESPACE_END \ No newline at end of file diff --git a/src/include/OpenImageIO/paramlist.h b/src/include/OpenImageIO/paramlist.h index f4840fc8b2..6d278a38df 100644 --- a/src/include/OpenImageIO/paramlist.h +++ b/src/include/OpenImageIO/paramlist.h @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -276,9 +277,15 @@ class OIIO_UTIL_API ParamValue { Copy _copy = Copy(true), FromUstring _from_ustring = FromUstring(false)) noexcept; void clear_value() noexcept; -}; + /// declare a friend heapsize definition + template friend size_t pvt::heapsize(const T&); +}; +/// heapsize specialization for `ParamValue` +template<> +OIIO_API size_t +pvt::heapsize(const ParamValue&); /// Factory for a ParamValue that holds a single value of any type supported /// by a corresponding ParamValue constructor (such as int, float, string). diff --git a/src/include/OpenImageIO/platform.h b/src/include/OpenImageIO/platform.h index 7fb09b43b5..f5f1101786 100644 --- a/src/include/OpenImageIO/platform.h +++ b/src/include/OpenImageIO/platform.h @@ -1,5 +1,5 @@ // Copyright Contributors to the OpenImageIO project. -// SPDX-License-Identifier: BSD-3-Clause and Apache-2.0 +// SPDX-License-Identifier: Apache-2.0 // https://github.com/AcademySoftwareFoundation/OpenImageIO @@ -52,64 +52,6 @@ #include #include -// Detect which C++ standard we're using, and handy macros. -// See https://en.cppreference.com/w/cpp/compiler_support -// -// OIIO_CPLUSPLUS_VERSION : which C++ standard is compiling (14, 17, ...) -// OIIO_CONSTEXPR14 : -// OIIO_CONSTEXPR17 : -// OIIO_CONSTEXPR20 : constexpr for C++ >= the designated version, otherwise -// nothing (this is useful for things that can only be -// constexpr for particular versions or greater). -// OIIO_INLINE_CONSTEXPR : inline constexpr variables, added in C++17. For -// older C++, static constexpr. -// -// Note: oiioversion.h defines OIIO_BUILD_CPP (set to 17, 20, etc.) -// reflecting what OIIO itself was *built* with. In contrast, -// OIIO_CPLUSPLUS_VERSION defined below will be set to the right number for -// the C++ standard being compiled RIGHT NOW. These two things may be the -// same when compiling OIIO, but they may not be the same if another -// package is compiling against OIIO and using these headers (OIIO may be -// C++14 but the client package may be newer, or vice versa -- use these two -// symbols to differentiate these cases, when important). -#if (__cplusplus >= 202001L) -# define OIIO_CPLUSPLUS_VERSION 20 -# define OIIO_CONSTEXPR17 constexpr -# define OIIO_CONSTEXPR20 constexpr -# define OIIO_INLINE_CONSTEXPR inline constexpr -#elif (__cplusplus >= 201703L) || (defined(_MSC_VER) && _MSC_VER >= 1914) -# define OIIO_CPLUSPLUS_VERSION 17 -# define OIIO_CONSTEXPR17 constexpr -# define OIIO_CONSTEXPR20 /* not constexpr before C++20 */ -# define OIIO_INLINE_CONSTEXPR inline constexpr -#else -# error "This version of OIIO is meant to work only with C++17 and above" -#endif - -// DEPRECATED(2.3): use C++14 constexpr -#define OIIO_CONSTEXPR14 constexpr - -// DEPRECATED(1.8): use C++11 constexpr -#define OIIO_CONSTEXPR constexpr -#define OIIO_CONSTEXPR_OR_CONST constexpr - -// DEPRECATED(1.8): use C++11 noexcept -#define OIIO_NOEXCEPT noexcept - - -// In C++20 (and some compilers before that), __has_cpp_attribute can -// test for understand of [[attr]] tests. -#ifndef __has_cpp_attribute -# define __has_cpp_attribute(x) 0 -#endif - -// On gcc & clang, __has_attribute can test for __attribute__((attr)) -#ifndef __has_attribute -# define __has_attribute(x) 0 -#endif - - - // Detect which compiler and version we're using // Notes: @@ -227,6 +169,55 @@ #endif +// Detect which C++ standard we're using, and handy macros. +// See https://en.cppreference.com/w/cpp/compiler_support +// +// OIIO_CPLUSPLUS_VERSION : which C++ standard is compiling (14, 17, ...) +// OIIO_CONSTEXPR14 : +// OIIO_CONSTEXPR17 : +// OIIO_CONSTEXPR20 : constexpr for C++ >= the designated version, otherwise +// nothing (this is useful for things that can only be +// constexpr for particular versions or greater). +// OIIO_INLINE_CONSTEXPR : inline constexpr variables, added in C++17. For +// older C++, static constexpr. +// +// Note: oiioversion.h defines OIIO_BUILD_CPP (set to 17, 20, etc.) +// reflecting what OIIO itself was *built* with. In contrast, +// OIIO_CPLUSPLUS_VERSION defined below will be set to the right number for +// the C++ standard being compiled RIGHT NOW. These two things may be the +// same when compiling OIIO, but they may not be the same if another +// package is compiling against OIIO and using these headers (OIIO may be +// C++17 but the client package may be newer, or vice versa -- use these two +// symbols to differentiate these cases, when important). +#if (__cplusplus >= 202001L) +# define OIIO_CPLUSPLUS_VERSION 20 +# define OIIO_CONSTEXPR20 constexpr +# define OIIO_INLINE_CONSTEXPR inline constexpr +#elif (__cplusplus >= 201703L) || (defined(_MSC_VER) && _MSC_VER >= 1914) +# define OIIO_CPLUSPLUS_VERSION 17 +# define OIIO_CONSTEXPR20 /* not constexpr before C++20 */ +# define OIIO_INLINE_CONSTEXPR inline constexpr +#else +# error "This version of OIIO is meant to work only with C++17 and above" +#endif + +// DEPRECATED(3.0): use C++17 constexpr +#define OIIO_CONSTEXPR17 constexpr + + +// In C++20 (and some compilers before that), __has_cpp_attribute can +// test for understand of [[attr]] tests. +#ifndef __has_cpp_attribute +# define __has_cpp_attribute(x) 0 +#endif + +// On gcc & clang, __has_attribute can test for __attribute__((attr)) +#ifndef __has_attribute +# define __has_attribute(x) 0 +#endif + + + // Pragma control // // OIIO_PRAGMA(x) make a pragma for *unquoted* x @@ -426,9 +417,6 @@ // [[maybe_unused]] attribute. #define OIIO_MAYBE_UNUSED [[maybe_unused]] -// DEPRECATED(1.9) name: -#define OIIO_UNUSED_OK OIIO_MAYBE_UNUSED - // OIIO_RESTRICT is a parameter attribute that indicates a promise that the // parameter definitely will not alias any other parameters in such a way // that creates a data dependency. Use with caution! diff --git a/src/include/OpenImageIO/refcnt.h b/src/include/OpenImageIO/refcnt.h index 06dc97213c..68cacd319c 100644 --- a/src/include/OpenImageIO/refcnt.h +++ b/src/include/OpenImageIO/refcnt.h @@ -16,6 +16,7 @@ #include #include +#include OIIO_NAMESPACE_BEGIN @@ -232,4 +233,25 @@ intrusive_ptr_release(T* x) #define OIIO_REFCNT_HAS_RELEASE 1 /* intrusive_ptr::release() */ +/// Memory tracking. Specializes the base memory tracking functions from memory.h. + +// heapsize specialization for `intrusive_ptr` +namespace pvt { +template +inline size_t +heapsize(const intrusive_ptr& ref) +{ + return ref ? footprint(*ref.get()) : 0; +} + +// footprint specialization for `intrusive_ptr` +template +inline size_t +footprint(const intrusive_ptr& ref) +{ + return sizeof(intrusive_ptr) + heapsize(ref); +} +} // namespace pvt + + OIIO_NAMESPACE_END diff --git a/src/include/OpenImageIO/strutil.h b/src/include/OpenImageIO/strutil.h index d22a546481..e0c5ec302f 100644 --- a/src/include/OpenImageIO/strutil.h +++ b/src/include/OpenImageIO/strutil.h @@ -152,7 +152,9 @@ using old::format; #endif -// format_to comes from fmt library +// More things we wrap from fmt library +using ::fmt::format_args; +using ::fmt::make_format_args; using ::fmt::format_to; using ::fmt::format_to_n; diff --git a/src/include/OpenImageIO/tiffutils.h b/src/include/OpenImageIO/tiffutils.h index 9d69559a31..0803634271 100644 --- a/src/include/OpenImageIO/tiffutils.h +++ b/src/include/OpenImageIO/tiffutils.h @@ -189,8 +189,9 @@ OIIO_API bool decode_iptc_iim (const void *iptc, int length, ImageSpec &spec); /// for multiple format plugins to support embedding IPTC metadata /// without having to duplicate functionality within each plugin. Note /// that IIM is actually considered obsolete and is replaced by an XML -/// scheme called XMP. -OIIO_API void encode_iptc_iim (const ImageSpec &spec, std::vector &iptc); +/// scheme called XMP. Return true if it was successful and any items +/// were encoded. +OIIO_API bool encode_iptc_iim (const ImageSpec &spec, std::vector &iptc); /// Add metadata to spec based on XMP data in an XML block. Return true /// if all is ok, false if the xml was somehow malformed. This is a diff --git a/src/include/imageio_pvt.h b/src/include/imageio_pvt.h index b6b606994c..c9befa7421 100644 --- a/src/include/imageio_pvt.h +++ b/src/include/imageio_pvt.h @@ -60,18 +60,6 @@ font_list(); -// For internal use - use error() below for a nicer interface. -void -append_error(string_view message); - -/// Use errorfmt() privately only. Formatting notation is like std::format. -template -inline void -errorfmt(const char* fmt, const Args&... args) -{ - append_error(Strutil::fmt::format(fmt, args...)); -} - // Make sure all plugins are inventoried. For internal use only. void catalog_all_plugins(std::string searchpath); @@ -123,12 +111,6 @@ parallel_convert_from_float(const float* src, void* dst, size_t nvals, OIIO_API bool check_texture_metadata_sanity(ImageSpec& spec); -/// Internal function to log time recorded by an OIIO::timer(). It will only -/// trigger a read of the time if the "log_times" attribute is set or the -/// OPENIMAGEIO_LOG_TIMES env variable is set. -OIIO_API void -log_time(string_view key, const Timer& timer, int count = 1); - /// Get the timing report from log_time entries. OIIO_API std::string timing_report(); diff --git a/src/iv/imageviewer.cpp b/src/iv/imageviewer.cpp index 8aa7aac13e..a22c5eae81 100644 --- a/src/iv/imageviewer.cpp +++ b/src/iv/imageviewer.cpp @@ -111,12 +111,10 @@ ImageViewer::ImageViewer(bool use_ocio, const std::string& image_color_space, , m_fullscreen(false) , m_default_gamma(1) , m_darkPalette(false) -#ifdef HAS_OCIO_2 , m_useOCIO(use_ocio) , m_ocioColourSpace(image_color_space) , m_ocioDisplay(display) , m_ocioView(view) -#endif // HAS_OCIO_2 { readSettings(false); @@ -139,11 +137,7 @@ ImageViewer::ImageViewer(bool use_ocio, const std::string& image_color_space, slideDuration_ms = 5000; slide_loop = true; -#ifdef HAS_OCIO_2 glwin = new IvGL_OCIO(this, *this); -#else - glwin = new IvGL(this, *this); -#endif glwin->setPalette(m_palette); glwin->resize(m_default_width, m_default_height); @@ -462,7 +456,7 @@ ImageViewer::createActions() SLOT(setSlideShowDuration(int))); } -#ifdef HAS_OCIO_2 + void ImageViewer::createOCIOMenus(QMenu* parent) @@ -606,7 +600,6 @@ ImageViewer::ocioDisplayViewAction() } } -#endif // HAS_OCIO_2 void ImageViewer::createMenus() @@ -694,9 +687,7 @@ ImageViewer::createMenus() viewMenu->addMenu(channelMenu); viewMenu->addMenu(colormodeMenu); -#ifdef HAS_OCIO_2 createOCIOMenus(viewMenu); -#endif viewMenu->addMenu(expgamMenu); menuBar()->addMenu(viewMenu); @@ -1046,14 +1037,8 @@ void ImageViewer::moveToNewWindow() { if (m_images.size()) { -#ifdef HAS_OCIO_2 ImageViewer* imageViewer = new ImageViewer(m_useOCIO, m_ocioColourSpace, m_ocioDisplay, m_ocioView); -#else - std::string dummy; - ImageViewer* imageViewer = new ImageViewer(false, dummy, dummy, dummy); -#endif - imageViewer->show(); imageViewer->rawcolor(rawcolor()); imageViewer->add_image(m_images[m_current_image]->name()); diff --git a/src/iv/imageviewer.h b/src/iv/imageviewer.h index d7dc8ef1d1..f1c0622547 100644 --- a/src/iv/imageviewer.h +++ b/src/iv/imageviewer.h @@ -244,12 +244,10 @@ class ImageViewer final : public QMainWindow { void rawcolor(bool val) { m_rawcolor = val; } bool rawcolor() const { return m_rawcolor; } -#ifdef HAS_OCIO_2 bool useOCIO() { return m_useOCIO; } const std::string& ocioColorSpace() { return m_ocioColourSpace; } const std::string& ocioDisplay() { return m_ocioDisplay; } const std::string& ocioView() { return m_ocioView; } -#endif // HAS_OCIO_2 private slots: void open(); ///< Dialog to open new image from file @@ -310,11 +308,9 @@ private slots: void showPixelviewWindow(); ///< View closeup pixel view void editPreferences(); ///< Edit viewer preferences -#ifdef HAS_OCIO_2 void useOCIOAction(bool checked); void ocioColorSpaceAction(); void ocioDisplayViewAction(); -#endif // HAS_OCIO_2 private: void createActions(); @@ -427,7 +423,6 @@ private slots: friend class IvPreferenceWindow; friend bool image_progress_callback(void* opaque, float done); -#ifdef HAS_OCIO_2 friend class IvGL_OCIO; void createOCIOMenus(QMenu* parent); @@ -444,7 +439,6 @@ private slots: std::string m_ocioColourSpace; std::string m_ocioDisplay; std::string m_ocioView; -#endif // HAS_OCIO_2 }; diff --git a/src/iv/ivgl_ocio.cpp b/src/iv/ivgl_ocio.cpp index d85439573c..0997fb6e4c 100644 --- a/src/iv/ivgl_ocio.cpp +++ b/src/iv/ivgl_ocio.cpp @@ -7,7 +7,6 @@ #include -#ifdef HAS_OCIO_2 IvGL_OCIO::IvGL_OCIO(QWidget* parent, ImageViewer& viewer) : IvGL(parent, viewer) @@ -360,15 +359,15 @@ IvGL_OCIO::allocate_all_textures(unsigned start_index) unsigned height = 0; GpuShaderDesc::TextureType channel = GpuShaderDesc::TEXTURE_RGB_CHANNEL; Interpolation interpolation = INTERP_LINEAR; -# ifdef HAS_OCIO_2_3 +#if OCIO_VERSION_HEX >= MAKE_OCIO_VERSION_HEX(2, 3, 0) GpuShaderCreator::TextureDimensions dimensions = GpuShaderCreator::TextureDimensions::TEXTURE_2D; m_shader_desc->getTexture(idx, textureName, samplerName, width, height, channel, dimensions, interpolation); -# else +#else m_shader_desc->getTexture(idx, textureName, samplerName, width, height, channel, interpolation); -# endif +#endif if (!textureName || !*textureName || !samplerName || !*samplerName || width == 0) { @@ -407,6 +406,5 @@ IvGL_OCIO::use_all_textures() } } -#endif // HAS_OCIO_2 //OIIO_PRAGMA_WARNING_POP diff --git a/src/iv/ivgl_ocio.h b/src/iv/ivgl_ocio.h index 38468b9b6a..ca4639c2b7 100644 --- a/src/iv/ivgl_ocio.h +++ b/src/iv/ivgl_ocio.h @@ -6,23 +6,14 @@ #ifndef OPENIMAGEIO_IVGL_OCIO_H #define OPENIMAGEIO_IVGL_OCIO_H -#ifdef USE_OCIO -# include -# if OCIO_VERSION_MAJOR >= 2 -# define HAS_OCIO_2 -# if OCIO_VERSION_MAJOR == 2 -# if OCIO_VERSION_MINOR >= 3 -# define HAS_OCIO_2_3 -# endif -# endif -# endif -#endif - -#ifdef HAS_OCIO_2 -# include "ivgl.h" - -# include -# include +#include + +#define MAKE_OCIO_VERSION_HEX(maj, min, patch) \ + (((maj) << 24) | ((min) << 16) | (patch)) + +#include "ivgl.h" + +#include using namespace OIIO; @@ -104,5 +95,4 @@ class IvGL_OCIO : public IvGL { Interpolation interpolation); }; -#endif // HAS_OCIO_2 #endif // OPENIMAGEIO_IVGL_OCIO_H diff --git a/src/iv/ivmain.cpp b/src/iv/ivmain.cpp index 0b17831aa3..a9c1181f55 100644 --- a/src/iv/ivmain.cpp +++ b/src/iv/ivmain.cpp @@ -58,7 +58,6 @@ getargs(int argc, char* argv[]) ap.arg("--rawcolor") .help("Do not automatically transform to RGB"); -#ifdef HAS_OCIO_2 ap.arg("--display") .help("OCIO display") .metavar("STRING") @@ -74,7 +73,6 @@ getargs(int argc, char* argv[]) .metavar("STRING") .defaultval("") .action(ArgParse::store()); -#endif ap.parse(argc, (const char**)argv); return ap; @@ -110,28 +108,18 @@ main(int argc, char* argv[]) // Q_INIT_RESOURCE(iv); QApplication app(argc, argv); -#ifdef HAS_OCIO_2 std::string color_space = ap["image-color-space"].as_string(""); std::string display = ap["display"].as_string(""); std::string view = ap["view"].as_string(""); // std::string look = ap["look"].as_string(""); bool use_ocio = color_space != "" && display != "" && view != ""; - -#ifdef OCIO_HAS_BUILTIN_CONFIGS std::string ocioenv = Sysutil::getenv("OCIO"); - if (ocioenv.empty() || !Filesystem::exists(ocioenv)) { + if (ocioenv.empty() || !Filesystem::exists(ocioenv)) setenv("OCIO", "ocio://default", 1); - } -#endif ImageViewer* mainWin = new ImageViewer(use_ocio, color_space, display, view); -#else - std::string dummy; - ImageViewer* mainWin = new ImageViewer(false, dummy, dummy, dummy); -#endif - mainWin->show(); diff --git a/src/jpeg.imageio/jpegoutput.cpp b/src/jpeg.imageio/jpegoutput.cpp index da1c7506d1..b845a86bea 100644 --- a/src/jpeg.imageio/jpegoutput.cpp +++ b/src/jpeg.imageio/jpegoutput.cpp @@ -249,8 +249,8 @@ JpgOutput::open(const std::string& name, const ImageSpec& newspec, // Write IPTC IIM metadata tags, if we have anything std::vector iptc; - encode_iptc_iim(m_spec, iptc); - if (iptc.size()) { + if (m_spec.get_int_attribute("jpeg:iptc", 1) + && encode_iptc_iim(m_spec, iptc)) { static char photoshop[] = "Photoshop 3.0"; std::vector head(photoshop, photoshop + strlen(photoshop) + 1); static char _8BIM[] = "8BIM"; diff --git a/src/libOpenImageIO/CMakeLists.txt b/src/libOpenImageIO/CMakeLists.txt index 7a76509f5b..fc3ab80512 100644 --- a/src/libOpenImageIO/CMakeLists.txt +++ b/src/libOpenImageIO/CMakeLists.txt @@ -137,7 +137,6 @@ target_include_directories (OpenImageIO ${OPENEXR_INCLUDES} PRIVATE ${ROBINMAP_INCLUDES} - ${OPENIMAGEIO_OPENCOLORIO_INCLUDES} ) target_include_directories (OpenImageIO SYSTEM PUBLIC ${OpenCV_INCLUDES}) @@ -158,7 +157,7 @@ target_link_libraries (OpenImageIO ${OPENIMAGEIO_OPENEXR_TARGETS} ${OpenCV_LIBRARIES} ${format_plugin_libs} # Add all the target link libraries from the plugins - $ + OpenColorIO::OpenColorIO $ $ $ diff --git a/src/libOpenImageIO/color_ocio.cpp b/src/libOpenImageIO/color_ocio.cpp index 38e8d39525..dd48db4985 100644 --- a/src/libOpenImageIO/color_ocio.cpp +++ b/src/libOpenImageIO/color_ocio.cpp @@ -24,19 +24,13 @@ #define MAKE_OCIO_VERSION_HEX(maj, min, patch) \ (((maj) << 24) | ((min) << 16) | (patch)) -#ifdef USE_OCIO -# include -# if OCIO_VERSION_HEX >= MAKE_OCIO_VERSION_HEX(2, 0, 0) -# define OCIO_v2 1 -# endif -# if OCIO_VERSION_HEX >= MAKE_OCIO_VERSION_HEX(2, 2, 0) \ - && !defined(OIIO_DISABLE_BUILTIN_OCIO_CONFIGS) -# define OCIO_HAS_BUILTIN_CONFIGS 1 -# endif -namespace OCIO = OCIO_NAMESPACE; -#else -# define OCIO_VERSION_HEX 0 +#include + +#define OCIO_v2 1 +#ifndef OIIO_DISABLE_BUILTIN_OCIO_CONFIGS +# define OCIO_HAS_BUILTIN_CONFIGS 1 #endif +namespace OCIO = OCIO_NAMESPACE; OIIO_NAMESPACE_BEGIN @@ -63,9 +57,7 @@ static bool colordebug = Strutil::stoi(Sysutil::getenv("OIIO_DEBUG_COLOR")) static int disable_ocio = Strutil::stoi(Sysutil::getenv("OIIO_DISABLE_OCIO")); static int disable_builtin_configs = Strutil::stoi( Sysutil::getenv("OIIO_DISABLE_BUILTIN_OCIO_CONFIGS")); -#ifdef USE_OCIO static OCIO::ConstConfigRcPtr ocio_current_config; -#endif @@ -151,11 +143,7 @@ typedef tsl::robin_map