Compare commits

...
474 Commits
Author SHA1 Message Date
Larry Gritz fbce7d59f4 fix(ustring): fix Cuda warnings (#3978)
To my eyes, these two constructors look like they should be treated as
doing exactly the same thing:

    MyType()
        : mymember(...)
    { }

and

    MyType()
    {
       mymember = ...;
    }

But nvcc in Cuda mode says no, if the constructor is constexpr, the
former is okey dokey, but latter gives a warning. Fine, Cuda, whatver
you say.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-08 13:41:19 -07:00
Larry Gritz 616bf69fef build: Fixes to work properly with fmt 10.1 (partial port of #3973)
Rig CI to properly test "latest" and "bleeding edge" fmt. It turns out
we had not yet been testing 10.1 or keeping up with their master.

In the process, I discovered that the combo of fmt >= 10.1 and gcc >= 11
results in a mangled AVX math heisenbug, symptomatic in our simd_test. I
struggled with this on and off for many days, having great difficulty
reproducing (though it does fail every time and deterministically, I
just can't seem to narrow it to a smaller example). It only happens with
gcc, only gcc >= 11, only when we use FMT_EXCEPTIONS=0 to disable true
exceptions in fmt. The change happens specifically at fmt commit 9a034b0
(midway between 10.0 and 10.1), which changes the definition of
FMT_THROW when exceptions are disabled. Why this should affect SIMD math
is a total mystery, and currently I am suspecting either a gcc compiler
error or that it's exposing undefined behavior. I found that redefining
FMT_THROW on our side to something innocuous is a good workaround. If I
no longer disable fmt exceptions, that also makes it work, but I don't
know what that might break for us or downstream.

My report of this to the fmt project is
[here](https://github.com/fmtlib/fmt/issues/3620), maybe they'll uncover
the true cause.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-05 10:59:44 -07:00
Larry Gritz be3c19a978 Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-01 14:29:12 -07:00
Larry Gritz 9984e93000 Stage release v2.4.15.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-01 09:48:29 -07:00
Larry Gritz 1738e0a6a5 ci: Bump 'latest release' test to OpenEXR/Imath 3.2 and OCIO 2.3 (#3971)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-01 09:48:29 -07:00
Larry Gritz 904e8dfc37 build: Fix broken libheif < 1.13 (#3970)
Typo introduced in #3894 broke our ability to build against libheif <
1.13. A conditional compilation that should have kicked in for >=1.16
was mistakenly written as 1.6.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-31 17:11:33 -07:00
Larry Gritz f58124dd60 admin: Relicense code under Apache 2.0 (#3966)
This is Update 4, the original PR is ongoing and we will continue to
update as additional people relicense.

Per PR #3905 (https://github.com/OpenImageIO/oiio/pull/3905), update the
RELICENSING document with the names of people and companies who have
signed on to the relicensing thus far, and update the SPDX license
notices on source files whose extant authorship (per 'git blame')
comprises only authors who have relicensed.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-29 21:56:27 -07:00
Larry Gritz 21e10fb2c0 Admin: Add Jesse Yurkovich to the TSC (#3937)
Proposal from Thiago to add Jesse Yurkovich, representing Blender, to
the TSC.

Vote passed by majority of TSC members voting yes on the PR itself.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-27 22:01:42 -07:00
Jesse Yurkovich 4836a21950 fix(dds): Fix div by 0 during DXT4 DDS load (#3959)
Fixes #3950

Fix the div-by-0 when handling unassociated alpha during a DXT4 DDS
load. The code mirrors what other formats do by first checking to see if
the alpha value is not 0 before continuing.

Added the 218-byte file from the bug to the local test suite.

---------

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
2023-08-25 11:43:09 -07:00
Mikael Sundell 84cd074604 build: Added check for Boost_NO_BOOST_CMAKE, ignore if already set (#3961)
Enable set of Boost_NO_BOOST_CMAKE through make using
MY_CMAKE_FLAGS=-DBoost_NO_BOOST_CMAKE:BOOL=OFF.

Signed-off-by: Mikael Sundell <mikael.sundell@gmail.com>
2023-08-25 11:43:02 -07:00
Jesse Yurkovich 1f05697cbd Fix(rla): Invalid read from an empty vector during RLA load (#3960)
The incoming length of the RLE data could be 0. In this case we would
attempt to take the address of the 1st element of an empty vector.

Added a new 1004-byte file to the local test suite.

Fixes #3951

---------

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
2023-08-25 09:03:39 -07:00
Jesse Yurkovich 2031172953 cleanup: Fix typo in debug output (#3956)
Fixes a typo in the debug output triggered during the image plugin
search sequence.


Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
2023-08-25 09:02:00 -07:00
Larry Gritz 88249cf59a fix: various protections against corrupted files (#3954)
Fixes #3952

Several interrelated fixes to guard against corrupted files:

* Extend the `limits:imagesize_MB` sanity check to Targa files to
address #3952 specifically, and check in that failing example file into
the testsuite. (N.B.: Only a couple readers use this, TIFF and now
Targa. it should be extended to the others. Mackerel!)

* Improve the error message used for the above, both for Targa and TIFF.

* For low-memory situations, perhaps the default of 32GB is too large.
Make the default be the minimum of 32GB and 1/2 the size of physical
memory on the machine. (An app that legit expects humongous files is
expected to raise the limit appropriately.)

* The generic "Read error: hit end of file" we sometimes issued from
`ImageInput::ioread()` was hard to discern which reader it came from, in
cases where the file extension was absent or misleading and a succession
of files were tried. By changing this error message to say which format
reader triggered the error, it might make these errors easier to track
down in the future. This also changed the reference output of a few test
involving truncated or corrupted files.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-24 22:31:51 -07:00
Larry Gritz cd1ffe5abf ci: Make more robust timer_test (#3953)
On overloaded VMs, the timer_test is ureliable and fails spuriously too
often.

Two strategies in this patch, hope some combination does the trick:

1. Increase the absolute error allowed for the timing tests when doing
CI runs.

2. Add just a bit more relative error (via a new unit test macro,
OIIO_CHECK_EQUAL_THRESH_REL).

Hopefully this will cut down on CI failures for unit_timer test case.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-24 18:09:36 -07:00
ShootfastandLarry Gritz 6cbd1e8fa2 build: Silence gcc new/delete warnings for texturesys (#3944)
Disable GCC warnings around mismatched new/delete for shared_texturesys
creation


Signed-off-by: Shootfast <markboo99@gmail.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
2023-08-24 18:09:20 -07:00
Larry Gritz e015ae4293 dev(ustring.h): string literal operator for ustring and ustringhash (#3939)
* Add string literal operators for ustring and ustringhash so you can
write: ``` "foo"_us "bar"_ush ``` Note that on Cuda (but not on the
host), this ustringhash construction is constexpr.

* Add a new `ustringhash(const char*, size_t)` constructor, which is
also constexpr on the device side.

* Mark the existing `ustringhash(string_view)` constructor as constexpr
on the device side.

We can mark those things as constexpr on the device side because on the
Cuda side, the implementation only takes the hash (which is constexpr),
and does not actually add a ustring to the table (which cannot be
constexpr). To make such declarations easy, add a new macro to
platform.h, `OIIO_DEVICE_CONSTEXPR` which is constexpr for the device,
merely inline for the host.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-24 18:09:11 -07:00
xiaoxiaoafeifei 672ed4c445 fix(bmp): fix signed integer overflow when computing total number of pixels (#3948)
fix #3947: runtime error: signed integer overflow in file
src/bmp.imageio/bmpinput.cpp:302
2023-08-20 11:21:34 -07:00
Larry Gritz c90efcf167 admin: Update pull request and issue templates (#3946)
The most important fix is to remove links to the old CLAs and update
references to the mail list to the new one.

Also spruced up some language while I was there, hopefully to coax out
improved PRs and Issues.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-20 11:21:14 -07:00
Anton Dukhovnikov 65e3838985 build: suppress Xcode warnings (#3940)
When building the code with Xcode ("cmake -G Xcode"), there are 1000+
warnings about implicit 64 to 32 bit conversion.
This change adds a compile option to suppress such warnings when
generating an Xcode project.

Signed-off-by: Anton Dukhovnikov <antond@wetafx.co.nz>
2023-08-12 08:51:08 -07:00
Larry Gritz 6d2b4194e7 admin: Relicense code under Apache 2.0 (#3938)
This is Update 3, the original PR is ongoing and we will continue to
update as additional people relicense.

Per PR #3905 (https://github.com/OpenImageIO/oiio/pull/3905), update the
RELICENSING document with the names of people and companies who have
signed on to the relicensing thus far, and update the SPDX license
notices on source files whose extant authorship (per 'git blame')
comprises only authors who have relicensed.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-03 21:06:20 -07:00
NicolasandLarry Gritz 99e4bc86ac fix: utf-8 text rendering (#3935)
Text rendering doesn't work with utf-8... 

I can't render chinese, arabic... or special chars as éèûîà...

It seems that the string function to convert utf-8 to unicode is quiet
simple.

Fixes #3933 

[Note]: OpenImageIO is used in the [gpx2video
project](https://github.com/progweb/gpx2video).

---------

Signed-off-by: Nicolas VIVIEN <nicolas@vivien.fr>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
2023-08-03 20:55:56 -07:00
Larry Gritz 59953474b2 Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-01 17:05:44 -07:00
Larry Gritz 40cff8d4a5 Docs: Make sure README has links for slack and meetings (#3936)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-08-01 13:15:24 -07:00
Larry Gritz 4d7fed6984 Stage for v2.4.14.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-30 17:06:27 -07:00
Jesse Yurkovich 9757e20694 fix(python): Fix arithmetic overflow in oiio_bufinfo (Python interop) (#3931)
When an incoming 1-dimensional, buffer-like, object was used in Python,
the corresponding check inside OIIO would overflow if its length
exceeded a signed 32bit value.

An error similar to `Pixel data array error: Python array shape is
[2304000000] but expecting h=24000, w=24000, ch=4` would be raised.

I modified a few similar calculations and tried to follow the
predominant pattern already used.

Tested using the following snippet which would previously fail:
```
import OpenImageIO as oiio
import numpy as np

filename = "t:/foo.png"
xres = 24000
yres = 24000
channels = 4  # RGB
pixels = np.zeros(xres * yres * channels, dtype=np.uint8)

spec = oiio.ImageSpec(xres, yres, channels, "uint8")
image = oiio.ImageOutput.create(filename)
image.open(filename, spec)
if not image.write_image(pixels):
    print("error = ", image.geterror())
image.close()
```

---------

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
2023-07-29 11:06:19 -07:00
Larry Gritz 0881ebdedb build: bump build_openexr and build_opencolorio defaults to latest versions (#3920)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-29 11:06:03 -07:00
Larry Gritz 20756dad13 admin: Relicense code under Apache 2.0 (#3926)
Per PR #3905 (https://github.com/OpenImageIO/oiio/pull/3905), update the
RELICENSING document with the names of people and companies who have
signed on to the relicensing thus far, and update the SPDX license
notices on source files whose extant authorship (per 'git blame')
comprises only authors who have relicensed.

This is part 2, the original PR is ongoing and we will continue to
update as additional people relicense.

Signed-off-by: Larry Gritz <lg@larrygritz.com>

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-29 11:05:46 -07:00
Larry Gritz 39f2022aca docs: Put logo on the main readme (#3927)
Add some logo images in ASWF/logos for handy use.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-29 11:05:24 -07:00
Larry Gritz ec4ead0cbb ci: Lock down icx version (#3929)
Intel's servers have again updated the default icx that you get when you
install from their yum repository, and the new one seems incompatible
with our libstdc++ toolchain. So lock down on 2023.1.0 for now so that
our CI can pass.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-29 11:05:12 -07:00
jasonbaumeister 77c2a8b217 feat(ico): Add IOProxy support to ICOInput (#3919)
This updates ICOInput to use the IOProxy model so it can read from files
or the IOMemReader

Signed-off-by: Jason Baumeister <jason@jasonbaumeister.com>
2023-07-29 11:03:17 -07:00
jasonbaumeister c9d75870c6 fix(psd): CMYK PSD files should copy alpha (#3918)
During the CMYK to RGB conversion in PSDInput, the alpha channel was
never copied to the RGBA output. Converting a PSD to JPEG worked because
it ignored all the 0 alpha values, but converting to WebP would result
in a fully transparent image.

I added a cmyk-with-alpha.psd test to the psd-colormodes test to check
this

Signed-off-by: Jason Baumeister <jason@jasonbaumeister.com>
2023-07-29 11:02:53 -07:00
Larry Gritz b32e546d16 ci: Test against pybind11 v2.11 (#3912)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-29 11:02:39 -07:00
D-Spirits c1f43ae796 Admin: Add DevilishSpirits to RELICENSING.md (#3922)
For the relicensing request in #3905 and signed with my personal PGP
key.
2023-07-29 11:02:05 -07:00
Larry Gritz f8f342f08a build: Fix broken OIIO_NO_NEON definition (#3911)
Clean up the `#if` tests that disable Intel SIMD when not on Intel
architectures, which incorrectly disabled ARM NEON when on ARM.

Fixes #3909

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-16 21:48:49 -07:00
Jesse Y 5ca4b06516 docs: Update ImageInput docs to not use deprecated APIs (#3907)
Update the ImageInput documentation to not use the deprecated
`read_image` APIs.

Based on the discussion in #3902

---------

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
2023-07-15 16:46:20 -07:00
Larry Gritz 23751c1bf1 admin: Relicense code under Apache 2.0 (#3914)
Per PR #3905 (https://github.com/OpenImageIO/oiio/pull/3905), update the
RELICENSING document with the names of people and companies who have
signed on to the relicensing thus far, and update the SPDX license
notices on source files whose extant authorship (per 'git blame')
comprises only authors who have relicensed.

This is part 1, the original PR is ongoing and we will continue to
update as additional people relicense.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-15 16:46:15 -07:00
Benjamin Buch 110ed69660 build: Find OpenEXR equally well with our FindOpenEXR and exr's exported config file (#3862)
If OpenEXR is found by cmake config file, OpenEXR_VERSION is set instead of OPENEXR_VERSION

Signed-off-by: Benjamin Buch <benjamin.buch@technoteam.de>
2023-07-15 16:45:52 -07:00
Benjamin Buch 3ab3231304 build: Fix WebP linking if CMAKE_FIND_PACKAGE_PREFER_CONFIG is ON (#3863)
Our own FindWebP.cmake was setting up targets that didn't
match the capitalization of the cmake configs that come with WebP itself.

Signed-off-by: Benjamin Buch <benjamin.buch@technoteam.de>
2023-07-15 16:45:43 -07:00
Larry Gritz 99542f910d admin: Mark more files that LG has contributed to as 'and Apache-2.0' (#3906)
This batch is for files that LG (relicensed!) has contributed, in
addition to >2 other authors. Also add appropriate license notices to
some that had no posted license before due to oversight.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-13 18:19:29 -07:00
Larry Gritz a21aa460ff admin: Copyright and license notice updates (#3904)
* Add copyright/license notices to some mixed-authorship files that
lacked them before (all related to tests)
* Get rid of the pointless year in many copyright notices (change to the
current LF recommended wording)

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-08 20:38:16 -04:00
Larry Gritz 95177f11a6 admin: update licensing (#3903)
Since LG has re-licensed all his old code under Apache-2.0, we can
change the license notice from BSD to Apache-2.0 for all files in which
LG is the only extant author. Also change all files that LG co-authored
with other people to specify "BSD-3-Clause and Apache-2.0".

Some files (mostly test scripts) had no license notice, so in those
cases, we added one.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-08 20:37:06 -04:00
Larry Gritz ab08205f6a admin: Change open source license to Apache 2.0 (#3899)
By majority vote of the TSC, we are changing OpenImageIO's main
incoming/outgoing open source license from BSD-3-Clause to Apache-2.0.
New code submitted from July 1, 2023 will be contributed under the
Apache 2.0 license.

Old code submitted prior to July 1 2023 is under the original BSD
3-clause license, unless relicensed per the process described in the new
RELICENSING.md file. We hope to get the vast majority of the code base
relicensed quickly and we will document which set of files contain a
mixture of licenses.

Instructions to everybody reading this:

* If you are contributing code under the authorization of an employer,
please let them know we are changing to Apache 2.0 and make sure that
you are authorized to make all future contributions to under that
license.

* If you made prior contributions to OpenImageIO over the years and are
willing to relicense your code under the Apache 2.0 license, please
submit a PR adding your name to the list in RELICENSING.md. If you were
working for a company that might own your IP output at the time you made
those contributions, please also ask somebody there (who has the
authority to do so) to submit a PR adding the company name as well,
indicating that they are re-submitting all of the old contributions
under the new license.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-08 20:33:56 -04:00
Larry Gritz d6c151efba docs: Document CVE
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-08 20:33:22 -04:00
Larry Gritz 50d51f58d7 admin: Remove old CLAs that are no longer in effect
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-05 21:34:11 -04:00
Larry Gritz 91341990f6 admin: Add charter and other ASWF documents to the repo (#3850)
By unanimous vote of the OpenImageIO TSC, as of July 1, 2023, we
adopt the technical charter, Code of Conduct, new CLAs, and GOVERNANCE
document.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-05 21:33:51 -04:00
Larry Gritz 7b3d368a87 Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-01 11:54:02 -07:00
Larry Gritz d308780e12 Stage v2.4.13.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-01 09:38:58 -07:00
Larry Gritz 8e8dab1215 fix(strutil.h): ensure proper constexpr of string hashing (#3901)
The underlying farmhash algorithm (which is the basis for
Strutil::strhash, and thus ustring's hash representation) turned out to
not be properly constexpr under certain circumstances and needed to be
expressed a different way to be fully constexpr on all platforms and for
all strings.

New implementation suggested by Alex Wells.

Also, make sure string_view ctr from char* can be constexpr, even for
C++14. This is related for the sake of the strhash calls that, when
taking string literals, actually choose the variety that accepts a
string_view.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-01 01:29:47 -07:00
Larry Gritz dfa76c7a5e testing: Fix missing simd test due to copy paste typo (#3896)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-01 00:08:38 -07:00
Larry Gritz b86d8ad011 docs: Document use of the DCO which is now required for all PRs (#3897)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-01 00:08:20 -07:00
Larry Gritz 9bcd4e7a1f ci: Simplify build_llvm.bash script (#3892)
* Remove leftover logic from when we used TravisCI.
* Pick a default for LLVM_DISTRO_NAME so it works when the script is run
standalone when not on GitHub Actions CI. (But it's still really only
meant to run on x86 Ubuntu, and not designed for anything useful outside
of our CI.)
* Eliminate all the complexity with old LLVM versions -- in practice,
our CI only uses this to download fairly modern clang versions.

Fixes #3891

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-01 00:07:51 -07:00
Larry Gritz f11dbfc40d ci: Fix broken heif dependency and test (#3894)
The strukturag repo for libheif recently upgraded the version it was
serving from 1.14 to 1.16, and that caused our tests to fail because (a)
some of the codec support has been moved to plugins that are loaded at
runtime and those are now distributed in packages we need to install
separately; (b) you must call heif_init() or it won't know about the
optional plugins.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-07-01 00:07:19 -07:00
Larry Gritz 84f8acdc56 docs(raw): Fix explanation of raw:Exposure config hint (#3889)
Fixes #3888

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-17 16:35:16 -07:00
Larry Gritz c79e11bfcf fix(IBA): Improve error message for IBA::ocio functions (#3887)
If colorconvert, ociolook, ociodisplay, ociofiletransform fail
because OCIO support is not enabled, make sure the error message
makes that clear.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-16 18:56:36 -07:00
Fabien Servant @ TCS 44ab7f4192 fix(exif): Convert paramvalue string to integer when needed (#3886)
Make sure we can input exif tags as strings containing numbers when
number are required.

E.G. if my input is "Orientation"=>"8", i would like the jpeg output to
contains the value 8 for the exif tag orientation.
2023-06-16 18:56:30 -07:00
Larry Gritz 55f97a43b7 fix(exr): correction to dwa vs zip logic when outputting OpenEXR (#3884)
PR #2147, addressing issue #1844, is related to an apparent OpenEXR bug
wherein single channel tiled images where the tile dimensions were not a
power of 2 and >= 16 would not work properly with dwa compression. We
work around the problem by automatically substituting zip compression in
those cases. But it was implemented with a subtle bug, forgetting that
tile_size == 0 for untiled images, and thus we were silently switching
from dwa to zip compression for all *untiled* single channel images of
any size (which presumably were never problematic). This patch fixes the
test so we are not changing the compression for the untiled files.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-14 13:30:32 -07:00
Larry Gritz 5b2d2066e6 fix(jpeg2000): better pixel type promotion logic (#3878)
J2K output was defaulting to UINT8 when asked to output an unsupported
type. It should have been UINT16 to try to minimize the amount of
precision loss.

Fixes #3876

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-14 13:30:32 -07:00
Larry Gritz bd588e5ca8 admin: Update mail list URL (#3880)
Everybody please go to https://lists.aswf.io/g/oiio-dev and sign up for
the new mail list as soon as possible. The old list is on its last legs
and having trouble, let's get this done.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-14 13:30:32 -07:00
Larry Gritz c7ff69ff59 ci: Add test with new aswf containers for VFX Platform 2023 (#3875)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-12 16:40:24 -07:00
Larry Gritz e97403c7ba build: Fix fmt vs gcc warning that had version typo (#3874)
The comment was right, but the test seems to have had a typo we didn't
catch in review.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-12 10:21:23 -07:00
Larry Gritz 8add832fa8 fix(psd): Prevent simultaneous psd thumbnail reads from clashing (#3877)
When reading a PSD file, if it contains a thumbnail, we read it from the
in-memory blob with a combination of an IOMemReader and an ImageBuf.
But... we always named it "thumbnail.jpg" without considering that
multiple simultaneous PSD files reading identically named images (but
which are in fact different) could cause a weird kind of clashing in any
underlying use of ImageCache!

The simple fix is to use ordinary ImageInput approach to reading the
thumbnail from the IOMemReader, but just store it in the ImageBuf.

Fixes #3824

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-12 10:21:14 -07:00
xiaoxiaoafeifei 749a557b5e fix(ico): heap-buffer-overflow (#3872)
heap-buffer-overflow in function ICOInput::readimg 

fixes #3871
2023-06-10 11:04:50 -07:00
Larry Gritz c095abae93 build: Fix use of OIIO_LOCAL_DEPS_PATH (#3865)
We set it, but we didn't use it where it was intended.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-10 11:04:43 -07:00
Jesse Y e43cbe830c docs: Many fixes to python code examples (#3869)
A variety of minor documentation fixups:
- Use Python 3 style 'print' statements consistently everywhere (some
snippets had a mix of both)
- Correct the usage of `ImageSpec::channels` that should be
`ImageSpec::nchannels`
- Template syntax errors in two C++ snippets
- Document the new default for `max_memory_MB`
2023-06-10 11:02:46 -07:00
Ziggy Cross 98ff1e57ae ImageInput and ImageOutput docs updated to Python 3. (#3866)
## Description

Fixes #3846 by updating Python examples.

Current code examples for
[ImageInput](https://openimageio.readthedocs.io/en/latest/imageinput.html)
and
[ImageOutput](https://openimageio.readthedocs.io/en/latest/imageoutput.html)
raise a SyntaxError in Python 3:
```python
File "<cwd>\main.py", line 13
    return
    ^^^^^^
SyntaxError: 'return' outside function
```

It seems these code examples might be for Python 2.7. Perhaps it would
be worth creating an extra tab instead of replacing the old code?

## Tests

Tested on Python 3.11, no issues.

## Checklist:

- [x] I have read the [contribution
guidelines](https://github.com/OpenImageIO/oiio/blob/master/CONTRIBUTING.md).
- [ ] If this is more extensive than a small change to existing code, I
  have previously submitted a Contributor License Agreement

([individual](https://github.com/OpenImageIO/oiio/blob/master/src/doc/CLA-INDIVIDUAL),
and if there is any way my
  employers might think my programming belongs to them, then also

[corporate](https://github.com/OpenImageIO/oiio/blob/master/src/doc/CLA-CORPORATE)).
- [x] I have updated the documentation, if applicable.
- [ ] I have ensured that the change is tested somewhere in the
testsuite
  (adding new test cases if necessary).
- [x] My code follows the prevailing code style of this project.
2023-06-07 16:04:17 -07:00
Larry Gritz 503fb7a511 feat(OpenCV): Improve OpenCV support -- errors, version, half (#3853)
Various improvements to OpenCV support:

* IBA::from_OpenCV and to_OpenCV now set error messages for every type
of failure they encounter, instead of returning false with no
explanation. For from_OpenCV, the error message can be retrieved from
the ImageBuf returned; for to_OpenCV, the error message can be retrieved
from the global OIIO::geterror(). Several assertions were removed,
instead relying on error return codes and messages.

* Add global OIIO attribute "opencv_version" which allows you to find
out what version of OpenCV OIIO was built against, which was previously
impossible to know without seeing the build-time status messages. This
can be retrieved via

      OIIO::get_int_attribute("opencv_version")

  and also you can find out from the command line with

      oiiotool --echo "{getattribute(opencv_version)}"

The return value is an integer encoded as `10000*major + 100*minor +
patch`, and it will return 0 if no OpenCV support was enabled when
OpenImageIO was built.

* For OpenCV >= 4.0, to_OpenCV can now correctly construct a 'half'
matrix. For OpenCV 3.x, we turn it into a float matrix as before, since
CV_16F was only supported starting in 4.0.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-02 11:38:35 -07:00
Larry Gritz a7ff737902 docs: Update CONTRIBUTING and SECURITY (#3852)
Just a routine update of these files as I proofread them in light of the
move to ASWF. This patch is addressing the "old" project, there will be
further ASWF-specific edits for changes that will take effect after the
project is fully moved.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-02 09:49:13 -07:00
Loïc Vital 1cd944338c fix(jpeg): fix density calculation for jpeg output (#3861)
In `jpegoutput.cpp` when computing the density fields the relationship
between `XRes`, `YRes` and `aspect` is `aspect = XRes / YRes`.

However this relationship was not respected in one specific case, when
`aspect >= 1.0` and `XRes` and `YRes` are not set.

This PR solves this problem by enforcing the correct relationship.

Related to: https://github.com/OpenImageIO/oiio/issues/2822
2023-06-02 09:49:03 -07:00
Larry Gritz 5cb94101ba Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-01 13:02:37 -07:00
Larry Gritz e7fe406481 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-01 10:26:37 -07:00
Larry Gritz 73fdd4281a Stage for v2.4.12.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-01 10:11:09 -07:00
Larry Gritz 0c48ae1ae3 ci: Fix package name for icc (#3860)
The Intel yum repo renamed this package a couple weeks ago, and it broke
our CI. Update to the new name.

Adjust fmt use to solve icc warning.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-06-01 07:33:26 -07:00
Loïc Vital 0e9406e17a fix(raw): raw input fix user_flip usage (#3858)
When reading a raw image, setting the `user_flip` to 1 meant ignoring
the `flip` value (to avoid buffer rotation from LibRaw).

However the value 1 for the `user_flip` is **not neutral**: values lie
between 0 and 7 (see
https://www.libraw.org/docs/API-datastruct-eng.html#libraw_image_sizes_t),
and 1 corresponds to a horizontal mirror (in my understanding of the
source code).

The proposed fix is to use 0 as `user_flip` value for ignoring the
`flip` value.

This modification invalidates the changes made in this PR:
https://github.com/OpenImageIO/oiio/pull/3847.
Therefore, flip to orientation conversion has been adapted to match
exactly LibRaw's documentation, which handles only rotations (+90, +180,
-90 degrees).

The previous PR was only tested on images of landscape and human faces,
hence the mirroring issue remained unnoticed.
When reading images containing text however the problem is clearly
visible.
This PR fixes this mirroring issue on the following 4 orientations: 0,
+90, +180 and -90 degrees rotation.
Other orientations could not be tested as they don't seem to ever appear
on raw images datasets.
2023-06-01 07:33:19 -07:00
Larry Gritz 73d99b9733 build(Mac): Fixes for latest xcode on MacOS 13.3 Ventura (#3854)
I found that this was needed after weekend OS update of my laptop.

Also added MacOS-13 CI test.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-05-29 09:52:07 -07:00
Loïc Vital e28cffbf2a fix(raw): fix LibRaw flip to Exif orientation conversion (#3847)
When reading a raw image while having a `user_flip` set to 1, we set the
orientation Exif tag to LibRaw's flip value (so that LibRaw doesn't
rotate and/or mirror the buffer but the image still gets displayed
correctly).

However LibRaw's convention for flip values differ from Exif orientation
values: https://www.libraw.org/comment/5176#comment-5176.

In this PR we fix this issue by converting LibRaw flip values to Exif
orientation values. This conversion is based on:
- https://www.libraw.org/comment/5178#comment-5178 (conversion proposed
by LibRaw's maintainer)
-
https://github.com/LibRaw/LibRaw/blob/6fffd414bfda63dfef2276ae07f7ca36660b8888/src/write/file_write.cpp#L22
(LibRaw's function for applying the flip).

Tested on:
- CR2 images with flip values 1, 5 and 6
- ARW images with flip values 1 and 5
(unfortunately I could not find any image covering other flip values).

Since the conversion is `[1, 2, 3, 4, 5, 6, 7, 8] -> [1, 2, 4, 3, 5, 8,
6, 7]`, the only test that came out with different results before and
after the change is the one with flip value 6:
in that case, the image orientation got corrected by the fix.
2023-05-19 18:56:00 -07:00
xiaoxiaoafeifei 5ff2c56dd2 fix: prevent heap-buffer-overflow in file src/gif.imageio/gifinput.cpp, line 368 (#3841)
Fixes #3840
2023-05-19 18:55:49 -07:00
Larry Gritz 2d0e89bdab fix(int): prevent possible deadlock when reaading files with wrong extensions (#3845)
Make pvt::imageio_mutex be a recursive_mutex

Fixes #3842
2023-05-17 09:24:11 -07:00
Larry Gritz 1ebe68ca90 fix(oiiotool): don't propagate unsupported channels (#3838)
Fixes #3837

oiiotool already attempted to trim extra channels when outputting to a
format that can't support it. It correctly handled the two common cases:

* More than 4 channels for formats that don't have
`supports("nchannels")` will drop after the first 4 channels.
* More than 3 channels for formats that don't have `supports("alpha")`
will drop after the first 3 channels.

But this omits an interesting (but rare) corner case: a 4 channel file
where the last channel is NOT alpha, and the output file supports an
alpha channel but not arbitrary channels. A concrete example might be an
input file that is exr with channels R, G, B, Z, writing to a PNG file
(which can support RGB or RGBA). We wouldn't want to write what appears
to be an RGBA file if that last channel isn't really alpha.

Also, noticed that oiiotool --chnames didn't properly clear the
alpha_channel and z_channel flags, which is important if the new channel
lists drop one of those channels.
2023-05-15 14:49:27 -07:00
Larry Gritz 405909bf70 Improve make_texture for very large images (#3829)
`make_texture()` already took a configuration option "maketx:forcefloat"
(defaults to 1), which if set to 0 disables the conversion to a float
buffer for intermediate computation.

For `oiiotool -otex`, there was no way to specify this. This patch
allows it to be disabled with the new optional modifier
`-otex:forcefloat=0`.

Also, in make_texture, this option only controlled the initial
conversion of the whole buffer to float, but the downsized levels all
were float either way. This patch now uses the forcefloat config option
to also control the buffers used for downsizing.

Disabling forcefloat like this has a speed penalty (the downsizing math
on float buffers is faster than going in and out of float for every
indvidual value) and loses some precision in the process of repeatedly
downsizing to generate the MIP levels. But it can sure save a lot of
memory if you have a ginormous uint8 image and want to avod the 4x
balooning of memory. I don't recommend disabling forcefloat except for
images that can't fit into memory for the texture creation without it.
But when this is the right hammer to use, it can be the difference
between being able to create the texture, or not.

Some other improvements:

* `oiiotool -otex` wasn't outputting ANY status output during texture
output as maketx does, and for that matter, -v and -debug were not being
influencing the behavior of make_texture at all despite it having such
support. So fix to pass down the right flags. Now there are proper
verbose status and debug messages when requested.

* Eliminate useless call to is_monochrome by calling it only when the
previously-computed pixel stats indicate that the average value of all
the channels is the same (if they don't have the same average, there's
no way the pixel-by-pixel values will be the same in all channels for
all pixels). This saves an extra traversal of all the pixel memory
during texture creation.

* Use synchronized/flushed status messages so users can see them as they
are issued for very long maketx tasks. This also included some
conversion from old iostream stuff to fmt-based print.

* For verbose/debug, more fine-grained timing for make_texture, in
particular, print the time spent downsizing and writing each MIP level.
2023-05-15 12:00:45 -07:00
Larry Gritz aead17571b ci: Fix warnings (#3833)
I'm honestly not sure why some GHA CI jobs suddenly started warning
about this in the past day or so. Something must have updated on their
end. But switching to the safer Strutil equivalents fixes it.
2023-05-15 11:59:35 -07:00
Ray Molenkamp 61d234347c Fix: Build error with MSVC (#3832)
`ssize_t` is a posix type, msvc seemingly doesn't know about leading to
a build error with MSVC 2019

usage elsewhere in this files used the `py::ssize_t` type, which seems
to fix this
2023-05-15 11:59:19 -07:00
Larry Gritz adf95f683a build(deps): fmt 10.0 support (#3836)
fmt 10.0 was recently released, and it breaks a lot for us because they
have fully removed legacy support for automatically being able to format
anything that has an iostream `<<` operator. This facility was deprecatd
in 8.1 but could be re-enabled with FMT_DEPRECATED_OSTREAM, but even
that was removed in 10.0.

So this means that we had to write several explicit format handlers for
some types for use with format() and print().

Also, they are even more strict with sprintf/printf which don't honor
the custom formatters as far as I can tell, so in several cases I also
switched those to the std::format/print style.

Fixes #3835
2023-05-15 11:12:34 -07:00
Larry Gritz 5b59ff65e3 One more revision to synchronized Strutil::print (#3828)
This is a continuation/fix for #3825
2023-05-15 11:12:31 -07:00
Larry Gritz e29c89b136 cleanup(strutil): use forward properly for sync::print(). (#3825) 2023-05-15 11:12:26 -07:00
Larry Gritz fa5dd1b222 fix(psd): Improve memory efficiency of PSD read (#3807)
The PSD reader was written 12 years ago by a GSOC student and has
changed little since. The following is not a knock on that student, who
clearly did a good job if his code has survived mostly unomdified for
over a decade. In chasing down problems with handling extremely large
psd files, I've noticed some oddities and inefficiencies that need
fixing. It's not an emergency, so I'll handle it in pieces.

The item addressed by this patch is memory usage and thread concurrency.
It turns out that the reader allocates memory for the scanline reads as
it goes... and basically keeps it in the ImageInput until it's
destroyed, even though it will never actually be used again. I guess
it's just trying to save the next allocation if it reads the same
scanline again or on the next subimage? But this means that if you read
a really big psd image, it's basically doubling the memory use -- it
reads one copy into the user's buffer, but also holds on to this extra
copy for no reason. Also, a bunch of the decoding helper functions
implicitly use this memory, which means we lock a mutex for the duration
of read_native_scanline (which in theory should not be necessary since
all I/O is happening through thread-safe IOProxy calls).

So this patch does the following:

1. Remove both this retained scanline memory as well as some other
scratch memory from the ImageInput, and make it allocated and freed
local to read_native_scanline.

2. Change all the helper methods that used it implicitly so that they
are passed buffers to use. In many cases these have been changed to
`const` methods and in a few cases to `static`, making it much easier to
assure ourselves that they don't modify (or sometimes use at all)
anything in the PSDInput to do their task.

3. The result of these changes means that read_native_scanline doen't
need to modify any of the data methods of the class (though it does use,
without modifcation, some things set up in the course of open). Because
it's now non-mutable, we can also remove the mutex, now allowing
multiple threads to read scanlines from the same file simultaneously
without blocking each other.

4. Some other miscellaneous cleanup, including that some scratch memory
was allocated as std::string (!), whereas it should really be a
`vector<unsigned char>` or `unique_ptr<unsigned char>`, and also
changing some computations from double to float.

There is still some more work to do after this is merged. In particular,
I think now that scanline read is stateless / non-mutable with respect
to the PSDInput object, this is a candidate for adding a multi-scanline
read_native_scanlines method (replacing the default implementation of
looping and calling read_native_scanline serially for each scanline),
which should also be able to read multiple scanlines with some overhead
and allocations done once per block, and with blocks of scanlines
running in parallel using the thread pool. This should be a huge
efficiency gain when reading psd files. But it will wait until the next
patch.
2023-05-05 16:48:22 -07:00
Larry Gritz c903169614 Bump version after release 2023-04-30 22:51:32 -07:00
Larry Gritz 56449a9d72 Stage for v2.4.11.0 2023-04-30 22:50:12 -07:00
Larry Gritz d84fef0922 feat(oiiotool): expression eval NIMAGES gives current stack depth (#3822)
Based on a suggestion Matt Chaput on the oiio-dev mail list.
2023-04-30 11:09:31 -07:00
Edoardo DominiciandEdoardo Dominici 41ced5bf5b Fix float128 compilation of NVPTX backend for LLVM (#3823)
The latest version of libfmt began using the `__float128` type but this
is [not supported in the NVPTX backend for
LLVM](https://discourse.llvm.org/t/compiling-cuda-code-fails/61240/13).
A way to detect this particular platform seems to be to check both
`__CUDA_ARCH__` and `__clang__`.
I am not disabling it entirely on any CUDA target because NVCC 10+
understands `_float128` and generates instructions for it when tested on
godbolt.

Following up from https://github.com/OpenImageIO/oiio/issues/3809.

Co-authored-by: Edoardo Dominici <edoardod@sy1wse0003.al.com.au>
2023-04-30 10:44:18 -07:00
Larry Gritz c7e37e5c5c test: Change the few symbolic links to copies to help Windows (#3818)
Windows isn't smart about symbolic links. There were a few places in the
testsuite where we used symlinks to essentially de-duplicate test
reference images that were expected to be identical. But then the
resulting archive you get when you ask GitHub for a zip file of the
whole repo (which some people download to get OIIO source rather than
git clone) can't be unzipped correctly on Windows (at least not by
cmake's unzip command).

OK, so just change those links to full copies.

Fixes #3811
2023-04-25 17:04:46 -07:00
Jesse Y 561b1ed0f9 build: Fix incorrect branch name when cloning openexr-images for the tests (#3814)
The `openexr-images` repo was never updated after the default branch was
renamed to `main`. This will fix the following silent errors in CI:
```
Cloning into '/__w/oiio/oiio/build/testsuite/openexr-images'...
warning: Could not find remote branch master to clone.
fatal: Remote branch master not found in upstream origin
```

Additionally, the cmake attempted to symbolically link local repos like
`oiio-images` if they were found. Unfortunately this type of link will
fail unless running as admin on Windows (which is rare) and the
COPY_ON_ERROR directive did _not_ work here (cmake 3.24; weird;
sigh...). The output will now look something like the following:
```
-- Linking oiio-images from C:/Users/jesse/source/oiio-images
-- Link result failed to create symbolic link 'C:/Users/jesse/source/oiio/build/testsuite/oiio-images': A required privilege is not held by the client.
-- Copying oiio-images from C:/Users/jesse/source/oiio-images
```
2023-04-25 14:36:01 -07:00
AdamMainsTL 3c8ce0ed00 Support HIF extension (#3813)
I've come across some unsupported files from Canon cameras that have a
.hif extension. These are HEIC/HEIF files with a slightly changed
extension. I have no idea why Canon decided to do this. Without any
changes I am able to open the images, probably because it checks the
header, but I am unable to write to paths with a hif extension.

Some random articles/forum posts mentioning the HIF format in relation
to Canon cameras:
https://www.cameralabs.com/jpeg-vs-heif-canon-hif-comparison/
https://www.dpreview.com/forums/thread/4558661

https://www.reddit.com/r/canon/comments/kjc6xl/new_eos_r6_owner_here_photo_files_show_up_as_hif/
2023-04-24 22:03:20 -07:00
Larry Gritz 2e835bacdf build: ffmpeg 6.0 support (#3812)
It seems to work fine with the new 6.0 with no code modifications, other
than our cmake build misidentifying the version.
2023-04-22 23:15:37 -07:00
Larry Gritz 4646313d35 Refactor simd.h to disable Intel inrinsics when not on Intel (#3810)
Especially when compiling for Cuda.

Fixes #3809
2023-04-19 09:40:19 -07:00
Brad Smith 31bc1e6432 Fix building on OpenBSD (#3808) 2023-04-18 23:51:58 -07:00
Larry Gritz 534e47eef2 fix(psd): Handle very wide images (#3806)
When decoding RLE data, some arguments to decompress_packbits() were
inexplicably declared uint16_t (they were passed uint32_t arguments, and
I honestly don't know why we didn't get a warning all along). This
prevented us from correctly reading PSD images whose width was more than
64k, which I suppose are rare enough that it's not hard to understand
why this went unreported for so long.

But anyway, just changing those parameters to uint32_t does the trick.
2023-04-17 08:54:24 -07:00
Eric Mehl 8ec4a8dca3 Fix fast_exp2 with MSVC and sse4.2 (#3804)
I ran into the problem described in #2929 and did a little digging to
see if I could find the source of the bad color conversions. I tracked
it down to `fast_exp2()`
https://github.com/OpenImageIO/oiio/blob/a77e36250fadfb4c391688eb1df4b3dd88d5e367/src/include/OpenImageIO/fmath.h#L2050-L2080

and in particular the return statement on L2071. In the process of
trying to figure out what part of that return statement was going awry,
I found that separating the bitcasts to separate variables as in this
PR, the problem went away. All testing was done with the `color_test`
added in #3023.

It also succeeded when adding various `std::cout` lines to check what
the values of each computation were, so it does sound like a compiler
optimization that does or does not get triggered is the problem.

Unfortunately I don't know why it's not failing on the CI builds, I
double checked to make sure I'm using the same settings and flags. I
also tested on two different machines and get the same failures, and
success with this patch, on both.

One strange wrinkle is that even without this patch, color conversions
worked fine when using AVX2 for the SIMD mode.

Summary :
Previous results (without this patch)

- USE_SIMD=0 - PASS
- USE_SIMD=SSE4.2 - FAIL
- USE_SIMD=AVX - FAIL
- USE_SIMD=AVX2 - PASS

With this patch
- USE_SIMD=0 - PASS
- USE_SIMD=SSE4.2 - PASS
- USE_SIMD=AVX - PASS
- USE_SIMD=AVX2 - PASS

Visual Studio 2019 versions 16.11.32228.343, 16.11.33328.57 and
16.11.33423.256(same as current Github build runners) in RelWithDebInfo
mode.
2023-04-15 09:43:38 -07:00
Larry Gritz 5187a52dab fix(python): improve error messages of bad python array sizes (#3801)
For cases of calls like `ImageOutput.write_image(array)`, this improves
the error messages when the array dimensions don't match the size of the
image we're writing, in two ways:

1. For the case of 2D images where the dims don't match, print what the
array shape actually is and what was expected. That's more helpful than
just saying "can't figure out array shape" and printing the number of
dimensions (but not the shape).

2. A mistake caused a number of error messages to be substituted by a
cryptic "can't handle numpy array with noncontiguous channels", but that
was only supposed to be for one particular case; fix that.
2023-04-13 11:26:31 -07:00
Larry Gritz 65806259dd fix(raw): handle raw 1-channel raw images (#3798)
Fixes #3797
2023-04-13 11:26:18 -07:00
Larry Gritz f660d2d7fe Bump version after release 2023-04-02 08:43:29 -07:00
Larry Gritz 0b131b231b Stage for v2.4.10.0 2023-04-01 16:34:53 -07:00
Tom Knowles 448d05d51f fix(maketx): Add support for CDFs of bumpslopes channels (#3793)
Currently, if you run oiiotool with --bumpslopes and --cdf at the same time (or -obump:cdf=1), the CDF is only produced for the first four (of six) channels. The techniques described in Burley (2019) actually do apply reasonably to the squared derivative channels, so it's useful to allow all six channels to have CDFs here.

maketx and oiiotool-maketx tests updated with new relevant tests.
2023-04-01 12:42:02 -07:00
Larry Gritz c8559ea177 Testing: improve testing of maketx (#3748)
* Tests for maketx -u, --attrib, --sattrib, --cdf

* maketx was documeted to take --cdf as a simple flag, but was
  incorrectly implemented as requiring a (pointless) nonzero argument.
  Fix it and hope nobody was depending on the undocumented behavior.

* maketx -v arg never had any effect. Add it back.
2023-04-01 11:50:59 -07:00
Larry Gritz 5e386bc330 Document that OIIO builds fine with clang 16 2023-03-31 19:10:05 -07:00
Larry Gritz 9d933a75d1 CI: bump 'latest versions' test to the newest openexr release (#3796) 2023-03-30 23:41:42 -07:00
johnfeaandTuomas Tonteri d3c6fd2e4d Make project compile with clang 11.0.1-2 in Mac (#3795)
Co-authored-by: Tuomas Tonteri <e90@tuomastonteri.fi>
2023-03-30 23:41:38 -07:00
Larry Gritz 12931a4891 fix: unique_ptr type mismatch caught by sanitizer (#3790) 2023-03-12 00:53:21 -08:00
Larry Gritz 2f92fcb894 fix(gif): gif.h array overrun (#3789) 2023-03-12 00:09:41 -08:00
Larry Gritz 7fa327a634 docs: edit INSTALL to correctly reflect changed dependencies lately
There were still some bolded (indicating newly changed) dependency
minimums that actually were bumped in 2.3 and should have been
unbolded long ago.
2023-03-11 15:36:53 -08:00
Larry Gritz 9934ab38a9 ci: updates to runners, dependencies (#3786)
* Don't use deprecated ubuntu-18.04 runner. Switch to running on
  ubuntu-20.04, but use docker containers that supply ubundu-18.04.

* Bump 'latest' version of openexr, webp, pugixml.
2023-03-11 15:08:09 -08:00
Larry Gritz 3a0d7d068f fix(IC/TS): Avoid deadlock situations with file handle cache (#3784)
There turns out to be a way to get wedged into a mutual deadlock on
the file handle cache, with how get_texture_info on a udim pattern
checks to see if the attribute requested is present and equally valued
in all constituent files of the udim set. This hits the handle set
pretty hard, and if multiple threads are hammering the same sets and
rapidly cycling textures out of the cache, there can be trouble, it
seems.

Remedies in this patch:

* When it's trying to close files because the number of handles is too
  high, we already had it so that if we only exceeded the max_files
  limit by a little bit, we would simply try to get the lock, and
  abandon the attempt if somebody else is holding it, but if we are
  quite a bit over, then stay and wait for the lock to be released.

  In this patch, we make the that default behavior -- if we are over
  the limit and need to free some handles, simply try to get the lock,
  and if somebody else is holding it, leave it all up to them and
  return immediately. The pros of this are (a) snappier response by
  never waiting at this point, and (b) removing the possibility of a
  deadlock, because if you can't acquire the lock, you just move
  on. But the con is that lots of threads adding new files may run
  faster than the one thread who has the file and is trying to release
  files, so it's possible that the number of handles will exceed the
  limit by a wider margin now, but hopefully only momentarily.  (But
  note that this can be overridden with a new ImageCache attribute
  "max_open_files_strict", which if set to nonzero revert to the old
  behavior. At least for now, in case I am neglecting to understand
  some bad consequence of this change.)

* The recursive_mutex controlling access to the ImageInput in each
  tile cache record is changed to a recursive_timed_mutex, and when
  closing a handle by calling release(), instead of an unconditional
  lock, try acquiring a lock for 100ms. If it fails to do so, it may
  be in a possible deadlock, so just give up and move on. The only
  consequence is that maybe that handle isn't freed after all. It will
  then move on to the next one, not the end of the world, but at least
  it can't get stuck there.

* In find_file, eliminate the call to check_max_files -- it's not
  needed here, since it's also called by open(), which is the only
  time that new file handles might be opened. We just don't also need
  it again simply because we're adding a file to the cache.
2023-03-10 23:01:51 -08:00
Fabien Castan 8a0ac72b0f rawinput: fix typo on CameraElevationAngle (#3783) 2023-03-07 18:16:08 -08:00
Larry Gritz bc75a81fcf Bump version after release 2023-03-01 09:57:57 -08:00
Larry Gritz 246ee42759 CHANGES and stage for v2.4.9.0 2023-03-01 09:52:37 -08:00
Larry Gritz 7abc4faf89 Qt6 compatibility (#3779) 2023-03-01 09:11:42 -08:00
Larry Gritz 3954b098b4 api(ustringhash): make a public explicit ustringhash ctr from hash value (#3778) 2023-03-01 09:10:27 -08:00
jreichel-nvidia e191d3b9eb Add cmake option to disable the stacktrace functionality. (#3777)
Setting the cmake option OIIO_DISABLE_BOOST_STACKTRACE to ON disables the use of
Boost stacktrace at compile time. This avoids dependencies on helper libraries
like dbgeng.dll.
2023-03-01 09:00:54 -08:00
Larry Gritz b4b4dcd6e3 fix(ImageCache): Avoid bad IC stats when no files were read (#3765) 2023-02-13 13:57:30 -08:00
Russell Greene 92a34f8596 use check_cxx_source_compiles instead (#3774) 2023-02-13 13:57:09 -08:00
Larry Gritz c145b80833 Bump version after release 2023-02-13 09:01:31 -08:00
Larry Gritz f4b38d9c30 Stage v2.4.8.1 2023-02-13 08:59:19 -08:00
Larry Gritz a39692256b fix: race condition in TIFF reader (#3772)
* test: Add a corrupted test file

* fix(IC): upon tile read error, mark the file as broken

The idea is to keep fruitlessly reading from a corrupted file.

* fix: race condition in TIFF reader

TIFFInput::read_native_tiles had a very subtle race condition.  There
is a section where it has a task_set of decompression tasks that are
sent to the thread queue.  When the method ends, the task_set goes out
of scope, and its destructor will wait for all the remaining tasks to
finish. All fine, right? Except that other variables in the function
include unique_ptr's with allocated memory that the tasks need.  So
what can happen is that if the compiler generates the code such that
the destructor of the unique_ptr happens before the destructor of the
task_set, the memory that the unique_ptr held may be deallocated
before some of the tasks still running in threads have finished.

In practice, we seem only to hit this race condition for particular
cases involving corrupted files, because the early `return` seems
quite likely to run those destructors before all the threads are done,
but it was possible to encounter it for valid files as well, if the
timing is just right. Shocking that we never had it reported.

The solution is just to have an explitit tasks.wait(), which will
block until all the tasks have finished before hitting the actual end
of the method and letting the other destructors to run. And for the
"early return" case, change it to a break so that we go through the
wait call at the end.

I believe that this fix addresses TALOS-2023-1709 / CVE-2023-24472.
2023-02-13 08:38:19 -08:00
Larry Gritz 6a7e404804 fix(fits): Make sure to close if open fails to find right magic number (#3771)
There are two ways to fail the FITS magic number check: fail to read
the bytes, or the bytes don't match the magic number. It seemed
suspicious that we call close() for the latter but not the
former. Combine them into a single error response (they had the same
message, anyway).

Also, make sure FitsInput::init() fully clears some other data
structures.  Oversight?

I don't know if any of these things are real bugs, but they look
sloppy and potentially problematic, so fixing them up.
2023-02-12 21:32:49 -08:00
angusdavisadobeandLarry Gritz f222d05930 improve thread safety for concurrent tiff loads (#3767)
* Make lookups of const unordered_maps thread-safe

* added back deleted end brace

* clang-format

---------

Co-authored-by: Larry Gritz <lg@larrygritz.com>
2023-02-10 12:42:32 -08:00
Larry Gritz 209bb4c327 fix(targa): guard against corrupted tga files (#3768)
* Be more careful constructing strings from what we read in the header;
  corrupted files may make them not be zero-terminated.
  Fixes TALOS-2023-1707 / CVE-2023-24473

* Watch out for pixels with palette indices that exceed the size we
  allocated for the palette.
  Fixes TALOS-2023-1708 / CVE-2023-22845

* Check alpha_type for valid range.
2023-02-09 13:35:13 -08:00
jreichel-nvidiaandJoachim Reichel bd319821e8 Initialize OpenEXROutput::m_levelmode() in init(). (#3764)
Avoids conditional jump on uninitialised values in close().

Co-authored-by: Joachim Reichel <joachim.reichel@posteo.de>
2023-02-04 22:18:48 -08:00
Latios96 0ad9b297d8 Fix unresolved external symbol for MSVS 2017 (#3762) (#3763)
If char16_t is used as template argument, this leads to an unresolved symbol for MSVS 2017.
Use int16_t instead of char16_t in this case
2023-02-04 15:37:30 -08:00
Larry Gritz 1a72ae7c31 Bump version after release 2023-02-01 11:16:53 -08:00
Larry Gritz 4991ac482e CHANGES and stage for v2.4.8.0 2023-01-30 14:36:11 -08:00
Larry Gritz 069a1877af Fix CHANGES typo 2023-01-26 14:06:26 -08:00
Larry Gritz bed036cfd6 Update CVE designations in CHANGES 2023-01-19 13:52:32 -08:00
Brecht Van Lommel cf8d6bf5cd Fix wrong oiio:UnassociatedAlpha spec for PSD files (#3750)
Refactoring in #1641 incorrectly caused this to be set on the last layer
rather than the composite image as before. Now set it on the composite
image and every layer, as all of them use unassociated alpha.
2023-01-12 14:28:43 -08:00
Larry Gritz 8bb093b162 Comment out parts of libcineon that are not used by OIIO (#3747) 2023-01-08 19:24:16 -08:00
Larry Gritz d648187d04 Clarify comments in documentation of IBA::make_texture 2023-01-08 19:24:08 -08:00
Larry Gritz 0665bffad3 Additional testing and improved code coverage (and minor fixes) (#3745)
* Better Typedesc testing of 'tostring' with fmt style formatting
  commands, and fix a bug that uncovered.

* Refine 'make CODECOV=1' behavior

* Beef up python-imagecache test to test getpixels, more attribute,
  invalidate.

* Better testing of python IB construction from numpy array.

* testtex: Use correct guard to avoid compiling unused code for
  coverage analysis testtex: get rid of unused 3d warp code.

* Add texture-threadtimes test

* Eliminate redundant code in exroutput.c by implementing
  write_scanline using write_scanlines.
2023-01-08 19:23:57 -08:00
Joris NijsandJoris Nijs fdbf190e2b Add EXIF write support to PNG output. (#3736)
* Add Exif write support to PNG output.

Stores any Exif data from the given ImageSpec into the PNG eXIf chunk.

* add test for writing Exif data in png

* add test reference output for libpng versions not supporting the eXIf chunk.

* Update testsuite/png/ref/out-libpng15.txt

Co-authored-by: Joris Nijs <joris.nijs@esko.com>
2023-01-08 11:47:47 -08:00
Larry Gritz 3edc96fdea Docs: minor improvments in description of ociodisplay and others 2023-01-08 11:14:15 -08:00
Larry Gritz 2b663e0061 ImageSpec:set_colorspace() (#3734)
Sets color space metadata. While conceptually, the main job is to call
`attribute("oiio:ColorSpace",name)`, this is a central spot to add
logic that adjusts or removes other contradictory metadata.
2023-01-07 23:54:22 -08:00
Larry Gritz 161b2a4c12 Docs: for rtd, upgrade sphinx/breathe versions, use furo theme (#3737)
I think this looks better.

Also a few minor tweaks to typos and misquotes.
2023-01-07 23:52:07 -08:00
Larry Gritz 9d514db8c6 CI: Lock down to older icc so it's not broken (#3744)
The new 2023 one on the Intel site seems to require a glibc too new to
be compatible with the one on the ASWF CentOS-7 based containers, so
has been breaking our CI for a couple weeks.
2023-01-07 18:03:03 -08:00
Larry Gritz ad34901684 Testing: get rid of testtex's datatime query, for test consistency (#3741) 2023-01-07 11:59:42 -08:00
Larry Gritz cba5c59fe9 Add testing for maketx --lightprobe, fix bugs (#3732)
We never had a test for `maketx --lightprobe`, so add it to
testsuite/maketx.

Immediately discovered that it only worked correctly for float images,
fails for half or other types. Fix.
2023-01-07 11:59:08 -08:00
Larry Gritz 17daba2ec0 texture3d testing, fixes, refactoring, coverage (#3699)
* More extensive testing of texture3d: handle vs filename, subimages,
  >4 channels, closest sample interpolation.

* Fixes for tex3d > 4 chan that turned out to be broken.

* Some rearrangement for the >4 channel case

* Refactor and simplify accum3d_sample_bilinear so multiple data types
  all use the same templated code path.

* This all reduces the amount of untested code in OIIO by another 0.4%.
2023-01-07 11:59:00 -08:00
Larry Gritz 0433073464 Testing; better tests of environment mapping, minor fixes (#3694)
Would you believe we never had a testsuite test for environment
mapping?  Well, it wasn't totally untested, in the sense that OSL
testsuite had one, and obviously it's used in production all the
time. But OIIO's testsuite didn't have any tests of
TextureSystem::environmemt(). We now remedy that.

* Add testsuite/texture-env, contains several environment tests,
  including handles vs filenames, subimage selection, different interp
  and mip modes, ask for >4 channels.

* New CMake build option OIIO_TEX_IMPLEMENT_VARYINGREF can be used for
  testing to disable implementation of the old 1.x style of batch
  texture calls.  We don't use them, they are deprecated. This option
  give us a way to exclude them from code analysis, because we really
  don't care.

* Fix bug with >4 channels for environment batch shading!

* Avoid unnecessary spec lookup in TileID constructor.

* Avoid building testtex test_hash during code coverage -- it is an
  extremely specialized test, not run in the testsuite, it shouldn't
  really count againt good code coverage.
2023-01-06 23:25:12 -08:00
Larry Gritz 52e5d89129 Testing; Imagecache better testing coverage and some stats improvements (#3654)
* testtex: better control over temp file creation

* Additional texture tests to improve coverage of udim generation,
  and deadling with cache limits.

* Better ImageCache unit tests for perthread create/destroy and
  individual tile retrieval. Fix a bug in get_tile for nonexistant
  subimage or miplevel.

* Dead code removal: ImageCacheFile::udim_to_concrete() and
  find_file_no_add(), which were no longer called anywhere.

* IC stats: fix messed up 'slowest' list ordering when there are broken files

* IC stats: when stats level is high, enable printing of some stats that
  we previously skipped over when they were "uninteresting" (e.g., too
  little time spent on something, no problematic files, etc).

* IC testing: test a variety of get_pixels error conditions

* IC testing: more tests of IC::imagespec() and get_imagespec(), incluing
  error conditions.

* More get_texture_info query testing

* Minor bug fix for int-to-float data conversion in get_image_info

* Test IC query for resolution[3]

* Test IC::reset_stats()

* Fix ImageCache::reset_stats in cases where threads ended
2023-01-06 21:44:40 -08:00
Larry Gritz 7086a599fa CI/Testing: many improvements for testing and code coverage (#3730)
* When checking code coverage, don't abort for failed tests
* Rejigger imagebufalgo_test a bit for better IBA test coverage
* Test zover
* Have testsuite/oiiotool-fixnan test with deep images
* Add to the extisting --fixnan tests a test for 'error' mode.
* [Excluded from backport to 2.4] Make testsuite/oiiotool-color test all colormap names
* Test 2D filters in filter_test
* Exclude python scripts in src/doc from coverage analysis
* Remove redundant attribute-seting code from the python internals
* Remove unused python_array_code function
* Exclude some imported code from coverage testing
* Re-enable and improve coverage testing from 'make CODECOV=1'
* Exclude unused/unexposed parts of xxhash.cpp from compilation
2023-01-06 15:28:34 -08:00
Larry Gritz fae8da1a9f Fix long-broken ref images for texture-icwrite test (#3733) 2023-01-06 14:12:30 -08:00
Larry Gritz 76609e0a8c pbm: Fix for incorrect inverting (#3731)
We didn't have thorough tests of pbm/pgm/ppm files, add some.
That immediately uncovered a problem with pbp files.

By spec, pbm (1 bit) files use 1 to mean black, 0 for white.
Confusing, because pgm (grey) and ppm (rgb) use 0 for black.
2023-01-06 14:12:23 -08:00
Larry Gritz 400fb3dbd4 platform.h: set up macros for detecting MSVS 2019 and 2022 (#3727) 2023-01-06 12:43:40 -08:00
Larry Gritz e82040a939 typedesc.h: Extend TypeDescFromC template to the full set of pixel types (#3726) 2023-01-06 12:43:36 -08:00
Larry Gritz 628726e46a IBAprep should not zero out deep images when creating dst (#3724) 2023-01-06 12:43:26 -08:00
Larry Gritz 58e090e329 Fix static analysis warning about array extent 2023-01-06 12:43:18 -08:00
Larry Gritz ab8027fc42 oiiotool --pdiff: test, be sure to count it as making output (#3723)
We had no testsuite exercise of --pdiff, add it.

Along the way, I saw tha we were getting the "you didn't have any
output" warning when using pdiff, so fix that.

And some other minor changes: formatted output update, some other
tightening up of things.

A little bit of jiggling the contents of XYZtoLAB_color to work around
what I think is a compiler error with icx -- it was generating NaNs
for reasons I was unable to understand or fix, but not if I rearranged
the code slightly. All the other compilers and versions had correct
behavior.
2023-01-06 12:00:12 -08:00
Larry Gritz 417155cc18 BMP: set colorspace to sRGB (#3701)
Seems like a reasonable assumption for BMP files.  It's not strictly
correct -- there are header fields on V4 and V5 BMP files that
communicate color primaries and gamma, but honestly, I do not have any
idea if anybody uses them or whether they're more misleading than
helpful. For now, assuming that a BMP file is meant for output on
an sRGB display seems like it's likely to be true.
2023-01-06 11:29:10 -08:00
Larry Gritz 18caee105a Bump version after release 2023-01-05 23:39:20 -08:00
Larry Gritz b178a54ee3 CHANGES and stage for v2.4.7.1 2023-01-03 19:05:13 -08:00
Larry Gritz 91c3a7c4c4 CMake config should not include a find of fmt if it's internalized (#3739) 2023-01-03 18:12:54 -08:00
Larry Gritz 5590f2403b CI: Temporarily lock fmt to 9.1.0 because its master seems broken (#3738)
Investigate later. For now, this is necessary for us to pass CI.
2023-01-03 17:08:44 -08:00
Larry Gritz 6f684e6261 Update ref output 2023-01-03 17:08:19 -08:00
Larry Gritz 0cafbcd471 Fix typos 2023-01-03 11:41:38 -08:00
Larry Gritz 3fdee625f4 Move ARM_NEON definition and fix possible double define (#3735)
It should not have been set in platform.h (inside the cpuid function!)
in the first place. And apparently, though this was ok for Windows ARM,
on Mac ARM it's an error because that symbol is already defined.
So only redefine it if it's currently undefined. And move the whole
check and definition into simd.h where all the other ARM_NEON stuff
lives.
2023-01-03 11:41:15 -08:00
Larry Gritz 9e94856ff2 Fix date 2023-01-01 09:42:31 -08:00
Larry Gritz 24f253cce3 CHANGES and stage for 2.4.7.0 release 2022-12-31 23:45:00 -08:00
Larry Gritz fcc6cfdf9b Make sure to retrieve oiio-images tests data specific to this branch 2022-12-30 09:34:30 -08:00
Larry Gritz e9cfbfbce8 Retroactively fix release notes to document TALOS-2022-1631/CVE-2022-41649 2022-12-24 15:38:44 -08:00
Larry Gritz be1fd307c2 Build: fmt external version flexibility (#3598)
* Build: fmt external version flexibility

The current default behavior is to
1. Check if there's already a copy of fmt found.
2. If not (or if BUILD_FMT_FORCE is ON), download it locally.
3. Copy the relevant fmt .h files as part of the OIIO install in
   OpenImageIO_ROOT/include/OpenImageIO/detail/fmt

This patch adds a new INTERNALIZE_FMT option, which defaults to ON,
whch is the old behavior. But if set to OFF at build time, the fmt
headers will NOT be copied into OIIO's install area (instead, it will
have dummy files that in turn include the real ones).

Set INTERNALIZE_FMT to OFF if you are really sure you want users of
OIIO to use the system install of fmt and not have OIIO install a new
copy.

When an externalized fmt is used, also make sure our exported cmake
config files cause the downstream user to find fmt and pass on the
dependency properly (necessary because strutil.h actually requires
properly including fmt headers).

Eliminate extraneous include_directories of fmt

Bump the auto-download version of fmtlib to 9.1
2022-12-24 13:59:07 -08:00
Larry Gritz bf4e5a869e ustring.h: cuda guards (#3718)
Hide from Cuda some things that can't possibly work in Cuda.
2022-12-22 16:30:07 -08:00
Larry Gritz 065d36c756 Add testsuite coverage of igrep utility (#3715)
Add exception safety in igrep test.
2022-12-22 16:30:07 -08:00
Larry Gritz c8d49a4358 Add a test of the 'term' pseudo-output (#3714)
A few minor fixe to the term code, add a "term:filename" optional hint
to redirect output rather than go to stdout, and also change to the
new std::format notation for output.
2022-12-22 16:30:07 -08:00
Larry Gritz 39120c722d ARM: Fix signed/unsigned simd mismatch in vbool4::load (#3722)
Fixes #3721

Please read the comments in #3721. This is the "local" fix for the
build break due to the type mismatch. It is a band-aid. And it may be
the best solution for the 2.4 branch if we don't want to potentially
break ABIs by changing the definition of any public types.

Still pending is to examine the issue of whether it was a mistake to
define vbool4 storage for neon as uint32x4_t or if we should change it
to int32x4_t to better match the non-simd reference implementation.
After debating that (and identifying somebody with access to an
ARM-based machine to test the solution for us), we may return to
tackle this more fundamental change.
2022-12-22 16:28:40 -08:00
Larry Gritz fc2c2615d9 IOProxy read/write error handling improvements (#3712)
IOMemReader::pread catch out-of-range read positions.

Fixes #3711

Along the way, I noticed that the system pread & pwrite return a
ssize_t rather than a size_t as our IOProxy methods do, so I need to
catch the negative value returns that they use to indicate errors.
2022-12-18 11:54:23 -08:00
Larry Gritz 4c1bdcc752 Build: Suppress warnings about deprecated std::codecvt_utf8_utf16 (#3710)
Another fix for the latest Apple clang, continuing #3709 (I missed
these other spots).
2022-12-17 17:51:59 -08:00
Larry Gritz af3b98c344 Build: Suppress warnings about deprecated std::codecvt_utf8_utf16 on Apple clang (#3709) 2022-12-17 17:51:53 -08:00
Larry Gritz 6ec28a05d3 Revise changes to add a CVE that was fixed 2022-12-17 17:51:06 -08:00
Larry Gritz 7c4253d9fc CI: Fix iinfo test so it works on windows (#3706) 2022-12-11 16:09:56 -08:00
Larry Gritz 7d73c62e8b Excise the last instances of unsafe sprintf (#3705) 2022-12-11 12:11:25 -08:00
Larry Gritz 2a4a1505e4 Remove useless test in hdrinput (#3704) 2022-12-11 12:11:18 -08:00
Michael Oliver 80ef5cd65e build_openexr.bash: bump default version to 3.1.5 (#3703)
bump to 3.1.5 for vfxreferenceplatform cy2022
2022-12-11 12:11:08 -08:00
Larry Gritz 6617e8c865 CI: Fix broken Mac CI with proper numpy install (#3702)
Something changing in homebrew caused CI on the macos11 test case to
fail, starting a few days ago. This fixes.
2022-12-08 16:23:43 -08:00
Larry Gritz 0ba31990fc Refactor common parts out of iinfo and oiiotool printinfo, testing (#3688)
* There was lots of duplicated code between iinfo and `oiiotool -info`.
  Refactor much of that into a new src/libOpenImageIO/printinfo.cpp.
  These are internal functions, no change to public API.
* Test iinfo --hash, --stats, and with nonzero origin and full size
* Test iinfo and oiiotool --dumpdata of deep image
* Test iinfo for subimages, mips, -f, -s
* Some conversion to new print instead of printf

There is probably more such refactoring to do later, I did the easy
parts for now and that's a start.
2022-12-04 11:14:30 -08:00
Larry Gritz 5fd50a69be span minor improvements (#3685)
* Make sure the cspan alias also allows the Extent template argument.

* Add a custom formatter for {fmt} to print spans, like we did for
  Imath types.
2022-12-04 10:21:25 -08:00
Larry Gritz fddc816e80 Bump version after release 2022-12-04 10:21:25 -08:00
Larry Gritz f15d4f4f2d CMake: Adjust how version overrides work (#3653)
Kai Pastor (dg0yt) made an important observation that the way I
recently made OpenImageIO_VERSION be a cache variable might lead to
unexpeted behavior by inadvertently retaining a version number upon
recompiles if the cache itself was not cleared, and this can happen
unexpectedly even when the user isn't trying to override the version.

This patch changs the behavior as follows:

You must use the special `-DOpenImageIO_VERSION_OVERRIDE=...` to
override the version.

  * if you do so, you are playing with fire and get what you deserve
    if you misuse it or change branches and don't remember to clear
    the cache.

If you do a normal build (without _trying_ to override the version),

  * you will get the real version number because it IS NOT cached
  * if you switch branches, you'll always get the right version number
  * ...but switching branches without clearing the cache can still, as
    always, have other subtle behavior differences versus doing a
    truly fresh build from scratch.

So in short, it still allows a way to override the version if you
really want to, but if you are not trying to do that, you can no
longer get yourself inadvertently into unexpected trouble.
2022-12-03 22:36:58 -08:00
Larry Gritz d737268c82 Bump to 2.4.6.1 to fix readthedocs generation 2022-12-03 22:00:13 -08:00
Larry Gritz 847481997d Fix broken version designation in docs (#3698) 2022-12-03 21:56:22 -08:00
Larry Gritz b06d2aae8a CHANGES, stage for v2.4.6.0 2022-12-01 14:40:09 -08:00
Larry Gritz f86e0999e6 CI: test against latest webp, and deal with its master->main repo change (#3695)
Also be more robust to the libheif and libde265 repos being
occasionally down.
2022-12-01 14:40:09 -08:00
Larry Gritz 745a071080 Fix docs typo 2022-12-01 13:11:04 -08:00
Gerdya df783ef8b9 Some fixes for compilation with MSVC for Windows ARM64 (#3690) 2022-12-01 10:47:45 -08:00
Larry Gritz 190e8f3fef oiiotool --dumpdata : fix channel name output (#3687)
We weren't copying the full spec, so didn't get the channel names.
2022-11-25 18:54:11 -08:00
Larry Gritz 0df4bbd478 oiiotool --point fix problem when there's no alpha (#3684)
We were over-allocating the color vector, and that was throwing off
the operation of IBA::render_point for cases where the image had no
alpha channel.
2022-11-25 18:53:46 -08:00
Larry Gritz f7c0402f7d Catch possible exception, identified by static analysis (#3681) 2022-11-19 09:30:23 -08:00
Larry Gritz e210d934a9 DPXColorConverter.cpp: exclude unused portions (#3682)
Many parts of this imported file are unused by OIIO. `#if 0` them away,
so they aren't part of static analysis or code coverage.
2022-11-19 09:30:15 -08:00
Larry Gritz bf85b2eda8 PSD reading: don't reject padded thumbnails (#3677)
When reading PSD file, if reading the thumbnail doesn't pass basic
sanity checks, we consider that a hard error reading the file.  One
check that we do is to make sure that our computation of the byte
width of the uncompressed thumbnail (`bpp/8 * width`) matches what the
file says the `widthbytes` is.

BUT... it seems that it might round up to an even (or maybe 4-multiple?)
of columns, presumably for scanline alignment reasons. And so we were
considering whole PDF files unreadable if they fell into this case.

This PR primarily loosens the test to allow some padding up to a
multiple of 4.

Fixes #3658
2022-11-19 09:29:55 -08:00
Larry Gritz 99f17b8349 IFF output safety (#3676)
* Maya IFF documentation says IFF file has max resolution of 8192, and
  our implementation only allows writing RGB and RGBA, so check these
  limits when an IFF file is opened for output.

* Make sure scratch space allocates enough for tile padding.

* Check for non-zero image origin coordinates (which are not allowed
  in IFF files).

* Change some 16-bit loop variables to uint32_t to avoid possible
  overflow.

Fixes TALOS-2022-1654, TALOS-2022-1655, TALOS-2022-1656
2022-11-19 09:29:33 -08:00
Larry Gritz c18b3ef72c IOProxy support for IFF files (#3647) 2022-11-19 09:29:24 -08:00
Larry Gritz 3a71e8a162 BMP output safety (#3673)
In open(), check for non-zero image offsets, which is not supported by
BMP, and issue an error if found. If the spec passed in has nonzero
spec.y, other code in the write functions would fail because they
assumed spec.y == 0 and could therefore access memory incorrectly.

More generally, also put checks in the write functions that issue
errors and take early outs if they find that they are called on a
BMPOutput that is not currently open, for example if open() fails but
the user doesn't check the return codes and proceeds to call the write
functions anyway.

This addresses TALOS-2022-1653 / CVE-2022-43594-CVE-2022-43595
2022-11-19 09:22:20 -08:00
Larry Gritz 1413022687 DPX output: fix write errors (#3672)
There was a subtle error where we had a reference to an ImageSpec for
one of the subimages, confusingly called m_spec, which we altered, but
then didn't make the same change to the this->m_spec, and in a later
spot we referenced the `m_spec` meaning the one in `this`. This could
lead to a crash.

Fix, but not only that, also rename to avoid the confusion. `spec0` is the
alias we us for the spec for subimage 0, and `spec_s` is the alias we
use when referencing subimage S, and we really never use m_spec
anymore to avoid any confusion. This should make it easier to reason
about this code in the future and avoid these kinds of mistakes.

A second error resulted from the situation where a failure in open()
would return before one or both of m_buf or m_tilebuf were allocated.
If the return status of open() were ignored and the caller
subsequently attempted calls to write_scanline or write_tile, invalid
memory could be accessed. Fix this with a variety of guards not only
based on the allocation status of these buffers, but also issuing
errors (and exiting early) from write_scanline or write_tile if they
are called on an ImageInput that is not in fact open.

Addresses TALOS-2022-1651 / CVE-2022-43592 and 
TALOS-2022-1652 / CVE-2022-43593
2022-11-19 09:22:07 -08:00
Larry Gritz 7b2f76dc7c PSD: Fix thumbnail extraction for PSD files (#3668)
Fixes #3660

In investigating this issue, I also noticed that now that IOProxy
support can be relied on, the old code that in the psd reader that
directly fumbles with libjpeg is not needed and can be replaced by
just a couple of lines to make an ImageBuf read from an IOProxy.

And it fixes the bug, too. So I'm not even going to try to figure
out what was going wrong with the old code.
2022-11-19 09:21:29 -08:00
Larry Gritz e66ff05314 Try to squash warning in gcc 12.1 + C++20 (#3679) 2022-11-17 22:42:53 -08:00
wayne-arnold-adsk 5d23f2d69f Avoid sanitizer warning unsigned integer overflow (#3678)
/Volumes/DATA/local/S/Maya_master_CI_sanitizer/build/RelWithDebInfo/src/Components/ExternalLibraries/OpenImageIO/install/include/OpenImageIO/string_view.h:252:43: runtime error: unsigned integer overflow: 0 - 17 cannot be represented in type 'unsigned long'
    #0 0x10d0adf61 in OpenImageIOMaya_v2_4::basic_string_view<char, std::__1::char_traits<char> >::compare(OpenImageIOMaya_v2_4::basic_string_view<char, std::__1::char_traits<char> >) const string_view.h:252
2022-11-17 18:02:16 -08:00
Larry Gritz 344f816b2d Fix formatting 2022-11-16 10:47:34 -08:00
Fabien Servant @ TCS 45592eaeab [raw] update exif orientation with raw flip if user flip is set (#3669) 2022-11-16 10:40:20 -08:00
Larry Gritz 5d9ff6294a DPX input: Comment out assertions (#3674)
We shouldn't abort here, we should return and handle the error better
(which we do).
2022-11-15 08:04:41 -08:00
Larry Gritz 13ed669ae5 ImageBuf+IOProxy vs ImageCache subtle fixes (#3666)
I uncovered a very subtle problem that can happen with the interaction
between ImageBuf, using an IOProxy, and the underlying ImageCache.
Remember that when using an IOProxy, it is critical that the lifetime
of the proxy outlasts any ImageInput, ImageBuf, or ImageCache that was
told about it.

Consider the following code:

    IOProxy proxy(...);   // temporary proxy in this local scope
    ImageBuf A ("foo.exr", 0, 0, proxy);

We've set up an ImageBuf that will read from an IOProxy.  Behind the
scenes, it made an ImageCache entry that remembers the IOProxy, as it
has to, since it needs to use that proxy for subsequent reads.
Now we read the image, and we use the `force=true` parameter to
force an immediate read of the file:

    A.read (0, 0, true);

It reads from the proxy. But the IB and the underlying entry in the IC
still know about the proxy. But in the user's mind, they have fully
read the image, will never read from it again, so of course (they
think) it is safe to close or destroy the proxy, knowing that they
made it last past its use:

    proxy.close();

But -- oops! -- the cache entry still has a pointer to the proxy, and
even though it won't need to read from it again, it still will access
it, close it, etc., but the user's proxy may by that point be out of
scope.

This is *technically* not a "bug" in the sense that it is the user who
violated the contract by closing or destroying the proxy before its
last use by anything they passed it to. But in context, it's very easy
to be confused by this -- the user thinks that the only observer of
the proxy is the ImageBuf, and they're done using the ImageBuf at that
point, but because they don't explicitly mention an ImageCache, they
don't realize that the ImageBuf passed the proxy reference along to
the underlying IC that could be backing any ImageBuf.

It's the user's fault in some sense, but let's just say that we have
given them an "attractive nuisance."

That's a long bit of background explanation, but I wanted to force
myself to explain it clearly and make sure it was spelled out in the
commit comments. Now here is the fix:

* When IB::read does an immediate forced read involving an IOProxy,
  after the read is complete, tell the cache to invalidate the entry
  for the file so that it no longer retains a pointer to the proxy.

* When an IB itself is destroyed or cleared, if it used an IOProxy,
  also invalidate the IC entry for that file.

* Unrelated cleanup: avoid a redundant invalidate call in init_spec().
2022-11-14 20:22:10 -08:00
Larry Gritz efffa5f24d OpenColorIO 2.2 support -- preliminaries (#3662)
* Make it so that when we build against OCIO 2.2, it is possible to
  specify the built-in configs. The logic had previously precluded
  this, because at one point it checks to see if the passed config or
  contents of env $OCIO was an existing file. Now you can set OCIO to
  "ocio://default", for example, and it will be used by OIIO.

* Expose getAliases (I think that has been there for a while but we
  didn't expose in in our ColorConfig wrapper).

* Expose isColorSpaceLinear (new to OCIO 2.2)

* New OIIO global getattribute query: "opencolorio_version" returns the
  human-readable version string (such as "2.2.0").

* Some miscellaneous other cleanup in color_ocio.cpp

* Change in color methodology for test suite: Previously, for every
  call to oiiotool in the testsuite, we passed a `--colorconfig`
  argument to oiiotool pointing it to the sample colorconfig that we
  ship in the testsuite. Here, I'm changing it so that the cmake setup
  for tests sets the OCIO env variable for all tests, so no explicit
  --colorconfig is necessary, and thus you won't see a path to the
  config in any of the test output files if they need to echo the
  command line arguments (and you'll see several test outputs altered
  in this way). This is a prelude to later changes that will use the
  built-in configs themselves for tests, when available.

More interesting changes coming in subsequent PRs.
2022-11-14 20:22:02 -08:00
Larry Gritz 811a321f74 Zfile write safety (#3670)
When writing a zfile, anything that causes open() to fail will leave
m_tilebuffer at 0 size. Subsequent calls to write_tiles, and also
to close (which cleans up unwritten parts of the buffer at the end)
did not check for this condition and would access out of bounds memory.

While I was in there, I converted the zfile.cpp error messages to the
new formatting convention.

Fixes TALOS-2022-1657
2022-11-14 20:21:46 -08:00
Larry Gritz d08ca20fe1 CI: No longer add the ppa:ubuntu-toolchain-r/test repository (#3671)
Lately, it has been experiencing intermittent availability problems
that causes our CI to fail while setting up dependencies.

What happens if we don't use the problematic ubuntu-toolchain-r at all?

Nothing, it seems. So eliminate it.

I think that once upon a time, it was necessary to add this repo to
get certain new packages? But maybe they are mainstream enough now
that it's not necessary to add this repo? In any case, it doesn't seem
to hurt anything, it's one less moving part that can't fail if it's
not there.
2022-11-14 14:10:19 -08:00
Larry Gritz 14748d5aa1 Expose OIIO::Strutil::print in the main OIIO namespace (#3667)
We use this all the time in our internals, and I'm tired of having to
write Strutil::print. Too verbose. By putting it in the main OIIO
namespace, OIIO internals can reference as simply print(), and
external users now have a choice of saying Strutil::print() or
OIIO::print().
2022-11-14 08:41:13 -08:00
Larry Gritz 8bcc715235 IOMemReader ctr should take const buffer pointer (#3665)
The ctr is inline, so I don't think it breaks backwards link
compatibility to make this change, so I do intend to backport it.
2022-11-14 08:41:04 -08:00
Larry Gritz ba3f204158 Fix type mismatch warning in JPEG code (#3664)
Fixes #3663
2022-11-12 13:53:21 -08:00
Larry Gritz 43f806d53c Additional Strutil tests (#3655)
Better coverage of edge cases for escape_chars/unescape_chars, stoi
hex conversion, strtod, stod, freestanding c_str(), parse_nested
failure cases, base64_encode, debug.
2022-11-12 13:52:57 -08:00
Larry Gritz 30571a094c Filesystem::is_executable and find_program (#3638)
Also cull some cruft that no longer is used for OIIO >= 2.4
2022-11-12 13:52:24 -08:00
Larry Gritz 8f9bf9973b Fix ColorConfig::getColorSpaceDataType null ptr deref when no OCIO config is found (#3652) 2022-11-12 13:51:58 -08:00
Larry Gritz 750f89cd7f CMake: use of ${PROJECT_NAME} must be after call to project() (#3651) 2022-11-04 17:12:00 -07:00
Larry Gritz 34ea2fb548 oiiotool testing and minor subimage/miplevel fixes (#3649)
* Add casual tests of oiiotool with no args (print brief usage message)
  and when an unknown command.

* Also changed the meaning of -q (quiet mode) to be more quiet -- in
  particular, not to print the full help message for errors when quiet
  mode is used, only print the error.

* oiiotool test sequence errors.

* Test (and fix) --selectmip and --subimage with out of range indices
2022-11-04 17:09:04 -07:00
Larry Gritz 62ff91df5c CI: Test against OpenColorIO 2.2 (#3644) 2022-11-01 23:18:40 -07:00
Larry Gritz 14b6c11847 CI: adjust when workflows are run to cut needless CI runs (#3645)
Changes:

* Scorecards and analysis -- allow newly launched job to cancel
  running old job from the same PR.

* Scorecard only runs on main repo, no need to run on forks.

* Nightly CI only runs on main repo, no need to run on forks.
2022-11-01 23:18:28 -07:00
Larry Gritz c794d877e3 Analysis: more test related fixes to try to increase code coverage (#3643)
* Test oiiotool control flow syntax mistakes
* Test oiiotool --set with array of strings
* oiiotool: better adjust_geometry unit testing

Helper utility additions:

* oiiotool --no-error-exit

  `--no-error-exit` causes an error to not exit immediately, but
  rather to try its best to continue execuing command line
  operations. Use with caution! This is mainly for unit tests and
  debugging.

  `--unittest` also turns this on automatically, so that tests that
  are probing failures don't cause an exit.

* unittest.h: If OIIO_UNIT_TEST_QUIET_SUCCESS is defined, don't print
  anything extra for unit test success
2022-11-01 23:18:18 -07:00
Larry Gritz 9e987d5e5e Squash some alignment problems caught by ubsan (#3646) 2022-11-01 23:18:05 -07:00
Larry Gritz e5bffd8a84 maketexture: Ensure proper setting of some metadata (#3634)
Make extra sure to clear the oiio:ConstantColor, oiio:AverageColor,
and oio:SHA-1 metadata when writing textures, if those things are not
going to be set.
2022-11-01 23:17:45 -07:00
Larry Gritz 6aab6975f5 Analysis: Add tests to improve code coverage of oiiotool (#3637)
* Unit test adjust_geometry
* Tests of --set for various implicit and explicit types not
  previously covered in the testsuite
* Comment out Oiiotool:get_position, which seems to be unused
* Exercise --iconfig for explicit types
* Add test for --origin and --originoffset
* Add test for --ociodisplay
* Add test for --unmip and --selectmip
2022-11-01 23:16:45 -07:00
Larry Gritz c7c2830b45 Strutil: trimmed_whitespace (#3636)
It's similar to trim_whitespace, but returns the trimmed result, rather
than operating in-place on a `string_view&`.

Also add unit testing of trim_whitespace and trimmed_whitespace
2022-11-01 23:16:23 -07:00
Larry Gritz e6b52502ad Bump version after release 2022-10-31 18:55:33 -07:00
Larry Gritz 1e70f7862c CHANGES and stage for 2.4.5.0 2022-10-31 18:07:20 -07:00
Larry Gritz 5563449f01 TIFF: guard against buffer overflow for certain CMYK files (#3632) 2022-10-23 22:55:08 -07:00
Larry Gritz 5bfe48a16d PSD: protect against corrupted embedded thumbnails (#3629) 2022-10-23 14:00:28 -07:00
Larry Gritz 79824feaa4 TIFF: guard against corrupt files with buffer overflows (#3628)
Along the way, improve the runtest.py script by giving the
info_command() fuction the same silent, concat, and failureok
parameters that the oiiotool() function has. (This lets individual
tests assemble iinfo command lines with a little more flexibility.)
2022-10-23 14:00:22 -07:00
Larry Gritz 1a53aa4ade DDS: fix crashes and add tests (#3625)
* In the case of DDS cubemap files where a cube face was not present,
  we were filling m_buf with 0 bytes before allocating it.

* Add check for invalid bits per pixel.

* Add regression test for another bug that was perviously fixed in
  2.4.3.
2022-10-23 13:59:41 -07:00
Larry Gritz 85eae966f8 Fix EXIF bugs where corrupted exif blocks could overrun memory (#3627)
In one case, we actually had a check for this, but an assignment to an
int made the nonsensical offset appear negative, and we only tested
whether the necessary offset it was bigger than the buffer size.
Keeping it as (unsigned) size_t makes the test work as intended.

In another case, there were several places where we never checked that
we were staying within the exif block, and here we address this by
changing the utility decode_ifd so instead of passing it a pointer to
the ifd, it passes the offset (the pointer turned out to always be
inside the buffer) so it can check the extent for subsequent accesses.

Also some fixes related to squashing undefined behavior sanitizer
cases.
2022-10-22 12:48:08 -07:00
Larry Gritz feb2c9c46f RLA: fix potential buffer overrun (#3624) 2022-10-22 12:48:00 -07:00
Larry Gritz 3361e8d89b Custom fmt formatter for ustringhash prints the string, not the hash (#3614)
Also, change `operator<<` to output the string, not the hash itself.
These changes help push us more toward the original intent of
ustringhash being a drop-in replacement for ustring, any time it's
more desirable to be using around the hashes rather than the pointers.
2022-10-22 10:22:19 -07:00
Larry Gritz b288f3ada9 Improve oiiotool test coverage (#3626)
* oiiotool tests for expressions var() and getattribute()

* Make sure we test oiiotool IMG[] expressions and several specific
  special attributes to retrieve.

* Add coverage of oiiotool --keyword and --clear-keywords
2022-10-22 10:22:09 -07:00
Larry Gritz b971489267 Targa: String overflow safety (#3622)
Added utility functions safe_string_view and safe_string to strutil.h.
2022-10-21 09:03:54 -07:00
Larry Gritz 2b542b92c6 BMP: protect against corrupt pixel coordinates (#3620)
When reading the image (which can have signals to jump around in the
array), we checked for out-of-bounds x coordinate, but not y, and some
corrupted files could overrun buffers as a result.
2022-10-21 09:03:45 -07:00
Larry Gritz 2735f38b42 CI: eliminate xxhash and farmhash code from coverage analysis
Because we're not the originators of the code and we use only a tiny
subset of what's in those files.
2022-10-21 09:03:36 -07:00
Larry Gritz 37bb86d116 oiiotool: New metadata expression syntax (#3619)
The existing syntax `TOP.name`, if the name wasn't found, produced
an error.

This PR adds another syntax: `TOP[name]` which is identical if the
named metadata is found. But if not found, this syntax just evaluates
to the empty string, with no error.
2022-10-21 09:03:29 -07:00
Aras Pranckevičius 8701cf7dd0 Docs: write Windows build instructions (#3602)
I recently wrote down how to build OIIO from source for myself (https://gist.github.com/aras-p/6497703c9b52f67761e6191343e43f7b), and maybe a slightly cleaned up version would be good to put into actual docs.
2022-10-20 08:46:28 -07:00
Larry Gritz cc933a0ff7 Fix missing getattribute of limits:channels and limits:imagesize_MB (#3617)
I think it was just inadvertently left out when these were first added.
2022-10-20 08:46:20 -07:00
Larry Gritz 65c61ca759 Testing: optimize oiiotool-control test (#3618)
This test was taking almost 30 seconds to run, without a lot of images
being read or written. Turns out it was just a large number of separte
oiiotool invocations, and the overhead of all those shells and
programs launched adds up. Most of them were just firing up oiiotool
for the sake of doing an `--echo` to print things. A little bit of
restructuring to make fewer oiiotool invocations (each one doing a
bunch of echo commands, each testing a different thing) cuts the time
for the whole test by 50%.

I also made the runtest.py script allow certain test debugging by
letting a test set the `wrapper_cmd`, and if so, will prepend every
oiio utility launch with it. For example, a test could say
`wrapper_cmd='time'` to time every command.
2022-10-20 08:46:00 -07:00
Larry Gritz 3faa66b592 oiiotool: Add unit tests, minor internals utility refactoring (#3616)
Add a hidden --unittest command to oiiotool, only functional for Debug
builds, which enables additional testing of internal utility funcions
and other things that are difficult to fully exercise in the testsuite
from normal oiiotool commands (could be done, but would take tons of
additional tests to get into particular deep edge cases).

Prototype by adding unit tests for scan_box. More will be added later
now that the mechanism exists.

Simplify string_to_dataformat

Make sure to use --list-formats and --runstats during testing.
2022-10-19 13:06:35 -07:00
Larry Gritz 09bba709c5 Testing: eliminate redundant code in Python IBA bindings (#3615)
Also add a test for sub(imagebuf,tuple) that we didn't have before.
2022-10-19 13:06:21 -07:00
Larry Gritz 9379097d7c Add a test that forces stats to be computed (#3612)
Increases code coverage for dynamic analysis and coverage metrics.
2022-10-18 08:47:09 -07:00
Larry Gritz 58a51a3705 Testing: testsuite/iinfo -- make it compute stats, use MIPmaps (#3613)
Better coverage of the functionality of iinfo
2022-10-18 08:47:02 -07:00
Larry Gritz ab887c5c76 Testing: update cineon test image 2022-10-17 11:04:51 -07:00
Larry Gritz 521a6ba64c Fix exr core test options (#3610) 2022-10-17 11:04:40 -07:00
Larry Gritz 6e39b13e78 CI: Sonar analysis should exclude stb_sprintf.h (#3609)
It's not really "our code", and we use very little of that file, so
it's not helpful to include it in coverage or other analysis.
2022-10-16 22:33:23 -07:00
Larry Gritz 69917346c5 Testing: make a test specifically for iinfo (#3605)
Believe it or not, iinfo was never run in the testsuite before this!
2022-10-16 22:33:16 -07:00
Larry Gritz 9d2f6717fa Test fixes (#3608)
* We mis-named color_test, and that caused it to never get run!

* imagespeed_test is meant for benchmarking only, run by hand.
  We don't make a testsuite test, so don't even build the source
  (which would never be counted for code coverage because it doesn't
  run) during CI.
2022-10-16 22:33:04 -07:00
Larry Gritz b1513e8c43 Improve cineon build and test (#3607)
* Add a test for cineon -- we never directly tested it before

* Don't compile code used only for writing. We don't supporting
  writing cineon, so there is no point compiling the cineon module
  used only for writing.

* And of course, once cineon was in the testsuite, we immediately
  found a problem via the sanitizers! So fix buffer overflows when
  reading FilmEdgeCode in Cineon.  (And clean up the equally sloppy,
  though not technically buggy, code in DPX as well.)
2022-10-16 19:29:08 -07:00
Larry Gritz fc94095738 Testing: test both openexr old and core versions (#3604)
On any one platform, our testsuite was only testing the old C++ and
the new C core exr implementations.

Rig it to run the openexr-oriented tests twice -- once in each state
(when using OpenEXR new enough to support the core library).

Doing this cleanly required adding SUFFIX and ENVIRONMENT optional
parameters to the oiio_add_tests utility macro. Once that was added,
the texture batch testing could be implemented that way as well,
removing a bunch of hackier special purpose code.
2022-10-16 19:29:02 -07:00
Larry Gritz 54224dce05 Static analysis related fixes (#3603)
* Protect against 0-sized allocation
* Exception safety in IffOutput destructor
* Using sonar.coverage.exclusions as a better way to exclude files
  from coverage analysis
* Null pointer safety
2022-10-16 19:28:53 -07:00
Aras Pranckevičius 5e15e1cb3b SIMD: extend NEON implementation coverage, and include neon in oiio_simd_caps (#3599)
* Use hardware float<->half conversion (similar to F16C on Intel)
* Use hardware sqrt
* Use horizontal adds in more places ("reduce_add")
* Equivalents of _mm_movemask_ps for NEON in vbool4
* Other smaller bits & bobs

Testing on Apple M1 Max, Release build, notable simd_test Mvals/sec
changes:

vfloat4
* load from half[]: 2457 -> 5890
* store to half[]: 1041 -> 6074
* simd sqrt: 2151 -> 6075

vfloat8
* load from half[]: 2433 -> 10367
* store to half[]: 1235 -> 11192
* reduce_add: 7377 -> 11971

vfloat16
* load from half[]: 2672 -> 14505
* store to half[]: 1322 -> 12558
* reduce_add: 7123 -> 11858
* operator<:  3345 -> 7500 (similar with other compare ops)

vint4
* blend: 4403 -> 5007
* blend0: 5187 -> 6076
* rotl: 1775 -> 2932

vint8
* load from int[]: 9415 -> 12152

vint16
* operator<<: 4656 -> 5865 (similar for >>, srl)
* rotl : 4042 -> 5137

vbool4
* reduce_and: 875 -> 1361
* reduce_or: 985 -> 1373
2022-10-12 21:31:03 -07:00
Larry Gritz 1fdfff056b ustring hashing improvements (#3577)
I realized that the recently added ustringhash class is confusingly
similar to the (obscure, barely used, mostly forgotten) ustringHash
functor. But also ustringHash doesn't need to exist, because it's
equivalent to `std::hash<ustring>`, if we define it. So now we do define
it, and also `std::hash<ustringhash>`, and deprecate ustringHash, to
be removed entirely for 3.0.

Also, add a ustring ctr from ustringhash (explicit only for now),
and `operator<` for ustringhash.

And add from_hash(size_t) method to ustringhash, analogous to
ustring::from_hash().

Modernize a few places we still used `(void)` to just `()`.

Give ustring and ustringhash a `using rep_t =`
rep_t is the type of the underlying representation (const char* for
ustring, size_t for ustringhash).

Modernize some typedef into using.

Make `==` and `!=(ustringhash, const char*)` be constexpr for C++ >= 17
2022-10-12 11:32:03 -07:00
Aras Pranckevičius c1d44d5d5b Windows: fewer windows.h includes from platform.h (#3596)
In particular, defining NOGDI before including <windows.h> achieves
several things amongh others:
- No longer causes ERROR symbol to be defined to 0. ERROR being defined
  prevents using e.g. google/glog library, since it wants ERROR to mean
  something else.
- No longer defines some possibly widely used names e.g. GetObject.
2022-10-11 09:05:53 -07:00
Aras Pranckevičius 7154cc5949 BMP: fix reading 16bpp images (#2808) (#3592)
16 bit per pixel (e.g. 555, 565, 444) formats probably have never
worked. One part of the code was assuming 5 bits in the mask, another
was shifting by 4 bits, and the 16-bit pixel fetch code was reading just
one byte.
2022-10-08 12:31:57 -07:00
jreichel-nvidiaandJoachim Reichel 0195106930 Fix PSD import on ARM. (#3589)
The code assumes "char" is "signed char" (as on x86), but on ARM "char" is
"unsigned char".

Co-authored-by: Joachim Reichel <joachim.reichel@posteo.de>
2022-10-07 12:31:04 -07:00
Aras Pranckevičius c6cb668b88 oiiotool: work around static destruction order issue (#3295) (#3591)
In some cases (at least on Windows, with static linking) the oiiotool
main returns zero, but the full process returns 3 error code due to
abort() being called. And that is called because a global shared
image cache is already destroyed, but the image references from another
global (Oiiotool itself) try to use it, get a call into a "pure virtual
function" stub that is put by MSVC C runtime into a destroyed object
vtable, and that ends up in an abort().

Work around that by making sure various member variables holding
ImageRecRef are cleared before main() finishes and global destructors
are called.
2022-10-07 12:30:17 -07:00
Aras Pranckevičius ecab9e2080 HDR: speed up reading by around 4x (#3590)
Most of the cost in HDR file reading was converting from RGBE to floats,
inside ldexpf(), which at least on Windows/VS2022 spends most of the
time inside _ctrlfp(). But we only have 256 possible exponents in total,
so just use a precomputed table.

On my PC (Windows 10, VS2022, Ryzen 5950X) this change gets file read
time for an 8x resolution .HDR image from 1.10s down to 0.27s
2022-10-07 12:28:04 -07:00
Aras Pranckevičius 9d8aa265b3 HDR: fix read performance regression (#3585) (#3588)
HDR code overhaul to support IOProxy (#3218) changed all reads into
a `pread()` with explicit file position tracking. Turns out, that is
quite a larger overhead compared to simple sequential reads; even more
so on Windows.

On my PC (Windows 10, VS2022, Ryzen 5950X) this change gets file read
time for an 8x resolution .HDR image (with RLE compression) from
8.28s back to 1.10s just like it was in OIIO 2.3.

On Windows the extra cost when using pread() is a bit more extra mutex
locks, but the real cost is in enventual ReadFile; looks like any seek
operations make it take some sort of "way slower" path with various
callbacks and whatnot inside the kernel.

---

Note repoduced from discussion #3588 from LG: 

Switching from IOProxy::pread to using IOProxy::seek + IOProxy::read makes the IOProxy stateful and not thread-safe without an external lock (which this HdrInput has, so it's not going to break anything), precluding any future removal of the locks from read_native_scanline to make the whole ImageInput able to read concurrently. That's probably not important for this file format, but for others (especially crucial those usable as texture), it would be desirable to rely on those stateless pread calls and remove the lock from the ImageInput.

I think this patch is fine. We don't expect a lot of concurrent reads from hdr like we do for tiff and openexr that we use extensively for highly threaded on-demand reading of texture. It fixes the recent performance regression, and it doesn't really cost us concurrency because we already had the lock in HdrInput. But in general, we want to prefer eschewing read/seek and using pread instead, so we can expect maximum concurrency from multiple threads using an ImageInput (as we do in ImageCache/TextureSystem).

So I believe that a revised and more complete diagnosis is that the problem isn't the pread vs read per se, but that for RLE-compressed images we were calling pread separately for every 4 bytes! The calls to read are faster simply because they are buffered (in FILE) and require fewer OS system calls. But the real sin is that we call it way too many times.

I think that the rle case could go back to pread if we want, but do just one pread per scanline (rather than one per pixel value run), asking for the maximum amount that will be needed to read the scanline for the worst case rle representation (it's ok if it's the end of the file, pread will just read up to the end and return the true number of bytes read). In other words, we'd be doing the buffering ourselves.

But anyway, the real misdesign of this HDR reader is ancient, and consists of doing many many tiny reads. Even the buffered fread would be sped up a lot by not doing it separately for every 2-4 bytes of the file. I don't know if it's worth fixing for this format. Depends on whether anybody really needs to maximize its performance or expects multiple threads reading the same hdr file to be fully concurrent.
2022-10-07 12:27:52 -07:00
Larry Gritz f3f375fc5b Revise RELEASING to explain updating oiio-images branch (#3580) 2022-10-06 16:17:02 -07:00
Larry Gritz 34b643922a Build/security: Try FORTIFY_SOURCE (#3575)
Add a new build-time cmake cache variable: FORTIFY_SOURCE

Default to empty, but can be set to 1, 2, or 3, corresponding to
setting the _FORTIFY_SOURCE macro available in recent versions of
clang and gcc. (I'm not sure exactly which minimum compiler version is
needed for each fortification level, except that for level 3, gcc must
be 12+.)

Fortification involves replacing several "unsafe" memory-related
functions such as memcpy, memset, strcpy, etc, with special versions
that do bounds checking, aided by some compiler smarts for
understanding the likely bounds of different buffers. If I understand
correctly, at level 2 it can figure out bounds of constant-sized
arrays, and at level 3 it can figure out certain dynamic cases as
well.

There are two use cases for this:

1. For our own CI, this is yet another bit of static and dynamic
anslysis to enable (currently, just in the gcc12 test) to possibly
catch bugs.

2. Users who are building OIIO to deploy it in security-sensitive
environment may wish to build with some fortification level enabled to
help prevent certain memory errors or security issues, understanding
that it may slightly impact performance.
2022-10-06 16:17:02 -07:00
Larry Gritz 705c25c193 CI: improvements and minor refactoring (#3570)
* Refactor the clang-format job to be part of the aswf batch of jobs
  rather than separate (reduces redundant logic in the workflow file).
* Give proper names to distinguish the two Mac jobs' artifacts for
  broken builds and their caches.
* Revise scorecard workflow triggers: no need to run weekly, and run
  on push only to the main repo, no reason to run on forks.
2022-10-06 16:17:02 -07:00
Larry Gritz 5e8483b758 Use undefined behavior sanitizer (ubsan) as part of CI (#3565)
In addition to address and leak sanitizers, also turn on the undefined
behavior sanitizer in our CI run. We can do it in the same job as
asan/lsan.

Some things that come along for the ride, including fixes for things
that ubsan uncovered:

* src/build-scripts/ubsan-suppressions.txt can hold suppression list
  (though we don't have any now, it just sets up the space for it for
  future needs).

* Split the "targa" test so that the parts that directly need the OIIO
  python module (which are all related to thumbnails) are now in
  "targa-thumbnails" test. That has to be disabled for the sanitizers,
  since we can't arrange for python to b linked to the sanitizer
  libraries.

* Found vint4::store has a potentially unaligned integer store.

* Found Strutil::concat is not necessarily safe if either of the
  strings are empty.
2022-10-06 16:17:02 -07:00
Larry Gritz 7f02d29935 Update one more ref image after recent raw change (#3572)
Also remove three raw test reference output files that we apparently
no longer use (corresponding to platform + libraw combinations that
aren't in our current set of CI configurations).
2022-10-06 16:17:02 -07:00
Larry GritzandVincent Demoulinv 69c40cf320 Update ref output after recent raw change and clang-format (#3569)
This is an addendum to #3561 to fix reference output

Co-authored-by: Vincent Demoulinv <vincent.demoulin@technicolor.com>
2022-10-06 16:17:02 -07:00
demoulinvanddemoulinv c6a9c08bc7 Add color metadata from libraw. (#3561)
2 vectors, pre_mul and cam_mul.
2 matrices, cam_xyz[4][3] and rgb_cam[3][4], delivered as 1D tab.

Co-authored-by: demoulinv <vincent.demoulin@technicolor.com>
2022-10-06 16:17:02 -07:00
Larry Gritz 427406d084 CI/build: build_libtiff.bash should be sure to build shared library (#3586)
Something changed in libtiff master and it doesn't build shared libs
by default, breaking our "bleeding edge" CI test. So when we build it,
be sure to ask for it. It can be overridden in build_libtiff by
invoking it with env variable `LIBTIFF_BUILD_SHARED_LIBS=OFF`.
2022-10-06 16:16:02 -07:00
Larry Gritz fde8de5602 DDS: honor ImageInput thread policy (#3584) 2022-10-05 23:57:39 -07:00
Aras Pranckevičius 8fe2463d30 DDS: optimize loading of compressed images (3-5x) (#3583)
Comparing the time it takes to load DXT/BCn compressed DDS images via
OIIO, I noticed that it's several times slower than in another codebase
(Blender). So I started profiling, and fixing some low hanging fruit.

- After decoding a BCn block (always 4x4 pixels), it was written into
  destination image using quite many branches in the innermost loop.
  Now it still takes care of not writing outside of a destination image
  that might not be multiple-of-4 in size, just with way fewer branches.
- BCn decompression is multi-threaded via parallel_for_chunked, using
  at least 8 block rows per job (i.e. 32 pixel rows). This is
  similar to internal multi-threading done by EXR or TIF readers.
- Avoid one case of std::vector resize (which clears memory) followed
  by immediate overwriting of that buffer with bytes read from the file.
  Switched to using unique_ptr for that array, similar to how other
  input plugins do it.

Performance data: I'm timing how long it takes to do "iinfo --hash" on
24 DDS files, each 4096x4096 in size. Quite a lot of time there is taken
by just the SHA hash calculation which is not related to loading, so
also have timing info for just DDSInput::read_native_scanline where
all the actual DDS loading/decoding happens.

Timings on PC (Windows 10, VS2022 Release build), AMD Ryzen 5950X.
- BC1: total 3.68s -> 2.76s, read_native_scanline 1.54s -> 0.59s
- BC3: total 3.74s -> 2.84s, read_native_scanline 1.83s -> 0.66s
- BC4: total 1.26s -> 0.82s, read_native_scanline 0.74s -> 0.24s
- BC5: total 2.29s -> 1.57s, read_native_scanline 1.31s -> 0.46s
- BC6: total 7.50s -> 4.30s, read_native_scanline 4.67s -> 1.60s
- BC7: total 6.18s -> 3.09s, read_native_scanline 4.34s -> 0.84s

Possible future optimization: implement DDSInput::read_native_scanlines,
that could avoid one extra temporary memory buffer copy. This extra
buffer clear & eventual copy from it into final user destination pixels
is non-trivial cost from profiling. But it's also quite involved
to handle all the possible edge cases (e.g. user requests scanlines
not on 4-pixel row boundaries); the code would have to do similar
juggling as EXR reader does to handle "not on chunk boundaries" reads.
It could potentially also interplay with DDS cubemap/volume texture
reading ("tiled") code paths, for which there is no test coverage at all
right now. Maybe for some other day.
2022-10-05 22:43:16 -07:00
Aras Pranckevičius cddf3e175b DDS: alpha/luminance format fixes, add & enable more tests (#3581)
* DDS: fixes for A8, L8, A8L8 formats

While developing #3573 at one time I had them working properly, but then
while fixing the address sanitizer failure for 3-channel formats I
botched them again. Note to self: never again do a "yeah I'll add tests
later", since if I had all of them running all the time this would
not have happened. 🤦

* DDS: extend test coverage for more formats & channel size cases

With more test images recently added (https://github.com/OpenImageIO/oiio/pull/3459),
start using them for DDS tests. This covers now:
- Alpha, Luminance and Alpha+Luminance formats,
- RGB formats with rarer channel sizes (rgb10 a2, r3g3b2),
- Several "broken" DDS file cases
- Removed usage of sample-DXT1 since it is well covered by others.
2022-10-05 22:43:16 -07:00
Larry Gritz aff5ea242f Remove incorrect OIIO_API from inline method declaration (#3578)
This was causing build issues on MinGW.
2022-10-05 22:43:16 -07:00
Larry Gritz 8a5580c59e Add RELEASING.md to document our release procedures (#3564)
Adapted from the similar document I wrote for OSL.

This serves both as a checklist for me to make sure I don't miss any
steps during a release, but also so that other people could take over
release procedures if necessary or desired.

I also rearranged the order of some lines in CMakeLists.txt for
clarity (but did not change the logic).
2022-10-05 21:09:12 -07:00
Larry Gritz f54a109ffb Python internals: support int8[] metadata and ICCProfile, refactor (#3556)
This patch allows ParamValue, ParamValueList, and ImageSpec to support
attribute/getattribute of metadata consisting of uint8[] arrays, which
is how we store certain binary blobs or raw byte arrays.  We translate
this to Python as a numpy array of type uint8 (dtype='B').

This fixes a limitation where it was not possible to directly retrieve
or set the "ICCProfile" metadata (which is stored as a uint8 array)
from the Python APIs, as you could easily do from the C++ APIs.

In the process, I found similar bits of code in several different
places, in various states of incompleteness. I refactored to make a
single make_pyobject() utility and then used that call in place of
several other redundant pieces of functionality.
2022-10-05 21:09:12 -07:00
Larry Gritz 922ec699a1 Extract metadata from embedded ICC profiles. (#3554)
For a while, we have found embedded ICC profiles in TIFF, JPEG,
JPEG-2000, PNG, and PSD (PhotoShop) files and store them in the
metadata as a byte array with the name "ICCProfile".

With this patch, we further add the facility of parsing the binary ICC
profile data to extract a number of other fields that we add to the
ImageSpec metadata so that "oiiotool -info -v" or "iinfo 'v"
will print this info.

Important caveat: You can read this for informational purposes, but
changing it (e.g. with spec.attribute()) does not change the contents
of the ICCProfile byte array, which is still the canonical ground
truth of the profile. You have to replace the "ICCProfile" byte array
to actually change the profile.
2022-10-05 21:09:12 -07:00
Larry Gritz f2a2d59344 Strutil utf conversion improvements (#3553)
* Add `Strutil::utf16_to_utf8(const std::u16string& utf16str)`.
  This is subtly different from our existing utf16_to_utf8() that
  takes a std::wstring, because wchar_t is not the same on all
  platforms.  If it really and truly is utf16-in-char16_t, you need
  this and can't use the utf-in-wchar_t which may be 32 bit chars.

* Add `Strutil::utf8_to_utf16wstring()` (identical to the old
  utr8_to_utf16) to make it more self-documenting as returning a
  utf16-encoded wstring and NOT a u16string. Note that wchar_t is not
  necessarily char16_t on all platforms (it is on Windows, but it's 32
  bits on Linux).

* Deprecate the ambiguously named `utf8_to_utf16()` for OIIO >= 2.5 and
  remove it for OIIO >= 3.0.
2022-10-05 21:09:12 -07:00
Larry Gritz 8fbf27b69d Build: Make the version number be a cmake cache variable (#3549)
Rather than specify the version in the usual project() statement,

    project (OpenImageIO VERSION 2.5.0.0 ...)

this patch decouples it

    set (OpenImageIO_VERSION "2.5.0.0" CACHE STRING "Version")
    project (OpenImageIO VERSION ${OpenImageIO_VERSION} ...)

thus allowing the possibility of overriding the version number at
build confuguration time (`cmake -DOpenImageIO_VERSION=3.1.4.1`).

This should be used with extreme caution. Probably never used by most
people. I don't need to describe all the ways that things can go
sideways if you make your build of x.y.z.w actually be arbitrarily
different from the x.y.z.w that everyone else uses and that is
documented.

That said, there are two scenarios I have in mind for which this
ability is very useful:

1. Sometimes, we add or deprecate API features "in advance" by having
   an `#if` enable or disable code based on the version, essentially
   putting in place changes that can't be enabled yet because they
   would break compatibility rules, but we want to integrate the code
   now and have it become active upon reaching a particular future
   version in which that incompatibility will be allowed. The version
   number override makes it easy to test this by quickly doing a build
   "as if" we had already bumped the version number to see what will
   happen when we actually do.

2. Every once in a while we need to do an internal build that, to
   conform to version compatibility rules, needs to appear to still be
   part of a past version family. This lets individual sites play some
   games with version number overrides rather than have to create new
   branches and tags for certain one-off internal releases.
2022-10-05 21:09:12 -07:00
Larry Gritz 98181a584e oiiotool --iccread and --iccwrite
--iccread reads a named file and directly adds its contents as the
"ICCProfile" metadata of the top image (as a byte array).

--iccwrite takes the "ICCProfile" metadata of the top image and
writes it to a named file.
2022-10-05 21:09:12 -07:00
Larry Gritz 1983be7f16 oiiotool protect against OpenEXR thread deadlock on Windows (#3582)
Suggested by SideFX: explicitly shut down the OpenEXR thread pool
before exiting oiiotool, because sometimes on Windows it seems to hang
otherwise. A better solution is probably possible on the OpenEXR side,
but I don't know what it would be. (And in any case, we'd still need
to do this be be well behaved when using OpenEXR versions earlier than
where a fix might land.)

Solution tracked down by Edward Lam.
2022-10-05 21:09:12 -07:00
Larry Gritz 5dfe62d56d CI: Re-enable sanitizer tests (#3545)
Oops, at some point, something about the way we set up the CI test
that runs the sanitizers, and ever since then (embarrassingly, perhaps
as much as a couple years ago), the "sanitizer" test has not in fact
been running the sanitizers. Here we fix that up, get sanitizers
running again.
2022-10-03 21:38:36 -07:00
Larry Gritz 78cca33201 PNG fixes (#3544)
* Minor png refactoring to fix some memory leaks for broken png files.

* Remove unused string variable from read_info() and simplify the
  surrounding "if"

* Split png test into png and png-damaged, because I just can't seem
  to squash some very minor memory leaks for broken png files, I think
  it's not worth worrying about and I'll just exclude the broken case
  from testing for the address sanitizer.
2022-10-03 21:38:36 -07:00
Johannes Unterguggenberger 8f7c48dec3 Fixes a warning from an unsuitable format specifier (#3540)
Changed the assert  to use format specifier %d and casting the size to an int.
2022-10-03 21:38:36 -07:00
Larry Gritz e7769b6b0d PNG: fix memory leak when error takes early exit (#3543)
Found by leak sanitizer.
2022-10-03 21:38:36 -07:00
Larry Gritz 8c8c918e5c Targa internals: fix incorrect unique_ptr declaration (#3541) 2022-10-03 21:38:36 -07:00
Larry Gritz fafbec1737 Bump version after release 2022-10-03 21:38:21 -07:00
Larry Gritz 4327cd8560 Stage for 2.4.4.2 patch release 2022-10-02 20:02:14 -07:00
Aras Pranckevičius 6ca23b7753 DDS: various improvements (#3573)
- If a DDS pixel format header contains "this is a normal map" flag
  set, then handle that properly (#3525):
  - For a DXT5, this means it's a "DXT5nm" format. Normal X & Y
    components are in green and alpha channel respectively. Compute Z
    component from those, and the result is a 3-channel tangent space
    normal map.
  - For ATI2/BC5 format that also has a "normal map" flag set, compute
    the Z component automatically too, and result is a 3-channel image.
    However a bunch of ATI2/BC5 normal maps out there in the wild do
    not have that bit set, so also have a global "dds:bc5normal"
    attribute to optionally turn this on.
- Fix support of R10G10B10A2 format - was producing garbage data due to
  code assumption that truncation down to 8 bits never needs to happen.
- Fix bit expansion ("too dark") of very low-bit formats, e.g. R3G3B2.
  Code was simply shifting the bits, instead of properly repeating
  the high bits into new low bit positions (i.e. a 3-bit "111" needs
  to become an 8-bit "11111111" and not a "11100000").
- Support "RXGB" (DXT5, with red & alpha swapped) as well as "BC4U"
  and "BC5U" formats (the latter two are just BC4 and BC5, produced by
  some older tools).
- Support alpha-only (e.g. A8) formats.

All this mostly prompted by doing DDS improvements in Blender, and
wanting to get Cycles renderer (which uses OIIO) to the same feature
parity. See https://developer.blender.org/T101405 and
https://developer.blender.org/D16087.
2022-10-02 15:07:49 -07:00
Larry Gritz aa0550e07f Fix heap overflow in DDS input (#3542)
Reading uncompressed scanlines would copy 4 bytes from each pixel into
an int and then decode the bits, incrementing where it was reading
from by Bpp bytes each time.  But when Bpp == 3, the last pixel of
every row would therefore read an extra byte past the end of the heap
storage. Allocation padding would in practice keep it from crashing,
and that meaningless extra byte was not used in the decode because it
knew it only needed the first 3 of the integer. But found by address
sanitizer!
2022-10-02 15:07:49 -07:00
Larry Gritz a10a88fa12 Bump version after release 2022-10-02 10:52:42 -07:00
Larry Gritz dab1663d6d Full release of 2.4.4.1 -- first official 2.4 release 2022-09-29 17:39:07 -07:00
Larry Gritz c0e7eb56d7 Remove long deprecated/nonfunctional C API headers (#3567)
This was an experiment that was added to master at one point but
removed before we branched for a release. But we forgot to remove a
few headers. Removing them now is not a compatibility break, since we
never shipped a supported release that contained the library that
implemented the functions declared in these headers.
2022-09-27 14:39:41 -07:00
Larry Gritz d02ad116b4 Reinstate missing (obsolete) parallel_for_chunked_2D variant (#3566)
This was part of a set of obsolete calls where we recently removed the
implementations, but for link compatibility, made matching shim calls
and wrap the modern versions. But I missed one case.
2022-09-26 23:40:51 -07:00
Larry Gritz ab7dc1f728 Update ref output after recent python chage 2022-09-24 11:36:17 -07:00
Larry Gritz 31dbd3d699 2.4.4.0-RC2 second release candidate
Changes since RC1:

  - ImageCache/TextureSystem both have added a `getattributetype()`
    method, which retrieves just the type of a named attribute. #3559
    (2.4.4.0)  NOTE: THIS IS AN ABI BREAKING CHANGE
  - Python: Fix the ability to `getattribute()` of int64 and uint64
    metadata or attributes. #3555 (2.4.4.0)
  - Build: Improvements to the generated cmake config files when
    building static libraries. #3552 #3557 (2.4.4.0)
  - Support for gcc 12.1. #3480 (2.4.2.1) #3551 (2.4.4.0)
  - Support building with clang 15.0. #3563 (2.4.4.0)
  - Fix cross-compiling on Android failing due to `-latomic` check. #3560
    (2.4.4.0)
  - Fix building on iOS. #3562 (2.4.4.0)

Note that we bumped the version to from 2.4.3.x 2.4.4.0 to reflect the
ABI break introduced by the last minute by the IC/TS addition of a new
virtual function. ABI will not change again for 2.4.
2022-09-23 08:56:49 -07:00
Larry Gritz d83aee94d5 Changes to take care of new clang 15 warnings (#3563) 2022-09-22 22:59:35 -07:00
Larry Gritz 7c167dab0a IC and TS getattributetype() (#3559)
ImageSpec and ParamValueList have had (since 2.1) a getattributetype()
method, which simply returns the TypeDesc of the named attribute, or
TypeUnknown if no such attribute exits. This goes along well with the
related getattribute() and attribute() family of methods.

The getattribute() method was not present in ImageCache and
TextureSystem, despite their having very similar
getattribute()/attribute() interfaces.

A recent issue made me realize that in the Python bindings, the IC and
TS bindings for `getattribute(name)` did not work properly, always
returning None, and *required* you to use the full
`getattribute(name,type)` variety where you have to supply -- and
already know -- the type. This isn't especially Pythonic, where you
should just be able to ask by name and get a polymorphic result. And
when I went to look at how to repair this, it was going to be very
awkward without getattributetype(), but trivial with it.

So this patch sets up getattributetype() for both IC and TS, and
exposes them to both C++ and Python APIs, and also fully fixes the
getattribute() so that it works properly with the name only.

Unfortunately, because getattributename is a new virtual method, it
changes the vtable, breaking the ABI, and thus cannot be backported to
any supported release that makes ABI compatibility promises.
2022-09-22 22:59:26 -07:00
Povilas Kanapickas fe98cbfb9a Fix build on iOS by not using std::system() (#3562)
iOS and similar Apple platforms only support executing single process
per app. Calling std::system() there fails at compile time.
2022-09-22 22:59:19 -07:00
Povilas Kanapickas 6445022f11 Build: Fix cross-compiling on Android failing due to -latomic check (#3560)
Currently when cross-compiling for Android build fails due to usage of
TRY_RUN(). In the particular case it tries to figure out whether atomics
can be used without the libatomic library.

Fortunately we don't need this check because on Android NDK atomics are
built-in and libatomic.so is not present. Only static dummy libatomic.a
exists for compatibility with -latomic flag.
2022-09-19 18:43:58 -07:00
Larry Gritz ade4132ada Python: add ability to getattribute of int64 and uint64 data (#3555)
Just a couple missing pieces were preventing getattribute() from
retrieving attributes that were stored as int64 or uint64. That
doesn't come up very often, but one place is retrieving certain
statistics that use 64 bit counters. (This comes up in ImageCache,
among other places.)

While we're at it, there was no existing test dedicated to the python
binding of ImageCache. So to add these getattribute calls, I made one.

There is an important caveat about ImageCache.getattribute(): In this
process, I discovered that the flavor of IC.getattribute(name) where
you only pass the name is BROKEN, and will always return None. You
MUST use the form where you pass the type, like

    x = ic.getattribute("foo", "int")

This is unfortunate and not very Pythonic, but it is the workaround
for now. I will addess getting the name-only form working in a
separate PR.

Closes #3537
2022-09-18 14:37:50 -07:00
Povilas Kanapickas c5d17a32c5 cmake: Find TBB dependency in Config.cmake.in when building static (#3557)
TBB::tbb is added as a library dependency via TARGET_NAME_IF_EXISTS.
Therefore if an executable links OpenImageIO static library without the
executable itself depending on TBB, then TBB will not be linked in and
result in link time errors.
2022-09-18 14:36:58 -07:00
Povilas Kanapickas 9900536fce cmake: Add library dependencies in Config.cmake.in when building static (#3552)
This fixes builds in projects that compile OpenImageIO as static
libraries and don't themselves depend on the image libraries used by
OpenImageIO such as PNG, JPEG or TIFF.

When OpenImageIO is built as a static library its targets have e.g.
PNG::PNG among INTERFACE_LINK_LIBRARIES. If the including project does
not itself depend on PNG, the following error would be observed:

Target "<...>" links to target "PNG::PNG" but the target was not found.
Perhaps a find_package() call is missing for an IMPORTED target, or an
ALIAS target is missing?
2022-09-18 14:36:11 -07:00
Larry Gritz 8c40efdcc5 Slight change to avoid gcc12 warning (#3551) 2022-09-13 14:07:11 -07:00
Larry Gritz 449e1c7ea6 Designate as RC1 2022-09-07 21:36:45 -07:00
Larry Gritz 0a28dc0186 Bump version and branch for 2.4 release 2022-08-31 17:03:05 -07:00
Larry Gritz 5ef709c1b4 CHANGES, docs 2022-08-31 14:31:05 -07:00
Larry Gritz 27745db1da ImageCache: improve file handle limits under heavy thread contention. (#3515)
When enforcing the max open files limit, there's a heuristic where we
only "try" to get the lock, and if we can't, rather than block, we
just defer the cleanup step until the next time around. So what if we
go slightly over the limit temporarily?

Interesting edge case: what if max_open_files is relatively low, but
the number of threads is very high and you have a high contention rate?

Then you can end up *significantly* over the limit, because almost all
the threads say "somebody else has the lock, I'll leave it to them to
clean up" and blithely open new handles.

So this patch modifies the logic so we do the defer trick only if
we're only a little over the limit. If we've exceeded the limit by
16 handles, grab the lock unconditionally and do the cleanup.
2022-08-31 11:08:02 -07:00
Luc 736864dca0 Added checks in PNG_pvt::write_info (#3535) 2022-08-29 23:18:50 -07:00
Larry Gritz afa6c84f68 CI: test latest fmt version (#3536) 2022-08-29 23:17:00 -07:00
Larry Gritz a14523e9b7 Add --version to all the things (#3534)
* ArgParse::add_version(str) tells ArgParse the version string, and
  automatically adds an option --version that prints the version string
  and exits.

* Add this to oiiotool, iinfo, igrep, iv, maketx.

* OIIO::getattribute("version") retrieves the version string.
2022-08-26 10:10:16 -07:00
Larry Gritz 7e77d7b05d Improve JPEG output of 2-channel images (#3531)
JFIF/JPEG files only support 1 and 3 channels. For > 3 channels, we
had just been discarding the extra. For 2 channels, we had been
discarding the second, but maybe that's not always right. Try to
distinguish between files whose names appear to be YA -- in which case
output the Y as grayscale (JFIF has no way to represent alpha anyway),
and other cases which we now promote to RGB and just make B be black.
2022-08-23 00:02:51 -07:00
Larry Gritz 939c25988a DDS improvements (#3530)
* For 2-channel DDS files, label them as Y,A if the flags indicate
  luminance and/or alpha, otherwise label them as R,G.

* Do not set "oiio:BitsPerSample" for cases where the dds.fmt.bpp field
  is not assumed to be valid. MS docs say it's valid only if the flags
  field indicates RGB, LUMINANCE, or YUV types.
2022-08-23 00:02:38 -07:00
Larry Gritz f582b8b5ab Make Filesystem::extension work identically for C++14 and 17 (#3529)
The implementation of boost::filesystem::path::extension() and the
equivalent for std::filesystem disagreed about the result of
extension(".foo"). C++17 correctly considers ".foo" to have no
extension.
2022-08-23 00:02:17 -07:00
Larry Gritz 217c169543 Miscellaneous Sonar-inspired warning fixes (#3532) 2022-08-21 15:09:57 -07:00
Larry Gritz cace0c4b82 Fix warning wth C++20 + g++12 (#3533) 2022-08-21 13:21:57 -07:00
Larry Gritz c2ed61bb85 Remove 'socket' file type (#3527)
This was envisioned to be useful in the very earliest days of OIIO,
but we never really finished it or used it in any helpful way.
In addition to being essentially dead and untested code, it ties us
to boost.asio, which we use nowhere else.

So just get rid of it this vestigial piece.
2022-08-19 19:43:45 -07:00
Larry Gritz b6b3166d4e CI: For Mac, test python 3.9 for MacOS11, and 3.10 for MacOS12. (#3528) 2022-08-19 10:25:34 -07:00
Larry Gritz be30dfa241 Suppress incorrect warnings for gcc12 (#3524) 2022-08-15 22:56:05 -07:00
Larry Gritz e69b267e0f Build: Don't force MACOSX_RPATH on (#3523) 2022-08-14 17:59:05 -07:00
Larry Gritz 59408d630c Fix mail list refereces 2022-08-14 17:58:06 -07:00
Larry Gritz 9501cd71ab Fix analysis trigger typo 2022-08-13 22:58:52 -07:00
Larry Gritz 50286f3e03 Several minor fixes for Sonar warnings (#3522)
Knocking these out a few at a time
2022-08-13 21:56:57 -07:00
Larry Gritz ce3d45a812 Fix destructors that could throw an exception -- big no-no (#3521) 2022-08-12 18:21:11 -07:00
Michael Cho 01cf730d2f cmake: fix ffmpeg 5.1 detection (#3516) 2022-08-11 23:29:06 -07:00
Larry Gritz 79a4803db6 Some minor refatoring to address Sonar warnings (#3518) 2022-08-11 23:22:25 -07:00
toxie f21a666b2d Fix vector-subscript-out-of-range on MSVC Debug builds (#3517)
Also fix potential problems with >31bit pixelsizes
2022-08-11 19:21:15 -07:00
Larry Gritz 1af0a782d3 Fix crash with oiiotool -i:ch= (#3513)
* Any use of `-i:ch=...` would result in a crash because of
  dereferencing an empty shared pointer.

* In the case of `-i:ch=` specifying missing channels, improve the
  warning message to make it clear which channels were actually present.
2022-08-06 23:26:20 -07:00
Larry Gritz 9f4f6ae6cd CI fixes (#3514)
* Remove GHA CI for Mac OS 10.5, it faces imminent deprecation by GitHub.
* Update some dependency version numbers in INSTALL.md.
2022-08-06 23:25:52 -07:00
Larry Gritz f8616d9824 Miscellaneous static analysis warning issues (#3512)
Also re-split the scorecard workflow from the analysis workflow.
2022-08-05 09:10:01 -07:00
Larry Gritz 61a58a17f8 Get rid of redundant 'virtual' when we use 'override' (#3511) 2022-08-04 23:50:28 -07:00
Larry Gritz 540e7e2554 Fix broken workflow file -- copy/paste error (#3510) 2022-08-03 23:34:42 -07:00
Larry Gritz c530e48cb6 Relative image compare (#3508)
Extend ImageBufAlgo::compare() to take relative metrics, which if
nonzero check the symmetric mean relative error, in addition to the
current absolute error. To be formal, this means that a value
comparison will fail if

    abs(A-B) > failthresh && abs(A-B)/((abs(A)+abs(B))/2) > failrelative

Setting the failthresh to 0 is equivalent to only checking relative
error, and setting failrelative to 0 is equivalent to the (previous
behavior) of checking only absolute error.

The idiff utility is extended to take new `-failrelative` and
`-warnrelative` command line arguments.

The hope is that there are various kinds of image comparisons within
tolerances -- like we frequenty use for unit tests, shader
verification, etc. -- where this metric is more helpful than absolute
error.
2022-08-03 23:27:01 -07:00
lmarz c3740921b6 cmake: Escape argument in regex (#3507)
See https://gitlab.kitware.com/cmake/cmake/-/issues/18737 for why this is an issue
2022-08-03 08:35:01 -07:00
Larry Gritz 307fe02a49 Set up SonarQube for static analysis (#3505)
Set up SonarQube to run weekly (seems unnecessary to do on every PR,
it's a LONG run). Also required some build system fixes to enable code
coverage analysis.

This is handled by the "analysis.yml" workflow (into which I also
merged the scorecard analysis we were doing). This workflow runs once
weekly or on only those pushes/PRs with specially named branches.
There's no reason to run this expensive analysis on every last PR or
push.

A number of fixes come along related to things found by Sonar as I was
setting this up:

* Fix buffer warnings
* Address sonar warning: was reading wrong size into buffer
* warning reduction in dpxoutput, simplify string ops
* Clean up dubious uses of sprintf
* Add assertions
* Save a needless string construction in ParamValue::get_string_indexed
* Fix string safety warnings
* iptc: simplify encoding string data and improving safety
2022-08-01 07:23:51 -07:00
Larry Gritz 7ab1ee5108 Refactor TGAInput::open to simplify. (#3504)
It was getting too big. Split off the tga-2.0 header reading parts
into a separate method.
2022-07-29 09:45:00 -07:00
Larry Gritz c72154fa26 Use imath .xyz rather than [] to fix static analysis warnings (#3503)
Stranely, this made slightly numerically different texture test
results on icc.  Switching its math mode to precise brings it back in
line with the other compilers. The differences aren't visible, so this
isn't an issue in practice, but for tests it made it hard to compare
to reference images.
2022-07-29 07:48:09 -07:00
Larry Gritz bc9c931092 Strutil::safe_strlen (#3501) 2022-07-24 22:13:15 -07:00
Larry Gritz 7f90f51792 Fix bug in print_info_subimage -- botched condition (#3499) 2022-07-24 22:12:58 -07:00
Larry Gritz 04e32c9894 Fix aspect ratio logic in jpeg (#3500)
Typo, was checking XRes twice instead of XRes and YRes.
2022-07-24 22:12:32 -07:00
Larry Gritz afc2bd1649 parallel.h refactoring and add support for TBB (#3473)
Hide nearly all of the implementation of the parallel_for family of
methods rather than expose them as inline. This gives us more freedom
to change the implementation in the future without breaking ABI.

Deprecate the parallel methods that take task functions whose first
parameter is the thread ID. The only reason they existed is because
our cobbled together thread_pool used that in its inner workings.  But
there are good reasons why we should not expose that:

  * We never used it anyway.

  * It was not very useful, since sometimes it was a real thread ID, but
    other times it was -1 in cases where the calling thread executed the
    task directly.

  * It is inconsistent with other thread pool implementations that we may
    wish to try in the future.

So better just to not expose those thread IDs at all. Mark those
versions of the parallel loops as deprecated and schedule them for
removal in OIIO 3.0.

If TBB is detected at build time, support will be built in that allows
either the old OIIO built-in pool, or TBB, depending on the setting of
a new global OIIO attribute, "use_tbb" (default 0), if set to nonzero
will use the TBB thread pool.

In my experiments, the TBB thread pool seems slightly better -- I
think because there is less overhead, and maybe the clever
work-stealing it does elps to load balance. It's not used by default,
set the attribute if you want to use it (assuming the build
included. After we've had a chance to test more thoroughly, we may
change to use TBB by default. I'm interested to hear people's thoughts
on the matter.

One case where you almost certainly will want to use the TBB thread
pool is if you're using libOpenImageIO from within an application that
uses TBB for its own threding -- that way you're using one pool for
everything, rather than have two separate thread pools that don't know
about each other (and probably twice as many threads as you have
cores)..
2022-07-24 14:37:34 -07:00
Larry Gritz db1cdd6935 Fix incorrect assignment of oiio_missingcolor (#3497)
Incorrect use of reserve(), then writing past the end of the vector.
It should have been resize(). But it can be cleaned up even further by
using assign().
2022-07-24 09:23:42 -07:00
Larry Gritz f8a237cb80 Bug fix: posible null pointer dereference in inventory_udim (#3498)
If udimfile is null, it would get dereferenced anyway. Was missing
a `return` in that case.

While I was there, I realized that ImageCacheImpl::inventory_udim and
resolve_udim had no reason to be virtual, so I removed that
qualifier. (It was probably a cut/paste error, as the
identically-named methods in TextureSystem are virtual, on
purpose. But they don't need to be for this class.)
2022-07-24 08:28:18 -07:00
Larry Gritz 04137bbeb9 Upgrade to the latest PugiXML (#3494) 2022-07-23 15:34:31 -07:00
Povilas Kanapickas d6594f132f JPEG: Fix a race condition in read_native_scanline() (#3495)
All read_native_* methods of ImageInput are required to be thread-safe
with any other read_native_* call or with the varieties of read_tiles()
that take an explicit subimage and miplevel parameter.

JpgInput::read_native_scanline() does a seek_subimage() call internally,
so it's obviously not thread safe without additional locking.
2022-07-23 11:08:12 -07:00
Povilas Kanapickas 2bcbb06944 filesystem.h: Improve documentation of pread() and pwrite() (#3496)
The current description of IOProxy::pread() and IOProxy::pwrite() is a
little ambiguous. This commit expands the description to explicitly tell
what the functions are and are not required to do.
2022-07-23 10:22:16 -07:00
Povilas Kanapickas fb07a242b2 Make access to imageio_mutex not recursive (#3489)
This will allow switching imageio_mutex to std::shared_mutex to avoid
exclusively locking the internal format database for read operations.
2022-07-22 22:50:55 -07:00
Larry Gritz 43d8d543b6 Fix typos in comments and docs (#3492) 2022-07-22 22:02:24 -07:00
Larry Gritz 1d3bb460e2 Bump version 2022-07-21 22:50:44 -07:00
Larry Gritz 32557090ea Protections against 0-length string attributes (#3493)
Files that have string metadata with length 0 can cause trouble
if we aren't careful. But in a number of protections.
2022-07-21 22:47:06 -07:00
Larry Gritz a9fbf36560 Fix mistake in unordered_map_concurrent (#3485)
Should not have passed an argument. Went undetected for a long time
because I guess we didn't previously call the erase() method. (Until
I did when working on something unrelated.)
2022-07-20 11:14:20 -07:00
Povilas Kanapickas ebee2b7888 Fix -Wsuggest-override warnings (#3488)
Consistently applying override specifiers helps to ensure that functions
are actually overridden when they meant to be such.
2022-07-20 11:13:51 -07:00
Larry Gritz 1bc666a708 Bump version for developer preview 2.4.2.1 2022-07-19 22:32:34 -07:00
Larry Gritz 56e0bd05d8 TIFF: Protect against empty attribs when setting TIFF fields (#3491) 2022-07-19 22:00:06 -07:00
Larry Gritz 590ce5f8f0 Empty string / null pointer safety in metadata printing (#3490) 2022-07-19 15:49:52 -07:00
Povilas Kanapickas 31daceea03 Address -Winconsistent-missing-destructor-override warning (#3481)
Virtual destructors don't significantly differ from regular virtual
functions, so it is customary to add override specifier when virtual
destructor is overridden.
2022-07-19 15:48:08 -07:00
Povilas Kanapickas 2e30e71ef1 cmake: Fix value of OpenImageIO_INCLUDE_DIR in cmake config (#3487)
Current code assumes that CMAKE_INSTALL_INCLUDEDIR and
CMAKE_INSTALL_LIBDIR has exactly one filesystem component. This is not
the case on e.g. Debian, where standard paths are as follows:

CMAKE_INSTALL_INCLUDEDIR=include
CMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu

Fortunately the Config.cmake file is installed into a path that is
itself relative to CMAKE_INSTALL_LIBDIR, so we can get
CMAKE_INSTALL_LIBDIR from CMAKE_CURRENT_LIST_DIR and then get
CMAKE_INSTALL_INCLUDEDIR by applying relative path from
CMAKE_INSTALL_LIBDIR to CMAKE_INSTALL_INCLUDEDIR on top of that.

Fixes: c8dfbd7066
2022-07-19 14:25:51 -07:00
Larry Gritz 786a55479e Move guts of OIIO::debug to Strutil so it can be used from util library (#3486) 2022-07-19 11:56:25 -07:00
Povilas Kanapickas e7ad7cef20 Bump maxthreads to 512 (#3484)
The current limit has been already hit when AMD released
second-generation Epyc processors (codename Rome) back in 2019. Top
models have 64 cores per CPU, or 128 threads. This means 2 socket
configuration has 256 threads.

Fourth generation Epyc processors (codename Genoa) are rumored to have
96 cores per CPU, or 192 threads. This means 2 socket configuration has
384 threads. While the CPUs have not been announced yet, it makes sense
to prepare for them in advance.
2022-07-19 09:34:15 -07:00
Larry Gritz 431204b78a CI: Try newest ubuntu 22.04 and MacOS 12 images, test gcc12 (#3480)
Bump the bleeding edge test to use gcc12, C++20, and python 3.10.

Address the couple of new warnings that popped up.

Add a test on MacOS 12.
2022-07-18 08:47:39 -07:00
Larry Gritz 777e7730df Get rid of Boost::system (#3479)
I think whatever we needed it for originally is long since gone.
2022-07-18 08:46:08 -07:00
Larry Gritz 24f804dfd2 Test against pybind11 v2.10 (#3478) 2022-07-17 20:50:14 -07:00
Larry Gritz 07c538071e Build: Use std::filesystem when we can (#3477)
C++17 (and/or adequately new versions of the compilers) support
std::filesystem, and in those cases we no longer need boost.filesystem.
2022-07-17 18:38:33 -07:00
Larry Gritz 1521da6213 Replace unsafe strcpy/strcat in SHA1.cpp (#3476)
Revealed by clang-tidy. Use length-safe versions.

Also get rid of some dead code by disabling some memory-clearing
code that we don't need (we're not using SHA-1 for cryptographic
or security reasons, just for comparing images).
2022-07-16 20:45:57 -07:00
Larry Gritz 97254f625d Filesystem: provide alternate implementations of last_write_time() (#3472)
This is a discrete step in an attempt to wean us off of boost::filesystem
2022-07-15 00:05:32 -07:00
Michael Oliver 836bd0d113 build_opencolorio.bash: update default ocio build to 2.1.2 (#3475) 2022-07-14 23:57:43 -07:00
Larry Gritz 348c4fee6e Remove a stray reference to half.h in a public header (#3474)
There's no reason to expose this here.
2022-07-14 18:13:06 -07:00
Larry Gritz 879dc2fbdb Bump version to 2.4.2.0 for developer preview 2022-07-11 20:56:59 -07:00
Larry Gritz 7b57336a28 CHANGES update 2022-07-11 16:57:34 -07:00
Larry Gritz a12a0cebc7 Strutil::safe_strcat (#3471) 2022-07-11 10:42:37 -07:00
Anders Langlands 3ee1a4d410 Allow loading of dlls from PATH on Windows Python 3.8+ (#3470)
Python 3.8 stopped loading DLLs from PATH on Windows, meaning anything that relied
on that environment for shared library resolution breaks. This PR works around that
behviour by manually adding PATH back to DLL resolution using os.add_dll_directory()
in a new __init__.py which just re-exports everything in the current .pyd.

The new behaviour is enabled by default, but is easily disabled at runtime if the
environment variable OIIO_LOAD_DLLS_FROM_PATH is equal to "1".
2022-07-10 21:58:01 -07:00
Larry Gritz e9103925bb TIFF: Fix some longstanding IPTC buffer safety issues (#3465)
Found this coincidentally during some address sanitizer runs.

Some tiff files out in the wild that have RichTIFFIPTC tags
inexplicably mark them as if the data was LONG instead of BYTE or
NOTYPE. I guess early in our history, we came across one of those and
thought it was correct, because we were always treating it as if it
came in the form of longs. But that's not always true, and in
particular, the size in the tag I think is always expressed in
bytes. So this could make for buffer overruns (generally harmless, but
caught by the sanitizer!).

So this patch cleans this all up.

And also we update a few sample images with bad RichTIFFIPTC tags to
strip out the in the incorrect form of the tag.
2022-07-07 12:55:40 -07:00
William Krick 925a6b7c8a Correctly accumulate 'ofs' when the cubemap has mipmap levels. (#3467) 2022-07-07 12:54:57 -07:00
Larry Gritz ea127e8973 PSD: beef up error message to help track down PSD failures (#3469)
Try to have an error message for every possible failure.
2022-07-06 18:09:24 -07:00
Larry Gritz 7a662829b9 Docs: Clarify how ImageOutput::copy_image propagates read errors (#3468) 2022-07-06 14:59:05 -07:00
Larry Gritz 5c3355bed0 Extend stochastic texturing to anisotropic (#3457)
Recently, we added the ability to do stochastic sampling in texture
lookups, by choosing the MIP level stochastically rather than reading
two MIP levels and mixing them.

This PR adds the ability to also stochastically sample the anisotropic
filter footprint -- instead of multiple anisotropic samples, choose
just one sample well distributed over the footprint axis. On real
scenes, this seems to speed up overall rendering (not just texture) by
up to 2-3%, for scenes where average anisotropy is around 3-4.

It's much less dramatic a speedup than the stochastic MIP selection,
which sped up texturing by around 40% and in practice sped up overall
rendering by around 15% for us. Why doesn't cutting the number of
texture samples by another factor of 3 only speed up by 3% instead of
another 20%? Basically, it's because the stochastic MIP mapping *by
definition* means that each texture call touches half the number of
tiles as before. In contrast, those multiple probes along the
anisotropic axis are almost always within the same tile, and
frequently touch a very nearby pixel within the tile, so not only are
we not needing to look up a new tile from the tile cache, but also the
very memory we need to read is highly likely to be in L1$. But still,
we'll take 2-3% rendering gain any time we can get it, that's
equivalent to a lot of money if you have a really large compute farm.

Some other changes that come along for the ride:

Add a --bluenoise option to testtex (makes for prettier 1spp results),
and add tests for the aniso sampling.

Some internals changes to precompute min w,h of mip levels so there is
less per-texture-call rifling through the ImageSpec of each MIP level.
Sadly, this did not produce any consistently detectable speedup in
overall rendering.

And I changed the interface for stochastic texturing a bit. The old
way involved asking for new MIP modes, StochasticAniso or
StochasticTrilinear, in addition to being sure to set TextureOpt::rnd
to the stratified random number you are using for sampling. Now we are
deprecating StochasticAniso and StochasticTrilinear. Just use the same
old mip levels you always did. So the new interface can be summarized
as follows:

* On each texture call, setting opt.rnd >= 0.0f is itself a request for
  stochastic texturing on that call (opt.rnd will default to -1.0, and
  any negative value does the old fashioned non-stochastic filtering).

* A ShaderSystem-wide option "stochastic" (int) indicates which things
  should be sampled stochastically, for those lookups that have rnd >= 0.
  It's a bit field: 0 means no stochastic sampling (even if rnd >= 0),
  1 means to do stochastic MIP level selection 2 means to do stochastic
  anisotropic sampling (so 3 means to do both, and higher bits are reserved
  for future extensions). The default is 0, so renderers need to enable
  it to get any stochastic texturing.

Finally, let me give a reminder that you ONLY want to do stochastic
texturing for shading that involves multiple stochastic samples per
pixel, like orinary surface shades. For displacement (shade once per
mesh vertex) or "imager" (shade once per pixel), you just have a
single shade that you want perfectly filtered, so you probably don't
want to set opt.rnd >= 0 in those cases.
2022-07-05 19:00:28 -07:00
Larry Gritz f0c3cccd44 CI: Test against fmt 9.0.0 (#3466) 2022-07-05 15:37:42 -07:00
Aras Pranckevičius 62400c3de8 DDS: speed up reading of uncompressed images (#3463)
Previous code was doing ioread one pixel at a time. Change it to
read one scanline at a time, similar to e.g. how BMP reader does it.

On a 8192x8192 rgba8 image (256MB), on Apple M1 Max "iinfo --hash"
time goes from 2.19s down to 0.65s, and is now similar to the time
it takes on an uncompressed TIF or BMP image.
2022-07-04 10:01:49 -07:00
Aras Pranckevičius 8a13790cd5 PR template: fix links to work in actual PR page (#3464)
When viewing this .md file in Github UI, everything seems to work. But when creating an actual PR, the links to CONTRIBUTING and CLAs point to nothing that would exist. Looks like they try to be relative links from the "create a new PR" page. Workaround seems to be to use absolute links instead.
2022-07-04 09:26:46 -07:00
Larry Gritz 43247981c5 CHANGES 2022-07-02 22:33:03 -07:00
Aras Pranckevičius 5e67c09ece DDS: replace libsquish with bcdec, add BC4-BC7 (#3462)
Implements support for BC4, BC5, BC6H (unsigned and signed) and BC7
GPU texture compressed formats in DDS reader (#2338).

- BC4: loaded into 1 channel uint8,
- BC5: loaded into 2 channel uint8,
- BC6H: loaded into 3 channel half,
- BC7: loaded into 4 channel uint8.

This is implemented by replacing whole of libsquish (~4700 lines of
code) with bcdec.h (https://github.com/iOrange/bcdec, ~1300 lines of
code). bcdec.h has an advantage of being faster, smaller and supports
all BCn formats for decoding.

bcdec.h license is MIT or Unlicense (aka public domain), updated all
the relevant third party / license files that I could find.
2022-07-02 09:29:55 -07:00
Aras Pranckevičius 50f0e273a9 dds: Add more DDS test images (#3459) 2022-07-01 22:17:14 -07:00
Larry Gritz 249ccaf21b CI: Security fixes (#3454)
* Add a SECURITY.md detailing our security policy and the private
  email address to contact to report vulnerabilities.

* Create scorecards.yml, to run OSSF scorecard to check supply chain
  security issues. It has some false positives, but it's only advisory.

* Make sure actions we use don't get write perms on our repo.

* Use exact SHA's for actions versions to guard against hijacked
  actions repos that might try to substutite something else at the
  version tag we use.

* Tried to use harden-runner action to ensure no actions on the runner
  overwrite source code or have unauthorized outgoing net connections
  during the GHA run, but currently leaving it disabled because of too
  many false positives -- it flags every dependency download as a case
  of altering source code. Which it technically is, but it doesn't
  matter for any jobs that aren't producing any artifacts that will be
  consumed or relied on by users.

Learned about this from a security talk.
2022-06-30 17:24:04 -07:00
Larry Gritz 7492ef0d0b idiff: add --allowfailures and convert output (#3455)
* --allowfailures is a big hammer to allow a certain number of pixel
  mismatches by any amount.
* Convert diff to modern std::format based output.
2022-06-27 11:27:34 -07:00
Aras Pranckevičius 26cc78c464 Build: allow "arm64" arch in make (#3456)
On Apple Silicon, `uname -m` returns `arm64`. The make platform detection script was allowing `aarch64`, so similar to that one, also allow `arm64`.
2022-06-27 08:35:05 -07:00
Larry Gritz 9aeb9d512b Timer: use clock_gettime rather than gettimeofday (#3443)
On Linux, we'd been using gettimeofday, which gives results with usec
resolution. Switch to clock_gettime, which has nsec results.

In practice, the round trip time of a pair of "get time" system calls
is about 30-50ns in either case. But the new call at least nominally
returns ns resolution values. Another way of saying that is: the
answers we get should be more accurate with this call, but the call
itself is the same expense as before, so we should still be just as
cautious about not inserting timers around events that are so brief
that the timers themselves are going to be a significant addition to
the cost.

This only effects Linux (and maybe BSD?). On MacOS, we use
mach_absolute_time(), and on Windows we use QueryPeformanceCounter(),
so neither of those platforms is affected by this patch.
2022-06-25 08:24:34 -07:00
Larry Gritz 5cee511134 Fix crash when ioproxy is passed to a plugin that doesn't support it (#3453)
The plugin was freed before the error message printed that depends on
it.
2022-06-25 07:20:07 -07:00
Larry Gritz 1e74b7ecf5 ustring: add OIIO_USTRING_HAS_USTRINGHASH symbol (#3449)
This makes it easier for downstream users to test if ustringhash is
available in a particular version of OIIO.
2022-06-18 08:32:06 -07:00
Larry Gritz 2213f62991 Change DoNotOptimize declaration to not conflict (#3444)
More care with "forceinline" so it doesn't interfere with the
"optnone" on some platforms.
2022-06-17 15:09:15 -07:00
Larry Gritz bc617dd0d1 TextureSystem: Change internal hq_filter to std::unique_ptr (#3448)
It's a very minor internal idiom modernization.
2022-06-17 11:26:27 -07:00
Larry Gritz f1a8ea067c TextureSystem: fix typo in attribute name (#3447)
Oops, calling it "m_max_tile_channels" (the name of the member
variable) instead of "max_tile_channels" (the name of the attribute)
actually prevented properly setting or retrieving the attribute by
name.
2022-06-17 11:25:43 -07:00
Larry Gritz 1b9638864e ustringhash (#3436)
ustring is a unique string (that lives in an internal hash table) whose
representation is the pointer to the characters that live in the table.

ustring hash is its alter ego -- it also refers to a ustring in the
internal hash table, but the representation is just the hash itself.

It presents an interface that is a subset of that of ustring, and in
many ways they can be used interchangeably.  For ustringhash,
accessing the characters requires using the hash to find the string in
the table -- which is not hard, but more expensive than accessing the
charcters with a ustring, where the representation is the pointer
directly to the characters.

For some uses where you don't need access to the characters in any
performance-critical paths, this may be a more convenient
representation.  In particular, it's well suited to a GPU that doesn't
have access to the character memory. Another interesting difference is
that from run to run, a ustring may have a different literal value,
since there's no reason to expect that the pointer to a string like
"foo" will refer to the same memory location every time the program
executes, but in contrast, the hash is guaranteed to be identical
from run to run.

In the process of adding unit tests for ustringhash, I ended up
overhauling all of ustring_test.cpp, as I saw that the ustring tests
were extremely cursory. Did a tiny bit of (non-breaking) touch-ups
on a few ustring methods as well.
2022-06-17 11:25:12 -07:00
Larry Gritz 46d97b2cc4 PNG: beef up error detection and propagation (#3442)
Especially for corrupt/broken files.
2022-06-13 10:05:11 -07:00
Larry Gritz 9beaa93d3a JPEG2000: better detect failure to open the file (#3440)
We were missing cases where the underlying OpenJPEG library itself
had errors reading corrupted files, or errors didn't propagate around
correctly.
2022-06-12 17:57:46 -07:00
Larry Gritz 999a7a4b21 BMP: protect against corroptions with palette indices out of bound (#3435)
If the BMP image we're reading declares a certain sized palette, but
then has pixels that contain values outside the range of that palette
size, we would read past the end of arrays.
2022-06-10 19:28:26 -07:00
Larry Gritz b9905464fb BMP: detect corrupted images (#3434)
Check for nonsensical image dimensions or total size before doing
buffer allocation.
2022-06-10 09:52:14 -07:00
Larry Gritz 040d71bfaa Targa: fix reading of tiny image (#3433)
With a 1x1, 2bit image of a Targa 1.0 file, the entire image was only
22 bytes, so the seek to 26 bytes before the end to look for the
Targa 2.0 data... obviously failed.

Don't look for the Targa 2.0 block if the file itself is not long
enough to hold both the header (18 bytes) and the block (26 bytes).
2022-06-10 08:51:26 -07:00
Larry Gritz 069f079eb5 Rename src/dds.imageio/squish/simd.h -> squish-simd.h (#3424)
This tiny change is a quality-of-life fix for me, addressing the fact
that there are two different simd.h files in our code base. I never
would have done that on purpose, but one of them is part of the
imported "squish" source code that we use for dds encoding.

For years I've been frustrated that reflexively typing `CMD-P simd.h`
in the editor has a 50/50 chance of pulling in this file, when in fact
there is literally a 100% chance of my wanting
src/include/OpenImageIO/simd.h.

So finally put my editing brain out of its misery by renaming the file
that I never want to edit.
2022-06-06 23:30:46 -07:00
Larry Gritz 78a504c6a5 ci: Bump OpenColorIO for 'latest' tests (#3425) 2022-06-05 17:14:01 -07:00
Larry Gritz 6d3e16fae3 Minor Python fix -- allow setitem to process a py::bytes as a string. (#3423) 2022-06-02 19:25:20 -07:00
Larry Gritz 597b8e6775 Straighten up OpenColorIO_FOUND vs OPENCOLORIO_FOUND (#3422)
We were using it inconsistently.
2022-06-02 15:17:23 -07:00
Larry Gritz dff26bd738 CI: Test the latest libtiff (#3420) 2022-05-31 22:39:45 -07:00
Larry Gritz a7aa251db4 testtex --minthreads and --lowtrials (#3418)
When doing thread "wedge" tests, most of the time spent is for the
1-thread case. Who cares about 1 thread anyway? So we make two
improvements with new command line options:

* --minthreads sets the minimum number of threads that will be
  used. For example, `--minthreads 2` will skip the single-thread case
  and start the wedge with the 2 thread case.

* --lowtrials is an optional maximum number of trials just for the 1
  or 2-thread case (overriding --trials just for those thread counts,
  if it is a lower value).

By default, the old behavior is still the default. But these allow a
bit of customization in the tradeoff of how much time to invest in the
very low thread counts in a wedge of thread timings.
2022-05-31 09:53:43 -07:00
Larry Gritz 12346eaf09 TIFF: fix read problem with tiff files with non-zero y offset (#3419)
You'd think there would be no way that basic failure like this could
occur after 14 years, right?

But the TIFF reader code was a little mixed up about the fact that the
internal m_next_scanline field is relative to the starting scanline of
the image, not an absolute value. But in the case of the code that has
to deal with handling the stray scanlines at the end of a strip-read
file neglected to set it properly and the end of the stripped part.

Obviously, for TIFF files with a first scanline of 0 (the vast, vast
majority), failing to adjust by this offset doesn't matter. And also
as long as the reading continued to be strictly sequential, it also
was asymptomatic. But in the presence of certain multithreaded random
access patterns, it makes a difference. Oops.
2022-05-31 09:52:16 -07:00
Larry Gritz 593bd319a7 UDIM speedups by eliminating mutex (#3417)
The udim_lookup_mutex_pool is not necessary. Just using an atomic
pointer for udiminfo.icfile is enough.

I'm seeing about a 5-8% overall speed improvement in testtex-based
intense udim benchmarks under heavy threading, a ~2% overall
improvement in a real rendered scene that uses a bunch of udim
textures (I think there are bigger bottlenecks elsewhere that I'll
move on to next, but every little bit helps).

Some testtex enhancements coming along for the ride:

* UDIM-oriented tests (automatically decuded if the test textures
  contain `<UDIM>` in their name.

* --maketests will construct random test textures and use them (handy
  if you need lots of textures for a big test, but don't want to store
  them). The tests are based on a file pattern using std::format-like
  replacement with an index. Also, if the pattern contains `<UDIM>` in
  the name, it's understood to be a udim pattern and many individual
  udim piece files will be created.

An example of these two items in action is:

```
testtex --maketests 200 "tmp/foo{:04}_<UDIM>.exr" --threadtimes 8 -iters 100000000 -runstats -v --handle -maxfiles 1000  -trials 5 -wedge
```
2022-05-25 19:51:38 -07:00
Larry Gritz 7ca693842f Adjust string formatters after change in fmt master (#3416)
fmt master seems to have just deprecated the ability for
fmt::sprintf("%s") to default to printing anything that allows stream
output. This breaks use of Strutil::sprintf formatting ustrings.

This isn't yet in any tagged release of fmtlib, but I'm trying to get
ahead of it.

The quick fix is to just change those handful of places to use
std::format style calls, which we are slowly converting to anyway.

Also throw in a fmt::formater for ustrings for good measure.
2022-05-22 09:24:18 -07:00
Larry Gritz 0dde711a71 Convert testshade to modern string formatting (#3415) 2022-05-21 23:34:56 -07:00
Larry Gritz 7fd5f527c8 CI: Fix ci upload of clang-format diffs (used wrong syntax) (#3414) 2022-05-21 20:33:54 -07:00
Larry Gritz 116a75dc6c Fix comment typos 2022-05-13 10:31:29 -07:00
Larry Gritz e726597fca Build: Do NOT auto-download test images by default (#3409)
It's a lot of data, you don't need it if you don't want to run the
full testsuite, and a lot of places and distros have policies against
live downloads happening in the build step. Also, downstream projects
that need to build OIIO for their CI or other reasons don't want to
accidentally download a lot of test data they won't need.

So change the default of OIIO_DOWNLOAD_MISSING_TESTDATA to OFF.

Build with -DOIIO_DOWNLOAD_MISSING_TESTDATA=ON to turn on auto
download of the data images, or else run
src/build-scripts/install_test_images.

Now, this does have the following danger: That people who build OIIO
and do want to run the tests -- and don't know to turn this option
back on -- will end up with very few tests able to run.

We largely address this by observing that quite a lot of our tests
that depended on oiio-images actually depended only on one file
(grid.tif, which is not especially large). So by making a copy of that
file in testsuite/common, quite a few additional tests can run even
without oiio-images.

Though, to be clear, there are still many tests that want oiio-images,
particularly tests that validate support for various image file
formats, which often depend on large collections of images that are
stored in oiio-images. So remember, if you are developing OIIO, the
best policy is to run the whole testsuite. But on the other hand, if
you submit a PR, they'll all be run in CI as well.
2022-05-12 00:08:53 -07:00
Larry Gritz 2c093e6c5e CI improvements -- don't overwrite cmake caches (#3408)
For failed CI builds, save the cmake caches in a safe place, don't zip
them up in situ, because then when I unpack them in my build area
locally, they overwrite my working cache.
2022-05-08 18:01:51 -07:00
Larry Gritz 866c7ba2ae CI: adjust to upgrading Intel Clang compiler to 2022.1.0 (#3407)
The Intel OneAPI LLVM-based C++ compiler, as we download it from Intel
for our CI, bumped from 2022.0.0 to 2022.1.0.

New warning popped up -- newest Intel LLVM-based compiler warns about
overriding certain floating point math flags.

Also had to adjust thresholds on a couple texture tests that have a
few pixels change slightly due to numerical differences.
2022-05-08 08:50:17 -07:00
Larry Gritz 3f58a8dc78 More changes to hide Imath: new half.h, improve vecparam.h (#3406)
Another round to hide Imath externally to OIIO public headers as well
as speed up our own builds.

* Remove the external reference to Imath::M44f from color.h, and instead
  use M44fParam.

* The `<OpenImageIO/Imath.h>` includes the most commonly used Imath
  headers including half.h. But this is unnecessarily expensive (and
  presumptuous about wanting other Imath types as well as fmt.h) if
  you just need to know about `half`.  So we create a new
  `<OpenImageIO/half.h>` that only includes what you need for `half`
  (as before, with logic to handle the changing location of the half.h
  header depending on whether you're using Imath 3.x or OpenEXR 2.x).

* Several files that included Imath.h, but in reality only needed half
  all along, change to including OpenImageIO/half.h.

* simd.h leans more on vecparam.h and other template trickery to
  reduce exposure of methods that only work in the presence of Imath
  headers, and make fewer use cases that would care whether the Imath
  headers are included before or after simd.h (which is less
  controllable for unity builds).

* Vec3Param gains a `cast<V>()` templated method that allows easy
  casting to foreign vector types even if Imath headers are not
  included prior to vecparam.h being included (which is less
  controllable for unity builds).
2022-05-07 09:32:34 -07:00
Larry Gritz 9c42b0b30e New bitcast is closer to std::bit_cast (#3403)
We have a template OIIO::bit_cast which has served us for a while, but
it turns out that C++20 has std::bit_cast which operates ALMOST the
same -- unfortunately, the tempalte arguments are reversed from the
way we did it!

So here we:

* Set up a new `bitcast<>` that works exactly like C++20 std::bit_cast.
* Implement our old bit_cast in terms of the new one, for now.
* Set up `#if` trick so that the confusing OIIO::bit_cast will be
  marked as deprecated beginning with OIIO 2.5, and will be removed
  entirely from OIIO 3.0. (Farther out than that, we may choose to
  re-introduce bit_cast as truly being identical semantics to
  std::bit_cast. But before that is possible, we need to completely
  ween downstream users off the old one.)
* Took the opportunity to expand the set of compilers for which
  certain bitcast overloads use Intel intrinsics. Previously, we only
  did this for the Intel compiler, but it seems to work for modern
  versions of clang and gcc as well. Do a little bitcast testing in
  fmath_test.cpp to verify that the use of these intrinsics doesn't
  break for any of the compilers we use for CI.
2022-05-03 21:30:27 -07:00
Larry Gritz be78eccbde CI: add clang14 test (#3404)
A couple very minor changes were necessary to address new warnings.
2022-05-01 00:12:33 -07:00
Larry Gritz 5852749bb7 CI tests use unity builds for speed (#3402)
Over the span of several individual PRs, we've made the code base safe
for "unity" (a.k.a. "jumbo") builds -- a feature of CMake that
automatically combines multiple .cpp files into a single compilation
unit (basically making temporary .cpp that `#include`s each original
cpp) in order to, allegedly, speed up compilation by not re-parsing
headers multiple times, and other sources of per-module overhead.

We discovered early on that on a modern computer where modules are
built in parallel (another automatic feature of CMake), jumbo builds
are simply not an overall performance improvement for OIIO. Basically,
the efficiency gain from removing redundant parsing is mostly offset
by the loss of parallel efficiency -- fewer and larger modules means
there are periods where all cores are not able to find work to
do. (Reductive example to illustrate the basic problem: If you have 8
independent modules to compile, and each takes 1 second, 8 cores can
compile the entire collection in parallel in 1 second. But a unity
build that batches those files in groups of 4 and achieves a 2x
speedup, thus compiling each set of 4 modules in 2 seconds instead of
4, only can do two of these compilations in parallel, so it takes 2
seconds. We've cut the total work in half, and yet it takes twice as
long in real time to complete, and 6/8 of your cores are idle.

OK, but that's when you have several cores. If you had only one core
(or maybe two) so you weren't using much parallelism in the first
place, then the unity build would look like a win, since you'd really
see the improvement from the amortized overhead of the combined
modules.

Most of us don't have single core machines on our desks, or laps, or
even in our pockets (or on our wrists?).

But we do have single core machines (or close to it) in our CI runners!
We get 1.5-2 cores, roughly, in the slice of VMs we get to run CI on
GitHub Actions. So maybe this is the one place where a unity build would
be of benefit.

That's the theory anyway. Does it pan out? I tested it, and the answer
is basically yes. I can speed up the "build" step of our CI by
somewhere in the vacinity of 30% (varies a LOT from run to run). I
tried a whole bunch of different approaches, summarized in the table
below. I picked the best basic strategies revealed by those tests and
set up the CI to use them. (I didn't preserve all the other
permutations.)

| Name                    | try 1 build | try 2                | try 3          | try 4    |
|:----------------------- | ----------- | -------------------- | -------------- | -------- |
| **linux gcc9 BASELINE** | 14:19       | 11:46                | 11:56          | 13:32    |
| linux gcc9 group        | 9:39        | 8:06                 | 9:58           | **7:58** |
| linux gcc9 batch 8      | 8:06        | **7:17**             | **8:02**       | **7:59** |
| linux gcc9 batch 16     | 8:29        | 7:32                 | **7:56**       | 9:35     |
| linux gcc9 batch 4      | 8:39        | 8:38                 | 8:52           | 10:31    |
| linux gcc9 batch 2      | 13:34       | 12:43                | 11:22          | 9:32     |
| linux gcc9 batch mix 4  | 7:22        | 9:14                 | 9:01           | 9:39     |
| linux gcc9 batch mix 2  | 9:11        | 7:45                 | 10:55          | 9:36     |
| **linux icx BASELINE**  |             | 14:39                | 15:07          | 15:06    |
| linux icx group         |             | 11:59                | **10:36**      | 10:26    |
| linux icx batch 8       |             | **9:40**             | 11:31          | **9:14**     |
| linux icx batch mix 4   |             | 10:06                | 11:58          | 11:16    |
| **macos11 BASELINE**    | 25:41       | 27:53                | 26:30          | 28:32    |
| macos11 group           | 10:56       | 20:24                | 19:28          | 19:24    |
| macos11 batch 8         | 16:43       | 17:38                | **18:34**      | **17:42**         |
| macos11 batch mix 4     |             | **9:22**             | 19:12          | 18:26         |
| **windows BASELINE**    | 20:17       | 23:27                | 28:43          | 19:13         |
| windows group           | 23:05       | 15:57 (tests broken) | 21:57 (broken) | 15:33         |
| windows batch 8         | 21:16       | 15:57                | **17:38**      | **15:08**         |
| windows batch mix 4     |             | **15:30**            | 23:19          | 15:16         |

Notes:

* Timings vary wildly from run to run. You never know which VMs you'll
  get or how overloaded they are. But over 3 trials, the trends were
  clear.
* I rigged it to clear the ccache, so these are FULL uncached builds.
* This is only "build" time. The CI run also includes time to set up the
  VM, download docker images, build or install dependencies, and of course
  run the testsuite. So the overall speedup of the entire CI run will not
  be as improved overall as these numbers indicate for the build step.
  But still, saving several minutes per job means the CI tests turn
  around faster, and that's what we want.
2022-04-29 12:00:36 -07:00
Larry Gritz 815463344d Eliminate use of boost::gcd (#3401)
For C++17 and beyond (and maybe earlier in some compilers), we already
used std::gcd. Now for C++14 compilers without std::gcd, we roll our
own simple gcd implementation instead of using boost::gcd. Maybe it's
slightly slower, but this is nowhere near a performance-critical
path. It's worth it to take one more step at eliminating boost.
2022-04-28 22:03:16 -07:00
Larry Gritz 50062fc121 Improvements in opening unknown files (#3400)
Reminder: When opening a file by name, first it tries to open assuming
that the file's extension indicates the format. If that doesn't work,
it tries all known format readers to see if one will work.

This patch includes several improvements to this process and surrounding
code in imageioplugin.cpp:

* When trying all formats because the extension was wrong, instead of
  traversing the input_formats map in alphabetical order of the list
  of all format names + extensions, try the three most common formats
  we encounter (openexr, tiff, jpeg) FIRST, then try the other formats
  in alphabetical order. We do this by traversing the
  format_list_vector, which contains all format names in the order
  they were declared, and ensure that those common formats are
  declared first. Basically, this means that if the mislabeled file is
  one of those most common formats, the correct reader is found after
  only a couple tries, instead of having to try a dozen or more bad
  guesses of rarely encountered formats.

* Debug mode messages that make it easier to understand which readers
  are being tried for which files.

* Comments clarify that input_formats and output_formats hold not just
  the map from format names to creators, but also map extensions to
  creators. (That confused me while I was debugging this, so I figure
  the clarification is needed.)

* Establish a new extension_to_format_map that lets you get the format
  name if you know the extension.

* Get rid of input_extensions and output_extensions maps, which weren't
  ever used.

* Some other minor refactoring.
2022-04-28 22:03:04 -07:00
Larry Gritz 0318ea44c1 More changes to support unity/jumbo builds (#3398)
* Make gif, png, targa, tiff unity-ready
* Make exr unity-ready
2022-04-25 21:34:07 -07:00
Larry Gritz abb41e5d05 Adjust debug templates -- they can have a simpler template trick (#3399) 2022-04-23 22:44:59 -07:00
splidje 5dce57435f py_imagespec: added get_bytes_attribute to bypass decoding as utf-8 (#3396)
py_imagespec: added get_bytes_attribute to bypass decoding as utf-8 and instead returning as a Python3 bytes object.

Fixes #3395
2022-04-22 18:43:21 -07:00
Larry Gritz d4074f0b31 ustring::from_hash() (#3397)
If you know the hash of a ustring, this tells you the ustring.
(Caveat: in the very unlikely chance of two ustrings having the same
hash, this will return the first one it finds in the table.)
2022-04-22 09:21:21 -07:00
Larry Gritz f1d619e915 More work to enable unity/jumbo builds (#3393)
* Make dpx and cineon unity-ready

* Make jpeg2000 and dds unity-ready
2022-04-21 21:22:36 -07:00
Larry Gritz 965cf04d7d oiiotool: attribute actions get subimage controls (#3384)
I realized that --attrib (and several related actions) only set the
attribute as directed for the first subimage if it's a multi-image
file (such as a multi-part exr), or all of them if the -a flag is
used.  But there was no ability to set it for a particular (non-first)
subimage, like many other oiiotool actions have the ability to do.

So in this patch, I refactor the following commands to use the
OiiotoolOp and related macros, which automatically make it responsive
to the `:subimages=` optional modifiers:

    --attrib
    --sattrib
    --eraseattrib
    --caption
    --orientation
    --clear-keywords
    --iscolorspace

As a bonus aside, one thing this lets you do is set a different
compression method per-subimage using, e.g.,
`--attrib compression:subimages=3 dwaa:100`.
But if you set compression with `--attrib compression`, do not also
use `--compression`, which will override it and also apply to all
subimages.
2022-04-21 12:36:18 -07:00
Larry Gritz 5767c62394 More unity-ready changes (#3392)
* Everything in texture system
* simd.h
* thread.cpp
* paramlist
2022-04-17 11:16:44 -07:00
Larry Gritz 596210427a OIIO_ERRORHANDLER_HIDE_PRINTF as aid for fmt conversion (#3391)
When this symbol is defined, this marks as deprecated the ErrorHandler
class methods that use sprintf formatting notation. It's not enabled
by default, but a downstream project can define the symbol in order to
help root out any uses of the old style formatting functions, to aid
identifying and changing those spots to the new style, long before
they are truly deprecated or removed from OIIO.

This change also sets up an OIIO_INTERNAL symbol that will be present
when OIIO itself is compiling, but not a downstream project using the
OIIO headers.
2022-04-15 17:01:49 -07:00
Larry Gritz a330bae6a7 Make oiiotool unity-ready (#3389)
This is the first tiny step to fixing all the little things that break
in a unity build. This one is pretty small fry -- the oiiotool set of
modules only needed some minor rearrangement of header file include
order.
2022-04-15 17:01:03 -07:00
Nathan Rusch fdafe1c3dc ImageBufAlgo: Initial implementation of st_warp transform function (#3379)
* Initial implementation of `ImageBufAlgo::st_warp`

* Simplify default filter logic, and share it with `ImageBufAlgo::warp`

* Add st_warp to oiiotool

* Add tests for bespoke `st_warp` validations that are done before IBAprep

* Add st_warp test to oiiotool-xform testsuite

* Address review notes

- Remove ST buffer datatype guard
- Simplify additional ROI prep
- Remove unnecessary buffer reallocation

* Use sample accumulator type for source/dest iterator USERT

* Add `--st_warp` section to `oiiotool.rst`
2022-04-15 16:15:54 -07:00
Larry Gritz 092b6af752 Fix botched build from PR 3381, command line utils not installed (#3390)
Cut/paste error inadvertently deleted a critical cmake line that I
wasn't intending to alter or remove, that resulted in the command line
utilities not being tagged for part of the install step. Oops!
2022-04-14 10:22:57 -07:00
Larry Gritz 7fc5199231 CHANGES and set developer snapshot 2.4.1.1 2022-04-13 10:48:22 -07:00
Larry Gritz 7956ca328f Speed up case insensitive string comparisons (#3388)
Oh boy, never leave anything unbenchmarked.

Turns out the boost::algorithm functions we were relying on underneath
many Strutil "case-insensitive" comparisons were ridiculously slow.
We thought they were good enough because they allowed specification of
locale, so we could just pass the static classic locale, and so they
would be inexpensive because they didn't have to query the current
locale.  But this is wrong, they were still ghastly.

So here I rewrite Strutil::iequals, iless, starts_with, istarts_with,
ends_with, iends_with in terms of a new (internal) Strutil::strcasecmp
and strncasecmp (which underneath handle differences in platform, and
use the locale-independent versions). The net result is that most of
those case-independent comparisons speed up by a factor of
50-100x. Wow.

I still need to tackle the family of 'ifind' related functions. They
are a bit trickier. But I'll leave them for another time, because I
need to roll this present fix out right away to fix a real production
bottleneck.

(Worth noting: iequals is instrumental when you're searching a
ParamValueList for a particular name, which is what happens when you
look up attributes from an ImageSpec, which is what happens when you
call get_texture_info(), which is what underlies OSL gettextureinfo()
calls in the cases that they cannot be constant-folded during runtime
optimization. So this came to my attention when analyzing a slow scene
whose shaders had a pathological explosion of gettextureinfo calls that
couldn't be optimized away.)
2022-04-13 10:31:02 -07:00
Larry Gritz 47eac0dfa7 Speed up IBA::isConstantColor (#3383)
Reminder: isConstantColor() finds out if an ImageBuf is constant
color.  It uses the thread pool to check several areas in
parallel. Once any task finds that its subregion is not constant, it
sets a flag so that as other subregions are pulled off the task queue,
they will take an early out if one of their siblings already knows the
image is not constant.

Turns out this isn't much of a big savings in practice, because lots
of regions may be in flight by the time one region realizes it's
non-constant, and once a region task starts, it doesn't check the flag
again.

This patch speeds up isConstantColor by a pretty big factor for
non-constant images (it can't really help for images that ARE
constant) in the following ways:

1. Before doing anything, it checks to see if the FIRST TWO pixels of
   the image are unequal. If that's the case -- and it's a fairly
   common case for non-constant images -- then it immediately knows
   the whole image is not a constant and doesn't need to look at
   anything else or launch any of the threads at all. (If it is a
   constant image, or if the first two pixels are just coincidentally
   identical, this quick check of only two pixels didn't really cost
   us any masurable time.)

2. In addition to checking the result flag at the start of each
   parallel job, now we also check if the flag has been changed as we
   iterate to each pixel. So pretty much as soon as one thread finds
   unequal pixels, the other threads can spot this and stop their
   tasks early, no need to finish looking at their entire region.  (To
   make the more frequent checks of the flag inexpensive, I changed it
   from an atomic to just a regular bool. It doesn't need to be
   atomic, because the strict ordering is not important at all here
   and it doesn't change the result if the threads' access to the flag
   is unsynchronized.)
2022-04-13 08:50:45 -07:00
Larry Gritz a5d723be8a exr output: Fix dwaa compression default (#3387)
When outputting OpenEXR files, in a case where the "compression"
request was for "dwaa" (no compression specified in the main name,
like "dwaa:100") we accidentally forced a default quality level of 4,
which is the default we wanted for zip compression. But that's not a
good default for dwaa!
2022-04-13 08:50:06 -07:00
Larry Gritz 4e985f6347 Lay groundwork for unity builds (#3381)
As I learned recently, a "unity" (aka "jumbo") build is where multiple
.cpp files are combined into one translation unit -- imagine a unity.cpp
that simply has

    #include "file1.cpp"
    #include "file2.cpp"
    ...
    #include "fileN.cpp"

and so you compile unity.cpp instead of the separate file?.cpp files
individually.

Turns out that CMake understands this concept and can do it for you
automatically!

The benefit of a unity build is that file1...fileN probably include
most of the same headers, expand the same templates, etc., so a bunch
of the per-file work of the compiler can be done once rather than
redundantly for each file.

There are two potential downsides, however:

1. It may not be safe to concatenate your cpp files! For example, if
   both file1.cpp and file2.cpp each contain a `static int foo;`, that
   may have been safe when compiled separately, but is not allowed to
   happen twice in one compilation unit. Similarly, if you have headers
   that don't have proper guards against multiple includes, etc. So one
   should expect a whole lot of little fix-ups are needed for this to
   work properly. (We'll come back to that topic.)

2. Combining source file into these "jumbo" modules can make heavily
   parallelized builds on many-core machine not be able to load balance
   or keep all the cores busy. (Simplified examples: if you have 16 .cpp
   files on a 16 core machine, each core can compile one cpp file in
   parallel with the others. But if you mash the modules into just one
   huge cpp file, give that to one core, and your other 15 cores are
   idle, so the full build probably takes much longer.)

I tried this out, including the many fixups implied by (1) above, and
at first the unity builds were slower on both my laptop (8 cores) and
workstation at work (32 cores), because of downside (2) explained
earlier -- harder to take advantage of parallel builds when there are
fewer, bigger, compilation units. Some tweaking of strategy got me to
the point where I could always get the unity builds to go faster, but
not by a whole lot when many core were available. Slighty faster, but
not worth the trouble. A bit disappointing, nearly abandoned the whole
idea.

HOWEVER, in situation where you are limited to very few cores (like in our
CI, which allocates 2 cores, and it sure seems more like 1-1.5 for the
Windows and Mac CI runners), the unity builds are substantially faster --
there's already not much parallelism to exploit, so you come out ahead
with the savings of that redundant per-file work we talked about.

So my current thinking is to go ahead and make the changes that allow
unity builds. I don't particularly recommend them when highly parallel
builds are available to you, but it might help to cut our CI
turnaround time down on the GitHub runners. And maybe it will help in
other situations for other people.

Ok, then. The present patch introduces these concepts and makes the
CMake and other build system changes to allow unity builds. (N.B. It
won't WORK yet, so don't try it!) After we get that out of the way, in
subsequent PRs I'll show all the changs to the code that were
necessary to fix all the little things that went wrong when source
files got combined.
2022-04-11 22:11:59 -07:00
Larry Gritz 8c8e119d3a CI: Bump 'latest release' versions of openexr and pybind11 (#3386) 2022-04-11 21:37:46 -07:00
Larry Gritz 304e4cee5b Fix formatting 2022-04-08 22:51:28 -07:00
Christopher KullaandLarry Gritz 727be5ad8f Fix a number of small warnings on windows (#3382)
* Fix warning from duplicate define
* Fix warnings about bool/int expressions
* Fix discarded result warning in PSD input
* Fix codepage warning from unicode symbol in string constant
* Ensure the term object is initialized with the stream we intend to output to
* Fix pointer casts in paramlist test

Signed-off-by: Chris Kulla <ckulla@gmail.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
2022-04-08 18:25:50 -07:00
Larry Gritz a4f422ccec CHANGES 2022-04-01 16:36:09 -07:00
Larry Gritz 7c660429a8 More format conversion (#3377)
Bit by bit, we convert all our formatted string from the sprintf
convention to the std::format convention.
2022-03-31 12:28:04 -07:00
Larry Gritz e3cc8e041c Python: support uint8 attributes in and out (#3378)
This is necessary for dealing correctly with ICCProfile ImageSpec
attributes, which are simply arrays of uint8's.
2022-03-31 12:24:52 -07:00
Larry Gritz 2dc807b4b5 Suppress MacOS warnings about OpenGL deprecation (#3380) 2022-03-31 12:24:29 -07:00
Larry Gritz 35b220ca02 ffmpeg reader: take care against possible double free (#3376)
In FFMpegInput::close(), some of the tear-down calls would happen
regardless of if their pointers were already null. Seemed safe, but
maybe not always? So check the pointers.

Fixes #3371
2022-03-27 09:37:22 -07:00
Larry Gritz 921fab6423 BMP files - read additional varieties (#3375)
There are two undocumented varieties of BMP files only written by
certain Adobe apps that we did not properly handle, identified by the
size value in their header.

This is the only explanation I could find about it:
https://web.archive.org/web/20150127132443/https://forums.adobe.com/message/3272950
2022-03-27 09:37:00 -07:00
Larry Gritz 429d4ac7a1 Convert texture and ImageCache stats output from stream io to fmt. (#3374) 2022-03-26 15:42:06 -07:00
Larry Gritz 98b434a819 Make ImageCache stats print openexr:core option status (#3373) 2022-03-25 19:11:25 -07:00
Larry Gritz ece2fd4f18 Fix conflict between RESTful and Windows long path notation (#3372)
When trying to break filenames into the base name and any "RESTful"
arguments (such as "/foo/bar.exr?name=value&dog=cat"), we were
just looking for presence of the "?" to determine if it was a RESTful
thingie and using that as the split position.

But this is thrown off by an odd Windows notation where names that
start with (get this) "\\?\" somehow designate long filepaths. See
See: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

So the solution is to change Strutil::get_rest_arguments to explicitly
check for this pattern at the start of the string.
2022-03-25 14:57:36 -07:00
Larry Gritz 85e3913bb1 Fix writing deep exrs when buffer datatype doesn't match the file (#3369)
In OpenEXROutput::write_deep_scanlines and write_deep_tiles, don't
just pass the DeepData along -- handle the case of where the DD (the
buffer the caller is presenting) does not match the data types that
you said the file is going to hold. In this case, we need to make a
local temporary DD that holds a copy of the passed-in data, but with
the formats transcoded.

Some changes to DeepData were done to support this.
2022-03-24 22:33:48 -07:00
Larry Gritz 608e593f60 CI: Remove the windows-2016 that will be imminently removed (#3370)
GHA is retiring the windows-2016 image, we won't be able to use it soon.

Also bump openexr versions in a couple places.

There's some in-progress work on a VS2022 test, but ignore that for now,
it's commnted out.
2022-03-21 10:05:06 -07:00
Larry Gritz 9497022cda Custom fmt formatters for vector types (#3367)
I'm a total convert to fmt (and/or std::format, std::print) and slowly
converting all prior use of sprintf and iostream to it.

If I print an Imath::V3f or a simd::vfloat3,

    fmt::print ("v = {} {} {}\n", myvec[0], myvec[1], myvec[2]);

That's ok, I guess, but it's clunky and a big pain to put the format
specification for every element separately if it were a vfloat16,
say. I would like to be able to do this:

    fmt::print ("v = {}\n", myvec);

and in fact, it does print all elements (thanks to some nice behavior
by fmt)!  But this does not work as expected:

    fmt::print ("v = {:.3f}\n", myvec);

fmt's tricks will print all elements, but only using the default format
spec, and the spec above applied so the "whole thing", not each element,
if you see the distinction.

So this patch sets up the custom formatter infrastructure to be able
to print array-like things (and in particular, the Imath and
OIIO::simd vector and matrix classes) by specifying the format spec
used for the elements.

The important elements to note:

* detail/fmt.h adds custom formatter helpers for (a) any class with
  operator[] and size() ("index_formatter"); (b) any class that lacks
  these but nonetheless has an array-like memory layout and a known
  length ("array_formatter"). I also added a nonstandard extension to
  the format spec for these, which optionally lets you use a comma
  separator rather than just the space between elements.

* These building blocks are used to specify custom formatters for
  the commonly-used Imath types (in our Imath.h) and our internal
  SIMD vector types (in simd.h).

* simd.h also adds a few other goodies, including an `is_simd<>`
  template, and `size()` constexpr methods to each vector type. These
  make certain template metaprogramming tasks easier for these types.

* A new "type_traits.h" header for collecting a bunch of little utility
  templates, such as `has_subscript<>` and `has_size_method<>`.
2022-03-19 18:21:36 -07:00
Larry Gritz f846cb531a simd.h fixes for armv7 and aarch32 (#3361)
Some neon instructions are only aarch64, guard them better.

Fixes #3360
2022-03-19 18:14:34 -07:00
Larry Gritz 288d0ad096 Print all 4 version numbers in help messages (#3368) 2022-03-18 09:55:35 -07:00
Larry Gritz 313202fe5d JPEG: better handling of PixelAspectRatio (#3366)
JPEG expresses pixel aspect ratio implicitly as header fields
"xdensity" and "ydensity" (which we call "XResolution" and
"YResolution" in our metadata after the TIFF names). We also have
"PixelAspectRatio", so the three of them, if they are all used, form
an over-constrained system. Plus, they may come both in the JPEG
header and also (not necessarily having the same values) in any Exif
block.

And on top of that, the way Nuke and PhotoShop infer the aspect ratio
is BACKWARDS! (If pixelaspect = width/height of a displayed pixel,
then it's also = ydensity/xdensity. But Nuke is the other way
around. Only for JPEG, it gets it right for TIFF and OpenEXR.)

Anyhoo, there were some edge cases in which we were still getting
confused (specifically, that we were making some files that Nuke was
not properly recognizing as anamorphic). This patch tightens up
these cases.
2022-03-18 09:55:11 -07:00
Larry Gritz 7b09f5d4db Fix typo -- used old name for header guard 2022-03-15 14:19:27 -07:00
Larry Gritz 99aae072e7 V3fParam (#3330)
Create a small shim class template called
Vec3Param (and its specialization, V3fParam) that does nothing but
implicitly convert from and to things that looks like 3-vectors
(thanks to some template magic I developed a while back for the Imath
project). And similar for template MatrixParam (and specializations
M33fParam and M44fParam) to pass a square matrix.

Basically the idea is that we can replace the public API function
parameters where we take an Imath::V3f and instead use a
V3fParam. User code that passes an Imath::V3f still works because
V3fParam accepts and converts it.  Implementation code can implicitly
convert the V3fParam to an Imath::V3f, so it doesn't need to be
changed, either. Only the function declaration itself. (Same basic
situation for MatrixParam and Imath::M33f/M44f.)

So in the process, now we have laundered our public API so that it
doesn't reference the Imath types and headers any longer. This confers
two big advantages:

1. It allows OIIO itself and any downstream client code calling OIIO
   to use *different* versions of Imath if they want.

2. It allows client code to not need Imath at all, for example if they
   have their own proprietary vector type that they prefer to use
   internally.

I'm not necessarily 100% sold on this approach, but I think it's got
promise and am seeking feedback. It seems to work, and I was able
to compile OSL against this altered OIIO with *no changes*.
2022-03-13 21:34:39 -07:00
Larry Gritz 2340b90160 Minor tweaks to CI workflow (#3365)
Just some renames and minor refactoring as I settle into the "strategy"
style.
2022-03-07 20:46:03 -08:00
Larry Gritz e82063d163 ffmpeg: make supported file extension check be case-insensitive (#3364)
The use of ends_with instead of iends_with made it so that
capitizalized files (especially on case-independent filesystems like
Windows or some Mac filesystems) were rejected.

(And yes, I did grep the whole code base for ends_with to be sure that
this was the only place we made this mistake.)

Fixes #3362
2022-03-07 20:45:38 -08:00
Larry Gritz 134ea8cc44 Bump master version to reflect ABI changes with the recent string_view 2022-03-07 10:45:18 -08:00
Larry Gritz 41b2a31b7a Build and CI and support for the icx compiler (#3363)
icx is the *new* Intel LLVM-based compiler, and it behaves a lot like
clang (versus icc, which is the "classic" Intel compiler).

* An additional CI test in ci.yml for icx.

* Tweaks in compiler.cmake and platform.h to detect and set options for
  this compiler.

* A variety of warning fixes encountered for this compiler.

* Add a new cmake build-time option `ENABLE_FAST_MATH` (default: OFF)
  for enabling fast-math optimizations that trade IEEE compliance for
  speed. The Intel compiler enables it by default (!), so this build
  option makes icx behave like the other compilers (not fast math
  unless explicitly asked for), which makes the CI tests and other
  behavior more consisent across compilers and platforms.

* Note: The bug that prevents some versions of fmtlib from working
  with icc does not appear to be a problem for icx.
2022-03-07 10:33:53 -08:00
Larry Gritz fcdbd6cd4c Switch to using std::this_thread::yield() now that we are C++11 (#3359)
Fixes 3357, which reported problems with Clang + libc++ + Windows,
where our old code used something pthreads-specific.
2022-03-07 00:50:38 -08:00
Larry Gritz d3648ab272 Fully templatize our string_view (#3344)
Brings us more in line with C++17 std::string_view.
2022-03-07 00:50:16 -08:00
Larry Gritz 461c9c058f CI: Use GHA "strategy" to make test descriptions more compact (#3356)
I finally learned how the "strategy" stuff works and refactored our
CI workflow based on it.

In short, we previously treated each CI test as its own universe, with
a huge amount of repeated build logic. These changes cut down on
redundancy by, for each set of related tests, collapsing them into
just one recitation of the build script logic and a handful of
variables that create the different test variations.

Currently, the categories are (a) all tests based on ASWF containers and
corresponding to VFX Platform specs, (b) "off-year" combinations based
on the native Ubuntu installations, (c) Mac tests, (d) Windows tests,
(e) the clang-format checker.

This refactor cuts the size of the ci.yml file by more than 50%, and
makes it much easier to add or change individual test configurations
in the future.
2022-03-04 20:57:20 -08:00
Larry Gritz 20645f83a8 Strutil::print vs sync::print (#3348)
Strutil::print wraps fmt::format to render the formatted output into a
std::string, then sends the string to Strutil::sync_output(), which
ensures that every string printed (or sent to a FILE or stream) is
done so atomically, using an internal mutex, and with a stream flush
after each string. But this makes it a lot more expensive than it
needs to be, when you don't need such care -- either because buffered
output is ok, or because you don't need the thread safety.

This patch:

* Adds an optional `flush` parameter to sync_output(), defaulting to
  true, which controls whether sync_output flushes or not.

* Introduces Strutil::sync::print, which is the same fully
  synchronous, thread-safe, non-buffering behavior that Strutil::print
  has traditionally had. Use this when you need those features.

* Redefines Strutil::print to be an alias for fmt::print, which means

  - There is one fewer layer of template expansion and generated code,
    and possibly fewer internal string copies, so that should make for
    both faster compilation and faster runtime performance.
  - Results are buffered, no sync after every output, so much faster
    when you don't need that.
  - No internal mutex.

On the platforms we use -- and with the current implementation of
fmtlib -- fmtlib's underlying use of stream and FILE output appears to
be adequately thread-safe. But we can't 100% guarantee this on all
platforms or all future versions of fmtlib, so users who need the
stronger guarantees (and are willing to sacrifice performance) can
simply use sync::print.
2022-03-04 10:03:49 -08:00
Anthony Nemoff 9f74aa2108 Add UDIM pattern <uvtile> (in lower-case) (#3358)
* Add UDIM pattern `<uvtile>` (in lower-case)

This UDIM pattern is equivalent to `u<u>_v<v>`.
See also #3280.

References:
- Clarisse: https://clarissewiki.com/5.0/image-maps-texture.html
- V-Ray: https://docs.chaos.com/display/VMAYA/File+Names+for+Bitmap+Textures

* LG Updated test and ref output
2022-03-02 15:52:29 -08:00
Larry Gritz 16e2bad47d CI: first stab at CI builds for Intel compiler (#3355)
* New CI test downloads the Intel icc compiler and builds with it.
* A variety of minor fixes to address warnings from icc that were
  not apparent from the other compilers.
* Some minor changes to just a few tests and reference output where
  the icc-built compiler produces slightly different (usually LSB)
  results.
2022-02-28 12:35:59 -08:00
Larry Gritz 2669a7d939 Some denorm and flush utilities no longer need to consider gcc 4.8 (#3354) 2022-02-27 20:53:07 -08:00
Larry Gritz 90323d8130 Fix inline discrepancies between template decl and redecl (#3350)
These are cases where we declared a template, then later gave its full
definition, and we marked the declaration of the OIIO_FORCEINLINE but
omitted it from the later definition.

This addresses some compiler warnings from icc.
2022-02-27 19:21:55 -08:00
Larry Gritz 7171b07dd4 Beef up precision in computePixelStats (#3353)
We should have been doing this particular multiplication as doubles, and
in just a couple spots, it slightly changes the answer.
2022-02-27 09:19:00 -08:00
Larry Gritz 1f1510fca8 runtest.py: Rename oiio_relpath to make_relpath (#3349)
Just reconciling some differences between this file and the analogous
one in OSL.
2022-02-27 09:17:59 -08:00
Larry Gritz 829d337264 Build: allow -Werror to be disabled even on CI branches (#3351)
Slight reworking of -Werror logic to let the default behavior be
changed by setting a cmake variable. In particular, this allows us to
make a CI build disable -Werror when we need to.

Previously, having the "OpenmageIO_CI" env variable set trumped all
else and forced -Werror. Now it just contributes to the default behavior,
but setting `-DSTOP_ON_WARNING=OFF` and cmake config time can still
disable it.
2022-02-26 23:44:38 -08:00
Larry Gritz d0302f6333 Avoid internal use of OIIO::string_view::str() (#3345)
Seemed like a good idea when we wrote it, but subsequently,
std::string_view was accepted into C++17 without a str() method. So
for the sake of future full interchangeability with std::string_view,
stop using this method.  We will eventually deprecate it.
2022-02-26 23:43:31 -08:00
Larry Gritz 7b8f4b9b7e Fix broken iinfo --stats (#3352)
Inadvertently broken by PR 3328.
2022-02-26 23:37:09 -08:00
Larry Gritz d15fd4aa06 Improvements to ParamList and ImageSpec to reduce ustring construction (#3342)
Special case some methods of ParamValue, ParamList, and
ImageSpec::attribute for ustring and string_view data, to reduce some
redundant copies and/or ustring conversions.

The internal method init_noclear() is augmented with a flag that allows
the caller to specify that any string data it might point to is already
ustrings, and thus does avoid the costly default behavior of converting
strings in the data block to ustrings. (This is not publicly exposed, so
users can't screw it up.)

So the new ParamValue constructor directly from a ustring can use this
flag to avoid passing the already-ustring through the string-to-ustring
conversion a needless second time. But also, the copy constructor, move
constructor, and assignment can use the flag and avoid the extra
conversion, since by definition they are copying from the contents of an
existing ParamValue which is guaranteed to be already ustring-ified.

While I was at it, I turned the optional arguments of ParamValue
constructors into "strongly typed" flags, deprecating the ones that
take a raw bool, which might be confusing.
2022-02-21 21:20:14 -08:00
Larry Gritz f6fb1eb81a Wean ourselves off of string_view::c_str() (#3343)
c_str() was cute, but it's a little dicey and it's not present in
the C++20 std::string_view. We didn't use it in a ton of places,
so replace with other idioms so that in the future we are better
able to interchange with std::string_view or replace our own entirely
once we have flying cars and C++20 minimum.
2022-02-20 16:19:19 -08:00
Larry Gritz 8c714804a9 Auto conversion from among different string_view types (#3337)
* Allow ustring and OIIO::string_view to auto-cast to fmt::string_view
  (helps some fmt formattting of types without custom formatters).

* When std::string_view (C++17) and/or std::experimental::string_view
  (some compilers pre-C++17) are available, add OIIO::string_view
  auto-construction from and auto-casting to those types.
2022-02-19 14:39:37 -08:00
Larry Gritz 7ee7477c4f Mark a bunch of long-deprecated things as OIIO_DEPRECATED (#3328)
...and stop using them internally as well.

For some of the IBA functions, we were unable to fully mark them as
OIIO_DEPRECATED (so instead that hint is commented out) because the
function signatures of the deprecated and new ones can be
ambiguous. We're just going to have to delete those when we are at a
compatibility break point, without going through a period where they
are present but marked as deprecated.
2022-02-19 10:11:25 -08:00
Larry Gritz 4260a7cc81 Track down some integer overflow warnings (#3329) 2022-02-19 09:31:11 -08:00
833 changed files with 34314 additions and 19451 deletions
+2 -2
View File
@@ -7,10 +7,10 @@ assignees: ''
---
**PLEASE DO NOT REPORT BUILD TROUBLES AS ISSUES**
**PLEASE DO NOT REPORT BUILD TROUBLES AS GITHUB "ISSUES" UNLESS YOU ARE RALLY SURE IT'S A BUG**
The best way to get help with your build problems is to ask a question on the
[oiio-dev developer mail list](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org).
[oiio-dev developer mail list](https://lists.aswf.io/g/oiio-dev).
When you email about this, please attach one or both of the following:
1. The full verbose build log, which you can create like this:
+1 -1
View File
@@ -19,7 +19,7 @@ But if you are just asking a question:
* I can't build OpenImageIO
For anything of this nature, the best way to get help using OpenImageIO is
to ask a question on the [oiio-dev developer mail list](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org).
to ask a question on the [oiio-dev developer mail list](https://lists.aswf.io/g/oiio-dev).
The [documentation](https://openimageio.readthedocs.org)
is pretty comprehensive, so please check there first; you may find the answer
+13 -8
View File
@@ -1,3 +1,8 @@
<!-- This is just a guideline and set of reminders about what constitutes -->
<!-- a good PR. Feel free to delete all this matter and replace it with -->
<!-- your own detailed message about the PR, assuming you hit all the -->
<!-- important points made below. -->
## Description
@@ -14,14 +19,14 @@
<!-- Put an 'x' in the boxes as you complete the checklist items -->
- [ ] I have read the [contribution guidelines](../CONTRIBUTING.md).
- [ ] If this is more extensive than a small change to existing code, I
have previously submitted a Contributor License Agreement
([individual](../src/doc/CLA-INDIVIDUAL), and if there is any way my
employers might think my programming belongs to them, then also
[corporate](../src/doc/CLA-CORPORATE)).
- [ ] I have read the [contribution guidelines](https://github.com/OpenImageIO/oiio/blob/master/CONTRIBUTING.md).
- [ ] I have updated the documentation, if applicable.
- [ ] I have ensured that the change is tested somewhere in the testsuite
(adding new test cases if necessary).
- [ ] My code follows the prevailing code style of this project.
- [ ] If I added or modified a C++ API call, I have also amended the
corresponding Python bindings (and if altering ImageBufAlgo functions, also
exposed the new functionality as oiiotool options).
- [ ] My code follows the prevailing code style of this project. If I haven't
already run clang-format before submitting, I definitely will look at the CI
test that runs clang-format and fix anything that it highlights as being
nonconforming.
+134
View File
@@ -0,0 +1,134 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
name: Analysis
on:
schedule:
# Run nightly while we're still working our way through the warnings
- cron: "0 8 * * *"
# Run unconditionally once weekly
# - cron: "0 0 * * 0"
push:
# Run on pushes only to master or if the branch name contains "analysis"
branches:
- master
- '*analysis*'
- '*sonar*'
# Allow manual kicking off of the workflow from github.com
workflow_dispatch:
# Uncomment the following line if we want to run analysis on all PRs:
# pull_request:
permissions: read-all
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
aswf:
name: "SonarCloud Analysis"
# Exclude runs on forks, since only the main org has the SonarCloud
# account credentials.
if: github.repository == 'OpenImageIO/oiio'
strategy:
fail-fast: false
matrix:
include:
- desc: sonar gcc9/C++14 py39 boost1.76 exr3.1 ocio2.1
nametag: static-analysis-sonar
os: ubuntu-latest
vfxyear: 2022
vfxsuffix: -clang11
cxx_std: 14
python_ver: 3.9
simd: "avx2,f16c"
fmt_ver: 8.1.1
pybind11_ver: v2.9.0
coverage: 1
# skip_tests: 1
sonar: 1
setenvs: export SONAR_SCANNER_VERSION=4.7.0.2747
SONAR_SERVER_URL="https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR=bw_output
OIIO_CMAKE_BUILD_WRAPPER="build-wrapper-linux-x86-64 --out-dir bw_output"
CMAKE_BUILD_TYPE=Debug
CMAKE_UNITY_BUILD=OFF
CODECOV=1
CTEST_TEST_TIMEOUT=1200
OIIO_CMAKE_FLAGS="-DOIIO_TEX_IMPLEMENT_VARYINGREF=OFF"
runs-on: ${{ matrix.os }}
container:
image: aswf/ci-osl:${{matrix.vfxyear}}${{matrix.vfxsuffix}}
env:
CXX: ${{matrix.cxx_compiler}}
CC: ${{matrix.cc_compiler}}
CMAKE_CXX_STANDARD: ${{matrix.cxx_std}}
USE_SIMD: ${{matrix.simd}}
FMT_VERSION: ${{matrix.fmt_ver}}
OPENEXR_VERSION: ${{matrix.openexr_ver}}
PYBIND11_VERSION: ${{matrix.pybind11_ver}}
PYTHON_VERSION: ${{matrix.python_ver}}
# DEBUG_CI: 1
steps:
# We would like to use harden-runner, but it flags too many false
# positives, every time we download a dependency. We should use it only
# on CI runs where we are producing artifacts that users might rely on.
# - name: Harden Runner
# uses: step-security/harden-runner@248ae51c2e8cc9622ecf50685c8bf7150c6e8813 # v1.4.3
# with:
# egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
with:
fetch-depth: '0'
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
with:
path: /tmp/ccache
key: ${{github.job}}-${{matrix.nametag}}-${{steps.ccache_cache_keys.outputs.date}}
restore-keys: ${{github.job}}-
- name: Build setup
run: |
${{matrix.setenvs}}
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
${{matrix.depcmds}}
src/build-scripts/gh-installdeps.bash
- name: Build
run: src/build-scripts/ci-build.bash
- name: Testsuite
if: matrix.skip_tests != '1'
run: src/build-scripts/ci-test.bash
- name: Code coverage
if: matrix.coverage == '1'
run: src/build-scripts/ci-coverage.bash
- name: Sonar-scanner
if: matrix.sonar == 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="build/bw_output" --define sonar.cfamily.gcov.reportsPath="_coverage"
# - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
# if: failure()
# with:
# name: oiio-${{github.job}}-${{matrix.nametag}}
# path: |
# build/cmake-save
# build/testsuite/*/*.*
# !build/testsuite/oiio-images
# !build/testsuite/openexr-images
# !build/testsuite/fits-images
# !build/testsuite/j2kp4files_v1_5
+407 -801
View File
File diff suppressed because it is too large Load Diff
+73
View File
@@ -0,0 +1,73 @@
name: Scorecards supply-chain security
on:
# Only the default branch is supported.
branch_protection_rule:
push:
# Run on pushes to master, but only the main repo, not forks
branches: [ "master" ]
if: github.event.pull_request.head.repo.full_name == github.repository
pull_request:
# Only run on individual PRs if the workflow file itself is changed.
paths:
- .github/workflows/scorecard.yml
# Declare default permissions as read only.
permissions: read-all
# Allow subsequent pushes to the same PR or REF to cancel any previous jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
analysis:
name: Scorecards analysis
if: github.repository == 'OpenImageIO/oiio'
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Used to receive a badge. (Upcoming feature)
id-token: write
# Needs for private repositories.
contents: read
actions: read
steps:
- name: "Checkout code"
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3.0.0
with:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@3e15ea8318eee9b333819ec77a36aca8d39df13e # v1.1.1
with:
results_file: results.sarif
results_format: sarif
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecards on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
# repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
# Publish the results for public repositories to enable scorecard badges. For more details, see
# https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories, `publish_results` will automatically be set to `false`, regardless
# of the value entered here.
publish_results: true
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # v1.0.26
with:
sarif_file: results.sarif
+1
View File
@@ -10,6 +10,7 @@ ext/
.project
.DS_Store
*.pyc
_coverage/
# Exclude test files I tend to leave around at the top level. The leading
# slash ensures that files with these extensions within subdirectories are not
+1
View File
@@ -0,0 +1 @@
Claire Foster <aka.c42f@gmail.com> <chris42f@gmail.com>
+149
View File
@@ -0,0 +1,149 @@
Project Name: OpenImageIO
Project Entity: OpenImageIO Project a Series of LF Projects, LLC
If emailing signed PDF, send to: manager@lfprojects.org
**Software Grant and Corporate Contributor License Agreement ("Agreement") v2.1**
Thank you for your interest in the project specified above (the “Project”). In
order to clarify the intellectual property license granted with Contributions
from any person or entity, the Project must have a Contributor License Agreement
(CLA) on file that has been signed by each Contributor, indicating agreement to
the license terms below. This license is for your protection as a Contributor as
well as the protection of the Project and its users; it does not change your
rights to use your own Contributions for any other purpose.
This version of the Agreement allows an entity (the “Corporation”) to submit
Contributions to the Project, to authorize Contributions submitted by its
designated employees to the Project, and to grant copyright and patent licenses
thereto.
If you have not already done so, please complete and sign this Agreement using
the electronic signature portal made available to you by the Project or its
third-party service providers, or email a PDF of the signed agreement to the
email address specified above. Please read this document carefully before
signing and keep a copy for your records.
You accept and agree to the following terms and conditions for Your present and
future Contributions submitted to the Project. In return, the Project shall not
use Your Contributions in a way that is contrary to the public benefit or
inconsistent with its charter at the time of the Contribution. Except for the
license granted herein to the Project and recipients of software distributed by
the Project, You reserve all right, title, and interest in and to Your
Contributions.
1. Definitions.
“You” (or “Your”) shall mean the copyright owner or legal entity authorized by
the copyright owner that is making this Agreement with the Project. For legal
entities, the entity making a Contribution and all other entities that
control, are controlled by, or are under common control with that entity are
considered to be a single Contributor. For the purposes of this definition,
“control” means (i) the power, direct or indirect, to cause the direction or
management of such entity, whether by contract or otherwise, or (ii) ownership
of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
ownership of such entity.
“Contribution” shall mean the code, documentation or other original works of
authorship, including any modifications or additions to an existing work, that
is intentionally submitted by You to the Project for inclusion in, or
documentation of, any of the products owned or managed by the Project (the
“Work”). For the purposes of this definition, “submitted” means any form
of electronic, verbal, or written communication sent to the Project or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that
are managed by, or on behalf of, the Project for the purpose of discussing and
improving the Work, but excluding communication that is conspicuously marked
or otherwise designated in writing by You as “Not a Contribution.”
2. Grant of Copyright License. Subject to the terms and conditions of this
Agreement, You hereby grant to the Project and to recipients of software
distributed by the Project a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable copyright license to reproduce, prepare
derivative works of, publicly display, publicly perform, sublicense,
and distribute Your Contributions and such derivative works.
3. Grant of Patent License. Subject to the terms and conditions of this
Agreement, You hereby grant to the Project and to recipients of software
distributed by the Project a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable (except as stated in this section) patent
license to make, have made, use, offer to sell, sell, import, and
otherwise transfer the Work, where such license applies only to
those patent claims licensable by You that are necessarily infringed
by Your Contribution(s) alone or by combination of Your
Contribution(s) with the Work to which such Contribution(s) were
submitted. If any entity institutes patent litigation against You or
any other entity (including a cross-claim or counterclaim in a
lawsuit) alleging that your Contribution, or the Work to which
you have contributed, constitutes direct or contributory patent
infringement, then any patent licenses granted to that entity under
this Agreement for that Contribution or Work shall terminate as of
the date such litigation is filed.
4. You represent that You are legally entitled to grant the above license. You
represent further that the employee of the Corporation designated as the Initial
CLA Manager below (and each who is designated in a subsequent written
modification to the list of CLA Managers) (each, a “CLA Manager”) is
authorized to maintain with the Project (1) the list of employees of the
Corporation who are authorized to submit Contributions on behalf of the
Corporation, and (2) the list of CLA Managers.
5. You represent that each of Your Contributions is Your original creation (see
section 7 for submissions on behalf of others).
6. You are not expected to provide support for Your Contributions, except to the
extent You desire to provide support. You may provide support for free, for a
fee, or not at all. Unless required by applicable law or agreed to in writing,
You provide Your Contributions on an “AS IS” BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied, including, without
limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
7. Should You wish to submit work that is not Your original creation, You may
submit it to the Project separately from any Contribution, identifying the
complete details of its source and of any license or other restriction
(including, but not limited to, related patents, trademarks, and license
agreements) of which you are personally aware, and conspicuously marking the
work as “Submitted on behalf of a third-party: [named here]”.
8. It is your responsibility to notify the Project when any change is required
to the list of designated employees authorized to submit Contributions on behalf
of the Corporation, or to the list of the CLA Managers.
\[Please complete and sign on the next page.\]
::: {style="page-break-after: always; visibility: hidden"}
```{=tex}
\pagebreak
```
:::
Please sign:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ Date:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Signatory Name:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Signatory E-mail:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Signatory Title:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Corporation Name:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Corporation Address:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Initial CLA Manager Name:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Initial CLA Manager E-Mail:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
+137
View File
@@ -0,0 +1,137 @@
Project Name: OpenImageIO
Project Entity: OpenImageIO Project a Series of LF Projects, LLC
If emailing signed PDF, send to: manager@lfprojects.org
**Individual Contributor License Agreement ("Agreement") v2.1**
Thank you for your interest in the project specified above (the “Project”). In
order to clarify the intellectual property license granted with Contributions
from any person or entity, the Project must have a Contributor License Agreement
(CLA) on file that has been signed by each Contributor, indicating agreement to
the license terms below. This license is for your protection as a Contributor as
well as the protection of the Project and its users; it does not change your
rights to use your own Contributions for any other purpose.
If you have not already done so, please complete and sign this Agreement using
the electronic signature portal made available to you by the Project or its
third-party service providers, or email a PDF of the signed agreement to the
email address specified above. Please read this document carefully before
signing and keep a copy for your records.
You accept and agree to the following terms and conditions for Your present and
future Contributions submitted to the Project. In return, the Project shall not
use Your Contributions in a way that is contrary to the public benefit or
inconsistent with its charter at the time of the Contribution. Except for the
license granted herein to the Project and recipients of software distributed by
the Project, You reserve all right, title, and interest in and to Your
Contributions.
1. Definitions.
“You” (or “Your”) shall mean the copyright owner or legal entity authorized by
the copyright owner that is making this Agreement with the Project. For legal
entities, the entity making a Contribution and all other entities that control,
are controlled by, or are under common control with that entity are considered
to be a single Contributor. For the purposes of this definition, “control”
means (i) the power, direct or indirect, to cause the direction or management
of such entity, whether by contract or otherwise, or (ii) ownership of fifty
percent (50%) or more of the outstanding shares, or (iii) beneficial ownership
of such entity.
“Contribution” shall mean the code, documentation or other original works of
authorship, including any modifications or additions to an existing work, that
is intentionally submitted by You to the Project for inclusion in, or
documentation of, any of the products owned or managed by the Project (the
“Work”). For the purposes of this definition, “submitted” means any form of
electronic, verbal, or written communication sent to the Project or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that are
managed by, or on behalf of, the Project for the purpose of discussing and
improving the Work, but excluding communication that is conspicuously marked or
otherwise designated in writing by You as “Not a Contribution.”
2. Grant of Copyright License. Subject to the terms and conditions of this
Agreement, You hereby grant to the Project and to recipients of software
distributed by the Project a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable copyright license to reproduce, prepare
derivative works of, publicly display, publicly perform, sublicense,
and distribute Your Contributions and such derivative works.
3. Grant of Patent License. Subject to the terms and conditions of this
Agreement, You hereby grant to the Project and to recipients of software
distributed by the Project a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable (except as stated in this section) patent
license to make, have made, use, offer to sell, sell, import, and
otherwise transfer the Work, where such license applies only to
those patent claims licensable by You that are necessarily infringed
by Your Contribution(s) alone or by combination of Your
Contribution(s) with the Work to which such Contribution(s) were
submitted. If any entity institutes patent litigation against You or
any other entity (including a cross-claim or counterclaim in a
lawsuit) alleging that your Contribution, or the Work to which
you have contributed, constitutes direct or contributory patent
infringement, then any patent licenses granted to that entity under
this Agreement for that Contribution or Work shall terminate as of
the date such litigation is filed.
4. You represent that you are legally entitled to grant the above license. If
your employer(s) has rights to intellectual property that you create that
includes your Contributions, you represent that you have received permission to
make Contributions on behalf of that employer, that your employer has waived
such rights for your Contributions to the Project, or that your employer has
executed a separate Corporate CLA with the Project.
5. You represent that each of Your Contributions is Your original creation (see
section 7 for submissions on behalf of others). You represent that Your
Contribution submissions include complete details of any third-party license or
other restriction (including, but not limited to, related patents and
trademarks) of which you are personally aware and which are associated with
any part of Your Contributions.
6. You are not expected to provide support for Your Contributions, except to the
extent You desire to provide support. You may provide support for free, for a
fee, or not at all. Unless required by applicable law or agreed to in writing,
You provide Your Contributions on an “AS IS” BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied, including, without
limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
7. Should You wish to submit work that is not Your original creation, You may
submit it to the Project separately from any Contribution, identifying the
complete details of its source and of any license or other restriction
(including, but not limited to, related patents, trademarks, and license
agreements) of which you are personally aware, and conspicuously marking the
work as “Submitted on behalf of a third-party: [named here]”.
8. You agree to notify the Project of any facts or circumstances of which you
become aware that would make these representations inaccurate in any respect.
\[Please complete and sign on the next page.\]
::: {style="page-break-after: always; visibility: hidden"}
```{=tex}
\pagebreak
```
:::
Please sign:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Date: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Full name:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Mailing Address:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
------------------------------------------------------------------------
------------------------------------------------------------------------
Country:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
E-Mail:
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
+21
View File
@@ -0,0 +1,21 @@
OpenImageIO has been accepted to be an ASWF-administered project, by vote of
the ASWF Technical Advisory Council (TAC) on May 3, 2023.
At this time, the ASWF subdirectory contains *proposed* (and sometimes TBD/WIP
placeholders) project organization and policy documents that will be formally
adopted as the OpenImageIO project is formally turned over to ASWF and moved
to the AcademySoftwareFoundation GitHub account. Please file issues or PRs
or review comments against these documents to make any suggested changes while
we are revising the drafts.
Summary of the current state of documents:
| File | Status | Notes |
| ---- | ------ | ----- |
| CLA-corporate.md | Final | Standard ASWF corporate CLA, approved by the TSC. Will take effect when the repo moves. |
| CLA-individual.md | Final | Standard ASWF individual CLA, approved by the TSC. Will take effect when the repo moves. |
| CODE_OF_CONDUCT.md | Final | Links to the standard LF CoC, approved by the TSC and now in effect. |
| CONTRIBUTING.md | Preliminary | Modified version of our existing CONTRIBUTING guidelines, lightly amended to reflect the changes that will come along with moving the repo, the new CLA/DCO rules, etc.
| GOVERNANCE.md | Final | Approved by the TSC and now in effect. |
| project_intake.md | Ongoing | This is the latest ASWF project intake checklist. We will check off items as we get them done. |
| Technical-Charter.md | Final | Approved by the TSC. |
+242
View File
@@ -0,0 +1,242 @@
# Technical Charter (the "Charter") for OpenImageIO a Series of LF Projects, LLC
Adopted July 1, 2023 by unanimous vote of the TSC.
This Charter sets forth the responsibilities and procedures for technical
contribution to, and oversight of, the OpenImageIO open source project, which
has been established as OpenImageIO a Series of LF Projects, LLC (the
“Project”). LF Projects, LLC (“LF Projects”) is a Delaware series limited
liability company. All contributors (including committers, maintainers, and
other technical positions) and other participants in the Project
(collectively, “Collaborators”) must comply with the terms of this Charter.
### 1. Mission and Scope of the Project
* **a.** The mission of the Project is to develop software to read, write,
and manipulate image files of any image file format relevant to vfx /
animation via a format-agnostic API, with a feature set, scalability, and
robustness needed for production.
* **b.** The scope of the Project includes collaborative development under
the Project License (as defined herein) supporting the mission, including
documentation, testing, integration and the creation of other artifacts
that aid the development, deployment, operation or adoption of the open
source project.
### 2. Technical Steering Committee
* **a.** The Technical Steering Committee (the “TSC”) will be responsible
for all technical oversight of the open source Project.
* **b.** The TSC voting members are initially the Project’s Committers. At
the inception of the project, the Committers of the Project will be as set
forth within the “GOVERNANCE” file within the Project’s code repository.
The TSC may choose an alternative approach for determining the voting
members of the TSC, and any such alternative approach will be documented
in the GOVERNANCE file. Any meetings of the Technical Steering Committee
are intended to be open to the public, and can be conducted
electronically, via teleconference, or in person.
* **c.** TSC projects generally will involve Contributors and Committers.
The TSC may adopt or modify roles so long as the roles are documented in
the GOVERNANCE file. Unless otherwise documented:
- **i.** Contributors include anyone in the technical community that
contributes code, documentation, or other technical artifacts to the
Project;
- **ii.** Committers are Contributors who have earned the ability to
modify (“commit”) source code, documentation or other technical
artifacts in a project’s repository; and
- **iii.** A Contributor may become a Committer by a majority approval of
the existing Committers. A Committer may be removed by a majority
approval of the other existing Committers.
* **d.** Participation in the Project through becoming a Contributor and
Committer is open to anyone so long as they abide by the terms of this
Charter.
* **e.** The TSC may (1) establish work flow procedures for the submission,
approval, and closure/archiving of projects, (2) set requirements for the
promotion of Contributors to Committer status, as applicable, and (3)
amend, adjust, refine and/or eliminate the roles of Contributors, and
Committers, and create new roles, and publicly document any TSC roles, as
it sees fit.
* **f.** The TSC may elect a TSC Chair, who will preside over meetings of
the TSC and will serve until their resignation or replacement by the TSC.
The TSC Chair, or any other TSC member so designated by the TSC, will
serve as the primary communication contact between the Project and the
Academy Software Foundation, a directed fund of The Linux Foundation.
* **g.** Responsibilities: The TSC will be responsible for all aspects of
oversight relating to the Project, which may include:
- **i.** coordinating the technical direction of the Project;
- **ii.** approving project or system proposals (including, but not
limited to, incubation, deprecation, and changes to a sub-project’s
scope);
- **iii.** organizing sub-projects and removing sub-projects;
- **iv.** creating sub-committees or working groups to focus on
cross-project technical issues and requirements;
- **v.** appointing representatives to work with other open source or open
standards communities;
- **vi.** establishing community norms, workflows, issuing releases, and
security issue reporting policies;
- **vii.** approving and implementing policies and processes for
contributing (to be published in the CONTRIBUTING file) and coordinating
with the series manager of the Project (as provided for in the Series
Agreement, the “Series Manager”) to resolve matters or concerns that may
arise as set forth in Section 7 of this Charter;
- **viii.** discussions, seeking consensus, and where necessary, voting on
technical matters relating to the code base that affect multiple
projects; and
- **ix.** coordinating any marketing, events, or communications regarding
the Project.
### 3. TSC Voting
* **a.** While the Project aims to operate as a consensus-based community,
if any TSC decision requires a vote to move the Project forward, the
voting members of the TSC will vote on a one vote per voting member basis.
* **b.** Quorum for TSC meetings requires at least fifty percent of all
voting members of the TSC to be present. The TSC may continue to meet if
quorum is not met but will be prevented from making any decisions at the
meeting.
* **c.** Except as provided in Section 7.c. and 8.a, decisions by vote at a
meeting require a majority vote of those in attendance, provided quorum is
met. Decisions made by electronic vote without a meeting require a
majority vote of all voting members of the TSC.
* **d.** In the event a vote cannot be resolved by the TSC, any voting
member of the TSC may refer the matter to the Series Manager for
assistance in reaching a resolution.
### 4. Compliance with Policies
* **a.** This Charter is subject to the Series Agreement for the Project and
the Operating Agreement of LF Projects. Contributors will comply with the
policies of LF Projects as may be adopted and amended by LF Projects,
including, without limitation the policies listed at
https://lfprojects.org/policies/.
* **b.** The TSC may adopt a code of conduct (“CoC”) for the Project, which
is subject to approval by the Series Manager. In the event that a
Project-specific CoC has not been approved, the LF Projects Code of
Conduct listed at https://lfprojects.org/policies will apply for all
Collaborators in the Project.
* **c.** When amending or adopting any policy applicable to the Project, LF
Projects will publish such policy, as to be amended or adopted, on its web
site at least 30 days prior to such policy taking effect; provided,
however, that in the case of any amendment of the Trademark Policy or
Terms of Use of LF Projects, any such amendment is effective upon
publication on LF Project’s web site.
* **d.** All Collaborators must allow open participation from any individual
or organization meeting the requirements for contributing under this
Charter and any policies adopted for all Collaborators by the TSC,
regardless of competitive interests. Put another way, the Project
community must not seek to exclude any participant based on any criteria,
requirement, or reason other than those that are reasonable and applied on
a non-discriminatory basis to all Collaborators in the Project community.
* **e.** The Project will operate in a transparent, open, collaborative, and
ethical manner at all times. The output of all Project discussions,
proposals, timelines, decisions, and status should be made open and easily
visible to all. Any potential violations of this requirement should be
reported immediately to the Series Manager.
### 5. Community Assets
* **a.** LF Projects will hold title to all trade or service marks used by
the Project (“Project Trademarks”), whether based on common law or
registered rights. Project Trademarks will be transferred and assigned to
LF Projects to hold on behalf of the Project. Any use of any Project
Trademarks by Collaborators in the Project will be in accordance with the
license from LF Projects and inure to the benefit of LF Projects.
* **b.** The Project will, as permitted and in accordance with such license
from LF Projects, develop and own all Project GitHub and social media
accounts, and domain name registrations created by the Project community.
* **c.** Under no circumstances will LF Projects be expected or required to
undertake any action on behalf of the Project that is inconsistent with
the tax-exempt status or purpose, as applicable, of the Joint Development
Foundation or LF Projects, LLC.
### 6. General Rules and Operations.
* **a.**. The Project will:
- **i.** engage in the work of the Project in a professional manner
consistent with maintaining a cohesive community, while also maintaining
the goodwill and esteem of LF Projects, Joint Development Foundation and
other partner organizations in the open source community; and
- **ii.** respect the rights of all trademark owners, including any
branding and trademark usage guidelines.
### 7. Intellectual Property Policy
* **a.** Collaborators acknowledge that the copyright in all new
contributions will be retained by the copyright holder as independent
works of authorship and that no contributor or copyright holder will be
required to assign copyrights to the Project.
* **a.** Except as described in Section 7.c., all contributions to the
Project are subject to the following:
- **i.** All new inbound code contributions to the Project must be made
using the Apache License, Version 2.0 available at
http://www.apache.org/licenses/LICENSE-2.0 (the “Project License”).
- **ii.** All new inbound code contributions must also be accompanied by
(i) a Developer Certificate of Origin (http://developercertificate.org)
sign-off in the source code system that is submitted through a
TSC-approved contribution process which will bind the authorized
contributor and, if not self-employed, their employer to the applicable
license and (ii) a duly executed contribution license agreement in the
form approved by the TSC;
- **iii.** All outbound code will be made available under the Project
License.
- **iv.** Documentation will be received and made available by the Project
under the Creative Commons Attribution 4.0 International License
(available at http://creativecommons.org/licenses/by/4.0/).
- **v.** The Project may seek to integrate and contribute back to other
open source projects (“Upstream Projects”). In such cases, the Project
will conform to all license requirements of the Upstream Projects,
including dependencies, leveraged by the Project. Upstream Project code
contributions not stored within the Project’s main code repository will
comply with the contribution process and license terms for the
applicable Upstream Project.
* **c.** The TSC may approve the use of an alternative license or licenses
for inbound or outbound contributions on an exception basis. To request an
exception, please describe the contribution, the alternative open source
license(s), and the justification for using an alternative open source
license for the Project. License exceptions must be approved by a
two-thirds vote of the entire TSC.
* **d.** Contributed files should contain license information, such as SPDX
short form identifiers, indicating the open source license or licenses
pertaining to the file.
### 8. Amendments
* **a.** This charter may be amended by a two-thirds vote of the entire TSC
and is subject to approval by LF Projects.
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

+66
View File
@@ -0,0 +1,66 @@
# Project Intake checklist
This is a checklist for TSC's to review as part of the intake process. The TSC should review this entire list during the kickoff meeting. For anything outstanding, create an [issue](../issues) to track and link to it in the list
- Existing Project Governance
- [X] A [LICENSE.md](../LICENSE.md) file in every code repository, with the license chosen an OSI-approved license.
- [X] Any third-party components/dependencies included are listed along with thier licenses ( [THIRD-PARTY.md](../THIRD-PARTY.md) )
- [X] A [README.md](../README.md) file welcoming new community members to the project and explaining why the project is useful and how to get started.
- [X] A [CONTRIBUTING.md](../CONTRIBUTING.md) file explaining to other developers and your community of users how to contribute to the project. The file should explain what types of contributions are needed and how the process works, along with how to disclose security issues responsibly ( may also point to a [SECURITY.md](../SECURITY.md) file ).
- [ ] A [CODEOWNERS](../CODEOWNERS) or [COMMITTERS](../COMMITERS.csv) file to define individuals or teams that are responsible for code in a repository; document current project owners and current and emeritus committers.
- [X] A [CODE_OF_CONDUCT.md](../CODE_OF_CONDUCT.md) file that sets the ground rules for participants’ behavior associated and helps to facilitate a friendly, welcoming environment. By default, projects should leverage the Linux Foundation Code of Conduct unless an alternate Code of Conduct was previously approved.
- [X] A [RELEASING.md](../RELEASING.md) file that provides documentation on the release methodology, cadence, criteria, etc.
- [X] A [GOVERNANCE.md](../GOVERNANCE.md) file that documents the project’s technical governance.
- [ ] A [SUPPORT.md](../SUPPORT.md) file to let users and developers know about ways to get help with your project.
- Infrastructure/Assets
- [X] Technical Charter Approved
- [ ] **(Awaiting scan from LF)** License scan completed and no issues found
- [ ] Code repository imported to ASWF GitHub organization or ownership of current GitHub organization given to `thelinuxfoundation` user
- [X] Developer Certificate of Origin past commit signoff done and DCO Probot enabled.
- [X] Issue/feature tracker established (JIRA, GitHub issues)
- [X] Mailing lists ( one of )
- [X] Setup new lists ( -dev@ and -tsc@ ) on [ASWF groups.io](https://lists.aswf.io) ( create [issue on foundation repo](https://github.com/AcademySoftwareFoundation/foundation/issues/new) to setup )
- [X] (In progress) Move to [ASWF groups.io](https://lists.aswf.io) ( create [issue on foundation repo](https://github.com/AcademySoftwareFoundation/foundation/issues/new) to transfer )
- [X] Slack ( create [issue on foundation repo](https://github.com/AcademySoftwareFoundation/foundation/issues/new) to setup project channel on [ASWF Slack](https://slack.aswf.io) )
- [ ] Website
- [X] CI/build environment
- [X] Trademarks/mark ownership rights ( complete 'LF Projects - Form of Trademark and Account Assignment' - create [issue on foundation repo](https://github.com/AcademySoftwareFoundation/foundation/issues/new) - only needed if project using existing name )
- [ ] Domain name ( create [issue with the LF IT staff](https://jira.linuxfoundation.org/plugins/servlet/theme/portal/2/group/19) to setup/transfer )
- [ ] Zoom account access ( create [issue on foundation repo](https://github.com/AcademySoftwareFoundation/foundation/issues/new) to get access to credentials )
- [X] (N/A) Social media accounts or other project accounts ( create [issue on foundation repo](https://github.com/AcademySoftwareFoundation/foundation/issues/new) to transfer )
- [X] Logo(s) ( create [issue on artwork repo](https://github.com/AcademySoftwareFoundation/artwork/issues/new) to add in SVG and PNG format and color/black/white )
- New Project Governance
- [X] TSC members identified
- [X] First TSC meeting held
- [X] TSC meeting cadence set and added to project calendar
- [X] CLA Approved ( if used ) ( [CCLA](CLA-corporate.md) and [ICLA](CLA-individual.md) )
- Project charter ( [Technical-Charter.md](Technical-Charter.md) )
- [X] Approved by TSC
- [ ] Filed ( create pull request against [foundation repo](https://github.com/AcademySoftwareFoundation/foundation) )
- [X] [Core Infrastructure Initiative Best Practices Badge](https://bestpractices.coreinfrastructure.org/) achieved as the 'Passing' level.
- Outreach
- [ ] New project announcement done ( create [issue on foundation repo](https://github.com/AcademySoftwareFoundation/foundation/issues/new) to trigger )
- [X] Project added to ASWF website and ASWF landscape
- Incubation Stage requirements
- [X] Have achieved and maintained a [OpenSSF Best Practices Badge at the passing level](https://bestpractices.coreinfrastructure.org/en/criteria).
- [ ] Have had a successful license scan with any critical issues remedied.
- [ ] Have a defined project mission and scope
- [ ] An overview of the project’s architecture and features defined.
- [ ] A project roadmap defined, which should address the following questions.
- What use cases are possible now?
- What does the next year look like in terms of additional features and use cases covered?
- [ ] Community and contributor growth assessment
- The current number of contributors and committers, and the number of different organizations contributing to the project.
- Demonstrate a sustained flow of commits / merged contributions
- A credible plan for developing a thriving user community, in particular expanding the number of committers and contributors?
- Outline of the plan for the project to complete the requirements for Adopted Stage
- [ ] Obtain an affirmative vote of the TAC.
- Adopted Stage graduation requirements
- [ ] Demonstrate a substantial ongoing flow of commits and merged contributions, authored by a healthy number of diverse contributors.
- [ ] Demonstrable roadmap progress.
- [ ] A healthy number of public adopters that are identified within the project ( using an ADOPTERS file or showcased on the project’s website ).
- [ ] Have achieved and maintained an [OpenSSF Best Practices Badge at the gold level](https://bestpractices.coreinfrastructure.org/en/criteria/2).
- [ ] Have a technical lead appointed for voting representation of the project to the TAC.
- [ ] Be deemed by the TAC to add value to the mission of ASWF.
- [ ] 2/3 supermajority vote of the TAC
- [ ] Affirmative majority vote of the Governing Board
+798 -83
View File
File diff suppressed because it is too large Load Diff
+31 -5
View File
@@ -1,20 +1,30 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
cmake_minimum_required (VERSION 3.12)
project (OpenImageIO VERSION 2.4.0.3
set (OpenImageIO_VERSION "2.4.16.0")
set (OpenImageIO_VERSION_OVERRIDE "" CACHE STRING
"Version override (use with caution)!")
mark_as_advanced (OpenImageIO_VERSION_OVERRIDE)
if (OpenImageIO_VERSION_OVERRIDE)
set (OpenImageIO_VERSION ${OpenImageIO_VERSION_OVERRIDE})
endif ()
project (OpenImageIO VERSION ${OpenImageIO_VERSION}
HOMEPAGE_URL "https://openimageio.org"
LANGUAGES CXX C)
set (PROJ_NAME OIIO) # short name, caps
string (TOLOWER ${PROJ_NAME} PROJ_NAME_LOWER) # short name lower case
string (TOUPPER ${PROJ_NAME} PROJ_NAME_UPPER) # short name upper case
set (PROJECT_VERSION_RELEASE_TYPE "dev" CACHE STRING
set (PROJECT_VERSION_RELEASE_TYPE "" CACHE STRING
"Build type, for example: dev, beta2, RC1 (empty string for normal release)")
set (${PROJECT_NAME}_VERSION_RELEASE_TYPE ${PROJECT_VERSION_RELEASE_TYPE})
set (PROJECT_AUTHORS "Contributors to the OpenImageIO project")
option (${PROJECT_NAME}_SUPPORTED_RELEASE
"Set ON for supported release branch, OFF for master" OFF)
"Set ON for supported release branch, OFF for master" ON)
if (${PROJECT_NAME}_SUPPORTED_RELEASE)
set (${PROJECT_NAME}_DEV_RELEASE OFF)
else ()
@@ -63,6 +73,7 @@ message (STATUS "Project build dir = ${CMAKE_BINARY_DIR}")
message (STATUS "Project install prefix = ${CMAKE_INSTALL_PREFIX}")
message (STATUS "Configuration types = ${CMAKE_CONFIGURATION_TYPES}")
message (STATUS "Build type = ${CMAKE_BUILD_TYPE}")
message (STATUS "Supported release = ${${PROJECT_NAME}_SUPPORTED_RELEASE}")
# Make the build area layout look a bit more like the final dist layout
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
@@ -94,6 +105,14 @@ set (PLUGIN_SEARCH_PATH "" CACHE STRING "Default plugin search path")
file (TO_NATIVE_PATH "${PLUGIN_SEARCH_PATH}" PLUGIN_SEARCH_PATH_NATIVE)
set (CMAKE_DEBUG_POSTFIX "_d" CACHE STRING "Library naming postfix for Debug builds")
if (CMAKE_UNITY_BUILD_BATCH_SIZE)
set (UNITY_SMALL_BATCH_SIZE "${CMAKE_UNITY_BUILD_BATCH_SIZE}" CACHE STRING "Unity batch mode size for expensive files")
else ()
set (UNITY_SMALL_BATCH_SIZE 8 CACHE STRING "Unity batch mode size for expensive files")
endif ()
message(STATUS "CMAKE_UNITY_BUILD_MODE = ${CMAKE_UNITY_BUILD_MODE}")
message(STATUS "CMAKE_UNITY_BUILD_BATCH_SIZE = ${CMAKE_UNITY_BUILD_BATCH_SIZE}")
option (OIIO_THREAD_ALLOW_DCLP "OIIO threads may use DCLP for speed" ON)
if (NOT OIIO_THREAD_ALLOW_DCLP)
add_definitions ("-DOIIO_THREAD_ALLOW_DCLP=0")
@@ -103,6 +122,10 @@ set (TEX_BATCH_SIZE "" CACHE STRING "Force TextureSystem SIMD batch size (e.g. 1
if (TEX_BATCH_SIZE)
add_definitions ("-DOIIO_TEXTURE_SIMD_BATCH_WIDTH=${TEX_BATCH_SIZE}")
endif ()
option (OIIO_TEX_IMPLEMENT_VARYINGREF "Implement the deprecated batch texture functions taking VaryingRef params" ON)
if (NOT OIIO_TEX_IMPLEMENT_VARYINGREF)
add_definitions (-DOIIO_TEX_NO_IMPLEMENT_VARYINGREF=1)
endif ()
# Set the default namespace
set (${PROJ_NAME}_NAMESPACE ${PROJECT_NAME} CACHE STRING
@@ -116,6 +139,9 @@ if (${PROJ_NAME}_NAMESPACE_INCLUDE_PATCH)
endif ()
message(STATUS "Setting Namespace to: ${PROJ_NAMESPACE_V}")
# Define OIIO_INTERNAL symbol only when building OIIO itself, will not be
# defined for downstream projects using OIIO.
add_definitions (-DOIIO_INTERNAL=1)
list (APPEND CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/src/cmake/modules"
+7
View File
@@ -0,0 +1,7 @@
# Code of Conduct
The OpenImageIO project abides by Linux Foundation's code of conduct, which
you can read in full [here](https://lfprojects.org/policies/code-of-conduct).
To report incidents or to appeal reports of incidents, send email to
the Manager of LF Projects at manager@lfprojects.org.
+146 -73
View File
@@ -1,56 +1,76 @@
Contributing to OpenImageIO
===========================
Code contributions to OpenImageIO are always welcome, and [nearly 150
people](CREDITS.md) have done so over the years. Please review this
document to get a briefing on our process.
> NOTE: This is the proposed post-ASWF-move version of CONTRIBUTING. After the
> project is legally transferred and moved to the new repo, this file will
> replace the one at the project root.
>
> TO DO:
>
> - [X] Update the mail list sign-up page after the mail list moves.
> - [ ] Update the repo URL
> - [ ] Double check the security and info email addresses.
>
Code contributions to OpenImageIO are always welcome, and [nearly 200
people](https://github.com/OpenImageIO/oiio/blob/master/CREDITS.md) have done
so over the years. Please review this document to get a briefing on our
process.
Mail Lists
----------
Mail List and Slack
-------------------
There are two mail lists associated with OpenImageIO development:
Contributors should be reading the oiio-dev mail list:
* [oiio-dev](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org)
* [oiio-dev](https://lists.aswf.io/g/oiio-dev)
For developers of the OpenImageIO code itself, or users who are really
interested in the OIIO internals. This is where we mostly discuss the code
(including bug reports), but are also happy to answer user questions about
use or working of OIIO.
* [oiio-announce](http://lists.openimageio.org/listinfo.cgi/oiio-announce-openimageio.org)
For announcements about major OIIO releases or other important news.
You can sign up for the mail list on your own using the link above.
You can sign up for these mail lists on your own using the links above.
The [ASWF Slack](https://slack.aswf.io/) has an `openimageio` channel. Sign up
for the Slack on your own, then under "channels", select "browse channels" and
you should see the openimageio channel (among those of the other projects and
working groups).
How to Ask for Help
-------------------
If you have trouble installing, building, or using OpenImageIO, but there's
not yet reason to suspect you've encountered a genuine bug, start by posting
a question to the
[oiio-dev](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org)
mailing list. This is the place for question such has "How do I...".
not yet a solid reason to suspect you've encountered a genuine bug, start by
posting a question to the [oiio-dev mailing
list](https://lists.aswf.io/g/oiio-dev).
This is the place for questions such has "How do I...".
Bug Reports and Issue Tracking
------------------------------
We use GitHub's issue tracking system for bugs and enhancements:
https://github.com/OpenImageIO/oiio/issues
We use GitHub's issue tracking system for reporting bugs and requesting
enhancements: https://github.com/OpenImageIO/oiio/issues
**If you are merely asking a question ("how do I...")**, please do not file an
issue, but instead ask the question on the [oiio-dev mailing
list](https://lists.aswf.io/g/oiio-dev).
If you are submitting a bug report, please be sure to note which version of
OIIO you are using, on what platform (OS/version, which compiler you used,
and any special build flags or other unusual environmental issues). Please
give a specific an account of
give a specific, as-detailed-as-possible account of
* what you tried
* what happened
* what you expected to happen instead
* what you tried (command line, source code example)
* what you expected to happen
* what actually happened (crash? error message? ran but didn't give the
correct result?)
with enough detail that others can reproduce the problem. Please quote the
exact error message you received. If you are having trouble building, please
post the full cmake output of a fresh VERBOSE=1 build.
with enough detail that others can easily reproduce the problem just by
following your instructions. Please quote the exact error message you
received. If you are having trouble building, please post the full cmake
output of a fresh VERBOSE=1 build.
Suspected security vulnerabilities should be reported by the same process.
@@ -61,29 +81,57 @@ may contact us privately at [security@openimageio.org](security@openimageio.org)
Contributor License Agreement (CLA) and Intellectual Property
-------------------------------------------------------------
To protect the project -- and the contributors! -- we do require a
Contributor License Agreement (CLA) for anybody submitting substantial
changes. Trivial changes (such as an alteration to the Makefiles, a one-line
bug fix, etc.) may be accepted without a CLA, at the sole discretion of the
project leader, but anything complex needs a CLA. This is for your own
safety.
To protect the project -- and the contributors! -- we do require a Contributor
License Agreement (CLA) for anybody submitting changes. This is for your own
safety, as it prevents any possible future disputes between code authors and
their employers or anyone else who might think they might own the IP output of
the author.
* If you are an individual writing the code on your own time and you're SURE
you are the sole owner of any intellectual property you contribute, use the
[Individual CLA](https://github.com/OpenImageIO/oiio/blob/master/src/doc/CLA-INDIVIDUAL).
* [Corporate CLA](https://github.com/OpenImageIO/oiio/blob/master/ASWF/CLA-corporate.md) :
If you are writing the code as part of your job, or if there is any
possibility that your employers might think they own any intellectual
property you create. This needs to be executed by someone who has
signatory power for the company.
* If you are writing the code as part of your job, or if there is any
possibility that your employers might think they own any intellectual
property you create, then you should use the [Corporate
CLA](https://github.com/OpenImageIO/oiio/blob/master/src/doc/CLA-CORPORATE).
* [Individual CLA](https://github.com/OpenImageIO/oiio/blob/master/ASWF/CLA-individual.md) :
If you are an individual writing the code on your own time, using your own
equipment, and you're SURE you are the sole owner of any intellectual
property you contribute.
Download the appropriate CLA from the links above (or find them in the
src/doc directory of the software distribution), print, sign, and rescan it
(or just add a digital signature directly), and email it back to us
(info@openimageio.org).
The easiest way to sign CLAs is digitally [using EasyCLA](https://corporate.v1.easycla.lfx.linuxfoundation.org).
Companies who prefer not to use the online tools may sign, scan, and email
the executed copy to manager@lfprojects.org.
Our CLA's are identical to those used by Apache and many other open source
projects.
The CLA allows a company to name a "CLA Manager" (who does not need
signatory power) who has the ability to use the online system to add or
delete individual employees of the company who are authorized to submit pull
requests, without needing to get an executive to amend and sign the
agreement each time.
Please note that these CLAs are based on the Apache 2.0 CLAs, and differ
minimally, only as much as was required to correctly describe the EasyCLA
process and our use of a CLA manager.
**Contribution sign off**
This project requires the use of the [Developer’s Certificate of Origin 1.1
(DCO)](https://developercertificate.org/), which is the same mechanism that
the [Linux®
Kernel](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst#n416)
and many other communities use to manage code contributions. The DCO is
considered one of the simplest tools for sign offs from contributors as the
representations are meant to be easy to read and indicating signoff is done
as a part of the commit message.
Here is an example Signed-off-by line, which indicates that the submitter
accepts the DCO:
Signed-off-by: John Doe <john.doe@example.com>
You can include this automatically when you commit a change to your local
git repository using `git commit -s`. You might also want to
leverage this [command line tool](https://github.com/coderanger/dco) for
automatically adding the signoff message on commits.
Pull Requests and Code Review
@@ -98,40 +146,61 @@ repository. The protocol is like this:
1. Get a GitHub account, fork OpenImageIO/oiio to create your own repository
on GitHub, and then clone it to get a repository on your local machine.
2. Edit, compile, and test your changes. Run clang-format (see the
1. Edit, compile, and test your changes. Run clang-format (see the
instructions on coding style below).
3. Push your changes to your fork (each unrelated pull request to a separate
1. Push your changes to your fork (each unrelated pull request to a separate
"topic branch", please).
4. Make a "pull request" on GitHub for your patch.
1. Make a "pull request" on GitHub for your patch.
5. If your patch will induce a major compatibility break, or has a design
2. If your patch will induce a major compatibility break, or has a design
component that deserves extended discussion or debate among the wider OIIO
community, then it may be prudent to email oiio-dev pointing everybody to
the pull request URL and discussing any issues you think are important.
6. All pull requests automatically launch CI jobs on GitHub Actions to
1. All pull requests automatically launch CI jobs on GitHub Actions to
ensure that the build completes and that the tests suite runs correctly, for
a varity of platform, compiler, library, and flag combinations. The status
a variety of platform, compiler, library, and flag combinations. The status
of the CI tests for your PR will be displayed on the GitHub PR page. We will
not accept PRs that don't build cleanly or pass the existing testsuite.
7. The reviewer will look over the code and critique on the "comments" area.
1. The reviewer will look over the code and critique on the "comments" area.
Reviewers may ask for changes, explain problems they found, congratulate the
author on a clever solution, etc. But until somebody says "LGTM" (looks good
to me), the code should not be committed. Sometimes this takes a few rounds
of give and take. Please don't take it hard if your first try is not
accepted. It happens to all of us.
8. After approval, one of the senior developers (with commit approval to the
1. After approval, one of the senior developers (with commit approval to the
official main repository) will merge your fixes into the master branch.
Coding Style
------------
#### Formatting
### File conventions
C++ implementation should be named `*.cpp`. Headers should be named `.h`.
All headers should contain
#pragma once
All source files should begin with these three lines:
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
as a comment in the syntax of whatever source code is used in that file.
Occasionally a file may contain substantial code from another project and will
also list its original copyright and license information. Do NOT alter that
notice or copy it to any new files, it really only applies to the particular
file in which it appears.
### Formatting
We use [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
to uniformly format our source code prior to PR submission. Make sure that
@@ -151,31 +220,35 @@ it on your end and update the PR with the formatting fixes.
If you don't have clang-format set up on your machine, and your patch is not
very long, you may find that it's more convenient to just submit it and hope
for the best, and if it doesn't pass the CI test, look at the diffs in
the log and make the corrections by hand and then submit an update to the
patch (i.e. relying on CI to run clang-format for you).
for the best, and if it doesn't pass the CI test, look at the diffs in the log
for the "clang-format" CI run and make the corrections by hand and then submit
an update to the patch (i.e. relying on CI to run clang-format for you).
Because the basic formatting is automated by clang-format, we won't
enumerate the rules here.
For the occasional non-clang-format regions of code, NEVER alter somebody
else's code to reformat just because you found something that violates the
rules. Let the group/author/leader know, and resist the temptation to change
it yourself.
#### File conventions
Each line of text in your code, including comments, should be at most 80
characters long. Exceptions are allowed for those rare cases where letting a
line be longer (and wrapping on an 80-character window) is actually a better
and clearer alternative than trying to split it into two lines. Sometimes this
happens, but it's extremely rare.
C++ implementation should be named `*.cpp`. Headers should be named `.h`.
All headers should contain
#pragma once
All source files should begin with the copyright and license, which can be
found in the LICENSE.md file (or cut and pasted from any other other source
file).
For NEW source files, please change the copyright year to the present. DO
NOT edit existing files only to update the copyright year, it just creates
pointless deltas and offers no increased protection.
We prefer three (3) consecutive empty lines between freestanding functions or
class definitions, one blank line between method declarations within a class
definition. Put a single blank line within a function if it helps to visually
separate different sequential tasks, but don't put multiple blank lines in a
row within a function, or blank lines right after an opening brace or right
before a closing brace. The goal is to use just enough white space to help
developers visually parse the code (for example, spotting at a glance where
new functions begin), but not so much as to spread it out or be confusing.
#### Identifiers
### Identifiers
In general, classes and templates should start with upper case and
capitalize new words: `class CustomerList;` In general, local variables
@@ -195,7 +268,7 @@ Names of data should generally be nouns. Functions/methods are trickier: a
the name of a function that returns a value but has no side effects should
be a noun, but a procedure that performs an action should be a verb.
#### Class structure
### Class structure
Try to avoid public data members, although there are some classes that serve
a role similar to a simple C struct -- a very straightforward collection of
@@ -215,21 +288,21 @@ Avoid multiple inheritance.
Namespaces: yes, use them!
#### Third-party libraries
### Third-party libraries
Prefer C++11 `std` rather than Boost, where both can do the same task.
Feel free to use Boost classes you already see in the code base, but don't
use any Boost you don't see us already using, without first checking with
the project leader.
Please do use IlmBase vector, matrix, and utility classes where applicable.
Please do use Imath vector, matrix, and utility classes where applicable.
Don't write your own vector or matrix code!
Use these libraries for OIIO internals, but please DO NOT require them in
any of our main external APIs unless it's been thoroughly discussed and
approved by the group.
#### Comments and Doxygen
### Comments and Doxygen
Comment philosophy: try to be clear, try to help teach the reader what's
going on in your code.
@@ -245,7 +318,7 @@ They looks like this:
float foo; ///< Doxygen comments on same line look like this
}
#### Miscellaneous
### Miscellaneous
Macros should be used only rarely -- prefer inline functions, templates,
enums, or "const" values wherever possible.
+20
View File
@@ -19,10 +19,14 @@ lg@openimageio.org
* Aman Shah
* Ananth Garre
* Anders Langlands
* Angus Davis
* Anthony Nemoff
* Aras Pranckevičius
* Arkady Shapkin
* Basileios Anastasatos
* Bastien Montagne
* Ben De Luca
* Bernhard Rosenkraenzer
* Biswapriyo Nath
* Blair Tennessy
* Blazej Floch
@@ -64,6 +68,7 @@ lg@openimageio.org
* Fredrik Averpil
* Frédéric Devernay
* Gaurav Bansal
* Gerdya
* Ghislain Antony Vaillant
* Gonzalo Garramuño
* Gregor Mueckl
@@ -78,15 +83,21 @@ lg@openimageio.org
* Irena Damsky
* Ismael Cortes
* Jan Hettenkofer
* Jan Honsbrok
* Jens Lindgren
* Jep Hill
* Jeph Alapat
* Jeremy Rose
* Jeremy Selan
* Jim Hourihan
* Joachim Reichel
* Johannes Unterguggenberger
* John Burnett
* John Fea
* John Haddon
* Jonathan Hearn
* Jonathan Scruggs
* Joris Nijs
* Joseph Goldstone
* Julien Enche
* Justin Israel
@@ -114,10 +125,13 @@ lg@openimageio.org
* Mariusz Szczepanczyk
* Mark Boorer
* Mark Visser
* Massimo Paladin
* Matteo F. Vescovi
* Matthew E. Levine
* Max Liani
* Merwan Achibet
* Michael Cho
* Michael Oliver
* Michel Lerenard
* Michel Normand
* Mikael Sundell
@@ -129,6 +143,7 @@ lg@openimageio.org
* Nick Black
* Nicolas Burtnyk
* Nixon Kwok
* Noah Rahm (designer of our logo!)
* Northon Patrick
* Nuno Cardoso
* Ole Gulbrandsen
@@ -142,6 +157,7 @@ lg@openimageio.org
* Pete Larabell
* Philip Nemec
* Pino Toscano
* Povilas Kanapickas
* Puneet Jain
* Radu Arjocu
* Ramon Montoya
@@ -152,6 +168,7 @@ lg@openimageio.org
* Roeland Schoukens
* Roman Zulak
* Rui Li
* Russell Greene
* Ryen
* Saket Jalan
* Sam Richards
@@ -173,11 +190,14 @@ lg@openimageio.org
* Till Dechent
* Tim D. Smith
* Tim Grant
* Tom Knowles
* Troy James Sobotka
* Vinod Khare
* Vishal Agrawal
* Vitor Franchi
* Wayne Arnold
* Will Rosecrans
* William Krick
* Wormszer
* Xo Wang
* Yang Yang
+215
View File
@@ -0,0 +1,215 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the OpenImageIO Project. -->
# OpenImageIO Project Governance
OpenImageIO is a project of the Academy Software Foundation and relies on the
ASWF governance policies, supported by the Linux Foundation.
There are three primary project roles: Contributors submit code to the
project; Committers approve code to be included into the project; and the
Technical Steering Committee (TSC) provides overall high-level project
guidance.
* [Contributors](#Contributors)
* [Committers](#Committers)
* [Technical Steering Committee](#Technical-Steering-Committee)
## Contributors
The OpenImageIO project grows and thrives from assistance from Contributors.
Contributors include anyone in the community who contributes code,
documentation, or other technical artifacts that have been incorporated into
the project repository.
Anyone can be a Contributor. You need no formal approval from the project,
beyond the legal forms.
### How to Become a Contributor
* Review the coding standards and [contributing
guidelines](../CONTRIBUTING.md) to ensure your contribution is in line with
the project's coding and styling guidelines.
* Sign the Individual CLA, or if you are employed by an organization that
might have any claim to IP you create, have your organization sign the
Corporate CLA.
* Submit your code as a PR with the appropriate DCO sign-off on each commit.
The easiest way to do this is to ensure that you commit your code with `git
commit -s`.
## Committers
Project Committers have merge access on the OpenImageIO GitHub repository
and are responsible for approving submissions by Contributors.
### Committer Responsibilities
Typical activities of a Committer include:
* Helping users and novice contributors.
* Ensuring a response to questions posted to the
[Oiio-dev developer mail list](https://lists.aswf.io/g/oiio-dev)
* Contributing code and documentation changes that improve the project.
* Reviewing and commenting on issues and pull requests.
* Ensuring that changes and new code meet acceptable standards and are in
the long-term interest of the project.
* Participation in working groups.
* Merging pull requests.
### How to Become a Committer
Any member of the OpenImageIO community (though typically an existing
Committer or TSC member) may nominate an individual making significant and
valuable contributions to the OpenImageIO project to become a new Committer.
To nominate a new Committer, open an issue in the OpenImageIO repository, send
mail to the TSC mail list, or raise the issue at a TSC meeting.
The TSC may periodically review the Committer list to identify inactive
Committers. Past Committers are typically given Emeritus status. Emeriti may
request that the TSC restore them to active Committer status.
## Technical Steering Committee
The Technical Steering Committee (TSC) has final authority over this project.
As defined in the project charter, in addition to committer activities, TSC
responsibilities also include, but are not limited to:
* Coordinating technical direction of the Project.
* Project governance and contribution policy.
* GitHub repository administration.
* Maintaining the list of additional Committers
* Appointing representatives to work with other open source or open
standards communities.
* Discussions, seeking consensus, and where necessary, voting on technical
matters relating to the code base that affect multiple projects.
* Coordinating any marketing, events, or communications regarding the
project.
Within the TSC are two elected leadership roles to be held by its members
and voted on annually. Any TSC member can express interest in serving in a
role, or nominate another member to serve. There are no term limits, and one
person may hold multiple roles simultaneously. Should a TSC member resign
from a leadership role before their term is complete, a successor shall be
elected through the standard nomination and voting process to complete the
remainder of the term. The leadership roles are:
* **Chair**: This position acts as the project manager, organizing meetings
and providing oversight to project administration.
* **Chief Architect**: This position makes all the final calls on design and
technical decisions, and is responsible for avoiding "design by committee"
pitfalls.
The chair role is assumed to rotate annually (though there are no term
limits, so the TSC may reelect an existing chair). The chief architect
position should be a source of stability and coherent design vision, so the
TSC is encouraged to choose an architect who can serve for many years and
only change architects when it is necessary for the health of the project
and its community.
At the time of election, the TSC will also agree upon which of these two
leaders will serve as the OpenImageIO ASWF (Academy Software Foundation) TAC
(Technical Advisory Council) representative for the term. This member
represents the project at all ASWF TAC meetings.
### TSC Members
Current voting members of the TSC are:
* **Chair and TAC representative**: Daniel Greenstein - Sony Pictures Imageworks (possibly interim?)
* **Chief Architect**: Larry Gritz - Sony Pictures Imageworks
* Anton Dukhovnikov - Wētā Digital / Unity
* Jesse Yurkovich - Blender
* Joseph Goldstone - ARRI
* Lewis Wakeland - Disney TV Animation
* Luke Emrose - Animal Logic (interim?)
* Martin Davies - LAIKA
* Robin Rowe - Heroic Robots
* Thiago Ize - Autodesk
### TSC Nomination and Succession
Any proposal for additional members of the TSC may be submitted by Committers,
TSC members, or other major stakeholders of the OpenImageIO community by
opening an issue outlining their case or raising the issue at a TSC meeting.
New TSC members are accepted or rejected by majority vote of the TSC.
If a TSC member is for an extended period not regularly participating or
performing the responsibilities expected of TSC members, the TSC may by
majority vote request an alternate TSC member be submitted by that
organization, or remove the inactive member from the TSC.
A voting member of the TSC may nominate a successor in the event that such
voting member decides to leave the TSC, and the TSC, including the departing
member, shall confirm or reject such nomination by a vote. In the event that
the departing member's nomination for successor is rejected by vote of the
TSC, the departing member shall be entitled to continue nominating successors
until one such successor is confirmed by vote of the TSC. If the departing
member fails or is unable to nominate a successor, the TSC may nominate one on
the departing member's behalf.
TSC membership is presumed to be retained by the individual even if they
change employers, provided they remain active in the project. The TSC may take
action to ensure that organizational stakeholder representation not become
severely disproportionate, for example by urging an organization that loses
its sole TSC representative to nominate a new member, or by limiting the total
number of voting members from any one organization if too many members all
move to the same organization.
### TSC Meetings
Any meetings of the TSC are intended to be open to the public, except where
there is a reasonable need for privacy. The TSC meets regularly in a voice
conference call, at a cadence deemed appropriate by the TSC. The TSC Chair
moderates the meeting, or appoints another TSC member to moderate in his or
her absence. Meetings may also be streamed online where appropriate;
connection details will be posted to the oiio-dev mail list in advance of the
scheduled meeting.
The biweekly TSC meetings can be found on the [ASWF Calendar](https://www.aswf.io/meeting-calendar),
just click on the OpenImageIO meeting entries to get the Zoom link.
Items are added to the TSC agenda which are considered contentious or are
modifications of governance, contribution policy, TSC membership, or release
process, in addition to topics involving the high-level technical direction
of the project.
The intention of the agenda is not to approve or review all patches. That
should happen continuously on GitHub and be handled by the larger group of
Committers.
Any community member or Contributor can ask that something be reviewed by
the TSC at the meeting by logging a GitHub issue. Any Committer, TSC member,
or the meeting chair can bring the issue to the TSC's attention by applying
the `TSC` label.
Prior to each TSC meeting, the meeting chair will share the agenda with
members of the TSC. TSC members can also add items to the agenda at the
beginning of each meeting. The meeting chair and the TSC cannot veto or
remove items.
The TSC may invite additional persons to participate in a non-voting
capacity.
The meeting chair is responsible for ensuring that minutes are taken and
archived in the project repository or other designated accessible location.
Due to the challenges of scheduling a global meeting with participants in
several time zones, the TSC will seek to resolve as many agenda items as
possible outside of meetings on the public mailing list or through GitHub
issues, discussions, and pull requests.
+119 -30
View File
@@ -14,66 +14,69 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
### Required dependencies -- OIIO will not build at all without these
* **C++14** (also builds with C++17, and C++20)
* C++14 (also builds with C++17, and C++20)
* The default build mode is C++14. This can be controlled by via the
CMake configuration flag: `-DCMAKE_CXX_STANDARD=17`, etc.
* Compilers: **gcc 6.1 - 11.2**, **clang 3.4 - 13**, **MSVS 2017 - 2019**,
**icc 17+**.
* CMake >= 3.12 (tested through 3.22)
* OpenEXR/Imath >= 2.3 (recommended: 2.4 or higher; tested through 3.1)
* libTIFF >= 3.9 (recommended: 4.0+; tested through 4.3)
* Compilers: gcc 6.1 - 12.1, clang 3.4 - 16, MSVS 2017 - 2019,
Intel icc 17+, **Intel OneAPI C++ compiler 2022+**.
* CMake >= 3.12 (tested through 3.26)
* **OpenEXR/Imath >= 2.3** (recommended: 2.4 or higher; tested through 3.2 and main)
* libTIFF >= 3.9 (recommended: 4.0+; tested through 4.5)
* libjpeg >= 8, or libjpeg-turbo >= 1.1 (tested through jpeg9d and jpeg-turbo
2.1)
* Boost >= 1.53 (recommended: at least 1.66; tested through 1.76)
* Boost >= 1.53 (recommended: at least 1.66; tested through 1.81)
* [fmtlib](https://github.com/fmtlib/fmt) >= 6.1.2 (tested through 10.0). If
not found at build time, this will be automatically downloaded unless the
build sets `-DBUILD_MISSING_FMT=OFF`.
### Optional dependencies -- features may be disabled if not found
* If you are building the `iv` viewer (which will be disabled if any of
these are not found):
* Qt >= 5.6 (tested through 5.15)
* Qt5 >= 5.6 (tested through 5.15) or Qt6 (tested through 6.4)
* OpenGL
* If you are building the Python bindings or running the testsuite:
* Python >= 2.7 (tested against 2.7, 3.7, 3.8, 3.9)
* pybind11 >= 2.4.2 (Tested through 2.9.)
* Python >= 2.7 (tested against 2.7, 3.7, 3.8, 3.9, 3.10, 3.11)
* pybind11 >= 2.4.2 (Tested through 2.11. Note that pybind11 v2.10+ does
not support Python < 3.6.)
* NumPy
* If you want support for camera "RAW" formats:
* LibRaw >= 0.15 (tested 0.15 - 0.20.2; LibRaw >= 0.18 is necessary for
* LibRaw >= 0.15 (tested 0.15 - 0.21.1; LibRaw >= 0.18 is necessary for
ACES support and much better recognition of camera metadata; if
building with C++17 or higher, LibRaw >= 0.20 is necessary)
* If you want support for a wide variety of video formats:
* **ffmpeg >= 3.0** (tested through 5.0)
* ffmpeg >= 3.0 (tested through 6.0)
* If you want support for jpeg 2000 images:
* **OpenJpeg >= 2.0** (tested through 2.4; we recommend 2.4 or higher
* OpenJpeg >= 2.0 (tested through 2.5; we recommend 2.4 or higher
for multithreading support)
* If you want support for OpenVDB files:
* OpenVDB >= 5.0 (tested through 9) and Intel TBB >= 2018 (tested
through 2021)
* Note that OpenVDB 8.0+ requires C++14 or higher.
* OpenVDB >= 5.0 (tested through 10.0)
* If you want to use TBB as the thread pool:
* 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.5)
* OpenCV 3.x, or 4.x (tested through 4.5)
* If you want support for GIF images:
* giflib >= 4.1 (tested through 5.2; 5.0+ is strongly recommended for
stability and thread safety)
* If you want support for HEIF/HEIC or AVIF images:
* libheif >= 1.3 (1.7 required for AVIF support, tested through 1.12)
* libheif >= 1.3 (1.7 required for AVIF support, tested through 1.16)
* libheif must be built with an AV1 encoder/decoder for AVIF support.
* Avoid libheif 1.10 on Mac, it is very broken. Libheif 1.11 is fine.
* If you want support for DDS files:
* libsquish >= 1.13 (tested through 1.15)
* But... if not found on the system, an embedded version will be used.
* Avoid libheif 1.10 on Mac, it is very broken. Libheif 1.11+ is fine.
* If you want support for DICOM medical image files:
* DCMTK >= 3.6.1 (tested through 3.6.5)
* DCMTK >= 3.6.1 (tested through 3.6.7)
* If you want support for WebP images:
* WebP >= 0.6.1 (tested through 1.2.1)
* WebP >= 0.6.1 (tested through 1.3.1)
* If you want support for OpenColorIO color transformations:
* OpenColorIO >= 1.1 (tested through 2.1; 2.0+ is recommended)
* OpenColorIO >= 1.1 (tested through 2.3; 2.0+ is recommended)
* If you want support for Ptex:
* Ptex >= 2.3.1 (probably works for older; tested through 2.4.0)
* 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:
* Freetype (minimum unknown, tested 2.8 through 2.13)
* We use PugiXML for XML parsing. There is a version embedded in the OIIO
tree, but if you want to use an external, system-installed version (as
may be required by some software distributions with policies against
embedding other projects), then just build with `-DUSE_EXTERNAL_PUGIXML=1`.
Any PugiXML >= 1.8 should be fine (we have tested through 1.11).
Any PugiXML >= 1.8 should be fine (we have tested through 1.13).
@@ -85,7 +88,7 @@ installed on your system, you can get it from http://www.cmake.org
If certain dependencies (robin-map and fmtlib) are not found, their sources
will be retrieved and built into libraries, as part of the build process. The
sources of those dependences are cloned from their Git repo, hence `git` must
sources of those dependencies are cloned from their Git repo, hence `git` must
be available as a command.
After you build OpenImageIO, if you compiled with the `EMBEDPLUGINS=0` flag
@@ -105,6 +108,8 @@ build options), maybe one of these packages managers will do it for you:
* https://github.com/Microsoft/vcpkg/tree/master/ports/openimageio
* `vcpkg install openimageio [tools]`
* For a full list of supported build features: `vcpkg search openimageio`
* Instructions for building a Python wheel on Windows:
https://github.com/Correct-Syntax/py-oiio
* homebrew (https://github.com/Homebrew/brew)
* https://formulae.brew.sh/formula/openimageio
* `brew install openimageio`
@@ -265,8 +270,92 @@ Building on Windows
**Method 1 - from source**
I really need someone to write correct, modern docs about how to build
from source on Windows.
You will need to have Git, CMake and Visual Studio installed.
The minimal set of dependencies for OIIO is: Boost, zlib, libTIFF, OpenEXR, and libjpeg or libjpeg-turbo. If you have them built somewhere then you skip
the section below, and will only have to point OIIO build process so their locations.
* Boost: get the boost source archive, extract into `{BOOST_ROOT}`.
```
cd {BOOST_ROOT}
bootstrap
b2
```
* zlib: this will build it, and then delete the non-static library, so they don't get picked up:
```
cd {ZLIB_ROOT}
git clone https://github.com/madler/zlib .
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..
cmake --build . --config Release --target install
del lib\zlib.lib
```
* libTIFF:
```
cd {TIFF_ROOT}
git clone https://gitlab.com/libtiff/libtiff.git .
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=. ..
cmake --build . --target install
```
* libjpeg-turbo:
```
cd {JPEG_ROOT}
git clone https://github.com/libjpeg-turbo/libjpeg-turbo .
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX=. ..
cmake --build . --config Release --target install
```
* OpenEXR: you'll have to point it to your `{ZLIB_ROOT}` location from the above. If copy-pasting the multi-line command (with lines ending in `^`) into
cmd.exe prompt, make sure to copy all the lines at once.
```
cd {EXR_ROOT}
git clone https://github.com/AcademySoftwareFoundation/openexr .
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=dist ^
-DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DOPENEXR_BUILD_TOOLS=OFF ^
-DOPENEXR_INSTALL_TOOLS=OFF -DOPENEXR_INSTALL_EXAMPLES=OFF ^
-DZLIB_ROOT={ZLIB_ROOT}\build ..
cmake --build . --target install --config Release
```
Now get the OIIO source and do one-time CMake configuration step. Replace `{*_ROOT}` below with folders where you have put the 3rd party
dependencies.
```
cd {OIIO_ROOT}
git clone https://github.com/OpenImageIO/oiio .
mkdir build
cd build
cmake -DVERBOSE=ON -DCMAKE_BUILD_TYPE=Release ^
-DBoost_USE_STATIC_LIBS=ON -DBoost_NO_WARN_NEW_VERSIONS=ON -DBoost_ROOT={BOOST_ROOT} ^
-DZLIB_ROOT={ZLIB_ROOT}\build ^
-DTIFF_ROOT={TIFF_ROOT}\build ^
-DOpenEXR_ROOT={EXR_ROOT}\build\dist ^
-DImath_DIR={EXR_ROOT}\build\dist\lib\cmake\Imath ^
-DJPEG_ROOT={JPEG_ROOT}\build ^
-DUSE_PYTHON=0 -DUSE_QT=0 -DBUILD_SHARED_LIBS=0 -DLINKSTATIC=1 ..
```
This will produce `{OIIO_ROOT}/build/OpenImageIO.sln` that can be opened in Visual Studio IDE. Note that the solution will be
only for the Intel x64 architecture only; and will only target "min-spec" (SSE2) SIMD instruction set.
Optional packages that OIIO can use (e.g. libpng, Qt) can be build and pointed to OIIO build process in a similar way.
In Visual Studio, open `{OIIO_ROOT}/build/OpenImageIO.sln` and pick Release build configuration. If you pick Debug, you
might need to re-run the CMake command above with `-DCMAKE_BUILD_TYPE=Debug` and also have all the dependencies above built
with `Debug` config too.
The main project that builds the library is `OpenImageIO`. The library is built into `{OIIO_ROOT}/build/lib/{CONFIG}` folder.
The various OIIO command line tools (`oiiotool`, `iconvert` etc.) are projects under Tools subfolder in VS IDE solution explorer.
They all build into `{OIIO_ROOT}/build/bin/{CONFIG}` folder.
There's a `CMakePredefinedTargets/INSTALL` project that you can build to produce a `{OIIO_ROOT}/dist` folder with `bin`, `include`,
`lib`, `share` folders as an OIIO distribution.
The instructions above use options for building statically-linked OIIO library and tools. Adjust options passed to CMake to
produce a dynamic-linked version.
**Method 2 - Using vcpkg**
+27
View File
@@ -0,0 +1,27 @@
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.
+196 -22
View File
@@ -1,27 +1,201 @@
Copyright (c) 2008-present by Contributors to the OpenImageIO project.
All Rights Reserved.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
1. Definitions.
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.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
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.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
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.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+18 -4
View File
@@ -8,8 +8,8 @@
#
# Run 'make help' to list helpful targets.
#
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
#########################################################################
@@ -187,6 +187,10 @@ MY_CMAKE_FLAGS += -G Ninja
BUILDSENTINEL := build.ninja
endif
ifneq (${UNITY},)
MY_CMAKE_FLAGS += -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_MODE=${UNITY}
endif
ifeq (${CODECOV},1)
CMAKE_BUILD_TYPE=Debug
MY_CMAKE_FLAGS += -DCODECOV:BOOL=${CODECOV}
@@ -308,7 +312,16 @@ test: build
cd ${build_dir} ; \
lcov -b . -d . -c -o cov.info ; \
lcov --remove cov.info "/usr*" -o cov.info ; \
genhtml -o ./cov -t "Test coverage" --num-spaces 4 cov.info ; \
lcov --remove cov.info "*/usr/incude" -o cov.info ; \
lcov --remove cov.info "/Library/Developer/*" -o cov.info ; \
lcov --remove cov.info "*/detail/pugixml/*" -o cov.info ; \
lcov --remove cov.info "*/detail/fmt/*" -o cov.info ; \
lcov --remove cov.info "*/detail/farmhash.h" -o cov.info ; \
lcov --remove cov.info "*/v1/*" -o cov.info ; \
lcov --remove cov.info "*/ext/robin-map/*" -o cov.info ; \
lcov --remove cov.info "*/kissfft.hh" -o cov.info ; \
lcov --remove cov.info "*/stb_sprintf.h" -o cov.info ; \
genhtml -o ../_coverage -t "Test coverage" --num-spaces 4 cov.info ; \
fi )
# 'make testall' does a full build and then runs all tests (even the ones
@@ -362,6 +375,7 @@ help:
@echo " EXTRA_CPP_ARGS= Additional args to the C++ command"
@echo " USE_NINJA=1 Set up Ninja build (instead of make)"
@echo " USE_CCACHE=0 Disable ccache (even if available)"
@echo " UNITY=BATCH Do a 'Unity' build (BATCH or GROUP or nothing)"
@echo " CODECOV=1 Enable code coverage tests"
@echo " SANITIZE=name1,... Enable sanitizers (address, leak, thread)"
@echo " CLANG_TIDY=1 Run clang-tidy on all source (can be modified"
@@ -369,7 +383,7 @@ help:
@echo " CLANG_FORMAT_INCLUDES=... CLANG_FORMAT_EXCLUDES=..."
@echo " Customize files for 'make clang-format'"
@echo " Linking and libraries:"
@echo " SOVERSION=nn Include the specifed major version number "
@echo " SOVERSION=nn Include the specified major version number "
@echo " in the shared object metadata"
@echo " OIIO_LIBNAME_SUFFIX=name Optional name appended to library names"
@echo " BUILD_SHARED_LIBS=0 Build static library instead of shared"
+21 -14
View File
@@ -1,7 +1,8 @@
README for OpenImageIO
======================
<p align="center">
<img src="ASWF/logos/openimageio-horizontal-gradient.png">
</p>
[![License](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md)
[![License](https://img.shields.io/badge/license-Apache2.0-blue.svg?style=flat-square)](https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md)
[![CI](https://github.com/OpenImageIO/oiio/actions/workflows/ci.yml/badge.svg)](https://github.com/OpenImageIO/oiio/actions/workflows/ci.yml)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2694/badge)](https://bestpractices.coreinfrastructure.org/projects/2694)
@@ -67,10 +68,13 @@ Licensing
OpenImageIO is (c) Copyright Contributors to the OpenImageIO project.
OpenImageIO is distributed using the [modified BSD license](LICENSE.md)
(also known as the "new BSD" or "3-clause BSD" license). The documentation
is licensed under the [Creative Commons Attribution 3.0 Unported
License](http://creativecommons.org/licenses/by/3.0/).
OpenImageIO is distributed using primarily the Apache 2.0 license -- see the
[LICENSE.md](LICENSE.md) file for details. The documentation is licensed
under the [Creative Commons Attribution 4.0 Unported
License](http://creativecommons.org/licenses/by/4.0/). A small amount of code
imported from other projects, and also some pre-July-2023 code that has not
yet been relicensed under Apache-2.0, is covered by other compatible licenses
-- see [THIRD-PARTY](THIRD-PARTY.md) file for details.
The plain English bottom line is that OpenImageIO is free, as well as
freely modifiable and redistributable (in both source and binary form).
@@ -110,7 +114,7 @@ Contact & reporting problems
Simple "how do I...", "I'm having trouble", or "is this a bug" questions are
best asked on the [oiio-dev developer mail
list](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org).
list](https://lists.aswf.io/g/oiio-dev).
That's where the most people will see it and potentially be able to answer
your question quickly (more so than a GH "issue").
@@ -127,7 +131,7 @@ security-related issues [security@openimageio.org](security@openimageio.org).
Contributing
------------
OpenImageIO welcomes code contributions, and [nearly 150 people](CREDITS.md)
OpenImageIO welcomes code contributions, and [nearly 200 people](CREDITS.md)
have done so over the years. We take code contributions via the usual GitHub
pull request (PR) mechanism. Please see [CONTRIBUTING](CONTRIBUTING.md) for
detailed instructions.
@@ -136,12 +140,15 @@ detailed instructions.
Web Resources
-------------
Main web page: http://www.openimageio.org
* Main web page: http://www.openimageio.org
GitHub page: http://github.com/OpenImageIO/oiio
* GitHub page: http://github.com/OpenImageIO/oiio
Mail list subscriptions and archives:
* Developer mail list subscriptions and archives:
https://lists.aswf.io/g/oiio-dev
* Developer mail list: http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
* ASWF Slack: https://slack.aswf.io
(look for the `#openimageio` channel)
* Just release announcements: http://lists.openimageio.org/listinfo.cgi/oiio-announce-openimageio.org
* Biweekly TSC meetings are on the ASWF Calendar: https://www.aswf.io/meeting-calendar/
(click on the OpenImageIO meeting entries, every second Monday, to get the Zoom link, anyone may join)
+352
View File
@@ -0,0 +1,352 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the OpenImageIO Project. -->
# Release Procedures for OpenImageIO
## Version nomenclature and release cadence
### The meaning of the version parts
Our release numbers are of the form `MAJOR.MINOR.PATCH.TWEAK`, and we follow
an almost-semantic-versioning scheme.
MAJOR changes are those that break backward-compatibility of the public APIs,
requiring existing application code to change their source code where it calls
OIIO API functions in order to compile and work correctly.
MINOR changes guarantee API backward-compatibility with prior releases that
have the same major number, but can introduce ABI or link incompatibilities.
Applications using OIIO need to be recompiled to move to a new minor release,
but should not need to change their source code. Minor releases are allowed
to drop support for sufficiently old compilers and dependencies.
PATCH changes guarantee both API and ABI/link backward-compatibility with
prior releases that have the same minor number. Features and new public API
calls may be added (thus deviating from strict semantic versioning), but only
if they preserve ABI/link compatibility. This means that standalone functions
or static methods may be added, but existing functions will not change their
parameters, and no new virtual methods or struct data layouts change for patch
releases (for classes in public header files). Application code can be
re-linked to a new patch release without needing to be recompiled. We also
guarantee that any compilers or dependencies supported for the first release
of a minor series will continue to be supported for all patches to that minor
series.
TWEAK changes are restricted to critical bug fixes or build breaks that do
not alter public APIs in any way.
### Cadence of releases
Major (arbitrarily incompatible) releases happen rarely, usually with multiple
years between them.
Minor (API backward-compatible) releases are scheduled annually, targeted at
late summer (SIGGRAPH time) to be in beta, and early autumn for a full
release.
Patch (API and ABI backward-compatible) releases are scheduled monthly,
usually aiming for the first day of each month.
Tweak (fully forward and backward compatible) releases are not regularly
scheduled, and only happen sporadically, when a critical fix is needed in
between scheduled patch releases.
### Things are different in "master"
The "master" branch is where ongoing development occurs without any
compatibility guarantees. We don't always know if the next year's release from
master will turn out to be major (API breaking) or minor (only ABI breaking).
Some studios or products need the most up-to-date enhancements, and thus tend
to build OIIO from the "master" branch rather than using tagged releases. For
these users, we try to set version numbers and occasionally tag in master, to
send a signal about which points in master seem safe to rely on various
compatibility levels. However, the rules are slightly different than we use
for releases.
In the "master" branch:
- TWEAK changes within "master" only guarantee ABI back-compatibility, but may
have additions or non-bug-fix behavior changes (akin to patch releases
within a release branch).
- PATCH changes within "master" are allowed to break ABI or API (changes that
would require minor or major releases, if they were not in "master").
- Beware of unmarked breaks in compatibility of commits in master that are
in between developer preview tags.
---
## Branch and tag names
**Branches** are places where commits containing new development may be added
(and thus the branch markers will move over time). Branch names obey the
following conventions:
- `master` is the area for arbitrary changes intended for the next year's
major or minor release.
- `dev-1.2` are the areas for staging additions to the next month's patch
release for the designated minor version series.
- `release` is a special branch marker that is always set to the latest tag of
the currently supported, stable release family. People can count on
"release" always being the latest stable release, whatever that may be at
the time.
**Tags** indicate releases or developer previews, and once a commit is
tagged, it is permanent and will never be moved. Tag names obey the following
conventions:
- `v1.2.3.4` is a specific public stable release, corresponding to official
major, minor, public, or tweak releases.
- `v1.2.3.4-alpha`, `v1.2.3.4-beta`, or `v1.2.3.4-RC1` are pre-releases for an
upcoming public stable release, at the alpha, beta, or release candidate
stages, respectively.
- `v1.2.3.4-dev` is a "developer preview" within "master." It is not an official
supported release, and while the numbering may indicate compatibility versus
other recent developer previews, they should not be assumed to be compatible
with any prior official stable releases.
*Very* occasionally, other branch or tag names (with custom suffixes or
different naming schemes) may be used for special purposes by particular
developers or users, but should not be considered reliable or permanent, and
in general should be ignored by anyone who didn't make the tag or branch.
---
## Release Procedures
### Soft freeze for monthly tweak releases:
We freely backport *safe*, non-ABI-breaking changes by cherry-picking them
from master to the supported branch continually throughout most of the month.
In the seven days before the new month, we do a "soft freeze" where only
important bug fixes are backported. Hold on to any other patches you wish to
backport until after the monthly patch release (i.e., save them for the next
month's release so you never have a release that contains changes that are
only a few days old, and therefore not as well tested). You may, of course,
continue to backport fixes to documentation or other non-code parts of the
project during this soft freeze.
### Branching for annual major/minor releases
By mid-June (about 1-2 months before the beta of a new annual big release),
you should branch and mark it as an alpha.
At the tip of "master", create a new branch named `dev-MAJOR.MINOR` that will
be the staging area for the next release.
Customarily, at that point we add a commit to master (but not to the new
dev-MAJ.MIN branch) that bumps master's version to the next minor level, to
avoid any confusion between builds from master versus what will be the next
release branch. This starts the divergence between master and the release
branch, and henceforth, any big or compatibility-breaking changes will only be
committed to master and not backported to the release branch. (Though we are
loose about this rule during the alpha period and allow continued breaking
changes in the alpha, but by the time we call it beta, we allow no more
breaking changes.) Also at this stage, the master branch's CHANGES.md should
have a heading added at the top for the *next* version.
### Prior to a release
1. Update CI dependencies: Ensure that the "latest" CI test specifies the
current releases of the dependencies and compilers (check their home
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
all the new features and fixes. Looking at the notes from older releases
should provide a good example of what we're aiming for.
- Patch and tweak releases can be brief one-line descriptions (often the
first line of the commit messages involved), presented in a single
section in either chronological or any other order that seems right.
- Minor or major releases have a much more extensive, prose-based
description of all changes since the last minor release, broken into
sections (dependency changes, major new features, enhancements and fixes,
internals and developer goodies, testing/CI/ports, etc.) and ordered for
readability and relevance.
3. Ensure docs are up to date:
- Actually read the [README.md](README.md), [INSTALL.md](INSTALL.md),
and other repository docs and make sure all the information is up to
date. Check the [CREDITS.md](CREDITS.md) against the recent repo history
to be sure new contributors are listed.
- Skim the primary user documentation to look for any obvious errors,
especially the parts that describe new features.
- If we are using any online docs (like readthedocs), make sure it is
building and looks correct on the web site.
4. 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
"beta" if appropriate, "RC" for release candidate, or empty string `""`
for most supported releases, and "dev" only for the master branch or
developer previews.
- The `${PROJECT_NAME}_SUPPORTED_RELEASE` variable should be `ON` for any
release branch, `OFF` for master.
5. In the https://github.com/OpenImageIO/oiio-images project, create a branch
`RB-x.y` for the major/minor branch, and in the main oiio repo, update
src/build-scripts/install_test_images.bash to specify `-b RB-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
weekly "analysis" workflows to make sure there aren't any important
warnings that should be fixed.
### Staging alpha / beta / release candidate (annual minor/major releases only)
For monthly patch releases, we don't have any formal alpha/beta/RC stages.
For the annual minor or major releases we have a staged release:
- `alpha` is everything after we have branched, in which we think all the big
new features have been added, and while we will make continued changes and
fixes, we are aiming for increased stability and to minimize additional
breaking changes prior to the release.
- `beta` should be about one month prior to the final release date. We create
a tag `v1.2.3.4-beta` and announce the beta (see below "Making the
release"). Once we tag a beta, we try very hard not to allow any further
changes that change the API or are not ABI-compatible (i.e., safe fixes
only).
- `RC` or release candidates around one week prior to the final release date.
This is a trial run, hopefully identical to the final release (except for
removing the RC label and making a new tag). The only changes allowed after
RC are fixes to the most critical bugs or build breaks that would be bad for
users to encounter. If critical problems are found with RC1, they should be
fixed and immediately re-tagged as RC2, etc. All other fixes should be
postponed until the next month's patch release.
### Making the release
A final release is made on the scheduled date, provided the latest RC has
survived for at least a few days of testing without finding any critical
problems. Don't make the release final until you are sure there are no
truly critical bugs or build breaks that users will encounter.
The following are the steps for making the release:
1. Edit the top-level CMakeLists.txt to remove any RC designation
(i.e., `PROJECT_VERSION_RELEASE_TYPE` should be set to `""`).
2. Edit CHANGES.md to reflect the correct date of the release and ensure it
includes any last-minute changes that were made during beta or release
candidate stages.
3. Push it to **your** GitHub, make sure it passes CI.
4. Tag the release: `git tag v1.2.3.4` (no more beta, RC, or dev suffix).
5. If this will now be the recommended stable release, move the `release`
branch marker to the same position.
6. Push it to GitHub: `git push OpenImageIO release --tags`
(This example assumes "OpenImageIO" is the name of the remote for the
GitHub `OpenImageIO/oiio` repo.)
7. Draft a release on GitHub: On https://github.com/OpenImageIO/oiio/releases
select "Draft a new release." Choose the new tag you just pushed. Make the
release title "OpenImageIO v1.2.3.4" (and beta, etc., designation
if applicable). In the description, paste the release notes for this
release (from CHANGES.md). If this is a beta or release candidate, check
"this is a pre-release" box at the bottom.
8. Announce the release on the [oiio-dev mail list](https://lists.aswf.io/g/oiio-dev)
with the subject "Release: OpenImageIO v1.2.3.4" and using one of these
templates for the body of the email.
For a monthly patch release:
> We have tagged v1.2.3.4 as the latest production release and moved the
> "release" branch marker to that point. This is guaranteed to be API,
> ABI, and link back-compatible with prior 1.2 releases. Release notes
> are below.
>
> (Paste the full set of 1.2 changes here, just copy the appropriate
> part of CHANGES.md)
For an annual major/minor release:
> OpenImageIO version 1.2 has been released! Officially tagged as
> "v1.2.3.4", we have also moved the "release" branch tag to this
> position. Henceforth, 1.2 is the supported production release family.
> The API is now frozen -- we promise that subsequent 1.2.x releases
> (which should happen monthly) will not break back-compatibility of API,
> ABI, or linkage, compared to this release. Please note that this release
> is *not* ABI or link compatible with 1.1 or older releases.
>
> Release notes for 1.2 outlining all the changes since last year's
> release are below.
>
> Please note that a few of the build and runtime dependencies have
> changed their minimum supported versions. (List here any important
> changes to dependencies, compilers, or C++ standard that users should be
> aware of.)
>
> (List here anything else that people should know about this release
> family that may be surprising if they haven't followed the last year of
> development closely, or that they must know even if they are too lazy to
> read the release notes. If this is a major release that is not
> backward-compatible with prior versions, warn about that here.)
>
> Enjoy, and please report any problems. We will continue to make patch
> releases to the 1.2 family roughly monthly, which will contain bug fixes
> and non-breaking enhancements.
>
> The older 1.1 series of releases is now considered obsolete. We will
> continue for now to make 1.1 patch releases, but over time, these will
> become less frequent and be reserved for only the most critical bug
> fixes.
>
> The "master" branch is now progressing toward an eventual 1.3 release next
> summer. As usual, you are welcome to use master for real work, but we do
> not make any compatibility guarantees and don't guarantee continuing API
> compatibility in master.
>
> (Paste the full set of 1.2 changes here, just copy the appropriate
> part of CHANGES.md)
For a beta leading up to the annual major/minor release:
> OpenImageIO version 1.2 is now in beta, tagged as "v1.2.3.4-beta". We
> will try very hard not to make any further API or ABI changes between
> now and the final release (unless it is absolutely necessary to fix
> an important problem identified during beta testing). The final 1.2
> release is scheduled for [DATE GOES HERE], so please try building and
> testing the beta so we are sure to find any problems.
>
> Release notes for 1.2 outlining all the changes since last year's
> release are below.
>
> (Paste the full set of 1.2 changes here, just copy the appropriate
> part of CHANGES.md)
### After the release
Odds and ends to do after the tag is pushed and the announcements are sent:
- Re-read RELEASING.md and ensure that the instructions match what you
have done. Update as necessary.
- Go to readthedocs.org, and ensure that the new release is built and visible
and is the default release shown (specified in the Admin section). I tend to
keep the latest patch of each minor release available for reference
indefinitely, but hide the docs for earlier patch releases within that minor
release series.
- Edit the top-level CMakeList.txt to update the version to the *next*
anticipated release on the branch, in order to ensure that anybody building
from subsequent patches won't get a release number that advertises itself
incorrectly as a prior tagged release. Also edit CHANGES.md to add a new
(blank) heading for the next patch or release.
+151
View File
@@ -0,0 +1,151 @@
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.
The following copyright holders agree that all of their contributions
originally submitted to this project under the 3-Clause BSD License are hereby
relicensed to the Apache License, Version 2.0, and are submitted pursuant to
the Developer Certificate of Origin, version 1.1:
- Larry Gritz (@lgritz)
- Chris Kulla (fpsunflower)
- Brecht Van Lommel (brechtvl)
- Daniel Flehner Heen (apetrynet)
- Daniel Wyatt (dewyatt)
- Aras Pranckevičius (aras-p)
- Leszek Godlewski (inequation)
- Dalai Felinto (dfelinto)
- Jesse Yurkovich (jessey-git)
- Sergey Sharybin (sergeyvfx)
- Ray Molenkamp (LazyDodo)
- Nathan Rusch (nrusch)
- Ismael Cortes (leamsi)
- AdamMainsTL
- Sony Pictures Imageworks (cmstein, olegul, fpsunflower, brianhall77, jeremyselan, drg, richardssam, lecocqp)
- Richard Shaw (hobbes1069)
- Robert Matusewicz
- Mariusz Szczepańczyk (mszczepanczyk)
- Scott Wilson
- Kevin Brightwell (Nava2)
- Simon Boorer
- Alex Hughes (Ahuge)
- Alister Chowdhury
- Manuel Leonhardt (skycaptain)
- Alexandre Gauthier (MrKepzie)
- Mark Boorer (shootfast)
- Povilas Kanapickas (p12tic)
- Mikael Sundell
- Roman Zulak (marsupial)
- Autodesk (includes Thiago Ize, Elvic Liang, Wayne Arnold, William Krick, Brecht Van Lommel, Marcos Fajardo)
- Thiago Ize
- Nick Black (dankamongmen)
- Michel Lerenard (micler)
- Stefan Bruens (StefanBruens)
- David Gordon
- Claire Foster (c42f)
- Konrad Kleine (kwk)
- Simone Gasparini (simogasp)
- Radu Arjocu (ra-mt)
- Dominik Bartkiewicz (fafik23)
- 360highdynamicrangehdr (?)
- Leonid Onokhov (sopvop)
- Nuno Cardoso (npcardoso)
- Todica Ionut (360highdynamicrangehdr)
- Till Dechent (ttddee)
- Tom Knowles (knowlsie)
- SRHMorris
- Biswapriyo Nath (Biswa96)
- Edoardo Dominici (dedoardo)
- Frédéric Devernay (devernay)
- Simone Gasparini (simogasp)
- roelandschoukens
- Nayden Dochev (nayyden)
- Yann Lanthony (yann-lty)
- Benjamin Buch (bebuch)
- Joris Nijs (joris-nijs)
- Jan Honsbrok (Latios96)
- Matteo F. Vescovi (mfvescovi)
- Patrick Northon (patlefort)
- Eric Mehl (ericmehl)
- Xo Wang (GHF)
- etiam
- Fabien Servant (servantftechnicolor)
- Loïc Vital (mugulmd)
- Thomas Mansencal (Wētā FX)
- Brent Davis (btdavis)
- pwm1234-sri
- toxieainc
- demoulinv
- Julien Enche (jenche)
- Justin Israel
- xiaoxiaoafeifei
- Brad Smith (brad0)
- lmarz
- Seifeddine Dridi (seifeddinedridi)
- Daniel Dresser (danieldresser)
- Luc Bournaud (DevilishSpirits)
- Dennis Schridde (devurandom)
- Dieter De Baets (debaetsd)
- Gonzalo Garramuño (ggarra13)
- Alan Jones (@skyphyr)
- pumkinpal
- Christopher Crosetto (ccrosetto)
- Russell Greene (russelltg)
- Sam Richards (richardssam)
- Guillaume Chatelet (gchatelet)
- extrowerk
- Heiko Becker (heirecka)
- Mark Visser (mjmvisser)
- Harry Mallon (hjmallon)
- Henri Fousse (darkhorse64)
- Krzysztof Blicharski (blicharski)
- Hugh Macdonald (HughMacdonald)
- Pascal Lecocq (lecocqp)
- Ramon Montoya Vozmediano (rmv)
- Dan Wexler (danwexler)
- Jérôme Duval (korli)
- Tim Grant (timgrant)
- Shane Ambler (sambler)
- Wētā
- Kimball Thurston (kdt3rd)
- Anders Langlands (anderslanglands)
- Алексей (Alexpux)
- Fabien Castan (fabiencastan)
- Grégoire De Lillo (gregoire-dl)
- Edgar Velázquez-Armendáriz (edgarv)
- Malcolm Humphreys (malcolmhumphreys)
- johnfea
- Max Liani (maxliani)
- Michael Görner (v4hn)
**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
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.**
---
Here are the instructions we have been given by the Linux Foundation for how
to document the contents of each file:
a. Files that consist of only contributions made entirely by companies that
have submitted PRs as described above can have, once those PRs are merged,
the BSD-3-Clause license information replaced with Apache-2.0 license
information.
b. Files that contain contributions made after the change to the Apache-2.0
license as the license for the project should include only the Apache-2.0
license information.
c. Files that contain contributions made both before the Apache-2.0 license
change and after the Apache-2.0 license change should include both
BSD-3-Clause and Apache-2.0 license information. The SPDX identifier for
these files is “BSD-3-Clause and Apache-2.0”.
d. Files that contain only contributions made prior to the Apache-2.0 license
change should continue to include BSD-3-Clause license information (e.g.,
no changes to BSD-3-Clause information included in those files).
+25
View File
@@ -0,0 +1,25 @@
# Security Policy
## Supported Versions
This gives guidance about which branches are supported with patches to
security vulnerabilities.
| Version / branch | Supported |
| ----------------- | ---------------------------------------------------- |
| master | :white_check_mark: :construction: ALL fixes immediately, but this is a branch under development with a frequently unstable ABI and occasionally unstable API. |
| 2.4.x | :white_check_mark: All fixes that can be backported without breaking ABI compatibility. New tagged releases monthly. |
| 2.3.x | :x: Only receives occasional critical fixes, upon request. |
| <= 2.2.x | :x: No longer receiving patches of any kind. |
## Reporting a Vulnerability
If you think you've found a potential vulnerability in OpenImageIO, please
report it by emailing security@openimageio.org. Only the project administrators
have access to these messages. Include detailed steps to reproduce the issue,
and any other information that could aid an investigation. Our policy is to
respond to vulnerability reports within 14 days.
Our policy is to address critical security vulnerabilities rapidly and post
patches as quickly as possible.
+17 -6
View File
@@ -1,5 +1,5 @@
See [LICENSE.md](LICENSE.md) for the main open source license of original
code written for the OpenImageIO project.
code written for the OpenImageIO project, which is the Apache-2.0 license.
The remainder of this file reproduces the open source licensing details
of other projects that have been imported, incorporated into, or derived
@@ -12,6 +12,13 @@ In no particular order:
BSD 3-Clause License
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).
* Gelato, Copyright (c) 2004 by NVIDIA Corp.
The initial (version 0.1) code found in imageio.h, fmath.h, filter.h,
@@ -34,6 +41,11 @@ SPDX-License-Identifier: BSD-3-Clause
The sample OpenColorIO configurations in our testsuite are borrowed from
this ASWF project, also BSD-3-Clause licensed.
* OpenEXR/Imath (c) Copyright contributors to the OpenEXR Project.
https://github.com/AcademySoftwareFoundation/Imath
Some templates in vecparam.h were first developed for Imath.
* DPX reader/writer (c) Copyright 2009 Patrick A. Palmer.
https://github.com/patrickpalmer/dpx
@@ -109,10 +121,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MIT License
SPDX-License-Identifier: MIT
* Squish
Copyright 2006 Simon Brown si@sjbrown.co.uk
http://sjbrown.co.uk/?code=squish
* PugiXML http://pugixml.org/ https://github.com/zeux/pugixml
Copyright (c) 2006-2018 Arseny Kapoulkine
@@ -249,6 +257,9 @@ SPDX-License-Identifier: Unlicense
* gif.h by Charlie Tangora. Public domain / Unlicense.
https://github.com/ginsweater/gif-h
* bcdec.h by Sergii "iOrange" Kudlai. MIT or Unlicense.
https://github.com/iOrange/bcdec
This is free and unencumbered software released into the public domain.
@@ -282,7 +293,7 @@ Public domain
* lookup3 code by Bob Jenkins, Public Domain.
http://burtleburtle.net/bob/c/lookup3.c
* The SHA-1 implemenation we use is public domain by Dominik Reichl.
* The SHA-1 implementation we use is public domain by Dominik Reichl.
http://www.dominik-reichl.de
-------------------------------------------------------------------------
-1
View File
@@ -23,7 +23,6 @@ tbb/2020.0
# openvdb
# ptex
# qt5
# libsquish
[generators]
+12 -6
View File
@@ -222,12 +222,18 @@ else ifeq (${platform}, macosx)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER},clang9)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@9/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@9/bin/clang++
else ifeq (${COMPILER},clang11)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@11/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@11/bin/clang++
else ifeq (${COMPILER},clang13)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@13/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@13/bin/clang++
else ifeq (${COMPILER},clang14)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@14/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@14/bin/clang++
else ifeq (${COMPILER},clang15)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@15/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@15/bin/clang++
else ifeq (${COMPILER},clang16)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@16/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@16/bin/clang++
else ifeq (${COMPILER},clang)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
else ifeq (${COMPILER},gcc)
+25
View File
@@ -0,0 +1,25 @@
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# Copyright Contributors to the OpenImageIO Project.
sonar.host.url=https://sonarcloud.io
# Required metadata
sonar.organization=openimageio
sonar.projectName=OpenImageIO
sonar.projectVersion=1.0
sonar.projectKey=OpenImageIO_oiio
# Source properties
sonar.sources=src
sonar.exclusions=src/doc/**,src/include/OpenImageIO/detail/pugixml/**,src/libutil/stb_sprintf.h,src/libutil/xxhash.cpp,src/include/OpenImageIO/detail/farmhash.h,src/libutil/farmhash.cpp
sonar.sourceEncoding=UTF-8
# C/C++ analyzer properties
sonar.cfamily.build-wrapper-output=build/bw_output
sonar.cfamily.gcov.reportsPath=_coverage
sonar.coverage.exclusions=src/iv/**,src/include/OpenImageIO/detail/pugixml/**,src/include/OpenImageIO/detail/fmt/**,src/libOpenImageIO/kissfft.hh
sonar.cfamily.cache.enabled=true
sonar.cfamily.cache.path=/tmp/sonarcache
sonar.verbose=false
+2 -2
View File
@@ -1,5 +1,5 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
add_oiio_plugin (bmpinput.cpp bmpoutput.cpp bmp_pvt.cpp)
+25 -15
View File
@@ -1,5 +1,5 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
@@ -70,8 +70,8 @@ BmpFileHeader::isBmp() const
case MAGIC_CI:
case MAGIC_CP:
case MAGIC_PT: return true;
default: return false;
}
return false;
}
@@ -92,7 +92,8 @@ DibInformationHeader::read_header(Filesystem::IOProxy* fd)
if (!fread(fd, &size))
return false;
if (size == WINDOWS_V3 || size == WINDOWS_V4 || size == WINDOWS_V5) {
if (size == WINDOWS_V3 || size == WINDOWS_V4 || size == WINDOWS_V5
|| size == UNDOCHEADER52 || size == UNDOCHEADER56) {
if (!fread(fd, &width) || !fread(fd, &height) || !fread(fd, &cplanes)
|| !fread(fd, &bpp) || !fread(fd, &compression)
|| !fread(fd, &isize) || !fread(fd, &hres) || !fread(fd, &vres)
@@ -100,16 +101,25 @@ DibInformationHeader::read_header(Filesystem::IOProxy* fd)
return false;
}
if ((size == WINDOWS_V3 && bpp == 16 && compression == 3)
|| size == WINDOWS_V4 || size == WINDOWS_V5 || size == UNDOCHEADER52
|| size == UNDOCHEADER56) {
if (!fread(fd, &red_mask) || !fread(fd, &green_mask)
|| !fread(fd, &blue_mask)) {
return false;
}
if (size != UNDOCHEADER52 && !fread(fd, &alpha_mask)) {
return false;
}
}
if (size == WINDOWS_V4 || size == WINDOWS_V5) {
if (!fread(fd, &red_mask) || !fread(fd, &blue_mask)
|| !fread(fd, &green_mask) || !fread(fd, &alpha_mask)
|| !fread(fd, &cs_type) || !fread(fd, &red_x)
|| !fread(fd, &red_y) || !fread(fd, &red_z)
|| !fread(fd, &green_x) || !fread(fd, &green_y)
|| !fread(fd, &green_z) || !fread(fd, &blue_x)
|| !fread(fd, &blue_y) || !fread(fd, &blue_z)
|| !fread(fd, &gamma_x) || !fread(fd, &gamma_y)
|| !fread(fd, &gamma_z)) {
if (!fread(fd, &cs_type) || !fread(fd, &red_x) || !fread(fd, &red_y)
|| !fread(fd, &red_z) || !fread(fd, &green_x)
|| !fread(fd, &green_y) || !fread(fd, &green_z)
|| !fread(fd, &blue_x) || !fread(fd, &blue_y)
|| !fread(fd, &blue_z) || !fread(fd, &gamma_x)
|| !fread(fd, &gamma_y) || !fread(fd, &gamma_z)) {
return false;
}
}
@@ -121,7 +131,7 @@ DibInformationHeader::read_header(Filesystem::IOProxy* fd)
}
}
} else if (size == OS2_V1) {
// some of theses fields are smaller than in WINDOWS_Vx headers,
// some of these fields are smaller than in WINDOWS_Vx headers,
// so we read into 16 bit ints and copy.
uint16_t width16 = 0;
uint16_t height16 = 0;
@@ -153,7 +163,7 @@ DibInformationHeader::write_header(Filesystem::IOProxy* fd)
return false;
}
return (true);
return true;
}
+41 -28
View File
@@ -1,5 +1,5 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
#pragma once
@@ -7,16 +7,23 @@
OIIO_PLUGIN_NAMESPACE_BEGIN
// Docs reminders:
// https://en.wikipedia.org/wiki/BMP_file_format
// https://web.archive.org/web/20150127132443/https://forums.adobe.com/message/3272950
namespace bmp_pvt {
// size of the BMP file header (the first header that occur in BMP file)
const int BMP_HEADER_SIZE = 14;
// sizes of various DIB haders
const int OS2_V1 = 12;
const int WINDOWS_V3 = 40;
const int WINDOWS_V4 = 108;
const int WINDOWS_V5 = 124;
// sizes of various DIB headers
const int OS2_V1 = 12;
const int WINDOWS_V3 = 40;
const int UNDOCHEADER52 = 52; // 0x34
const int UNDOCHEADER56 = 56; // 0x38
const int WINDOWS_V4 = 108;
const int WINDOWS_V5 = 124;
// bmp magic numbers
const int16_t MAGIC_BM = 0x4D42;
@@ -29,12 +36,18 @@ const int32_t NO_COMPRESSION = 0; // BI_RGB
const int32_t RLE8_COMPRESSION = 1; // BI_RLE8
const int32_t RLE4_COMPRESSION = 2; // BI_RLE4
enum class CSType {
CalibratedRGB = 0,
DeviceDependentRGB = 1,
DeviceDependentCMYK = 2
};
// store informations about BMP file
// store information about BMP file
class BmpFileHeader {
public:
// reads informations about BMP file
// reads information about BMP file
bool read_header(Filesystem::IOProxy* fd);
// writes information about bmp file to given file
@@ -55,10 +68,10 @@ private:
// stores information about bitmap
class DibInformationHeader {
public:
// reads informations about bitmap
// reads information about bitmap
bool read_header(Filesystem::IOProxy* fd);
// writes informations about bitmap
// writes information about bitmap
bool write_header(Filesystem::IOProxy* fd);
int32_t size; // size of the header
@@ -78,23 +91,23 @@ public:
// in most cases ignored
// added in Version 4 of the format
int32_t red_mask;
int32_t blue_mask;
int32_t green_mask;
int32_t alpha_mask;
int32_t cs_type; //color space type
int32_t red_x;
int32_t red_y;
int32_t red_z;
int32_t green_x;
int32_t green_y;
int32_t green_z;
int32_t blue_x;
int32_t blue_y;
int32_t blue_z;
int32_t gamma_x;
int32_t gamma_y;
int32_t gamma_z;
int32_t red_mask = 0;
int32_t blue_mask = 0;
int32_t green_mask = 0;
int32_t alpha_mask = 0;
int32_t cs_type = 0; // color space type
int32_t red_x = 0;
int32_t red_y = 0;
int32_t red_z = 0;
int32_t green_x = 0;
int32_t green_y = 0;
int32_t green_z = 0;
int32_t blue_x = 0;
int32_t blue_y = 0;
int32_t blue_z = 0;
int32_t gamma_x = 0;
int32_t gamma_y = 0;
int32_t gamma_z = 0;
// added in Version 5 of the format
int32_t intent;
+154 -50
View File
@@ -1,5 +1,5 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
#include <cstdio>
@@ -17,19 +17,19 @@ using namespace bmp_pvt;
class BmpInput final : public ImageInput {
public:
BmpInput() { init(); }
virtual ~BmpInput() { close(); }
virtual const char* format_name(void) const override { return "bmp"; }
~BmpInput() override { close(); }
const char* format_name(void) const override { return "bmp"; }
int supports(string_view feature) const override
{
return feature == "ioproxy";
}
virtual bool valid_file(const std::string& filename) const override;
virtual bool open(const std::string& name, ImageSpec& newspec) override;
virtual bool open(const std::string& name, ImageSpec& newspec,
const ImageSpec& config) override;
virtual bool close(void) override;
virtual bool read_native_scanline(int subimage, int miplevel, int y, int z,
void* data) override;
bool valid_file(const std::string& filename) const override;
bool open(const std::string& name, ImageSpec& newspec) override;
bool open(const std::string& name, ImageSpec& newspec,
const ImageSpec& config) override;
bool close(void) override;
bool read_native_scanline(int subimage, int miplevel, int y, int z,
void* data) override;
private:
int64_t m_padded_scanline_size;
@@ -40,6 +40,8 @@ private:
std::vector<bmp_pvt::color_table> m_colortable;
std::vector<unsigned char> fscanline; // temp space: read from file
std::vector<unsigned char> m_uncompressed; // uncompressed palette image
uint32_t m_right_shifts[3];
uint32_t m_bit_counts[3];
bool m_allgray;
void init(void)
@@ -59,11 +61,17 @@ private:
bool read_rle_image();
bool ioeof() { return size_t(ioproxy()->tell()) == ioproxy()->size(); }
// Safe, clamped access to color table
const bmp_pvt::color_table& colortable(int i)
{
return m_colortable[clamp(i, 0, int(m_colortable.size() - 1))];
}
};
// Obligatory material to make this a recognizeable imageio plugin
// Obligatory material to make this a recognizable imageio plugin
OIIO_PLUGIN_EXPORTS_BEGIN
OIIO_EXPORT int bmp_imageio_version = OIIO_PLUGIN_VERSION;
@@ -102,6 +110,28 @@ BmpInput::open(const std::string& name, ImageSpec& newspec)
return open(name, newspec, emptyconfig);
}
inline void
calc_shifts(uint32_t mask, uint32_t& count, uint32_t& right)
{
if (mask == 0) {
count = right = 0;
return;
}
uint32_t i;
for (i = 0; i < 32; i++, mask >>= 1) {
if (mask & 1)
break;
}
right = i;
for (i = 0; i < 32; i++, mask >>= 1) {
if (!(mask & 1))
break;
}
count = i;
}
bool
@@ -134,11 +164,20 @@ BmpInput::open(const std::string& name, ImageSpec& newspec,
close();
return false;
}
// Strutil::print(
// "Header: magic={:x} {}{} fsize={} res1={} res2={} offset={}\n",
// m_bmp_header.magic, char(m_bmp_header.magic & 0xff),
// char(m_bmp_header.magic >> 8), m_bmp_header.fsize, m_bmp_header.res1,
// m_bmp_header.res2, m_bmp_header.offset);
if (!m_dib_header.read_header(ioproxy())) {
errorfmt("\"{}\": wrong bitmap header size", name);
close();
return false;
}
// Strutil::print(
// "Header: size={}(0x{:02x}) width={} height={} cplanes={} bpp={}\n",
// m_dib_header.size, m_dib_header.size, m_dib_header.width,
// m_dib_header.height, m_dib_header.cplanes, m_dib_header.bpp);
const int nchannels = (m_dib_header.bpp == 32) ? 4 : 3;
const int height = (m_dib_header.height >= 0) ? m_dib_header.height
@@ -149,6 +188,26 @@ BmpInput::open(const std::string& name, ImageSpec& newspec,
m_spec.attribute("YResolution", (int)m_dib_header.vres);
m_spec.attribute("ResolutionUnit", "m");
}
if (m_spec.width < 1 || m_spec.height < 1 || m_spec.nchannels < 1
|| m_spec.image_bytes() < 1
|| m_spec.image_pixels() > std::numeric_limits<uint32_t>::max()) {
errorfmt(
"Invalid image size {} x {} ({} chans, {}), is likely corrupted",
m_spec.width, m_spec.height, m_spec.nchannels, m_spec.format);
close();
return false;
}
// Compute channel shifts & masks (only relevant for 16bpp case)
if (m_dib_header.red_mask == 0 || m_dib_header.green_mask == 0
|| m_dib_header.blue_mask == 0) {
m_dib_header.red_mask = 0b111110000000000;
m_dib_header.green_mask = 0b000001111100000;
m_dib_header.blue_mask = 0b000000000011111;
}
calc_shifts(m_dib_header.red_mask, m_bit_counts[0], m_right_shifts[0]);
calc_shifts(m_dib_header.green_mask, m_bit_counts[1], m_right_shifts[1]);
calc_shifts(m_dib_header.blue_mask, m_bit_counts[2], m_right_shifts[2]);
// computing size of one scanline - this is the size of one scanline that
// is stored in the file, not in the memory
@@ -160,7 +219,7 @@ BmpInput::open(const std::string& name, ImageSpec& newspec,
break;
case 16:
m_padded_scanline_size = ((m_spec.width << 1) + 3) & ~3;
m_spec.attribute("oiio:BitsPerSample", 4);
m_spec.attribute("oiio:BitsPerSample", m_bit_counts[0]);
break;
case 8:
m_padded_scanline_size = (m_spec.width + 3) & ~3;
@@ -184,6 +243,9 @@ BmpInput::open(const std::string& name, ImageSpec& newspec,
if (!read_color_table())
return false;
break;
default:
errorfmt("Unsupported BMP bit depth: {}", m_dib_header.bpp);
return false;
}
if (m_dib_header.bpp <= 16)
m_spec.attribute("bmp:bitsperpixel", m_dib_header.bpp);
@@ -194,6 +256,25 @@ BmpInput::open(const std::string& name, ImageSpec& newspec,
case WINDOWS_V5: m_spec.attribute("bmp:version", 5); break;
}
// Default presumption is that a BMP file is meant to look reasonable on a
// display, so assume it's sRGB. This is not really correct -- see the
// comments below.
m_spec.attribute("oiio:ColorSpace", "sRGB");
#if 0
if (m_dib_header.size >= WINDOWS_V4
&& m_dib_header.cs_type == CSType::CalibratedRGB) {
// FIXME: V4 and newer BMP files have color primary information, but
// we currently ignore it and presume sRGB. I don't know how
// frequently the color primaries are reliable or if anybody cares for
// this ancient format. We may come back to this later.
}
if (m_dib_header.size >= WINDOWS_V4
&& m_dib_header.cs_type == CSType::DeviceDependentCMYK) {
// FIXME: I've never encountered a BMP file that holds CMYK data. If
// this is a problem for people, we can return to fix this later.
}
#endif
// Bite the bullet and uncompress now, for simplicity
if (m_dib_header.compression == RLE4_COMPRESSION
|| m_dib_header.compression == RLE8_COMPRESSION) {
@@ -204,13 +285,6 @@ BmpInput::open(const std::string& name, ImageSpec& newspec,
}
}
if (m_spec.width < 1 || m_spec.height < 1 || m_spec.nchannels < 1
|| m_spec.image_bytes() < 1) {
errorfmt("Invalid image size {} x {} ({} chans, {})", m_spec.width,
m_spec.height, m_spec.nchannels, m_spec.format);
return false;
}
newspec = m_spec;
return true;
}
@@ -223,14 +297,23 @@ BmpInput::read_rle_image()
int rletype = m_dib_header.compression == RLE4_COMPRESSION ? 4 : 8;
m_spec.attribute("compression", rletype == 4 ? "rle4" : "rle8");
m_uncompressed.clear();
m_uncompressed.resize(m_spec.height * m_spec.width);
m_uncompressed.resize(m_spec.image_pixels());
// Note: the clear+resize zeroes out the buffer
bool ok = true;
int y = 0, x = 0;
while (ok) {
// Strutil::print("currently at {},{}\n", x, y);
unsigned char rle_pair[2];
if (!ioread(rle_pair, 2)) {
ok = false;
// Strutil::print("hit end of file at {},{}\n", x, y);
break;
}
if (y >= m_spec.height) { // out of y bounds
errorfmt(
"BMP might be corrupted, it is referencing an out-of-bounds pixel coordinte ({},{})",
x, y);
ok = false;
break;
}
int npixels = rle_pair[0];
@@ -239,8 +322,10 @@ BmpInput::read_rle_image()
// [0,0] is end of line marker
x = 0;
++y;
// Strutil::print("end of line, moving to {},{}\n", x, y);
} else if (npixels == 0 && value == 1) {
// [0,1] is end of bitmap marker
// Strutil::print("end of bitmap\n");
break;
} else if (npixels == 0 && value == 2) {
// [0,2] is a "delta" -- two more bytes reposition the
@@ -249,14 +334,17 @@ BmpInput::read_rle_image()
ok &= ioread(offset, 2);
x += offset[0];
y += offset[1];
// Strutil::print("offset by {:d},{:d} to {},{}\n", offset[0],
// offset[1], x, y);
} else if (npixels == 0) {
// [0,n>2] is an "absolute" run of pixel data.
// n is the number of pixel indices that follow, but note
// that it pads to word size.
int npixels = value;
int nbytes = (rletype == 4)
? round_to_multiple((npixels + 1) / 2, 2)
: round_to_multiple(npixels, 2);
npixels = value;
int nbytes = (rletype == 4)
? round_to_multiple((npixels + 1) / 2, 2)
: round_to_multiple(npixels, 2);
// Strutil::print("rle of {} pixels at {},{}\n", npixels, x, y);
unsigned char absolute[256];
ok &= ioread(absolute, nbytes);
for (int i = 0; i < npixels; ++i, ++x) {
@@ -270,6 +358,7 @@ BmpInput::read_rle_image()
}
} else {
// [n>0,p] is a run of n pixels.
// Strutil::print("direct read {} pixels at {},{}\n", npixels, x, y);
for (int i = 0; i < npixels; ++i, ++x) {
int v;
if (rletype == 4)
@@ -303,9 +392,10 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
|| m_dib_header.compression == RLE8_COMPRESSION) {
for (int x = 0; x < m_spec.width; ++x) {
int p = m_uncompressed[(m_spec.height - 1 - y) * m_spec.width + x];
mscanline[3 * x] = m_colortable[p].r;
mscanline[3 * x + 1] = m_colortable[p].g;
mscanline[3 * x + 2] = m_colortable[p].b;
auto& c = colortable(p);
mscanline[3 * x] = c.r;
mscanline[3 * x + 1] = c.g;
mscanline[3 * x + 2] = c.b;
}
return true;
}
@@ -333,43 +423,56 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
}
if (m_dib_header.bpp == 16) {
const uint16_t RED = 0x7C00;
const uint16_t GREEN = 0x03E0;
const uint16_t BLUE = 0x001F;
for (unsigned int i = 0, j = 0; j < scanline_bytes; i += 2, j += 3) {
uint16_t pixel = (uint16_t) * (&fscanline[i]);
mscanline[j] = (uint8_t)((pixel & RED) >> 8);
mscanline[j + 1] = (uint8_t)((pixel & GREEN) >> 4);
mscanline[j + 2] = (uint8_t)(pixel & BLUE);
uint16_t pixel = *(uint16_t*)&fscanline[i];
mscanline[j + 0]
= (uint8_t)bit_range_convert((pixel & m_dib_header.red_mask)
>> m_right_shifts[0],
m_bit_counts[0], 8);
mscanline[j + 1]
= (uint8_t)bit_range_convert((pixel & m_dib_header.green_mask)
>> m_right_shifts[1],
m_bit_counts[1], 8);
mscanline[j + 2]
= (uint8_t)bit_range_convert((pixel & m_dib_header.blue_mask)
>> m_right_shifts[2],
m_bit_counts[2], 8);
}
}
if (m_dib_header.bpp == 8) {
if (m_allgray) {
// Keep it as 1-channel image because all colors are gray
for (unsigned int i = 0; i < scanline_bytes; ++i) {
mscanline[i] = m_colortable[fscanline[i]].r;
mscanline[i] = colortable(fscanline[i]).r;
}
} else {
// Expand palette image into 3-channel RGB (existing code)
for (unsigned int i = 0, j = 0; j < scanline_bytes; ++i, j += 3) {
mscanline[j] = m_colortable[fscanline[i]].r;
mscanline[j + 1] = m_colortable[fscanline[i]].g;
mscanline[j + 2] = m_colortable[fscanline[i]].b;
auto& c = colortable(fscanline[i]);
mscanline[j] = c.r;
mscanline[j + 1] = c.g;
mscanline[j + 2] = c.b;
}
}
}
if (m_dib_header.bpp == 4) {
for (unsigned int i = 0, j = 0; j < scanline_bytes; ++i, j += 6) {
uint8_t mask = 0xF0;
mscanline[j] = m_colortable[(fscanline[i] & mask) >> 4].r;
mscanline[j + 1] = m_colortable[(fscanline[i] & mask) >> 4].g;
mscanline[j + 2] = m_colortable[(fscanline[i] & mask) >> 4].b;
uint8_t mask = 0xF0;
{
auto& c = colortable((fscanline[i] & mask) >> 4);
mscanline[j] = c.r;
mscanline[j + 1] = c.g;
mscanline[j + 2] = c.b;
}
if (j + 3 >= scanline_bytes)
break;
mask = 0x0F;
mscanline[j + 3] = m_colortable[fscanline[i] & mask].r;
mscanline[j + 4] = m_colortable[fscanline[i] & mask].g;
mscanline[j + 5] = m_colortable[fscanline[i] & mask].b;
mask = 0x0F;
{
auto& c = colortable(fscanline[i] & mask);
mscanline[j + 3] = c.r;
mscanline[j + 4] = c.g;
mscanline[j + 5] = c.b;
}
}
}
if (m_dib_header.bpp == 1) {
@@ -380,9 +483,10 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
int index = 0;
if (fscanline[i] & (1 << j))
index = 1;
mscanline[k] = m_colortable[index].r;
mscanline[k + 1] = m_colortable[index].g;
mscanline[k + 2] = m_colortable[index].b;
auto& c = colortable(index);
mscanline[k] = c.r;
mscanline[k + 1] = c.g;
mscanline[k + 2] = c.b;
}
}
}
+35 -18
View File
@@ -1,5 +1,5 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
// https://github.com/OpenImageIO/oiio
#include <cstdio>
@@ -18,17 +18,17 @@ using namespace bmp_pvt;
class BmpOutput final : public ImageOutput {
public:
BmpOutput() { init(); }
virtual ~BmpOutput() { close(); }
virtual const char* format_name(void) const override { return "bmp"; }
virtual int supports(string_view feature) const override;
virtual bool open(const std::string& name, const ImageSpec& spec,
OpenMode mode) override;
virtual bool close(void) override;
virtual bool write_scanline(int y, int z, TypeDesc format, const void* data,
stride_t xstride) override;
virtual bool write_tile(int x, int y, int z, TypeDesc format,
const void* data, stride_t xstride,
stride_t ystride, stride_t zstride) override;
~BmpOutput() override { close(); }
const char* format_name(void) const override { return "bmp"; }
int supports(string_view feature) const override;
bool open(const std::string& name, const ImageSpec& spec,
OpenMode mode) override;
bool close(void) override;
bool write_scanline(int y, int z, TypeDesc format, const void* data,
stride_t xstride) override;
bool write_tile(int x, int y, int z, TypeDesc format, const void* data,
stride_t xstride, stride_t ystride,
stride_t zstride) override;
private:
int64_t m_padded_scanline_size;
@@ -55,7 +55,7 @@ private:
// Obligatory material to make this a recognizeable imageio plugin
// Obligatory material to make this a recognizable imageio plugin
OIIO_PLUGIN_EXPORTS_BEGIN
OIIO_EXPORT ImageOutput*
@@ -97,6 +97,12 @@ BmpOutput::open(const std::string& name, const ImageSpec& spec, OpenMode mode)
return false;
}
if (m_spec.x || m_spec.y || m_spec.z) {
errorfmt("{} does not support images with non-zero image origin offset",
format_name());
return false;
}
// Only support 8 bit channels for now.
m_spec.set_format(TypeDesc::UINT8);
m_dither = m_spec.get_int_attribute("oiio:dither", 0);
@@ -133,12 +139,18 @@ bool
BmpOutput::write_scanline(int y, int z, TypeDesc format, const void* data,
stride_t xstride)
{
if (y > m_spec.height) {
if (!ioproxy_opened()) {
errorfmt("write_scanline called but file is not open.");
return false;
}
if (y > m_spec.y + m_spec.height) {
errorfmt("Attempt to write too many scanlines to {}", m_filename);
close();
return false;
}
y -= m_spec.y;
if (m_spec.width >= 0)
y = (m_spec.height - y - 1);
int64_t scanline_off = y * m_padded_scanline_size;
@@ -165,9 +177,14 @@ bool
BmpOutput::write_tile(int x, int y, int z, TypeDesc format, const void* data,
stride_t xstride, stride_t ystride, stride_t zstride)
{
if (!ioproxy_opened()) {
errorfmt("write_tile called but file is not open.");
return false;
}
// Emulate tiles by buffering the whole image
return copy_tile_to_image_buffer(x, y, z, format, data, xstride, ystride,
zstride, &m_tilebuffer[0]);
zstride, m_tilebuffer.data());
}
@@ -181,11 +198,11 @@ BmpOutput::close(void)
}
bool ok = true;
if (m_spec.tile_width) {
if (m_spec.tile_width && m_tilebuffer.size()) {
// Handle tile emulation -- output the buffered pixels
OIIO_DASSERT(m_tilebuffer.size());
ok &= write_scanlines(m_spec.y, m_spec.y + m_spec.height, 0,
m_spec.format, &m_tilebuffer[0]);
m_spec.format, m_tilebuffer.data());
std::vector<unsigned char>().swap(m_tilebuffer);
}
+1 -1
View File
@@ -3,7 +3,7 @@
# Utility script to download and build OpenJPEG
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
+1 -1
View File
@@ -3,7 +3,7 @@
# Utility script to download and build Ptex
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
+4
View File
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
# Utility script to download and build cmake
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Utility script to download and build giflib
+1 -1
View File
@@ -3,7 +3,7 @@
# Utility script to download and build libjpeg-turbo
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
+1 -1
View File
@@ -3,7 +3,7 @@
# Utility script to download and build libpng
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
+4
View File
@@ -1,5 +1,9 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Utility script to download and build LibRaw
# Exit the whole script if any command fails.
+5
View File
@@ -1,5 +1,9 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Utility script to download and build libtiff
# Exit the whole script if any command fails.
@@ -39,6 +43,7 @@ if [[ -z $DEP_DOWNLOAD_ONLY ]]; then
time cmake -DCMAKE_BUILD_TYPE=${LIBTIFF_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${LIBTIFF_INSTALL_DIR} \
-DCMAKE_CXX_FLAGS="${LIBTIFF_CXX_FLAGS}" \
-DBUILD_SHARED_LIBS=${LIBTIFF_BUILD_SHARED_LIBS:-ON} \
${LIBTIFF_BUILDOPTS} ..
time cmake --build . --target install
fi
+10 -20
View File
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
# Utility script to download and build LLVM & clang
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
@@ -10,27 +14,13 @@ uname
if [[ `uname` == "Linux" ]] ; then
LLVM_VERSION=${LLVM_VERSION:=8.0.0}
LLVM_INSTALL_DIR=${LLVM_INSTALL_DIR:=${PWD}/llvm-install}
if [[ "$GITHUB_WORKFLOW" != "" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-18.04}
elif [[ "$TRAVIS_DIST" == "trusty" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-14.04}
elif [[ "$TRAVIS_DIST" == "xenial" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-16.04}
elif [[ "$TRAVIS_DIST" == "bionic" ]] ; then
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=ubuntu-18.04}
else
LLVM_DISTRO_NAME=${LLVM_DISTRO_NAME:=error}
fi
if [ "$LLVM_VERSION" == "5.0.0" ] ; then
LLVMTAR=clang+llvm-${LLVM_VERSION}-linux-x86_64-${LLVM_DISTRO_NAME}.tar.xz
else
LLVMTAR=clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-${LLVM_DISTRO_NAME}.tar.xz
fi
: ${LLVM_VERSION:=13.0.0}
: ${LLVM_INSTALL_DIR:=${PWD}/llvm-install}
: ${LLVM_DISTRO_NAME:=ubuntu-18.04}
LLVMTAR=clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-${LLVM_DISTRO_NAME}.tar.xz
echo LLVMTAR = $LLVMTAR
curl --location http://releases.llvm.org/${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
# ls -l $LLVMTAR
curl --location https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
ls -l $LLVMTAR
tar xf $LLVMTAR
rm -f $LLVMTAR
echo "Installed ${LLVM_VERSION} in ${LLVM_INSTALL_DIR}"
+4
View File
@@ -1,5 +1,9 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
+5 -1
View File
@@ -1,5 +1,9 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Utility script to download and build OpenColorIO
# Exit the whole script if any command fails.
@@ -7,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.0.1}
OPENCOLORIO_VERSION=${OPENCOLORIO_VERSION:=v2.2.1}
# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
+5 -1
View File
@@ -2,12 +2,16 @@
# Utility script to download and build OpenEXR & IlmBase
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
# Which OpenEXR to retrieve, how to build it
OPENEXR_REPO=${OPENEXR_REPO:=https://github.com/AcademySoftwareFoundation/openexr.git}
OPENEXR_VERSION=${OPENEXR_VERSION:=v2.4.1}
OPENEXR_VERSION=${OPENEXR_VERSION:=v3.1.9}
# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
+1 -1
View File
@@ -3,7 +3,7 @@
# Utility script to download and build pugixml
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
+4
View File
@@ -1,5 +1,9 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Utility script to download and build pybind11
# Exit the whole script if any command fails.
+1 -1
View File
@@ -3,7 +3,7 @@
# Utility script to download and build webp
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
+1 -1
View File
@@ -3,7 +3,7 @@
# Utility script to download and build zlib
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
+28 -5
View File
@@ -1,15 +1,30 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Important: set -ex causes this whole script to terminate with error if
# any command in it fails. This is crucial for CI tests.
set -ex
OIIO_CMAKE_FLAGS="$MY_CMAKE_FLAGS $OIIO_CMAKE_FLAGS"
if [[ "$USE_SIMD" != "" ]] ; then
MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"
OIIO_CMAKE_FLAGS="$OIIO_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"
fi
if [[ -n "$FMT_VERSION" ]] ; then
MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DBUILD_FMT_VERSION=$FMT_VERSION"
OIIO_CMAKE_FLAGS="$OIIO_CMAKE_FLAGS -DBUILD_FMT_VERSION=$FMT_VERSION"
fi
if [[ -n "$CODECOV" ]] ; then
OIIO_CMAKE_FLAGS="$OIIO_CMAKE_FLAGS -DCODECOV=${CODECOV}"
fi
# On GHA, we can reduce build time with "unity" builds.
if [[ ${GITHUB_ACTIONS} == true ]] ; then
OIIO_CMAKE_FLAGS+=" -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD:=ON} -DCMAKE_UNITY_BUILD_MODE=${CMAKE_UNITY_BUILD_MODE:=BATCH}"
fi
pushd build
@@ -20,10 +35,18 @@ cmake .. -G "$CMAKE_GENERATOR" \
-DPYTHON_VERSION="$PYTHON_VERSION" \
-DCMAKE_INSTALL_LIBDIR="$OpenImageIO_ROOT/lib" \
-DCMAKE_CXX_STANDARD="$CMAKE_CXX_STANDARD" \
$MY_CMAKE_FLAGS -DVERBOSE=1
-DOIIO_DOWNLOAD_MISSING_TESTDATA=ON \
-DEXTRA_CPP_ARGS="${OIIO_EXTRA_CPP_ARGS}" \
$OIIO_CMAKE_FLAGS -DVERBOSE=1
# Save a copy of the generated files for debugging broken CI builds.
mkdir cmake-save || /bin/true
cp -r CMake* *.cmake cmake-save
: ${BUILDTARGET:=install}
if [[ "$BUILDTARGET" != "none" ]] ; then
echo "Parallel build " ${CMAKE_BUILD_PARALLEL_LEVEL}
time cmake --build . --target ${BUILDTARGET:=install} --config ${CMAKE_BUILD_TYPE}
echo "Parallel build ${CMAKE_BUILD_PARALLEL_LEVEL} of target ${BUILDTARGET}"
time ${OIIO_CMAKE_BUILD_WRAPPER} cmake --build . --target ${BUILDTARGET} --config ${CMAKE_BUILD_TYPE}
fi
popd
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Run code coverage analysis
# This assumes that the build occurred with CODECOV=1 and tests have already
# fully run.
set -ex
echo "Performing code coverage analysis"
mkdir _coverage
pushd _coverage
# The sed command below converts from:
# ../build/src/libOpenImageIO/CMakeFiles/OpenImageIO.dir/foo.gcno
# to:
# ../src/libOpenImageIO/foo.cpp
for g in $(find ../build -name "*.gcno" -type f); do
echo "Processing $g"
echo "dirname $g = $(dirname $g) to " `$(echo "$g" | sed -e 's/\/build\//\//' -e 's/\.gcno/\.cpp/' -e 's/\.cpp\.cpp/\.cpp/' -e 's/\/CMakeFiles.*\.dir\//\//')`
gcov -l -p -o $(dirname "$g") $(echo "$g" | sed -e 's/\/build\//\//' -e 's/\.gcno/\.cpp/' -e 's/\/CMakeFiles.*\.dir\//\//')
done
popd
+6
View File
@@ -1,5 +1,9 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# This script is run when CI system first starts up.
# Since it sets many env variables needed by the caller, it should be run
# with 'source', not in a separate shell.
@@ -21,11 +25,13 @@ export LD_LIBRARY_PATH=$OpenImageIO_ROOT/lib64:$LD_LIBRARY_PATH
export OIIO_LIBRARY_PATH=$OpenImageIO_ROOT/lib
export LSAN_OPTIONS=suppressions=$PWD/src/build-scripts/nosanitize.txt
export ASAN_OPTIONS=print_suppressions=0
export UBSAN_OPTIONS=suppressions=$PWD/src/build-scripts/ubsan-suppressions.txt
export PYTHON_VERSION=${PYTHON_VERSION:="2.7"}
export PYTHONPATH=$OpenImageIO_ROOT/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
export BUILD_MISSING_DEPS=${BUILD_MISSING_DEPS:=1}
export COMPILER=${COMPILER:=gcc}
export CC=${CC:=gcc}
export CXX=${CXX:=g++}
export OpenImageIO_CI=true
export USE_NINJA=${USE_NINJA:=1}
+38 -9
View File
@@ -1,18 +1,47 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Important: set -ex causes this whole script to terminate with error if
# any command in it fails. This is crucial for CI tests.
set -ex
# (Though we let it run all the way through for code coverage workflows.)
if [[ "${CODECOV}" == "" ]]; then
set -ex
fi
: ${CTEST_EXCLUSIONS:="broken"}
: ${CTEST_TEST_TIMEOUT:=180}
#
# Try a few command line options to test them and also get some important
# debugging info in the CI logs.
#
echo ; echo "Results of oiiotool --version:"
$OpenImageIO_ROOT/bin/oiiotool --version || true
echo ; echo "Results of oiiotool brief help:"
$OpenImageIO_ROOT/bin/oiiotool || true
echo ; echo "Results of oiiotool full --help:"
$OpenImageIO_ROOT/bin/oiiotool --help || true
echo ; echo "Results of oiiotool with no args (should get short help message):"
$OpenImageIO_ROOT/bin/oiiotool || true
echo ; echo "Run unit tests and simple stats:"
$OpenImageIO_ROOT/bin/oiiotool --unittest --list-formats --threads 0 \
--cache 1000 --autotile --autopremult --runstats || true
echo ; echo "Try unknown command:"
$OpenImageIO_ROOT/bin/oiiotool -q --unknown || true
#
# Full test suite
#
echo "Parallel test ${CTEST_PARALLEL_LEVEL}"
echo "Default timeout ${CTEST_TEST_TIMEOUT}"
echo "Test exclusions '${CTEST_EXCLUSIONS}'"
echo "CTEST_ARGS '${CTEST_ARGS}'"
echo "Parallel test " ${CTEST_PARALLEL_LEVEL}
pushd build
time ctest -C ${CMAKE_BUILD_TYPE} -E broken --force-new-ctest-process \
--output-on-failure --timeout ${CTEST_TEST_TIMEOUT:=180} ${CTEST_ARGS}
time ctest -C ${CMAKE_BUILD_TYPE} --force-new-ctest-process --output-on-failure \
-E "${CTEST_EXCLUSIONS}" --timeout ${CTEST_TEST_TIMEOUT} ${CTEST_ARGS}
popd
# if [[ "$CODECOV" == 1 ]] ; then
# bash <(curl -s https://codecov.io/bash)
# fi
+73 -10
View File
@@ -1,6 +1,11 @@
#!/usr/bin/env bash
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
set -ex
@@ -10,8 +15,6 @@ set -ex
if [[ "$ASWF_ORG" != "" ]] ; then
# Using ASWF CentOS container
export PATH=/opt/rh/devtoolset-6/root/usr/bin:/usr/local/bin:$PATH
#ls /etc/yum.repos.d
sudo yum install -y giflib giflib-devel && true
@@ -20,10 +23,48 @@ if [[ "$ASWF_ORG" != "" ]] ; then
if [[ "${EXTRA_DEP_PACKAGES}" != "" ]] ; then
time sudo yum install -y ${EXTRA_DEP_PACKAGES}
fi
if [[ "${CONAN_LLVM_VERSION}" != "" ]] ; then
mkdir conan
pushd conan
# Simple way to conan install just one package:
# conan install clang/${CONAN_LLVM_VERSION}@aswftesting/ci_common1 -g deploy -g virtualenv
# But the below method can accommodate multiple requirements:
echo "[imports]" >> conanfile.txt
echo "., * -> ." >> conanfile.txt
echo "[requires]" >> conanfile.txt
echo "clang/${CONAN_LLVM_VERSION}@aswftesting/ci_common1" >> conanfile.txt
time conan install .
echo "--ls--"
ls -R .
export PATH=$PWD/bin:$PATH
export LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH
export LLVM_ROOT=$PWD
popd
fi
if [[ "$CXX" == "icpc" || "$CC" == "icc" || "$USE_ICC" != "" ]] ; then
# Lock down icc to 2022.1 because newer versions hosted on the Intel
# repo require a glibc too new for the ASWF CentOS7-based containers
# we run CI on.
sudo cp src/build-scripts/oneAPI.repo /etc/yum.repos.d
sudo /usr/bin/yum install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2022.1.0.x86_64
set +e; source /opt/intel/oneapi/setvars.sh --config oneapi_2022.1.0.cfg; set -e
elif [[ "$CXX" == "icpc" || "$CC" == "icc" || "$USE_ICC" != "" || "$CXX" == "icpx" || "$CC" == "icx" || "$USE_ICX" != "" ]] ; then
# Lock down icx to 2023.1 because newer versions hosted on the Intel
# repo require a libstd++ too new for the ASWF containers we run CI on
# because their default install of gcc 9 based toolchain.
sudo cp src/build-scripts/oneAPI.repo /etc/yum.repos.d
sudo yum install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.1.0.x86_64
# sudo yum install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
set +e; source /opt/intel/oneapi/setvars.sh; set -e
echo "Verifying installation of Intel(r) oneAPI DPC++/C++ Compiler:"
icpx --version
fi
else
# Using native Ubuntu runner
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
time sudo apt-get update
time sudo apt-get -q install -y \
@@ -33,13 +74,18 @@ else
libtbb-dev \
libtiff-dev libgif-dev libpng-dev libraw-dev libwebp-dev \
libavcodec-dev libavformat-dev libswscale-dev libavutil-dev \
dcmtk libsquish-dev libopenvdb-dev \
dcmtk libopenvdb-dev \
libfreetype6-dev \
locales wget \
libopencolorio-dev \
libopencv-dev \
qt5-default \
libhdf5-dev
if [[ "${QT_VERSION:-5}" == "5" ]] ; then
time sudo apt-get -q install -y \
qt5-default || /bin/true
elif [[ "${QT_VERSION}" == "6" ]] ; then
time sudo apt-get -q install -y qt6-base-dev || /bin/true
fi
if [[ "${EXTRA_DEP_PACKAGES}" != "" ]] ; then
time sudo apt-get -q install -y ${EXTRA_DEP_PACKAGES}
fi
@@ -56,9 +102,11 @@ else
fi
if [[ "$USE_LIBHEIF" != "0" ]] ; then
sudo add-apt-repository ppa:strukturag/libde265
sudo add-apt-repository ppa:strukturag/libheif
time sudo apt-get -q install -y libheif-dev
sudo add-apt-repository ppa:strukturag/libde265 || true
sudo add-apt-repository ppa:strukturag/libheif || true
time sudo apt-get -q install -y libheif-plugin-aomdec \
libheif-plugin-aomenc libheif-plugin-libde265 \
libheif-plugin-x265 libheif-dev || true
fi
export CMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu:$CMAKE_PREFIX_PATH
@@ -75,6 +123,17 @@ else
time sudo apt-get install -y g++-10
elif [[ "$CXX" == "g++-11" ]] ; then
time sudo apt-get install -y g++-11
elif [[ "$CXX" == "g++-12" ]] ; then
time sudo apt-get install -y g++-12
fi
if [[ "$CXX" == "icpc" || "$CC" == "icc" || "$USE_ICC" != "" || "$USE_ICX" != "" ]] ; then
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
time sudo apt-get update
time sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
set +e; source /opt/intel/oneapi/setvars.sh; set -e
fi
fi
@@ -131,8 +190,12 @@ if [[ "$PTEX_VERSION" != "" ]] ; then
source src/build-scripts/build_Ptex.bash
fi
src/build-scripts/install_test_images.bash
if [[ "$USE_ICC" != "" ]] ; then
# We used gcc for the prior dependency builds, but use icc for OIIO itself
echo "which icpc:" $(which icpc)
export CXX=icpc
export CC=icc
fi
# Save the env for use by other stages
src/build-scripts/save-env.bash
+7 -8
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# DEP_DIR="$PWD/ext/dist"
@@ -27,10 +27,14 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DEP_DIR/lib:$VCPKG_INSTALLATION_ROOT/i
if [[ "$PYTHON_VERSION" == "3.6" ]] ; then
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/c/hostedtoolcache/windows/Python/3.6.8/x64"
else
elif [[ "$PYTHON_VERSION" == "3.7" ]] ; then
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/c/hostedtoolcache/windows/Python/3.7.9/x64"
export Python_EXECUTABLE="/c/hostedtoolcache/windows/Python/3.7.9/x64/python.exe"
export PYTHONPATH=$OpenImageIO_ROOT/lib/python${PYTHON_VERSION}/site-packages
elif [[ "$PYTHON_VERSION" == "3.9" ]] ; then
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/c/hostedtoolcache/windows/Python/3.9.10/x64"
export Python_EXECUTABLE="/c/hostedtoolcache/windows/Python/3.9.10/x64/python3.exe"
export PYTHONPATH=$OpenImageIO_ROOT/lib/python${PYTHON_VERSION}/site-packages
fi
pip install numpy
@@ -46,7 +50,6 @@ echo "---------------"
# vcpkg update
#
time vcpkg install boost-asio:x64-windows
time vcpkg install boost-container:x64-windows
time vcpkg install boost-filesystem:x64-windows
time vcpkg install boost-math:x64-windows
@@ -64,7 +67,6 @@ vcpkg install libjpeg-turbo:x64-windows
#
# vcpkg install libraw:x64-windows
# vcpkg install openjpeg:x64-windows
# vcpkg install libsquish:x64-windows
# # vcpkg install ffmpeg:x64-windows # takes FOREVER!
# # vcpkg install webp:x64-windows # No such vcpkg package?a
#
@@ -134,9 +136,6 @@ echo "DEP_DIR $DEP_DIR :"
ls -R -l "$DEP_DIR"
src/build-scripts/install_test_images.bash
# source src/build-scripts/build_openexr.bash
# export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$ILMBASE_ROOT;$OPENEXR_ROOT"
# source src/build-scripts/build_opencolorio.bash
+11 -10
View File
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
# This script, which assumes it is runnign on a Mac OSX with Homebrew
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# This script, which assumes it is running on a Mac OSX with Homebrew
# installed, does a "brew install" in all packages reasonably needed by
# OIIO.
@@ -24,9 +28,10 @@ brew list --versions
# All cases except for clang-format target, we need the dependencies.
brew install --display-times -q gcc ccache cmake ninja boost || true
brew link --overwrite gcc
brew unlink python@2.7 || true
brew unlink python@3.9 || true
brew install --display-times -q python@${PYTHON_VERSION} || true
brew unlink python@3.8 || true
brew unlink python@3.9 || true
brew unlink python@3.10 || true
brew link --overwrite --force python@${PYTHON_VERSION} || true
#brew upgrade --display-times -q cmake || true
#brew install --display-times -q libtiff
@@ -34,22 +39,18 @@ brew install --display-times -q imath openexr opencolorio
#brew install --display-times -q libpng giflib webp
brew install --display-times -q jpeg-turbo openjpeg
brew install --display-times -q freetype libraw dcmtk pybind11 numpy || true
brew install --display-times -q ffmpeg libheif libsquish ptex || true
brew install --display-times -q ffmpeg libheif ptex || true
brew install --display-times -q tbb || true
brew install --display-times -q openvdb || true
brew install --display-times -q opencv || true
brew install --display-times -q qt@5
brew install --display-times -q qt${QT_VERSION}
echo ""
echo "After brew installs:"
brew list --versions
# Needed on some systems
if [[ $PYTHON_VERSION != "2.7" ]] ; then
pip3 install numpy
else
pip install numpy
fi
pip${PYTHON_VERSION} install numpy
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
+4 -2
View File
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
if [[ ! -e ../oiio-images ]] ; then
git clone https://github.com/OpenImageIO/oiio-images.git ../oiio-images
git clone https://github.com/OpenImageIO/oiio-images.git -b RB-2.4 --depth 1 ../oiio-images
# NOTE: on release branches, this should include `-b RB-x.y`` so that
# updates to the master oiio-images don't break tests in release branches.
fi
# if [[ ! -e ../libtiffpic ]] ; then
@@ -10,7 +12,7 @@ fi
# fi
if [[ ! -e ../openexr-images ]] ; then
git clone https://github.com/openexr/openexr-images.git ../openexr-images
git clone https://github.com/openexr/openexr-images.git --depth 1 ../openexr-images
fi
# if [[ ! -e ../bmpsuite ]] ; then
+1 -9
View File
@@ -1,10 +1,2 @@
leak:Imf_2_2
leak:Imf_2_3
leak:libIlmImf
leak:libgomp
leak:boost::detail::make_external_thread_data
leak:boost::detail::add_new_tss_node
leak:g_malloc0
leak:ArgParse::options
leak:LibRaw::copy_fuji_uncropped
leak:libtbb
leak:libjpeg
+7
View File
@@ -0,0 +1,7 @@
[oneAPI]
name=Intel® oneAPI repository
baseurl=https://yum.repos.intel.com/oneapi
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
+4
View File
@@ -1,5 +1,9 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Save the env for use by other stages. Exclude things that we know aren't
# needed.
printenv \
+6 -3
View File
@@ -1,8 +1,11 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
add_oiio_plugin (cineoninput.cpp
libcineon/Cineon.cpp libcineon/OutStream.cpp libcineon/Codec.cpp
libcineon/Reader.cpp libcineon/Writer.cpp libcineon/CineonHeader.cpp
libcineon/Reader.cpp libcineon/CineonHeader.cpp
libcineon/ElementReadStream.cpp libcineon/InStream.cpp)
# Note: OIIO doesn't support cineon output, so we don't compile
# libcineon/Writer.cpp
+28 -25
View File
@@ -1,5 +1,5 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
#include <cmath>
@@ -19,12 +19,12 @@ OIIO_PLUGIN_NAMESPACE_BEGIN
class CineonInput final : public ImageInput {
public:
CineonInput() { init(); }
virtual ~CineonInput() { close(); }
virtual const char* format_name(void) const override { return "cineon"; }
virtual bool open(const std::string& name, ImageSpec& newspec) override;
virtual bool close() override;
virtual bool read_native_scanline(int subimage, int miplevel, int y, int z,
void* data) override;
~CineonInput() override { close(); }
const char* format_name(void) const override { return "cineon"; }
bool open(const std::string& name, ImageSpec& newspec) override;
bool close() override;
bool read_native_scanline(int subimage, int miplevel, int y, int z,
void* data) override;
private:
InStream* m_stream = nullptr;
@@ -50,7 +50,7 @@ private:
// Obligatory material to make this a recognizeable imageio plugin:
// Obligatory material to make this a recognizable imageio plugin:
OIIO_PLUGIN_EXPORTS_BEGIN
OIIO_EXPORT ImageInput*
@@ -85,7 +85,7 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
m_cin.SetInStream(m_stream);
if (!m_cin.ReadHeader()) {
error("Could not read header");
errorfmt("Could not read header");
return false;
}
@@ -108,12 +108,11 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
// fill channel names
m_spec.channelnames.clear();
int gscount = 0, rcount = 0, gcount = 0, bcount = 0;
char buf[3];
for (int i = 0; i < m_cin.header.NumberOfElements(); i++) {
switch (m_cin.header.ImageDescriptor(i)) {
case cineon::kGrayscale:
if (++gscount > 1) {
std::string ch = Strutil::sprintf("I%d", gscount);
std::string ch = Strutil::fmt::format("I{}", gscount);
m_spec.channelnames.push_back(ch);
} else
m_spec.channelnames.emplace_back("I");
@@ -121,7 +120,7 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
case cineon::kPrintingDensityRed:
case cineon::kRec709Red:
if (++gscount > 1) {
std::string ch = Strutil::sprintf("R%d", rcount);
std::string ch = Strutil::fmt::format("R{}", rcount);
m_spec.channelnames.push_back(ch);
} else
m_spec.channelnames.emplace_back("R");
@@ -129,7 +128,7 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
case cineon::kPrintingDensityGreen:
case cineon::kRec709Green:
if (++gcount > 1) {
std::string ch = Strutil::sprintf("G%d", gcount);
std::string ch = Strutil::fmt::format("G{}", gcount);
m_spec.channelnames.push_back(ch);
} else
m_spec.channelnames.emplace_back("G");
@@ -137,14 +136,14 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
case cineon::kPrintingDensityBlue:
case cineon::kRec709Blue:
if (++bcount > 1) {
std::string ch = Strutil::sprintf("B%d", bcount);
std::string ch = Strutil::fmt::format("B{}", bcount);
m_spec.channelnames.push_back(ch);
} else
m_spec.channelnames.emplace_back("B");
break;
default:
std::string ch = Strutil::sprintf("channel%d",
m_spec.channelnames.size());
std::string ch = Strutil::fmt::format("channel{}",
m_spec.channelnames.size());
m_spec.channelnames.push_back(ch);
break;
}
@@ -184,7 +183,7 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
if (!std::isinf(m_cin.header.Gamma()) && m_cin.header.Gamma() != 0.0f)
// actual gamma value is read later on
m_spec.attribute("oiio:ColorSpace",
Strutil::sprintf("Gamma%.2g", g));
Strutil::fmt::format("Gamma{:.2g}", g));
break;
}
@@ -201,8 +200,9 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
// libcineon's date/time format is pretty close to OIIO's (libcineon
// uses %Y:%m:%d:%H:%M:%S%Z)
m_spec.attribute("DateTime",
Strutil::sprintf("%s %s", m_cin.header.creationDate,
m_cin.header.creationTime));
Strutil::fmt::format("{} {}",
m_cin.header.creationDate,
m_cin.header.creationTime));
// FIXME: do something about the time zone
}
@@ -332,13 +332,16 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
// libcineon's date/time format is pretty close to OIIO's (libcineon
// uses %Y:%m:%d:%H:%M:%S%Z)
m_spec.attribute("DateTime",
Strutil::sprintf("%s %s", m_cin.header.sourceDate,
m_cin.header.sourceTime));
Strutil::fmt::format("{} {}", m_cin.header.sourceDate,
m_cin.header.sourceTime));
// FIXME: do something about the time zone
}
m_cin.header.FilmEdgeCode(buf);
if (buf[0])
m_spec.attribute("cineon:FilmEdgeCode", buf);
{
char filmedge[17];
m_cin.header.FilmEdgeCode(filmedge, sizeof(filmedge));
if (filmedge[0])
m_spec.attribute("cineon:FilmEdgeCode", filmedge);
}
// read in user data
if (m_cin.header.UserSize() != 0 && m_cin.header.UserSize() != 0xFFFFFFFF) {
+34 -39
View File
@@ -82,7 +82,7 @@ cineon::GenericHeader::GenericHeader()
void cineon::GenericHeader::Reset()
{
// File Information
this->magicNumber = MAGIC_COOKIE;
this->magicNumber = CINEON_MAGIC_COOKIE;
this->imageOffset = ~0;
EmptyString(this->version);
OIIO::Strutil::safe_strcpy(this->version, SPEC_VERSION, sizeof(this->version));
@@ -212,6 +212,8 @@ bool cineon::Header::Check()
#ifdef OIIO_DOES_NOT_NEED_THIS
bool cineon::Header::Write(OutStream *io)
{
// write the header to the file
@@ -254,7 +256,7 @@ bool cineon::Header::WriteOffsetData(OutStream *io)
//const long IMAGE_STRUCTURE = 72; // sizeof the image data structure
/*int i;
for (i = 0; i < MAX_ELEMENTS; i++)
for (i = 0; i < CINEON_MAX_ELEMENTS; i++)
{
// only write if there is a defined image description
if (this->chan[i].descriptor == kUndefinedDescriptor)
@@ -272,11 +274,12 @@ bool cineon::Header::WriteOffsetData(OutStream *io)
return true;
}
#endif /* OIIO_DOES_NOT_NEED_THIS */
bool cineon::Header::ValidMagicCookie(const U32 magic)
{
U32 mc = MAGIC_COOKIE;
U32 mc = CINEON_MAGIC_COOKIE;
if (magic == mc)
return true;
@@ -289,7 +292,7 @@ bool cineon::Header::ValidMagicCookie(const U32 magic)
bool cineon::Header::DetermineByteSwap(const U32 magic) const
{
U32 mc = MAGIC_COOKIE;
U32 mc = CINEON_MAGIC_COOKIE;
bool byteSwap = false;
@@ -317,7 +320,7 @@ bool cineon::Header::Validate()
SwapBytes(this->fileSize);
// Image information
for (int i = 0; i < MAX_ELEMENTS; i++)
for (int i = 0; i < CINEON_MAX_ELEMENTS; i++)
{
SwapBytes(this->chan[i].pixelsPerLine);
SwapBytes(this->chan[i].linesPerElement);
@@ -372,7 +375,7 @@ int cineon::GenericHeader::ImageElementCount() const
{
int i = 0;
while (i < MAX_ELEMENTS )
while (i < CINEON_MAX_ELEMENTS )
{
if (this->ImageDescriptor(i) == kUndefinedDescriptor)
break;
@@ -383,6 +386,7 @@ int cineon::GenericHeader::ImageElementCount() const
}
#ifdef OIIO_DOES_NOT_NEED_THIS
void cineon::GenericHeader::CalculateNumberOfElements()
{
int i = this->ImageElementCount();
@@ -398,7 +402,7 @@ void cineon::Header::CalculateOffsets()
{
int i;
for (i = 0; i < MAX_ELEMENTS; i++)
for (i = 0; i < CINEON_MAX_ELEMENTS; i++)
{
// only write if there is a defined image description
if (this->chan[i].designator[1] == kUndefinedDescriptor)
@@ -407,11 +411,12 @@ void cineon::Header::CalculateOffsets()
}
}
#endif /* OIIO_DOES_NOT_NEED_THIS */
cineon::DataSize cineon::GenericHeader::ComponentDataSize(const int element) const
{
if (element < 0 || element >= MAX_ELEMENTS)
if (element < 0 || element >= CINEON_MAX_ELEMENTS)
return kByte;
cineon::DataSize ret;
@@ -444,7 +449,7 @@ cineon::DataSize cineon::GenericHeader::ComponentDataSize(const int element) con
int cineon::GenericHeader::ComponentByteCount(const int element) const
{
if (element < 0 || element >= MAX_ELEMENTS)
if (element < 0 || element >= CINEON_MAX_ELEMENTS)
return kByte;
int ret;
@@ -500,43 +505,33 @@ int cineon::GenericHeader::DataSizeByteCount(const DataSize ds)
}
void cineon::IndustryHeader::FilmEdgeCode(char *edge) const
void cineon::IndustryHeader::FilmEdgeCode(char *edge, size_t size) const
{
if (this->filmManufacturingIdCode == 0xff
&& this->filmType == 0xff
&& this->perfsOffset == 0xff
&& this->prefix == 0xffffffff
&& this->count == 0xffffffff)
*edge = 0;
else
sprintf(edge, "%02u%02u%02u%06u%04u",
(unsigned int)this->filmManufacturingIdCode,
(unsigned int)this->filmType,
(unsigned int)this->perfsOffset,
this->prefix,
this->count);
if (this->filmManufacturingIdCode == 0xff && this->filmType == 0xff
&& this->perfsOffset == 0xff && this->prefix == 0xffffffff
&& this->count == 0xffffffff)
*edge = 0;
else {
std::string e = OIIO::Strutil::sprintf(
"%02u%02u%02u%06u%04u",
(unsigned int)this->filmManufacturingIdCode,
(unsigned int)this->filmType,
(unsigned int)this->perfsOffset, this->prefix, this->count);
OIIO::Strutil::safe_strcpy(edge, e, size);
}
}
#ifdef OIIO_DOES_NOT_NEED_THIS
void cineon::IndustryHeader::SetFilmEdgeCode(const char *edge)
{
char buf[7];
strncpy(buf, edge, 2);
this->filmManufacturingIdCode = OIIO::Strutil::stoi(buf);
strncpy(buf, edge + 2, 2);
this->filmType = OIIO::Strutil::stoi(buf);
strncpy(buf, edge + 4, 2);
this->perfsOffset = OIIO::Strutil::stoi(buf);
strncpy(buf, edge + 6, 6);
this->prefix = OIIO::Strutil::stoi(buf);
strncpy(buf, edge + 12, 4);
this->count = OIIO::Strutil::stoi(buf);
this->filmManufacturingIdCode = OIIO::Strutil::stoi(OIIO::string_view(edge, 2));
this->filmType = OIIO::Strutil::stoi(OIIO::string_view(edge + 2, 2));
this->perfsOffset = OIIO::Strutil::stoi(OIIO::string_view(edge + 4, 2));
this->prefix = OIIO::Strutil::stoi(OIIO::string_view(edge + 6, 6));
this->count = OIIO::Strutil::stoi(OIIO::string_view(edge + 12, 4));
}
#endif /* OIIO_DOES_NOT_NEED_THIS */
void cineon::GenericHeader::SetCreationTimeDate(const long sec)
+66 -71
View File
@@ -64,24 +64,17 @@
*/
#define SPEC_VERSION "V4.5"
/*!
* \def MAX_ELEMENTS
/*!
* \def CINEON_MAX_ELEMENTS
* \brief Maximum number of image elements
*/
#define MAX_ELEMENTS 8
#define CINEON_MAX_ELEMENTS 8
/*!
* \def MAX_COMPONENTS
* \brief Maximum number of components per image element
*/
#define MAX_COMPONENTS 8
/*!
* \def MAGIC_COOKIE
/*!
* \def CINEON_MAGIC_COOKIE
* \brief HEX value of 0x802A5FD7
*/
#define MAGIC_COOKIE 0x802A5FD7
#define CINEON_MAGIC_COOKIE 0x802A5FD7
@@ -275,8 +268,8 @@ namespace cineon
U8 imageOrientation; //!< Image orientation \see Orientation
U8 numberOfElements; //!< Number of elements (1-8)
U8 unused1[2]; //!< Unused (word alignment)
ImageElement chan[MAX_ELEMENTS]; //!< Image element data structures
R32 whitePoint[2]; //!< White point (x, y pair)
ImageElement chan[CINEON_MAX_ELEMENTS]; //!< Image element data structures
R32 whitePoint[2]; //!< White point (x, y pair)
R32 redPrimary[2]; //!< Red primary chromaticity (x, y pair)
R32 greenPrimary[2]; //!< Green primary chromaticity (x, y pair)
R32 bluePrimary[2]; //!< Blue primary chromaticity (x, y pair)
@@ -856,7 +849,7 @@ namespace cineon
inline void SetXDevicePitch(const R32 size);
/*!
* \brief Get the veritcal pitch of the device
* \brief Get the vertical pitch of the device
* \return pitch in samples/mm
*/
inline R32 YDevicePitch() const;
@@ -962,7 +955,7 @@ namespace cineon
* \brief Get the film edge code information that is machine readable
* \param edge buffer to write film edge code information (16+1 chars)
*/
void FilmEdgeCode(char *edge) const;
void FilmEdgeCode(char *edge, size_t size) const;
/*!
* \brief Set the film edge code information that is machine readable
@@ -1056,6 +1049,7 @@ namespace cineon
*/
bool Read(InStream *);
#ifdef OIIO_DOES_NOT_NEED_THIS
/*!
* \brief Set the Output Stream object to write header to
*/
@@ -1063,6 +1057,7 @@ namespace cineon
// write the offset within the header
bool WriteOffsetData(OutStream *);
#endif
/*!
* \brief Validate the header
@@ -1242,30 +1237,30 @@ namespace cineon
inline U32 GenericHeader::PixelsPerLine(const int i) const
{
if (i < 0 || i >= MAX_ELEMENTS)
return 0xffffffff;
return this->chan[i].pixelsPerLine;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return 0xffffffff;
return this->chan[i].pixelsPerLine;
}
inline void GenericHeader::SetPixelsPerLine(const int i, const U32 ppl)
{
if (i < 0 || i >= MAX_ELEMENTS)
return;
this->chan[i].pixelsPerLine = ppl;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return;
this->chan[i].pixelsPerLine = ppl;
}
inline U32 GenericHeader::LinesPerElement(const int i) const
{
if (i < 0 || i >= MAX_ELEMENTS)
return 0xffffffff;
return this->chan[i].linesPerElement;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return 0xffffffff;
return this->chan[i].linesPerElement;
}
inline void GenericHeader::SetLinesPerElement(const int i, const U32 lpe)
{
if (i < 0 || i >= MAX_ELEMENTS)
return;
this->chan[i].linesPerElement = lpe;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return;
this->chan[i].linesPerElement = lpe;
}
inline U8 GenericHeader::DataSign() const
@@ -1280,100 +1275,100 @@ namespace cineon
inline R32 GenericHeader::LowData(const int i) const
{
if (i < 0 || i >= MAX_ELEMENTS)
return std::numeric_limits<R32>::infinity();
return this->chan[i].lowData;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return std::numeric_limits<R32>::infinity();
return this->chan[i].lowData;
}
inline void GenericHeader::SetLowData(const int i, const R32 data)
{
if (i < 0 || i >= MAX_ELEMENTS)
return;
this->chan[i].lowData = data;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return;
this->chan[i].lowData = data;
}
inline R32 GenericHeader::LowQuantity(const int i) const
{
if (i < 0 || i >= MAX_ELEMENTS)
return std::numeric_limits<R32>::max();
return this->chan[i].lowQuantity;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return std::numeric_limits<R32>::max();
return this->chan[i].lowQuantity;
}
inline void GenericHeader::SetLowQuantity(const int i, const R32 quant)
{
if (i < 0 || i >= MAX_ELEMENTS)
return;
this->chan[i].lowQuantity = quant;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return;
this->chan[i].lowQuantity = quant;
}
inline R32 GenericHeader::HighData(const int i) const
{
if (i < 0 || i >= MAX_ELEMENTS)
return std::numeric_limits<R32>::max();
return this->chan[i].highData;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return std::numeric_limits<R32>::max();
return this->chan[i].highData;
}
inline void GenericHeader::SetHighData(const int i, const R32 data)
{
if (i < 0 || i >= MAX_ELEMENTS)
return;
this->chan[i].highData = data;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return;
this->chan[i].highData = data;
}
inline R32 GenericHeader::HighQuantity(const int i) const
{
if (i < 0 || i >= MAX_ELEMENTS)
return std::numeric_limits<R32>::max();
return this->chan[i].highQuantity;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return std::numeric_limits<R32>::max();
return this->chan[i].highQuantity;
}
inline void GenericHeader::SetHighQuantity(const int i, const R32 quant)
{
if (i < 0 || i >= MAX_ELEMENTS)
return;
this->chan[i].highQuantity = quant;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return;
this->chan[i].highQuantity = quant;
}
inline U8 GenericHeader::Metric(const int i) const
{
if (i < 0 || i >= MAX_ELEMENTS)
return 0xff;
return this->chan[i].designator[0];
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return 0xff;
return this->chan[i].designator[0];
}
inline void GenericHeader::SetMetric(const int i, const U8 m)
{
if (i < 0 || i >= MAX_ELEMENTS)
return;
this->chan[i].designator[0] = m;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return;
this->chan[i].designator[0] = m;
}
inline Descriptor GenericHeader::ImageDescriptor(const int i) const
{
if (i < 0 || i >= MAX_ELEMENTS)
return Descriptor(0xff);
return Descriptor(this->chan[i].designator[1]);
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return Descriptor(0xff);
return Descriptor(this->chan[i].designator[1]);
}
inline void GenericHeader::SetImageDescriptor(const int i, const Descriptor desc)
{
if (i < 0 || i >= MAX_ELEMENTS)
return;
this->chan[i].designator[1] = (U8)desc;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return;
this->chan[i].designator[1] = (U8)desc;
}
inline U8 GenericHeader::BitDepth(const int i) const
{
if (i < 0 || i >= MAX_ELEMENTS)
return 0xff;
return this->chan[i].bitDepth;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return 0xff;
return this->chan[i].bitDepth;
}
inline void GenericHeader::SetBitDepth(const int i, const U8 depth)
{
if (i < 0 || i >= MAX_ELEMENTS)
return;
this->chan[i].bitDepth = depth;
if (i < 0 || i >= CINEON_MAX_ELEMENTS)
return;
this->chan[i].bitDepth = depth;
}
inline Interleave GenericHeader::ImageInterleave() const
@@ -94,7 +94,7 @@ namespace cineon
offset += block.x1 * numberOfComponents / 3 * 4;
// get the read count in bytes, round to the 32-bit boundry
// get the read count in bytes, round to the 32-bit boundary
int readSize = (block.x2 - block.x1 + 1) * numberOfComponents;
readSize += readSize % 3;
readSize = readSize / 3 * 4;
@@ -110,7 +110,7 @@ namespace cineon
for (int count = (block.x2 - block.x1 + 1) * numberOfComponents - 1; count >= 0; count--)
{
// unpacking the buffer backwords
// unpacking the buffer backwards
U16 d1 = U16(readBuf[(count + index) / 3] >> ((2 - (count + index) % 3) * 10 + PADDINGBITS) & 0x3ff);
BaseTypeConvertU10ToU16(d1, d1);
BaseTypeConverter(d1, obuf[count]);
@@ -146,7 +146,7 @@ namespace cineon
for (int i = count - 1; i >= 0; i--)
{
// unpacking the buffer backwords
// unpacking the buffer backwards
// find the byte that the data starts in, read in as a 16 bits then shift and mask
// the pattern with byte offset is:
// 10 bits datasize rotates every 4 data elements
+6 -6
View File
@@ -82,12 +82,12 @@ void cineon::Writer::SetImageInfo(const U32 width, const U32 height)
}
// returns next available or MAX_ELEMENTS if full
// returns next available or CINEON_MAX_ELEMENTS if full
int cineon::Writer::NextAvailElement() const
{
unsigned int i;
for (i = 0; i < MAX_ELEMENTS; i++)
for (i = 0; i < CINEON_MAX_ELEMENTS; i++)
{
if (this->header.ImageDescriptor(i) == kUndefinedDescriptor)
break;
@@ -139,7 +139,7 @@ void cineon::Writer::SetElement(const int num, const Descriptor desc, const U8 b
const R32 highData, const R32 highQuantity)
{
// make sure the range is good
if (num < 0 || num >= MAX_ELEMENTS)
if (num < 0 || num >= CINEON_MAX_ELEMENTS)
return;
// set values
@@ -160,7 +160,7 @@ void cineon::Writer::SetElement(const int num, const Descriptor desc, const U8 b
bool cineon::Writer::WriteElement(const int element, void *data, const long count)
{
// make sure the range is good
if (element < 0 || element >= MAX_ELEMENTS)
if (element < 0 || element >= CINEON_MAX_ELEMENTS)
return false;
// make sure the entry is valid
@@ -180,7 +180,7 @@ bool cineon::Writer::WriteElement(const int element, void *data, const long coun
bool cineon::Writer::WriteElement(const int element, void *data)
{
// make sure the range is good
if (element < 0 || element >= MAX_ELEMENTS)
if (element < 0 || element >= CINEON_MAX_ELEMENTS)
return false;
// make sure the entry is valid
@@ -197,7 +197,7 @@ bool cineon::Writer::WriteElement(const int element, void *data, const DataSize
bool status = true;
// make sure the range is good
if (element < 0 || element >= MAX_ELEMENTS)
if (element < 0 || element >= CINEON_MAX_ELEMENTS)
return false;
// make sure the entry is valid
+38 -9
View File
@@ -1,3 +1,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
@@ -17,16 +21,41 @@ if (NOT @OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH@ AND NOT OPENIMAGEIO_CONFIG_DO_NOT
endif ()
endif ()
# Compute the installation prefix relative to this file
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
if (NOT @OIIO_USING_FMT_LOCAL@ AND NOT @INTERNALIZE_FMT@)
find_dependency(fmt)
endif ()
# There's no guarantee that CMAKE_INSTALL_XXXDIR is a relative path so we extract the final component to handle asbolute paths
get_filename_component(_INCLUDE_DIR_NAME "@CMAKE_INSTALL_INCLUDEDIR@" NAME)
get_filename_component(_LIB_DIR_NAME "@CMAKE_INSTALL_LIBDIR@" NAME)
if (NOT @BUILD_SHARED_LIBS@)
# This is required in static library builds, as e.g. PNG::PNG appears among
# 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)
if (@JPEG_FOUND@)
find_dependency(JPEG)
endif()
if (@PNG_FOUND@)
find_dependency(PNG)
endif()
# The following have the same problem except that INTERFACE_LINK_LIBRARIES use
# TARGET_NAME_IF_EXISTS, so the error only happens on link time.
if (@OIIO_TBB@)
find_dependency(TBB)
endif ()
endif ()
set_and_check (@PROJECT_NAME@_INCLUDE_DIR "${_IMPORT_PREFIX}/${_INCLUDE_DIR_NAME}")
set_and_check (@PROJECT_NAME@_INCLUDES "${_IMPORT_PREFIX}/${_INCLUDE_DIR_NAME}")
set_and_check (@PROJECT_NAME@_LIB_DIR "${_IMPORT_PREFIX}/${_LIB_DIR_NAME}")
# Compute the installation prefix relative to this file. Note that cmake files are installed
# to ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} (see OIIO_CONFIG_INSTALL_DIR)
get_filename_component(_CURR_INSTALL_LIBDIR "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE)
get_filename_component(_ABS_CMAKE_INSTALL_LIBDIR "@CMAKE_INSTALL_FULL_LIBDIR@" ABSOLUTE)
get_filename_component(_ABS_CMAKE_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" ABSOLUTE)
file(RELATIVE_PATH _INCLUDEDIR_RELATIVE_TO_LIBDIR
"${_ABS_CMAKE_INSTALL_LIBDIR}" "${_ABS_CMAKE_INSTALL_INCLUDEDIR}")
get_filename_component(_CURR_INSTALL_INCLUDE_DIR
"${_CURR_INSTALL_LIBDIR}/${_INCLUDEDIR_RELATIVE_TO_LIBDIR}" ABSOLUTE)
set_and_check (@PROJECT_NAME@_INCLUDE_DIR "${_CURR_INSTALL_INCLUDE_DIR}")
set_and_check (@PROJECT_NAME@_INCLUDES "${_CURR_INSTALL_INCLUDE_DIR}")
set_and_check (@PROJECT_NAME@_LIB_DIR "${_CURR_INSTALL_LIBDIR}")
set (@PROJECT_NAME@_PLUGIN_SEARCH_PATH "@PLUGIN_SEARCH_PATH_NATIVE@")
if (NOT @FOUND_OPENEXR_WITH_CONFIG@)
@@ -44,4 +73,4 @@ include ("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components ("@PROJECT_NAME@")
# Set a CMake variable that says if this OpenImageIO build has OCIO support
set (@PROJECT_NAME@_HAS_OpenColorIO @OPENCOLORIO_FOUND@)
set (@PROJECT_NAME@_HAS_OpenColorIO @OpenColorIO_FOUND@)
+19 -15
View File
@@ -1,5 +1,5 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
@@ -39,20 +39,24 @@ macro (add_oiio_plugin)
get_filename_component (_plugin_name ${CMAKE_CURRENT_SOURCE_DIR} NAME_WE)
if (NOT _plugin_NAME)
# If NAME is not supplied, infer target name (and therefore the
# executable name) from the directory name.
# library name) from the directory name.
get_filename_component (_plugin_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
endif ()
# if (NOT _plugin_SRC)
# # If SRC is not supplied, assume local cpp files are its source.
# file (GLOB _plugin_SRC *.cpp)
# endif ()
# If SRC is supplied, use it. Otherwise, assume any unparsed arguments are the
# source files. If there are none, then glob *.cpp of the current directory.
if (NOT _plugin_SRC)
set (_plugin_SRC ${_plugin_UNPARSED_ARGUMENTS})
endif ()
if (NOT _plugin_SRC)
file (GLOB _plugin_SRC *.cpp)
endif ()
check_is_enabled (${_plugin_name} _enable_plugin)
if (_enable_plugin)
if (EMBEDPLUGINS)
# Add each source file to the libOpenImageIO_srcs, but it takes some
# bending over backwards to change it in the parent scope.
set (_plugin_all_source ${libOpenImageIO_srcs})
foreach (_plugin_source_file ${_plugin_UNPARSED_ARGUMENTS} )
foreach (_plugin_source_file ${_plugin_SRC})
list (APPEND _plugin_all_source "${CMAKE_CURRENT_SOURCE_DIR}/${_plugin_source_file}")
endforeach ()
set (libOpenImageIO_srcs "${_plugin_all_source}" PARENT_SCOPE)
@@ -60,17 +64,17 @@ macro (add_oiio_plugin)
set (format_plugin_include_dirs ${format_plugin_include_dirs} ${_plugin_INCLUDE_DIRS} PARENT_SCOPE)
set (format_plugin_libs ${format_plugin_libs} ${_plugin_LINK_LIBRARIES} PARENT_SCOPE)
else ()
# Get the name of the current directory and use it as the target name.
get_filename_component (_plugin_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
add_library (${_plugin_name} MODULE ${_plugin_UNPARSED_ARGUMENTS})
target_compile_definitions (${_plugin_name} PRIVATE
# # Get the name of the current directory and use it as the target name.
# get_filename_component (_plugin_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
add_library (${_plugin_NAME} MODULE ${_plugin_SRC})
target_compile_definitions (${_plugin_NAME} PRIVATE
${_plugin_DEFINITIONS}
OpenImageIO_EXPORTS)
target_include_directories (${_plugin_name} PRIVATE ${_plugin_INCLUDE_DIRS})
target_link_libraries (${_plugin_name} PUBLIC OpenImageIO
target_include_directories (${_plugin_NAME} PRIVATE ${_plugin_INCLUDE_DIRS})
target_link_libraries (${_plugin_NAME} PUBLIC OpenImageIO
PRIVATE ${_plugin_LINK_LIBRARIES})
set_target_properties (${_plugin_name} PROPERTIES PREFIX "" FOLDER "Plugins")
install_targets (${_plugin_name})
set_target_properties (${_plugin_NAME} PROPERTIES PREFIX "" FOLDER "Plugins")
install_targets (${_plugin_NAME})
endif ()
else ()
message (STATUS "${ColorRed}Disabling ${_plugin_name} ${ColorReset}")
+2 -2
View File
@@ -1,5 +1,5 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Is the named package "enabled" via our disabling convention? If either
+1 -1
View File
@@ -1,5 +1,5 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
+2 -2
View File
@@ -1,5 +1,5 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
+103 -35
View File
@@ -1,5 +1,5 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
###########################################################################
@@ -51,7 +51,8 @@ else ()
set (GCC_VERSION 0)
endif ()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER MATCHES "[Cc]lang")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER MATCHES "[Cc]lang"
OR CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
# If using any flavor of clang, set CMAKE_COMPILER_IS_CLANG. If it's
# Apple's variety, set CMAKE_COMPILER_IS_APPLECLANG and
# APPLECLANG_VERSION_STRING, otherwise for generic clang set
@@ -65,6 +66,12 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER MATCHES "[Cc]lan
if (VERBOSE)
message (STATUS "The compiler is Clang: ${CMAKE_CXX_COMPILER_ID} version ${APPLECLANG_VERSION_STRING}")
endif ()
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})
if (VERBOSE)
message (STATUS "The compiler is Intel Clang: ${CMAKE_CXX_COMPILER_ID} version ${INTELCLANG_VERSION_STRING}")
endif ()
else ()
string (REGEX REPLACE ".* version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION_STRING ${clang_full_version_string})
if (VERBOSE)
@@ -82,10 +89,14 @@ endif ()
###########################################################################
# Turn on more detailed warnings and optionally consider warnings as errors
#
if (${PROJECT_NAME}_SUPPORTED_RELEASE)
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" OFF)
else ()
if (NOT ${PROJECT_NAME}_SUPPORTED_RELEASE OR DEFINED ENV{${PROJECT_NAME}_CI})
# For development branches (i.e., not a supported release), or when
# running CI, default to treating all warnings as errors.
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" ON)
else ()
# For release branches not doing a CI build default to just printing
# warnings but not letting them stop the build.
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" OFF)
endif()
option (EXTRA_WARNINGS "Enable lots of extra pedantic warnings" OFF)
if (NOT MSVC)
@@ -93,11 +104,8 @@ if (NOT MSVC)
if (EXTRA_WARNINGS)
add_compile_options ("-Wextra")
endif ()
if (STOP_ON_WARNING OR DEFINED ENV{${PROJECT_NAME}_CI})
if (STOP_ON_WARNING)
add_compile_options ("-Werror")
# N.B. Force CI builds to use -Werror, even if STOP_ON_WARNING has
# been switched off by default, which we may do in release
# branches.
endif ()
endif ()
@@ -152,6 +160,9 @@ if (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG)
# Don't warn about using unknown preprocessor symbols in `#if`
add_compile_options ("-Wno-expansion-to-defined")
endif ()
if (CMAKE_GENERATOR MATCHES "Xcode")
add_compile_options ("-Wno-shorten-64-to-32")
endif ()
endif ()
if (CMAKE_COMPILER_IS_GNUCC AND NOT (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG))
@@ -170,8 +181,11 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
# Ensure this macro is set for stdint.h
add_definitions ("-D__STDC_LIMIT_MACROS")
add_definitions ("-D__STDC_CONSTANT_MACROS")
# this allows native instructions to be used for sqrtf instead of a function call
add_compile_options ("-fno-math-errno")
endif ()
if (INTELCLANG_VERSION_STRING VERSION_GREATER_EQUAL 2022.1.0)
# New versions of icx warn about changing certain floating point options
add_compile_options ("-Wno-overriding-t-option")
endif ()
if (MSVC)
@@ -190,6 +204,28 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"
add_compile_options (-march=i586)
endif ()
# Fast-math mode may go faster, but it breaks IEEE and also makes inconsistent
# results on different compilers/platforms, so we don't use it by default.
option (ENABLE_FAST_MATH "Use fast math (may break IEEE fp rules)" OFF)
if (ENABLE_FAST_MATH)
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
add_compile_options ("-ffast-math")
elseif (MSVC)
add_compile_options ("/fp:fast")
endif ()
else ()
if (CMAKE_COMPILER_IS_INTELCLANG)
# Intel icx is fast-math by default, so if we don't want that, we need
# to explicitly disable it.
add_compile_options ("-fno-fast-math")
endif ()
endif ()
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
# this allows native instructions to be used for sqrtf instead of a function call
add_compile_options ("-fno-math-errno")
endif ()
# We will use this for ccache and timing
set (MY_RULE_LAUNCH "")
@@ -305,6 +341,7 @@ if (NOT VERBOSE)
set (CMAKE_REQUIRED_QUIET 1)
endif ()
include (CMakePushCheckState)
include (CheckCXXSourceCompiles)
include (CheckCXXSourceRuns)
include (CheckLibraryExists)
@@ -313,9 +350,9 @@ include (CheckLibraryExists)
# Check if we need libatomic on this platform. We shouldn't on mainstream
# x86/x86_64, but might on some other platforms.
#
if (NOT MSVC AND NOT APPLE)
if (NOT MSVC AND NOT APPLE AND NOT ANDROID)
cmake_push_check_state ()
check_cxx_source_runs(
check_cxx_source_compiles(
"#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x {0};
@@ -341,17 +378,38 @@ if (NOT MSVC AND NOT APPLE)
endif ()
###########################################################################
# Check if we need have std::filesystem on this platform.
#
cmake_push_check_state ()
set (CMAKE_REQUIRED_DEFINITIONS ${CSTD_FLAGS})
check_cxx_source_compiles("#include <filesystem>
int main() { std::filesystem::path p; return 0; }"
USE_STD_FILESYSTEM)
if (USE_STD_FILESYSTEM AND GCC_VERSION AND GCC_VERSION VERSION_LESS 9.0)
message (STATUS "Excluding USE_STD_FILESYSTEM because gcc is ${GCC_VERSION}")
set (USE_STD_FILESYSTEM OFF)
endif ()
if (USE_STD_FILESYSTEM)
# Note: std::filesystem seems unreliable for gcc until 9
message (STATUS "Compiler supports std::filesystem")
add_definitions (-DUSE_STD_FILESYSTEM)
else ()
message (STATUS "Using Boost::filesystem")
add_definitions (-DUSE_BOOST_FILESYSTEM)
endif ()
cmake_pop_check_state ()
###########################################################################
# Code coverage options
#
option (CODECOV "Build code coverage tests" OFF)
if (CODECOV AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG))
message (STATUS "Compiling for code coverage analysis")
add_compile_options ("-ftest-coverage -fprofile-arcs -O0")
add_compile_options (-ftest-coverage -fprofile-arcs)
add_link_options (-ftest-coverage -fprofile-arcs)
add_definitions ("-D${PROJ_NAME}_CODE_COVERAGE=1")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs")
endif ()
@@ -365,22 +423,9 @@ if (SANITIZE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG))
foreach (feature ${SANITIZE_FEATURE_LIST})
message (STATUS " sanitize feature: ${feature}")
add_compile_options (-fsanitize=${feature})
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${feature}")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=${feature}")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=${feature}")
add_link_options (-fsanitize=${feature})
endforeach()
add_compile_options (-g -fno-omit-frame-pointer)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (SANITIZE_ON_LINUX 1)
endif ()
if (CMAKE_COMPILER_IS_GNUCC AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
add_compile_options ("-fuse-ld=gold")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=gold")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold")
set (SANITIZE_LIBRARIES "asan;pthread")
# set (SANITIZE_LIBRARIES "asan" "ubsan")
endif()
if (CMAKE_COMPILER_IS_GNUCC)
# turn on glibcxx extra annotations to find vector writes past end
add_definitions ("-D_GLIBCXX_SANITIZE_VECTOR=1")
@@ -389,6 +434,29 @@ if (SANITIZE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG))
endif ()
###########################################################################
# Fortification and hardening options
#
# In modern gcc and clang, FORTIFY_SOURCE provides buffer overflow checks
# (with some compiler-assisted deduction of buffer lengths) for the following
# functions: memcpy, mempcpy, memmove, memset, strcpy, stpcpy, strncpy,
# strcat, strncat, sprintf, vsprintf, snprintf, vsnprintf, gets.
#
# We try to avoid these unsafe functions anyway, but it's good to have the
# extra protection, at least as an extra set of checks during CI. Some users
# may also wish to enable it at some level if they are deploying it in a
# security-sensitive environment. FORTIFY_SOURCE=3 may have minor performance
# impact, though FORTIFY_SOURCE=2 should not have a measurable effect on
# performance versus not doing any fortification. All fortification levels are
# not available in all compilers.
set (FORTIFY_SOURCE "0" CACHE STRING "Turn on Fortification level (0, 1, 2, 3)")
if (FORTIFY_SOURCE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG))
message (STATUS "Compiling with _FORTIFY_SOURCE=${FORTIFY_SOURCE}")
add_compile_options (-D_FORTIFY_SOURCE=${FORTIFY_SOURCE})
endif ()
###########################################################################
# clang-tidy options
#
@@ -450,7 +518,7 @@ if (PROJECT_IS_TOP_LEVEL)
set (CLANG_FORMAT_EXCLUDES "*pugixml*" "*SHA1*" "*/farmhash.cpp"
"src/dpx.imageio/libdpx/*"
"src/cineon.imageio/libcineon/*"
"src/dds.imageio/squish/*"
"src/dds.imageio/bcdec.h"
"src/gif.imageio/gif.h"
"src/libutil/stb_sprintf.h"
CACHE STRING "Glob patterns to exclude for clang-format")
@@ -486,7 +554,7 @@ endif ()
set (EXTRA_CPP_ARGS "" CACHE STRING "Extra C++ command line definitions")
if (EXTRA_CPP_ARGS)
message (STATUS "Extra C++ args: ${EXTRA_CPP_ARGS}")
add_compile_options ("${EXTRA_CPP_ARGS}")
add_compile_options (${EXTRA_CPP_ARGS})
endif()
set (EXTRA_DSO_LINK_ARGS "" CACHE STRING "Extra command line definitions when building DSOs")
@@ -553,7 +621,7 @@ endif ()
###########################################################################
# Rpath handling at the install step
#
set (MACOSX_RPATH ON)
# set (MACOSX_RPATH ON)
if (CMAKE_SKIP_RPATH)
# We need to disallow the user from truly setting CMAKE_SKIP_RPATH, since
# we want to run the generated executables from the build tree in order to
+50 -48
View File
@@ -1,5 +1,5 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
###########################################################################
@@ -23,7 +23,7 @@ message (STATUS "${ColorReset}")
set (OIIO_LOCAL_DEPS_PATH "${CMAKE_SOURCE_DIR}/ext/dist" CACHE STRING
"Local area for dependencies added to CMAKE_PREFIX_PATH")
list (APPEND CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/ext/dist)
list (APPEND CMAKE_PREFIX_PATH ${OIIO_LOCAL_DEPS_PATH})
include (ExternalProject)
@@ -52,24 +52,25 @@ if (MSVC)
endif ()
endif ()
if (BOOST_CUSTOM)
set (Boost_FOUND true)
# N.B. For a custom version, the caller had better set up the variables
# Boost_VERSION, Boost_INCLUDE_DIRS, Boost_LIBRARY_DIRS, Boost_LIBRARIES.
else ()
set (Boost_COMPONENTS filesystem system thread)
# The FindBoost.cmake interface is broken if it uses boost's installed
# cmake output (e.g. boost 1.70.0, cmake <= 3.14). Specifically it fails
# to set the expected variables printed below. So until that's fixed
# force FindBoost.cmake to use the original brute force path.
set (Boost_NO_BOOST_CMAKE ON)
checked_find_package (Boost REQUIRED
VERSION_MIN 1.53
COMPONENTS ${Boost_COMPONENTS}
RECOMMEND_MIN 1.66
RECOMMEND_MIN_REASON "Boost 1.66 is the oldest version our CI tests against"
PRINT Boost_INCLUDE_DIRS Boost_LIBRARIES )
set (Boost_COMPONENTS thread)
if (NOT USE_STD_FILESYSTEM)
list (APPEND Boost_COMPONENTS filesystem)
endif ()
message (STATUS "Boost_COMPONENTS = ${Boost_COMPONENTS}")
# The FindBoost.cmake interface is broken if it uses boost's installed
# cmake output (e.g. boost 1.70.0, cmake <= 3.14). Specifically it fails
# to set the expected variables printed below. So until that's fixed
# force FindBoost.cmake to use the original brute force path.
if (NOT DEFINED Boost_NO_BOOST_CMAKE)
set (Boost_NO_BOOST_CMAKE ON)
endif ()
checked_find_package (Boost REQUIRED
VERSION_MIN 1.53
COMPONENTS ${Boost_COMPONENTS}
RECOMMEND_MIN 1.66
RECOMMEND_MIN_REASON "Boost 1.66 is the oldest version our CI tests against"
PRINT Boost_INCLUDE_DIRS Boost_LIBRARIES )
# On Linux, Boost 1.55 and higher seems to need to link against -lrt
if (CMAKE_SYSTEM_NAME MATCHES "Linux"
@@ -80,6 +81,8 @@ endif ()
include_directories (SYSTEM "${Boost_INCLUDE_DIRS}")
link_directories ("${Boost_LIBRARY_DIRS}")
option (OIIO_DISABLE_BOOST_STACKTRACE "Disable use of Boost stacktrace." OFF)
# end Boost setup
###########################################################################
@@ -101,14 +104,14 @@ checked_find_package (OpenEXR REQUIRED
PRINT IMATH_INCLUDES OPENEXR_INCLUDES)
# Force Imath includes to be before everything else to ensure that we have
# the right Imath/OpenEXR version, not some older version in the system
# library. This shoudn't be necessary, except for the common case of people
# library. This shouldn't be necessary, except for the common case of people
# building against Imath/OpenEXR 3.x when there is still a system-level
# install version of 2.x.
include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES})
if (MSVC AND NOT LINKSTATIC)
add_definitions (-DOPENEXR_DLL) # Is this needed for new versions?
endif ()
if (OPENEXR_VERSION VERSION_GREATER_EQUAL 3.0)
if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.0)
set (OIIO_USING_IMATH 3)
else ()
set (OIIO_USING_IMATH 2)
@@ -180,8 +183,8 @@ checked_find_package (OpenColorIO
DEFINITIONS -DUSE_OCIO=1 -DUSE_OPENCOLORIO=1
# PREFER_CONFIG
)
if (NOT OPENCOLORIO_FOUND)
set (OPENCOLORIO_FOUND 0)
if (NOT OpenColorIO_FOUND)
set (OpenColorIO_FOUND 0)
endif ()
checked_find_package (OpenCV 3.0
DEFINITIONS -DUSE_OPENCV=1)
@@ -189,7 +192,7 @@ checked_find_package (OpenCV 3.0
# Intel TBB
set (TBB_USE_DEBUG_BUILD OFF)
checked_find_package (TBB 2017
DEFINITIONS -DUSE_TBB=1
SETVARIABLES OIIO_TBB
PREFER_CONFIG)
checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images
@@ -248,21 +251,22 @@ checked_find_package (R3DSDK) # RED camera
set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target")
checked_find_package (Nuke)
checked_find_package (OpenGL) # used for iv
# Qt -- used for iv
set (qt5_modules Core Gui Widgets)
if (OPENGL_FOUND)
list (APPEND qt5_modules OpenGL)
endif ()
option (USE_QT "Use Qt if found" ON)
checked_find_package (Qt5 COMPONENTS ${qt5_modules})
if (USE_QT AND NOT Qt5_FOUND AND APPLE)
message (STATUS " If you think you installed qt5 with Homebrew and it still doesn't work,")
message (STATUS " try: export PATH=/usr/local/opt/qt5/bin:$PATH")
if (USE_QT)
checked_find_package (OpenGL) # used for iv
endif ()
if (USE_QT AND OPENGL_FOUND)
checked_find_package (Qt6 COMPONENTS Core Gui Widgets OpenGLWidgets)
if (NOT Qt6_FOUND)
checked_find_package (Qt5 COMPONENTS Core Gui Widgets OpenGL)
endif ()
if (NOT Qt5_FOUND AND NOT Qt6_FOUND AND APPLE)
message (STATUS " If you think you installed qt with Homebrew and it still doesn't work,")
message (STATUS " try: export PATH=/usr/local/opt/qt/bin:$PATH")
endif ()
endif ()
###########################################################################
@@ -305,22 +309,13 @@ macro (find_or_download_robin_map)
endmacro()
###########################################################################
# libsquish
option (USE_EMBEDDED_LIBSQUISH
"Force use of embedded Libsquish, even if external is found" OFF)
if (NOT USE_EMBEDDED_LIBSQUISH)
checked_find_package (Libsquish)
endif ()
###########################################################################
# fmtlib
option (BUILD_FMT_FORCE "Force local download/build of fmt even if installed" OFF)
option (BUILD_MISSING_FMT "Local download/build of fmt if not installed" ON)
set (BUILD_FMT_VERSION "8.0.0" CACHE STRING "Preferred fmtlib/fmt version, when downloading/building our own")
option (INTERNALIZE_FMT "Copy fmt headers into <install>/include/OpenImageIO/detail/fmt" ON)
set (BUILD_FMT_VERSION "9.0.0" CACHE STRING "Preferred fmtlib/fmt version, when downloading/building our own")
macro (find_or_download_fmt)
# If we weren't told to force our own download/build of fmt, look
@@ -349,9 +344,16 @@ macro (find_or_download_fmt)
endif ()
endif ()
set (FMT_INCLUDE_DIR "${FMT_INSTALL_DIR}/include")
set (OIIO_USING_FMT_LOCAL TRUE)
else ()
set (OIIO_USING_FMT_LOCAL FALSE)
endif ()
checked_find_package (fmt REQUIRED)
endmacro()
find_or_download_fmt()
include_directories (${FMT_INCLUDES})
if (FMT_VERSION VERSION_EQUAL 90100
AND GCC_VERSION VERSION_GREATER 0.0 AND NOT GCC_VERSION VERSION_GREATER 7.2)
message (WARNING "${ColorRed}fmt 9.1 is known to not work with gcc <= 7.2${ColorReset}")
endif ()
+8 -1
View File
@@ -1,5 +1,5 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
# Macro to add an executable build target. The executable name can be
@@ -52,6 +52,13 @@ macro (fancy_add_executable)
endif ()
set_target_properties (${_target_NAME} PROPERTIES FOLDER "Tools")
check_is_enabled (INSTALL_${_target_NAME} _target_NAME_INSTALL_enabled)
if (CMAKE_UNITY_BUILD AND UNITY_BUILD_MODE STREQUAL GROUP)
set_source_files_properties(${_target_SRC} PROPERTIES
UNITY_GROUP ${_target_NAME})
if (VERBOSE)
message (STATUS "Unity group ${_target_NAME} = ${_target_SRC}")
endif ()
endif ()
if (_target_NAME_INSTALL_enabled)
install_targets (${_target_NAME})
endif ()
+4
View File
@@ -1,5 +1,9 @@
# Module to find DCMTK
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
#
# This module will first look into the directories defined by the variables:
# - DCMTK_ROOT, DCMTK_INCLUDE_PATH, DCMTK_LIBRARY_PATH
#
+15 -7
View File
@@ -16,8 +16,8 @@
# BSD license.
#
# Modifications:
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
if (FFMPEG_INCLUDES AND FFMPEG_LIBRARIES)
@@ -59,17 +59,25 @@ else ()
endif ()
if (FFMPEG_INCLUDES)
file(STRINGS "${FFMPEG_INCLUDES}/libavcodec/version.h" TMP
set (_libavcodec_version_major_h "${FFMPEG_INCLUDES}/libavcodec/version_major.h")
if (NOT EXISTS "${_libavcodec_version_major_h}")
set (_libavcodec_version_major_h "${FFMPEG_INCLUDES}/libavcodec/version.h")
endif()
file(STRINGS "${_libavcodec_version_major_h}" TMP
REGEX "^#define LIBAVCODEC_VERSION_MAJOR .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" LIBAVCODEC_VERSION_MAJOR ${TMP})
string (REGEX MATCHALL "[0-9]+[.0-9]+" LIBAVCODEC_VERSION_MAJOR "${TMP}")
file(STRINGS "${FFMPEG_INCLUDES}/libavcodec/version.h" TMP
REGEX "^#define LIBAVCODEC_VERSION_MINOR .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" LIBAVCODEC_VERSION_MINOR ${TMP})
string (REGEX MATCHALL "[0-9]+[.]?[0-9]*" LIBAVCODEC_VERSION_MINOR "${TMP}")
file(STRINGS "${FFMPEG_INCLUDES}/libavcodec/version.h" TMP
REGEX "^#define LIBAVCODEC_VERSION_MICRO .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" LIBAVCODEC_VERSION_MICRO ${TMP})
string (REGEX MATCHALL "[0-9]+[.0-9]+" LIBAVCODEC_VERSION_MICRO "${TMP}")
set (LIBAVCODEC_VERSION "${LIBAVCODEC_VERSION_MAJOR}.${LIBAVCODEC_VERSION_MINOR}.${LIBAVCODEC_VERSION_MICRO}")
if (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 59.18.100)
if (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 60.3.100)
set (FFMPEG_VERSION 6.0)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 59.37.100)
set (FFMPEG_VERSION 5.1)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 59.18.100)
set (FFMPEG_VERSION 5.0)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 58.134.100)
set (FFMPEG_VERSION 4.4)
+4
View File
@@ -1,3 +1,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
# - Try to find libjpeg-turbo
# Once done, this will define
#
+4
View File
@@ -1,5 +1,9 @@
# Module to find LIBHEIF
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
#
# This module will first look into the directories defined by the variables:
# - Libheif_ROOT, LIBHEIF_INCLUDE_PATH, LIBHEIF_LIBRARY_PATH
#
-69
View File
@@ -1,69 +0,0 @@
# Module to find Libsquish
#
# This module will first look into the directories defined by the variables:
# - Libsquish_ROOT, LIBSQUISH_INCLUDE_PATH, LIBSQUISH_LIBRARY_PATH
#
# This module defines the following variables:
#
# Libsquish_FOUND True if Libsquish was found.
# LIBSQUISH_INCLUDES Where to find Libsquish headers
# LIBSQUISH_LIBRARIES List of libraries to link against when using Libsquish
# LIBSQUISH_VERSION Version of Libsquish (e.g., 3.6.2)
include (FindPackageHandleStandardArgs)
include (SelectLibraryConfigurations)
find_path (LIBSQUISH_INCLUDE_DIR squish.h
HINTS
${LIBSQUISH_INCLUDE_PATH}
ENV LIBSQUISH_INCLUDE_PATH
DOC "The directory where Libsquish headers reside")
find_library (LIBSQUISH_LIBRARY_RELEASE squish
HINTS ${LIBSQUISH_LIBRARY_PATH} ENV LIBSQUISH_LIBRARY_PATH)
find_library (LIBSQUISH_LIBRARY_DEBUG squishd
HINTS ${LIBSQUISH_LIBRARY_PATH} ENV LIBSQUISH_LIBRARY_PATH)
select_library_configurations(LIBSQUISH)
find_package_handle_standard_args (Libsquish
REQUIRED_VARS
LIBSQUISH_INCLUDE_DIR
LIBSQUISH_LIBRARY
)
if (Libsquish_FOUND)
set (LIBSQUISH_INCLUDES ${LIBSQUISH_INCLUDE_DIR})
if (NOT LIBSQUISH_LIBRARIES)
set (LIBSQUISH_LIBRARIES ${LIBSQUISH_LIBRARY})
endif ()
if (NOT TARGET Libsquish::Libsquish)
add_library(Libsquish::Libsquish UNKNOWN IMPORTED)
set_target_properties(Libsquish::Libsquish PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBSQUISH_INCLUDES}")
if (LIBSQUISH_LIBRARY_RELEASE)
set_property(TARGET Libsquish::Libsquish APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Libsquish::Libsquish PROPERTIES
IMPORTED_LOCATION_RELEASE "${LIBSQUISH_LIBRARY_RELEASE}")
endif ()
if (LIBSQUISH_LIBRARY_DEBUG)
set_property(TARGET Libsquish::Libsquish APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(Libsquish::Libsquish PROPERTIES
IMPORTED_LOCATION_DEBUG "${LIBSQUISH_LIBRARY_DEBUG}")
endif ()
if (NOT LIBSQUISH_LIBRARY_RELEASE AND NOT LIBSQUISH_LIBRARY_DEBUG)
set_property(TARGET Libsquish::Libsquish APPEND PROPERTY
IMPORTED_LOCATION "${LIBSQUISH_LIBRARY}")
endif ()
endif ()
endif ()
mark_as_advanced (
LIBSQUISH_INCLUDE_DIR
LIBSQUISH_LIBRARY
)
+4
View File
@@ -1,3 +1,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# - CMake find module for Nuke
#
# If requesting a specific release, the Nuke version string must be converted
+4
View File
@@ -1,3 +1,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# - Find OpenCV
# Find the OpenCV library
# This module defines
+7 -3
View File
@@ -1,3 +1,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# Module to find OpenColorIO
#
# This module will first look into the directories hinted by the variables:
@@ -9,7 +13,7 @@
#
# Old style CMake, this module also defines the following variables:
#
# OPENCOLORIO_FOUND - True if OpenColorIO was found.
# 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
@@ -20,7 +24,7 @@
# 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 perferred if found.
# 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
@@ -82,7 +86,7 @@ find_library (OPENCOLORIO_LIBRARY
find_package_handle_standard_args (OpenColorIO
REQUIRED_VARS OPENCOLORIO_INCLUDE_DIR OPENCOLORIO_LIBRARY
FOUND_VAR OPENCOLORIO_FOUND
FOUND_VAR OpenColorIO_FOUND
VERSION_VAR OPENCOLORIO_VERSION
)
+4
View File
@@ -1,3 +1,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
# Module to find OpenEXR and Imath.
#
# I'm afraid this is a mess, due to needing to support a wide range of
+4
View File
@@ -1,3 +1,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
# Module to find OpenJpeg.
#
# This module will first look into the directories defined by the variables:
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause
# - Find OPENVDB library
# Find the native OPENVDB includes and library
# This module defines
+4
View File
@@ -1,3 +1,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# - Try to find R3D SDK
#
# Set R3DSDK_ROOT Environment variable to root of the SDK
+4
View File
@@ -1,5 +1,9 @@
# Find Robinmap
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
#
# Sets the usual variables expected for find_package scripts:
#
# ROBINMAP_INCLUDES - header location
+1 -1
View File
@@ -58,7 +58,7 @@
#
# * TBB_FOUND - Set to false, or undefined, if we haven’t found, or
# don’t want to use TBB.
# * TBB_<component>_FOUND - If False, optional <component> part of TBB sytem is
# * TBB_<component>_FOUND - If False, optional <component> part of TBB system is
# not available.
# * TBB_VERSION - The full version string
# * TBB_VERSION_MAJOR - The major version
+12 -8
View File
@@ -1,5 +1,9 @@
# Module to find Webp
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
#
# This module will first look into the directories defined by the variables:
# - Webp_ROOT, WEBP_INCLUDE_PATH, WEBP_LIBRARY_PATH
#
@@ -40,18 +44,18 @@ 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
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
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
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
set_property(TARGET WebP::webpdemux APPEND PROPERTY
IMPORTED_LOCATION ${WEBPDEMUX_LIBRARY})
endif ()
endif ()
+4
View File
@@ -1,5 +1,9 @@
# Find fmt library
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
#
# Sets the usual variables expected for find_package scripts:
#
# FMT_INCLUDES - header location

Some files were not shown because too many files have changed in this diff Show More