Compare commits

...
478 Commits
Author SHA1 Message Date
Clifford Yapp cfe3a2bfaf Merge tag 'v2.5.12.0' into RELEASE 2024-06-25 09:13:40 -04:00
Larry Gritz 67a6bb1c63 Stage for v2.5.12.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-06-01 12:59:05 -07:00
Larry Gritz 1f8e563712 ci: Avoid Ubuntu apt-get update that's killing the 24.04 runners (#4278)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-06-01 12:59:05 -07:00
Larry Gritz f434dd3a76 build: typo in OpenVDB version check
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-28 12:56:12 -07:00
Larry Gritz a185e6ec5d build: gcc-14 support, testing, CI (#4270)
* Switch runner type for bleeding edge, use gcc14 and python 3.12

* Various minor gcc-14 + C++20 + Python 3.12 fixes

Notable: gcc14 warns about std::atomic_load for share_ptr as deprecated,
since C++20 provides a true atomic shared pointer.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-28 10:50:21 -07:00
Jesse Yurkovich b33e591be7 build: Add appropriate compiler defines and flags for SIMD with MSVC (#4266)
This should address the following 2 issues when using MSVC:
- MSVC does not set defines like `__SSE2__` or `__SSE4_2__` etc. we must
do that ourselves
- MSVC uses the `/arch` flag differently than other compilers and it
should be set only once

The ramifications of not having those defines set basically means that
OIIO won't notice any SIMD is possible.

For MSVC the /arch flag only controls which instruction set the compiler
may use when generating code "on its own". For example, the x64 compiler
by default will use SSE2 whenever possible when its generating code but
when using `/arch:AVX` it will produce AVX code as it sees fit. NOTE:
case matters here too! "avx" does not work but "AVX" does.

However, if the source code uses intrinsics, MSVC will happily use those
instead. In fact it's possible to use `avx512` intrinsics without
specifying any /arch flag at all and it will happily generate
corresponding avx512 code. This is much different than say GCC where, in
order to use intrinsics at all, you must specify the corresponding flags
allowing you to do so for the arch in question.

Fixes #4265

Existing simd_test.cpp should be sufficient I think. In addition to
those, I've verified the below locally:

Currently: when using `-DUSE_SIMD="sse4.2,avx2"` to build, we get the
wrong `build:simd` flags:
`sse2`

After: using the same flags as above:
`sse2,sse3,ssse3,sse41,sse42,avx,avx2`

---------

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
2024-05-26 14:02:31 -07:00
Larry Gritz 29334c2f18 test: Fix windows quoting for test (#4271)
We didn't notice before because our CI didn't test with OCIO on Windows.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-26 14:00:20 -07:00
Larry Gritz b63a1a4268 fix(simd.h): fix longstanding probem with 16-wide bitcast for 8-wide HW (#4268)
We've been plagued on and off for a long time with spurious wrong
results in our SIMD versions of exp and log. It was really squirrelly,
came and went with changes to seemingly unrelated code, and had long
periods of time with no symptoms or ability to reproduce it. It just
started popping up again in CI in the dev-2.5 branch, consistently.

Today I think I finally tracked it down for real. I believe the problem
was actually in the SIMD bitcast_to_int and bitcast_to_float functions,
for the variety that was 8-wide when running on 4-wide hardware, and the
16-wide one when running on 8-wide (or less) hardware.

Background: When real 16-wide HW is not available, we define the 16-wide
vectors as an array of two 8-wide vectors. (Same for 8 vs 4, I'll spare
you explaining it all twice.) So most of the 16 wide functions boil down
to:

    vfloat16 op (vfloat16 arg, ...)
    {
    #if 16 wide HW is available
        return real_16_wide_intrinsic(arg);
    #else /* recursively define in terms of 8-wide halves */
        return vfloat16(op(arg.lo()), op(arg.hi()));
    #endif
    }

But for the bitcast operators, we did something different, a shade too
clever: we just did a pointer cast, dereference and return:

    vint16 bitcast_to_int (const vfloat16& x)
    {
    #if OIIO_SIMD_AVX >= 512
        return _mm512_castps_si512 (x.simd());
    #else
        return *(vint16 *)&x;
    #endif
    }

I believe that the problem is that this cast is undefined behavior for
the case where the vector x was broken into two halves, and by being in
the middle of a long code sequence of SIMD ops, the two halves happened
to be in registers at that moment. Basically, we are taking the address,
and it just doesn't seem to always understand that it needs to
materialize the whole thing in memory for the pointer cast to work
properly.

I removed the pointer cast and replaced with

    return vfloat16(bitcast_to_float(x.lo()), bitcast_to_float(x.hi()));

basically falling back on the usual recursive definition of 16-wide
operations to being in terms of 8-wide operations when 16-wide HW is not
available. This totally clears up the problem since we're no longer
potentially relying on needing the address of something that has no
address at that moment.

A couple other spots (andnot) also had dubious casts that I fixed in the
same way.

N.B.: The 16-wide cast from bool to int had to do something slightly
different, because it's represented differently and isn't a true
bitcast.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-22 11:13:06 -07:00
jreichel-nvidia 6702d2b927 fix: Add proxy support for EXR multipart output (#4263) (#4264)
Add proxy support for EXR multipart output by taking the setup code from
the other open() overload and calling the constructor accepting a stream
instead of a filename.


---------

Signed-off-by: Joachim Reichel <43646584+jreichel-nvidia@users.noreply.github.com>
2024-05-18 16:39:39 -07:00
Larry Gritz 293df93701 testing: Add new heif test output (#4262)
Some weird combination of old libheif library gives a different
oiio:OriginalOrientation result. Need this ref because that's how it
behaves in that version (which I have to build against at work), but
it's not worth tracking down a "fix" because it's so old and works fine
on newer versions.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-18 16:39:19 -07:00
Larry Gritz fc7f304240 refactor: oiiotool break out expression eval methods into separate file (#4256)
This is just a code move. There no changes to the code logic, though in
the process, I do change old "local" uses of eval_as_bool to the new
Strutil one.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-18 16:38:56 -07:00
Larry Gritz c1796e62b8 fix: Improve IB::nsubimages and other related fixes (#4228)
Background: Some formats that support multi-image files know as soon as
they are opened and read the header what the total subimage count is.
Others (I'm looking at you, TIFF) can't know without reading each
subimage in succession until you hit the end of the file. Format readers
who can easily figure it out open first opening are supposed to set
attribute "oiio:subimages" to the number of subimages, or 0 / unset if
it can't be cheaply or immediately determined.

ImageBuf has a `nsubimages()` method that you'd think would give you the
right count, and it did when all IBs were read through the ImageCache
(which fully inventories the subimages of any file it reads). But when
OIIO 2.5 changed IB behavior to only be backed by IC when explicitly
requested, we effectively lost this functionality most of the time, and
instead returned 0 ("don't know yet"). This was confusing. And also
silly, because it reported 0 even for files whose formats don't permit
multiple images (so you know the count is 1).

This patch does the following:

* Changes the behavior and documentation of `ImageBuf::nsubimages()` to
the following return values:
- 1, for formats that are always a single subimage. (Or for ImageBufs
that are not direct reads of a file.)
- n>=1 for files that permit multiple subimages and the count is known.
- 0 for files that permit multiple subimages, but the count is not known
because it's one of the formats where it can't easily be determined upon
opening the file.
* Add a new ImageInput::supports("multiimage") that says if the input
file format permits multiple images, and ensure that it returns true for
all formats where this is the case.
* Ensure that formats permitting multiimage and can easily know the
count up front set the "oiio:subimages" attribute (not all did).
* Document in the built-in format section of the docs the formats that
are expected to set this attribute.

Fixes #4225

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-18 15:47:02 -07:00
Larry Gritz 9d76df377b build: More warning elimination for clang18 (#4257)
This is a continuation of PR 4246, had one more spot where we needed to
disable warnings for unity builds involving clang18 and deprecated
unicode conversion functions.

There's some changes included to ci.yml and install_homebrew_deps.bash
that are part of work I did to make it easier for me to force it to use
clang-18 for certain tests while working on this.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-18 15:46:22 -07:00
Vlad (Kuzmin) Erium fc69bf4603 pnm: Improvements to pnm plugin (#4253)
Fixes added:

- import/export support for 8/16 uint 32-float
- "pnm:bigendian" attribute reports/controls andianness
- "pnm:pfmflip" attribute (when set to 0) can disable the automatic vertical flip of pfm files (GIMP flips float PFM files by default, Photoshop does not)
- update in documentation

---------

Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
Signed-off-by: Vlad (Kuzmin) Erium <shaamaan@gmail.com>
2024-05-18 15:46:03 -07:00
Larry Gritz e3bd662563 docs: Fix stray references to the old repo home (#4255)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-18 15:45:33 -07:00
Larry Gritz 530987caaf dev: Add Strutil::eval_as_bool (#4250)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-18 15:44:55 -07:00
Larry Gritz 6fc6f83ccc Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-18 15:44:26 -07:00
Larry Gritz 7141852ffe Stage for v2.5.11.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-05-01 09:16:57 -07:00
Larry Gritz c0ece769db fix: fix crash when no default fonts are found (#4249)
The nullptr at the end of default_font_name was left over from a time
that we iterated by going through array elements until we hit the
nullptr that signalled we had passed the last valid element. At some
point we switched to a range-for, which iterates over every element of
the array without needing an "end sentinel", and we should have
eliminated the nullptr but failed to do so.

Fixes #4248

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-29 19:19:03 -07:00
Brecht Van Lommel 3f38a7e34d Don't use (DY)LD_LIBRARY_PATH as plugin search paths (#4245)
Only use the OIIO_LIBRARY_PATH environment variable by default.

Searching through such system paths has some risk loading plugins
installed for another purpose or that may be incompatible.

If the previous behavior is desired, applications can add these
environment variables to the plugin search path manually.

Signed-off-by: Brecht Van Lommel <brecht@blender.org>
2024-04-29 19:18:33 -07:00
Larry Gritz 66576b33e0 build: Disable clang18 warnings about deprecated unicode conversion (#4246)
clang/llvm 18 (and probably other compilers soon) has made noisy
warnings about the C++17-deprecated unicode conversions. Actually
replacing them enirely with something else is rather hairy, we will
tackle that later.

In the mean time, this patch seems to be the minimal change to disable
the warnings that should be totally easy to backport.

These seem to be the only changes necessary to make a clean build with
clang 18.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-28 12:15:00 -07:00
Larry Gritz 22665432ac security: Better documentation of past CVE fixes in SECURITY.md (#4238)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-28 12:12:15 -07:00
Larry Gritz 9e9e80d764 fix(fmt.h): fix build break from recent fmt change (#4227)
We disable fmt execptions and force it to do one of our ASSERT's
instead. But fmt in their main branch recently added `[[noreturn]]`
annotations in a way that cause this to be compiler errors for our
overrides. Needed an extra std::terminate() call to guarantee the
noreturn promise.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-15 09:42:53 -07:00
Aaron Colwell d75a7d470f fix(openexr): Fix out-of-bounds reads when using OpenEXR decreasingY lineOrder. (#4215)
This change fixes out-of-bounds reads and incorrect scanline ordering
when OpenEXR's decreasingY lineOrder mode is used.

OpenEXR expects to process scanlines in decreasing order when the
decreasingY lineOrder option is enabled. This change fixes the code that
provides the chunks of scanlines to OpenEXR so that the proper scanlines
are available when it accesses the FrameBuffer OIIO created. The old
code was providing incorrect scanlines AND setting up the FrameBuffer
with incorrect pointers so out-of-bounds reads were occurring.

The key things to keep in mind are:
- Chunks of scanlines need to be sent to
OpenEXROutput::write_scanlines() from the bottom of the image to the top
when decreasingY is enabled. If the chunk's scanline range does not
contain the scanlines OpenEXR is expecting to fetch, then it can cause
out-of-bound reads because the wrong information is used to construct
the pointers for the Slices created when constructing a FrameBuffer.
- OpenEXROutput::write_scanlines() does its own chunking of scanlines
and this logic must also properly start from the bottom of the chunk
data passed into this function when decreasingY is enabled.
- The to_native_rectangle() call in OpenEXROutput::write_scanlines() may
return a pointer to m_scratch if a format conversion is needed. This
means the pointers passed to OpenEXR, in this situation, _WILL NOT_ be a
full frame buffer. This caused OpenEXR to do out-of-bounds reads because
the computations used to create the Slices were using the wrong scanline
number to adjust the pointer.
- The progress callback computation needed to be modified to handle
traversing scanlines in decreasing order.

I added an openexr-decreasingY test to verify that the code no longer
crashes because of the out-of-bound reads and it also verifies that the
decreasingY images match the increasingY images.

---------

Signed-off-by: Aaron Colwell <300262+acolwell@users.noreply.github.com>
2024-04-13 08:38:13 -07:00
alexguirre 2421ab8342 feat(dds): DDS support more DXGI formats (#4220)
Adds support for the following DXGI formats when using the DX10 extended
header on DDS files:
 - Compressed BCn and its sRGB variants.
 - BGRA8/BGRX8/RGBA8 and its sRGB variants.
 - RGB10A2.
 - R16.

On the sRGB formats, the attribute `oiio:ColorSpace` is also set to
`sRGB`.

Closes #4045.

Added new DDS test images to the OpenImageIO-images repo and updated the
testsuite expected output.
OpenImageIO-images PR:
https://github.com/AcademySoftwareFoundation/OpenImageIO-images/pull/7

Signed-off-by: Alejandro Aguirre <alexguirre.aa@gmail.com>
2024-04-13 08:37:46 -07:00
EmilDohneandLarry Gritz d9e764053b feat(psd): Add support for 16- and 32-bit Photoshop file reads (#4208)
As mentioned in #4205, #3900 and
https://github.com/AcademySoftwareFoundation/OpenImageIO/discussions/3910#discussioncomment-8913737
OpenImageIO previously did not support reading of 16- and 32-bit files
beyond their merged image data section. I have now implemented this by:

1. Adding support for reading layer info from the "Lr16" and "Lr32"
Tagged Blocks as well as adding additional checks to the regular layer
info section
2. Implemented the Zip and ZipPrediction compression codec which is
required to read these files as that is photoshops preferred compression
codec for those bitdepths

Due to the way the Zip data is stored (per channel but not per scanline)
the current implementation reads the whole channel into a buffer which
is then memcpy'd from by calls to `read_native_scanline()`. The buffer
gets cleared on deletion of the `PSDInput` object

---------

Signed-off-by: EmilDohne <86836589+EmilDohne@users.noreply.github.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
2024-04-02 11:15:00 -07:00
Larry Gritz 7046d8af8a ci: Fix broken Windows CI by building our own libtiff (#4214)
Windows CI was failing because it couldn't get a proper libtiff from
VcPkg, which in turn is because lzma is a dependency of the libtiff
build in VcPkg, and for the time being, it looks like VcPgk is failing
to get lzma which is part of the big xz debacle of 2024.

So work around for now by just building our own libtiff rather than
relying on VcPkg. Seems to work fine.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-01 22:25:28 -07:00
Larry Gritz 73041c2a09 Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-01 12:11:17 -07:00
Larry Gritz 34a9b0754f v2.5.10.1 -- because 2.5.10.0 was mis-tagged
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-04-01 12:07:17 -07:00
Larry Gritz a7d5d0a171 Stage for v2.5.10.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-30 22:21:29 -07:00
Larry Gritz 4e6ae73eb9 fix: Restore internals of strhash to compile on 32 bit architectures (#4213)
Fixes #4212

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-30 20:35:29 -07:00
Chris Hellmuth 9e4fe339ab texture.h: Overload decode_wrapmode to support ustringhash (#4207)
For OSL, we want to be able to decode a wrapmode directly from a
ustringhash without having to expensively convert it to ustring.

Signed-off-by: Chris Hellmuth <chellmuth@gmail.com>
2024-03-28 13:25:01 -07:00
Larry Gritz e3b45a798d build: FindOpenColorIO failed to properly set OpenColorIO_VERSION (#4196)
... in the OCIO 1.x case where we relied on our own Find module rather
than an exported cmake config from OCIO itself. This is desired for
uniformity of naming with the exported configs of the later versions.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-27 21:10:46 -07:00
Vlad (Kuzmin) Erium 28eb2e864e fix: iv build issues with glTexImage3D (#4202)
glTexImage3D not in QOpenGLFunctions but in QOpenGLExtraFunctions
https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/4180

Signed-off-by: ssh4net <libalias@gmail.com>
2024-03-27 18:29:36 -07:00
Clifford Yapp d188d1e53d Match RELEASE to v2.5.9.0 2024-03-27 13:48:58 -04:00
Clifford Yapp 58082d98f4 Merge tag 'v2.5.9.0' into RELEASE 2024-03-27 13:46:29 -04:00
Larry Gritz 15613a43bd ci: Enable Windows 2022 CI tests (#4195)
Needed some fixups with its python version to get it fully working.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-22 11:20:11 -07:00
Larry Gritz e7fb6883b5 build: need additional include (#4194)
On some platforms, for C++17 or higher, and we were missing one header we
needed in this module.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-22 11:19:08 -07:00
Sergio Rojas 8ffef13a6e build: Fix buld_ninja.bash to make directories and download correctly (#4192)
Signed-off-by: Sergio Rojas <sergiorojasava@gmail.com>
2024-03-22 11:18:58 -07:00
Andy Chan a616f93bec feat: Implement copy_image for OpenEXR (#4004)
Base on the [OIIO slack channel
discussion](https://academysoftwarefdn.slack.com/archives/C05782U3806/p1689031780561469),
this PR implements the `copy_image` function for the OpenEXR format. The
main motivation of this PR was due to a recompression issue where
copying a lossy compressed EXR image (pixels are decoded and then
encoded again), which can cause the image quality to downgrade on each
iteration.

- `OpenEXROutput` is now a friend class of `OpenEXRInput`. Since
`OpenEXROutput::copy_image()` needs to access some of the private
members in `OpenEXRInput` (This approach is referencing the
implementation in `JpegInput` and `JpegOutput`).
- The `OpenEXRInputStream` and `OpenEXRInput` class have been moved from
`exrinput.cpp` to `exr_pvt.h`. As `OpenEXRInput` depends on
`OpenEXRInputStream`, so both have to be moved together. Such relocation
is necessary due to the above reason, i.e. `OpenEXROutput::copy_image()`
needs to access some of the private members in `OpenEXRInput`.
- And the implementation itself, `OpenEXROutput::copy_image()` overrides
the base class method just like `JpegOutput` does.

The `OpenEXROutput::copy_image()` implementation took the advantages of
the existing OpenEXR function `Imf::OutputFile::copyPixels`, quoting the
comment from the function:
>  //--------------------------------------------------------------
    // Shortcut to copy all pixels from an InputFile into this file,
    // without uncompressing and then recompressing the pixel data.
    // This file's header must be compatible with the InputFile's
    // header:  The two header's "dataWindow", "compression",
    // "lineOrder" and "channels" attributes must be the same.
    //--------------------------------------------------------------
    IMF_EXPORT void copyPixels (InputFile &in);

When the output image is copied from an input image, the pixel data can
only be located in one of the input parts. So it checks if both input
and output part is initialized (non-null), then invoke the `copyPixels`
function in place.

All the error handling is done within the OpenEXR `copyPixels` call.
There is a try-catch block in OIIO side that emits an error message and
fallback to the default image copy routine, e.g.
`ImageOutput::copy_image`.

Note that currently, this doesn't do anything optimized for the
"core library" code path.

---------

Signed-off-by: Andy Chan <andychancse@gmail.com>
2024-03-20 21:46:42 -07:00
Larry Gritz 93c509344a ci: make one of the Mac tests build for avx2 (#4188)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-16 09:32:09 -07:00
Larry Gritz 85d2e4a0c5 fix(heif): Fixes to recent orientation support (#4184)
We inadvertently started using libheif functions that only became
available in their version 1.16.0. Guard against that and now we
recommend at least that version (but we aren't yet changing the minimum
requirement). This fixes a build break introduced in #4142 (but only
breaks for older libheif).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-16 09:31:53 -07:00
Larry Gritz d6068140ce fix(simd.h): gather_mask was wrong for no-simd fallback (#4183)
The operation it's supposed to be performing is to merge in the gathered
value where the mask is set, and leave mask=0 lanes unchanged. But for
our "no SIMD" fallback (i.e., no AVX2 for 4- and 8-wide), we incorrectly
implemented it as setting the unmasked lanes to 0!

This was quite wrong, and unfortunately masked by the fact that our test
of the function initialized a variable to 0. Change to a better number.
The best number.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-16 09:31:24 -07:00
Larry Gritz 8e438382bd fix: Mismatched pragma push/pop in hash.h (#4182)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-16 09:31:14 -07:00
Larry Gritz 418555cc33 fix: format spec typos (#4172)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-10 20:32:02 -07:00
Larry Gritz fafbafee9a ci: Allow triggering CI workflow from web (#4178)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-10 20:31:38 -07:00
Larry Gritz 7e5eb047cb admin: Add a ROADMAP document (#4161)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-10 20:29:11 -07:00
Larry Gritz 9e9082b8fc fix(build): Fix warning when Freetype is disabled (#4177)
A variable was declared unconditionally but only used when Freetype is
enabled. Move its declaration to be within the right conditional, on
order to avoid compiler warnings about unused static variables.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-06 14:39:10 -08:00
Larry Gritz de8f55afc4 fix: Add some color space aliases (#4166)
Automatically recognize some additional color space name synonyms:

"srgb_texture", "lin_rec709" and "lin_ap1" are names that MaterialX and
USD use as canonical names.

Also add common permutation "srgb_tx" and "srgb texture" as additional
aliases for srgb.

Fixes #4165

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-05 14:12:20 -08:00
Larry Gritz 7d2ef33b3f feat(oiiotool): Allow decision making about fixnan (#4171)
Added a new bit of pseudo-metadata that can be retrieved by oiiotool's
expression substitution: `{TOP.NONFINITE_COUNT}` will be replaced by the
count of inf and nan values present in the top image.

Also, the `-fixnan` command now has the side effect of setting a user
variable called `NONFINITE_COUNT` to the number of nonfinite values that
were detected or repaired.

Between the two of these, it's now easy to solve the following problem
that actually came up in production for us.

Sometimes, nans creep into images, and it's easier to repair them than
to fix the complicated process that produced them in the first place.
For some process in the studio, we had a script that was doing this
preemptively on every image it encountered:

    oiiotool image.exr -fixnan black -o image.exr

It was very expensive to repair every image whether it needed it or not,
when actually it's only needed once every
many-thousands-of-images. Most of the expense was in outputting the
repaired file overtop the original. Now we can do this

oiiotool image.exr -if "{TOP.NONFINITE_COUNT}" -fixnan black -o
image.exr -endif

It still has to read the image and look for NaN values, but since there
are almost never any actual NaN's, now for the usual case, it can skip
writing the output -- which was the vast majority of time.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-05 11:53:14 -08:00
Larry Gritz c96dfd8144 docs: Fix some typos and add missing oiiotool expression explanations (#4169)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-05 09:41:46 -08:00
Larry Gritz 09d1c5a693 fix(heic): Don't auto-transform camera-rotated images (#4142)
It seems that unlike most image formats where we merely note the camera
rotation but don't rotate the pixels, the heic reader automatically
rotated.

The trick is that using the C++ API wrapper of libheif, there is no way
to pass the decoder options struct that is where you need to say not to
auto-transform. Needed to drop down to the lower level C API for this
one spot.

We want this format to behave like the others -- the orientation is
advisory, and it's up to the app how to deal with it. But we have back
compatibility to deal with.

If a rotated image is aecountered, OIIO 2.5 and earlier will by default
still auto-rotate to preserve compatibility, but OIIO 2.6+ will not
auto-rotate.

When not rotating, the Orientation metadata will reflect the desired
display orientation of the image, according to what was in the file.

When auto-rotating, Orientation will be 1 (canonical display
orientation), and a new attribute "heif:Orientation" will reflect what
was originally in the file.

When opening a file for input, the special configuration metadata hint
"heif:reorient" can express a preference for auto-rotation, overriding
the default. Thus, setting this hint to 0 for OIIO 2.5 will turn off
auto-rotation, and setting it to 1 for OIIO 2.6+ will make it
auto-rotate like it used to do.

I also added some additional tests for heif files.

Along the way I fixed a rather embarrassing documentation problem as
well, where all the orientation codes were "off by 1", oh boy.


Fixes #4123

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-01 10:18:29 -08:00
Larry Gritz 32516e1b1e Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-03-01 10:18:00 -08:00
Larry Gritz a3ac757956 CHANGES stage for release of v2.5.9.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-29 20:48:05 -08:00
Larry Gritz bf58c1477a ci: Fix Windows CI, need to build newer openexr and adjust boost search (#4167)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-29 20:44:10 -08:00
Larry Gritz ae599cc10d ci: Add vfx platform 2024 (#4163)
Not much to say here, it worked the first time as soon as the new
containers were published.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-29 17:00:18 -08:00
Scott Wilson 405932e336 int: Allow TypeDesc to have all the right POD attributes (#4162)
This PR is for allowing the TypeDesc type to be used directly in a C API
without indirection, and therefore also in a Rust API without
indirection.

---------

Signed-off-by: Scott Wilson <scott@propersquid.com>
2024-02-29 16:59:17 -08:00
Larry Gritz 826dae2a06 build: Fixes for DCMTK (#4147)
It somehow escaped our notice, but not only does DCMTK have an exported
config, but also CMake itself has a FindDCMTK.cmake module. So get rid
of ours, and prefer the config if available. This is hoped to solve some
edge cases for finding and using this library properly.

Fixes #4146
(I hope?)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-19 17:46:02 -08:00
Larry Gritz a590bc02c9 fix: Fixes to buildinfo queries (#4150)
* Make sure clang variants are before clang and things that might
emulate gcc are before gcc.
* Use the right symbol for detecting ICC
* Capitalize `__linux__` correctly, oops.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-19 17:45:41 -08:00
Larry Gritz f603cfe790 admin: Relicense code under Apache 2.0
This is Update 7, 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.

To the best of our estimation, we now have 99.85% of lines of code
relicensed, and 93.2% of all source files now consist of ONLY
Apache-2.0 licensed code with no traces of BSD remaining.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-19 17:44:44 -08:00
Larry Gritz a669d0e587 testing/api: Add test for filter values and 'filter_list' query (#4140)
Add testsuite/filters that verifies that the filter shapes are correct
and don't change if we make future changes to the filter code.

Along the way, add a new global getattribute query 'filter_list', that
returns a semicolon-separated list of all the 2D filters it knows about.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-19 17:44:21 -08:00
Larry Gritz 25ff992d4c cleanup: Coalesce redundant STRINGIZE macros -> OIIO_STRINGIZE (#4121)
We did this separately each place we needed it. Do it just once, in a
public header, and give it a name that won't clash with other packages.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-07 22:11:18 -08:00
Larry Gritz 8c1447b87e fix(oiiotool): Overhaul and fix bugs in mixed-channel propogation (#4127)
Remember that ImageBuf only stores one pixel data type per buffer, but
of course they may have differing-per-channel types in image files. So
how does oiiotool know what to write? There is a series of heuristics:
-d is for explicit user control, if not, then try to deduce it from the
input files.

A bedrock precept is that `oiiotool in.exr -o out.exr` ought to write
the same channel types that it read in.

The logic to implement this with the various image operations and
possible overrides can be hard to get right. Indeed, I did not get it
right. It made mistakes even in simple cases like the above. And the
code was complicated and hard to understand, as well.

This PR rewrites a couple functions that implement this chunk of this
logic, both correcting several errors as well as (I hope) being clearer
and better commented so that we can more easily reason about it and
modify it in the future.

I also added some additional tests to testsuite/perchannel to verify
some of the cases that were previously failing.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-07 22:11:07 -08:00
Larry Gritz b9ebbcd3e6 fix(simd.h): Address NEON issues (#4143)
Primarily, recent changes (PR #4071) to vint4::store for the NEON case
appear to have some type mismatches, which apple clang on ARM-based Mac
(including our CI) seems ok with, but which is generating type errors on
other ARM Linux platforms.

I think the types were weird here, so I tightened it up to get the types
right for temporary variables in that function. That's the primary fix
here.

Secondarily, I modified simd.h and the CMake setup so that build option
USE_SIMD=0 will disable NEON in the same way that it disables SSE. (I
realized that USE_SIMD=0 was not disabling NEON, so there was no way for
a NEON platform to completely disable SIMD if they needed to.)

Fixes #4111

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-07 22:10:48 -08:00
Larry Gritz b31a01bfbb Internals: various fixes for memory safey and reduce static analysis complaints (#4128)
* jpeg output: Extra memory check
* TS: batch texture call fixed to handle any number of channels
* TS: assert to guard against possible null pointer dereference
* oiiotool printinfo: clarify assertion for the sake of static analysis
* jpeg2000 reader: assertion to ensure we don't dereference a null
pointer

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-07 18:11:20 -08:00
Larry Gritz d8ea7f98cf ci: Switch away from deprecated GHA idiom set-output (#4141)
Eliminates some GHA warnings.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-07 18:11:00 -08:00
Larry Gritz 70e507d69b docs: Fix python example (#4139)
typos

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-07 18:10:52 -08:00
Larry Gritz ac1401ae3e ci: Start using macos-14 ARM runners, bump latest OCIO (#4134)
No more need for the paid macos13-arm-py311 runner and only use it on
the ASWF repo selectively. An ARM-based MacOS-14 runner is now available
for open source projects, so can run free on every PR and on user forks.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-01 22:27:41 -08:00
Larry Gritz 6e7a5a4d7c docs: Fix tab that was missing from the rendering on rtd (#4137)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-02-01 22:25:21 -08:00
Larry GritzandThiago Ize 6fc028b3ca docs: update SECURITY and RELEASING documentation (#4138)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Thiago Ize <ThiagoIze@users.noreply.github.com>
2024-02-01 22:25:13 -08:00
Larry Gritz a7c90cb6bf Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-31 23:35:14 -08:00
Larry Gritz e73884bdb4 Stage for release of v2.5.8.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-31 20:43:30 -08:00
Larry Gritz 2b9673811b build: don't fail pybind11 search if python is disabled (#4136)
Fixes #4135 

Thanks to @OgreTransporter for the suggestion.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-31 20:43:30 -08:00
Larry Gritz dbab4dfd97 ci: Bump 'latest' test to newer dep versions, document (#4130)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-30 08:23:55 -08:00
Larry Gritz 2491891e7d feat: query/print build information (#4124)
New OIIO global attributes (read only):

- "build:platform" retrieves the OS and CPU type that this build of OIIO
is fof (e.g., "Linux/x86_64").
- "build:compiler" retrieves the compiler name and version used to build
OIIO itself (e.g. "gcc 9.3").
- "build:dependencies" retrieves a semicolon-separated list of library
dependencies -- both for image format support (like libtiff) but also
general (boost, TBB, Python, fmt, OCIO).
- "build:simd" is a new (preferred) synonym for the SIMD and other
hardware capabilities selected at build time. The old name, "oiio:simd"
is hereby softly deprecated as confusing.

`oiiotool --buildinfo` is a new command that prints this information.

Example output:

```
$ oiiotool --buildinfo

OIIO 2.6.0.2spi | MacOS/x86_64
    Build compiler: Apple clang 15.0 | C++17/201703
    HW features enabled at build: sse2,sse3,ssse3,sse41,sse42
Dependencies: OpenEXR 3.2.1, LIBTIFF Version 4.6.0, jpeg-turbo
    3.0.1/jp80, dcmtk 3.6.8, FFMpeg 6.0 (Lavf60.16.100), gif_lib 5.2.1,
    libheif 1.17.6, OpenJpeg 2.5.0, null 1.0, OpenVDB 11.0.0abi11, libpng
    1.6.40, Ptex 2.4, libraw 0.21.2-Release, Webp 1.3.2, Boost 1.83,
    OpenColorIO 2.3.1, Python 3.11.7, TBB 2021.11.0, fmt 10.2.1
```

This is all a convenience utility to make it easy to ask users to run a
simple command that will tell us a lot of information relevant to
resolving their issues in cases where it's related to some of their
build-time compiler or dependencies.

Also cleaned up the "bug report issue template" to clarify the
instructions and specifically ask people to run this command and include
the information with any bug report.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-30 08:23:45 -08:00
Larry Gritz 4a9a5d387a iv: Assume iv display gamma 2.2 (#4118)
A better default for users is probably to assume a 2.2 value if the
GAMMA env variable is not set. If you want something different, set
GAMMA proactively or use a real color managed workflow.

Fixes #318

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-26 21:43:17 -08:00
Larry Gritz a4741887cd ci: improve parallel builds by basing on number of cores (#4115)
With GitHub runners with more cores becoming available, adjust our CI
scripts to do parallel builds with nprocs+2 instead of hard-coding. We
use slightly more than the number of available cores because these
builds and tests tend to be I/O bound, so they can be a little
over-threaded to get maximum utilization.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-26 21:42:54 -08:00
jreichel-nvidia c3fda6ab0e feat(openexr): Add support for luminance-chroma OpenEXR images. (#4070)
Upon reading, the subsampled Y/BY/RY(/A) channels of luminance-chroma
images are automatically converted to RGB(A) channels. These images will
set a metadata "openexr::luminancechroma" to 1 in the ImageSpec, to indicate
that the original image was luminance/chroma.

Subsampled channels are not supported with the exception of reading
luminance-chroma images with vertical and horizontal sampling rates of 2.
This limited support does not work when OpenEXR's C Core API in used, only
when OpenEXR's C++ API is used. Furthermore, it does not work in
combination with tiles, multiple subimages, mipmapping, or deep pixels.

The test images from the OpenEXR testsuite have been added and work with
the C++ variant of the test.

Fixes #4051.

---------

Signed-off-by: Joachim Reichel <43646584+jreichel-nvidia@users.noreply.github.com>
2024-01-23 09:29:03 -08:00
Larry Gritz 04b022c3c2 style: Add recent reformatting to .git-blame-ignore-revs (#4122)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-22 22:30:07 -08:00
AngryLoki 3376cd76c3 fix(simd.h): AVX-512 round function (#4119)
This PR fixes vfloat16 round function. Intrinsic `_mm512_roundscale_ps`
was used incorrectly, and caused failure on Zen4 CPU.

```
/var/tmp/portage/media-libs/openimageio-2.5.5.0-r1/work/OpenImageIO-2.5.5.0/src/libutil/simd_test.cpp:1579:
FAILED: round(F) == mkvec<VEC>(std::round(F[0]), std::round(F[1]), std::round(F[2]), std::round(F[3]))
	values were '-1.5 0 1.5 4 -1.5 0 1.5 4 -1.5 0 1.5 4 -1.5 0 1.5 4' and '-2 0 2 4 -2 0 2 4 -2 0 2 4 -2 0 2 4'
``` 

In old code `_mm512_roundscale_ps (a, (1<<4) | 3)` meant the following:
```
[0001] - Number of fixed points to preserve
[0] - Use MSCSR exception mask
[0] - Select mode from imm
[11] - Truncate mode
```
Effectively enabling rounding to nearest 0.5, not to integer.

References:
* https://www.felixcloutier.com/x86/vrndscalepd#fig-5-29
*
https://stackoverflow.com/questions/50854991/instrinsic-mm512-round-ps-is-missing-for-avx512


Signed-off-by: Sv. Lockal <lockalsash@gmail.com>
2024-01-20 16:45:24 -08:00
Larry Gritz 1f68a59575 Fix typos (#4116)
Thanks to Matteo Vescovi for pointing these out.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-20 16:45:12 -08:00
Larry Gritz 6b2f82c2e4 Fixes to reduce problems identified by static analysis (#4113)
* pngoutput.cpp: Catch possible exceptions.
* printinfo.cpp: assertions to assure we don't dereference a null
pointer.
* testtex.cpp: make sure allocated chunk is initialized
* WriterInternal.h: Catch condition that could lead to buffer underflow.
* imagebufalgo_mad.cpp: Simplify pointless clause. The prior test was
redundant. Since a few lines above, if B was an image but A was not, we
swapped to ensure that A was always an image. So here, we can just test
A to know for sure that at least one of them is an image. That makes the
test here simpler, but it also makes it more clear to static analysis
that from this point forward, A can't be nullptr.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-20 16:44:45 -08:00
Larry Gritz 5c339b153b docs: Fix broken IBA color management documentation (#4104)
The function signatures in the header didn't match those in the docs,
after some previous changes. It's probably been broken in the docs for
some time. Nobody noticed?

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-20 16:43:42 -08:00
Larry GritzandJohn Mertic 8e94d6ab50 admin: Switch to jmertic's slack notifier action (#4079)
The one we were using is broken. John's is surely the GOAT notifier.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: John Mertic <jmertic@linuxfoundation.org>
Co-authored-by: John Mertic <jmertic@linuxfoundation.org>
2024-01-20 16:42:40 -08:00
Larry Gritz 7166998d35 fix(raw): Avoid buffer overrun for flip direction cases (#4100)
If you are looping i over range [0,width), and want index to go the
other direction, you need `index = width - 1 - i`, not `index = width - i`.

Identified by Sonar static analysis.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-20 16:42:08 -08:00
Larry Gritz b88b82ffe9 style: update our formatting standard to clang-format 17.0 and C++17 (#4096)
Bump our clang-format standard from llvm 12 to llvm 17, and our
C++ standard (for formatting) to 17.

Fixes/improvements along the way:

* Moved the clang-format CI test from an aswf container to bare Ubuntu
  to make it run faster -- it doesn't need most of the dependencies,
  so there's no point wasting 2 minutes or so downloading a container.

* build_llvm.bash: Make sure llvm installs when needed, even if not
  using clang.

* gh-installdeps.bash: Setting SKIP_SYSTEM_DEPS_INSTALL=1 skips
  installation of many non-essential dependencies.

There is some reformatting here and there as 12->17 changed some formatting
choices somewhat, but it's fairly minor. Most changes are improvements,
some are neutral, a few are inexplicable but not less readable than before.
We've long since accepted the tradeoff that using clang-format makes some
things formatted differently/worse than we would have preferred, but we deem
it worthy of the benefit of having it all 10% automatic and never fighting
over formatting in PRs.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-20 09:45:01 -08:00
Larry Gritz 8cdac7e2a5 build(deps): deal with changes in fmt's trunk (#4114)
Bleeding edge CI test failures due to more changes in fmt's trunk.
Solutions:

* Accommodate some recent header refactoring in fmt.

* Straighten up some const issues that worked before, but break under
the latest fmt. Making the custom formatter's 'format' method be const
fixes the latest, but breaks some of the oldest versions of fmt we
support, so we add the const only from fmt 9.0 on.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-18 15:17:58 -08:00
Larry Gritz b9210fecb5 build(deps): Account for header changes in fmt project trunk (#4109)
Fixes a CI breakage

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-16 22:55:04 -08:00
Dominik Wójt 3ba9c7c1ae build: clean up after removing Findfmt.cmake (#4103)
Remove duplicate dependecy for OpenImageIO_Util to fmt.
OpenImageIO target already depends on fmt through OpenImangeIO_Util
library.


Signed-off-by: Dominik Wójt <domin144@o2.pl>
2024-01-16 22:54:25 -08:00
Dominik Wójt 65cfc19d06 build: Remove Findfmt.cmake (#4069)
fmt provides cmake config files since at least version 7.0.0, which is
the minimum version supported.
Fixed some variable names, so the provided config can be used.
The previous variable names were missing, if the library was installed
in a custom location,
like in case of manual build or provided by conan.

---------

Signed-off-by: Dominik Wójt <domin144@o2.pl>
2024-01-16 22:53:48 -08:00
Larry Gritz 1b63d1b3f3 test: Fix docs test, used wrong namespace (#4090)
We did `import OpenImageIO as oiio` then instead of using `oiio`, we
used `OpenImageIO`.

This was failing sometimes. Frankly, I'm not sure why it ever worked.
Maybe it works on some versions of Python but not others?
I dunno. But this fixes it everywhere and is clearly correct.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-02 12:51:51 -08:00
Larry Gritz 4cb956b0a0 fix(simd.h): Make all-architecture matrix44::inverse() (#4076)
We had an awkward situation of the simd matrix44::inverse() only being
defined for Intel SSE, and in all other cases falling back on
Imath::M44f::inverse. The problem with that is that it made simd.h
depend either directly on ImathMatrix.h, or assume that it would be
included prior to inclusion of simd.h. This was not good.

This patch rewrites inverse() to eliminate all of the direct SSE
intrinsics in terms of other simd wrapper functions, which means that
they will be defined one way or another on all architectures.

Along the way I added a new vfloat4 shuffle that combines two vectors
(corresponding to `_mm_shuffle_ps` in SSE land), and a vfloat4
constructor from 2 float*', where the first two elements come from the
first ptr and the second two elements come from the second ptr.
Ultimately, the final implementation I settled on for the new inverse
didn't use these (an earlier version did), but I want to keep them
around anyway in case they are useful in the future. I did add a test
for them.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-02 12:51:43 -08:00
Larry Gritz 8f9b21f845 docs: Minor change to formatting and naming (#4098)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-01 13:06:30 -08:00
Larry Gritz 0fde420f9c test: Shuffle some tests between directories (#4091)
Move a bunch of specific tests from testsuite/oiiotool to
testsuite/oiiotool-copy to group similar tests together, and also to
load balance better between the tests.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-01 13:06:13 -08:00
Larry Gritz 56061c0dde ci: Revert bad branch exclusion -- doesn't work as I thought it would (#4099)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-01 13:06:13 -08:00
Larry Gritz ca9e757fc6 ci: Repair Sonar scanner analysis (#4097)
This broke some time back, probably partly related to our change in
repository home. This seems to get it mostly working? The reports are
still not showing up, but I think the solution might be to make sure
this is checked into master, so we need to merge this before assessing
whether there is more work to be done in this area.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-01 13:05:20 -08:00
Larry Gritz 72988d3a62 Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-01 13:04:43 -08:00
Larry Gritz c518e2da23 Stage for v2.5.7.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2024-01-01 11:49:08 -08:00
Larry Gritz ea4444d780 fix(iv): avoid crash with OpenGL + multi-channel images (#4087)
For image with more than 4 channels, we were misallocating the OpenGL
buffer by using the total channels instead of the 4 we wanted to create
the texture out of. Also, make sure the calculation usees wide types to
avoid possible integer overflow.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-27 12:32:25 -08:00
Larry Gritz 60690d0b32 build: Add a way to cram in a custom extra library for iv (#4086)
It's a little involved to explain why, but at work a combination of
libraries and some trickery with static linkage led me to really need a
way to inject another library into the mix, just for iv linkage.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-27 12:31:53 -08:00
Larry Gritz dec7810399 perf: Improve perf of IBA::channels in-place operation (#4088)
For the in-place case (where src and dst refer to the same IB), we were
doing an unnecessary full-image copy.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-25 16:01:41 -08:00
Larry Gritz 57ac049116 ci: Rename macro to avoid conflict during CI unity builds (#4092)
Unity builds (which we do for CI to speed it up) combine source files,
sometimes in ways that are a bit non-deterministic, and can run into
violations of the ODR that were not a problem when separate definitions
of the same thing (a macro in this case) were in different compilation
units but are in the same one as a unity build.

In this case, a private OIIO_DISPATCH_TYPES macro in printinfo.cpp
conflicted with a different macro of the same name in
imagebufalgo_util.h.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-24 12:54:18 -08:00
Larry Gritz 207ad73c7a docs: fix typo (#4089)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-24 12:54:10 -08:00
Jesse Yurkovich 3591296c7c Fix link to openexr test images (#4080)
## Description

Minimal change to update link to OpenEXR's new Test Images page. I poked
around a bit to find a "friendlier" variant of the link but could find
none.

Note that the section containing this link implies that folks need to
download these files themselves and should be "placed in a sibling
directory to oiio-testimages". The problem is that not even OpenEXR
lists the repository for the test images nor does the page linked above
offer a download.

Should we list out the openexr-images repo address too and say to just
clone that?

Fixes #4042

---------

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
2023-12-24 12:54:00 -08:00
AdamMainsTL 032d3e8559 fix: Only check REST arguments if the file does not exist (#4085)
Fix for #4084. Will now check if the given filename exists before
checking for REST parameters.

Before:
```
bin % ./oiiotool \?.png -o \?-output.png
oiiotool ERROR: read : "?.png": ImageInput::create() called with malformed filename
Full command line was:
> oiiotool ?.png -o ?-output.png
```

After: 
```
bin % ./oiiotool \?.png -o \?-output.png
```
No output, `?-output.png` created.


Signed-off-by: AdamMainsTL <adam.mains@topazlabs.com>
2023-12-21 19:35:47 -08:00
Larry Gritz f23b6c7cd8 admin: Account for duplicate emails in the .mailmap (#4075)
Please look this over. If you are one of the duplicated names and I
haven't chosen your preferred canonical email (I made my best guess),
please comment here with corrections.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-21 19:35:35 -08:00
Clifford Yapp 15b5abf4b8 Merge tag 'v2.5.6.0' into RELEASE 2023-12-19 16:47:12 -05:00
Larry Gritz c3e6420c0a ci: restrict Mac ARM running (#4077)
I didn't have the condition right -- the `if` isn't respected in the
`pull_request` section, so this job was running on every PR instead of
just the ones with "macarm" in the branch name. Refactor to get the
conditional on the job instead.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-18 12:55:10 -08:00
Larry Gritz 46253cbdc7 fix(png): Fix crash for writing large PNGs with alpha (#4074)
There was a flaw in PNGOutput::write_scanlines when the y range of
scanlines to write consisted of less than the whole image, and alpha
de-association was needed -- we used the whole-image size instead of the
y range of scanlines size.

Fixes #4044

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-13 01:15:40 -08:00
Larry Gritz e2de284f23 fix(jpeg2000): include the headers we need to discern version (#4073)
Without getting the version properly, we weren't disabling use of a
deprecated field for OpenJpeg >= 2.5, as we thought we were.

This fixes recently broken CI when building against the current openjpeg
master.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-10 20:59:58 -08:00
Dominik Wójt 3486fc1c74 build: ptex support for static library (#4072)
In some environments, only one kind of the library could be available.
Choose proper fallback in such cases. Prefer static library, if
LINKSTATIC is ON and dynamic otherwise.

Signed-off-by: Dominik Wójt <domin144@o2.pl>
2023-12-10 12:05:27 +09:00
Aras Pranckevičius ed9d0ca709 perf(simd): faster vint4 load/store with unsigned char conversion (#4071)
## simd.h improvements:

vint4::load from unsigned char pointer got pre-SSE4 code path. Testing
on Ryzen 5950X / VS2022 (with only SSE2 enabled in the build):
- vint4 load from unsigned char[]: 946.1 -> 4232.8 Mvals/sec

vint4::store to unsigned char pointer got simpler/faster SSE code path,
and a NEON code path. Additionally, it got test correctness coverage,
including what happens to values outside of unsigned char range (current
behavior just masks lowest byte, i.e. does not clamp the integer lanes).

- vint4 store to unsigned char[]: 3489.8 -> 3979.3 Mvals/sec
- vint8 store to unsigned char[]: 5516.9 -> 7325.3 Mvals/sec

NEON code path as tested on Mac M1 Max (clang 15):
- vint4 store to unsigned char[]: 4137.2 -> 6074.8 Mvals/sec

## Tests

vint4 store to unsigned char pointer got actual correctness checking
test, which seemingly was lacking before (only had a benchmark test).
2023-12-10 12:05:16 +09:00
Larry Gritz dfdae5dd4d test: Add one more ref output for python-colorconfig test (#4065)
Slightly different output to match for the combo of OCIO >= 2.2, but
simultaneously Python 2.7 -- which was not in our CI test matrix, so I
missed it, but ran into it at work.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-10 11:14:30 +09:00
Larry Gritz 792ae6a033 test: improve color management test in imagebufalgo_test (#4063)
Add a few more assertion checks and error messages in imagebufalgo_test.

I observe that if somebody runs the testsuite with `$OCIO` set to a
config that doesn't contain the required color space names for this
test, it will fail. As a backstop, use the default built-in config if
the initial request fails. That will always give a working processor
between these spaces if OCIO >= 2.2 is being used.

Also one more tiny SPI-specific enhancement to hacky identification of
nonconforming color space names in our old configs.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-10 11:13:25 +09:00
Larry Gritz 728ca952db Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-12-02 18:30:30 +09:00
Larry Gritz 5c29caab40 Stage for v2.5.6.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-30 21:46:11 -08:00
Aura Munoz d032dfac6f fix(diff): Fix issue when computing perceptual diff (#4061)
- Fix perceptual test false positive by removing the initialization of
`cr` to avoid losing the information when leaving block scope

Included additional test with parameter `-fail 1`, which was giving a
false positive pass for a perceptual difference.
This was due to the fact that the result variable `cr` was getting out
of scope for the perceptual calculation and the first `if (cr.nfail <=
imagesize_t(allowfailures)) {` was testing for the result of the
absolute difference instead of the perceptual difference.

Before:
```
Comparing "img1.exr" and "img2.exr"
PASS
```
After:
```
Comparing "img1.exr" and "img2.exr"
64 x 64, 3 channels
  Mean error = 0
  RMS error = 0
  Peak SNR = 0
  Max error  = 1 @ (5, 17, R)  values are 0.1, 0.1, 0.1 vs 0.1, 0.6, 0.1
  0 pixels (0%) over 0.008
  121 pixels (2.95%) over 1
  121 pixels (2.9541%) failed the perceptual test
FAILURE
```

Signed-off-by: Aura Munoz <aura.munoz@autodesk.com>
2023-11-30 21:36:55 -08:00
Larry Gritz 51899ea478 fix(oiiotool): --autocc bugfix and color config inventory cleanup (#4060)
The important bug fix is in oiiotool image input when autocc is used,
where we reversed the sense of a test and did the autocc-upon-input if
the file's color space was equivalent to the scene_linear space
(pointlessly), and skipped the conversion if they were different (oh no,
big bug!).

Along the way:

* Add missing try/catch around OCIO call that should have had it.

* Some very ugly SPI-specific recognize-by-name color space heuristics.
I hate this, sorry, but it solves a really important problem for me.

* A bunch of additional debugging messages during color space inventory,
enabled only when debugging, so nobody should see these but me.

* A couple places where we canonicalize the spelling of
"oiio:ColorSpace".

Note that there is still an issue with the color space classification
using OCIO 2.3+'s identification of built-in equivalents by name. These
are shockingly expensive. I will return to this later.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-23 18:34:07 -08:00
Larry Gritz 1811af62c8 fix: Remove redundant line in .clang-format (#4057)
Used to be no problem, but after a recent VSCode update, this seems to
have been causing errors when asking VSCode to format. No idea why this
recently became problematic.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-23 18:33:52 -08:00
Larry Gritz c0136eddbc doc: Update INSTALL.md to reflect the latest versions we've tested against (#4058)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-23 18:33:38 -08:00
Larry Gritz f99b7f313a ci: test against gcc-13 (#4059)
Switch "bleeding edge" test to gcc13, "latest releases" test to gcc12

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-23 16:48:54 -08:00
Larry Gritz aef64614fe ci: Remove MacOS-11 test (#4053)
It's started failing on GHA and is old enough that it's not worth trying
to track down what's broken. We still have MacOS 12 and 13 tests in the
matrix.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-19 21:10:59 -08:00
Larry Gritz 96d57e51dc ci: Add tiff-misc reference for slightly changed error messages (#4052)
Everything works, no code changes needed. But with some libtiff builds,
there is some variation in exactly which error messages bubble up when
reading certain corrupted files. This fixes some recently broken CI.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-16 14:18:52 -08:00
Larry Gritz 4e3a49aaf0 admin: Relicense code under Apache 2.0 (#4038)
This is Update 6, 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-11-15 18:12:56 -08:00
Larry Gritz 4a0c6d1bba build: Better cmake verbose behavior (#4037)
When we bumped to cmake 3.15 minimum for 2.5, we changed lots of
constructs like this:

    if (VERBOSE)
        message (STATUS "blah")
    endif ()

to this:

    message (VERBOSE "blah")

but I didn't realize that this was not enough, and to do it right
requires CMAKE_MESSAGE_LOG_LEVEL. So even when VERBOSE=ON, we weren't
actually getting all the verbose messages. Here, we fix it.

Also, when verbose, print the list of C++ compile features that cmake
discovers.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-15 18:12:48 -08:00
Larry Gritz 7d5edbe792 ci: Nomenclature change 'os' to 'runner' for clarity (#4036)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-15 18:12:33 -08:00
Larry Gritz 3c784fdb13 security: use the full SHA for the slack-release-notifier action (#4047)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-15 18:12:22 -08:00
Larry Gritz 4f8aa3434b Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-15 18:11:53 -08:00
Larry Gritz a19d63aa34 admin: Fix typo in slack-release-notifier version (#4046)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-11-01 18:17:10 -07:00
Larry Gritz 1a4aebb742 Stage for v2.5.5.0
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-31 15:45:42 -07:00
Larry Gritz 7d1d6bd42b security: Document CVE-2023-42295
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-20 21:42:33 -07:00
Larry Gritz dbb9d5d1b6 testing: Add opencv regression test (#4024)
Testing to make sure we can convert an IC-backed IB to a cv::Mat.

Related to issue #3800 and PR #4013

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-20 11:26:58 -07:00
Larry Gritz 0d5ee25347 docs: Fix RTD configuration for v2 (#4032)
RTD recently cut off old configuration file style and these additions
were needed.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-20 11:26:43 -07:00
Larry Gritz 78b9716325 testing: imagebuf_test add benchmarks for iterator traversal (#4007)
To help with some other investigation I'm doing, amend imagebuf_test
with benchmarks to compare the relative speeds of traversing a big
ImageBuf with Iterator, ConstIterator, or just using pointers on an
equivalently large array.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-20 11:26:35 -07:00
Anton Dukhovnikov 2c9d7983f4 feat(iv): split off the current image in iv into a separate window (#4017)
This change adds a menu item "Move to new window" under the menu "File" which
creates a new window and initialises it with the currently displayed
image.

I have tested the UI changes on Mac and linux, I don't have a Windows
machine currently.
No other functionality should be affected by this change.

This was one item from issue #2058 

---------

Signed-off-by: Anton Dukhovnikov <antond@wetafx.co.nz>
2023-10-20 11:26:24 -07:00
Danny Greenstein 8d7263cdb3 docs: convert make_texture doc examples to tests (#4027)
Takes the make_texture section of the imagebufalgo doc and turns it into
a unit test in both python and c++.

This adds a make_texture section to the `docs-examples-cpp` test and the
`docs-examples-python` test.

Signed-off-by: Danny Greenstein <danny.gr@gmail.com>
2023-10-18 21:25:23 -07:00
Vlad (Kuzmin) Erium d91ac03561 LibRaw wavelet denoise options (#4028)
- ``raw:threshold``
     - float
     - Libraw parameter for noise reduction through wavelet denoising..
       The best threshold should be somewhere between 100 and 1000.

- ``raw:fbdd_noiserd`` 
    - int 
    - Controls FBDD noise reduction before demosaic. 0 - do not use FBDD
       noise reduction, 1 - light FBDD reduction, 2 (and more) - full FBDD reduction

---------

Signed-off-by: ssh4net <libalias@gmail.com>
2023-10-18 21:25:08 -07:00
Larry Gritz a8a3e2f6fc build: Adjust OpenVDB version requirements vs C++17 (#4030)
Revision of PR #4023

I have since determined that although OpenVDB raised their own build
requirements to C++17 starting with 10.0, it wasn't until 10.1 that
C++17-isms crept into their header files and force downstream projects
to need C++17 to consume OpenVDB's headers. So we can go back to
allowing use of OpenVDB 10.0 even when we are building with C++14.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-18 21:24:47 -07:00
Larry Gritz b0559ce682 ci: CI tests on MacOS ARM, and fixes found consequently (#4026)
There's a new GitHub runner in town!

Set up CI to run on Mac ARM. But not all the time -- it's too expensive!

This runner is only available for paid accounts, and it's 20x more
expensive than paying for a Linux runner. The ASWF can't afford to run
this job on every iteration of every PR, and again upon merge.

We split it into a separate workflow so we can direct it to run only for
tagged releases, branches with names containng "-alpha", "-beta",
"release", or contain the substring "macarm" (this last one is so we can
force a particular PR that we think is directly relevant to ARM to test,
even though it's not one of those other release-related cases). We also
run it once a month, on the 27th -- a few days before each monthly
release -- to try to catch any ARM problems we've accidentally
introduced by PRs that didn't test.

It's also rigged to run only on the ASWF repo, so you don't need to
worry that you will get charged for pushes to your own fork. (On the
other hand, it also means you aren't testing against ARM when you push
to your fork prior to making a PR.)

In the process of testing this, of course I found some minor things that
needed to be fixed on ARM -- a couple compile issues, and several
testsuite reference outputs that needed to be updated because they
differ ever so slightly in some math calculations on the different CPU
architecture.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-18 21:24:19 -07:00
Larry Gritz 92b364286c ci: Some straggler repo renames in the workflows (#4025)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-15 14:43:40 -07:00
Larry Gritz a97443887c build: Protect against mismatch of OpenVDB vs C++ (#4023)
Looks like OpenVDB >= 10.0 requires a minimum of C++17. Warn at build
time if trying to use an OpenVDB too new for the C++ compiler being
used.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-15 14:34:55 -07:00
Calvin 725cbcf2a8 docs: Added tests for Simple Image input and updated rst (#4019)
Added the simple input tests from the ImageInput chapter of the docs as
C++ and Python examples, a part of the larger issue #3992 . Followed
prototype
(https://github.com/AcademySoftwareFoundation/OpenImageIO/wiki/Converting-documentation-examples-to-tests)
approach.

---------

Signed-off-by: CalvinSch <calvinschaul@gmail.com>
2023-10-14 20:34:47 -07:00
Larry Gritz 79f03050f6 fix: IBA::to_OpenCV fails for ImageCache-backed images (#4013)
We were using parallel_convert_image but not realizing that asking for
the IB::localpixels() would give us nullptr for an IC-backed image.

Instead, "wrap" the cv::Mat with an IB and then use IBA::copy(). This
handles both in-memory and IC-backed ImageBuf's, and also has many other
advantages (such as format conversion) we may wish to take advantage of
in the future.

Fixes #3800

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-14 12:58:43 -07:00
Jeremy Retailleau 98cee45a87 docs: Convert examples within the imagebufalgo chapter. (#4016)
Convert C++ and Python examples from the "imagebufalgo" chapter into
tests within the "docs-examples" testsuites (#3992).

Signed-off-by: Jeremy Retailleau <jeremy.retailleau@gmail.com>
2023-10-14 09:07:48 -07:00
Chaitanya Sharma ea16ad63d6 feat(iv): Implement Directory Argument Loading for iv (#4010)
Solves the issue "Load a directory: iv dirname ought to be the same as
specifying all the image files in that directory" from the Great Big iv
Wish List #2058

This PR addresses the request from the Master list of iv feature
requests to allow loading a directory as an argument, which in turn
loads all images within the specified directory. The code modifications
include checks to validate the file or directory existence, and if a
directory is provided, iterates through its files to load all valid
images into iv. This enhancement simplifies the process of viewing
multiple images collectively located in a single directory.

---------

Signed-off-by: Chaitanya Sharma <39400946+CheeksTheGeek@users.noreply.github.com>
2023-10-14 09:07:35 -07:00
David Aguilar dda56ce77a feat(idiff): allow users to specify a directory as the 2nd argument (#4015)
Teach `idiff` to accept a directory as the 2nd argument.

Fixes #4009

## Tests

Functional tests for `idiff` don't currently exist. Manual testing
verifies it works as advertised.

---------

Signed-off-by: David Aguilar <davvid@gmail.com>
2023-10-14 09:07:25 -07:00
David Aguilar bcd63d36db cmake/compiler.cmake: provide compile_commands.json for use by tools (#4014)
`compile_commands.json` allows LSPs and other tools to better interact
with the code.

Signed-off-by: David Aguilar <davvid@gmail.com>
2023-10-14 09:07:13 -07:00
Larry Gritz af0bbddb41 docs: Make an example of doc-to-test in the imagebufalgo chapter (#4012)
Slightly different set of issues, so I wanted to provide a full example
for anyone who wants to work on this chapter.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-14 09:07:02 -07:00
Larry Gritz a798f85e9a fix(exr): handle edge case of exr attribute that interferes with our hints (#4008)
Our exr writer uses some special hints starting with "openexr:" to
control aspects of the writing, and the reader sets these to
communicate some things about the file it's reading.

But we identified a case where the actual exr file had metadata named
"openexr:levelmode" -- which is of no particular meaning to openexr
itself, but it is the name we use to communicate hints to our writer
by make_texture. We just need to make sure that if we don't set it
proactivesly, we make sure to clear it if there is a stray bit of
metadata with that same name coincidentally.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-10 12:42:08 -07:00
Larry Gritz 173dc482e3 feat: print unretrieved global error messages (#4005)
In the ongoing effort to help newcomers to OIIO diagnose their own
problems, this uses a trick to print any global error messages that
never got retrieved by OIIO::geterror() at the time that the program
exits. (This is all similar to a change we made recently that adds an
analogous behavior to ImageBuf, but in this case it's for those error
messages that don't have an object like an ImageBuf to attach to.)

This should have no effect on anybody who diligently checks
OIIO::has_error() or OIIO::geterror() after any failed calls that would
send error messages to that global store. Also, it is possible to
disable the behavior by setting the new global attribute
"oiio:print_uncaught_errors" to 0.

But for users who don't know to check errors and are experiencing
baffling behavior with OIIO, maybe seing those error messages will
prompt them to understand what's going wrong before they feel the need
to file an issue against OIIO or need to ask us for help.

Doing this helped me to find two places where our own code in OIIO
failed to clear the global error at times that it should, and these are
also fixed as part of this PR.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-10 12:42:03 -07:00
Larry Gritz 0b644cc2e9 fix(ImageBuf): fix crash when mutable Iterator used with read-IB (#3997)
The following sequence would have a floating point exception:

    // Readable IB backed by ImageCache
    ImageBuf buf("file.exr"),  0, 0, ImageCache::create());

    // Make a mutable iterator, even though it's an image file reference.
    ImageBuf::Iterator<float> it(buf);  <----- CRASHES INSIDE HERE!

The problem was in ImageBuf::IteratorBase::init_ib, several steps taken
if it's a mutable IB looking at a "read-only" IC-backed file, including
calling make_writable() on the buffer. But we neglected to set
m_localpixels to true.

Fixes #3770

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-07 14:51:53 -07:00
Larry Gritz 5a1292cb05 build: Don't fail for 32 bit builds because of static_assert check (#4006)
A static_assert was added recently as part of PR #3898, which assures
that the size of a TileID is a multiple of 8 bytes. But on architectures
with 32 bit pointers, this assertion fails. Which is not quite what we
want, because the code isn't wrong if the struct isn't a multiple of 8
bytes; it's just less efficient. And we don't want to fail for 32 bit
arch.

Bottom line: only do this check to ensure we're in the most efficient
case if we're 64 bits. Nobody's expecting highest performance on a 32
bit machine anyway.

Fixes #4001

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-07 14:51:53 -07:00
Larry Gritz 82a4f9a1d7 admin: Alert slack "release-announcements" channel upon OIIO release (#4002)
Add a GHA workflow that is triggered up on drafting a release, which
will echo a notice to the ASWF slack #release-announcements channel.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-07 14:51:53 -07:00
Larry Gritz 3ec28f03f0 Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-07 14:51:53 -07:00
Larry Gritz 8fa8e9ce04 Stage for full release of v2.5.4.0
This is the first release of 2.5 as the current supported production
release. The 2.4 family is now relegated to "obsolete" status with
only important bugs fixed and support level slowly reducing over the
next several months is adopted.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-01 18:17:00 -07:00
Larry Gritz 13d8ce311b admin: Repo rename -- fix all URL references (#3998 + fixes)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-10-01 18:17:00 -07:00
Larry Gritz 7ae8529cc4 Stage 2.5.3.2-rc1
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-26 21:54:00 -07:00
Larry Gritz 962b3f635f fix: Overhaul of ColorConfig internals to solve perf issues (#3995)
First, some background: In the course of working toward OIO 2.5, we
added some heuristics that used OpenColorIO 2.2's new
isColorSpaceLinear, and also using its new "built-in config" to figure
out if an arbitrarily named color spaces in a user's config were
equivalent to some built-in ones that are commonly used.

All seemed well until... we recently discovered that it was moderately
expensive (~0.1s per color space!) on the OCIO side, which wasn't
particularly noticeable when I was testing, but can add up to several
seconds of needless startup time when inventorying large configs with
dozens and dozens of color spaces. And even worse, it was exceptionally
expensive for color spaces with LUT3Ds because of a bug on the OCIO side
that would invert the 3D LUT needlessly (taking >10s per LUT3D
inversion), leaving to MINUTES of overhead for some configs with many
such spaces.

So this PR attempts to work around all of this with several big changes
(which are amplified by the fact that I've really shuffled around the
code between methods and within the file, sorry):

1. Per suggestion from Doug Walker, there's a new heuristic to try to
detect if a color space from or to the reference space appears to
contain a 3D LUT, and if so, skip some of the more expensive heuristics
that appear to cause the LUT to be inverted. It's not perfect, but we're
making a bet that no LUT3D-involving color spaces are going to be one of
the few canonical spaces we're trying to detect. This fixes the "10s of
seconds of delays" problem for those particular color spaces.

2. When using OCIO 2.3+, use its newly introduced utility
IdentifyBuiltinColorSpace to have it tell us which color space in the
user's config matches some of the canonical ones we care about in the
built-in config.

3. Whew, switch to a kind of lazy evaluation of the propererties of each
color space. Whereas before, we fully inventoried the config and for
each cs we found in it, do all the heuristics, now we only do the
inexpensive tests up front (silly rules of thumb where we guess based on
the *names* of the color spaces). We save the potentially more expensive
but thorough ones (like transforming some sentinel colors around to see
if the behavior of the cs matches a color space we care about, and
asking OCIO what it thinks about isColorSpaceLinear) only if we are
asked to do certain things with *that* color space. In other words, a cs
in the config that OIIO doesn't need to *use* in some way will now not
undergo the expense of the trickier investigation about what it might be
equivalent to.

These add up to making the overhead for ordinary use be significantly
sub-second, no longer a problem. Nature is healing.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-26 21:42:03 -07:00
Jesse Yurkovich bd802279f1 fix: Prevent infinite loop in bit_range_convert (#3996)
It was possible for `bit_range_convert` to be called with a 0 for the
`FROM_BITS` parameter leading to an infinite loop in its processing.

Fixes #3993: OIIO library freezes when loading R16G16 uncompressed DDS files

The test image from the above bug is now able to be read correctly.

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
2023-09-26 21:41:52 -07:00
Larry Gritz 101b8bb942 fix(png): Improve png write with alpha is low (#3985)
We found that PNG output (which is required to be unassociated alpha)
had precision problems with low alpha values because it quantized to the
final bit depth before doing the alpha deassociation.

Explanation:

PNG requires associated alpha to be stored in the file. So if you have
(unassociated) pixel value [0.00235, 0.00106, 0.00117, 0.0025], that
means that we need to divide the colors by alpha before storing in the
file, so that's [0.94, 0.424, 0.468, 0.0025] if you have full precision.
But you don't, because PNG only supports uint8 and uint16. For uint8,
this should end up as [240, 108, 119, 1].

But it turns out that our png writer does the integer conversion before
the un-premultiplication, so actually we first quantize from [0.00235,
0.00106, 0.00117, 0.0025] to [1 0 0 1], and THEN we un-premultiply,
giving us the [255, 0, 0, 1] that made you think "Why is that red value
clipped? And where did green and blue go?"

The solution, then, is to deassociate as floats first, then quantize to
the final integer data type.

Also add a test for this, as well as a test that verifies correctly
writing of 16 bit files that I had some problems with in the last png
PR.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-24 21:27:14 -07:00
Larry Gritz e2ed0dbb45 png: a variety of minor optimizations to the PNG writer (#3980)
* Implement PNGOutput::write_scanlines, previously we only had
write_scanline. Sadly, being able to write multiple scanlines at once
reduces overhead by much less than I had hoped. But there's a bit of
savings, so I'll keep it.

* New compression recognized: "pngfast", which translates to the
Z_BEST_SPEED setting. I don't particularly recommend this, but it's
useful for benchmarking.

* New compression recognized: "none", which turns off compression. Also
not recommended, as it makes the files much larger. Mostly done for
benchmarking and other comparisons.

* Don't unconditionally copy user's data buffer to m_scratch. It's only
necessary if there's a data type conversion, stride shuffling, alpha
deassociation, or endian swapping. When none of those are needed, we can
avoid the extra allocatin and copy, and so now we do. (Sigh, in real
use, we're almost always doing the alpha deassociation, so this rarely
is a savings.)

* Better documentation on the custom output attribute hint
`"png:filter"` noting that a non-default value can make it write PNG
files dramatically faster, but with the tradeoff of having much larger
files.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-24 21:27:14 -07:00
Larry Gritz a74bb72c48 Stage for 2.5.3.1-beta2
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-24 21:24:04 -07:00
Larry Gritz 951411392a CHANGES (updated for 2.5.3.1-beta2)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-24 21:24:04 -07:00
Larry Gritz 0090d3212f docs: Spruce up the main README and add "Building_the_docs" (#3991)
For the upcoming DevDays, I wanted to spruce up our main README to make
it easier to find info, and I wrote a new guide for how to locally build
the documentation.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-24 20:17:33 -07:00
Larry Gritz e82b860ad8 build: Use exported targets for libjpeg-turbo and bump min to 2.1 (#3987)
libjpeg-turbo has exported cmake configs since its version 2.1. Relying
on this simplifies the build and allows us to completely remove the
troublesome Findlibjpeg-turbo.cmake. This implies raising the floor for
libjpeg-turbo support to 2.1 (the current release is 3.0) which was
released in April 2021 (beta in Nov 2020).

That's cutting it a little close (we usually support dependencies going
back at least 3 years at a minimum, and often significantly longer). But
since this is an optional dependency anyway and simplifies the build,
I'm tempted to do so.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-24 20:17:25 -07:00
Larry Gritz 8a358b7bd3 ImageBuf: Only back IB with IC when passed an IC (#3986)
The behavior of ImageBuf has always been that an IB referencing from a
file is backed by ImageCache unless you carefully use read() with the
"force" parameter set to true. The IC can be really helpful if you only
need *part* of the file, or if you have so many large IB's at once that
you want IC to manage the memory for you to keep the total reasonable.

Over the years, I've started to wonder if this was the right approach
for the default. It's much more typical that IBs aren't big enough or
numerous enough to gain much from the IC, and it's usually worse
performance to have it IC-backed. Plus, now the properties of the
ImageCache (size, behavior for nontiled images, etc.) can affect the
performane of ImageBuf without users understanding why.

So this patch tries on a different approach: ImageBuf's only use an
ImageCache underneath if explicitly passed a pointer to one in the IB
constructor or reset() call. Otherwise, it just uses local memory owned
by the IB. It's much simpler to reason about, and should be higher perf
for most common cases.

I did add a global OIIO option, "imagebuf:use_imagecache" that can
revert to the old behavior of having all IB's by default be backed by IC
when reading from a file.

Changed oiiotool to match: By default, IB's own their local memory.
Using the --cache option (which previously existed to set the size of
the cache) also enables use of the cache, so it's still possible to use
IC-backed IBs if the user needs it.

For the reader of this PR: What do you think? Is this a change you'd
like to see? Is it something we should try to squeeze into 2.5? Or are
we not sure enough about whether it's the right thing that we should not
be merging it close to a major release?

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-24 20:17:19 -07:00
Larry Gritz 3031f9153f testing: Set up placeholders for docs-examples-are-tests (#3994)
I had previously prototyped an instance of this for the ImageOutput
chapter.

This patch makes empty placeholders for all of the other API chapters.
They don't contain any actual tests or generate any output now, but they
do build and run, so people can drop new examples into them without
having to worry about how to set up new files for each chapter.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-24 20:11:28 -07:00
Larry Gritz 1b6c89c57a perf(oiiotool): oiiotool --mosaic improve type conversion (#3979)
`oiiotool --mosaic` was always allocating a `float` buffer for the
result. Instead, make it use the "widest" data type of the input images.
So, for example, if you are making a mosaic of uint8 images, the result
buffer should be uint8, not have to allocate 4x bigger nor do
uint8->float conversions as it pastes the images.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-21 12:15:50 -07:00
Larry Gritz dbfe1c65c5 admin: Relicense code under Apache 2.0 (#3989)
This is Update 5, 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-09-20 14:57:57 -07:00
Danny Greenstein af1f2df2d1 Print build-time warnings for LGPL gotchas (#3958)
Print helpful reminder to check licenses when using libheif or
ffmpeg statically linked.

Fixes #3916

Signed-off-by: grdanny <danny.gr@gmail.com>
2023-09-20 14:57:48 -07:00
Larry Gritz e181aadac5 build: Test ABI compliance (#3983, #3988)
This patch adds a new test to the CI matrix: verifying that we do not
break the ABI during releases.

Basically, in addition to building the current checkout, it also builds
a checkout of the designated "ABI standard" (generally, the first
non-beta release of a major version), then generates ABI dumps of both
versions and runs the ABI compliance checker using the tools from
https://github.com/lvc

Making two builds sounds expensive, but both builds are rigged to be
minimal, since only the main two libraries are needed for ABI checks (we
can turn off the binary tools, unit tests, python bindings, and support
for many formats), and of course the test suite need not run. So
actually, it's less expensive than most of the test matrix entries, and
it helps ensure that we don't accidentally break ABI when we don't mean
to.

I'm not sure how many false positives we'll have. We might need to
adjust the methodology slightly as we gain experience with this.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-16 21:58:34 -07:00
Jesse Yurkovich 082b360122 fix(png): Write out proper tiff header version in png EXIF blobs (#3984)
When writing out EXIF headers in PNG files, the `tiff_version` field
wasn't handling endianness properly.

This lead to some tools like `exiv2` refusing to process the file at
all[1]

[1] https://github.com/Exiv2/exiv2/issues/2745

---------

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
2023-09-16 16:32:48 -07:00
Larry Gritz 8d37a81f83 feat(python): Implement ImageCache.get_imagespec() (#3982)
This C++ method of ImageCache was never exposed previously.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-16 16:31:39 -07:00
Larry Gritz 49459df4b8 docs: Prototype docs examples doubling as tests (#3977)
New theory of code examples in the docs: every one should live in the
testsuite somewhere, and merely be included by reference in the docs.
This ensures that every code example works, stays current with the
evolution of the APIs, and never breaks. It also beefs up our test cases
for more thorough code overage in the testsuite.

I've done this with just two examples here, but hopefully it serves as
an example for others to -- bit by bit -- convert all the other code
examples in the docs into tests in a similar manner.

Doing this for any one example is a perfect "good first issue," since
it's bite sized and can easily be done in a day, it doesn't require any
knowledge of deep OIIO internals, and in the process it also teaches you
something about how both the docs and the testsuite are set up.

A few notes:

* I'm structuring it (for now?) as two testsuite entry for each chapter
of the documentation (one for C++ and one for Python).

* Note how I can have many code snippets in a test source file, and use
the Sphinx `:start-after:` and `:end-before:` modifiers of
`literalinclude` to clip particular subsections of the file, using
special comment markers in the code.

While I was there, I also fixed some typos I noticed in the text of the
chapter, oops.

---------

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-16 16:31:24 -07:00
Larry Gritz a0162813fd 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:02 -07:00
Jesse Yurkovich 7c4634ce64 Remove unnecessary headers from strutil.cpp causing build trouble (#3976)
While testing out the 2.5 beta for use in Blender, I hit an odd build
error[1] apparently related to include order. Apparently `windows.h`
should be included before `shellapi.h`[2]. Swapping the order does fix
things, however, it turns out neither is used in this particular file so
just remove them both. Unsure why we didn't see it until now.

[1]
```
20>[9/146] Building CXX object src\libutil\CMakeFiles\OpenImageIO_Util.dir\strutil.cpp.obj
20>FAILED: src/libutil/CMakeFiles/OpenImageIO_Util.dir/strutil.cpp.obj

20>cl : Command line warning D9002: ignoring unknown option '/arch:sse2'
20>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\shellapi.h(68): error C2146: syntax error: missing ';' before identifier 'DECLSPEC_IMPORT'
20>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\shellapi.h(79): error C2065: 'HDROP': undeclared identifier
20>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\shellapi.h(82): error C2086: 'int EXTERN_C': redefinition
20>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\shellapi.h(68): note: see declaration of 'EXTERN_C'
```
[2] 

https://stackoverflow.com/questions/2953704/vs2010-lots-of-errors-when-including-standard-libraries

https://social.msdn.microsoft.com/forums/vstudio/en-us/ed93ae48-969a-4280-8fd5-ef57a332022b/problems-with-shellexecute-and-shellapih?forum=vcgeneral

## Checklist:

<!-- Put an 'x' in the boxes as you complete the checklist items -->

- [X] 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).
- [ ] 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).
- [X] 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.

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
2023-09-08 12:42:31 -07:00
Larry Gritz 1383491c9b Stage for 2.5.3.0-beta1
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2023-09-04 19:58:10 -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
637 changed files with 11487 additions and 3515 deletions
+1 -2
View File
@@ -1,6 +1,5 @@
Language: Cpp
BasedOnStyle: WebKit
SpaceBeforeParens: ControlStatements
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
@@ -122,7 +121,7 @@ SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++14
Standard: c++17
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
+4
View File
@@ -36,3 +36,7 @@ f701a76b745b6ddba41c77b24a1ea7e1f48ae0b4
# clang-format: Adjust alignment of line continuation backslashes (#2664)
742173e39588e07cf43cbe7b49dd22d624a48388
d8810c5365ea88e2b1bce6155b7b495c18f2f9bc
# style: update our formatting standard to clang-format 17.0 and C++17 (#4096)
c618d45e13dcc382fb07a948be84b8074d1ed481
b88b82ffe9b3c4fcf04bf17bacc4ee77b2d1ed92
+23 -12
View File
@@ -8,30 +8,41 @@ assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is. What happened, and
what did you expect to happen instead.
**OpenImageIO version and dependencies**
Please run `oiiotool --buildinfo` and paste the output here.
Also please tell us if there was anything unusual about your environment or
nonstandard build options you used.
**To Reproduce**
Steps to reproduce the behavior:
1. Do this...
2. Then this...
3. Then THIS happens (reproduce the exact error message if you can)
4. Whereas I expected this other specific thing to happen instead.
If the problem occurs in your C++ or Python code that uses the OIIO APIs, can
you also reproduce the problem using oiiotool? If so, please describe the
exact command line that reproduces the problem. (Being able to reproduce the
problem using only OIIO components makes it a lot easier for the developers
investigate and makes it clear it's not your application's fault.)
**Expected behavior**
A clear and concise description of what you expected to happen.
**Evidence**
Do you have error messages? (please quote exactly) Screenshots? Example
command lines or scripts that reliably reproduce the error? If it only
happens with certain image files, can you attach the smallest image you
can make that reproduces the problem?
**Platform information:**
- OIIO branch/version:
- OS:
- C++ compiler:
- Any non-default build flags when you build OIIO:
- Error messages (paste them here exactly)
- Screenshots (if helpful)
- Example input: If the problem only happens with certain image files, please
attach the smallest image you can make that reproduces the problem.
**IF YOU ALREADY HAVE A CODE FIX:** There is no need to file a separate issue,
please just go straight to making a [pull request](https://github.com/OpenImageIO/oiio/pulls).
please just go straight to making a [pull request](https://github.com/AcademySoftwareFoundation/OpenImageIO/pulls).
+1 -1
View File
@@ -18,4 +18,4 @@ When you email about this, please attach one or both of the following:
2. The `CMakeCache.txt` file from your build directory.
If you are pretty sure that you have identified a **BUG** in the OpenImageIO
build scripts, please file a [bug report issue](https://github.com/OpenImageIO/oiio/issues/new?template=bug_report.md).
build scripts, please file a [bug report issue](https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/new?template=bug_report.md).
+1 -1
View File
@@ -10,7 +10,7 @@ assignees: ''
**PLEASE DO NOT ASK USAGE QUESTIONS USING GITHUB "ISSUES"**
If you are pretty sure that you have identified a **BUG** in OpenImageIO,
please file a [bug report issue](https://github.com/OpenImageIO/oiio/issues/new?template=bug_report.md).
please file a [bug report issue](https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/new?template=bug_report.md).
But if you are just asking a question:
* How do I...?
+1 -1
View File
@@ -19,7 +19,7 @@
<!-- Put an 'x' in the boxes as you complete the checklist items -->
- [ ] I have read the [contribution guidelines](https://github.com/OpenImageIO/oiio/blob/master/CONTRIBUTING.md).
- [ ] I have read the [contribution guidelines](https://github.com/AcademySoftwareFoundation/OpenImageIO/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).
+25 -17
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
name: Analysis
@@ -35,7 +35,7 @@ jobs:
name: "SonarCloud Analysis"
# Exclude runs on forks, since only the main org has the SonarCloud
# account credentials.
if: github.repository == 'OpenImageIO/oiio'
if: github.repository == 'AcademySoftwareFoundation/OpenImageIO'
strategy:
fail-fast: false
matrix:
@@ -43,30 +43,28 @@ jobs:
- desc: sonar gcc9/C++14 py39 boost1.76 exr3.1 ocio2.2
nametag: static-analysis-sonar
os: ubuntu-latest
vfxyear: 2022
vfxsuffix: -clang11
cxx_std: 14
python_ver: 3.9
container: aswf/ci-osl:2023-clang15
vfxyear: 2023
cxx_std: 17
python_ver: "3.10"
simd: "avx2,f16c"
fmt_ver: 8.1.1
pybind11_ver: v2.9.0
fmt_ver: 10.1.1
pybind11_ver: v2.10.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"
setenvs: export SONAR_SERVER_URL="https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR=/__w/OpenImageIO/OpenImageIO/bw_output
OIIO_CMAKE_BUILD_WRAPPER="build-wrapper-linux-x86-64 --out-dir /__w/OpenImageIO/OpenImageIO/bw_output"
CMAKE_BUILD_TYPE=Debug
CMAKE_UNITY_BUILD=OFF
CODECOV=1
CTEST_TEST_TIMEOUT=1200
OIIO_CMAKE_FLAGS="-DOIIO_TEX_IMPLEMENT_VARYINGREF=OFF"
OPENCOLORIO_VERSION=v2.2.0
runs-on: ${{ matrix.os }}
container:
image: aswf/ci-osl:${{matrix.vfxyear}}${{matrix.vfxsuffix}}
image: ${{ matrix.container }}
env:
CXX: ${{matrix.cxx_compiler}}
CC: ${{matrix.cc_compiler}}
@@ -90,7 +88,7 @@ jobs:
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'`"
run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT
- name: ccache
id: ccache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
@@ -106,6 +104,9 @@ jobs:
run: |
${{matrix.depcmds}}
src/build-scripts/gh-installdeps.bash
- name: Install sonar-scanner and build-wrapper
if: matrix.sonar == '1'
uses: sonarsource/sonarcloud-github-c-cpp@e4882e1621ad2fb48dddfa48287411bed34789b1 # v2.0.2
- name: Build
run: src/build-scripts/ci-build.bash
- name: Testsuite
@@ -120,7 +121,14 @@ jobs:
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"
which sonar-scanner
ls -l /__w/OpenImageIO/OpenImageIO/bw_output
echo "BUILD_OUTPUT_DIR is " "${{ env.BUILD_WRAPPER_OUT_DIR }}"
find . -name "*.gcov" -print
# sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
time sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="$BUILD_WRAPPER_OUT_DIR" --define sonar.cfamily.gcov.reportsPath="_coverage" --define sonar.cfamily.threads="$PARALLEL"
# Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options
# - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
# if: failure()
# with:
+157 -84
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
name: CI
@@ -10,6 +10,8 @@ on:
paths-ignore:
- '**.md'
- '**.rst'
- '**.analysis.yml'
- '**.properties'
pull_request:
paths-ignore:
- '**.md'
@@ -17,7 +19,9 @@ on:
schedule:
# Full nightly build
- cron: "0 8 * * *"
if: github.repository == 'OpenImageIO/oiio'
if: github.repository == 'AcademySoftwareFoundation/OpenImageIO'
workflow_dispatch:
# This allows manual triggering of the workflow from the web
permissions: read-all
@@ -32,7 +36,7 @@ jobs:
include:
- desc: gcc6/C++14 py2.7 boost1.66 exr2.4 ocio1.1
nametag: linux-vfx2019
os: ubuntu-latest
runner: ubuntu-latest
container: aswf/ci-osl:2019
vfxyear: 2019
cxx_std: 14
@@ -44,7 +48,7 @@ jobs:
setenvs: export PUGIXML_VERSION=v1.9 CMAKE_VERSION=3.15.5
- desc: gcc6/C++14 py3.7 boost1.70 exr2.4 ocio1.1
nametag: linux-vfx2020
os: ubuntu-latest
runner: ubuntu-latest
container: aswf/ci-osl:2020
vfxyear: 2020
cxx_std: 14
@@ -55,7 +59,7 @@ jobs:
setenvs: export PUGIXML_VERSION=v1.9 WEBP_VERSION=v1.1.0
- desc: gcc9/C++17 py3.7 boost1.73 exr2.5 ocio2.0
nametag: linux-vfx2021
os: ubuntu-latest
runner: ubuntu-latest
container: aswf/ci-osl:2021
vfxyear: 2021
cxx_std: 17
@@ -66,7 +70,7 @@ jobs:
setenvs: export PUGIXML_VERSION=v1.9 WEBP_VERSION=v1.1.0
- desc: clang10/C++14 avx2 exr2.5 ocio2.0
nametag: linux-clang10-cpp14
os: ubuntu-latest
runner: ubuntu-latest
container: aswf/ci-osl:2021-clang10
vfxyear: 2021
cc_compiler: clang
@@ -78,7 +82,7 @@ jobs:
fmt_ver: 8.1.1
- desc: gcc9/C++17 py39 boost1.76 exr3.1 ocio2.1
nametag: linux-vfx2022
os: ubuntu-latest
runner: ubuntu-latest
container: aswf/ci-osl:2022-clang11
vfxyear: 2022
cxx_std: 17
@@ -88,7 +92,7 @@ jobs:
pybind11_ver: v2.9.0
- desc: clang13/C++17 py39 avx2 exr3.1 ocio2.1
nametag: linux-vfx2022-clang13
os: ubuntu-latest
runner: ubuntu-latest
container: aswf/ci-osl:2022-clang13
vfxyear: 2022
cc_compiler: clang
@@ -100,7 +104,7 @@ jobs:
pybind11_ver: v2.8.1
- desc: icc/C++17 py3.9 boost1.76 exr3.1 ocio2.1 qt5.15
nametag: linux-vfx2022-icc
os: ubuntu-latest
runner: ubuntu-latest
container: aswf/ci-osl:2022
vfxyear: 2022
cxx_std: 17
@@ -115,7 +119,7 @@ jobs:
# that make test results differ from other platforms.
- desc: icx/C++17 py3.9 boost1.76 exr3.1 ocio2.1 qt5.15
nametag: linux-vfx2022-icx
os: ubuntu-latest
runner: ubuntu-latest
container: aswf/ci-osl:2022
vfxyear: 2022
cc_compiler: icx
@@ -127,7 +131,7 @@ jobs:
setenvs: export USE_OPENVDB=0
- desc: sanitizers
nametag: sanitizer
os: ubuntu-latest
runner: ubuntu-latest
container: aswf/ci-osl:2022-clang13
vfxyear: 2022
cc_compiler: clang
@@ -138,10 +142,10 @@ jobs:
OIIO_CMAKE_FLAGS="-DSANITIZE=address,undefined -DUSE_PYTHON=0"
CMAKE_BUILD_TYPE=Debug
CTEST_TEST_TIMEOUT=1200
CTEST_EXCLUSIONS="broken|cmake-consumer|png-damaged"
CTEST_EXCLUSIONS="broken|png-damaged"
- desc: gcc11/C++17 py3.10 boost1.80 exr3.1 ocio2.2
nametag: linux-vfx2023
os: ubuntu-latest
runner: ubuntu-latest
container: aswftesting/ci-osl:2023-clang15
vfxyear: 2023
cxx_std: 17
@@ -149,11 +153,21 @@ jobs:
simd: "avx2,f16c"
fmt_ver: 10.1.1
pybind11_ver: v2.10.0
- desc: gcc11/C++17 py3.11 boost1.82 exr3.2 ocio2.3
nametag: linux-vfx2024
runner: ubuntu-latest
container: aswftesting/ci-osl:2024-clang17
vfxyear: 2024
cxx_std: 17
python_ver: "3.11"
simd: "avx2,f16c"
fmt_ver: 10.1.1
pybind11_ver: v2.10.0
- desc: oldest/hobbled gcc6.3/C++14 py2.7 boost-1.66 exr-2.4 no-sse no-ocio
# Oldest versions of the dependencies that we can muster, and various
# things disabled (no SSE, OCIO, or OpenCV, don't embed plugins).
nametag: linux-oldest
os: ubuntu-latest
runner: ubuntu-latest
container: aswf/ci-osl:2019
vfxyear: 2019
cxx_std: 14
@@ -171,22 +185,27 @@ jobs:
USE_OPENCV=0
depcmds: sudo rm -rf /usr/local/include/OpenEXR
# Test formatting. This test entry doesn't do a full build, it
# just runs clang-format on everything, and passes if nothing is
# misformatted. Upon failure, the build artifact will be the full
# source code with the formatting fixed (diffs will also appear in
# the console output).
- desc: "clang-format"
nametag: clang-format
os: ubuntu-latest
container: aswf/ci-osl:2022-clang12
vfxyear: 2022
# Test ABI stability. `abi_check` is the version or commit that we
# believe is the current standard against which we don't want to
# break the ABI. Basically, we will build that version as well as
# the current one, and compare the resulting libraries.
- desc: abi check
nametag: linux-vfx2023
runner: ubuntu-latest
container: aswftesting/ci-osl:2023-clang15
vfxyear: 2023
cxx_std: 17
python_ver: "3.10"
simd: "avx2,f16c"
fmt_ver: 10.1.1
pybind11_ver: v2.10.0
skip_tests: 1
setenvs: export BUILDTARGET=clang-format
OIIO_CMAKE_FLAGS=-DUSE_PYTHON=0
abi_check: v2.5.3.0-beta1
setenvs: export OIIO_CMAKE_FLAGS="-DOIIO_BUILD_TOOLS=0 -DOIIO_BUILD_TESTS=0 -DUSE_PYTHON=0"
USE_OPENCV=0 USE_FFMPEG=0 USE_PYTHON=0
CMAKE_BUILD_TYPE=RelWithDebInfo
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.runner }}
container:
image: ${{ matrix.container }}
env:
@@ -198,6 +217,7 @@ jobs:
OPENEXR_VERSION: ${{matrix.openexr_ver}}
PYBIND11_VERSION: ${{matrix.pybind11_ver}}
PYTHON_VERSION: ${{matrix.python_ver}}
ABI_CHECK: ${{matrix.abi_check}}
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
@@ -209,7 +229,7 @@ jobs:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT
- name: ccache
id: ccache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
@@ -230,12 +250,30 @@ jobs:
- name: Testsuite
if: matrix.skip_tests != '1'
run: src/build-scripts/ci-test.bash
- name: Check out ABI standard
if: matrix.abi_check != ''
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
ref: ${{matrix.abi_check}}
path: abi_standard
- name: Build ABI standard
if: matrix.abi_check != ''
run: |
mkdir -p abi_standard/build
pushd abi_standard
src/build-scripts/ci-build.bash
popd
- name: Check ABI
if: matrix.abi_check != ''
run: |
src/build-scripts/ci-abicheck.bash ./build abi_standard/build libOpenImageIO libOpenImageIO_Util
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
if: failure()
with:
name: oiio-${{github.job}}-${{matrix.nametag}}
path: |
build/cmake-save
build/compat_reports
build/testsuite/*/*.*
!build/testsuite/oiio-images
!build/testsuite/openexr-images
@@ -249,50 +287,60 @@ jobs:
fail-fast: false
matrix:
include:
- desc: latest releases gcc11 C++17 avx2 exr3.2 ocio2.3
- desc: latest releases gcc12 C++17 avx2 exr3.2 ocio2.3
nametag: linux-latest-releases
os: ubuntu-22.04
cc_compiler: gcc-11
cxx_compiler: g++-11
runner: ubuntu-22.04
cc_compiler: gcc-12
cxx_compiler: g++-12
cxx_std: 17
fmt_ver: 10.1.1
openexr_ver: v3.2.0
openexr_ver: v3.2.1
pybind11_ver: v2.11.1
python_ver: "3.10"
simd: avx2,f16c
setenvs: export LIBRAW_VERSION=0.20.2
LIBTIFF_VERSION=v4.5.0
OPENCOLORIO_VERSION=v2.3.0
setenvs: export LIBJPEGTURBO_VERSION=3.0.1
LIBRAW_VERSION=0.21.2
LIBTIFF_VERSION=v4.6.0
OPENCOLORIO_VERSION=v2.3.2
OPENJPEG_VERSION=v2.4.0
PTEX_VERSION=v2.4.0
PUGIXML_VERSION=v1.13
PTEX_VERSION=v2.4.2
PUGIXML_VERSION=v1.14
USE_OPENVDB=0
WEBP_VERSION=v1.3.0
# The installed OpenVDB has a TLS conflict with Python 3.8
- desc: bleeding edge gcc12 C++20 py3.10 OCIO/libtiff/exr-master boost1.74 avx2
- desc: bleeding edge gcc14 C++20 py3.12 OCIO/libtiff/exr-master boost1.74 avx2
nametag: linux-bleeding-edge
os: ubuntu-22.04
cc_compiler: gcc-12
cxx_compiler: g++-12
runner: ubuntu-24.04
cc_compiler: gcc-14
cxx_compiler: g++-14
cxx_std: 20
fmt_ver: master
fmt_ver: 10.0.0
openexr_ver: main
pybind11_ver: master
python_ver: "3.10"
python_ver: "3.12"
simd: avx2,f16c
setenvs: export LIBRAW_VERSION=master
setenvs: export LIBJPEGTURBO_VERSION=main
LIBRAW_VERSION=master
LIBTIFF_VERSION=master
OPENCOLORIO_VERSION=main
OPENJPEG_VERSION=master
PTEX_VERSION=main
PUGIXML_VERSION=master
USE_OPENVDB=0
WEBP_VERSION=main
OIIO_CMAKE_FLAGS="-DFORTIFY_SOURCE=2"
QT_VERSION=6
EXTRA_DEP_PACKAGES="python3.12-dev python3-numpy"
PIP_INSTALLS="none"
USE_OPENVDB=0
SKIP_APT_GET_UPDATE=1
# The installed OpenVDB has a TLS conflict with Python 3.8
# Disabling the `apt-get update` in gh-installdeps.bash
# addresses a job killing problem in the GHA Ubuntu
# 24.04 runners that cropped up circa May 29 2024. Maybe
# it will be fixed and we can do the update again later?
- desc: clang14 C++20 avx2 exr3.1 ocio2.1
nametag: linux-clang14
os: ubuntu-20.04
runner: ubuntu-20.04
cxx_compiler: clang++
cc_compiler: clang
cxx_std: 20
@@ -307,7 +355,7 @@ jobs:
# The installed OpenVDB has a TLS conflict with Python 3.8
- desc: debug gcc7/C++14, sse4.2, exr2.4
nametag: linux-gcc7-cpp14-debug
os: ubuntu-20.04
runner: ubuntu-20.04
container:
image: ubuntu-18.04
cxx_compiler: g++-7
@@ -322,7 +370,7 @@ jobs:
- desc: gcc8 C++17 avx exr2.5
nametag: linux-gcc8
os: ubuntu-20.04
runner: ubuntu-20.04
container:
image: ubuntu-18.04
cc_compiler: gcc-8
@@ -331,9 +379,10 @@ jobs:
openexr_ver: v2.5.8
pybind11_ver: v2.5.0
simd: avx
setenvs: export EXTRA_DEP_PACKAGES=libjpeg-turbo8-dev
- desc: static libs gcc7 C++14 exr2.4
nametag: linux-static
os: ubuntu-20.04
runner: ubuntu-20.04
container:
image: ubuntu-18.04
cxx_compiler: g++-7
@@ -344,8 +393,24 @@ jobs:
depcmds: |
sudo rm -rf /usr/local/include/OpenEXR
sudo rm -rf /usr/local/lib64/cmake/{IlmBase,OpenEXR}
# Test formatting. This test entry doesn't do a full build, it
# just runs clang-format on everything, and passes if nothing is
# misformatted. Upon failure, the build artifact will be the full
# source code with the formatting fixed (diffs will also appear in
# the console output).
- desc: "clang-format"
nametag: clang-format
runner: ubuntu-latest
cxx_std: 17
extra_artifacts: "src/*.*"
python_ver: "3.10"
skip_tests: 1
setenvs: export BUILDTARGET=clang-format
OIIO_CMAKE_FLAGS=-DUSE_PYTHON=0
LLVM_VERSION=17.0.6 LLVM_DISTRO_NAME=ubuntu-22.04
SKIP_SYSTEM_DEPS_INSTALL=1 QT_VERSION=0
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.runner }}
env:
CXX: ${{matrix.cxx_compiler}}
CC: ${{matrix.cc_compiler}}
@@ -366,7 +431,7 @@ jobs:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT
- name: ccache
id: ccache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
@@ -374,6 +439,7 @@ jobs:
path: /tmp/ccache
key: ${{github.job}}-${{matrix.nametag}}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: ${{github.job}}-
save-always: true
- name: Build setup
run: |
${{matrix.setenvs}}
@@ -394,6 +460,7 @@ jobs:
path: |
build/cmake-save
build/testsuite/*/*.*
${{ matrix.extra_artifacts }}
!build/testsuite/oiio-images
!build/testsuite/openexr-images
!build/testsuite/fits-images
@@ -401,43 +468,49 @@ jobs:
macos:
name: "${{matrix.os}} appleclang${{matrix.aclang}}/C++${{matrix.cxx_std}} py${{matrix.python_ver}} ${{matrix.desc}} boost1.76 exr3.1 ocio2.1"
name: "${{matrix.runner}} appleclang${{matrix.aclang}}/C++${{matrix.cxx_std}} py${{matrix.python_ver}} ${{matrix.desc}}"
strategy:
fail-fast: false
matrix:
include:
- desc: MacOS-11
os: macos-11
nametag: macos11-py39
cxx_std: 17
python_ver: "3.9"
aclang: 13
setenvs: export QT_VERSION=@5
- desc: MacOS-12
os: macos-12
runner: macos-12
nametag: macos12-py310
cxx_std: 20
cc_compiler: clang
cxx_compiler: clang++
cxx_std: 17
python_ver: "3.10"
aclang: 13
setenvs: export CTEST_TEST_TIMEOUT=600
- desc: MacOS-13
os: macos-13
runner: macos-13
nametag: macos13-py311
cxx_std: 20
cc_compiler: clang
cxx_compiler: clang++
cxx_std: 17
python_ver: "3.11"
aclang: 14
setenvs: export CTEST_TEST_TIMEOUT=600
runs-on: ${{ matrix.os }}
simd: sse4.2,avx2
- desc: MacOS-14-ARM
runner: macos-14
nametag: macos14-arm-py311
cc_compiler: clang
cxx_compiler: clang++
cxx_std: 20
python_ver: "3.11"
aclang: 15
runs-on: ${{ matrix.runner }}
env:
CC: clang
CXX: clang++
CXX: ${{matrix.cxx_compiler}}
CC: ${{matrix.cc_compiler}}
CMAKE_CXX_STANDARD: ${{ matrix.cxx_std }}
PYTHON_VERSION: ${{ matrix.python_ver }}
USE_SIMD: ${{matrix.simd}}
CTEST_TEST_TIMEOUT: 600
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
run: echo "date=`date -u +'%Y-%m-%dT%H:%M:%SZ'`" >> $GITHUB_OUTPUT
- name: ccache
id: ccache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
@@ -445,6 +518,7 @@ jobs:
path: /Users/runner/.ccache
key: ${{github.job}}-${{matrix.nametag}}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: ${{github.job}}-
save-always: true
- name: Build setup
run: |
${{matrix.setenvs}}
@@ -479,21 +553,20 @@ jobs:
matrix:
include:
- desc: windows-2019
os: windows-2019
runner: windows-2019
vsver: 2019
generator: "Visual Studio 16 2019"
openexr_ver: v2.5.8
openexr_ver: v3.2.2
python_ver: 3.7
simd: sse4.2
# - desc: windows-2022
# os: windows-2022
# vsver: 2022
# generator: "Visual Studio 17 2022"
# openexr_ver: main
# # v3.1.4
# python_ver: 3.7
# simd: sse4.2
runs-on: ${{ matrix.os }}
# simd: sse4.2
- desc: windows-2022
runner: windows-2022
vsver: 2022
generator: "Visual Studio 17 2022"
openexr_ver: v3.2.2
python_ver: "3.9"
# simd: sse4.2
runs-on: ${{ matrix.runner }}
env:
PYTHON_VERSION: ${{matrix.python_ver}}
CMAKE_GENERATOR: ${{matrix.generator}}
@@ -503,7 +576,7 @@ jobs:
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Setup Nuget.exe
uses: nuget/setup-nuget@b2bc17b761a1d88cab755a776c7922eb26eefbfa # v1.0.6
uses: nuget/setup-nuget@a21f25cd3998bf370fde17e3f1b4c12c175172f9 # v2.0.0
- name: Build setup
shell: bash
run: |
+26
View File
@@ -0,0 +1,26 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
name: Publish Release Notice to ASWF Slack
on:
release:
types:
- published
# published should cover both 'released' and 'prereleased'
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Notify Slack
id: slack
with:
project_name: "OpenImageIO"
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
slack_channel: "#release-announcements"
project_logo: "https://artwork.aswf.io/projects/openimageio/icon/color/openimageio-icon-color.png"
uses: jmertic/slack-release-notifier@main
+6 -1
View File
@@ -1,3 +1,8 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
name: Scorecards supply-chain security
on:
# Only the default branch is supported.
@@ -23,7 +28,7 @@ concurrency:
jobs:
analysis:
name: Scorecards analysis
if: github.repository == 'OpenImageIO/oiio'
if: github.repository == 'AcademySoftwareFoundation/OpenImageIO'
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
+70
View File
@@ -1 +1,71 @@
# This file establishes email equivalences so we can resolve what look like
# multiple authors, but actually are the same author who has used multiple
# emails over the course of their involvement with the project.
#
# The format is any of the following:
# <CANONICAL-EMAIL> <alternate-email>
# CANONICAL-NAME <CANONICAL-EMAIL> <alternate-email>
# CANONICAL-NAME <CANONICAL-EMAIL> alternate-name <alternate-email>
#
# You can check for duplicates with this command:
# git shortlog -sne --all
# That command (and others) will use this file to collapse the duplicates.
#
# If you see any duplicates we don't account for here, or if you look at your
# own entry here and want a different name or email to be your canonical one
# (we may not have guessed correctly and matched your preferences), please
# file a PR with the edits to this file.
Alejandro Conty <aconty@imageworks.com> aconty <aconty@gmail.com>
Alejandro Conty <aconty@imageworks.com> Alejandro Conty <aconty@gmail.com>
Anton Dukhovnikov <antond@wetafx.co.nz> Anton Dukhovnikov <131838425+antond-weta@users.noreply.github.com>
Brecht Van Lommel <brecht@blender.org> <brecht@solidangle.com>
Brecht Van Lommel <brecht@blender.org> Brecht Van Lommel <brechtvanlommel@gmail.com>
Brecht Van Lommel <brecht@blender.org> brechtvanlommel@gmail.com <brechtvanlommel@gmail.com>
Chris Kulla <ckulla@gmail.com> <ckulla@imageworks.com>
Chris Kulla <ckulla@gmail.com> <fpsunflower@users.noreply.github.com>
Chris Kulla <ckulla@gmail.com> Christopher Kulla <ckulla@gmail.com>
Chris Kulla <ckulla@gmail.com> fpsunflower <ckulla@gmail.com>
Claire Foster <aka.c42f@gmail.com> <chris42f@gmail.com>
Clément Champetier <cl.champetier@gmail.com> Clement Champetier <cnt@mikrosimage.eu>
Clifford Stein <cstein@imageworks.com> Cliff Stein <clifford.stein@gmail.com>
Clifford Stein <cstein@imageworks.com> cmstein <cstein@imageworks.com>
Dan Wexler <danwexler@gmail.com> Dan Wexler <wex@flarg.com>
Dan Wexler <danwexler@gmail.com> Dan Wexler <wex@the11ers.com>
Edgar Velazquez-Armendariz <eva5@cs.cornell.edu> Edgar Velázquez-Armendáriz <edgarv@users.noreply.github.com>
Fabien Castan <fabcastan@gmail.com> Fabien Castan <fabien.castan@free.fr>
Fabien Servant <55734626+servantf@users.noreply.github.com> Fabien Servant @ TCS <100348063+servantftechnicolor@users.noreply.github.com>
Frédéric Devernay <frederic.devernay@m4x.org> Frédéric Devernay <devernay@users.noreply.github.com>
Harry Mallon <harry.mallon@codex.online> Harry Mallon <1816667+hjmallon@users.noreply.github.com>
Henri Fousse <henri.fousse@free.fr> darkhorse64 <henri.fousse@free.fr>
Jesse Yurkovich <jesse.y@gmail.com> Jesse Y <jesse.y@gmail.com>
Larry Gritz <lg@larrygritz.com> <larrygritz@gmail.com>
Larry Gritz <lg@larrygritz.com> lgritz <lg@larrygritz.com>
Leszek Godlewski <ineqvation@gmail.com> Leszek Godlewski <lg@inequation.org>
lmarz <main@lmarz.org> lmarz <37630820+lmarz@users.noreply.github.com>
Mark Boorer <markboo99@gmail.com> Mark Boorer <mkj@dneg.com>
Mark Boorer <markboo99@gmail.com> Shootfast <markboo99@gmail.com>
Mark Visser <mjmvisser@gmail.com> Mark Visser <mvisser@mokkostudio.com>
Matteo F. Vescovi <mfvescovi@gmail.com> Matteo F. Vescovi <mfv.debian@gmail.com>
Matteo F. Vescovi <mfvescovi@gmail.com> Matteo F. Vescovi <mfvescovi@users.noreply.github.com>
Mikael Sundell <mikael.sundell@gmail.com> Mikael Sundell <mikaelsundell@Mikaels-MacBook-Pro.local>
Nathan Rusch <nathanrusch@gmail.com> Nathan Rusch <nrusch@users.noreply.github.com>
Nick Black <dank@qemfd.net> nick black <dankamongmen@gmail.com>
Nick Black <dank@qemfd.net> Nick Black <dankamongmen@gmail.com>
Pascal Lecocq <plecocq@imageworks.com> Pascal Lecocq <pascal.lecocq@gmail.com>
Ramon Montoya <ramon.montoya@gmail.com> Ramon Montoya Vozmediano <ramon.montoya@gmail.com>
Ramon Montoya <ramon.montoya@gmail.com> rmv <ramon.montoya@gmail.com>
Ray Molenkamp <ray@lazydodo.com> Ray Molenkamp <github@lazydodo.com>
Richard M. Shaw <hobbes1069@gmail.com> Richard <hobbes1069@gmail.com>
Richard M. Shaw <hobbes1069@gmail.com> Richard Shaw <hobbes1069@gmail.com>
Robert Matusewicz <matekm@gmail.com> matekm <matekm@gmail.com>
Robert Matusewicz <matekm@gmail.com> Robert <matekm@gmail.com>
Roman Zulak <marsupial@users.noreply.github.com> marsupial <marsupial@users.noreply.github.com>
Sam Richards <sam_junk@taurich.org> Sam Richards <sam@imageworks.com>
Shane Ambler <FreeBSD@ShaneWare.Biz> sambler <Develop@Shaneware.Biz>
Shane Ambler <FreeBSD@ShaneWare.Biz> SAmbler <Develop@Shaneware.Biz>
Simon Boorer <simonboo99@gmail.com> Simon Boorer <sboorer@localhost.localdomain>
Thiago Ize <thiago@solidangle.com> Thiago Ize <ThiagoIze@users.noreply.github.com>
Vlad (Kuzmin) Erium <shaamaan@gmail.com> Vlad (Kuzmin) Erium <libalias@gmail.com>
Will Rosecrans <wrosecrans@gmail.com> Will <wrosecrans@gmail.com>
Yang Yang <yang.yang@topazlabs.com> YangYangTL <yang.yang@topazlabs.com>
+11 -1
View File
@@ -2,9 +2,20 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Required
version: 2
# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: src/doc/conf.py
@@ -16,6 +27,5 @@ formats:
# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: src/doc/requirements.txt
+6 -6
View File
@@ -15,7 +15,7 @@ This is a checklist for TSC's to review as part of the intake process. The TSC s
- Infrastructure/Assets
- [X] Technical Charter Approved
- [X] 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] 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 )
@@ -25,8 +25,8 @@ This is a checklist for TSC's to review as part of the intake process. The TSC s
- [ ] 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] Domain name ( create [issue with the LF IT staff](https://jira.linuxfoundation.org/plugins/servlet/theme/portal/2/group/19) to setup/transfer )
- [X] 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
@@ -43,8 +43,8 @@ This is a checklist for TSC's to review as part of the intake process. The TSC s
- [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
- [X] Have had a successful license scan with any critical issues remedied.
- [X] 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?
@@ -54,7 +54,7 @@ This is a checklist for TSC's to review as part of the intake process. The TSC s
- 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.
- [X] 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.
+417 -233
View File
File diff suppressed because it is too large Load Diff
+15 -6
View File
@@ -1,10 +1,10 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
cmake_minimum_required (VERSION 3.15)
set (OpenImageIO_VERSION "2.5.3.0")
set (OpenImageIO_VERSION "2.5.12.0")
set (OpenImageIO_VERSION_OVERRIDE "" CACHE STRING
"Version override (use with caution)!")
mark_as_advanced (OpenImageIO_VERSION_OVERRIDE)
@@ -19,12 +19,12 @@ project (OpenImageIO VERSION ${OpenImageIO_VERSION}
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 ()
@@ -92,6 +92,11 @@ endif ()
option (VERBOSE "Print lots of messages while compiling" OFF)
if (VERBOSE)
set (CMAKE_MESSAGE_LOG_LEVEL "VERBOSE" CACHE STRING "CMake log level to display")
else ()
set (CMAKE_MESSAGE_LOG_LEVEL "STATUS" CACHE STRING "CMake log level to display")
endif ()
option (${PROJ_NAME}_BUILD_TOOLS "Build the command-line tools" ON)
option (${PROJ_NAME}_BUILD_TESTS "Build the unit tests" ON)
set (OIIO_LIBNAME_SUFFIX "" CACHE STRING
@@ -139,6 +144,11 @@ if (${PROJ_NAME}_NAMESPACE_INCLUDE_PATCH)
endif ()
message(STATUS "Setting Namespace to: ${PROJ_NAMESPACE_V}")
set (OIIO_SITE "" CACHE STRING "Site name for customization")
if (OIIO_SITE)
add_definitions (-DOIIO_SITE_${OIIO_SITE})
endif ()
# Define OIIO_INTERNAL symbol only when building OIIO itself, will not be
# defined for downstream projects using OIIO.
add_definitions (-DOIIO_INTERNAL=1)
@@ -187,7 +197,6 @@ include_directories (
# Tell CMake to process the sub-directories
add_subdirectory (src/libutil)
find_or_download_robin_map ()
# Add IO plugin directories -- if we are embedding plugins, we need to visit
@@ -305,7 +314,7 @@ install (EXPORT OIIO_EXPORTED_TARGETS
NAMESPACE ${PROJECT_NAME}::)
if (PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
if (PROJECT_IS_TOP_LEVEL AND BUILD_TESTING AND ${PROJ_NAME}_BUILD_TESTS)
oiio_setup_test_data()
oiio_add_all_tests()
endif ()
+8 -7
View File
@@ -13,7 +13,7 @@ Contributing to OpenImageIO
>
Code contributions to OpenImageIO are always welcome, and [nearly 200
people](https://github.com/OpenImageIO/oiio/blob/master/CREDITS.md) have done
people](https://github.com/AcademySoftwareFoundation/OpenImageIO/blob/master/CREDITS.md) have done
so over the years. Please review this document to get a briefing on our
process.
@@ -51,7 +51,7 @@ Bug Reports and Issue Tracking
------------------------------
We use GitHub's issue tracking system for reporting bugs and requesting
enhancements: https://github.com/OpenImageIO/oiio/issues
enhancements: https://github.com/AcademySoftwareFoundation/OpenImageIO/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
@@ -87,13 +87,13 @@ 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.
* [Corporate CLA](https://github.com/OpenImageIO/oiio/blob/master/ASWF/CLA-corporate.md) :
* [Corporate CLA](https://github.com/AcademySoftwareFoundation/OpenImageIO/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.
* [Individual CLA](https://github.com/OpenImageIO/oiio/blob/master/ASWF/CLA-individual.md) :
* [Individual CLA](https://github.com/AcademySoftwareFoundation/OpenImageIO/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.
@@ -143,8 +143,9 @@ The best way to submit changes is via GitHub Pull Request. GitHub has a
All code must be formally reviewed before being merged into the official
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.
1. Get a GitHub account, fork AcademySoftwareFoundation/OpenImageIO to create
your own repository on GitHub, and then clone it to get a repository on your
local machine.
1. Edit, compile, and test your changes. Run clang-format (see the
instructions on coding style below).
@@ -190,7 +191,7 @@ 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
// https://github.com/AcademySoftwareFoundation/OpenImageIO
as a comment in the syntax of whatever source code is used in that file.
+26
View File
@@ -4,10 +4,12 @@ by first name.
If you know of somebody that I missed or have corrections, please email:
lg@openimageio.org
* Aaron Colwell
* Adam Mains
* Akihiro Yamasaki
* Alan Jones
* Alejandro Conty
* Alex Guirre
* Alex Hughes
* Alex Schworer
* Alexander Kuleshov
@@ -19,13 +21,18 @@ lg@openimageio.org
* Aman Shah
* Ananth Garre
* Anders Langlands
* Andy Chan
* AngryLoki
* Angus Davis
* Anthony Nemoff
* Anton Dukhovnikov
* Aras Pranckevičius
* Arkady Shapkin
* Aura Munoz
* Basileios Anastasatos
* Bastien Montagne
* Ben De Luca
* Benjamin Buch
* Bernhard Rosenkraenzer
* Biswapriyo Nath
* Blair Tennessy
@@ -35,22 +42,27 @@ lg@openimageio.org
* Brent Davis
* Brian Hall
* Brice Gros
* Calvin Schaul
* Carl Rand
* Cassian Andrei
* Chad Dombrova
* Chaitanya Sharma
* Changlin Hsieh
* Chris Crosetto
* Chris Foster
* Chris Hellmuth
* Chris Kulla
* Chris Whalen
* Christoph Willing
* Cliff Stein
* Clément Champetier
* D-Spirits
* Dalai Felinto
* Dan Wexler
* Daniel Dresser
* Daniel Flehner Heen
* Daniel Wyatt
* Danny Greenstein
* David Aguilar
* David Gordon
* Deepak Gopinath
@@ -58,11 +70,13 @@ lg@openimageio.org
* Dieter De Baets
* Dinko Galetik
* Dominik Bartkiewicz
* Dominik Wójt
* Duncan Chan
* Dustin Rodrigues
* Edgar Velazquez-Armendariz
* Eloi Du Bois
* Elvic Liang
* Emil Dohne
* Fabien Castan
* Fabien Servant
* Fredrik Averpil
@@ -84,11 +98,14 @@ lg@openimageio.org
* Ismael Cortes
* Jan Hettenkofer
* Jan Honsbrok
* Jason Baumeister
* Jens Lindgren
* Jep Hill
* Jeph Alapat
* Jeremy Retailleau
* Jeremy Rose
* Jeremy Selan
* Jesse Yurkovich
* Jim Hourihan
* Johannes Unterguggenberger
* John Burnett
@@ -101,6 +118,7 @@ lg@openimageio.org
* Julien Enche
* Justin Israel
* Justina Mikonyte
* Kaarrot
* Kazuki Takahashi
* Kevin Brightwell
* Kimball Thurston
@@ -110,6 +128,7 @@ lg@openimageio.org
* LazyDodo
* Leonid Onokhov
* Leszek Godlewski
* Loïc Vital
* Lucas Panian
* Lucille Caillaud
* Lukas Schrangl
@@ -141,6 +160,7 @@ lg@openimageio.org
* Nicholas Yue
* Nick Black
* Nicolas Burtnyk
* Nicolas Vivien
* Nixon Kwok
* Noah Rahm (designer of our logo!)
* Northon Patrick
@@ -154,6 +174,7 @@ lg@openimageio.org
* Paul Molodowitch
* Pavel Karneliuk
* Pete Larabell
* Peter Kovář
* Philip Nemec
* Pino Toscano
* Povilas Kanapickas
@@ -177,6 +198,7 @@ lg@openimageio.org
* SebTV
* Seifeddine Dridi
* Sergey Sharybin
* Sergio Rojas
* Shane Ambler
* Simon Boorer
* Solomon Boulos
@@ -191,14 +213,18 @@ lg@openimageio.org
* Tim Grant
* Tom Knowles
* Troy James Sobotka
* Vic P
* Vinod Khare
* Vishal Agrawal
* Vitor Franchi
* Vlad (Kuzmin) Erium
* Wayne Arnold
* Will Rosecrans
* William Krick
* Wormszer
* xiaoxiaoafeifei
* Xo Wang
* Yang Yang
* Yann Lanthony
* Ziggy Cross
* zomgrolf
+34 -35
View File
@@ -18,55 +18,57 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
* The default build mode is C++14. This can be controlled by via the
CMake configuration flag: `-DCMAKE_CXX_STANDARD=17`, etc.
* ADVISORY: We expect that OIIO 2.6 in 2024 will require C++17 or higher.
* Compilers: gcc 6.1 - 12.1, clang 3.4 - 16, MSVS 2017 - 2019,
* Compilers: gcc 6.1 - 14.1, clang 3.4 - 18, MSVS 2017 - 2019,
Intel icc 17+, Intel OneAPI C++ compiler 2022+.
* **CMake >= 3.15** (tested through 3.27)
* **CMake >= 3.15** (tested through 3.28)
* **OpenEXR/Imath >= 2.4** (recommended: 3.1 or higher; tested through 3.2
and main) (ADVISORY: We expect that OIIO 2.6 in 2024 will require OpenEXR >= 3.1)
* 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.81)
* **[fmtlib](https://github.com/fmtlib/fmt) >= 7.0** (tested through 10.1).
* libTIFF >= 3.9 (recommended: 4.0+; tested through 4.6)
* libjpeg >= 8 (tested through jpeg9e), or **libjpeg-turbo >= 2.1** (tested
through 3.0)
* Boost >= 1.53 (recommended: at least 1.66; tested through 1.85)
* **[fmtlib](https://github.com/fmtlib/fmt) >= 7.0** (tested through 10.2).
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):
* Qt5 >= 5.6 (tested through 5.15) or Qt6 (tested through 6.4)
* Qt5 >= 5.6 (tested through 5.15) or Qt6 (tested through 6.7)
* 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, 3.10, 3.11)
* pybind11 >= 2.4.2 (Tested through 2.11. Note that pybind11 v2.10+ does
* Python >= 2.7 (tested against 2.7, 3.7, 3.8, 3.9, 3.10, 3.12)
* pybind11 >= 2.4.2 (Tested through 2.12. Note that pybind11 v2.10+ does
not support Python < 3.6.)
* NumPy
* If you want support for camera "RAW" formats:
* LibRaw >= 0.18 (tested though 0.21.1; if
* LibRaw >= 0.18 (tested though 0.21.2; 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 6.0)
* ffmpeg >= 3.0 (tested through 7.0)
* If you want support for jpeg 2000 images:
* OpenJpeg >= 2.0 (tested through 2.5; we recommend 2.4 or higher
for multithreading support)
* If you want support for OpenVDB files:
* OpenVDB >= 5.0 (tested through 10.0)
* OpenVDB >= 5.0 (tested through 11.0). Note that using OpenVDB >= 10.0
requires that you compile OIIO with C++17 or higher.
* 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.9)
* 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.16)
* libheif >= 1.3 (1.7 required for AVIF support, 1.16 required for
correct orientation support, tested through 1.17.6)
* 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 DICOM medical image files:
* DCMTK >= 3.6.1 (tested through 3.6.7)
* DCMTK >= 3.6.1 (tested through 3.6.8)
* If you want support for WebP images:
* WebP >= 0.6.1 (tested through 1.3.1)
* WebP >= 0.6.1 (tested through 1.4)
* If you want support for OpenColorIO color transformations:
* OpenColorIO >= 1.1 (tested through 2.3; 2.0+ is recommended)
* If you want support for Ptex:
@@ -77,7 +79,7 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
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.13).
Any PugiXML >= 1.8 should be fine (we have tested through 1.14).
@@ -325,7 +327,7 @@ Now get the OIIO source and do one-time CMake configuration step. Replace `{*_RO
dependencies.
```
cd {OIIO_ROOT}
git clone https://github.com/OpenImageIO/oiio .
git clone https://github.com/AcademySoftwareFoundation/OpenImageIO .
cmake -S . -B build -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 ^
@@ -367,24 +369,21 @@ produce a dynamic-linked version.
Test Images
-----------
We have yet another project containing a set of sample images for testing
OpenImageIO. We split test images into a separate project in order to make
the main source code tree smaller and simpler for people who don't need the
test suite.
There are several projects containing sets of sample images for testing
OpenImageIO.
git clone https://github.com/OpenImageIO/oiio-images.git
They are kept separate in order to make the main source code
tree smaller and simpler for people who don't need the test suite.
Additionally, some of these packages are maintained outside the OpenImageIO
project by their respective organizations.
Also, there are collections of images for some of the file formats we
support, and make test expects them to also be present. To run full tests,
you will need to download and unpack the test image collections from:
* http://www.simplesystems.org/libtiff/images.html
* http://www.openexr.com/downloads.html
* http://www.itu.int/net/ITU-T/sigdb/speimage/ImageForm-s.aspx?val=10100803
* http://www.cv.nrao.edu/fits/data/tests/
These images should be placed in a sibling directory to the OpenImageIO
repository named oiio-testimages.
| Download | Directory Placement | Notes |
| --- | --- | --- |
| git clone https://github.com/AcademySoftwareFoundation/OpenImageIO-images.git | `<path>/../oiio-images` | CMake will download if not present |
| git clone https://github.com/AcademySoftwareFoundation/openexr-images.git | `<path>/../openexr-images` | CMake will download if not present |
| http://www.cv.nrao.edu/fits/data/tests/ | `<path>/../fits-images` | Manual download required |
| https://www.itu.int/net/ITU-T/sigdb/speimage/ImageForm-s.aspx?val=10100803 | `<path>/../j2kp4files_v1_5` | Manual download required |
Where `<path>` is the location of the main `OpenImageIO` repository.
You do not need any of these packages in order to build or use
OpenImageIO. But if you are going to contribute to OpenImageIO
+3 -3
View File
@@ -9,8 +9,8 @@
# Run 'make help' to list helpful targets.
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
#########################################################################
@@ -45,7 +45,7 @@ INSTALL_PREFIX ?= ${working_dir}/${dist_dir}
VERBOSE ?= ${SHOWCOMMANDS}
ifneq (${VERBOSE},)
MY_MAKE_FLAGS += VERBOSE=${VERBOSE}
MY_CMAKE_FLAGS += -DVERBOSE:BOOL=${VERBOSE}
MY_CMAKE_FLAGS += -DVERBOSE:BOOL=${VERBOSE} --log-level=VERBOSE
ifneq (${VERBOSE},0)
MY_NINJA_FLAGS += -v
TEST_FLAGS += -V
+69 -63
View File
@@ -1,9 +1,11 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the OpenImageIO Project. -->
<p align="center">
<img src="ASWF/logos/openimageio-horizontal-gradient.png">
</p>
[![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)
[![License](https://img.shields.io/badge/license-Apache2.0-blue.svg?style=flat-square)](https://github.com/AcademySoftwareFoundation/OpenImageIO/blob/master/LICENSE.md)
[![CI](https://github.com/AcademySoftwareFoundation/OpenImageIO/actions/workflows/ci.yml/badge.svg)](https://github.com/AcademySoftwareFoundation/OpenImageIO/actions/workflows/ci.yml)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2694/badge)](https://bestpractices.coreinfrastructure.org/projects/2694)
[![latest packaged version(s)](https://repology.org/badge/latest-versions/openimageio.svg)](https://repology.org/project/openimageio/versions)
@@ -11,6 +13,11 @@
Introduction
------------
**Mission statement**: OpenImageIO is a toolset for reading, writing, and
manipulating 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 feature film production.
The primary target audience for OIIO is VFX studios and developers of
tools such as renderers, compositors, viewers, and other image-related
software you'd find in a production pipeline.
@@ -64,92 +71,91 @@ OpenImageIO consists of:
Licensing
---------
🏢 Project administration and Licensing
---------------------------------------
OpenImageIO is (c) Copyright Contributors to the OpenImageIO project.
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.
For original code, we use the [Apache-2.0 license](LICENSE.md), and for
documentation, the [Creative Commons Attribution 4.0 Unported
License](http://creativecommons.org/licenses/by/4.0/). In 2023 we asked
historical users to [relicense](RELICENSING.md) from the original BSD-3-clause
license to Apache-2.0, and over 99.75% of lines of code have been relicensed
to Apache-2.0. A small amount of code incorporated into this repository from
other projects are covered by compatible [third-party open source
licenses](THIRD-PARTY.md).
The plain English bottom line is that OpenImageIO is free, as well as
freely modifiable and redistributable (in both source and binary form).
You may use part or all of it in your own applications, whether
proprietary or open, free or commercial. Using it in a commercial or
proprietary application DOES NOT obligate you to pay us, or to use any
particular licensing terms in your own application.
Some code and resources are distributed along with OIIO that have highly
compatible, though slightly different, licenses (generally MIT or Apache).
See the PDF documentation Acknowledgements section, and the
[THIRD-PARTY](THIRD-PARTY.md) file for details.
The OpenImageIO project is part of the [Academy Software
Foundation](https://www.aswf.io/), a part of the Linux Foundation formed in
collaboration with the Academy of Motion Picture Arts and Sciences. The
[Technical Charter](aswf/Technical-Charter.md) and [Project
Governance](GOVERNANCE.md) explain how the project is run, who makes
decisions, etc. Please be aware of our [Code of Conduct](CODE_OF_CONDUCT.md).
Building and Installation
-------------------------
💁 User Documentation
---------------------
Please read the [INSTALL.md](INSTALL.md) file for detailed instructions on
how to build and install OpenImageIO.
If you build with `EMBEDPLUGINS=0`, remember that you need to set the
environment variable `OIIO_LIBRARY_PATH` to point to the 'lib' directory
where OpenImageIO is installed, or else it will not be able to find the
plugins.
[OpenImageIO Documentation on ReadTheDocs](https://openimageio.readthedocs.io/)
is the best place to start if you are interested in how to use OpenImageIO,
its APIs, its component programs (once they are built). There is also a [PDF
version](https://readthedocs.org/projects/openimageio/downloads/pdf/latest/).
Documentation
-------------
The primary user and programmer documentation can be found
on [openimageio.readthedocs.io](https://openimageio.readthedocs.io/en/latest/)
as html or as [PDF](https://readthedocs.org/projects/openimageio/downloads/pdf/latest/).
👷 Building and installing OpenImageIO
--------------------------------------
- [Build and installation instructions](INSTALL.md) for OpenImageIO. Such
as it is. This could use some work, particularly for Windows.
Contact & reporting problems
----------------------------
🚑 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](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").
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"). For quick questions, you could also try the [ASWF
Slack](https://slack.aswf.io) `#openimageio` channel.
Bugs, build problems, and discovered vulnerabilities that you are relatively
certain is a legit problem in the code, and for which you can give clear
instructions for how to reproduce, should be [reported as
issues](https://github.com/OpenImageIO/oiio/issues).
certain is a legit problem in the code, and **for which you can give clear
instructions for how to reproduce**, should be [reported as
issues](https://github.com/AcademySoftwareFoundation/OpenImageIO/issues).
If confidentiality precludes a public question or issue, you may contact us
privately at [info@openimageio.org](info@openimageio.org), or for
security-related issues [security@openimageio.org](security@openimageio.org).
Contributing
------------
🔧 Contributing and developer documentation
-------------------------------------------
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.
pull request (PR) mechanism.
* [CONTRIBUTING](CONTRIBUTING.md) has detailed instructions about the
development process.
* [ROADMAP](docs/ROADMAP.md) is a high-level overview of the current
development priorities for the next annual release, expected in September,
2024.
* [RELEASING](RELEASING.md) explains our policies and procedures for making
releases. We have a major, possibly-compatibility-breaking, release annually
in September/October, and minor bug fix and safe feature addition release at
the beginning of every month.
* [Building the docs](src/doc/Building_the_docs.md) has instructions for
building the documentation locally, which may be helpful if you are editing
the documentation in nontrivial ways and want to preview the appearance.
Web Resources
-------------
☎️ Communications channels and additional resources
--------------------------------------------------
* Main web page: http://www.openimageio.org
* GitHub page: http://github.com/OpenImageIO/oiio
* Developer mail list subscriptions and archives:
https://lists.aswf.io/g/oiio-dev
* ASWF Slack: https://slack.aswf.io
(look for the `#openimageio` channel)
* 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)
* [Main web page](http://www.openimageio.org)
* [GitHub project page](http://github.com/AcademySoftwareFoundation/OpenImageIO)
* [Developer mail list](https://lists.aswf.io/g/oiio-dev)
* [ASWF Slack](https://slack.aswf.io) (look for the `#openimageio` channel)
* Biweekly Technical Steering Committee (TSC) Zoom 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)
+20 -17
View File
@@ -170,14 +170,17 @@ have a heading added at the top for the *next* version.
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,
- [README.md](README.md): Actually read it! Make sure it all seems
accurate and up to date.
- [INSTALL.md](INSTALL.md): Be sure that it accurately reflects the
current minimum and latest-tested versions of each dependency.
- [CREDITS.md](CREDITS.md): Check against the recent repo history to be
sure new contributors are listed.
- [SECURITY.md](SECURITY.md): Make sure it accurately reflects the
status of which branches get updates.
- Skim the [user documentation](https://openimageio.readthedocs.io/) to
ensure it's building correctly and doesn't have 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:
@@ -189,9 +192,9 @@ have a heading added at the top for the *next* version.
- The `${PROJECT_NAME}_SUPPORTED_RELEASE` variable should be `ON` for any
release branch, `OFF` for master.
5. In the https://github.com/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
5. In the https://github.com/AcademySoftwareFoundation/OpenImageIO-images project, create a branch
`dev-x.y` for the major/minor branch, and in the main oiio repo, update
src/build-scripts/install_test_images.bash to specify `-b dev-x.y` in the
checkout of oiio-images to ensure CI tests are against the set of test
images corresponding to that major/minor release (just in the branch, not
in master!).
@@ -250,9 +253,9 @@ The following are the steps for making the release:
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.)
GitHub `AcademySoftwareFoundation/OpenImageIO` repo.)
7. Draft a release on GitHub: On https://github.com/OpenImageIO/oiio/releases
7. Draft a release on GitHub: On https://github.com/AcademySoftwareFoundation/OpenImageIO/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
@@ -337,11 +340,11 @@ 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.
- Go to [readthedocs.org](https://openimageio.readthedocs.io/), and ensure
that the new release is built, 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
+18
View File
@@ -119,6 +119,24 @@ the Developer Certificate of Origin, version 1.1:
- johnfea
- Max Liani (maxliani)
- Michael Görner (v4hn)
- Philip Nemec (p-nemec)
- Google
- Nandan Dubey (ndubey)
- NVIDIA
- Jonathan Hearn (splidje)
- Michael Root
- Ott Tinn
- Lukas Shrangl (luhk)
- Manuel Gamito (mgamito)
- Rémi Achard (remia)
- Joseph Goldstone (JGoldstone)
- Matthew Levine (melevine)
- Yang Yang (yangyangl, but now cometyang)
- Merwan Achibet (merwaaan)
- Anthony Nemoff (ix-anemoff)
- Damien Courtois (ix-dcourtois)
- Carl Rand (crand)
- Gregor Mückl (gmueckl)
**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
+30 -3
View File
@@ -8,9 +8,9 @@ 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. |
| 2.5.x | :white_check_mark: All fixes that can be backported without breaking ABI compatibility. New tagged releases monthly. |
| 2.4.x | :warning: Only receives occasional critical fixes, upon request, only if they can be easily backported. |
| <= 2.3.x | :x: No longer receiving patches of any kind. |
## Reporting a Vulnerability
@@ -23,3 +23,30 @@ respond to vulnerability reports within 14 days.
Our policy is to address critical security vulnerabilities rapidly and post
patches as quickly as possible.
## Outstanding Security Issues
None known
## History of CVE Fixes
Most recent fixes listed first, more or less
- CVE-2023-42295: Fix signed integer overflow when computing total number of pixels while reading BMP files. [#3948](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3948) (by xiaoxiaoafeifei) (Fixed in 2.5.3.0/2.6.0.1)
- CVE-2023-36183: Heap-buffer-overflow while reading ICO files [#3872](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3872) (by xiaoxiaoafeifei)
- TALOS-2023-1709 / CVE-2023-24472: Race condition in TIFF reader. [#3772](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3772) (2.5.1.0/2.4.8.1)
- TALOS-2023-1707 / CVE-2023-24473, TALOS-2023-1708 / CVE-2023-22845: Guard against corrupted Targa. [#3768](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3768) (2.5.1.0/2.4.8.1)
- TALOS-2022-1654 / CVE-2022-43596, TALOS-2022-1655 / CVE-2022-43597 CVE-2022-43598, TALOS-2022-1656 / CVE-2022-43599 CVE-2022-43600 CVE-2022-43601 CVE-2022-43602: Fix possible IFF write errors [#6876](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3676) (2.4.6/2.5.0.0)
- TALOS-2022-1653 / CVE-2022-43594: Fix possible errors when writing BMP files. [#3673](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3673) (by lgritz) (2.4.6/2.5.0.0)
- TALOS-2022-1651 / CVE-2022-43592, TALOS-2022-1652 / CVE-2022-4359: Fix possible DPX write errors. [#3672](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3672) (2.4.6/2.5.0.0)
- TALOS-2022-1657 / CVE-2022-43603: Zfile write safety. [#3670](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3670) (2.4.6/2.5.0.0)
- TALOS-2022-1633 / CVE-2022-41639, TALOS-2022-1643 / CVE-2022-41988: Guard TIFF against buffer overflow for certain CMYK files. [#3632](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3632) (2.4.5/2.5.0.0)
- TALOS-2022-1626, CVE-2022-41794: PSD files protect against corrupted embedded thumbnails. [#3629](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3629) (2.4.5/2.5.0.0)
- TALOS-2022-1627, CVE-2022-41977: Guard TIFF reads against corrupt files with buffer overflows. [#3628](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3628) (2.4.5/2.5.0.0)
- TALOS-2022-1626 / CVE-2022-41794, TALOS-2022-1632 / CVE-2022-41684, TALOS-2022-1636 / CVE-2022-41837: Exif (all formats that support it, TIFF/JPEG/PSD) fix bugs where corrupted Exif blocks could overrun memory. [#3627](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3627) (2.4.5/2.5.0.0)
- TALOS-2022-1634 / CVE-2022-41838, TALOS-2022-1635 / CVE-2022-41999: Fix DDS reading crashes for cubemap files when a cube face was not present, and check for invalid bits per pixel. [#3625](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3625) (2.4.5/2.5.0.0) #3625 (2.4.5/2.5.0.0)
- TALOS-2022-1629, CVE-2022-36354: RLA potential buffer overrun. [#3624](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3624) (2.4.5/2.5.0.0)
- TALOS-2022-1628, CVE-2022-41981: Targa file string overflow safety. [#3622](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3622) (2.4.5/2.5.0.0)
- TALOS-2022-1630, CVE-2022-38143: Protect against corrupt pixel coordinates while reading BMP files. [#3620](https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/3620) (by lgritz) (Fixed in 2.4.5/2.5.0.0)
+102
View File
@@ -0,0 +1,102 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the OpenImageIO Project. -->
# OpenImageIO Roadmap
This describes the major tasks we hope to accomplish on the road to
OpenImageIO 3.0, which should be released circa September 2024. Where there
are links to issue, please read the issue for more extensive description and
discussion about the modifications required.
OpenImageIO is fairly mature and one could argue that its being used
extensively in production for 15 years puts an empirical limit on the
criticality of any "missing" feature. So while we welcome new features, those
that don't break old APIs can be added in any release, so there are no "must
have features" that are required to be completed for this release.
However, 2.x -> 3.0 is one of the rare opportunities for things that might
break backward compatibility, i.e., that might require actual source code
changes to software that calls OIIO. Since this happens only every 5 years or
so, this means that for many such changes (including removing previously
deprecated API calls), it is a matter of doing in now or waiting several
years.
## Dependency modernization ([project](https://github.com/orgs/AcademySoftwareFoundation/projects/28))
We would like to pull forward a whole lot of other dependencies so that their
minimums are somewhere in the "released 3-5 years ago" range. The full list of
our dependencies [can be found
here](https://github.com/AcademySoftwareFoundation/OpenImageIO/discussions/4151).
See the [Dependency proposal wiki page](https://github.com/AcademySoftwareFoundation/OpenImageIO/discussions/4151)
* [ ] Big required upgrades with potentially widespread impact on the code base
- [ ] C++17 [#4155](https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/4155)
- [ ] Python 3.7 [#4157](https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/4157)
- [ ] OpenEXR/Imath 3.1 [#4156](https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/4156)
* [ ] Miscellaneous optional upgrades whose changes will be very localized
This isn't a complete list, nor do we need to do all of these, but the
highest priorities are:
- [ ] CMake 3.18 (from 3.15). Or possibly newer if there's a good reason? (3.19 or 3.20 are also reasonable.)
- [ ] OpenColorIO 2.0, or possibly 2.1 (from 1.1). Open for debate: should it be a required dependency rather than optional?
- [ ] fmt 8.0 (from 7.0), which has many improvements.
- [ ] GIFlib 5.0 (from 4.0), which adds thread safety.
- [ ] libheif 1.11 (from 1.3), which supports many additional features of that format.
- [ ] WebP 1.2 (from 0.6) which lets us use their exported CMake configs and retire FindWebP.cmake.
- [ ] pybind11 2.6 or 2.7 (from 2.4).
- [ ] [#4156](https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/4156) Eliminate the last few places where we use Boost and eliminate it as a dependency.
<br>
## API Modernization
- [ ] [#4159](https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/4159) Using span and string_view instead of raw pointers
Scrub the APIs to find where we have API calls that take a pointer and size
(or worse -- just a pointer and an assumption about the size), and instead
use `span<T>` / `cspan<T>` for things that are like arrays, and
`string_view` for things that are like strings.
- [ ] [#4160](https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/4160)
Using named keyword/value lists more extensively in imagebufalgo.h
- [ ] Deprecate as much as possible of the old printf-style string formatting we use internally, instead using the fmt/std::format style everywhere. This includes changing Strutil::format to alias to Strutil::fmt::format (currently it aliases to Strutil::old::format, which uses printf style).
- [ ] Remove deprecated API elements
Hunt for things marked DEPRECATED and try to get rid of them where possible.
If we can't remove them, at least make sure they are marked as
`OIIO_DEPRECATED` (or `[[deprecated]]` in modern C++).
## The rest
Other initiatives we hope to have completed by the time of this next
major release:
- [ ] [#4164](https://github.com/AcademySoftwareFoundation/OpenImageIO/issues/4164) Better color management
Regardless of OCIO availability, version, or contents of any configs, have universal support for the [canonical color spaces](https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/documents/Specification/MaterialX.Specification.md#color-spaces-and-color-management-systems) that seem to be the common consensus of ACES, MaterialX, and USD.
- [ ] Preliminary Rust bindings for most of the OpenImageIO APIs.
- [ ] Python wheel construction so `pip install openimageio` will be an easy way
for users to install the whole banana.
If there is something you think should be on the roadmap for the next major
release but is not, please open an issue or discussion to propose it, or
bring it up at a TSC meeting, or on the mail list or Slack channel.
## Parking
Here is where we will put things that definitely should be on the roadmap, but
that need not be completed in time for the fall 2024 release of OIIO 3.0.
...
+11 -5
View File
@@ -1,13 +1,19 @@
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the OpenImageIO Project.
sonar.host.url=https://sonarcloud.io
# Required metadata
sonar.organization=openimageio
sonar.organization=academysoftwarefoundation
sonar.projectName=OpenImageIO
sonar.projectVersion=1.0
sonar.projectKey=OpenImageIO_oiio
sonar.projectVersion=2.6
sonar.projectKey=AcademySoftwareFoundation_OpenImageIO
# Project links
sonar.links.homepage=https://github.com/AcademySoftwareFoundation/OpenImageIO
sonar.links.ci=https://github.com/AcademySoftwareFoundation/OpenImageIO/actions
sonar.links.scm=https://github.com/AcademySoftwareFoundation/OpenImageIO
sonar.links.issue=https://github.com/AcademySoftwareFoundation/OpenImageIO/issues
# Source properties
sonar.sources=src
@@ -15,7 +21,7 @@ sonar.exclusions=src/doc/**,src/include/OpenImageIO/detail/pugixml/**,src/libuti
sonar.sourceEncoding=UTF-8
# C/C++ analyzer properties
sonar.cfamily.build-wrapper-output=build/bw_output
sonar.cfamily.build-wrapper-output=/__w/OpenImageIO/OpenImageIO/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
+1 -1
View File
@@ -1,5 +1,5 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
add_oiio_plugin (bmpinput.cpp bmpoutput.cpp bmp_pvt.cpp)
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
// https://github.com/AcademySoftwareFoundation/OpenImageIO
#include <OpenImageIO/filesystem.h>
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
// https://github.com/AcademySoftwareFoundation/OpenImageIO
#pragma once
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
// https://github.com/AcademySoftwareFoundation/OpenImageIO
#include <cstdio>
@@ -313,7 +313,7 @@ BmpInput::read_rle_image()
}
if (y >= m_spec.height) { // out of y bounds
errorfmt(
"BMP might be corrupted, it is referencing an out-of-bounds pixel coordinte ({},{})",
"BMP might be corrupted, it is referencing an out-of-bounds pixel coordinate ({},{})",
x, y);
ok = false;
break;
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
// https://github.com/OpenImageIO/oiio
// https://github.com/AcademySoftwareFoundation/OpenImageIO
#include <cstdio>
+1 -1
View File
@@ -4,7 +4,7 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
+1 -1
View File
@@ -4,7 +4,7 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# Utility script to download and build abi checking tools
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
# Where to install the final results
: ${LOCAL_DEPS_DIR:=${PWD}/ext}
: ${ABITOOLS_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
mkdir -p ${LOCAL_DEPS_DIR}
pushd ${LOCAL_DEPS_DIR}
git clone https://github.com/lvc/vtable-dumper
pushd vtable-dumper ; make install prefix=${ABITOOLS_INSTALL_DIR} ; popd
git clone https://github.com/lvc/abi-dumper
pushd abi-dumper ; make install prefix=${ABITOOLS_INSTALL_DIR} ; popd
git clone https://github.com/lvc/abi-compliance-checker
pushd abi-compliance-checker ; make install prefix=${ABITOOLS_INSTALL_DIR} ; popd
popd
# ls -R ${LOCAL_DEPS_DIR}
export PATH=${PATH}:${ABITOOLS_INSTALL_DIR}/bin
+1 -1
View File
@@ -4,7 +4,7 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
+1 -1
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Utility script to download and build giflib
+6 -4
View File
@@ -4,21 +4,22 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of libjpeg-turbo to download if we don't have it yet
LIBJPEGTURBO_REPO=${LIBJPEGTURBO_REPO:=https://github.com/libjpeg-turbo/libjpeg-turbo.git}
LIBJPEGTURBO_VERSION=${LIBJPEGTURBO_VERSION:=2.0.5}
LIBJPEGTURBO_VERSION=${LIBJPEGTURBO_VERSION:=3.0.0}
# Where to put libjpeg-turbo repo source (default to the ext area)
LIBJPEGTURBO_SRC_DIR=${LIBJPEGTURBO_SRC_DIR:=${PWD}/ext/libjpeg-turbo}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
LIBJPEGTURBO_SRC_DIR=${LIBJPEGTURBO_SRC_DIR:=${LOCAL_DEPS_DIR}/libjpeg-turbo}
# Temp build area (default to a build/ subdir under source)
LIBJPEGTURBO_BUILD_DIR=${LIBJPEGTURBO_BUILD_DIR:=${LIBJPEGTURBO_SRC_DIR}/build}
# Install area for libjpeg-turbo (default to ext/dist)
LIBJPEGTURBO_INSTALL_DIR=${LIBJPEGTURBO_INSTALL_DIR:=${PWD}/ext/dist}
LIBJPEGTURBO_INSTALL_DIR=${LIBJPEGTURBO_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
#LIBJPEGTURBO_CONFIG_OPTS=${LIBJPEGTURBO_CONFIG_OPTS:=}
pwd
@@ -50,4 +51,5 @@ popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export JPEGTurbo_ROOT=$LIBJPEGTURBO_INSTALL_DIR
export libjpegturbo_ROOT=$LIBJPEGTURBO_INSTALL_DIR
+1 -1
View File
@@ -4,7 +4,7 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
+1 -1
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Utility script to download and build LibRaw
+1 -1
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Utility script to download and build libtiff
+3 -2
View File
@@ -4,7 +4,7 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
@@ -23,10 +23,11 @@ if [[ `uname` == "Linux" ]] ; then
ls -l $LLVMTAR
tar xf $LLVMTAR
rm -f $LLVMTAR
echo "Installed ${LLVM_VERSION} in ${LLVM_INSTALL_DIR}"
echo "Installed LLVM ${LLVM_VERSION} in ${LLVM_INSTALL_DIR}"
mkdir -p $LLVM_INSTALL_DIR && true
mv clang+llvm*/* $LLVM_INSTALL_DIR
export LLVM_DIRECTORY=$LLVM_INSTALL_DIR
export PATH=${LLVM_INSTALL_DIR}/bin:$PATH
export LLVM_ROOT=${LLVM_INSTALL_DIR}
# ls -a $LLVM_DIRECTORY
fi
+6 -3
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
@@ -14,8 +14,11 @@ NINJA_VERSION=${NINJA_VERSION:=1.10.2}
NINJA_BRANCH=${NINJA_BRANCH:=v${NINJA_VERSION}}
NINJA_INSTALL_DIR=${NINJA_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist/bin}
if [ ! -f $DOWNLOADS_DIR/ninja-${NINJA_VERSION}.zip ]; then
curl --location ${NINJA_REPO}/archive/${NINJA_BRANCH}.tar.gz -o $DOWNLOADS_DIR/ninja-${NINJA_BRANCH}.tar.gz
mkdir -p "$DOWNLOADS_DIR"
# Check if the tar exist, download it if not
if [ ! -f $DOWNLOADS_DIR/ninja-v${NINJA_VERSION}.tar.gz ]; then
curl --location ${NINJA_REPO}/archive/refs/tags/${NINJA_BRANCH}.tar.gz -o $DOWNLOADS_DIR/ninja-${NINJA_BRANCH}.tar.gz
fi
tar xf $DOWNLOADS_DIR/ninja-${NINJA_BRANCH}.tar.gz
+1 -1
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Utility script to download and build OpenColorIO
+2 -3
View File
@@ -3,8 +3,8 @@
# 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
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
@@ -28,7 +28,6 @@ echo "Building OpenEXR ${OPENEXR_VERSION}"
echo "OpenEXR build dir will be: ${OPENEXR_BUILD_DIR}"
echo "OpenEXR install dir will be: ${OPENEXR_INSTALL_DIR}"
echo "OpenEXR Build type is ${OPENEXR_BUILD_TYPE}"
echo "CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}"
# Clone OpenEXR project (including IlmBase) from GitHub and build
if [[ ! -e ${OPENEXR_SOURCE_DIR} ]] ; then
+1 -1
View File
@@ -4,7 +4,7 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
+1 -1
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Utility script to download and build pybind11
+1 -1
View File
@@ -4,7 +4,7 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
+1 -1
View File
@@ -4,7 +4,7 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Exit the whole script if any command fails.
set -ex
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Important: set -ex causes this whole script to terminate with error if
# any command in it fails. This is crucial for CI tests.
set -e
# Arguments to this script are:
# BUILDDIR_NEW BUILDDIR_OLD LIBRARIES...
BUILDDIR_NEW=$1
shift
BUILDDIR_OLD=$1
shift
LIBS=$*
#
# First, create ABI dumps from both builds
#
ABI_ARGS="-bin-only -skip-cxx -public-headers $PWD/dist/include/OpenImageIO "
echo "ABI_CHECK: PWD=${PWD} "
ls -l $BUILDDIR_NEW
ls -l $BUILDDIR_OLD
for dir in $BUILDDIR_NEW $BUILDDIR_OLD ; do
for lib in $LIBS ; do
abi-dumper $ABI_ARGS ${dir}/lib/${lib}.so -o ${dir}/abi-${lib}.dump
done
done
echo "Saved ABI dumps"
#
# Run the ABI compliance checker, saving the outputs to files
#
for lib in $LIBS ; do
abi-compliance-checker -l $lib -old $BUILDDIR_OLD/abi-$lib.dump -new $BUILDDIR_NEW/abi-$lib.dump | tee ${lib}-abi-results.txt || true
echo -e "\x1b[33;1m"
echo -e "$lib"
fgrep "Binary compatibility:" ${lib}-abi-results.txt
echo -e "\x1b[33;0m"
done
#
# If the "Binary compatibility" summary results say anything other than 100%,
# we fail!
#
for lib in $LIBS ; do
if [[ `fgrep "Binary compatibility:" ${lib}-abi-results.txt | grep -v 100\%` != "" ]] ; then
cp -r compat_reports ${BUILDDIR_NEW}/compat_reports
exit 1
fi
done
+14 -5
View File
@@ -2,13 +2,16 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# 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"
export OIIO_SRC_DIR=${OIIO_SRC_DIR:=$PWD}
export OIIO_BUILD_DIR=${OIIO_BUILD_DIR:=${OIIO_SRC_DIR}/build}
export OIIO_INSTALL_DIR=${OIIO_INSTALL_DIR:=${OIIO_SRC_DIR}/dist}
if [[ "$USE_SIMD" != "" ]] ; then
OIIO_CMAKE_FLAGS="$OIIO_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"
@@ -27,7 +30,8 @@ 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
cmake -S . -B build -G "$CMAKE_GENERATOR" \
# pushd $OIIO_BUILD_DIR
cmake -S $OIIO_SRC_DIR -B $OIIO_BUILD_DIR -G "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX="$OpenImageIO_ROOT" \
@@ -39,14 +43,18 @@ cmake -S . -B build -G "$CMAKE_GENERATOR" \
$OIIO_CMAKE_FLAGS -DVERBOSE=1
# Save a copy of the generated files for debugging broken CI builds.
mkdir build/cmake-save || /bin/true
cp -r build/CMake* build/*.cmake build/cmake-save
mkdir ${OIIO_BUILD_DIR}/cmake-save || /bin/true
cp -r ${OIIO_BUILD_DIR}/CMake* ${OIIO_BUILD_DIR}/*.cmake ${OIIO_BUILD_DIR}/cmake-save
: ${BUILDTARGET:=install}
if [[ "$BUILDTARGET" != "none" ]] ; then
echo "Parallel build ${CMAKE_BUILD_PARALLEL_LEVEL} of target ${BUILDTARGET}"
time ${OIIO_CMAKE_BUILD_WRAPPER} cmake --build build --target ${BUILDTARGET} --config ${CMAKE_BUILD_TYPE}
if [[ ${OIIO_CMAKE_BUILD_WRAPPER} != "" ]] ; then
echo "Using build wrapper '${OIIO_CMAKE_BUILD_WRAPPER}'"
fi
time ${OIIO_CMAKE_BUILD_WRAPPER} cmake --build ${OIIO_BUILD_DIR} --target ${BUILDTARGET} --config ${CMAKE_BUILD_TYPE}
fi
# popd
if [[ "${DEBUG_CI:=0}" != "0" ]] ; then
echo "PATH=$PATH"
@@ -57,6 +65,7 @@ if [[ "${DEBUG_CI:=0}" != "0" ]] ; then
fi
if [[ "$BUILDTARGET" == clang-format ]] ; then
echo "Running " `which clang-format` " version " `clang-format --version`
git diff --color
THEDIFF=`git diff`
if [[ "$THEDIFF" != "" ]] ; then
+6 -1
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Run code coverage analysis
# This assumes that the build occurred with CODECOV=1 and tests have already
@@ -25,4 +25,9 @@ for g in $(find ../build -name "*.gcno" -type f); do
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
# Remove pointless .gcov files so we don't analyze them
rm -f "*opt*include*"
rm -f "*usr*local*"
popd
+27 -6
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# This script is run when CI system first starts up.
# Since it sets many env variables needed by the caller, it should be run
@@ -39,11 +39,6 @@ export CMAKE_GENERATOR=${CMAKE_GENERATOR:=Ninja}
export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release}
export CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD:=11}
export PARALLEL=${PARALLEL:=4}
export PAR_MAKEFLAGS=-j${PARALLEL}
export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:=${PARALLEL}}
export CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL:=${PARALLEL}}
export LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=$HOME/ext}
export PATH=${LOCAL_DEPS_DIR}/dist/bin:$PATH
export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$LD_LIBRARY_PATH
@@ -53,6 +48,30 @@ export DYLD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$DYLD_LIBRARY_PATH
# export OCIO="$PWD/testsuite/common/OpenColorIO/nuke-default/config.ocio"
export TESTSUITE_CLEANUP_ON_SUCCESS=${TESTSUITE_CLEANUP_ON_SUCCESS:=1}
# Sonar
export BUILD_WRAPPER_OUT_DIR="${PWD}/bw_output"
export BW_OUTPUT_DIR="${PWD}/bw_output"
# Parallel builds
if [[ `uname -s` == "Linux" ]] ; then
echo "procs: " `nproc`
head -40 /proc/cpuinfo
export PARALLEL=${PARALLEL:=$((2 + `nproc`))}
elif [[ "${RUNNER_OS}" == "macOS" ]] ; then
echo "procs: " `sysctl -n hw.ncpu`
sysctl machdep.cpu.features
export PARALLEL=${PARALLEL:=$((2 + `sysctl -n hw.ncpu`))}
elif [[ "${RUNNER_OS}" == "Windows" ]] ; then
# Presumably Windows
export PARALLEL=${PARALLEL:=$((2 + ${NUMBER_OF_PROCESSORS}))}
else
export PARALLEL=${PARALLEL:=6}
fi
export PAR_MAKEFLAGS=-j${PARALLEL}
export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:=${PARALLEL}}
export CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL:=${PARALLEL}}
mkdir -p build dist
echo "HOME = $HOME"
@@ -67,8 +86,10 @@ ls
env | sort
if [[ `uname -s` == "Linux" ]] ; then
echo "nprocs: " `nproc`
head -40 /proc/cpuinfo
elif [[ "${RUNNER_OS}" == "macOS" ]] ; then
echo "nprocs: " `sysctl -n hw.ncpu`
sysctl machdep.cpu.features
fi
+1 -1
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Important: set -ex causes this whole script to terminate with error if
# any command in it fails. This is crucial for CI tests.
+38 -19
View File
@@ -3,7 +3,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
set -ex
@@ -18,8 +18,12 @@ if [[ "$ASWF_ORG" != "" ]] ; then
#ls /etc/yum.repos.d
sudo yum install -y giflib giflib-devel && true
sudo yum install -y opencv opencv-devel && true
sudo yum install -y ffmpeg ffmpeg-devel && true
if [[ "${USE_OPENCV}" != "0" ]] ; then
sudo yum install -y opencv opencv-devel && true
fi
if [[ "${USE_FFMPEG}" != "0" ]] ; then
sudo yum install -y ffmpeg ffmpeg-devel && true
fi
if [[ "${EXTRA_DEP_PACKAGES}" != "" ]] ; then
time sudo yum install -y ${EXTRA_DEP_PACKAGES}
fi
@@ -65,21 +69,25 @@ if [[ "$ASWF_ORG" != "" ]] ; then
else
# Using native Ubuntu runner
time sudo apt-get update
if [[ "${SKIP_APT_GET_UPDATE}" != "1" ]] ; then
time sudo apt-get update
fi
time sudo apt-get -q install -y \
git cmake ninja-build ccache g++ \
libboost-dev libboost-thread-dev libboost-filesystem-dev \
libilmbase-dev libopenexr-dev \
libtbb-dev \
libtiff-dev libgif-dev libpng-dev libraw-dev libwebp-dev \
libavcodec-dev libavformat-dev libswscale-dev libavutil-dev \
dcmtk libopenvdb-dev \
libfreetype6-dev \
locales wget \
libopencolorio-dev \
libopencv-dev \
libhdf5-dev
libtiff-dev libgif-dev libpng-dev
if [[ "${SKIP_SYSTEM_DEPS_INSTALL}" != "1" ]] ; then
time sudo apt-get -q install -y \
libraw-dev libwebp-dev \
libavcodec-dev libavformat-dev libswscale-dev libavutil-dev \
dcmtk libopenvdb-dev \
libfreetype6-dev \
libopencolorio-dev \
libtbb-dev \
libopencv-dev
fi
if [[ "${QT_VERSION:-5}" == "5" ]] ; then
time sudo apt-get -q install -y \
qt5-default || /bin/true
@@ -93,12 +101,11 @@ else
# Nonstandard python versions
if [[ "${PYTHON_VERSION}" == "3.9" ]] ; then
time sudo apt-get -q install -y python3.9-dev python3-numpy
pip3 --version
pip3 install numpy
elif [[ "$PYTHON_VERSION" == "2.7" ]] ; then
time sudo apt-get -q install -y python-dev python-numpy
else
pip3 install numpy
fi
if [[ "${PIP_INSTALLS:=numpy}" != "none" ]] ; then
time pip3 install ${PIP_INSTALLS}
fi
if [[ "$USE_LIBHEIF" != "0" ]] ; then
@@ -125,13 +132,17 @@ else
time sudo apt-get install -y g++-11
elif [[ "$CXX" == "g++-12" ]] ; then
time sudo apt-get install -y g++-12
elif [[ "$CXX" == "g++-13" ]] ; then
time sudo apt-get install -y g++-13
elif [[ "$CXX" == "g++-14" ]] ; then
time sudo apt-get install -y g++-14
fi
if [[ "$CXX" == "icpc" || "$CC" == "icc" || "$USE_ICC" != "" || "$USE_ICX" != "" ]] ; then
time sudo apt-get -q install -y wget
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
@@ -148,7 +159,7 @@ cmake --version
# If we're using clang to compile on native Ubuntu, we need to install it.
# If on an ASWF CentOS docker container, it already is installed.
#
if [[ "$CXX" == "clang++" && "$ASWF_ORG" == "" ]] ; then
if [[ ("$CXX" == "clang++" && "$ASWF_ORG" == "") || "$LLVM_VERSION" != "" ]] ; then
source src/build-scripts/build_llvm.bash
fi
@@ -193,6 +204,14 @@ if [[ "$PTEX_VERSION" != "" ]] ; then
source src/build-scripts/build_Ptex.bash
fi
if [[ "$ABI_CHECK" != "" ]] ; then
source src/build-scripts/build_abi_tools.bash
fi
if [[ "$LIBJPEGTURBO_VERSION" != "" ]] ; then
source src/build-scripts/build_libjpeg-turbo.bash
fi
if [[ "$USE_ICC" != "" ]] ; then
# We used gcc for the prior dependency builds, but use icc for OIIO itself
echo "which icpc:" $(which icpc)
+8 -7
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# DEP_DIR="$PWD/ext/dist"
DEP_DIR="$PWD/dist/$PLATFORM"
@@ -32,8 +32,8 @@ elif [[ "$PYTHON_VERSION" == "3.7" ]] ; then
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 CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/c/hostedtoolcache/windows/Python/3.9.13/x64"
export Python_EXECUTABLE="/c/hostedtoolcache/windows/Python/3.9.13/x64/python3.exe"
export PYTHONPATH=$OpenImageIO_ROOT/lib/python${PYTHON_VERSION}/site-packages
fi
pip install numpy
@@ -57,7 +57,8 @@ time vcpkg install boost-stacktrace:x64-windows
time vcpkg install boost-system:x64-windows
time vcpkg install boost-thread:x64-windows
# # vcpkg install zlib:x64-windows
#vcpkg install libdeflate:x64-windows
#vcpkg install zlib:x64-windows
vcpkg install tiff:x64-windows
# vcpkg install libpng:x64-windows
# vcpkg install giflib:x64-windows
@@ -81,7 +82,7 @@ vcpkg install libjpeg-turbo:x64-windows
#
# # export PATH="$PATH:$DEP_DIR/bin:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
# export PATH="$DEP_DIR/lib:$DEP_DIR/bin:$PATH:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib"
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib"
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:$VCPKG_INSTALLATION_ROOT/installed/x64-windows"
# export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib:$DEP_DIR/lib:$DEP_DIR/bin"
#
echo "All VCPkg installs:"
@@ -102,8 +103,8 @@ vcpkg list
# export PNG_ROOT=$PWD/ext/dist
# We're currently getting libtiff from vcpkg
#src/build-scripts/build_libtiff.bash
#export TIFF_ROOT=$PWD/ext/dist
src/build-scripts/build_libtiff.bash
export TIFF_ROOT=$PWD/ext/dist
# We're currently getting jpeg from vcpkg
# LIBJPEGTURBO_CONFIG_OPTS=-DWITH_SIMD=OFF
+14 -5
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# This script, which assumes it is running on a Mac OSX with Homebrew
# installed, does a "brew install" in all packages reasonably needed by
@@ -20,7 +20,9 @@ if [[ `which brew` == "" ]] ; then
fi
#brew update >/dev/null
if [[ "${DO_BREW_UPDATE:=0}" != "0" ]] ; then
brew update >/dev/null
fi
echo ""
echo "Before my brew installs:"
brew list --versions
@@ -42,8 +44,16 @@ brew install --display-times -q freetype libraw dcmtk pybind11 numpy || 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${QT_VERSION}
if [[ "${USE_OPENCV}" != "0" ]] ; then
brew install --display-times -q opencv || true
fi
if [[ "${USE_QT}" != "0" ]] ; then
brew install --display-times -q qt${QT_VERSION}
fi
if [[ "${USE_LLVM:=0}" != "0" ]] || [[ "${LLVMBREWVER}" != "" ]]; then
brew install --display-times -q llvm${LLVMBREWVER}
export PATH=/usr/local/opt/llvm/bin:$PATH
fi
echo ""
echo "After brew installs:"
@@ -57,7 +67,6 @@ pip${PYTHON_VERSION} install numpy
export PATH=/usr/local/opt/qt5/bin:$PATH
export PATH=/usr/local/opt/python/libexec/bin:$PATH
export PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
#export PATH=/usr/local/opt/llvm/bin:$PATH
# Save the env for use by other stages
src/build-scripts/save-env.bash
+1 -1
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Save the env for use by other stages. Exclude things that we know aren't
# needed.
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
add_oiio_plugin (cineoninput.cpp
libcineon/Cineon.cpp libcineon/OutStream.cpp libcineon/Codec.cpp
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
// https://github.com/AcademySoftwareFoundation/OpenImageIO
#include <cmath>
+4 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
@PACKAGE_INIT@
@@ -36,6 +36,9 @@ if (NOT @BUILD_SHARED_LIBS@)
if (@PNG_FOUND@)
find_dependency(PNG)
endif()
if (@DCMTK_FOUND@)
find_dependency(DCMTK)
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@)
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Macro to add a build target for an IO plugin.
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Is the named package "enabled" via our disabling convention? If either
# USE_pkgname (or the all-uppercase USE_PKGNAME, or ENABLE_pkgname, or
+13 -3
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
set (REQUIRED_DEPS "" CACHE STRING
@@ -9,6 +9,8 @@ set (OPTIONAL_DEPS "" CACHE STRING
"Additional dependencies to consider optional (semicolon-separated list, or ALL)")
option (ALWAYS_PREFER_CONFIG "Prefer a dependency's exported config file if it's available" OFF)
# Track all build deps we find with checked_find_package
set (CFP_ALL_BUILD_DEPS_FOUND "")
# Utility function to list the names and values of all variables matching
# the pattern (case-insensitive)
@@ -66,6 +68,9 @@ endfunction ()
# file from the package before using a FindPackage.cmake module.
# * Optional DEBUG turns on extra debugging information related to how
# this package is found.
# * Found package "name version" or "name NONE" are accumulated in the list
# CFP_ALL_BUILD_DEPS_FOUND. If the optional NO_RECORD_NOTFOUND is
# supplied, un-found packags will not be recorded.
#
# N.B. This needs to be a macro, not a function, because the find modules
# will set(blah val PARENT_SCOPE) and we need that to be the global scope,
@@ -73,7 +78,7 @@ endfunction ()
macro (checked_find_package pkgname)
cmake_parse_arguments(_pkg # prefix
# noValueKeywords:
"REQUIRED;PREFER_CONFIG;DEBUG"
"REQUIRED;PREFER_CONFIG;DEBUG;NO_RECORD_NOTFOUND"
# singleValueKeywords:
"ENABLE;ISDEPOF;VERSION_MIN;VERSION_MAX;RECOMMEND_MIN;RECOMMEND_MIN_REASON"
# multiValueKeywords:
@@ -155,6 +160,8 @@ macro (checked_find_package pkgname)
message (STATUS "${ColorYellow}Recommend ${pkgname} >= ${_pkg_RECOMMEND_MIN} ${_pkg_RECOMMEND_MIN_REASON} ${ColorReset}")
endif ()
endif ()
string (STRIP "${pkgname} ${${pkgname}_VERSION}" app_)
list (APPEND CFP_ALL_BUILD_DEPS_FOUND "${app_}")
else ()
message (STATUS "${ColorRed}${pkgname} library not found ${ColorReset}")
if (${pkgname}_ROOT)
@@ -176,6 +183,9 @@ macro (checked_find_package pkgname)
if (_pkg_REQUIRED)
message (FATAL_ERROR "${ColorRed}${pkgname} is required, aborting.${ColorReset}")
endif ()
if (NOT _pkg_NO_RECORD_NOTFOUND)
list (APPEND CFP_ALL_BUILD_DEPS_FOUND "${pkgname} NONE")
endif ()
endif()
if (_pkg_VERBOSE AND (${pkgname}_FOUND OR ${pkgname_upper}_FOUND OR _pkg_DEBUG))
if (_pkg_DEBUG)
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Define color codes for pretty terminal output
+40 -3
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
###########################################################################
#
@@ -20,6 +20,7 @@ message (VERBOSE "CMAKE_SYSTEM_VERSION = ${CMAKE_SYSTEM_VERSION}")
message (VERBOSE "CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}")
message (STATUS "CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}")
message (STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
message (VERBOSE "CMAKE_CXX_COMPILE_FEATURES = ${CMAKE_CXX_COMPILE_FEATURES}")
###########################################################################
@@ -299,13 +300,31 @@ set (SIMD_COMPILE_FLAGS "")
if (NOT USE_SIMD STREQUAL "")
message (STATUS "Compiling with SIMD level ${USE_SIMD}")
if (USE_SIMD STREQUAL "0")
set (SIMD_COMPILE_FLAGS ${SIMD_COMPILE_FLAGS} "-DOIIO_NO_SSE=1")
set (SIMD_COMPILE_FLAGS ${SIMD_COMPILE_FLAGS} "-DOIIO_NO_SIMD=1")
else ()
set(_highest_msvc_arch 0)
string (REPLACE "," ";" SIMD_FEATURE_LIST ${USE_SIMD})
foreach (feature ${SIMD_FEATURE_LIST})
message (VERBOSE "SIMD feature: ${feature}")
if (MSVC OR CMAKE_COMPILER_IS_INTEL)
set (SIMD_COMPILE_FLAGS ${SIMD_COMPILE_FLAGS} "/arch:${feature}")
if (feature STREQUAL "sse2")
list (APPEND SIMD_COMPILE_FLAGS "/D__SSE2__")
endif ()
if (feature STREQUAL "sse4.1")
list (APPEND SIMD_COMPILE_FLAGS "/D__SSE2__" "/D__SSE4_1__")
endif ()
if (feature STREQUAL "sse4.2")
list (APPEND SIMD_COMPILE_FLAGS "/D__SSE2__" "/D__SSE4_2__")
endif ()
if (feature STREQUAL "avx" AND _highest_msvc_arch LESS 1)
set(_highest_msvc_arch 1)
endif ()
if (feature STREQUAL "avx2" AND _highest_msvc_arch LESS 2)
set(_highest_msvc_arch 2)
endif ()
if (feature STREQUAL "avx512f" AND _highest_msvc_arch LESS 3)
set(_highest_msvc_arch 3)
endif ()
else ()
set (SIMD_COMPILE_FLAGS ${SIMD_COMPILE_FLAGS} "-m${feature}")
endif ()
@@ -317,6 +336,20 @@ if (NOT USE_SIMD STREQUAL "")
add_compile_options ("-ffp-contract=off")
endif ()
endforeach()
# Only add a single /arch flag representing the highest level of support.
if (MSVC OR CMAKE_COMPILER_IS_INTEL)
if (_highest_msvc_arch EQUAL 1)
list (APPEND SIMD_COMPILE_FLAGS "/arch:AVX")
endif ()
if (_highest_msvc_arch EQUAL 2)
list (APPEND SIMD_COMPILE_FLAGS "/arch:AVX2")
endif ()
if (_highest_msvc_arch EQUAL 3)
list (APPEND SIMD_COMPILE_FLAGS "/arch:AVX512")
endif ()
endif ()
unset(_highest_msvc_arch)
endif ()
add_compile_options (${SIMD_COMPILE_FLAGS})
endif ()
@@ -622,6 +655,10 @@ else ()
endif ()
###########################################################################
# Generate compile_commands.json for use by editors and tools.
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
###########################################################################
# Macro to install targets to the appropriate locations. Use this instead
+46 -17
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
###########################################################################
# Find external dependencies
@@ -101,7 +101,7 @@ checked_find_package (TIFF REQUIRED
checked_find_package (OpenEXR REQUIRED
VERSION_MIN 2.4
RECOMMEND_MIN 3.1
PRINT IMATH_INCLUDES OPENEXR_INCLUDES)
PRINT IMATH_INCLUDES OPENEXR_INCLUDES Imath_VERSION)
# 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 shouldn't be necessary, except for the common case of people
@@ -136,12 +136,11 @@ set (OPENIMAGEIO_IMATH_DEPENDENCY_VISIBILITY "PUBLIC" CACHE STRING
set (OPENIMAGEIO_CONFIG_DO_NOT_FIND_IMATH OFF CACHE BOOL
"Exclude find_dependency(Imath) from the exported OpenImageIOConfig.cmake")
# JPEG -- prefer Turbo-JPEG to regular libjpeg
checked_find_package (JPEGTurbo
DEFINITIONS -DUSE_JPEG_TURBO=1
PRINT JPEG_INCLUDES JPEG_INCLUDE_DIRS
JPEG_LIBRARIES JPEG_VERSION)
if (NOT JPEG_FOUND) # Try to find the non-turbo version
# JPEG -- prefer JPEG-Turbo to regular libjpeg
checked_find_package (libjpeg-turbo
VERSION_MIN 2.1
DEFINITIONS -DUSE_JPEG_TURBO=1)
if (NOT TARGET libjpeg-turbo::jpeg) # Try to find the non-turbo version
checked_find_package (JPEG REQUIRED)
endif ()
@@ -159,6 +158,9 @@ endif()
# From pythonutils.cmake
find_python()
if (USE_PYTHON)
checked_find_package (pybind11 REQUIRED VERSION_MIN 2.4.2)
endif ()
###########################################################################
@@ -198,7 +200,10 @@ checked_find_package (TBB 2017
SETVARIABLES OIIO_TBB
PREFER_CONFIG)
checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images
# DCMTK is used to read DICOM images
checked_find_package (DCMTK VERSION_MIN 3.6.1
PREFER_CONFIG)
checked_find_package (FFmpeg VERSION_MIN 3.0)
checked_find_package (GIF
VERSION_MIN 4
@@ -207,8 +212,8 @@ checked_find_package (GIF
# For HEIF/HEIC/AVIF formats
checked_find_package (Libheif VERSION_MIN 1.3
RECOMMEND_MIN 1.7
RECOMMEND_MIN_REASON "for AVIF support")
RECOMMEND_MIN 1.16
RECOMMEND_MIN_REASON "for orientation support")
if (APPLE AND LIBHEIF_VERSION VERSION_GREATER_EQUAL 1.10 AND LIBHEIF_VERSION VERSION_LESS 1.11)
message (WARNING "Libheif 1.10 on Apple is known to be broken, disabling libheif support")
set (Libheif_FOUND 0)
@@ -236,6 +241,11 @@ checked_find_package (OpenVDB
VERSION_MIN 5.0
DEPS TBB
DEFINITIONS -DUSE_OPENVDB=1)
if (OpenVDB_FOUND AND OpenVDB_VERSION VERSION_GREATER_EQUAL 10.1 AND CMAKE_CXX_STANDARD VERSION_LESS 17)
message (WARNING "${ColorYellow}OpenVDB >= 10.1 (we found ${OpenVDB_VERSION}) can only be used when we build with C++17 or higher. Disabling OpenVDB support.${ColorReset}")
set (OpenVDB_FOUND 0)
add_compile_definitions(DISABLE_OPENVDB=1)
endif ()
checked_find_package (Ptex PREFER_CONFIG)
if (NOT Ptex_FOUND OR NOT Ptex_VERSION)
@@ -246,12 +256,14 @@ if (NOT Ptex_FOUND OR NOT Ptex_VERSION)
endif ()
checked_find_package (WebP)
# Note: When WebP 1.1 (released late 2019) is our minimum, we can use their
# exported configs and remove our FindWebP.cmake module.
option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF)
checked_find_package (R3DSDK) # RED camera
checked_find_package (R3DSDK NO_RECORD_NOTFOUND) # RED camera
set (NUKE_VERSION "7.0" CACHE STRING "Nuke version to target")
checked_find_package (Nuke)
checked_find_package (Nuke NO_RECORD_NOTFOUND)
# Qt -- used for iv
@@ -310,6 +322,8 @@ macro (find_or_download_robin_map)
checked_find_package (Robinmap REQUIRED)
endmacro()
find_or_download_robin_map ()
###########################################################################
# fmtlib
@@ -329,7 +343,7 @@ macro (find_or_download_fmt)
# If an external copy wasn't found and we requested that missing
# packages be built, or we we are forcing a local copy to be built, then
# download and build it.
if ((BUILD_MISSING_FMT AND NOT FMT_FOUND) OR BUILD_FMT_FORCE)
if ((BUILD_MISSING_FMT AND NOT fmt_FOUND) OR BUILD_FMT_FORCE)
message (STATUS "Downloading local fmtlib/fmt")
set (FMT_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/fmt")
set (FMT_GIT_REPOSITORY "https://github.com/fmtlib/fmt")
@@ -347,16 +361,31 @@ macro (find_or_download_fmt)
endif ()
set (FMT_INCLUDE_DIR "${FMT_INSTALL_DIR}/include")
set (OIIO_USING_FMT_LOCAL TRUE)
if (EXISTS "${FMT_INCLUDE_DIR}/fmt/base.h")
file (STRINGS "${FMT_INCLUDE_DIR}/fmt/base.h" TMP REGEX "^#define FMT_VERSION .*$")
else ()
file (STRINGS "${FMT_INCLUDE_DIR}/fmt/core.h" TMP REGEX "^#define FMT_VERSION .*$")
endif ()
string (REGEX MATCHALL "[0-9]+" FMT_VERSION_NUMERIC ${TMP})
math(EXPR FMT_VERSION_PATCH "${FMT_VERSION_NUMERIC} % 100")
math(EXPR FMT_VERSION_MINOR "(${FMT_VERSION_NUMERIC} / 100) % 100")
math(EXPR FMT_VERSION_MAJOR "${FMT_VERSION_NUMERIC} / 10000")
set (fmt_VERSION "${FMT_VERSION_MAJOR}.${FMT_VERSION_MINOR}.${FMT_VERSION_PATCH}")
list (APPEND CFP_ALL_BUILD_DEPS_FOUND "${pkgname} ${${pkgname}_VERSION}")
else ()
get_target_property(FMT_INCLUDE_DIR fmt::fmt-header-only INTERFACE_INCLUDE_DIRECTORIES)
set (OIIO_USING_FMT_LOCAL FALSE)
checked_find_package (fmt REQUIRED
VERSION_MIN 7.0)
endif ()
checked_find_package (fmt REQUIRED
VERSION_MIN 7.0)
endmacro()
find_or_download_fmt()
if (FMT_VERSION VERSION_EQUAL 90100
if (fmt_VERSION VERSION_EQUAL 9.1.0
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 ()
list (SORT CFP_ALL_BUILD_DEPS_FOUND COMPARE STRING CASE INSENSITIVE)
message (STATUS "All build dependencies: ${CFP_ALL_BUILD_DEPS_FOUND}")
+2 -2
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Macro to add an executable build target. The executable name can be
# specified with NAME, otherwise is inferred from the subdirectory name. The
-72
View File
@@ -1,72 +0,0 @@
# 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
#
# This module defines the following variables:
#
# DCMTK_FOUND True if DCMTK was found.
# DCMTK_INCLUDES Where to find DCMTK headers
# DCMTK_LIBRARIES List of libraries to link against when using DCMTK
# DCMTK_VERSION Version of DCMTK (e.g., 3.6.2)
# DCMTK_VERSION_NUMBER Int version of DCMTK (e.g., 362 for 3.6.2)
include (FindPackageHandleStandardArgs)
include (FindPackageMessage)
if (NOT DCMTK_FIND_QUIETLY)
if (DCMTK_ROOT)
message(STATUS "DCMTK path explicitly specified: ${DCMTK_ROOT}")
endif()
if (DCMTK_INCLUDE_PATH)
message(STATUS "DCMTK INCLUDE_PATH explicitly specified: ${DCMTK_INCLUDE_PATH}")
endif()
if (DCMTK_LIBRARY_PATH)
message(STATUS "DCMTK LIBRARY_PATH explicitly specified: ${DCMTK_LIBRARY_PATH}")
endif()
endif ()
find_path (DCMTK_INCLUDE_DIR
dcmtk/dcmdata/dcuid.h
HINTS
${DCMTK_INCLUDE_PATH} ENV DCMTK_INCLUDE_PATH
DOC "The directory where DCMTK headers reside")
foreach (COMPONENT dcmimage dcmimgle dcmdata oflog ofstd iconv)
find_library (DCMTK_${COMPONENT}_LIB ${COMPONENT}
HINTS
${DCMTK_LIBRARY_PATH} ENV DCMTK_LIBRARY_PATH
PATH_SUFFIXES lib lib64
)
if (DCMTK_${COMPONENT}_LIB)
set (DCMTK_LIBRARIES ${DCMTK_LIBRARIES} ${DCMTK_${COMPONENT}_LIB})
endif ()
endforeach()
if (DCMTK_INCLUDE_DIR AND EXISTS "${DCMTK_INCLUDE_DIR}/dcmtk/config/osconfig.h")
file(STRINGS "${DCMTK_INCLUDE_DIR}/dcmtk/config/osconfig.h" TMP REGEX "^#define PACKAGE_VERSION[ \t].*$")
string(REGEX MATCHALL "[0-9.]+" DCMTK_VERSION ${TMP})
file(STRINGS "${DCMTK_INCLUDE_DIR}/dcmtk/config/osconfig.h" TMP REGEX "^#define PACKAGE_VERSION_NUMBER[ \t].*$")
string(REGEX MATCHALL "[0-9.]+" DCMTK_VERSION_NUMBER ${TMP})
endif ()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (DCMTK
REQUIRED_VARS DCMTK_INCLUDE_DIR DCMTK_LIBRARIES
VERSION_VAR DCMTK_VERSION
)
if (DCMTK_FOUND)
set(DCMTK_INCLUDES "${DCMTK_INCLUDE_DIR}")
endif()
mark_as_advanced (
DCMTK_INCLUDE_DIR
DCMTK_LIBRARIES
DCMTK_VERSION
DCMTK_VERSION_NUMBER
)
+1 -1
View File
@@ -18,7 +18,7 @@
# Modifications:
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
if (FFMPEG_INCLUDES AND FFMPEG_LIBRARIES)
set (FFmpeg_FOUND TRUE)
-59
View File
@@ -1,59 +0,0 @@
# 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
#
# JPEG_FOUND - system has libjpeg-turbo
# JPEG_INCLUDE_DIRS - the libjpeg-turbo include directories
# JPEG_LIBRARIES - link these to use libjpeg-turbo
#
include (FindPackageHandleStandardArgs)
find_path(JPEG_INCLUDE_DIR turbojpeg.h
HINTS /usr/local/opt/jpeg-turbo/include
PATH_SUFFIXES include)
set(JPEG_NAMES ${JPEG_NAMES} jpeg libjpeg turbojpeg libturbojpeg)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES}
HINTS ${JPEG_INCLUDE_DIR}/..
/usr/local/opt/jpeg-turbo
/opt/libjpeg-turbo
PATH_SUFFIXES lib lib64
NO_DEFAULT_PATH)
if (NOT JPEG_LIBRARY)
find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES}
HINTS ${JPEG_INCLUDE_DIR}/..
/usr/local/opt/jpeg-turbo
PATH_SUFFIXES lib lib64)
endif ()
if (JPEG_INCLUDE_DIR AND JPEG_LIBRARY)
set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR} CACHE PATH "JPEG include dirs")
set (JPEG_LIBRARIES ${JPEG_LIBRARY} CACHE STRING "JPEG libraries")
file(STRINGS "${JPEG_INCLUDE_DIR}/jconfig.h"
jpeg_lib_version REGEX "^#define[\t ]+JPEG_LIB_VERSION[\t ]+.*")
if (jpeg_lib_version)
string(REGEX REPLACE "^#define[\t ]+JPEG_LIB_VERSION[\t ]+([0-9]+).*"
"\\1" JPEG_VERSION "${jpeg_lib_version}")
endif ()
endif ()
# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARIES JPEG_INCLUDE_DIRS)
if (JPEG_FOUND)
set (JPEGTURBO_FOUND true)
# Use an intermediary target named "JPEG::JPEG" to match libjpeg's export
if(NOT TARGET JPEG::JPEG)
add_library(JPEG::JPEG INTERFACE IMPORTED)
target_link_libraries(JPEG::JPEG INTERFACE ${JPEG_LIBRARY})
endif()
endif ()
mark_as_advanced(JPEG_LIBRARIES JPEG_INCLUDE_DIRS )
+1 -1
View File
@@ -2,7 +2,7 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
#
# This module will first look into the directories defined by the variables:
# - Libheif_ROOT, LIBHEIF_INCLUDE_PATH, LIBHEIF_LIBRARY_PATH
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# - CMake find module for Nuke
#
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# - Find OpenCV
# Find the OpenCV library
+2 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Module to find OpenColorIO
#
@@ -91,6 +91,7 @@ find_package_handle_standard_args (OpenColorIO
)
if (OpenColorIO_FOUND)
set (OpenColorIO_VERSION ${OPENCOLORIO_VERSION})
set (OPENCOLORIO_INCLUDES ${OPENCOLORIO_INCLUDE_DIR})
set (OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARY})
set (OPENCOLORIO_DEFINITIONS "")
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Module to find OpenEXR and Imath.
#
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause and Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Module to find OpenJpeg.
#
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# - Try to find R3D SDK
#
+1 -1
View File
@@ -2,7 +2,7 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
#
# Sets the usual variables expected for find_package scripts:
#
+11 -1
View File
@@ -2,7 +2,7 @@
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
#
# This module will first look into the directories defined by the variables:
# - Webp_ROOT, WEBP_INCLUDE_PATH, WEBP_LIBRARY_PATH
@@ -17,6 +17,14 @@
# definitions giving the version:
# WEBP_VERSION Version of Webp (e.g., 3.6.2)
# Try the config for newer WebP versions.
find_package(WebP CONFIG)
if (NOT TARGET WebP::webp)
# If not found, roll our own.
# Note: When WebP 1.1 (released late 2019) is our minimum, we can use their
# exported configs and remove our FindWebP.cmake module.
include (FindPackageHandleStandardArgs)
find_path (WEBP_INCLUDE_DIR webp/encode.h
@@ -65,3 +73,5 @@ mark_as_advanced (
WEBP_LIBRARY
WEBPDEMUX_LIBRARY
)
endif ()
-32
View File
@@ -1,32 +0,0 @@
# 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
# FMT_FOUND - true if fmt was found.
# FMT_VERSION - combined version number (e.g. 60102 for 6.1.2)
find_path (FMT_INCLUDE_DIR fmt/format.h
HINTS "${PROJECT_SOURCE_DIR}/ext/fmt"
)
if (FMT_INCLUDE_DIR)
file(STRINGS "${FMT_INCLUDE_DIR}/fmt/core.h" TMP REGEX "^#define FMT_VERSION .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" FMT_VERSION ${TMP})
endif ()
# Support the REQUIRED and QUIET arguments, and set FMT_FOUND if found.
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (fmt
REQUIRED_VARS FMT_INCLUDE_DIR
VERSION_VAR FMT_VERSION)
if (FMT_FOUND)
set (FMT_INCLUDES ${FMT_INCLUDE_DIR})
endif ()
mark_as_advanced (FMT_INCLUDE_DIR)
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Find the pugixml XML parsing library.
#
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio/
# https://github.com/AcademySoftwareFoundation/OpenImageIO/
#########################################################################
# Packaging
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Python-related options.
option (USE_PYTHON "Build the Python bindings" ON)
+14 -6
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio/
# https://github.com/AcademySoftwareFoundation/OpenImageIO/
include (CTest)
@@ -139,6 +139,7 @@ macro (oiio_add_all_tests)
# Freestanding tests:
oiio_add_tests (
cmake-consumer
docs-examples-cpp
iinfo igrep
nonwhole-tiles
oiiotool
@@ -208,6 +209,7 @@ macro (oiio_add_all_tests)
# libraries to run correctly.
if (USE_PYTHON AND NOT BUILD_OIIOUTIL_ONLY AND NOT SANITIZE)
oiio_add_tests (
docs-examples-python
python-colorconfig
python-deep
python-imagebuf
@@ -218,6 +220,7 @@ macro (oiio_add_all_tests)
python-roi
python-texturesys
python-typedesc
filters
)
# These Python tests also need access to oiio-images
oiio_add_tests (
@@ -256,8 +259,10 @@ macro (oiio_add_all_tests)
IMAGEDIR openexr-images
URL http://github.com/AcademySoftwareFoundation/openexr-images)
oiio_add_tests (heif
FOUNDVAR Libheif_FOUND ENABLEVAR ENABLE_Libheif
URL https://github.com/nokiatech/heif/tree/gh-pages/content)
FOUNDVAR Libheif_FOUND
ENABLEVAR ENABLE_Libheif
IMAGEDIR oiio-images/heif
URL http://github.com/AcademySoftwareFoundation/openexr-images)
oiio_add_tests (ico
ENABLEVAR ENABLE_ICO
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
@@ -272,15 +277,18 @@ macro (oiio_add_all_tests)
IMAGEDIR j2kp4files_v1_5
URL http://www.itu.int/net/ITU-T/sigdb/speimage/ImageForm-s.aspx?val=10100803)
set (all_openexr_tests
openexr-suite openexr-multires openexr-chroma
openexr-suite openexr-multires openexr-chroma openexr-decreasingy
openexr-v2 openexr-window perchannel oiiotool-deep)
if (USE_PYTHON AND NOT SANITIZE)
list (APPEND all_openexr_tests openexr-copy)
endif ()
if (OpenEXR_VERSION VERSION_GREATER_EQUAL 3.1.10)
# OpenEXR 3.1.10 is the first release where the exr core library
# properly supported all compression types (DWA in particular).
list (APPEND all_openexr_tests openexr-compression)
endif ()
# Run all OpenEXR tests without core library
oiio_add_tests (${all_openexr_tests}
oiio_add_tests (${all_openexr_tests} openexr-luminance-chroma
ENVIRONMENT OPENIMAGEIO_OPTIONS=openexr:core=0
IMAGEDIR openexr-images
URL http://github.com/AcademySoftwareFoundation/openexr-images)
@@ -404,7 +412,7 @@ endfunction()
function (oiio_setup_test_data)
oiio_get_test_data (oiio-images
REPO https://github.com/OpenImageIO/oiio-images.git)
REPO https://github.com/AcademySoftwareFoundation/OpenImageIO-images.git)
oiio_get_test_data (openexr-images
REPO https://github.com/AcademySoftwareFoundation/openexr-images.git
BRANCH main)
+1 -1
View File
@@ -1,5 +1,5 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
add_oiio_plugin (ddsinput.cpp)
+16 -1
View File
@@ -1,6 +1,6 @@
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
// https://github.com/AcademySoftwareFoundation/OpenImageIO
#pragma once
@@ -27,11 +27,26 @@ namespace DDS_pvt {
#define DDS_4CC_BC4U DDS_MAKE4CC('B', 'C', '4', 'U')
#define DDS_4CC_BC5U DDS_MAKE4CC('B', 'C', '5', 'U')
#define DDS_FORMAT_R10G10B10A2_UNORM 24
#define DDS_FORMAT_R8G8B8A8_UNORM 28
#define DDS_FORMAT_R8G8B8A8_UNORM_SRGB 29
#define DDS_FORMAT_R16_UNORM 56
#define DDS_FORMAT_BC1_UNORM 71
#define DDS_FORMAT_BC1_UNORM_SRGB 72
#define DDS_FORMAT_BC2_UNORM 74
#define DDS_FORMAT_BC2_UNORM_SRGB 75
#define DDS_FORMAT_BC3_UNORM 77
#define DDS_FORMAT_BC3_UNORM_SRGB 78
#define DDS_FORMAT_BC4_UNORM 80
#define DDS_FORMAT_BC5_UNORM 83
#define DDS_FORMAT_B8G8R8A8_UNORM 87
#define DDS_FORMAT_B8G8R8X8_UNORM 88
#define DDS_FORMAT_B8G8R8A8_UNORM_SRGB 91
#define DDS_FORMAT_B8G8R8X8_UNORM_SRGB 93
#define DDS_FORMAT_BC6H_UF16 95
#define DDS_FORMAT_BC6H_SF16 96
#define DDS_FORMAT_BC7_UNORM 98
#define DDS_FORMAT_BC7_UNORM_SRGB 99
enum class Compression {
None,
+142 -9
View File
@@ -1,6 +1,6 @@
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
// https://github.com/AcademySoftwareFoundation/OpenImageIO
#include <cmath>
#include <cstdio>
@@ -295,6 +295,71 @@ DecompressImage(uint8_t* rgba, int width, int height, const uint8_t* blocks,
opt);
}
/// Gets the bitmasks required to extract the channels of a DXGI format.
/// Returns whether the DXGI format is supported.
/// Compressed formats BCn are not handled by this function.
///
static bool
GetDxgiFormatChannelMasks(uint32_t dxgiFormat, uint32_t masks[4])
{
masks[0] = masks[1] = masks[2] = masks[3] = 0;
switch (dxgiFormat) {
case DDS_FORMAT_R16_UNORM: masks[0] = 0xFFFF; break;
case DDS_FORMAT_R10G10B10A2_UNORM:
masks[0] = 0x000003FF;
masks[1] = 0x000FFC00;
masks[2] = 0x3FF00000;
masks[3] = 0xC0000000;
break;
case DDS_FORMAT_R8G8B8A8_UNORM:
case DDS_FORMAT_R8G8B8A8_UNORM_SRGB:
masks[0] = 0x000000FF;
masks[1] = 0x0000FF00;
masks[2] = 0x00FF0000;
masks[3] = 0xFF000000;
break;
case DDS_FORMAT_B8G8R8A8_UNORM:
case DDS_FORMAT_B8G8R8A8_UNORM_SRGB:
masks[3] = 0xFF000000;
OIIO_FALLTHROUGH;
case DDS_FORMAT_B8G8R8X8_UNORM:
case DDS_FORMAT_B8G8R8X8_UNORM_SRGB:
masks[0] = 0x00FF0000;
masks[1] = 0x0000FF00;
masks[2] = 0x000000FF;
break;
default: return false;
}
return true;
}
/// Gets the bits-per-pixel of a DXGI format, or 0 if not supported.
/// Compressed formats BCn are not handled by this function.
///
static uint32_t
GetDxgiFormatBitsPerPixel(uint32_t dxgiFormat)
{
switch (dxgiFormat) {
case DDS_FORMAT_R16_UNORM: return 16;
case DDS_FORMAT_R10G10B10A2_UNORM:
case DDS_FORMAT_R8G8B8A8_UNORM:
case DDS_FORMAT_R8G8B8A8_UNORM_SRGB:
case DDS_FORMAT_B8G8R8A8_UNORM:
case DDS_FORMAT_B8G8R8A8_UNORM_SRGB:
case DDS_FORMAT_B8G8R8X8_UNORM:
case DDS_FORMAT_B8G8R8X8_UNORM_SRGB: return 32;
default: return 0;
}
}
// Obligatory material to make this a recognizable imageio plugin:
OIIO_PLUGIN_EXPORTS_BEGIN
@@ -390,13 +455,16 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
std::cerr << "[dds] mipmaps: " << m_dds.mipmaps << "\n";
std::cerr << "[dds] fmt.size: " << m_dds.fmt.size << "\n";
std::cerr << "[dds] fmt.flags: " << m_dds.fmt.flags << "\n";
std::cerr << "[dds] fmt.fourCC: " << ((char *)&m_dds.fmt.fourCC)[0]
<< ((char *)&m_dds.fmt.fourCC)[1]
<< ((char *)&m_dds.fmt.fourCC)[2]
<< ((char *)&m_dds.fmt.fourCC)[3]
<< " (" << m_dds.fmt.fourCC << ")\n";
std::cerr << "[dds] fmt.bpp: " << m_dds.fmt.bpp << "\n";
std::cerr << "[dds] fmt.masks[0]: " << m_dds.fmt.masks[0] << "\n";
std::cerr << "[dds] fmt.masks[1]: " << m_dds.fmt.masks[1] << "\n";
std::cerr << "[dds] fmt.masks[2]: " << m_dds.fmt.masks[2] << "\n";
std::cerr << "[dds] fmt.masks[3]: " << m_dds.fmt.masks[3] << "\n";
std::cerr << "[dds] caps.flags1: " << m_dds.caps.flags1 << "\n";
std::cerr << "[dds] caps.flags2: " << m_dds.caps.flags2 << "\n";*/
@@ -432,6 +500,12 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
if (m_dds.fmt.fourCC == DDS_4CC_DX10) {
if (!ioread(&m_dx10, sizeof(m_dx10), 1))
return false;
/*std::cerr << "[dds:dx10] dxgiFormat: " << m_dx10.dxgiFormat << "\n";
std::cerr << "[dds:dx10] resourceDimension: " << m_dx10.resourceDimension << "\n";
std::cerr << "[dds:dx10] arraySize: " << m_dx10.arraySize << "\n";
std::cerr << "[dds:dx10] miscFlag: " << m_dx10.miscFlag << "\n";
std::cerr << "[dds:dx10] miscFlag2: " << m_dx10.miscFlag2 << "\n";*/
}
// validate the pixel format
@@ -453,6 +527,18 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
case DDS_4CC_BC5U: m_compression = Compression::BC5; break;
case DDS_4CC_DX10: {
switch (m_dx10.dxgiFormat) {
case DDS_FORMAT_BC1_UNORM:
case DDS_FORMAT_BC1_UNORM_SRGB:
m_compression = Compression::DXT1;
break;
case DDS_FORMAT_BC2_UNORM:
case DDS_FORMAT_BC2_UNORM_SRGB:
m_compression = Compression::DXT3;
break;
case DDS_FORMAT_BC3_UNORM:
case DDS_FORMAT_BC3_UNORM_SRGB:
m_compression = Compression::DXT5;
break;
case DDS_FORMAT_BC4_UNORM: m_compression = Compression::BC4; break;
case DDS_FORMAT_BC5_UNORM: m_compression = Compression::BC5; break;
case DDS_FORMAT_BC6H_UF16:
@@ -461,12 +547,22 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
case DDS_FORMAT_BC6H_SF16:
m_compression = Compression::BC6HS;
break;
case DDS_FORMAT_BC7_UNORM: m_compression = Compression::BC7; break;
case DDS_FORMAT_BC7_UNORM:
case DDS_FORMAT_BC7_UNORM_SRGB:
m_compression = Compression::BC7;
break;
default:
if (!GetDxgiFormatChannelMasks(m_dx10.dxgiFormat,
m_dds.fmt.masks)) {
errorfmt("Unsupported DXGI format: {}", m_dx10.dxgiFormat);
return false;
}
break;
}
} break;
}
if (m_compression == Compression::None) {
errorf("Unsupported compression type");
default:
errorfmt("Unsupported compression type: {}", m_dds.fmt.fourCC);
return false;
}
}
@@ -481,6 +577,20 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
if (m_compression != Compression::None) {
m_nchans = GetChannelCount(m_compression,
m_dds.fmt.flags & DDS_PF_NORMAL);
} else if (m_dds.fmt.fourCC == DDS_4CC_DX10) {
// uncompressed DXGI formats, calculate bytes per pixel and bit shifts
m_Bpp = (GetDxgiFormatBitsPerPixel(m_dx10.dxgiFormat) + 7) >> 3;
m_nchans = 0;
for (int i = 0; i < 4; ++i) {
if (m_dds.fmt.masks[i] != 0) {
// place channels sequentially
m_dds.fmt.masks[m_nchans] = m_dds.fmt.masks[i];
m_nchans++;
}
}
for (int i = 0; i < m_nchans; ++i)
calc_shifts(m_dds.fmt.masks[i], m_BitCounts[i], m_RightShifts[i]);
} else {
// also calculate bytes per pixel and the bit shifts
m_Bpp = (m_dds.fmt.bpp + 7) >> 3;
@@ -698,6 +808,7 @@ DDSInput::seek_subimage(int subimage, int miplevel)
m_spec.attribute("compression", str);
}
uint32_t bpp = 0;
if (m_dds.fmt.bpp
&& (m_dds.fmt.flags
& (DDS_PF_RGB | DDS_PF_LUMINANCE | DDS_PF_YUV | DDS_PF_ALPHAONLY))) {
@@ -708,12 +819,34 @@ DDSInput::seek_subimage(int subimage, int miplevel)
m_dds.fmt.bpp);
return false;
}
m_spec.attribute("oiio:BitsPerSample", m_dds.fmt.bpp);
bpp = m_dds.fmt.bpp;
} else if (m_dds.fmt.fourCC == DDS_4CC_DX10) {
bpp = GetDxgiFormatBitsPerPixel(m_dx10.dxgiFormat);
}
if (bpp != 0)
m_spec.attribute("oiio:BitsPerSample", bpp);
const char* colorspace = nullptr;
if (m_dds.fmt.fourCC == DDS_4CC_DX10) {
switch (m_dx10.dxgiFormat) {
case DDS_FORMAT_BC1_UNORM_SRGB:
case DDS_FORMAT_BC2_UNORM_SRGB:
case DDS_FORMAT_BC3_UNORM_SRGB:
case DDS_FORMAT_BC7_UNORM_SRGB:
case DDS_FORMAT_R8G8B8A8_UNORM_SRGB:
case DDS_FORMAT_B8G8R8A8_UNORM_SRGB:
case DDS_FORMAT_B8G8R8X8_UNORM_SRGB: colorspace = "sRGB"; break;
}
}
// linear color space for HDR-ish images
if (basetype == TypeDesc::HALF || basetype == TypeDesc::FLOAT)
m_spec.attribute("oiio:ColorSpace", "linear");
if (colorspace == nullptr
&& (basetype == TypeDesc::HALF || basetype == TypeDesc::FLOAT))
colorspace = "linear";
m_spec.set_colorspace(colorspace);
m_spec.default_channel_names();
// Special case: if a 2-channel DDS RG or YA?
+2 -3
View File
@@ -1,11 +1,10 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
if (DCMTK_FOUND)
add_oiio_plugin (dicominput.cpp
INCLUDE_DIRS ${DCMTK_INCLUDE_DIR}
LINK_LIBRARIES ${DCMTK_LIBRARIES}
LINK_LIBRARIES DCMTK::DCMTK
DEFINITIONS "-DUSE_DCMTK=1")
else ()
message (WARNING "DICOM plugin will not be built, no DCMTK")
+1 -1
View File
@@ -1,6 +1,6 @@
// Copyright Contributors to the OpenImageIO project.
// SPDX-License-Identifier: Apache-2.0
// https://github.com/OpenImageIO/oiio
// https://github.com/AcademySoftwareFoundation/OpenImageIO
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imageio.h>
+117
View File
@@ -0,0 +1,117 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the OpenImageIO Project. -->
# Building the OpenImageIO documentation
The main OpenImageIO documentation can be read on [OpenImageIO Documentation
on ReadTheDocs](https://openimageio.readthedocs.io/).
But sometimes -- such as for developers who are editing the documentation --
it is helpful to be able to build and preview it locally. These are the steps
required to build the documentation.
The main docs as they appear on ReadTheDocs consist of two parts:
- Individual class and function documentation that are in the comments
in the various public header files of OpenImageIO.
- All the explanatory text found in `src/doc/*.rst`, which is processed
by Sphinx to generate the final documentation, and which draw on the
header documentation that was extracted by Doxygen.
## Building what you need to build the docs
To be able to fully build the documentation, there are some packages you
will need installed.
### Python
You will need Python.
### Doxygen
We don't use Doxygen for our final docs, but we do use it to generate some
intermediate files used by the Sphinx documentation (via the Breathe plugin),
so you'll need it installed.
You can read full build-from-source instructions for Doxygen
[here](https://www.doxygen.nl/manual/install.html), but that's unnecessary
for most users. There are several common ways to install via package
managers:
- Debian/Ubuntu/etc that use apt: `sudo apt install doxygen`
- RHEL/CentOS/Rocky/Alma/etc/ that use yum: `sudo yum install doxygen`
- Homebrew on macOS: `brew install doxygen`
- MacPorts on macOS: `sudo port install doxygen`
### Sphinx and its plugins
Our main documentation uses Sphinx, and several extensions. The easiest way to
install it is via Python PIP:
- [Sphinx](https://www.sphinx-doc.org/) documentation generator: `pip install -U sphinx`
- [Breathe](https://breathe.readthedocs.io) plugin for Sphinx for combining with Doxygen: `pip install breathe`
- [Sphinx-tabs](https://sphinx-tabs.readthedocs.io) plugin: `pip install -U sphinx-tabs`
- [Furo](https://github.com/pradyunsg/furo) theme: `pip install furo`
## Actually building the docs
The building of the documentation is separate from the main OpenImageIO
build system.
1. First, build OpenImageIO itself. You should probably know how to do this
before you're writing documentation for other users. Note that the build
itself will generate a lot of temporary files (like object files) from the
compilation in the `build` subdirectory, and that will also be used as scratch space for building the documentation.
2. Do the rest of these steps in src/doc:
cd src/doc
3. Build the Doxygen intermediate files
# (still in the src/doc directory)
make doxygen
Don't worry about warnings. Only worry if you see errors.
You only need to redo this step if you do one of the following things:
- Edit any of the `.h` file from which documentation is extracted. In fact,
more specifically, you need to redo this step if you CHANGE any of the
doxygen-based documentation in the comments of the headers.
- Start a fresh build, change which branch you're working on, or in any
way delete your `build` directory. Remember, as pointed out above, that
this is where the documentation is built, so if it disappears, you have
to start over again.
4. Build the Sphinx documentation
# (still in the src/doc directory)
make sphinx
You should see output that may spew some warnings (don't worry about
that) and should end with something that looks like this:
...
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 63 warnings.
You need to redo this Sphinx step if you change any of the text
documentation in `src/doc/*.rst` is changed. Note that if you are only
changing the `.rst` files, there is no need to go all the way back to step
3 to regenerate the Doxygen files.
5. Where are my docs?
The HTML pages are in `../../build/sphinx`
Point your browser at `index.html` in that directory to view the docs.
+1 -1
View File
@@ -1,6 +1,6 @@
These are all the release notes for versions 0.1 (Sept 2008) - 0.10 (Feb 2012).
For the full release notes of all versions, see:
[CHANGES](https://github.com/OpenImageIO/oiio/blob/master/CHANGES.md).
[CHANGES](https://github.com/AcademySoftwareFoundation/OpenImageIO/blob/master/CHANGES.md).
Release 0.10.5 (20 Feb 2012)
+1 -1
View File
@@ -1,7 +1,7 @@
These are all the release notes for versions 1.0 (Feb 2012) - 1.8 (Dec 2018).
For 0.x releases, see [CHANGES-0.x.md](CHANGES-0.x.md).
For the full release notes of all versions, see:
[CHANGES](https://github.com/OpenImageIO/oiio/blob/master/CHANGES.md).
[CHANGES](https://github.com/AcademySoftwareFoundation/OpenImageIO/blob/master/CHANGES.md).
Release 1.8.17 (1 Dec 2018) -- compared to 1.8.16
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
project(documentation)
+1 -1
View File
@@ -1,6 +1,6 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
.PHONY: figures
+129 -19
View File
@@ -290,6 +290,9 @@ options are supported:
- ptr
- Pointer to a ``Filesystem::IOProxy`` that will handle the I/O, for
example by reading from memory rather than the file system.
* - ``oiio:subimages``
- int
- The number of "image elements" (subimages) in the file.
**Configuration settings for DPX output**
@@ -547,6 +550,9 @@ storage. Currently, OpenImageIO only supports 2D FITS data (images), not 3D
* - ``Hierarch``
- string
- FITS "HIERARCH" (*)
* - ``oiio:subimages``
- int
- The number of subimages in the file.
* - *other*
-
- all other FITS keywords will be added to the ImageSpec as arbitrary
@@ -685,6 +691,11 @@ preferred except when legacy file access is required.
* - ``oiio:Gamma``
- float
- the gamma correction specified in the RGBE header (if it's gamma corrected).
* - ``heif:Orientation``
- int
- If the configuration option ``heif:reorient`` is nonzero and
reorientation was performed, this will be set to the original
orientation in the file.
**Configuration settings for HDR input**
@@ -704,6 +715,14 @@ options are supported:
- ptr
- Pointer to a ``Filesystem::IOProxy`` that will handle the I/O, for
example by reading from memory rather than the file system.
* - ``oiio:reorient``
- int
- The default of 1 means to let libheif auto-reorient the image to
undo the camera's orientation (this will set a "heif:Orientation"
metadata to the Exif orientation code indicating the original
orientation of the image). If this hint is set to 0, the pixels will be
left in their orientation as stored in the file, and the "Orientation"
metadata will reflect that.
**Configuration settings for HDR output**
@@ -750,6 +769,15 @@ currently supported for reading, but not yet writing. All pixel data is
uint8, though we hope to add support for HDR (more than 8 bits) in the
future.
The default behavior of the HEIF reader is to reorient the image to the
orientation indicated by the camera, and to report the "Orientation" metadata
as 1 (indicating that the image should be displayed as returned) and set the
"oiio:OriginalOrientation" metadata to what was originally stored in the file.
If you want to read the image without automatic reorientation, you can set the
configuration option "oiio:reorient" to 0, in which case the pixels will be
left in their orientation as stored in the file, and the "Orientation"
metadata will reflect that.
**Configuration settings for HEIF input**
When opening an HEIF ImageInput with a *configuration* (see
@@ -769,6 +797,12 @@ attributes are supported:
cause the reader to leave alpha unassociated (versus the default of
premultiplying color channels by alpha if the alpha channel is
unassociated).
* - ``oiio:reorient``
- int
- If nonzero, asks libheif to reorient any images (and report them as
having Orientation 1). If zero, then libheif will not reorient the
image and the Orientation metadata will be set to reflect the camera
orientation.
**Configuration settings for HEIF output**
@@ -1188,6 +1222,10 @@ Apple M4V :file:`.m4v`
MPEG-1/MPEG-2 :file:`.mpg`
===================== ====================================================
The format list include may other file types as well. We rely on the
:program:`ffmpeg` library to read these files, so the actual list of supported
formats may vary depending on the version of :program:`ffmpeg` that was linked
into OpenImageIO.
Currently, these files may only be read. Write support may be added in a
future release. Also, currently, these files simply look to OIIO like
@@ -1210,10 +1248,7 @@ Some special attributes are used for movie files:
- Nonzero value for movie files
* - ``oiio:subimages``
- int
- The number of frames in the movie, positive if it can be known
without reading the entire file. Zero or not present if the number
of frames cannot be determinend from reading from just the file
header.
- The number of frames (subimages) in the movie.
* - ``FramesPerSecond``
- int[2] (rational)
- Frames per second
@@ -1349,6 +1384,9 @@ The official OpenEXR site is http://www.openexr.com/.
* - ``captureRate``
- int[2]
- Frames per second capture rate (vecsemantics will be marked as RATIONAL)
* - ``oiio:subimages``
- int
- The number of "parts" (subimages) in the file.
* - ``smpte:TimeCode``
- int[2]
- SMPTE time code (vecsemantics will be marked as TIMECODE)
@@ -1365,6 +1403,11 @@ The official OpenEXR site is http://www.openexr.com/.
* - ``openexr:dwaCompressionLevel``
- float
- compression level for dwaa or dwab compression (default: 45.0).
* - ``openexr::luminancechroma``
- int
- If nonzero, indicates whether the image is a luminance-chroma image.
Upon reading, the subsampled Y/BY/RY(/A) channels of luminance-chroma
images are automatically converted to RGB(A) channels.
* - *other*
-
- All other attributes will be added to the ImageSpec by their name and
@@ -1446,6 +1489,11 @@ by :file:`libIlmImf`.
data. OpenImageIO's OpenEXR writer will silently convert data in formats
(including the common UINT8 and UINT16 cases) to HALF data for output.
* Subsampled channels are not supported with the exception of reading
luminance-chroma images with vertical and horizontal sampling rates of 2.
This limited support does not work when OpenEXR's C Core API in used, only
when OpenEXR's C++ API is used. Furthermore, it does not work in
combination with tiles, multiple subimages, mipmapping, or deep pixels.
|
@@ -1481,6 +1529,9 @@ report as tiled, using the leaf dimension size.
* - ``oiio:subimagename``
- string
- unique layer name
* - ``oiio:subimages``
- int
- The number of "layers" (subimages) in the file.
* - ``openvdb:indextoworld``
- matrix of doubles
- conversion of voxel index to world space coordinates.
@@ -1601,6 +1652,13 @@ control aspects of the writing itself:
(``PNG_FILTER_UP``), 64 (``PNG_FILTER_AVG``), or 128
(``PNG_FILTER_PAETH``).
**Important**: We have noticed that 8 (PNG_FILTER_NONE) is much
faster than the default of NO_FILTERS (sometimes 3x or more faster),
but it also makes the resulting files quite a bit larger (sometimes
2x larger). If you need to optimize PNG write speed and are willing
to have larger PNG files on disk, you may want to use that value for
this attribute.
**Custom I/O Overrides**
PNG input and output both support the "custom I/O" feature via the special
@@ -1633,22 +1691,38 @@ and :ref:`sec-imageinput-ioproxy`) as well as the `set_ioproxy()` methods.
PNM / Netpbm
===============================================
The Netpbm project, a.k.a. PNM (portable "any" map) defines PBM, PGM,
and PPM (portable bitmap, portable graymap, portable pixmap) files.
The Netpbm project, a.k.a. PNM (portable "any" map) defines PBM, PGM, PPM
and later added PFM (portable float map) as a set of simple image formats
(portable bitmap, portable graymap, portable pixmap) files.
Without loss of generality, we will refer to these all collectively as
"PNM." These files have extensions :file:`.pbm`, :file:`.pgm`, and
:file:`.ppm` and customarily correspond to bi-level bitmaps, 1-channel
grayscale, and 3-channel RGB files, respectively, or :file:`.pnm` for
those who reject the nonsense about naming the files depending on the
"PNM." These files have extensions :file:`.pbm`, :file:`.pgm`,
:file:`.ppm`, :file:`.pfm` and customarily correspond to bi-level bitmaps,
1-channel grayscale, and 3-channel RGB files, respectively, or :file:`.pnm`
for those who reject the nonsense about naming the files depending on the
number of channels and bitdepth.
PNM files are not much good for anything, but because of their
historical significance and extreme simplicity (that causes many
"amateur" programs to write images in these formats), OpenImageIO
supports them. PNM files do not support floating point images, anything
other than 1 or 3 channels, no tiles, no multi-image, no MIPmapping.
It's not a smart choice unless you are sending your images back to the
1980's via a time machine.
PNM files are widely used in the Unix world as simple ASCII or binary image
files that are easy to read and write. They are not compressed, and are
not particularly efficient for large images. They are not widely used in
the professional graphics world, but because of their historical
significance and extreme simplicity, OpenImageIO supports them.
PNM files do not support anything other than 1 or 3 channels, no tiles,
no multi-image, no MIPmapping.
The pbm, pgm, and ppm varieties are stored with scanlines ordered in the
file as top-to-bottom (the same as the usual OIIO convention), but the
float-based pfm files are conventionally ordered in the file as
bottom-to-top. Therefore, by default, reading and writing of the pfm
variety will automatically flip the image so that an application calling
the OpenImageIO API can, as usual, assume that scanline 0 is the visual
"top" (even though it is actually the last scanline stored in the file).
Both the reader and writer accept configuration hints "pnm:pfmflip"
(default: 1), which if set to 0 will disable this flipping and ensure
that scanline 0 is written as the first in the file (therefore
representing what PFM assumes is the visual "bottom" of the image).
This hint only affects PFM files and has no effect on the pbm, pgm,
or ppm varieties.
**Attributes**
@@ -1686,6 +1760,16 @@ attributes are supported:
- ptr
- Pointer to a ``Filesystem::IOProxy`` that will handle the I/O, for
example by reading from memory rather than the file system.
* - ``pnm:bigendian``
- int
- If nonzero, the PNM file is big-endian (the default is little-endian).
* - ``pnm:pfmflip``
- int
- If this configuration hint is present and is zero, the automatic
vertical flipping of PFM image will be disabled (i.e., scanline 0 will
really be the first one stored in the file). If nonzero (the default),
float PFM files will store scanline 0 as the last scanline in the file
(i.e. the visual "top" of the image).
**Configuration settings for PNM output**
@@ -1708,6 +1792,23 @@ control aspects of the writing itself:
- ptr
- Pointer to a ``Filesystem::IOProxy`` that will handle the I/O, for
example by writing to a memory buffer.
* - ``pnm:bigendian``
- int
- If nonzero, the PNM file is big-endian (the default is little-endian).
* - ``pnm:binary``
- int
- nonzero if the file itself used the PNM binary format, 0 if it used
ASCII. The PNM writer honors this attribute in the ImageSpec to
determine whether to write an ASCII or binary file.
Float PFM files are always written in binary format.
* - ``pnm:pfmflip``
- int
- If this configuration hint is present and is zero, for PFM files,
scanline 0 will really be stored first in the file, thus disabling the
usual automatically flipping that accounts for PFM files conventionally
being stored in bottom-to-top order. If nonzero (the default), float
PFM files will store scanline 0 as the last scanline in the file (i.e.
the visual "top" of the image).
**Custom I/O Overrides**
@@ -1919,8 +2020,17 @@ options are supported:
- int
- Set libraw user flip value : -1 ignored, other values are between [0; 8] with the same
definition than the Exif orientation code.
* - ``raw:threshold``
- float
- Libraw parameter for noise reduction through wavelet denoising.
The best threshold should be somewhere between 100 and 1000.
(Default: 0.0)
* - ``raw:fbdd_noiserd``
- int
- Controls FBDD noise reduction before demosaic.
0 - do not use FBDD noise reduction, 1 - light FBDD reduction,
2 (and more) - full FBDD reduction
(Default: 0)
|
+1 -1
View File
@@ -36,4 +36,4 @@ http://creativecommons.org/licenses/by/4.0/
OpenImageIO incorporates code from several other software packages with
compatible licenses. Copies of their licenses are reproduced here:
https://github.com/OpenImageIO/oiio/blob/master/THIRD-PARTY.md
https://github.com/AcademySoftwareFoundation/OpenImageIO/blob/master/THIRD-PARTY.md
+1 -1
View File
@@ -2,7 +2,7 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/OpenImageIO/oiio
# https://github.com/AcademySoftwareFoundation/OpenImageIO
# Format the output from various oiio command line "$tool --help" invocations,
# and munge such that txt2man generates a simple man page with not-too-horrible
+4 -1
View File
@@ -26,12 +26,15 @@ Using `idiff`
The `idiff` utility is invoked as follows:
`idiff` [*options*] *image1* *image2*
`idiff` [*options*] *input1* *input2|directory*
Where *input1* and *input2* are the names of two image files that should be
compared. They may be of any format recognized by OpenImageIO (i.e., for
which image-reading plugins are available).
When a *directory* is specified instead of *input2* then `idiff` will use
the same-named file as *input1* in the specified directory.
If the two input images are not the same resolutions, or do not have the
same number of channels, the comparison will return FAILURE immediately and
will not attempt to compare the pixels of the two images. If they are the
+204 -292
View File
@@ -37,24 +37,22 @@ Most ImageBufAlgo functions that produce image data come in two forms:
case, an entirely new image will be created to hold the result. In case of
error, the result image returned can have any error conditions checked with
`has_error()` and `geterror()`.
.. tabs::
.. code-tab:: c++
// Method 1: Return an image result
ImageBuf dst = ImageBufAlgo::over (fg, bg);
if (dst.has_error())
std::cout << "error: " << dst.geterror() << "\n";
.. code-tab:: py
# Method 1: Return an image result
fg = ImageBuf("fg.exr")
bg = ImageBuf("bg.exr")
dst = ImageBufAlgo.over (fg, bg)
if dst.has_error() :
print("error:", dst.geterror())
.. tabs::
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-output-error1
:end-before: END-imagebufalgo-output-error1
:dedent: 4
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-output-error1
:end-before: END-imagebufalgo-output-error1
:dedent: 4
2. Pass a destination ImageBuf reference as the first parameter.
@@ -64,27 +62,22 @@ Most ImageBufAlgo functions that produce image data come in two forms:
function succeeds or `false` if the function fails. Upon failure, the
destination ImageBuf (the one that is being altered) will have an error
message set.
.. tabs::
.. code-tab:: c++
// Method 2: Write into an existing image
ImageBuf fg ("fg.exr"), bg ("bg.exr");
ImageBuf dst; // will be the output image
bool ok = ImageBufAlgo::over (dst, fg, bg);
if (! ok)
std::cout << "error: " << dst.geterror() << "\n";
.. code-tab:: py
# Method 2: Write into an existing image
fg = ImageBuf("fg.exr")
bg = ImageBuf("bg.exr")
dst = ImageBuf() # will be the output image
ok = ImageBufAlgo.over (dst, fg, bg)
if not ok :
print("error:", dst.geterror())
.. tabs::
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-output-error2
:end-before: END-imagebufalgo-output-error2
:dedent: 4
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-output-error2
:end-before: END-imagebufalgo-output-error2
:dedent: 4
The first option (return an ImageBuf directly) is a more compact and
@@ -188,58 +181,34 @@ zero() -- create a black image
Examples:
.. tabs::
.. code-tab:: c++
// Create a new 3-channel, 512x512 float image filled with 0.0 values.
ImageBuf zero = ImageBufAlgo::zero (ROI(0,512,0,512,0,1,0,3));
// Zero out an existing buffer, keeping it the same size and data type
ImageBuf A = ...;
...
ImageBufAlgo::zero (A);
// Zero out just the green channel, leave everything else the same
ROI roi = A.roi ();
roi.chbegin = 1; // green
roi.chend = 2; // one past the end of the channel region
ImageBufAlgo::zero (A, roi);
// Zero out a rectangular region of an existing buffer
ImageBufAlgo::zero (A, ROI (0, 100, 0, 100));
.. code-tab:: py
# Create a new 3-channel, 512x512 float image filled with 0.0 values.
zero = ImageBufAlgo.zero (ROI(0,512,0,512,0,1,0,3))
# Zero out an existing buffer, keeping it the same size and data type
A = ImageBuf(...)
...
ImageBufAlgo.zero (A)
# Zero out just the green channel, leave everything else the same
roi = A.roi
roi.chbegin = 1 # green
roi.chend = 2 # one past the end of the channel region
ImageBufAlgo.zero (A, roi)
# Zero out a rectangular region of an existing buffer
ImageBufAlgo.zero (A, ROI (0, 100, 0, 100))
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-zero
:end-before: END-imagebufalgo-zero
:dedent: 4
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-zero
:end-before: END-imagebufalgo-zero
:dedent: 4
.. code-tab:: bash oiiotool
# Create a new 3-channel, 512x512 float image filled with 0.0 values.
oiiotool --create 512x512 3 -d float -o out.exr
# Zero out an existing image, keeping it the same size and data type.
# For simplicity, just scale all values by 0.0
oiiotool in.exr --mulc 0.0 -o out.exr
# Zero out just the green channel, leave everything else the same.
# Again, rely on --mulc to scale the channels
oiiotool in.exr --mulc 1,0,1 -o out.exr
# Zero out a rectangular region of an existing image
oiiotool in.exr --fill:color=0,0,0 100x100+0+0 -o out.exr
@@ -254,29 +223,20 @@ fill() -- fill a region with a solid color or gradient
Examples:
.. tabs::
.. code-tab:: c++
// Create a new 640x480 RGB image, with a top-to-bottom gradient
// from red to pink
float pink[3] = { 1, 0.7, 0.7 };
float red[3] = { 1, 0, 0 };
ImageBuf A = ImageBufAlgo::fill (red, pink, ROI(0, 640, 0, 480, 0, 1, 0, 3));
// Draw a filled red rectangle overtop existing image A.
ImageBufAlgo::fill (A, red, ROI(50, 100, 75, 175));
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-fill
:end-before: END-imagebufalgo-fill
:dedent: 4
.. code-tab:: py
# Create a new 640x480 RGB image, with a top-to-bottom gradient
# from red to pink
pink = (1, 0.7, 0.7)
red = (1, 0, 0)
A = ImageBufAlgo.fill (top=red, bottom=pink,
ROI(0, 640, 0, 480, 0, 1, 0, 3))
# Draw a filled red rectangle overtop existing image A.
ImageBufAlgo.fill (A, red, ROI(50, 100, 75, 175))
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-fill
:end-before: END-imagebufalgo-fill
:dedent: 4
.. code-tab:: bash oiiotool
@@ -307,24 +267,19 @@ checker() -- make a checker pattern
.. tabs::
.. code-tab:: c++
// Create a new 640x480 RGB image, fill it with a two-toned gray
// checkerboard, the checkers being 64x64 pixels each.
ImageBuf A (ImageSpec(640, 480, 3, TypeDesc::FLOAT);
float dark[3] = { 0.1, 0.1, 0.1 };
float light[3] = { 0.4, 0.4, 0.4 };
ImageBufAlgo::checker (A, 64, 64, 1, dark, light, 0, 0, 0);
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-checker
:end-before: END-imagebufalgo-checker
:dedent: 4
.. code-tab:: py
# Create a new 640x480 RGB image, fill it with a two-toned gray
# checkerboard, the checkers being 64x64 pixels each.
A = ImageBuf (ImageSpec(640, 480, 3, "float")
dark = (0.1, 0.1, 0.1)
light = (0.4, 0.4, 0.4)
A = ImageBufAlgo.checker (64, 64, 1, dark, light,
roi=ROI(0, 640, 0, 480, 0, 1, 0, 3))
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-checker
:end-before: END-imagebufalgo-checker
:dedent: 4
.. code-tab:: bash oiiotool
@@ -352,43 +307,20 @@ Noise patterns
Examples:
.. tabs::
.. code-tab:: c++
// Create a new 256x256 field of grayscale white noise on [0,1)
ImageBuf A = ImageBufAlgo::noise ("uniform", 0.0f /*min*/, 1.0f /*max*/,
true /*mono*/, 1 /*seed*/, ROI(0,256,0,256,0,1,0,3));
// Create a new 256x256 field of grayscale white noise on [0,1)
ImageBuf B = ImageBufAlgo::noise ("blue", 0.0f /*min*/, 1.0f /*max*/,
true /*mono*/, 1 /*seed*/, ROI(0,256,0,256,0,1,0,3));
// Add color Gaussian noise to an existing image
ImageBuf C ("tahoe.jpg");
ImageBufAlgo::noise (C, "gaussian", 0.0f /*mean*/, 0.1f /*stddev*/,
false /*mono*/, 1 /*seed*/);
// Use salt and pepper noise to make occasional random dropouts
ImageBuf D ("tahoe.jpg");
ImageBufAlgo::noise (D, "salt", 0.0f /*value*/, 0.01f /*portion*/,
true /*mono*/, 1 /*seed*/);
.. code-tab:: py
# Create a new 256x256 field of grayscale white noise on [0,1)
A = ImageBufAlgo.noise ("uniform", min=0.0, max=1.0, mono=True, seed=1,
roi = ROI(0,256,0,256,0,1,0,3))
# Create a new 256x256 field of grayscale blue noise on [0,1)
B = ImageBufAlgo.noise ("blue", min=0.0, max=1.0, mono=True, seed=1,
roi = ROI(0,256,0,256,0,1,0,3))
# Add color Gaussian noise to an existing image
C = ImageBuf ("tahoe.jpg")
ImageBufAlgo.noise (C, "gaussian", A=0.0, B=0.1, mono=False, seed=1)
# Use salt and pepper noise to make occasional random dropouts
D = ImageBuf ("tahoe.jpg")
ImageBufAlg.noise (D, "salt", A=0.0, B=0.01, mono=True, seed=1)
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-noise1
:end-before: END-imagebufalgo-noise1
:dedent: 4
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-noise1
:end-before: END-imagebufalgo-noise1
:dedent: 4
.. code-tab:: bash oiiotool
@@ -432,15 +364,20 @@ Noise patterns
Example:
.. tabs::
.. code-tab:: c++
const ImageBuf& A = ImageBufAlgo::bluenoise_image();
.. code-tab:: py
A = ImageBufAlgo.bluenoise_image()
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-noise2
:end-before: END-imagebufalgo-noise2
:dedent: 4
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-noise2
:end-before: END-imagebufalgo-noise2
:dedent: 4
Drawing shapes: points, lines, boxes
@@ -452,18 +389,20 @@ Drawing shapes: points, lines, boxes
Examples:
.. tabs::
.. code-tab:: c++
ImageBuf A (ImageSpec (640, 480, 4, TypeDesc::FLOAT));
float red[4] = { 1, 0, 0, 1 };
ImageBufAlgo::render_point (A, 50, 100, red);
.. code-tab:: py
A = ImageBuf(ImageSpec(640, 480, 4, "float"))
red = (1, 0, 0, 1)
ImageBufAlgo.render_point (A, 50, 100, red)
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-point
:end-before: END-imagebufalgo-point
:dedent: 4
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-point
:end-before: END-imagebufalgo-point
:dedent: 4
.. code-tab:: bash oiiotool
@@ -478,20 +417,20 @@ Drawing shapes: points, lines, boxes
Examples:
.. tabs::
.. code-tab:: c++
ImageBuf A (ImageSpec (640, 480, 4, TypeDesc::FLOAT));
float red[4] = { 1, 0, 0, 1 };
ImageBufAlgo::render_line (A, 10, 60, 250, 20, red);
ImageBufAlgo::render_line (A, 250, 20, 100, 190, red, true);
.. code-tab:: py
A = ImageBuf(ImageSpec(640, 480, 4, "float"))
red = (1, 0, 0, 1)
ImageBufAlgo.render_line (A, 10, 60, 250, 20, red);
ImageBufAlgo.render_line (A, 250, 20, 100, 190, red, True)
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-lines
:end-before: END-imagebufalgo-lines
:dedent: 4
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-lines
:end-before: END-imagebufalgo-lines
:dedent: 4
.. code-tab:: bash oiiotool
@@ -510,21 +449,19 @@ Drawing shapes: points, lines, boxes
.. tabs::
.. code-tab:: c++
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-box
:end-before: END-imagebufalgo-box
:dedent: 4
ImageBuf A (ImageSpec (640, 480, 4, TypeDesc::FLOAT));
float cyan[4] = { 0, 1, 1, 1 };
float yellow_transparent[4] = { 0.5, 0.5, 0, 0.5 };
ImageBufAlgo::render_box (A, 150, 100, 240, 180, cyan);
ImageBufAlgo::render_box (A, 100, 50, 180, 140, yellow_transparent, true);
.. code-tab:: py
A = ImageBuf(ImageSpec(640, 480, 4, "float"))
cyan = (0, 1, 1, 1)
yellow_transparent = (0.5, 0.5, 0, 0.5)
ImageBufAlgo.render_box (A, 150, 100, 240, 180, cyan)
ImageBufAlgo.render_box (A, 100, 50, 180, 140, yellow_transparent, fill=True)
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-box
:end-before: END-imagebufalgo-box
:dedent: 4
.. code-tab:: bash oiiotool
@@ -548,29 +485,19 @@ Drawing text
.. tabs::
.. code-tab:: c++
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-text1
:end-before: END-imagebufalgo-text1
:dedent: 4
ImageBufAlgo::render_text (ImgA, 50, 100, "Hello, world");
float red[] = { 1, 0, 0, 1 };
ImageBufAlgo::render_text (ImgA, 100, 200, "Go Big Red!",
60, "Arial Bold", red);
float white[] = { 1, 1, 1, 1 };
ImageBufAlgo::render_text (ImgB, 320, 240, "Centered",
60, "Arial Bold", white,
TextAlignX::Center, TextAlignY::Center);
.. code-tab:: py
ImageBufAlgo.render_text (ImgA, 50, 100, "Hello, world")
red = (1, 0, 0, 1)
ImageBufAlgo.render_text (ImgA, 100, 200, "Go Big Red!",
60, "Arial Bold", red)
white = (1, 1, 1, 1)
ImageBufAlgo.render_text (ImgB, 320, 240, "Centered",
fontsize=60, fontname="Arial Bold",
color=white, alignx="center", aligny="center")
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-text1
:end-before: END-imagebufalgo-text1
:dedent: 4
.. code-tab:: bash oiiotool
@@ -602,30 +529,19 @@ Drawing text
.. tabs::
.. code-tab:: c++
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-text2
:end-before: END-imagebufalgo-text2
:dedent: 4
// Render text centered in the image, using text_size to find out
// the size we will need and adjusting the coordinates.
ImageBuf A (ImageSpec (640, 480, 4, TypeDesc::FLOAT));
ROI Aroi = A.roi();
ROI size = ImageBufAlgo::text_size ("Centered", 48, "Courier New");
if (size.defined()) {
int x = Aroi.xbegin + Aroi.width()/2 - (size.xbegin + size.width()/2);
int y = Aroi.ybegin + Aroi.height()/2 - (size.ybegin + size.height()/2);
ImageBufAlgo::render_text (A, x, y, "Centered", 48, "Courier New");
}
.. code-tab:: py
# Render text centered in the image, using text_size to find out
# the size we will need and adjusting the coordinates.
A = ImageBuf (ImageSpec (640, 480, 4, "float"))
Aroi = A.roi
size = ImageBufAlgo.text_size ("Centered", 48, "Courier New")
if size.defined() :
x = Aroi.xbegin + Aroi.width//2 - (size.xbegin + size.width//2)
y = Aroi.ybegin + Aroi.height//2 - (size.ybegin + size.height//2)
ImageBufAlgo.render_text (A, x, y, "Centered", 48, "Courier New")
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-text2
:end-before: END-imagebufalgo-text2
:dedent: 4
@@ -998,19 +914,27 @@ Shuffling channels
.. tabs::
.. code-tab:: c++
.. tab:: C++
ImageBuf A ("grid.jpg");
ImageBuf B = ImageBufAlgo::circular_shift (A, 70, 30);
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-cshift
:end-before: END-imagebufalgo-cshift
:dedent: 4
.. code-tab:: py
.. tab:: Python
A = ImageBuf("tahoe.jpg")
A = ImageBufAlgo.circular_shift (A, 70, 30)
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: c++
:start-after: BEGIN-imagebufalgo-cshift
:end-before: END-imagebufalgo-cshift
:dedent: 4
.. code-tab:: bash oiiotool
.. tab:: oiiotool
oiiotool tahoe.jpg --cshift +70+30 -o out.jpg
.. code-block:: bash
oiiotool tahoe.jpg --cshift +70+30 -o out.jpg
.. |cshiftimg1| image:: figures/grid-small.jpg
:width: 2.0 in
@@ -1063,8 +987,6 @@ Shuffling channels
.. doxygengroup:: resize
..
Examples::
Examples:
.. tabs::
@@ -2806,11 +2728,11 @@ Color space conversion
|
.. doxygenfunction:: colormatrixtransform(const ImageBuf &src, const Imath::M44f &M, bool unpremult = true, ROI roi = {}, int nthreads = 0)
.. doxygenfunction:: colormatrixtransform(const ImageBuf &src, M44fParam M, bool unpremult = true, ROI roi = {}, int nthreads = 0)
..
Result-as-parameter version:
.. doxygenfunction:: colormatrixtransform(ImageBuf &dst, const ImageBuf &src, const Imath::M44f &M, bool unpremult = true, ROI roi = {}, int nthreads = 0)
.. doxygenfunction:: colormatrixtransform(ImageBuf &dst, const ImageBuf &src, M44fParam M, bool unpremult = true, ROI roi = {}, int nthreads = 0)
Examples:
@@ -2853,11 +2775,11 @@ Color space conversion
|
.. doxygenfunction:: ociolook(const ImageBuf &src, string_view looks, string_view fromspace, string_view tospace, bool unpremult = true, bool inverse = false, string_view context_key = "", string_view context_value = "", ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
.. doxygenfunction:: ociolook(const ImageBuf &src, string_view looks, string_view fromspace, string_view tospace, bool unpremult = true, bool inverse = false, string_view context_key = "", string_view context_value = "", const ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
..
Result-as-parameter version:
.. doxygenfunction:: ociolook(ImageBuf &dst, const ImageBuf &src, string_view looks, string_view fromspace, string_view tospace, bool unpremult = true, bool inverse = false, string_view context_key = "", string_view context_value = "", ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
.. doxygenfunction:: ociolook(ImageBuf &dst, const ImageBuf &src, string_view looks, string_view fromspace, string_view tospace, bool unpremult = true, bool inverse = false, string_view context_key = "", string_view context_value = "", const ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
Examples:
@@ -2881,11 +2803,11 @@ Color space conversion
|
.. doxygenfunction:: ociodisplay(const ImageBuf &src, string_view display, string_view view, string_view fromspace = "", string_view looks = "", bool unpremult = true, string_view context_key = "", string_view context_value = "", ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
.. doxygenfunction:: ociodisplay(const ImageBuf &src, string_view display, string_view view, string_view fromspace = "", string_view looks = "", bool unpremult = true, bool inverse = false, string_view context_key = "", string_view context_value = "", const ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
..
Result-as-parameter version:
.. doxygenfunction:: ociodisplay(ImageBuf &dst, const ImageBuf &src, string_view display, string_view view, string_view fromspace = "", string_view looks = "", bool unpremult = true, string_view context_key = "", string_view context_value = "", ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
.. doxygenfunction:: ociodisplay(ImageBuf &dst, const ImageBuf &src, string_view display, string_view view, string_view fromspace = "", string_view looks = "", bool unpremult = true, bool inverse = false, string_view context_key = "", string_view context_value = "", const ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
Examples:
@@ -2909,11 +2831,11 @@ Color space conversion
|
.. doxygenfunction:: ociofiletransform(const ImageBuf &src, string_view name, bool unpremult = true, bool inverse = false, ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
.. doxygenfunction:: ociofiletransform(const ImageBuf &src, string_view name, bool unpremult = true, bool inverse = false, const ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
..
Result-as-parameter version:
.. doxygenfunction:: ociofiletransform(ImageBuf &dst, const ImageBuf &src, string_view name, bool unpremult = true, bool inverse = false, ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
.. doxygenfunction:: ociofiletransform(ImageBuf &dst, const ImageBuf &src, string_view name, bool unpremult = true, bool inverse = false, const ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
Examples:
@@ -3003,41 +2925,31 @@ Import / export
Examples:
.. tabs::
.. code-tab:: c++
.. tabs::
ImageBuf Input ("in.exr");
ImageSpec config;
config["maketx:highlightcomp"] = 1;
config["maketx:filtername"] = "lanczos3";
config["maketx:opaque_detect"] = 1;
bool ok = ImageBufAlgo::make_texture (ImageBufAlgo::MakeTxTexture,
Input, "texture.exr", config);
if (! ok)
std::cout << "make_texture error: " << OIIO::geterror() << "\n";
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imagebufalgo.cpp
:language: c++
:start-after: BEGIN-imagebufalgo-make-texture
:end-before: END-imagebufalgo-make-texture
:dedent: 4
.. code-tab:: py
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imagebufalgo.py
:language: py
:start-after: BEGIN-imagebufalgo-make-texture
:end-before: END-imagebufalgo-make-texture
:dedent: 4
Input = ImageBuf("in.exr")
config = ImageSpec()
config["maketx:highlightcomp"] = 1
config["maketx:filtername"] = "lanczos3"
config["maketx:opaque_detect"] = 1
ok = ImageBufAlgo.make_texture (OpenImageIO.MakeTxTexture,
Input, "texture.exr", config)
if not ok :
print("make_texture error:", OpenImageIO.geterror())
.. tab:: oiiotool
.. sourcecode:: bash
oiiotool in.exr -otex:hilightcomp=1:filtername=lanczos3:opaque_detect=1 texture.exr
.. code-tab:: bash oiiotool
.. tab:: maketx
.. sourcecode:: bash
oiiotool in.exr -otex:hilightcomp=1:filtername=lanczos3:opaque_detect=1 texture.exr
.. code-tab:: bash maketx
maketx in.exr --hicomp --filter lanczos3 --opaque-detect -o texture.exr
maketx in.exr --hicomp --filter lanczos3 --opaque-detect -o texture.exr
|
+14 -28
View File
@@ -20,35 +20,17 @@ memory, even if that's not the way they're stored in the file):
.. tabs::
.. code-tab:: c++
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imageinput.cpp
:language: c++
:start-after: BEGIN-imageinput-simple
:end-before: END-imageinput-simple
#include <OpenImageIO/imageio.h>
using namespace OIIO;
...
auto inp = ImageInput::open(filename);
if (! inp)
return;
const ImageSpec &spec = inp->spec();
int xres = spec.width;
int yres = spec.height;
int nchannels = spec.nchannels;
auto pixels = std::unique_ptr<unsigned char[]>(new unsigned char[xres * yres * nchannels]);
inp->read_image(0, 0, 0, nchannels, TypeDesc::UINT8, &pixels[0]);
inp->close();
.. code-tab:: py
import OpenImageIO as oiio
inp = oiio.ImageInput.open(filename)
if inp :
spec = inp.spec()
xres = spec.width
yres = spec.height
nchannels = spec.nchannels
pixels = inp.read_image(0, 0, 0, nchannels, "uint8")
inp.close()
.. tab:: Python
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imageinput.py
:language: py
:start-after: BEGIN-imageinput-simple
:end-before: END-imageinput-simple
Here is a breakdown of what work this code is doing:
@@ -941,6 +923,10 @@ hints are supported by each reader) are:
cause the reader to leave alpha unassociated (versus the default of
premultiplying color channels by alpha if the alpha channel is
unassociated).
* - ``oiio:reorient``
- int
- If zero, disables any automatic reorientation that the reader may
ordinarily do to present te pixels in the preferred display orientation.
Examples:
+40 -70
View File
@@ -18,42 +18,19 @@ to a file:
.. tabs::
.. code-tab:: c++
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imageoutput.cpp
:language: c++
:start-after: BEGIN-imageoutput-simple
:end-before: END-imageoutput-simple
#include <OpenImageIO/imageio.h>
using namespace OIIO;
...
.. tab:: Python
const char *filename = "foo.jpg";
const int xres = 640, yres = 480;
const int channels = 3; // RGB
unsigned char pixels[xres * yres * channels];
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imageoutput.py
:language: py
:start-after: BEGIN-imageoutput-simple
:end-before: END-imageoutput-simple
std::unique_ptr<ImageOutput> out = ImageOutput::create (filename);
if (! out)
return;
ImageSpec spec (xres, yres, channels, TypeDesc::UINT8);
out->open (filename, spec);
out->write_image (TypeDesc::UINT8, pixels);
out->close ();
.. code-tab:: py
import OpenImageIO as oiio
import numpy as np
filename = "foo.jpg"
xres = 640
yres = 480
channels = 3 # RGB
pixels = np.zeros((yres, xres, channels), dtype=np.uint8)
out = oiio.ImageOutput.create (filename)
if out:
spec = oiio.ImageSpec(xres, yres, channels, 'uint8')
out.open (filename, spec)
out.write_image (pixels)
out.close ()
This little bit of code does a surprising amount of useful work:
@@ -73,7 +50,7 @@ This little bit of code does a surprising amount of useful work:
out = ImageOutput.create (filename)
* Open the file, write the correct headers, and in all other important ways
prepare a file with the given dimensions (640 x 480), number of color
prepare a file with the given dimensions (320 x 240), number of color
channels (3), and data format (unsigned 8-bit integer).
.. tabs::
@@ -172,33 +149,26 @@ time, one tile at a time, or by individual rectangles.
Writing individual scanlines
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Individual scanlines may be written using the ``writescanline()`` API call:
Individual scanlines may be written using the ``write_scanline()`` API call:
.. tabs::
.. code-tab:: c++
.. tab:: C++
.. literalinclude:: ../../testsuite/docs-examples-cpp/src/docs-examples-imageoutput.cpp
:language: c++
:start-after: BEGIN-imageoutput-scanlines
:end-before: END-imageoutput-scanlines
:dedent: 4
unsigned char scanline[xres*channels];
out->open (filename, spec);
int z = 0; // Always zero for 2D images
for (int y = 0; y < yres; ++y) {
... generate data in scanline[0..xres*channels-1] ...
out->write_scanline (y, z, TypeDesc::UINT8, scanline);
}
out->close ();
.. tab:: Python
.. code-tab:: py
.. literalinclude:: ../../testsuite/docs-examples-python/src/docs-examples-imageoutput.py
:language: py
:start-after: BEGIN-imageoutput-scanlines
:end-before: END-imageoutput-scanlines
:dedent: 8
out.open (filename, spec)
z = 0 # Always zero for 2D images
for y in range(yres) :
# generate data in scanline[0..xres*channels-1] ...
scanline = ...
out.write_scanline (y, z, scanline)
}
out.close ()
The first two arguments to ``writescanline()`` specify which scanline is
The first two arguments to ``write_scanline()`` specify which scanline is
being written by its vertical (*y*) scanline number (beginning with 0)
and, for volume images, its slice (*z*) number (the slice number should
be 0 for 2D non-volume images). This is followed by a `TypeDesc`
@@ -212,7 +182,7 @@ All ``ImageOutput`` implementations will accept scanlines in strict order
any). See Section :ref:`sec-imageoutput-random-access-pixels` for details
on out-of-order or repeated scanlines.
The full description of the ``writescanline()`` function may be found
The full description of the ``write_scanline()`` function may be found
in Section :ref:`sec-imageoutput-class-reference`.
Writing individual tiles
@@ -220,7 +190,7 @@ Writing individual tiles
Not all image formats (and therefore not all ``ImageOutput``
implementations) support tiled images. If the format does not support
tiles, then ``writetile()`` will fail. An application using OpenImageIO
tiles, then ``write_tile()`` will fail. An application using OpenImageIO
should gracefully handle the case that tiled output is not available for
the chosen format.
@@ -297,7 +267,7 @@ individual plugin.
out.write_tile (x, y, z, tile)
out.close ()
The first three arguments to ``writetile()`` specify which tile is being
The first three arguments to ``write_tile()`` specify which tile is being
written by the pixel coordinates of any pixel contained in the tile: *x*
(column), *y* (scanline), and *z* (slice, which should always be 0 for 2D
non-volume images). This is followed by a `TypeDesc` describing the data
@@ -311,7 +281,7 @@ All ``ImageOutput`` implementations that support tiles will accept tiles in
strict order of increasing *y* rows, and within each row, increasing *x*
column, without missing any tiles. See
The full description of the ``writetile()`` function may be found
The full description of the ``write_tile()`` function may be found
in Section :ref:`sec-imageoutput-class-reference`.
Writing arbitrary rectangles
@@ -451,15 +421,15 @@ do not attempt to remap values, and do not clamp (except to their full
floating-point range).
It is not required that the pixel data passed to ``writeimage()``,
``writescanline()``, ``writetile()``, or ``write_rectangle()`` actually be
It is not required that the pixel data passed to ``write_image()``,
``write_scanline()``, ``write_tile()``, or ``write_rectangle()`` actually be
in the same data type as that requested as the native pixel data type of the
file. You can fully mix and match data you pass to the various "write"
routines and OpenImageIO will automatically convert from the internal format
to the native file format. For example, the following code will open a TIFF
file that stores pixel data as 16-bit unsigned integers (values ranging from
0 to 65535), compute internal pixel values as floating-point values, with
``writeimage()`` performing the conversion automatically:
``write_image()`` performing the conversion automatically:
.. tabs::
@@ -484,7 +454,7 @@ file that stores pixel data as 16-bit unsigned integers (values ranging from
out.write_image (pixels)
Note that ``writescanline()``, ``writetile()``, and ``write_rectangle()``
Note that ``write_scanline()``, ``write_tile()``, and ``write_rectangle()``
have a parameter that works in a corresponding manner.
@@ -507,13 +477,13 @@ passed to the "write" functions are *contiguous*, that is:
* for 3D volumetric images, the first pixel of slice *z* immediately
follows the last pixel of of slice ``z-1``.
Please note that this implies that data passed to ``writetile()`` be
Please note that this implies that data passed to ``write_tile()`` be
contiguous in the shape of a single tile (not just an offset into a whole
image worth of pixels), and that data passed to ``write_rectangle()`` be
contiguous in the dimensions of the rectangle.
The ``writescanline()`` function takes an optional ``xstride`` argument, and
the ``writeimage()``, ``writetile()``, and ``write_rectangle()`` functions
The ``write_scanline()`` function takes an optional ``xstride`` argument, and
the ``write_image()``, ``write_tile()``, and ``write_rectangle()`` functions
take optional ``xstride``, ``ystride``, and ``zstride`` values that describe
the distance, in *bytes*, between successive pixel columns, rows, and
slices, respectively, of the data you are passing. For any of these values
@@ -1152,8 +1122,8 @@ specification of the subimages at the time you first open the file.
out.write_image (pixels[s])
out.close ()
In both of these examples, we have used ``writeimage()``, but of course
``writescanline()``, ``writetile()``, and ``write_rectangle()`` work as you
In both of these examples, we have used ``write_image()``, but of course
``write_scanline()``, ``write_tile()``, and ``write_rectangle()`` work as you
would expect, on the current subimage.
@@ -1278,8 +1248,8 @@ used for texture mapping):
out.close ()
In this example, we have used ``writeimage()``, but of course
``writescanline()``, ``writetile()``, and ``write_rectangle()`` work as you
In this example, we have used ``write_image()``, but of course
``write_scanline()``, ``write_tile()``, and ``write_rectangle()`` work as you
would expect, on the current MIP level.

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