Compare commits

...
Author SHA1 Message Date
Larry Gritz b9f903e441 Typo 2022-07-01 16:52:51 -07:00
Larry Gritz 3c4c9f3163 CHANGES, ready for release of 2.2.21.0 2022-07-01 15:43:12 -07:00
Aras Pranckevičius be39e448f4 Build: allow "arm64" arch in make (#3456)
On Apple Silicon, `uname -m` returns `arm64`. The make platform detection script was allowing `aarch64`, so similar to that one, also allow `arm64`.
2022-07-01 15:43:12 -07:00
Larry Gritz 3dabbd80d4 TextureSystem: fix typo in attribute name (#3447)
Oops, calling it "m_max_tile_channels" (the name of the member
variable) instead of "max_tile_channels" (the name of the attribute)
actually prevented properly setting or retrieving the attribute by
name.
2022-07-01 15:43:11 -07:00
Larry Gritz beaa7feb12 BMP: protect against corroptions with palette indices out of bound (#3435)
If the BMP image we're reading declares a certain sized palette, but
then has pixels that contain values outside the range of that palette
size, we would read past the end of arrays.
2022-07-01 15:43:11 -07:00
Larry Gritz 407b3f9ea9 BMP: detect corrupted images (#3434)
Check for nonsensical image dimensions or total size before doing
buffer allocation.
2022-07-01 15:43:11 -07:00
Larry Gritz 5ae1fe0b2d TIFF: fix read problem with tiff files with non-zero y offset (#3419)
You'd think there would be no way that basic failure like this could
occur after 14 years, right?

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

Obviously, for TIFF files with a first scanline of 0 (the vast, vast
majority), failing to adjust by this offset doesn't matter. And also
as long as the reading continued to be strictly sequential, it also
was asymptomatic. But in the presence of certain multithreaded random
access patterns, it makes a difference. Oops.
2022-07-01 15:43:11 -07:00
Larry Gritz 363cf22492 Fix bmp test location 2022-07-01 14:59:25 -07:00
Larry Gritz b4fedf2ab1 BMP files - read additional varieties (#3375)
There are two undocumented varieties of BMP files only written by
certain Adobe apps that we did not properly handle, identified by the
size value in their header.

This is the only explanation I could find about it:
https://web.archive.org/web/20150127132443/https://forums.adobe.com/message/3272950
2022-07-01 12:32:10 -07:00
Larry Gritz b6f5f92add simd.h fixes for armv7 and aarch32 (#3361)
Some neon instructions are only aarch64, guard them better.

Fixes #3360
2022-07-01 12:05:25 -07:00
Larry Gritz 09028b27ae ffmpeg: make supported file extension check be case-insensitive (#3364)
The use of ends_with instead of iends_with made it so that
capitizalized files (especially on case-independent filesystems like
Windows or some Mac filesystems) were rejected.

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

Fixes #3362
2022-07-01 12:04:54 -07:00
Larry Gritz 1f4d7247d4 Update THIRD-PARTY info for OSL and OCIO with new URLs and copyright notices 2022-07-01 12:02:08 -07:00
Larry Gritz 7224c06c03 Avoid unsafe isspace() (#3310)
C isspace() takes an int, but on Windows when building in debug mode,
the implementation of isspace() can hit an assert if the value is < 0,
which of course it can be if you're looking at a character in a string
whose high bit is set (because char is signed).

Easiest solution is to make our own Strutil::isspace that does exactly
what we want and is safe.

Fixes #3300
2022-07-01 12:01:17 -07:00
Larry Gritz 86222fa067 ci: fix openexr master -> main rename, limit fmt version
Changes in fmt master (not yet any tagged release of fmt) break
things, but we're not going to backport the OIIO-side fixes all the
way back to OIIO 2.2. It works in 2.3 and 2.4.
2022-06-30 13:50:44 -07:00
Larry Gritz 75d04f9597 ustring: add OIIO_USTRING_HAS_USTRINGHASH symbol
This makes it easier for downstream users to test if ustringhash is
available in a particular version of OIIO.
2022-06-30 13:50:44 -07:00
Larry Gritz 553e2ef77e ustringhash (#3436)
ustring is a unique string (that lives in an internal hash table) whose
representation is the pointer to the characters that live in the table.

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

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

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

In the process of adding unit tests for ustringhash, I ended up
overhauling all of ustring_test.cpp, as I saw that the ustring tests
were extremely cursory. Did a tiny bit of (non-breaking) touch-ups
on a few ustring methods as well.
2022-06-30 13:50:44 -07:00
Larry Gritz f7845333ff ffmpeg reader: take care against possible double free (#3376)
In FFMpegInput::close(), some of the tear-down calls would happen
regardless of if their pointers were already null. Seemed safe, but
maybe not always? So check the pointers.

Fixes #3371
2022-06-28 23:17:20 -07:00
Bernhard Rosenkraenzer 573f2dfc45 Port to ffmpeg 5.0 (#3282)
Port to ffmpeg 5.0 -- av_register_all removed, AVPicture
removed, pkt_pts changed to pts

Signed-off-by: Bernhard Rosenkränzer <bero@lindev.ch>
2022-06-28 23:17:20 -07:00
Larry Gritz 51eb7a3ba0 Bump version after release 2022-06-28 23:17:20 -07:00
Larry Gritz 5f532c3461 ustring::from_hash() (#3397)
If you know the hash of a ustring, this tells you the ustring.
(Caveat: in the very unlikely chance of two ustrings having the same
hash, this will return the first one it finds in the table.)
2022-06-28 22:58:27 -07:00
Larry Gritz 8c1ab4bb18 CHANGES / 2.2.20 release 2022-02-01 09:17:30 -08:00
Larry Gritz 2aa4e56a0f Fix ImageBuf::read bug for images of mixed per-channel data types (#3088)
When it comes time to read_image() into the ImageBuf's internal
memory, we should have said to convert to `m_spec.format`, which
describes the buffer we allocated. Instead, we asked for `convert`,
which is the user request, which at that time can still be UNKNOWN,
which indicates to preserve the file's data format, which in fact does
not necessarily match the internal buffer.

This becomes especially troublesome for images with mixed per-channel
data types, which will obviously never match the internal buffer since
ImageBuf only internally stores one data format for all channels.
2022-02-01 01:07:12 -08:00
Larry Gritz 19f2946bf4 CI: fix CI breakage on this old branch
The container this test used has incompatible OpenEXR and OpenVDB.
So just disable OpenVDB.
2022-01-04 17:59:52 -08:00
Larry Gritz 7022828ce5 Turn off CI checking of clang-format
It's an obsolete branch, there's no point in inviting CI failures
just because of something backported from master whose formatting
standard has drifted slightly.
2022-01-04 17:57:34 -08:00
Larry Gritz 70fb4878f1 TIFF: make it work for 16-bit palette images (#3260) 2022-01-04 11:47:36 -08:00
Brecht Van Lommel 792292179c Fix excessive memory usage when saving EXR file with many channels (#3176)
Scratch memory allocation in ImageOutput::to_native_rectangle was using
the number of channels squared.
2021-11-11 15:03:48 -08:00
Rémi Achard 2dd84e1286 Fix identifier not found error on MSVC (#3168)
Signed-off-by: Rémi Achard <remiachard@gmail.com>
2021-11-03 19:03:04 -07:00
Larry Gritz 84027f028b CI: OCIO has renamed its master branch to main (#3169) 2021-11-03 19:02:47 -07:00
Larry Gritz be559ed23b Update to newer stb_printf for our implementation of vsnprintf (#3160)
Solves some security problems and/or just false positives in
address sanitizer.
2021-11-03 11:38:43 -07:00
SebTV 1b5f278fc0 Fix Typo that prevents setting Compile Definitions (#3167) 2021-11-03 11:38:22 -07:00
Larry Gritz c233694d93 Bump version after release 2021-10-31 10:09:01 -07:00
Larry Gritz 4082b689d4 CHANGES for 2.2.19 2021-10-31 10:08:10 -07:00
Larry Gritz a50964ac8c raw: Fix compat break in their 202110 snapshot (#3143) 2021-10-31 10:07:28 -07:00
Brad Smith ec2fe43d75 Sysutil: improvements to NetBSD and OpenBSD support (#3137) 2021-10-18 00:46:37 -07:00
Larry Gritz e023a98a58 Fix sometimes build breaks related to OpenCV headers (#3135)
Reclassify the OpenCV headers as "system" includes, which will turn off
warnings for things that show up in those headers that we can't control.
2021-10-16 20:23:34 -07:00
Brad Smith ef19ba5c5d Fix building with Clang on big endian archs (#3133) 2021-10-16 19:53:16 -07:00
Larry Gritz f34df70f6c Fix typo (#3130) 2021-10-15 08:50:38 -07:00
Larry Gritz 06444a7af6 Update CI test for VP2022, fix revealed python binding bugs (#3094 #3074)
* CI test for VP2022, fix revealed python binding bugs

* CI test against ASWF's latest VFXPlatform-2022 docker container,
  including Python 3.9.

* Pesky crash resulted in testsuite/python-imagebufalgo, laboriously
  traced to IBA_color_range_check releasing the GIL too liberally. The
  scoped release cannot contain the tuple construction!

* Audited the rest of py_imagebufalgo.cpp and found the same mistake in
  only one other place: IBA_histogram. Was asymptomatic so far, but fixed
  now.

* Presumably we just got lucky and these bugs were never symptomatic
  until we started building against Python 3.9.

* Noticed that the recent change in build tree layout where we now
  copy the test images into the build/testsuite area, resulted in HUGE
  GHA build artifacts for failed tests. Modify ci.yml use of
  upload-artifact action to exclude those directories.

* more tweaks
2021-10-10 23:13:22 -07:00
Larry Gritz fa1cc230d9 ci: Make a proper vfxplatform-2022 test and freshen latest/bleeding 2021-10-10 23:13:22 -07:00
Larry Gritz 21103c7da8 For obsolete 2.2 branch, bump CI cron to weekly, not daily 2021-10-10 12:27:39 -07:00
Larry Gritz 36d1d8449c Address new warnings revealed by clang13 (#3122) 2021-10-10 12:22:22 -07:00
Larry Gritz 581ab53fc9 OCIO: better catching of exceptions. (#3089)
When OIIO that was built against OCIO 1.x, but encounters an OCIO 2.x
config file, OCIO could throw an exception that was not caught by
OIIO.  The problem was the call to OCIO::GetCurrentConfig(), it should
have been inside the try/catch block.
2021-09-11 16:55:37 -07:00
Larry Gritz 98e554bcdc Bump version after release 2021-08-31 23:30:35 -07:00
Larry Gritz b99b7c57e7 CHANGES 2021-08-31 21:43:28 -07:00
Larry Gritz 6ccee8ffba Build bleeding edge against OCIO 2.1 2021-08-31 21:43:28 -07:00
Larry Gritz e340504f8d Build: Updates to handling OpenColorIO (#3050)
For the upcoming OCIO 2.1, the library names will incorporate the
major/minor version numbers, so our Find module needs to take that into
consideration.

Work towards eventually using OCIO exported configs (though still not
100% working now, may need fixes on their end).

Change CI to use the OCIO's that come in the aswf containers instead
of building from scratch in many cases.
2021-08-31 20:19:13 -07:00
Larry Gritz fb017b24f4 Let CUE_THREADS help determine default number of threads for OIIO (#3038)
OpenCue-launched apps are encouraged to honor the setting of
CUE_THREADS to limit the number of threads they use. This change makes
oiiotool (and other OIIO-based tools and scripts) better citizens when run
as part of an OpenCue job.

CUE_THREADS has lower precedence than the more OIIO-specific
`OPENIMAGEIO_THREADS`.

For ordinary command line usage, this should not change behavior, since
you wouldn't expect CUE_THREADS to be set.

(Also fix docs which incorrectly named `OPENIMAGEIO_TEXTURE_OPTIONS`.)
2021-08-04 20:56:29 -07:00
Larry Gritz a674f70b2f Augment PR 3037 to make it not break ABI compat (#3040) 2021-08-04 20:55:26 -07:00
Larry Gritz d99dd49f6c Extend Sysutil::getenv() to take a default if the env var is not found (#3037) 2021-08-04 20:55:14 -07:00
Larry Gritz 30a2eb3fc4 Bump version after release 2021-08-01 15:54:30 -07:00
Larry Gritz 099c8585e3 CHANGES for 2.2.17.0 2021-08-01 15:52:26 -07:00
Larry Gritz d5a03e0579 CI: update "latest" releases we test against, notably OpenEXR 3.1 (#3033)
OpenEXR -> 3.1.0
pybind11 -> 2.7.0
OCIO -> 2.0.1
2021-07-25 16:07:11 -07:00
zomgrolf e7ec6b3f7a Make finding Boost more flexible. (#3031)
This patch modifies the build system to make it possible to control
whether OIIO should link Boost in the form of static or dynamic
libraries, independently from the LINKSTATIC setting, without
having to use the fully custom route (BOOST_CUSTOM).

This is done by preserving the value of the Boost_USE_STATIC_LIBS
variable, if it has been defined by the user. If the value
of Boost_USE_STATIC_LIBS has NOT been explicitly defined, it is
set to match the value of the LINKSTATIC variable, which should
result in Boost being linked in the same way as other dependencies.
2021-07-19 08:52:15 -07:00
Larry Gritz 244a9d6492 I think these should be master only 2021-07-12 16:21:04 -07:00
Larry Gritz b293db1bbe fmt related fixes (#3007)
* New fmt 8.0.0 is out -- make sure we test against both that and their
  current master.

* Starting with fmt 8.0, and in accordance with C++20 std::format's
  final incarnation, the format string needs to be constant, for the
  sake of compile time checks. To use a nonconstant format string, as
  we do for these wrapper functions, we need to lean on vformat.

* For Strutil::sprintf, just `using ::fmt::sprintf` and eliminate the
  wrapper entirely. (Though we express the wrapper inside
  `#ifdef OIIO_OXYGEN_ONLY` so that it fully appears in any docs we
  generate.)
2021-07-12 16:18:12 -07:00
Kimball Thurston f2590bcbc8 Convert dpx output to be ioproxy enabled (#3013)
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
2021-07-05 09:26:31 -07:00
Larry Gritz 031dbdfc2a TypeDesc improvements (#3008)
* Add TypeDesc support for metadata that is a 2D or 3D bounding box,
  represented as an array of 2 VEC2 aggregates (for 2d) or VEC3
  aggregates (for 3d), having the BOX semantic. The basetype
  determines whether it's an integer-based (generally for pixel
  ranges) or float-based (generally for 3D spatial) bounds. The new
  text representations are "box2" and "box3" (for float-based), and
  "box2i" and "box3i" (for int-based).

* Somehow we never had a C++ test thoroughly exercising all the corners
  of TypeDesc. Now we do: typedesc_test.cpp

* The test revealed a number of edge cases we don't handle well, now
  shored up.
2021-07-05 09:26:31 -07:00
Larry Gritz 2589c70e34 Make a unit test for color.h contents (#3023)
Currently, it only tests the linear <-> sRGB and linear <-> Rec709
transformations.
2021-07-05 09:26:31 -07:00
Larry Gritz 173e6e30a1 Clarify docs that oiiotool --ociofiletransform doesn't need an OCIO config 2021-07-01 11:57:13 -07:00
Larry Gritz f0b30f3550 Bump version after release 2021-07-01 11:56:29 -07:00
Larry Gritz 037f783c6d CHANGES 2021-07-01 11:54:28 -07:00
Larry Gritz 5808911125 Build and test fixes related to Ptex (#3001)
* New Ptex (since 2.3.1) has exported cmake configs. Use those if
  available and seem to work.
* Rename FindPTex.cmake -> FindPtex.cmake to match the capitalization
  in the Ptex project itself, thus avoiding warnings from CMake.
* Fix our FindPtex.cmake to set up Ptex::Ptex_dynamic target. Use
  that instead of the old style variables. That makes a seamless future
  transition between the old Find module and future exported configs.
* Our FindPtex.cmake got the version number all wrong. Fix.
* gh-installdeps.bash tried to install ptex-base. That's not Ptex! So
  stop doing that.
* New build_Ptex.bash does a simple clone and build of Ptex. Do so for
  a few of the CI test cases so that we are more thoroughly testing Ptex
  in CI.
2021-06-28 15:33:32 -07:00
Bernd d56916c525 fix typo for REQUIRED_USE (#3011)
Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
2021-06-26 10:18:54 -07:00
etheory 8e2bdd35ab Add Houdini and AL custom UDIM support (#3006)
Add custom UDIM support and Houdini UDIM convention support

For our (Animal Logic) in-house renderer, we need support for an additional UDIM format of `/path/to/file/textureName_u##v##.ext`

Added second line to ImageCacheImpl::resolve_udim to make this work.

Additionally add support for Houdini UDIM specification
2021-06-21 23:34:50 -07:00
Larry Gritz 077e30c08d Clean up preprocessor mess left by farmhash.h (#3002)
Try to `#undef` at the end all the things that are `#define` by
farmhash.h that do not begin with `FARMHASH_`.
2021-06-15 22:09:40 -07:00
Larry Gritz 20e14b8e54 CI: make a specific test for buildling with clang11 and C++17 (#3004) 2021-06-15 22:09:32 -07:00
Larry Gritz 8ede469092 Clang + C++17 + LibRaw < 0.20 don't mutually get along (#3003)
LibRaw 0.19 and earlier use auto_ptr in public headers, which was
deprecated in C++11 and removed in C++17.

When this combo is detected, issue a warning message from CMake.
2021-06-15 20:40:24 -07:00
Larry Gritz 7b0d6c4588 Change acknowledgment
We switched from Jasper to OpenJPEG many years ago, but apparently never
updated this acknowledgement.
2021-06-15 20:40:01 -07:00
Larry Gritz fb3ad5e529 More exception safety in Filesystem directory iteration (#2998)
When using filesystem::directory_iterator, I was using operator++,
which can throw exceptions for OS errors. I should have used
increment(ec) instead. Throw in a surrounding try/catch just in case,
since even increment is not marked as noexcept.
2021-06-14 15:55:20 -07:00
Larry Gritz 75f77bd249 Have FindFFmpeg.cmake detect the version at cmake time. (#2994) 2021-06-08 21:23:50 -07:00
Larry Gritz 28771ee3d7 Fix to accommodate changed preprocessor name in imath master. (#2996)
Also need to back off the top of fmt master when using gcc11, it seems
to have some trouble with.
2021-06-08 21:22:21 -07:00
Larry Gritz 5beaec9dbd Less restrictive warning pragma, amend last PR 2021-06-06 23:48:05 -07:00
Larry Gritz fad752bac2 gcc 11 support (#2995)
* Use g++11 on the bleeding edge CI test
* Remove OIIO_CONSTEXPR20 decls from string_view -- gcc 11, even in
  C++20 mode, doesn't have std::string fully constexpr plumbed, it's
  not ready for this.
* Suppress gcc11 warnings about arithmetic with enums that occur in the
  OpenCV headers.
* Suppress gcc11 warning (correct) in the spot where we were trying to
  force a crash for testing purposes.
2021-06-06 23:38:40 -07:00
Larry Gritz 1f4115f005 make_texture now detects and rejects deep images (#2991)
It's meaningless to try to use make_texture on input images that are
"deep".  We never even thought to check for this, which led to a
cascade of problems resulting in a segfault.
2021-06-06 22:35:14 -07:00
Larry Gritz ba39d09482 Fix ustring crash on M1 (ARM) based Mac. (#2990)
There's something wrong with the behind the scenes tricks we're using
to doctor the internal string representation. Is it because of big
endian?  The "alternate" string rep? Something else different on
Apple's libc++ on M1?

Fix for now by just disabling that clause. The only harm is that
ustring internals will take more memory on that platform. That's
better than crashing!

When I have more hands-on access to an M1 (or when GitHub Actions
supports running CI tests on M1), I'll return to this for a proper
fix.
2021-06-03 14:51:55 -07:00
Larry Gritz 7bf125c2c1 Fix some ffmpeg encodings that didn't realize they were >8bit, alpha (#2989)
A few varieties of encoded videos with bit depth 12 and having alpha
were not marked as such, and falling to the default case that reported
them as 8 bit RGB.
2021-06-02 21:45:47 -07:00
Larry Gritz ce85d69d13 One more OpenJPEG rename that I missed in #2979 2021-06-01 12:26:18 -07:00
Larry Gritz fdbae68903 Build: FindOpenJPEG.cmake improvements (#2979)
Rename FindOpenJpeg -> FindOpenJPEG to match the conventions used by
that project, in particular for its exported CMake config files.

(We don't yet rely on their exported configs, I need to do some
homework to see if they exist and are reliable as far back as the
oldest OpenJPEG release that we support.)

Add helper script to build OpenJPEG
2021-06-01 12:26:08 -07:00
Larry Gritz ee676653ee Clarify behavior of color conversion on image with > 4 channels (#2987)
The docs were ambiguous about what would happen for many-channel
image, and the behavor in fact was to copy and color transform only up
to the first 4 channels, leaving additional channels in the
destination undefined (though in practice they turned out black).

Clarify now that for colorconvert, colormatrixtransform, ociolook,
ociodisplay, and ociofiletransform, the first 4 channels are assumed
to be RGBA to undergo the transformation, and any additional channels
will be copied unaltered from source to destination (not set to black).
2021-05-31 23:40:50 -07:00
Larry Gritz 1a66e6090e If feature is disabled, skip its tests, don't report them broken (#2988) 2021-05-31 23:40:38 -07:00
Larry Gritz fbb8e01e00 Avoid divide-by-0 error computing chunk size for invalid image sizes (#2983)
In ImageInput::read_scanlines and read_image, if somehow the image has
a spec with 0 size, it will lead to a divide by zero error. Check this
and fail safely.

For BMP in particular, do some sanity checks to catch corrupted headers.
(This is in response to Issue 2982)
2021-05-30 08:17:43 -07:00
Larry Gritz 7f71640f58 Change localtime() calls to Sysutil::get_local_time (#2978)
We still had a few stray localtime() calls (which is not reentrant,
because it depends on a global buffer), even though all along we had a
"safe" wrapper in Sysutil::get_local_time, which internally calls safe
versions localtime_r or localtime_s (depending on the OS).
2021-05-30 08:17:43 -07:00
Larry Gritz 28e0820567 Bump version after release 2021-05-30 08:17:43 -07:00
Larry Gritz 8c6b526792 CHANGES 2021-05-30 08:17:43 -07:00
Larry Gritz d3eb4f1f07 Fix broken build against TBB 2021 (#2985)
For TBB 2021, headers moved around, and our FindTBB.cmake was failing.
But actually, starting with TBB 2021, TBB exports a proper cmake config!
So take advantage of that by preferring to load TBB from a config file.

Fixes 2963
2021-05-30 08:16:26 -07:00
Larry Gritz afcf58e43b CMake: Make checked_find_package able to prefer configs (#2984)
Both global and per-package controls have been added to our
checked_find_package cmake function, to cause it to first check for
an exported config for the dependency, and only if not found, revert
to potentially using a FindPackage.cmake module.

This reflects our general leaning toward assuming that a package that
exports a cmake config probably does a better job of it than we would
do writing a Find module for it.
2021-05-30 08:16:26 -07:00
Larry Gritz 2bf67bd96e IBA::render_text did not properly account for alpha of the draw color (#2981) 2021-05-28 22:24:25 -07:00
Larry Gritz 31394ebdb9 Improvements to BMP (#2976)
* Writing: Write single channel BMP as 8 bit palette images (not 24/32
  bit images). This fixes a problem I discovered related to the recent
  change that reads 8 bit palette images as if they were single channel.
  The lack of symmetry there made problems for round-tripping an image
  and having it end with the same apparent number of channels as it
  started with.

* Reading: respect a configuration hint "bmp:monochrome_detect" that if
  set to 0, will disable the detection of monochrome palettes and spoofing
  to look like a single-channel image. The default is 1.

* Read RLE-compressed images correcty now! Both 4 and 8 bpp varieties.

* Beef up the testsuite/bmp tests, now test against a wider set of sample
  BMP images from bmpsuite (including rle compressed images).
2021-05-24 12:55:47 -07:00
Larry Gritz 8d09f3984e Fix oiiotool docs typo and clarify discussion about subimages 2021-05-24 12:32:54 -07:00
Larry Gritz 45221dc447 BMP refactor: move BMPInput and BMPOutput to the files where they are used. (#2973) 2021-05-19 19:20:48 -07:00
Larry Gritz 7f8db2dbe8 Fix exported cmake config, it confused imath and openexr versions (#2975)
OpenImageIO exported config has a dependency on Imath/OpenEXR.  For
Imath 3, I accidentally used OpenEXR_VERSION when I should have said
Imath_VERSION. Makes no differece if they're in sync. But should
somebody downstream have a separately compiled Imath and OpenEXR that
just might be different patch versions, it could break builds by
rejecting if the Imath version appears to be behind the OpenEXR
version. There's no guarantee that Imath and OpenEXR will always be
released exactly in sync.
2021-05-19 19:18:30 -07:00
Larry Gritz 84566283b1 CI: Bump OpenEXR releases to the latest in each branch (#2974) 2021-05-19 19:18:17 -07:00
Larry Gritz 1ed188e277 Clarify that our BMP implementation does not support RLE files. (#2972)
Separate patch coming later to add support for RLE.
2021-05-18 16:14:45 -07:00
Larry Gritz 0b64ec8c66 CI: Mac: Adjust to homebrew using imath 3
Need to disable OpenVDB on Mac CI for now, because its homebrew version
wants ilmbase.
2021-05-13 13:53:17 -07:00
Larry Gritz eb4de4241f Fix runaway parsing time for pathological XMP metadata (#2968)
Found some files that encountered the problem described here:
https://prepression.blogspot.com/2017/06/metadata-bloat-photoshopdocumentancestors.html
https://feedback.photoshop.com/conversations/photoshop/photoshop-corrupt-ancestors-tag-in-xmp-causing-giant-file-sizes/5f5f45f74b561a3d426ba97f

The pathologically long lists of "photoshop:DocumentAncestors" tags (a
4MB PNG of which 3MB consisting of XMP) was tripping us up with an
O(n^2) handling of appending to lists for those attributes that could take
minutes per file.

It seems like this was a widely acknowledged problem that has been fixed
in Photoshop 20.0.2 (January 2019) and later.

Solution:

* Just skip the problem tag; I can discern no real use for preserving
  it in any OIIO context.

* More generally, be on the lookout for pathological or corrupt XMP by
  keeping track of the length of lists and just cutting them off from
  further appending when they seem senselessly long. I can imagine XMP
  with lots of attributes, but it's hard to imagine that any single
  attribute having thousands of list entries is intentional and useful.

* Fix some places where we were needlessly generating and then tearing
  down std::string's.
2021-05-13 13:53:17 -07:00
Larry Gritz 410de67c8c Remove unused variable 2021-05-13 13:53:17 -07:00
Larry Gritz 89256f6f2d Update the CI clang-format to use llvm 11 (from 10) (#2966)
This makes several minor formatting changes, mostly related to how
clang-format 11 has improved ability to track the alignment of = in
successive statements, even when one of those statements is split
across two lines.
2021-05-13 11:14:16 -07:00
Larry Gritz 169549c5e2 CI script typo kept mac from recognizing ARCH properly (#2967) 2021-05-13 10:09:59 -07:00
Larry Gritz af764e9aaa Adjustment for OpenColorIO 2.1 (in dev) deprecating method (#2961)
This started out as just trying to fix our CI on the "bleeding edge"
building against OCIO master and complaining about a recently committed
OCIO deprecation of Config::parseColorSpaceFromString.

But it turned out that the new OCIO v2 method, getColorSpaceFromFilepath,
didn't work quite the same way and broke our tests. So I ended up having
to implement a bit more of a complicated set of functionality:

* Config::parseColorSpaceFromString now wraps the OCIO version if it's
  available, but implements the equivalent logic if OCIO is new enough
  that the function is deprecated.

* As a bonus, our pCSFS now works (didn't before) in cases where lack of
  OCIO support or missing config meant the OCIO functionality wasn't
  available. That is, it works on our meager set of default color spaces
  that are present even without OCIO.

* New Config::getColorSpaceFromFilepath wraps the OCIO version if OCIO
  is new enough, but if it isn't, or if there's no OCIO, or if OCIO ends
  up not figuring it out and returning the default rule, we fall back
  to Config::parseColorSpaceFromString.

* Add OCIO to VFX Platform CI builds -- because it's not in the aswf-osl
  docker images, we weren't testing OCIO in as many versions as we had
  previously thought.

* Bump default OCIO version built by build-scripts/build_opencolorio.bash
  to 2.0 (from 1.1.1).
2021-05-04 23:49:22 -07:00
Damien Courtois dd029cdbb1 fixed a crash is ImageCacheFile::read_unmipped when sampling non-zero-base channels. (#2962)
the temporary image buffer is created with only 3 channels, so the get_pixels call at the end of the
read_unmipped method must account for that when creating the ROI passed to it.
2021-05-04 10:07:43 -07:00
Larry Gritz 831263ef67 Strutil: add find, rfind, ifind, irfind (#2960) 2021-05-04 10:07:43 -07:00
Larry Gritz e3c4ff23a4 CMake: use modern targets for PNG and ZLIB (#2957) 2021-05-01 09:36:59 -07:00
Larry Gritz adc159a967 Bump version after release 2021-04-30 22:12:16 -07:00
Larry Gritz 72bdc35f19 CHANGES 2021-04-30 22:12:16 -07:00
Matteo F. VescoviandMatteo F. Vescovi 1833916ac5 Rename TITLE to NAME in manpages script (#2958)
Co-authored-by: Matteo F. Vescovi <mfv@debian.org>
2021-04-30 22:12:16 -07:00
Larry Gritz 51b2a669fd Document support of libtiff 4.3 and test against it (#2953) 2021-04-26 22:04:07 -07:00
Larry Gritz 15a7da7e5d Docs: Clarify the optional modifier of oiiotool --ociodisplay and --ociolook (#2952) 2021-04-20 22:57:00 -07:00
Larry Gritz adef20d4eb Add missing MakeTxBumpWithSlopes enum value to python bindings (#2951) 2021-04-20 22:56:54 -07:00
Larry Gritz 34d16a5a6a Adjustment on exported config: hint where to find OpenEXR/IlmBase (#2947) 2021-04-17 09:14:24 -07:00
Larry Gritz 8cab83499b BMP: eliminate wasteful allocation and copying (#2934)
Temporary allocations were made and freed for each scanline read or
written. Do it once per image and reuse. When reading, eliminate one
temp buffer by writing data into its final location, also eliminating
a needless extra copy of each scanline.
2021-04-14 11:57:26 -07:00
Larry Gritz 396057d54c Yet again, cmake adjustments to openexr, etc. (#2942)
Sorry this has taken so much tinkering to get right for downstream
projects. It's tricky business.

First, we start by adding testsuite/cmake-consumer -- a test that
consumes OIIO and its exported cmake modules, and is independent of
the rest of OIIO's build system, more accurately simulating whether
things will work for a downstream client.

Adjust our exported module, it needs to break out the OpenEXR 3 vs 2
cases separately, as well as whether it found an OpenEXR/Imath config
file or not. I think I have all the cases covered now. I also needed
to specify find_dependency of IlmBase and Threads, for the sake of
openexr 2.4 with config, and add the INCLUDES directory lists in the
case of no config files found.

Some adjustment of our library target_link_libraries -- better PRIVATE
hiding of things not needed in the interface by downstream builds.
In particular, the OpenEXR components and OpenCV should be private, not
public.
2021-04-14 11:57:26 -07:00
Larry Gritz 5d6bb77c35 Adjust openexr includes (#2941)
We broke things subtly for older OpenEXR when we added the 3.x
support.  Without this fix, our export CMake config files weren't
properly exporting the OpenEXR include path as the interface includes
for OIIO libraries. This doesn't affect the OIIO build itself, but it
can affect downstream libraries that use OIIO as a dependency and
rely on our exported cmake config files.

We also remove the need for OpenEXR/OpenEXRConfig.h entirely through
header configuration.
2021-04-09 12:47:57 -07:00
alister-chowdhury db679d4e57 Added logic to copy along the alpha_channel when generating sub-images for fillholes_pushpull (#2939) 2021-04-08 20:06:36 -07:00
Larry Gritz 3e79658454 Build: be robust to certain OpenEXR 2.x config files (#2935)
Ever since adding OpenEXR 3.0 support, we had some cases where
installations that built the 2.x IlmBase and OpenEXR portions
separately and installing to separate areas.

Also make some minor changes to ci.yml to make sure we are documenting
the right openexr versions used for each test.
2021-04-07 12:21:22 -07:00
Frédéric Devernay 214d62b81d fix c++11 build (#2930) 2021-04-02 16:02:23 -07:00
Larry Gritz b4217ebffa CMake: don't use --config inappropriately (#2931)
It seems that for CMake, --config should only be used in conjunction
with --build. Who knew? Things are breaking right and left now, especially
on GitHub Actions CI. But also on my laptop.

Hypothesis: maybe this was silently ignored in older cmake versions, but
now with CMake 3.20 is a hard error?
2021-04-02 16:02:09 -07:00
Larry Gritz 766692f9d9 TIFF: support IOProxy for input (#2921)
Also beef up docs, which had neglected to mention that proxy was
supported for a few other formats.
2021-04-01 11:51:54 -07:00
Larry Gritz 0bd647e00a Allow reading of JPEG files with mildly corrupted headers (#2927)
We were treating some recoverable warnings from jpeglib as fatal errors.

Removed testsuite/jpeg-corrupt-header since now we can read it just
fine despite the very minor corruption! Also, turns out the image was
inappropriate, sorry, I had never actually seen it before because
OIIO wouldn't read and display it and I assumed it was just garbage.
2021-04-01 11:51:44 -07:00
Larry Gritz 420ee218f2 Bump version after release 2021-03-29 17:16:29 -07:00
Larry Gritz b378576471 CHANGES 2021-03-29 17:13:34 -07:00
Larry Gritz d545fb77bd Fix function name ambiguity in farmhash.h for C++11 and certain compilers (#2914)
Apparently all the recent farmhash changes are fine with C++14 mode,
and fine with C++11 mode on gcc 4.8, but gets some errors when
usig in newer compilers (gcc6+) using C++11 mode.

Add a CI test with gcc10 but with C++11 compatibility to verify this fix.
We will remove this test once we retire C++11 compatibility.
2021-03-28 09:43:14 -07:00
Larry Gritz 151b69506e Overhaul ustring hash collision handling (#2870)
This patch ensures that two ustrings will never have the same hash value.
The basic strategy is that the usual 64 bit hash of the characters provides
an initial guess. If no other string has already used that hash (as is
almost always the case), we use it. However, if a different string already
took that hash value, we rehash, and repeat until we find an unused hash.

We maintain a "reverse hash map" that relates hashes to ustrings to
help figure this out efficiently. (Note: This adds at least another 16
bytes per unique ustring to maintain the reverse map. Do we care?
Probably few applications are in the business of creating more than a
few million distinct strings.)

Because we are recording the collisions as they happen, this also
greatly simplifies (and reduces to trivially low cost) the
recently-added ustring::hash_collisions() function, because there is
no complicated search when it is called.
2021-03-26 11:55:21 -07:00
Larry Gritz 32d4c25c41 make_texture: Clamp half values to prevent Inf values popping up (#2892)
When making a texture out of float values, but writing ultimately to a
`half` file, it's not too hard to end up with valid but large float
values that are outside the range representable by a `half` (fp16)
value and therefore will get converted to an `Inf`, which nobody wants
in their texture.

This patch prevents Inf from showing up in the output of make_texture
by clamping output buffers to the range of `half` when the source data
are float and the destination file is half.
2021-03-26 11:55:21 -07:00
Larry Gritz 05661f8a2b Avoid OCIO 2 exception by setting strides correctly (#2911)
For the case of applying a color transformation to just one color, we
were sloppy and set the strides to 0 (just one color means we are not
iterating from point to point using the strides).

OpenColorIO 1.x didn't care, but OpenColorIO 2.0 throws an exception if
the strides don't look valid.

Thanks to Thomas Metais for the fix suggestion.
2021-03-26 00:15:32 -07:00
Larry Gritz af949b73dc CMake 3.20 dropped the -g3 flag (#2913) 2021-03-25 16:10:14 -07:00
Larry Gritz ce58cc6db1 Fix missing boost path on recently broken GHA CI (#2912)
GitHub Actions in its wisdom has removed pre-installed Boost from the Windows
images, causing our CI to fail.

Instead, get boost from vcpkg, just the pieces we need.

Also needed some JPEG adjustments for Windows CI build.
2021-03-25 14:39:00 -07:00
Nayden Dochev 3b9b4f1bb8 Fix reading tiff files when size is not multiple of tile size (#2895)
Fix reading tiled tiff files when vertical read size is less than tile size, just for the code path where we use TIFFReadRGBATile (used for certain rarely encountered types of TIFF files). TIFFReadRGBATile returns the image data in bottom-to-top order, and we had been correctly reversing it all along, but neglected to account for the issue of a partially-filled tile ending up with the padding at the beginning of the buffer rather than the end.
2021-03-21 14:10:46 -07:00
Larry Gritz 7f4f9a7adc Targa read fix for tga files with 0-sized thumbnails (#2903)
All of our prior tga tests had valid thumbnails. The code skipped the
thumbnail if the "offset to the thumbnail" was 0. But if the offset was
nonzero but the thumbnail record at that spot had a 0x0 size, we just
ran merrily along, and on Windows in debug mode even it an assert.

This patch makes it understand that a 0x0 thumbnail size means no
thumbnail.

I added an image from Doug Rogers, the reporter of the problem, to the
oiio-images repo in the targa directory, and updated the OIIO testsuite
to also check that image. (So testsuite will fail for people who don't
update their oiio-images repo.)

Also changed some stray refs to &vector[0] to vector.data().

Fixes #2900
2021-03-20 23:37:47 -07:00
Larry Gritz 5beebb3df8 BMP: fix bug reading older variety (#2899)
The very old OS2_V1 variety of BMP files -- which dates from the OS/2
and Windows 2.0 circa 1987 -- could have undefined results by relying
on the cpalete header field that didn't exist in that early
version. Our failure to initialize it led to expecting color palettes
of undefined size (which could either cause a read failure or even a
crash if it vastly over-allocated).

Some other minor touch-ups to the bmp code while we're at it:

* Zero-initialize all the other fields that don't exist in the OS2_V1
  version of the header.

* Don't set the Resolution metadata if the values in the file aren't
  positive (including for the V1 header that lacks it entirely).

* Fix reading V1 header resolution on big endian architectures (I just
  happened to spot that potential bug).

* Fix longstanding error (that I only just noticed) in reading 4 bpp
  images with odd horizontal resolutions, wherein the very last column
  was not filled in correctly (that's the change at lines 188 and
  193).

* Beef up one of the error messages invoked for failures while reading
  the color palette.

* Rig the BMP reader to know the "dib" is another extension often
  associated with BMP files.

* Add a regression test case for this format variant.

* Make sure CI tests bmp -- the GHA CI did not download the bmpsuite and
  so was not actually running the testsuite/bmp tests.

* Add "bmp:bitsperpixel" (when not 24 or 32) and "bmp:version" metadata.
  This is primarily for debugging and understanding which encodings the
  BMP file is using.

* Recognize nonsensical values for the header's field for number of entries
  in the palette. Add a test for that.
2021-03-19 15:50:23 -07:00
Larry Gritz 894e4667c4 CI: Bump latest and bleeding tests to OpenEXR 3.0 tags (#2897) 2021-03-17 14:19:52 -07:00
Larry Gritz 448e03cb8f Remove old pre-C++11 use of boost::random (#2896) 2021-03-17 14:19:41 -07:00
Larry Gritz 963632bf4e Minor fixes to keep up with OpenEXR build system changes 2021-03-16 12:47:42 -07:00
Larry Gritz 05345677a5 CI: test C++20 on the Linux bleeding edge test. (#2891)
Fix minor warnings and deprecations of C++20.

Bump to more modern ubuntu images for recent-year tests and make some
related adjustments. Also make sure that the "latest" and "bleeding edge"
tests are using python3, they were inadvertently still using python2.
2021-03-16 11:44:20 -07:00
Larry Gritz d2f16f4037 Docs: Fix doxygen mismatch, bump breathe version 2021-03-16 11:05:18 -07:00
Larry Gritz 4bf6df17cd Fix build breaks against recent OpenEXR 3.x additions (#2894)
A recent commit in the OpenEXR master changed which headers are
transitively included by other OpenEXR headers, and that broke our
build until this patch adds the missing headers explicitly.

The change may or may not be reverted on the OpenEXR side, but this
patch to OIIO at least unbreaks our CI in the mean time, and has
no down-side.
2021-03-16 11:01:55 -07:00
Larry Gritz 22762b6bbb Make RAW files handle Unicode filenames on Windows (#2888) 2021-03-09 14:31:30 -08:00
Larry Gritz 09203688de Fix crash related to ImageBuf::set_write_format (#2885)
There were some flaws in the logic of IB::set_write_format that could
cause a crash when used in conjunction with a file format that doesn't
support per-channel data types (even if the set_write_format call
specified a single type rather than per-channel types!).

There are basically two problems I fixed here.

First, in ImageBuf::write, where we are dealing with the fact that
set_write_format previously registered a request, be extra careful
that the "default" data format is the "biggest" type out of the
per-channel choices, and also make sure that if all the channels are
identical, we just use the default type and clear the channelformats
vector.

Secondly -- and more importantly to the crash itself -- in
ImageOutput::to_native_rectangle, if the output file format does not
suport per-channel data types, just use the main format.  Do NOT
consider this case a hard error, which previously took an early out by
returning NULL for the location where the native data was copied.  It
was that NULL that, when subsequently copied from (not noticing that
it was NULL indicating an error), actually produced the segfault that
caused the crash.  In other words, don't worry, be happy -- just do
your best by treating the unsatisfiable request as the next best
thing, as if it were the same type for all channels.
2021-03-05 09:31:59 -08:00
SRHMorris c22c67842a Fix error checking for file descriptor in gifinput on windows (#2886) 2021-03-05 09:31:52 -08:00
Larry Gritz 19d65ec1d5 Adjust to changed int type definitions in upcoming Imath 3.0 (#2883) 2021-03-04 21:17:33 -08:00
Larry Gritz 45107d2d44 CI: Use Qt5 as a temporary measure (#2884)
Homebrew just upgraded to Qt6, and that breaks us. Peg to Qt5 as a
temporary measure to let our CI pass, until somebody figures out what
needs to be fixed for full Qt6 compatibility.
2021-03-04 21:17:25 -08:00
Larry Gritz ac4c90e87b Bump version after release 2021-03-01 12:48:49 -08:00
Larry Gritz 2f1bdb601c CHANGES 2021-03-01 12:48:49 -08:00
Larry Gritz 8ad4afd697 Changes to accommodate upcoming Imath vector conversion changes (#2878)
I have submitted a PR to Imath that adds "interopability" constructors
and assignment, that use some templates to allow seamless
construction, assignment, and passing of "foreign" vector types to
Imath vectors. This makes it easier library A that uses Imath vector
types in its API to interact with app or library B that has a custom
internal vector type, without a ton of ugly casts and copies.
(See https://github.com/AcademySoftwareFoundation/Imath/pull/91)

These created a few minor conflicts with OIIO's internal SIMD classes
and their construction and casting from Imath types. This patch cleans
up the ambiguities:

* Make Imath::V4f -> simd::vfloat4 and Imath::M44f -> simd::matrix44
  constructor `explicit`.

* Make the simd types `simd()` method (returning the underlying raw SIMD
  type) also have a variety that returns a ref to a non-const vector,
  to ensure proper working of the _MM_TRANSPOSE4_PS macro.

Now I am going to commit a sin. This MUST get backported to OIIO 2.2
in order for it to not break against the upcoming Imath 3.0.  This
doesn't break ABI compatibility, nor change OIIO's primary advertised
public APIs, but it does change the technically/informally public APIs
of simd.h in ways that introduce the possibility that an app using
those simd vector classes *might* need minor source code editing if
they relied on those implicit constructors. Such software might need
certain `simd::vector4 foo = imath_bar` to become `foo = vector4(bar)`
and the same for certain matrix44 assignments.  It is usually a big
no-no to backport any change that could require editing of source
code.  But since the alternative is not being able to use the new
Imath, I think this is the lesser evil, and maybe nobody out there is
doing the thing that would need to be changed?
2021-03-01 12:45:38 -08:00
Larry Gritz 8dc01f250e Imath/OpenEXR 3.x fixes (#2876)
Need some include fixes to more gracefully handle the case where
Imath_ROOT points to a custom build (say, of Imath 3.x), but there is
a system installation of a different version (say, OpenEXR 2.x in
/usr/include, which could easily end up earlier in the path list).

Also update some reference output due to recent bug fixes in OpenEXR,
where error messages changed.
2021-02-28 11:07:11 -08:00
SRHMorris 87c9f1a26e Fix loading PSB with cinf tag (#2877) 2021-02-28 11:06:57 -08:00
Larry Gritz a4bb2367cd Make failure artifacts include the CMake cache and log 2021-02-19 23:24:33 -08:00
Larry Gritz 4a75da3a5f Remove last vestiges of Travis-CI (#2871)
* Some very minor CI cleanup

Mostly get rid of some needless verbosity.
2021-02-19 23:24:23 -08:00
Larry Gritz c7070e15f4 unordered_map_concurrent additions: find_or_insert(), nobin_mask() (#2867) 2021-02-19 23:24:09 -08:00
Larry Gritz 8e568b8c0a Improve parsing of xmp records (#2865)
* Better handling of lists/sequences -- append into attribute arrays
  instead of allowing each value to overwrite the previous one.

* Better inference of unknown attributes that look like int, float, or
  rational, rather than cramming into strings.

* Fixed what I now think were bugs in handling rational values.
2021-02-19 23:23:28 -08:00
Larry Gritz ccb61011d9 pkgconfig OpenImageIO.pc was setting include dir one level too deep (#2869) 2021-02-18 08:53:14 -08:00
Larry Gritz 5159490195 Re-enable libheif for Ubuntu (#2866)
Seems to work
2021-02-17 12:19:51 -08:00
Larry Gritz ce467d34ed Switch to OpenEXR 2.5.5 in hopes of avoiding deadlock (#2863)
Turns out it doesn't -- we're still seeing timeouts on the Windows CI
tests, even with the OpenEXR that we thought fixed the threadpool
problem.

But let's keep this change anyway.
2021-02-17 12:19:43 -08:00
Larry Gritz c3e5511ddc CI overhaul: separate stages (#2862)
Background: In our GitHub Actions CI, we were doing environment setup,
dependency setup, OIIO build, and testsuite -- all in one action
"step" because each stage is its own shell process, so I couldn't
figure out how to communicate between them (for example, a dependency
setup might build and install a dep package, but then the later build
stage needs the CMake Pkg_ROOT variable set to that location).

Doing it all as one "step" was clumsy, not best GHA practice, and it
made it hard to understand which stages were taking different amounts
of time and how to optimize them.

The trick, it turns out, is that $GITHUB_ENV is the name of a file
that will be executed at the start of each step. So you put commands
into that location that restore whatever env variable you need to
restore between steps, or any other setup you need.

So in this patch, we:

* Elevate env setting to be for all steps.

* Split build-and-test.bash into separate build and test scripts.

* Separate setup, dependency installs, build, and test into separate
  GHA steps.

* Each step's script, at its very end, calls new script save-env.bash,
  which puts commands to restore the environment into the file named
  by $GITHUB_ENV, which will be read at the beginning of the subsequent
  step.

* Merge gh-installdeps and gh-centos-installdeps scripts -- there was a
  lot of redundancy between them anyway.

The net result of this is that when we examine the test results, it's
much easier to see which stage a failed test had trouble on, and
especially how much time each stage took. That's really handy with the
recent changes to add caching, and helps us verify that the caching is
working as intended, since it is expected to take a big bite out of
the dependency and build stages, but not the test stage.
2021-02-17 12:19:31 -08:00
Larry Gritz cb11829541 Build: warn for incompatible OpenVDB 8.0 vs C++11 (#2860) 2021-02-12 20:57:34 -08:00
Larry Gritz a3c79622d0 Turn off STOP_ON_WARNING default for release branches (#2861) 2021-02-12 20:57:23 -08:00
Larry Gritz a346d2c2bc Speed up CI with GitHub 'cache' action + ccache (#2859)
This speeds up CI builds by 1/2 - 2/3 of total time, for PRs that are
minor changes by reusing the compiled results from previous runs.
Most of the remaining time cannot be squeezed down -- it's the
instantiation of docker containers and running the testsuite
itself. But the build (including of dependencies we build from
scratch) is dramatically faster.

Currently, this depends on ccache, so is for Linux/Mac only. I'm also
working on doing something similar for Windows, but it's not ready for
review yet.
2021-02-09 16:32:53 -08:00
Larry Gritz 538d134c9d CI: Don't build OpenEXR examples (#2857) 2021-02-09 16:32:26 -08:00
Larry Gritz d4f6f5a1ae Modify hash_test to verify correctness and stability of the hashes (#2853)
Do some adjustment/simplification of the macros that set up the right
decorators on the new inline farmhash.

Some additional constexpr's, including Strutil::strhash().

Add to hash_test verification of the actual results of each of the
hashes, so we know that we don't break them over time, that they give
the same result on all platforms, and most immediately, to 100% verify
that the new constexpr inline version of the hash precisely matches
the old procedure call one.

Augment the existing benchmarking of the hashes to include
farmhash::inline.  It tries a variety of string sizes. I was worried
that the constexpr/inline version would be a performance hit because
it can't use any of the SSE intrinsics (which, ugh, aren't declared
constexpr in the headers).  But it turns out that the inline (but
SSE-free0 version is a little faster on some tests, a little slower on
other tests, overall a wash and never differing by more than
10%. Maybe that means that the inlining/constexpr makes up for the
lack of SSE? Maybe it means that the compiler optimization is adding
SSE back in well enough that losing the intrinsics isn't as bad as we
would have thought? In any case, the upshot is that this doesn't
represent a performance it, so I may consider a future change to just
go strictly with the inline constexpr versions and eliminating the
separately compiled version altogether. Will mull that over.
2021-02-03 22:52:56 -08:00
Shootfast 8b4ecb508a Static building (#2854)
* cmake: Make LibRaw Jasper and LCMS2 detection optional, add LIBRAW_NODLL

* cmake: Fix OpenColorIO defines on Windows to use correct cmake mechanism

* cmake: Add missing LibRaw defines (needed when linking statically)
2021-02-03 22:52:16 -08:00
Larry Gritz cf9ca07ffb Update INSTALL regarding libheif versions 2021-02-02 09:18:57 -08:00
Clifford Stein da257ab644 Move farmhash.h to detail subdirectory 2021-02-01 18:10:56 -08:00
cmstein c3ea0329ea make hash functions constexpr friendly so we can compute string hashe… (#2843)
make hash functions constexpr friendly so we can compute string hashes at
compile-time for CUDA/OptiX shaders in OSL.
2021-02-01 18:10:56 -08:00
Larry Gritz 5a7dedd6d2 Bump version after release 2021-02-01 18:10:56 -08:00
Larry Gritz d92de54ca6 Build break fix for new Qt version in VFX Platform 2021 (#2852)
Also bump the number of allowed timeouts on Windows to help pass
tests until we fully track down the OpenEXR deadlock problem.
2021-02-01 17:54:55 -08:00
Larry Gritz 6a8b6ffbfd Bump version after release 2021-02-01 16:34:40 -08:00
Larry Gritz af7f0d333f CHANGES 2021-02-01 11:26:49 -08:00
Larry Gritz 54e13fd173 CI: Temporarily lock 'bleeding edge' pybind11 to v2.6.3
Something seems to have broken in their master. Lock to the last known
working release so tests pass, while I sort this out.
2021-02-01 10:23:06 -08:00
Larry Gritz f259e59d7d Fixes to support libraw 202101 snapshot, in progress 0.21.0 (#2850)
Some fields have disappeared from certain structures, so we need to make
adjustments to the various conditional compilation guards.

This patch just makes OIIO build against the new libraw, and is intended
to be backported to the release branch.

This patch does not incorporate any new fields added to libraw
structs, representing newly retrieved metadata. A separate PR patch
will address the newly added capabilities (TBD whether or not that
ends up safe to backport and when).
2021-01-30 21:11:39 -08:00
Larry Gritz 06ab90dd7e OpenColorIO v2 miscellany (#2849)
Bump CI "current releases" test to OCIO v2, it's released!

Oops, we used the wrong name for the env variable, and that CI test
wasn't getting the OCIOv2 RC all along!

Add OIIO::ColorConfig::OpenColorIO_version_hex().

Have oiiotool --help print the OCIO version.

Also Bump the pybind11 version for the "latest" test, and update
INSTALL.md a bit to document the latest versions known to work of
several dependencies.
2021-01-29 22:04:22 -08:00
Larry Gritz 6ebcf0a56c CI: Reduce redundant verbosity in the output during dependency building 2021-01-29 22:04:11 -08:00
Larry Gritz cbecc92461 Use std types, not TIFF-defined types (#2848)
libtiff trunk is removing these custom types from future
versions. They have been there forever, since long before the std
versions were present.
2021-01-29 22:03:59 -08:00
Larry Gritz ef781a211b Don't use the version of libheif that's known to be broken on Mac (#2847) 2021-01-28 15:20:16 -08:00
Larry Gritz 0234b6dbbe Fix argument order mismatch on IBA::ociolook and ociofiletransform (#2844)
Ugh, the argument order of the headers and documentation didn't match
that of the implementation, with the inverse and unpremult args swapped.
2021-01-28 15:20:08 -08:00
Larry Gritz a2d5cd9c6d Start staging span and string_view size and ssize changes (#2827)
When we wrote our `span<>`, we based it off the draft for std::span,
which at that time specified span::size() as ptrdiff_t, which is
signed. By the time std::span got finalized in C++20, it was changed
to size_t, which is unsigned. Ick. Switching to size_t will be an API
break, so we can't do that until we're at a version where it's ok to
make breaking changes.

But we can stage a few changes that will make that future transition
easier.

* Add std::size() and std::ssize() wrappers for both span and
  string_view.  This gives downstream apps the opportunity to avoid
  span::size(), instead using std::size(the_span), which is guaranteed
  to be unsigned, and std::ssize(the_span), which is guaranteed to be
  signed, and both of these will work now as well as after we make the
  other breaking changes.

* Doing this properly required adding a couple 'constexpr' in places
  where they should have been all along.

* Define macros OIIO_SPAN_HAS_STD_SIZE and OIIO_STRING_VIEW_HAS_STD_SIZE
  making it easy to know if std::size and std::ssize are defined for
  span and string_view

* OIIO_SPAN_SIZE_IS_UNSIGNED will be defined when OIIO::span switches
  to having an unsigned size like std::span (making it easy for client
  software to know if span::size is signed or unsigned).

  Turn this on automatically for OIIO >= 3.0 so we don't forget.

  If client code predefines OIIO_SPAN_SIZE_IS_UNSIGNED before
  including span.h, that forces span::size to unsigned now (good for
  experimentation and compatibility testing, but I don't recommend
  anybody ship software in that state unless they really know what
  they are doing and don't mind potential incompatibility with the
  out-of-the-box OIIO).

These SHOULD NOT break any existing code or ABIs that uses our
existing span and string_view classes or their size() methods. It only
adds options that will help bridge compatibility.
2021-01-23 11:26:53 -08:00
Larry Gritz 9917958a7b Windows CI: get tiff-suite test passing on Windows (#2840)
We were failing this test because of lack of JPEG support in the TIFF we
were building. Rather than fight it, just use vcpkg to get tiff.
2021-01-23 11:25:59 -08:00
Larry Gritz da1f27af66 Changes to make filesystem_test work properly on Windows (#2836) 2021-01-20 09:59:42 -08:00
alister-chowdhury bec3f038b2 Changing pybind11 bindings to used SHARED rather than using MODULE (#2830) 2021-01-18 12:44:03 -08:00
Larry Gritz 02be6659c5 Try to fix oiiotool-copy and oiiotool-maketx test for Windows CI (#2835) 2021-01-18 09:29:20 -08:00
Larry Gritz ebd24245af imagebuf_test: reset the IB before we remove the file it's reading (#2834)
This is a weird thing we're doing in this very artificial test,
removing a file when the IB reading it is still alive. That's safe on
Unix, where a file with an open file handle still be safe to read even
if it's removed.  But it's not kosher on Windows.  Fix by simply making
sure that in this test, we aren't doing the unadvised thing of having
the IB still active on the file we're deleting. This should fix the
unit_imagebuf test that is failing our Windows CI.
2021-01-17 19:40:37 -08:00
Larry Gritz 26ceab5d13 platform.h: define OIIO_INLINE_CONSTEXPR to be inline constexpr (#2832)
But only for C++ >= 17 when inline constexpr variables became available.
It defines to simply constexpr for older C++.
2021-01-17 19:39:29 -08:00
Larry Gritz b26a2979a4 Simple macros for testing if OIIO is < or >= a certain version (#2831) 2021-01-17 19:39:19 -08:00
Chris Whalen 75ab8d8304 added openjpeg-2.4 to OpenJpeg_include_paths (#2829) 2021-01-17 19:38:36 -08:00
Larry Gritz fec17162c6 Windows CI fix: windows shell treats quotes differently (#2826) 2021-01-17 19:38:18 -08:00
Larry Gritz 33f0690772 Fix doc -- C++-like declaration crept into python docs 2021-01-14 12:54:34 -08:00
Larry Gritz 001d3ab123 CI: Bump some dependency versions that we test against (#2823)
* CI use latest PugiXML release

* Have the 'latest' test use OCIO v2 RC1

* Bump which version of fmt we download by default
2021-01-14 12:54:24 -08:00
Larry Gritz 1dc079a489 Update ref images after recent changes to oiiotool error messages (2825) 2021-01-13 22:40:32 -08:00
Larry Gritz 90f5f0fba9 Various fixes to make more Windows CI tests pass (#2821)
* Try to address the OpenEXR thread pool hanging when we call exit().

    * Strive to remove all exit() calls after any file reads happen,
      in oiiotool, iconvert, and idiff.

    * This DOES NOT stop all hanging. It's still a bit of a mystery whether
      there is anything we can do to fully prevent it without a fix on the
      OpenEXR side.

    * Temp workaround: for the Windows CI tests, use ctest commands to
      allow each test to timeout 3 times before giving up. To be clear,
      this does not solve the problem, it only masks it. But it helps
      us "pass" those tests, exposing any other problems occurring with
      them, and we will return later to find the source of any residual
      timeouts.

* Update ref output for several tests where the differ slightly under Windows.

* Make runtest.py convert text output line endings cr-lf -> lf before
  comparing to reference output. (This eliminates unnecessary diffs.)

* Update many tests' run.py file to use double quotes instead of single
  quotes for arguments containing some characters -- looks like the Windows
  shell invoked by Python system() does not handle the single quotes quite
  the same way as Unix shells.

* oiiotool: when printing the command line after errors, genericize
  identifiable filenames so they render the same on Windows and POSIX,
  and strip directory name from the oiiotool filepath. This makes
  error output comparison more equal between Windows and POSIX, making
  several more tests pass.

In total, this seems to get us down to failing only 7 tests (not counting
spurious timeouts that cause failures).
2021-01-13 11:56:42 -08:00
Larry Gritz 309c29f8b5 Some refactoring to remove unnecessary linkage to python libs (#2807)
Use pybind11 functions to set up python module, it's got superior logic
to what we were doing.

Bump pybind11 version default in build_pybind11.bash

Suppress clang warnings about python register use
2021-01-13 11:56:42 -08:00
Fabien Servant fa59ef61b2 [exif] memory leak in exif parse (#2824) 2021-01-13 11:56:42 -08:00
Larry Gritz fca99cc5eb Argparse::abort() stops further processing of arguments (#2820) 2021-01-13 11:56:42 -08:00
Larry Gritz e9ff5306c4 Filesystem::generic_filepath. (#2819)
Similar to C++17 std::filesystem::path::generic_string(), but for a
filepath sent as string_view.

While I was there, I noticed that a few Filesystem functions that I
declared as `noexcept` actually call things that can throw, so I put a
few try/catch in stratgic spots. Nobody had reported a problem with
this, and maybe it would be fine, but it's the right thing to do.
2021-01-13 11:56:42 -08:00
Larry Gritz ae4d5ca495 CI: fix Windows python tests (#2805)
* Change to finding a consistent Python version (3.7)

* Install numpy

* On Windows, convert crlf to lf before diffing reference output, so we
  don't get mismatches just because of LF vs CRLF.

* Update ref output on testsuite/python-imageinput

* Fix windows detection in runtest.py oiio_relpath

* Fix some semicolon problems that were making bash command lines conused

Along for the ride:

* Have ci-build-and-test.bash send OIIO_CTEST_FLAGS as extra args to ctest

* Remove some needless verbosity from the dependency building scripts.
2021-01-06 11:15:22 -08:00
Harry Mallon 317a3a0bdc Fix tests with libheif built without AV1 support (#2818) 2021-01-06 11:15:22 -08:00
Larry Gritz c75dbdc66e Fix recently-symptomatic python2 vs clang warnings (#2815) 2021-01-06 11:15:22 -08:00
Larry Gritz 474ed3865b Fix build break against OpenColorIO master -- headers disappeared (#2817)
The functions we depend on are all still there, they just moved from
these headers into the main OpenColorIO.h.
2021-01-05 20:23:15 -08:00
Larry Gritz a4a6c572d9 Fix build break for older libheif (#2814)
With some recent heic related packages, we lost the ability to build
against some older libheif versions that we purport to support. We may
eventually want to raise the minimum supported libheif, but in the
mean time, this restores the prior build abilities.
2021-01-05 15:11:41 -08:00
Harry Mallon 8be88d269f Enabled AVIF encoding with libheif (#2811) (#2812)
Requires libheif built with libaom or dav1d/rav1e
2021-01-05 12:27:12 -08:00
Harry Mallon 84852ebae5 Enabled AVIF decoding with libheif (#2811)
Requires libheif built with libaom or dav1d/rav1e

Add a test file and simple test for AVIF
2021-01-04 15:30:06 -08:00
Harry Mallon bbd8101a69 Re-add the HeifInput valid_file check (#2810)
Perhaps an earlier version of libheif was missing the defs? Not sure.
2021-01-04 11:37:27 -08:00
Harry Mallon f62036ab8d Fix error decoding Apple HEIF files (#2809)
* 0 size metadata causes an issue in the libheif cxx wrapper
* fixes #2794
2021-01-04 11:06:44 -08:00
Larry Gritz 766deab023 Fix several Windows CI tests involving text (#2798)
* Re-enable vcpkg installation of freetype on windows

* Add TESTSUITE-README.md file

We'll use this file to document how the testsuite works and how users
should update it when necessary.

* Re-enable windows tests
2021-01-04 11:06:31 -08:00
debaetsdandDieter De Baets 4cf32b32f8 Windows CI fixes (#2796)
* fixes to make vs2019 CI run. Not passing yet as some tests fail

* added explicit ctest timeout (180sec) + misc fixes to run CI local

* disable Windows VS2019 tests again as they are not passing yet

Co-authored-by: Dieter De Baets <dieter.baets@unity3d.com>
2020-12-30 23:37:25 -08:00
Larry Gritz 11b03fc4d5 CI: Test against latest libtiff release (#2792) 2020-12-30 23:37:25 -08:00
Larry Gritz c2a09c2fd0 ustring hash collision instrumentation (#2786)
OSL has some concerns about how ustring hash collisions could impact
its strategy for strings on GPU.

This patch adds some instrumentation to ustring to detect hash
collisions.  Added static ustring methods total_ustrings() and
hash_collisions(). The latter tells you the number of collision pairs,
including optionally enumerating them into a vector of ustrings. Also,
`getstats(verbose=true)`, in Debug builds only, will print all of the
colliding pairs.  These are both somewhat expensive if there are lots
of strings (my laptop takes about 4 seconds to find and print all
collisions for 10M ustrings). So if you are concerned about
performance in debug builds, call getstats(false) instead if you have
a truly enormous ustring table.
2020-12-30 23:37:24 -08:00
Larry Gritz 8a1db1b13c Bump version after release 2020-12-30 23:37:24 -08:00
Larry Gritz 5167b11277 CHANGES for 2.2.10 release 2020-12-30 23:37:07 -08:00
Larry Gritz 9d8cda7cca Avoid stray pyconfig.h definition of 'copysign' causing problems (#2800)
Caused build errors on Windows due to conflicting definitions of copysign (one of which was a macro).
2020-12-30 21:48:16 -08:00
Chris CrosettoandChris Crosetto 0f8a453f5a Fix crash parsing OpenEXR header with certain Rational attributes. (#2801)
Fix a few issues parsing rational values with large denominator in OpenEXR header.

Incorrect array index can cause divide by zero crash (observed consistently on Windows with repro image).

Conditional comparison was assigning 1 or 0 to int f declaration instead of gcd value.

Changed gcd type parameter to long long to avoid unsigned int->long int overflow on windows (long int is 4-bytes on windows).

Co-authored-by: Chris Crosetto <ccrosetto@gmail.com>
2020-12-30 12:04:10 -08:00
Larry Gritz 1406bb8e66 Mac CI cleanup (#2791)
* No need to uninstall openssl for mac ci (in fact, it breaks things now)

* Mac CI python and numpy install refinement
2020-12-20 19:25:43 -08:00
Larry Gritz 3de6233f41 Docs: add missing modifiers to -otex (#2790) 2020-12-18 12:18:32 -08:00
Patrick Piché 5f92a5af48 Removed some duplicates in maketx.rst (#2785)
Removed some duplicates
2020-12-18 12:18:09 -08:00
Larry Gritz b5bb85d02b Fix webp compile break on 32 bit systems (#2783)
The WebPData::size is a size_t, on 32 bit systems it will balk at our
putting a uint64_t in it. Downcast explicitly so the warning doesn't
flag us.

Also some changes to ensure adequate testing of webp in CI. (Even though
we only CI test 64 bit systems, so this was not related to the specific
build break being fixed... but an excuse to make sure we are hitting it
a reasonable amount in CI.)
2020-12-10 10:05:44 -08:00
Larry Gritz 01742570d1 Better error reporting for IOFile, esp. for OpenEXR writes (#2780)
Filesystem::IOFile constructor now upon an error opening the file will
set the error message appropriately.

Move IOProxy::error() implementation from inline to be in
filesystem.cpp to hide its details, use a static mutex to make error
set and retrieval be thread-safe (we presume that the rare chance that
multiple threads will be setting or getting IOProxy errors
simultaneously are rare enough that it's not a thread performance
issue, and if the user is getting file I/O errors, a bit of minor
locking is the least of their worries).

Better checking of these errors in OpenEXR input and output open
operations.  Hopefully this means that exr file I/O errors will
percolate up more helpful error messages.
2020-12-10 10:05:27 -08:00
Larry Gritz a0b2611526 CI: Make sure we test the latest fmt, PugiXML, and pybind11 releases (#2778)
Also add build scripts for ninja and gif.
2020-12-06 23:36:00 -08:00
Larry Gritz eac83b2d95 Fix rare OpenEXR multithread output crash (#2781)
TL;DR: This could crash during openexr output, turned out to be a subtle
race condition.

Long explanation:

Metadata gets prefixed with `<formatname>:` in cases where it's only
meant to be understood by the reader or writer of one format.  Formats
that support arbitrary metadata filter out any items that are prefixed
by the name of a different format (so you don't, for example, when
converting file formats, incorrectly copy a TIFF-specific metadata
hint into an OpenEXR file as literal metadata).

The specific code we used in the OpenEXR writer tried to do this but
got the threading locks wrong, and this could lead to very rare, subtle
crashes. It could have been fixed by a 3-line very local fix, but...

I also noticed that the same code was replicated in Field3D output (and
quite incorrectly -- in the cut and paste from the openexr code, it was
still looking for "openexr:" prefix instead of the correcd field3d one!).

Since this idiom was happening (wrong) in two different places, and
seemed likely to crop up again some time, instead of fixing locally I
added a new API call, `is_imageio_format_name()`, to do this centrally
and correctly.  So most of this patch is implementing that and then
using it instead of the incorrect code elsewhere.

Also add python bindings and docs for the new API function
2020-12-06 21:58:01 -08:00
Larry Gritz 2d7660b59c Remove appveyor.yml -- broken and no longer needed. (#2782)
We test Windows build with GitHub Actions CI now, this is no longer
needed and a PITA to maintain.
2020-12-05 21:50:22 -08:00
Larry Gritz 716d86f465 Support UTF-8 filenames for GIF (#2777)
Required adding a utility function Filesystem::open that returns an
integer file descriptor.
2020-12-02 10:25:50 -08:00
Larry Gritz a16ac8acc7 Bump version after release 2020-11-30 23:21:20 -08:00
Larry Gritz 99d6947b8d CHANGES 2020-11-30 23:09:14 -08:00
Larry Gritz 29ddf1e6b7 Extend checked_find_package with VERSION_MIN and VERSION_MAX (#2773)
Upon reading cmake docs mre carefully, it's clear that when you pass a
version to find_package (which does much of the heavy lifting inside
checked_find_package), it DOESN'T MEAN you want that version or
later. It means you want to find a version that is "compatible" with
the named version. The meaning of "compatible" is up to the package.
Some packages define it as being >= the requested version. Others
define it as being the same major release, or same major AND minor
release, or exact.

But generally speaking, we only care about the minimum version (e.g.,
"I want FooBar 8.0 or later"). And it's not guaranteed that is what
the package's compatibility will do. In fact, FooBar may be using
compatibility mode "SameMajorVersion", which will make our find of
FooBar succeed for 8.0, 8.1, 8.2, but if a user encounters FooBar 9.0,
our build will reject it, even though it's probably fine.

So I augmented our checked_find_package wrapper to take optional
VERSION_MIN to give the real minimum version, when that's the semantic
we really want (in which case we would omit the ordinary version
number used for the compatibility check and let VERSION_MIN do all the
work). There's also an optional (and usually omitted) VERSION_MAX that
you can use if you are sure that we must be less than a certain
version (the max is exclusive, you must be <, not <=, whereas the min
is inclusive >=).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-27 12:30:35 -08:00
SRHMorris 9e77cdecf5 Fix bmp row order (#2776) 2020-11-26 12:04:38 -08:00
Larry Gritz 6189faeaf7 CMake refactoring and subproject friendliness (#2770)
* Detect if OIIO is being built as a subproject, and if so, set
  `OpenImageIO_IS_SUBPROJECT` (a.k.a. `${PROJECT_NAME}_IS_SUBPROJECT`).

* Move all the testing logic out of the main CMakeLists.txt (and a few
  testing-related macros from oiio_macros.cmake) and into a new
  src/cmake/testing.cmake.

* Move all of the packaging logic out of the main CMakeLists.txt and
  into a new src/cmake/packaging.cmake.

* Make all the testing and packaging inactive if this is being built
  as a subproject. Also disable the clang-format target for subprojects.

* Move fancy_add_executable and add_oiio_plugin from oiio_macros.cmake
  into their own files (leaving oiio_macros.cmake empty and
  eliminating it).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-21 22:26:13 -08:00
Larry Gritz c46a47f00b Unbreak CI on Mac
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-21 22:26:04 -08:00
Larry Gritz e9881d0e3f Unbreak CI on Windows (#2772)
Some permissions on GH changed due to security concerns, and that broke
the setup-nuget action we were using... which turned out to be obsolete,
anyway, and switching to the new recommended replacement fixes everything.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-21 21:59:55 -08:00
Larry Gritz 5d10f088a0 Docs: Set up to try sphinx_tabs extension (#2768)
Inspired by OpenColorIO's beautiful docs, I'm adding the "sphinx_tabs"
extension to our docs, and testing them out in one little spot in
ImageBufAlgo to see if we like the effect.

Please look at https://openimageio.readthedocs.io/en/rtd/imagebufalgo.html
look at the first couple screenfuls to see the example of how the
tabs look. Opinions are welcome. Should we do this kind of thing more
extensively?

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-18 17:21:13 -08:00
Larry Gritz 581b59d3ad Read exif encoded in PNG files (#2767)
At present, it only reads Exif from png, it doesn't write.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-15 16:53:52 -08:00
Larry Gritz ab3f04204b Build against OpenEXR 3.0 + Imath 3.0 (#2771)
As OpenEXR works toward their 3.0 release, which includes splitting
Imath (the vector, matrix, math, and 'half' stuff) out into a separate
repo, their top of tree master finally breaks our "bleeding edge"
build.

This is a little tricky, because now our support of this dependency is
attempting to span 3 eras: 3.0 with the full split of openexr from
imath, recent openexr+ilmbase 2.x that supplies reliable exported
cmake configs, and older 2.x that predates cmake configs. Eventually
we'll phase out older versions and clean up.

Fixes in this patch generally include:

* Add a new CI test of VFX2021 + openexr/imath master. (This will go away
  when 3.0 is released and that's what we use for the main 2021 case.)

* For new enough versions of OpenEXR, use the exported config file and
  targets, rather than the old style OPENEXR_LIBRARIES style variables.
  We have kind of a mixed idiom use because we're still supporting older
  versions that predate use of the config files.

* Move imath includes to new OpenImageIO/Imath.h Deal with the fact
  that the Imath headers now live inside `<Imath/ImathBlah.h>` rather
  than `<OpenEXR/ImathBlah.h>`. But of course, you need to start
  including things just to find out the version. It's tricky.  The
  logic is to look at `<OpenEXR/OpenEXRConfig.h>` to determine the
  version we're dealing with, then include Imath stuff from one or the
  other depending on what we found. I rearranged quite a few includes
  to ensure that all this logic only happens in a couple spots and the
  rest gets included transitively. As it turns out, quite a few of our
  `#include`s of Imath headers were redundant.

* OpenImageIO-C depended on OpenImageIO publicly, but actually it
  should depend on OpenImageIO privately, but export its include
  needs.

* OIIO's exported config needs to look for OpenEXR.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-15 16:53:51 -08:00
Larry Gritz 2721bd60df clang-format fix
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-09 18:24:34 -08:00
Larry Gritz feca3fe4ff Improvements to docs and breathe setup (#2762)
* Bump breathe release to the latest (we'e been holding back because of
  errors that we fix in the other elements of this patch, below)

* Changing declaration formatting, particularly in the ImageBuf and
  ImageBufAlgo chapters, eliminates function ambiguity warnings and even
  python exceptions we were getting in Breathe before.

* Document missing texture option fields and improve formatting.

* Instruct Doxygen to not catalog deprecated ImageBufAlgo functions.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-08 08:51:08 -08:00
Fabien Servant 16a6951e07 libraw user_flip configuation option (#2769) 2020-11-08 08:51:08 -08:00
Larry Gritz fdd2985cfa Document jpeg output hints
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 22:41:01 -08:00
Larry Gritz 35a68d2581 Fix reading TIFF files with "separate" planarconfig (#2757)
There is a big bug lurking in how we read TIFF files with "separate"
planarconfig (RRRGGGBBB, versus "contig" RGBRGBRGB). I knew that
libtiff when reading scanline files doesn't support true "random
access" to scanline for most compression methods -- because you can't
seek to the start of a scanline in the middle of a compressed "strip,"
you have to read whole strips, or read individual scanlines
consecutively. But what somehow I've misunderstood for years (if not
decades) is that for "separate" planarconfig, this means that you
can't jump from scanline i in plane 0 to scanline i in plane 1! You
have to read all the scanlines (at least within one strip) in a single
plane before moving to the next plane.

This means that we get all sorts of read failures when reading TIFF
files meeting all of these conditions:

* "separate" planarconfig (these are rare in general)
* Scanline-oriented (tiles are fine, because they're read whole)
* More than one channel (with one channel, separate and contig are
  basically the same)
* Certain compression codecs (turns out the separate+scanline combo
  tests in the libtiff example suite are uncompressed, which is how
  our testsuite failed to catch this).
* rowsperstrip > 1 (if rps == 1, every scanline is a new strip, and
  that worked)
* written by an app that doesn't use OpenImageIO (because OIIO TIFF
  output forced rps=1 for separate planarconfig)

Things were very broken. There is a comment in tiffoutput.cpp that says

    // I can only seem to make separate planarconfig work when
    // rowsperstrip is 1.

and forces rps=1 for separate planarconfig output. So at some point
many years ago I realized that something odd was happening here, but I
apparently I thought it was a bug in libtiff when writing with rps > 1.
Probably we were writing correctly all along, and the real bug was in
the reading.  This also explains why we had mostly not seen this
problem before, which is because all OIIO-written files avoided
producing tiff files that fell into the failures case.

This patch mostly fixes it and also makes a number of performance
enhancements:

* Fix misunderstanding in read_scanlines where it was loose with thread
  safety in retrieving the rows per strip.

* In read_scanlines when deciding the "chunk size" to limit temp
  buffer size, and in read_image when deciding how many scanlines to
  read at a time via read_scanlines, these computations weren't the
  same, leaving slivers to be read alone instead of staying aligned
  with strips. Make those both compute the same way, so from read_image
  on down, we end up reading chunks that are always aligned with
  strips.

* TIFF read_scanlines used to try to read whole strips, except for
  reading individual scanlines that didn't comprise a whole strip
  length. Modify it to recognize that the one exception is the last
  strip in the file, in which the strip is shorter than usual if the
  total number of scanlines is not an even multiple of rps. This
  ensures that the last strip is read as a strip, not as individual
  scanlines.

* Imagecache autotile behavior is modified to force the pseudo-tile
  size to be a multiple of the strip length. Again, that keeps the
  resulting reads to always be in units of strips, which is much more
  efficient and is the safe way to seek and read separate
  planarconfig.  Also, always turn on autotile for any tiff file with
  rowsperstrip > 1, because it's already organized that way in the
  file. This is not only more efficient generally, but also makes it
  so that ImageCache will only do reads aligned safely to strip
  boundaries.

This is not a complete solution, in the sense that an app making
individual read_scanline calls for solo scanlines, or read_scanlines()
that is not aligned to strips, can still have read failures for TIFF
files that are just the right combination of separate planarconfig +
certain compressions + scanline order.

However, with this patch, the following common cases will ALWAYS work
correctly now: (a) read_image or read_scanlines of the whole image
size; (b) any reads mediated by ImageCache or TextureSystem; (c) all
images read by ImageBuf (which always use either (a) or (b)); (d) all
operations of oiiotool (which use ImageBuf).

After this patch is merged, solving the common cases, I'll return to
the topic to tackle the remaining issue of broken reads for these
files when doing individual ImageInput::read_scanline reads or
read_scanlines with ranges not aligned to strips. To make those work,
I'll need some kind of ugly internal strip buffering.

I'm going to leave the "force rps = 1 when writing planar separate tiff"
as it is, because even after this set of fixes, software using old
versions of OIIO will not be able to correctly read rps>1 planar files,
so we wouldn't want to be inadvertently writing them, at least not
until all the pre-fix OIIO releases are unlikely to be used by
anyone. Not writing planar files with rps>1 is not much of a
sacrifice, considering how rarely planar files are used at all.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 20:59:36 -08:00
Larry Gritz 537763e4a3 Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 20:59:16 -08:00
Larry Gritz 6fc196607c CHANGES and CREDITS updates
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 20:56:33 -08:00
Larry Gritz e660b7e247 Build: Require exact version if PYTHON_VERSION is specified (#2764)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 17:45:07 -08:00
Larry Gritz 4dc6c7816d CI: Just run all tests, don't try to cleverly exclude some (#2766)
We were running some CI tests only for PRs or for certain branches.
This may save some time, but I found that I was, more often than not,
naming my branches to trigger all tests to run. That's silly. Just run
all the tests every time, it's not that expensive.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 16:57:10 -08:00
Larry Gritz 43ff4d4b3f Changes for recent OpenColorIO v2 (#2765)
OCIO master recently renamed the symbol in its headers that we used to
detect its version, breaking OIIO's build against the current OCIO
top of tree master.

This change makes our FindOpenColorIO.cmake work with both old and new
OCIO.

Also, cut out other useless OCIO building (for our purposes) by having
our build_opencolorio.cmake disable buildig of GPU tests (which,
recently, became controlled by a different option than is used to
disable building all the other tests).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-11-01 16:57:10 -08:00
Larry Gritz cc0a14fd9f CI: Better libraw testing (#2761)
* Accommodate changes for 0.20.2 that Homebrew now has.

* Mistake in variable naming meant we weren't testing libraw master as
  we previously thought.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-29 19:01:48 -07:00
Jan Hettenkofer dc22640b66 Docs: illustrate reading image data into separate per-channel buffers (#2756)
Related to #2744
2020-10-27 21:29:04 -07:00
Larry Gritz b22a3fad02 CI: Simplify install_homebrew_deps.bash for modes we don't use (#2753)
Now that we use Linux and the ASWF docker containers for the
"clang-format" test, there's no reason to have logic in this setup
script for Mac to choose a more restrictive set of package for that
case.

Same for clang-tidy -- we don't have a test like that anyway, and
if we add one, we will surely do it with one of the Linux containers.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-25 12:02:37 -07:00
Larry Gritz 7abec22847 WebP input overhaul (including animated webp and metadata) (#2730)
* WebP input overhaul (including animated webp and metadata)

Huge overhaul of webp reading. Since webp support was first added in
2011 (with no major changes since, other than a couple minor bug
fixes), we have been using the basic/simplified webp API, which had
many limitations.  This patch rewrites it to use the more complete
API. This results in the following changes and new capabilities:

* RGB images are kept as 3-channel instead of forced to be RGBA upon
  input.

* Skip alpha premultiplication for RGB files. And for RGBA, skip the
  dubious color space transformation when doing premultiplication of
  RGBA files. I think this has been wrong all along.

* We can now read animated webp images (akin to animated GIFs, they look
  like multi-subimage files).

* Much more efficient to read just the header, the pixels are read and
  decoded lazily.

* Switch to the WebPDecode*Into API calls, which lets us preallocate
  and manage the decoded image buffer (as a unique_ptr). Also switch
  the encoded buffer from a std::vector to std::unique_ptr, which
  avoids an unnecessary zeroing out of the buffer.

* Close the file handle immediately after we're done reading, rather
  than leaving the handle open until the client is done with the
  ImageInput.

* Read Exif metadata properly from webp files.

* To use the more sophisticated API, we need to find and use the
  libwebpdemux library.

* Since there is a "LoopCount" metadata here, similarly to with GIF, I
  decided to make an OIIO metadata "oiio:LoopCount" that will work
  with both. GIF saves with this, too, and "gif:LoopCount" is now
  considered a deprecated synonym.

Fixes #2721

N.B. This only covers webp input, not output. A similar overhaul should be
done eventually on the output side.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-23 11:36:04 -07:00
Larry Gritz ef627e53de CI: lock down on clang-format 10 (#2751)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-22 21:26:15 -07:00
Larry Gritz f6971293be Work around GHCI Mac problem with homebrew openssl (#2750)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-22 21:21:54 -07:00
SRHMorris 39689b9c8a Add support for saving progressive jpegs (#2749) 2020-10-22 12:33:28 -07:00
Larry Gritz 1983edc550 oiiotool: Improve guessing about output format based on inputs (#2717)
What data format does oiiotool write for its outputs? The ones
specified by -d, if supplied, but otherwise it will make a guess based
on the types of inputs it has seen.

This patch makes several improvements:

* Multi-subimage files were getting very confused because different
  subimages may want different data formats, and it was at best
  remembering data formats overall and by channel name, but not taking
  subimages into consideration. Make this much more specific by
  remembering both raw channel names (for all subimages), as well as
  specific channels of named subimages.

* The way the input data formats were remembered had repeated (and
  non-matching) code depending on whether the input was read
  immediately or lazily.  That is now cleared up, with the logic
  refactored and expressed only once.

* The -d directive can specify a type (for all channels), a type for a
  particular channel name (`channel=type`), and -- this part is new --
  a type for all channels of a named subimage (specified as
  `subimage.*=type`) or just one channel of a specific subimage
  (`subimage.channel=type`).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-21 09:46:11 -07:00
Larry Gritz 35b4576dd3 Make readthedocs generate downloadable html as well as pdf (#2746)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-21 09:46:11 -07:00
Larry Gritz 3a99936a77 Confirm that we can build with Clang 11
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-20 22:25:35 -07:00
Larry GritzandDeclan Russell 530bbd3ce3 Fix Cuda build break (#2743)
Cuda 10.1 seems to have trouble because of the `__attribute__` used in
`OPENIMAGEIO_PRINTF_ARGS`. Declan Russell suggests modifying the `#if`
to avoid using it for `__CUDACC__`.

LG further observes that `OPENIMAGEIO_PRINTF_ARGS` is only used for
the declaration of two functions, it seems like a nice decluttering to
just directly use the short attribute exactly where it is needed
instead of having a lengthy explanation and possibly defining
`__attribute__` everywhere as a side effect.

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

Co-authored-by: Declan Russell <declan@solidangle.com>
2020-10-20 22:18:28 -07:00
Larry Gritz d44de82931 IC bug fix: add_tile/get_tile not peroperly honoring chend < chbegin (#2742)
For IC::add_tile() and IC::get_tile(), the documentation advertised that
passing chend < chbegin meant "all channels". But the implementation was
setting chend=nchannels but not setting chbegin to 0.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-15 23:18:58 -07:00
Larry Gritz d136f98ff6 pugixml build fixes (#2733)
* Bring back the idea of a Findpugixml.cmake file because it turns out
  that (for pugixml <= 1.10) the exported config files are not reliable.

* Fix CI scripts to build PugiXML (with a few different versions). We
  previously were relying on the embedded version for all CI tests, which
  masked problems associated with using an external PugiXML.

* Fix deprecation warnings about xml_document.load(), the new call is
  xml_document::load_string().

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-11 15:12:50 -07:00
Larry Gritz fc5c4844e6 Fix CI break (#2741)
One of our CI matrix entries -- building with clang -- has
mysteriously broken with compile errors complaining about reallocarray
being inconsistently declared in stdlib.h and gif_lib.h. It just broke
a few days ago, unrelated to any changes on our part. I have no idea
if it was the compiler or gif library that got updated and then broke.
Whatever. Insulate ourselves from random changes on GHCI by converting
this test to use one of the ASWF containers that we can count on to
have stable dependencies installed.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-11 15:12:50 -07:00
Larry Gritz ce6b763249 python cleanup (#2705)
Switch from old cmake macros that were marked obsolete in cmake 3.12 to
the new FindPython.cmake module.

Instead of defaulting to python 2.7, default to whatever is found.
But user can still set PYTHON_VERSION variable to request a specific
one in case there are multiple.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-10 11:20:22 -07:00
Brice Gros 0a3a68b57c WebP: add support for lossless attribute of image spec for webp (#2726) 2020-10-10 11:20:22 -07:00
Larry Gritz 5d9945b55b oiiotool: Enhance --chappend and --siappend (#2709)
For both, allow an optional modifier ":n=" to specify the number of
images from the stack to be combined by having their channels or
subimages appended (versus the default of combining just the top 2
images).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-09 13:36:07 -07:00
gbansal2andGaurav Bansal a1ebb935fb Fixed ARM NEON code path in simd.h, all tests in simd_test are passing (#2739)
Co-authored-by: Gaurav Bansal <gbansal@apple.com>
2020-10-09 13:36:07 -07:00
Larry Gritz 9cee6827cf make_texture was not correctly setting tile sizes (#2737)
It was setting it, but later, too late for the particular case where
constant_color_detect was used and found a constant color and also the
config spec came in without any tile preference (still 0's).  So move
the default initialization up to the top.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-07 21:17:51 -07:00
Larry Gritz 80fccb90a4 Fix broken read of 16 bit iff files (#2736)
This used to work, was inadvertently broken in #2398, in Nov 2019, and
no release of OIIO 2.1 ever had it working!  (I guess people don't
come across 16 bit iff files very often?)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-06 23:10:23 -07:00
debaetsd 3f2e217c60 Fix boost linkage on Windows (#2727)
Boost date_time, though never explicitly called in OIIO code, can be transitively pulled in by boost threads. This seems to be a problem on Windows when you build a partial boost containing only the libraries you think you need.

The solution seems to be to set BOOST_ALL_NO_LIB on MSVC, even for the dynamic linking case.
2020-10-06 23:10:23 -07:00
Larry Gritz 9a8a1e041e More principled approach to alloca to avoid stack overflows (#2716)
A bug (issue 2713) revealed that an alloca in IBA::colorconvert could
cause a stack overflow on an image that had an unusually wide number of
columns per scanline.

This patch takes a number of measures to help root out these problems
in the future:

* The OIIO_ALLOCA macro is amended to assert (in DEBUG builds only)
  upon any attempt to alloca more than 1MB, which is surely a sign that
  we have used alloca in an inappropriate place.

* A new OIIO_ALLOCATE_STACK_OR_HEAP macro is used to encapsulate an
  idiom I have used before, to alloca small things but new[] big things,
  and ensure in both cases that the memory is freed when the function
  exists scope. I choose arbitrarily for "big thing" to mean <= 64 KB,
  which is big enough for one 64x64 tile or one scanline of a 4k image
  if it has 4 float channels, that means most of the time we'll safely
  allocate on the stack, but for anything larger, it will use heap.

* Use OIIO_ALLOCATE_STACK_OR_HEAP in those problematic spots of
  colorconvert.

* Use OIIO_ALLOCATE_STACK_OR_HEAP in a few other places that seem
  prudent.

* Grepped through the code for all instances of OIIO_ALLOCA and I think
  that all the potentiallly "big" ones are now using the safe idiom.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-10-04 15:16:21 -07:00
Larry Gritz f1ab555440 Fix ImageBuf vs ImageCache out-of-date image problem (#2696)
ImageBuf uses ImageCache underneath. But this can lead to the following
unexpected behavior if you don't understand this:

1. Make an ImageBuf for an image, read it (even just header info).
2. Done with it, destroy the ImageBuf.
3. Some other part of the program, or even a different process, changes
   that file on disk.
4. Make another ImageBuf with the same filename, thinking you're getting
   the updated image, but in fact it's relying on the cached representation
   which doesn't contain the changes made in step 3.

So these tiny changes try to make this much harder to shoot yourself in the
foot:

* New ImageBufs automatically call cache->invalidate on the filename
  before they start reading, to ensure that if the file has changed on
  disk, anything in the cache is invalidated.
* When you destroy or clear an ImageBuf, it calls cache->close() on the
  file, to release the handle (especially helpful on Windows, where an
  open file handle can lock the file to other processes).

There is a chance that some image operations will have degraded
performance, if you are mixing direct ImageCache use (including
TextureSystem) and ImageBuf reads of the same files -- since creating
and destroying the IB's will flush tiles from the cache and close cached
file handles. But I think that this should not be a problem in practice,
since most apps that are heavy users of ImageBuf (like oiiotool) aren't
heavey users of IC/TS, and vice versa. And eliminating this confusing
behavior is probably more important than occasional over-eager
invalidation of the cache.

Also clarify in the docs (and imagebuf_test) that if you use the
variety of ImageBuf ctr where you give it a custom ImageCache, it's
important that the ImageBuf outlives the ImageCache, as it is a
non-owning reference.

Fixes 1987

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-30 19:39:10 -07:00
Larry Gritz 59f2e89362 Move type_merge functionality from IBA to TypeDesc (#2715)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-30 19:39:10 -07:00
Larry Gritz 00fdb92973 Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-30 19:39:10 -07:00
Larry Gritz 5bb655ecbd CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-30 16:43:00 -07:00
Larry Gritz 38b6e42c83 CI on Windows: Disable ffmpeg download, the link is broken (#2729)
The web site where we used to download pre-built ffmpeg binaries
seems to have disappeared.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-28 23:08:55 -07:00
alister-chowdhury db73f2f1eb #2720 - Adding 1 bits per sample support to tiffs. (#2722) 2020-09-26 15:09:00 -07:00
Larry Gritz 496777a686 TIFF: Fix spec() and spec_dimensions() for mipmapped tiff files (#2723)
For "mip-mapped" TIFF files where we use the multiple images in the file
to emulate MIP-maps rather than what we ordinarily consider subimages,
a call to `ImageInput::spec(subimage,miplevel)` was not properly
recognizing invalid subimage values and returning an empty ImageSpec
as advertised. Basically, we assumed that they would only ask for a
valid subimage and miplevel and didn't properly handle out of range
values.

Same problem for spec_dimensions().

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-26 15:04:49 -07:00
Larry Gritz 8af1d39ac2 Update ref output after libheif 1.9 release (#2724)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-26 15:04:49 -07:00
Larry Gritz fa03aac802 Strutil::splits, splitsv should return NO pieces for empty string (#2712)
Fix cause of a subtle bug: splitting an empty string returned one
string piece (also empty) instead of 0 pieces.

Beef up the Strutil unit tests in this area.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-17 23:33:41 -07:00
Larry Gritz 3c28573b14 Fix crash in oiiotool --resize with multi-subimages (#2711)
This was subtle. Empty subimage include/exclude specifications would
confuse compute_subimages(), which in turn would MUCH later do a
mis-allocation and lead to a situation in --resize where it would
iterate over subimages that had not need allocated.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-17 23:33:00 -07:00
Larry Gritz 78b05a1937 Robust to broken homebrew gpg transitive dependency
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-14 14:34:42 -07:00
Larry Gritz 914407e614 oiiotool --pastemeta (#2708)
This new command takes two images as arguments, and appends all the
metadata (only) from the first image onto the second image's pixels
and metadata, producing a combined image.

This can be useful for users who have some (either non-OIIO-based or
just badly implemented) application that operates on image files but
fails to propagate the metadata, by having a simple way to transfer
metadata from one file to another:

    bad-app in.exr -o out.exr
    # oops, out.exr no longer has the crucial metadata from in.exr

    oiiotool in.exr out.exr --pastemeta -o out2.exr
    # Now out2.exr has the pixels of out.exr, but with all metadata
    # from in.exr added to or overwriting that found in out.exr.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-13 18:23:12 -07:00
Larry Gritz d5f7efcb33 IBA::contrast_remap -- move alloca outside loop (#2704)
This could stack overflow for large images.

Fixes 2703

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-07 14:34:34 -07:00
Larry Gritz a831c50e78 Declare aligned_malloc and aligned_free as OIIO_API (#2701)
Fixes 2700

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-07 01:22:04 -07:00
Larry Gritz 306a50e230 Python: be more forgiving in what's passed to attribute() (#2695)
We have many classes that have methods

    .attribute(name, intval)
    .attribute(name, floatval)
    .attribute(name, stringval)
    .attribute(name, TypeDesc, anyval)

For ImageSpec.attribute() and OIIO.attribute(), the anyval was
restricted to only accept tuples. Fix these to bring them in line with
many other classes' attribute calls in which the 'anyval' really can
be just about anything -- tuples, lists, numpy arrays or other buffer
objects, or scalar values.

Fixes #2674

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-03 21:53:13 -07:00
Larry Gritz d40a33aece Warn about recommended minimum versions of some dependencies
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-03 16:52:52 -07:00
patlefort 2568474d66 Fix pugixml linkage and some mingw build problems (#2698)
- Fix external pugixml linkage. Also remove 'BEFORE' as it is unnecessary. 
- A few fixes for cross compiling with mingw on linux.
2020-09-03 16:04:11 -07:00
Larry Gritz 1e666fca49 Python: Direct support for 'half' using numpy.float16 type (#2694)
When transferring blocks of pixels (for example, by ImageInput.read_image
or ImageOutput.write_image), "half" pixels ended up mangled into uint16,
the only type of the right bit width.

But NumPy has a numpy.float16 type! A little bit of extra hinting to
pybind11 makes this work as users probably expect.

Fixes #2689

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-03 12:08:39 -07:00
Larry Gritz ee51de91a6 Fix broken TIFF reads of multi-subimage non-spectral files (#2692)
For a few rare edge cases of photometric interpretation, we fall back
on libtiff's ability to auto-translate to an RGBA image for us. It
only does this for the whole image at once, so we do it for the first
scanline we read (storing the whole image in a buffer, skipping the
conversion for subsequent scanlines -- and it can tell it's the
"first" scanline because the buffer isn't yet allocated).

The bug was that for these cases (such as a photometric YCbCr), if the
file was *multi-subimage*, we were not clearing the rgba buffer, so
upon reading the second subimage, it thought its buffer was already
filled, so it wasn't actually doing the read and convert, just using
whatever was already living in the buffer. Oops.

Also, I noticed that we should clear m_use_rgba_interface for each
subimage -- it was previously just setting it when it found those edge
cases. We never saw a symptom from this, but I realized it would be
problematic for a file where the first subimage was YCbCr and the
second subimage was regular RGB, it wouldn't know to fall back to our
usual code path.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-02 22:11:41 -07:00
Larry Gritz c12f89c0a8 Stop running the "openexr-damaged" test for CI. (#2690)
It's been endless trouble, because the nature of the test is malformed
images that fail in inconsistent ways. I can never seem to make a
stable set of reference output for it, especially for OpenEXR
development master, which is always adding new fixes or tinkering with
exceptions and error messages.

So just don't run that test in the automated CI.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-02 18:56:17 -07:00
Larry Gritz b558145c71 Improved error message for corrupted input (#2687)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-09-02 18:56:08 -07:00
Larry Gritz 01692cdfe0 Update ref image after Homebrew upgraded libraw to 0.20
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-30 15:28:52 -07:00
Larry Gritz eb796bbd2c Build system and CI touchups (#2686)
Periodic compare of analogous build scripts in OIIO & OSL and synchronize
to ensure that my current most favored idioms are in both.

The biggest change is that I split the checked_find_package into a separate
cmake file, for easier copying between projects.

Also fix some minor typos.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-30 13:06:08 -07:00
Larry Gritz 88522189b4 Bump version after release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-30 13:06:08 -07:00
Larry Gritz 740dc45c00 Final release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-30 13:04:31 -07:00
Larry Gritz bf5a076dbb CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-30 13:04:31 -07:00
Larry Gritz 70cb7edac4 Bump version for release candidate
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-29 12:16:08 -07:00
Larry Gritz bea411565c CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-29 12:15:57 -07:00
Larry Gritz 0621f0a66e oiiotool: fix some multi-subimage bugs when outputting images (#2684)
Plain old bug in all cases:

--croptofull botched the subimage count by reserving space for results
based on the subimages in the input image, but then only producing
results for the first one if -a (or :allsubimages=1) was not used.

Output specific bugs:

There are some operations that happen ephemerally upon output, mostly
to account for output file formats that don't support some feature of
the top image (like action_croptofull if the output format doesn't
support differing display and data windows, or action_channels if
there are more channels than are supported by the format, or
action_colorconvert when --autocc is used).

In these cases, we were forgetting that those operations may tend to
drop all but the first subimages, if no -a or :allsubimages=1 is not
used.  But that's NOT the behavior we want in this case, because for
output specifically, we never want to drop subimages. This is because
we want a simple format conversion like

    oiiotool in.xyz -o out.pdq

to faithfully copy, not "narrow" to one subimage, even if some other
operations on their own will tend to drop all but the first subimage if
not instructed to preserve them all.

So the solution is that we need to add ":allsubimages=1" modifier to
these ephemerally called adjustments.
2020-08-29 12:14:01 -07:00
Larry Gritz f320f3d60f Rejigger the build dir's detail area to be in the same spot as dist (#2667)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-29 12:03:59 -07:00
lmarz 210e3b15f1 Fix compilation error with armv7, x86 (#2660)
Fixes a compilation error, that appears on alpine linux.
 /builds/lmarz/aports/testing/openimageio/src/oiio-Release-2.1.18.0/src/libOpenImageIO/exif.cpp: In function 'void OpenImageIO_v2_1::read_exif_tag(OpenImageIO_v2_1::ImageSpec&, const TIFFDirEntry*, OpenImageIO_v2_1::cspan<unsigned char>, bool, int, std::set<unsigned int>&, const OpenImageIO_v2_1::pvt::TagMap&)':
 /builds/lmarz/aports/testing/openimageio/src/oiio-Release-2.1.18.0/src/libOpenImageIO/exif.cpp:789:20: error: comparison of integer expressions of different signedness: 'unsigned int' and 'OpenImageIO_v2_1::span<const unsigned char, -1>::index_type' {aka 'int'} [-Werror=sign-compare]
   789 |         if (offset >= buf.size()) {
       |
2020-08-29 11:55:42 -07:00
Larry Gritz 52e5c2ab7a Improve comments in openexr handling code
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-29 11:18:38 -07:00
Larry Gritz 4dd0da99d7 Support for libheif 1.8 (#2685)
HEIF is a lossy format, and it seems libheif 1.8 changed internally
in such a way that the bit-for-bit comparsions of the write-read
cycle we do in imageinout_test started failing. (Bummer on our Mac
CI, where the homebrew version of libheif updated automatically and
then started failing.)

The easy solution is that just for this test, write zeros to the image,
not 1.0 values (which were coming out 254, not the expected 255).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-29 11:18:09 -07:00
Larry Gritz f6b08b1b9f Improve missing dependency hints (#2682)
In the case of a dependency not being found, we look for
src/build-scripts/build_{package}.bash and if it exists, suggest using
it. But the scripts were all lower case, and the packages were not, so
it was often not giving the hint! Also, in some cases, the package
might be named 'TIFF' but the script was 'build_libtiff.bash'.

So now, look for a build script with the package name straight, and
also all-upper and all-lower-case versions, and "lib<lower>".

Rename build_ocio.bash to build_opencolorio.bash, because it's the one
case where the script didn't match any of those obvious
transformations.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-26 16:25:45 -07:00
Larry Gritz a3fd72cfb9 Use .git-blame-ignore-revs (#2683)
This new file contains the hashes of commits whose only function was
to reformat large amounts of code.

Ordinarily, this would make for confusing 'git blame' output, by
making old code written by author A appear to have a new modification
date and authorship by B, when in fact we know that B just did some
reformatting. This can make it especially hard to discern code history
after after commits that establish the use of "clang-format".

A new git feature (requiring git >= 2.23) allows pointing to a file
containing hashes of commits to be ignored by git blame:

    git blame --ignore-revs-file .git-blame-ignore-revs

To avoid having to remember this all the time, consider adding this to
your git config:

    git config blame.ignoreRevsFile .git-blame-ignore-revs

Note that git supports this feature but does not dictate the name of
the file. I'm just following the convention I'm seeing pop up in other
projects of calling it ".git-blame-ignore-revs".

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-25 23:14:01 -07:00
Larry Gritz 5d4bdc6666 Try renaming LICENSE-THIRD-PARTY to make GitHub recognize the license properly
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-25 23:12:03 -07:00
Larry Gritz dfbc4c180f Remove old and misleading Windows install instructions (#2679)
These were so out of date and unhelpful, it has to be better to
have no instructions at all. Tear it down and make room for somebody
to do it right.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-25 13:40:15 -07:00
Larry Gritz 9815a69240 Fix typos in comments and docs (#2678)
Ran spell checker on all the comments.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-25 12:40:07 -07:00
Larry Gritz 92faacfbb2 Update ref output after changes in OpenEXR 2.5/3.0 error message text
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-22 21:48:00 -07:00
Larry Gritz e85390ec81 Restore missing python read_image signature (#2677)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-20 19:37:32 -07:00
Larry Gritz 40e64bb42b Document design flaw in Python ParamValue (#2675)
Oops, ParamValue.type ought to be a TypeDesc, just like in C++.  In
the Python binding overhaul of 2.0, it seems that I made a mistake and
unintentionally changed it to appear to Python as a string (e.g.,
'int' rather than TypeDesc('int')).

Fixing it to be the way it was originally intended would involve a
breaking change and not appropriate until such things are allowed by a
2.x -> 3.0 transition, so we'll just have to live with it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-20 19:37:25 -07:00
Larry Gritz 58dbf96727 Re-enable fmt formatting helper for TypeDesc (#2670)
A previous patch removed the definition of OIIO_USE_FMT, which
inadvertently removed this helper class from the compilation stream.
2020-08-14 16:23:38 -07:00
Michael Shigorin 31db7bc483 Fix build for Elbrus 2000 architecture (2671)
https://en.wikipedia.org/wiki/Elbrus_2000

From Michael Shigorin

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-14 15:07:54 -07:00
Larry Gritz 46ad94c8a8 Fix Mac CI ref output for OpenEXR 2.5.3
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-14 13:49:46 -07:00
Larry Gritz bc931de72b CI: Bump exr 2.5 to 2.5.3; update ref output for failure case
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-12 22:12:49 -07:00
Larry Gritz ff8671a371 Fix CI Linux oldest test
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-12 22:12:45 -07:00
marsupialandrzulak 833ad192ce Add llvm-11.0.0 to Makefile-bits. (#2669)
Co-authored-by: rzulak <rzulak@imageworks.com>
2020-08-12 22:12:37 -07:00
Larry Gritz 037fcb8839 Bump version after beta release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-11 09:36:51 -07:00
Larry Gritz 963d07d531 2.2 Beta2
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 22:55:55 -07:00
Larry Gritz ecbeda622f ImageCache should not close IOProxy-based files to stay in file limits (2666)
The thing about IOProxy is, once closed, it can't be reopened. So it's
important that if an IOProxy-based file is in the IC, its ImageInput
should not be reclaimed by closing it (and that might not help the
file handle count anyway, since the main use of an IOProxy under those
circumstances is probably to read an image from memory).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 18:44:28 -07:00
Larry Gritz a6345e095e Fix to DPX IOProxy support (#2665)
It's important not to mess with a passed-in IOProxy* in Input::close(),
because that proxy may not still exist.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 18:37:32 -07:00
ra-mt 8e470c7616 Add support for reading DPX files from memory (#2659)
* Add support for reading DPX files from any IOProxy
* Replace memcpy_s function with memcpy
* Fix IOProxy bug (not just for DPX) seeking from end

Signed-off-by: ra-mt <radu.arjocu@masstech.com>
2020-08-10 18:36:37 -07:00
Larry Gritz d8810c5365 clang-format: Adjust alignment of line continuation backslashes (#2664)
I just like this better than the prior habit of putting it one PAST
the column width, which made the backslashes go in column 81, ick.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 17:45:54 -07:00
Larry Gritz d631f92721 bit_cast should take a reference, not a value (#2668)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-10 17:45:46 -07:00
Larry Gritz 7f71282027 SPI: Mac newer compilers
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-09 16:51:03 -07:00
Larry Gritz 4f981ba3b7 pybind11 version fix for CI
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-09 16:50:42 -07:00
Larry Gritz d0a77b9f2f Windows CI: build dependencies ourselves (#2663)
Last week, Vcpkg apparently had some flaw that recently caused it to
fail when building/installing libpng (among other things). It's been
fixed in the vcpkg main branch, but that hasn't propagated to the
vcpkg that's installed on the GitHub Actions CI runners, and that's
causing our Windows CI tests to fail.

Rather than wait out the fix, I'm just taking it into my own hands by
building all our dependencies from source on Windows. This means adding
bash scripts to download and build zlib, libpng, and libjpeg-turbo (and
maybe those will be helpful to others as well).

**Late breaking news** They beat me to it, vcpkg has been updated and
the GitHub CI Windows tests are passing again.

But I had already done this work! So I still would like to switch to
this methodology because:

* Sometimes it's faster to build ourselves rather than have vcpkg
  build, since vcpkg always builds both release and debug, but we only
  need the release builds of the dependencies.

* This makes it easier to customize the specific version of a
  dependency, or particular build options, which are hard or
  impossible to change for a vcpkg build.

* These same dependency-building scripts could be useful for people who
  are not on Windows or not interested in using vcpkg.

Also some minor changes to the build_libtiff and build_openexr scripts
to synchronize some of the idioms I use in these scripts.

Rename workflow.yml to ci.yml to adhere to convention and also make it
so we can have multiple workflows in the future.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-09 16:50:32 -07:00
ra-mt 292b6ac1c1 Fix Windows long paths when opening files (#2661)
* Disregard Windows extended-length / long path prefix ("\\?\" style) when getting the REST arguments

* Add test cases for disregarding Windows extended-length / long path prefix.
2020-08-07 17:10:48 -07:00
Brecht Van Lommel f8969b894a Fix poor performance with texture cache and HDR files (#2662)
When the texture cache reads scanlines in random order, the same pixels could
be read many times over. Now the file offset for scanlines is cached for quick
random access.
2020-08-06 15:28:21 -07:00
Biswapriyo Nath 871e88c857 Fix mingw compiler warnings (#2657)
* OpenImageIO/imagebufalgo.h: remove OIIO_API from enums
* OpenImageIO/strutil.h: remove OIIO_API from inlined lower and upper functions
* libutil/plugin.cpp: cast return value of GetProcAddress to void*
* libutil/sysutil.cpp: define _POSIX_C_SOURCE for localtime_r declaration
* libutil/thread.cpp: cast t->native_handle() to HANDLE type
* ptex.imageio/ptexinput.cpp: use perr.c_str() for %s string format
2020-08-06 09:16:09 -07:00
Larry Gritz dcf48e1f80 Minor fixes to ImageBuf error reporting (#2653)
* Fix some incorrect error calls in ImageBuf internals.
* Simplify because we know that ImageBuf::error() and warning(), with
  just one string argument, doesn't need a format command.
* Make sure that if no message bubbles up, we say "unknown error".

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-05 14:35:23 -07:00
Larry Gritz 94be07fbce Improved propagation of png write errors and fix sRGB profile check (#2655)
We weren't setting up the proper handler callbacks for libpng internal
errors to bubble up to the caller.

Tell libpng to turn off sRGB color profile check. There are many
false positives where embedded ICC profiles that don't match its
expectations (but that other people and apps consider fine) trigger
errors in libpng.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-05 13:23:51 -07:00
Larry Gritz 1d0e570a49 Fix python binding of ImageSpec.erase_attribute (#2654)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-05 10:57:58 -07:00
Larry Gritz be2c4e3198 PNG option: add "png:filter" to control PNG filter options (#2650)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-08-02 13:05:18 -07:00
Larry Gritz 5ba33f3886 Bump version after first beta release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-31 14:25:23 -07:00
Larry Gritz bfa4ba5f2e Branch and beta 2.2
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-31 12:27:03 -07:00
Larry Gritz e8f1202f0f changes
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-30 18:21:21 -07:00
Larry Gritz 3082bd7f2a More gradual fmt conversion (#2649)
Another step toward switching to std::format notation.

The basic strategy is to make sure that all the classes that have
errorf (etc) methods using printf notation will also have errorfmt
(etc) methods using std::format notation. These will coexist for a
while to let people switch, before the printf ones will be marked
deprecated and then eventually removed.

In some cases where the methods aren't really part of the public
API, but only are used internally, we are already skipping to the
deprecation marking.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-30 12:47:42 -07:00
Larry Gritz 1253a034f0 Move disted but non-public headers to "detail" subdirectory (#2648)
Policy change:

There are some headers that we just have to make part of the OIIO
distribution, but they aren't officially part of the supported OIIO
public API. We are moving them into an include/OpenImageIO/detail
subdirectory.

Anything in there is, therefore, allowed to be changed arbitrarily for
any minor version numbered release, including source back-incompatible
changes that would ordinarily require a change in major release
version if they were part of the public API. They nonetheless cannot
change in patch releases in ways that would break ABI or linkage.

Initially, this includes the imported headers from fmt and pugixml,
but in possible subsequent patches, I may move other headers there, or
split some headers to have declarations be public but certain inline
implementation details split into separate files in detail.

We were also able to move SHA1.h out of the public include area and
locally into libutil, since it should only be needed by SHA1.cpp.
It was also used by imagebufalgo_compiler.cpp, but didn't need to be,
so we changed the direct use into use of the hash.h wrapper.

Also add a build_pugixml.bash to make it easier for people to install
that dependency. We will eventually migrate to a fully external
pugixml, but right now old versions of OSL depend on it being part of
OIIO. We'll change on the OIIO side after another release.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-27 20:40:25 -07:00
Larry Gritz 14ee3c30e4 Remove tinyformat (#2647)
We relied on it for years and are very thankful for its existence.

It has been optional for some time now, as we have come to use the fmt
library, which is more similar to the upcoming C++20 std::format.

Now it's time to excise tinyformat completely.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-24 17:10:59 -07:00
Larry Gritz 41fe60cf4c Eliminate some needlessly included headers to speed up build time (#2646)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-24 09:16:10 -07:00
Larry Gritz a20766cd17 Dependency testing
* Bump Linux "latest deps" to use the newly release LibRaw 0.20.
* Document that we can successfully build with CMake 3.18.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-23 15:09:01 -07:00
Larry Gritz 129728f4e8 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-18 15:15:32 -07:00
Larry Gritz e35dc40e7a IBA::resize: Use heap instead of stack for an allocation (#2643)
Resizing an enormous image by a large scale factor could end up having
this allocation, which is xres*ntaps*sizeof(float), end up big enough
to overflow the stack. It's only done once per thread worker, so there
is no perf penalty to making it a heap allocation just in case it's
too big.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-15 11:54:47 -07:00
Larry Gritz 3d0be6561c Typo fix -- got 'ImageBuf.writable' name wrong (#2644)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-15 11:53:59 -07:00
Larry Gritz 6f15fb343d Handy macro to construct an integer version code (#2641)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-15 09:12:43 -07:00
Larry Gritz 7eea02d2ba Python version of ImageBuf that takes an open ImageOutput (#2640)
This is the key to writing a multi-subimage file from ImageBufs.
We previously could do that from C++, but not from Python.

Add a test to testsuite/python-imagebuf. Also rearrange the python in
that test a bit to cleave off a couple pieces into separate functions.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-14 19:37:12 -07:00
Larry Gritz c47dbb566c PNG: Document the "png:compressionLevel" output hint. (#2642)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-13 21:13:08 -07:00
Larry Gritz ec1843512f Minor fix to Python binding for ParamValueList (#2638)
The `__getitem__` method taking an integer index correctly set the
return value policy so it returns in internal reference rather than
a copy, but the `__getitem__` method taking a string did not.

Also fix indentation.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-13 21:12:12 -07:00
Larry Gritz 4827c23775 Build against more recent versions of {fmt} (#2639)
fmt is supposed to (if you include fmt/ostream.h) automatically
support any user type that defines an `operator<<()`. And so it did
through version 6.1.2.

Starting with 6.2.x, the presence of `operator bool()` throws it off,
particularly for our TypeDesc, which started rendering as "true" rather
than "uint8" or whatever. It seems that the fact that it can convert
to bool takes precedence, it formats as a bool, rather than notice that
there's a stream ouput option.

In this patch, we add a custom formatter for TypeDesc, which solves
the problem for `format("{}", typedesc)`, but unfortunately not for
`sprintf("%s", typedesc)`. I've filed an issue, but in any case, the
workaround to avoid incorrect formatting when using sprintf is to be
sure to use typedesc.c_str().

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-10 16:27:16 -07:00
Larry Gritz 276ff1656f Update ref output
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-10 16:26:43 -07:00
Larry Gritz 46fdc7fc0b Update ref image for evolving libraw
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-10 10:15:45 -07:00
Larry Gritz d7427ae376 CI: Make sure all tests run for RB and master
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-10 10:15:45 -07:00
Larry Gritz eec0106ad3 CI: use python 3.8 on Mac GH CI
Trying to force 3.7 when Homebrew has moved on is swimming upstream.
VFX Platform is also talking about moving to 3.8 next year anyway.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-09 10:53:32 -07:00
Larry Gritz 73842b9968 Update ref image for debug case
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-08 23:28:52 -07:00
Larry Gritz a25c31af5b Terminal I/O of images (#2631)
This is a little kooky maybe, but it was something I was playing a couple
years ago, finally inspired by Chris to clean it up and PR it.

This patch adds a "term" format which, instead of writing files,
outputs a preview image to a true color text terminal window.

Is any of this useful? I have no idea. But it's kinda fun.

The quick demo of this is:

    oiiotool myfile.exr -o out.term

It will only do something useful if on a color terminal emulator with
24 bit color capability and Unicode. (I've tested it on the
gnome-terminal on Linux, and iTerm2 on Mac.)

The best quality results are on Mac if you are using iTerm2, it can
additionally do an actual pixel output (iTerm2 has as a nonstandard
feature the ability to send inline images to the terminal). This is
the "iterm2" method, but it's only expected to work on Mac with
iTerm2. It will automatically use this method as the default if you
are running iTerm2.

Next best is (thanks, Chris) is to display two pixels (vertically) in
each character cell, by outputting the Unicode "upper half block"
glyph (\u2508) with the foreground color set to the top pixel's color
and the background color set to the bottom pixel's color. This is the
default if you're not on a Mac running iTerm2. To demo (if you're on
have iTerm2 but want to see this method):

    oiiotool myfile.exr -attrib term:method 24bit -o out.term

But some terminals and fonts don't support unicode, or don't display
this character, or display it with an ugly border. So you can also use
an alternate method:

    oiiotool myfile.exr -attrib term:method 24bit-space -o out.term

where doesn't use the unicode trick but instead outputs a space (' ')
for each 2 vertical pixels, simply setting the background color to the
average of those two pixels.

There's also a "256color" method that just uses the 6x6x6 color space
in the 256 color palette -- which looks horrible -- and an
experimental "dither" which does a half-assed Floyd-Steinberg
dithering, horizontally only, and frankly is not an improvement unless
you squint really hard.

In all cases, the image will automatically be resized to fit in the
terminal, as well as converted to sRGB so it looks kinda ok.

Along the way, I added a new ImageOutput::supports("procedural")
query.  If the existing input supports("procedural") query says
whether the input image is being generated procedurally and doesn't
correspond to an existing file on disk being ead, then the output
supports("procedural") is the opposite -- is the output doing
something procedural that does not correspond to a file being written.
(The specific use is to use this to avoid oiiotool attempting to
rename the file to move it into its final position.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-08 22:16:59 -07:00
Larry Gritz d351cf3b32 Re-enable travis and include an arm64 (aka aarch64) build (#2634)
This is a step toward making sure we are habitually testing on ARM64.

It is incomplete at the moment, several individual tests fail and need
to be tracked down, so the test is marked as "allow_failures" so it
will never appear to fail.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-08 22:16:31 -07:00
Larry Gritz 1dcee8487d Adjust to API changes in OpenColorIO v2 (#2636)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-08 15:12:36 -07:00
Larry Gritz 363ed762b7 Fix build break due to pybind11 master recent change (#2637)
By using the explicit `cast<TypeDesc>()` instead of allowing the
template system to figure it out, we were losing the `const` detection
and making it fail to match templates. It used to work, but a recently
added change in pybind11's master branch caused this to finally fail.

Also change the "latest releases" to use pybind11 2.5. (Only semi-related,
2.5 was fine, it was post-2.5 where we broke.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-08 13:28:14 -07:00
Larry Gritz 100897491e Update ref output
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-07 23:08:10 -07:00
Larry Gritz f0c3890eb5 raw: use mutex to guard non-reentrant LibRaw constructor (#2633)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-07 12:46:56 -07:00
Larry Gritz 63ee142750 oiiotool: Fix --eraseattrib not applying to all subimages (#2632)
Either -a or optional modifier :allsubimages=1 ought to have erased
an attribute from all subimages, but it was erased from only the first.

Add a test to verify that --attrib and --eraseattrib both apply
correctly to all subimages when requested.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-07 09:25:24 -07:00
Larry Gritz 3481ab058b Disable tests when support for format is disabled (#2629)
We previously disabled tests for a format when its library was not
found, but didn't consider if the library was found but the
`ENABLE_FOO` variable was set to intentionally disable it.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-06 09:13:33 -07:00
Larry Gritz f30f2b77bc simd.h improvements (#2621)
SIMD improvements for emulating 8-wide on 4-wide HW: for many methods
on 8-wide SIMD types when running on 4-wide hardware, it's better (as
revealed by benchmarks) to implement as two 4-wide ops rather than
falling back to a purely scalar path.

Add operator*(vfloat{4,6,16}, float). On SSE, it hardly matters, no
better than letting the float be promoted to vfloat. But NEON has
vec*float.

Add NEON implementation of blend, min, max, reduce_add.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-05 21:58:10 -07:00
Larry Gritz 2b6cfc76f9 Commit ref output for openexr-damanged test for exr 2.2
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-05 14:12:17 -07:00
Larry Gritz 7c26a62201 SPI touchup
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-05 14:12:10 -07:00
Larry Gritz 7e5b841a80 Fix broken clang-format test (#2627)
A few weeks back, I rearranged a bit of ci-build-and-test.bash to invoke
cmake directly instead of the makefile wrapper. But in the process, I
accidentally caused it to always build `--target install` instead of
using the optional target `$BUILDTARGET` which is how clang-format runs
were supposed to have been triggered.

The result was the 'clang-format' test did a full *build* instead of
running clang-format. This was both much more expensive, and also
pointless: we weren't testing clang-format during CI at all.  Oops.
Thus, some recent checkouts weren't properly formatted. We also amend
the minor fixes that bring us into format compliance.

I also noticed that I can use apt-get to install OCIO on the Ubuntu
instances used by GH CI, so modify to only build OCIO from source if a
specific version is requested. This speeds up some of our CI test
cases.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-05 14:03:48 -07:00
Larry Gritz 2ebf56fa47 unordered_map_concurrent: fix missing size decrement upon erase (#2624)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-03 22:57:39 -07:00
Larry Gritz 198258fd7e argparse -- try to resolve overload ambiguity (#2622)
To help track down build issues with MSVS 2015, re-enable appveyor.
Also split GHA CI to test windows for both MSVS 2019 and 2017.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-07-01 15:58:08 -07:00
Larry Gritz 489b443368 SPI: update libraw 0.20 beta
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-30 13:26:55 -07:00
Larry Gritz aa12d70274 fmath: add vint versions of clamp (#2617)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-29 00:16:33 -07:00
Larry Gritz e60789f6c0 Avoid unexplained build break with VS2015 -- presumed compiler bug (#2618)
Doesn't trigger an error on other compilers, or on newer MSVS. But this
minor rearrangement makes VS2015 happy, so let's just go with it and
not look under that rug.

Partially addresses #2611

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-27 18:58:02 -07:00
Larry Gritz ea2a846b70 simd.h: More support for ARM NEON (#2614)
Was browsing some NEON docs and took the opportunity to fill in
implementations of a few more simd methods.

I don't have a way to directly test this myself, but hopefully
simd_test.cpp has enough unit tests to uncover if I've used the wrong
intrinsics for any of this.

I'm hoping that soon GitHub will add a way to run CI jobs on ARM CPUs
for Mac, if nothing else, so we'll have a way to verify this
architecture.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-27 11:56:58 -07:00
Blazej Floch 830d55b76b Fix OIIO_VERSION_RELEASE_TYPE (#2616)
Fixes typo that prevents the release type being propagated from CMake.
The definition in distributed headers is currently empty without the patch.
2020-06-27 11:56:29 -07:00
Larry Gritz 4fc8ce3a29 simd.h: add abs,sign,ceil,floor,round for float3 (#2612)
They already existed for float{4,8,16}, but were never implemented for
float3.

Add to simd_test.cpp both unit sanity checks and benchmarks for these
functions (including for the other classes where it already existed,
they were nonetheless not unit tested).

Also beef up simd_test by testing and benchmarking load/construcution
from scalar. Rename some test functions for clarity.

Along the way I realized a difference between scalar std::round and
our vector simd::round() in how they handle exact middle values
i+0.5. Because our round is more efficient (one instruction, whereas
std::round cannot be done in one op on x64, because "round midpoint
away from zero" is not a native hw rounding mode), put a big fat
comment warning about the difference.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-25 19:18:30 -07:00
Jens Lindgren 7b602c1722 update libraw longitude (#2613) 2020-06-25 13:30:20 -07:00
Larry Gritz 975ed71af5 Fix Mac GH CI: freetype already installed
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-25 09:19:59 -07:00
Larry Gritz 7d3ba8fad2 Update INSTALL to reflect working with ffmpeg 4.3
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-18 23:23:42 -07:00
Larry Gritz 42e4a0b842 Fix comment typo
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-18 23:23:42 -07:00
Larry Gritz fed34425be EXR: Stop translating "worldToNDC" to "worldtoscreen". (#2609)
This seems wrong. EXR standard metadata "worldToNDC" is exactly what it
says, not screen space. I'm not sure how we ended up with the historical
accident of reading "worldToNDC" from exr headers and auto-translating
it to "worldtoscreen".

The hope is that nearly no one is affected by any of this, since the
primary use case for these matrices was shadow maps, which were never
fully implemented in OIIO's TextureSystem anyway (they were last on
the list, and the VFX world switched to ray tracing before anybody got
angry enough at my procrastination to force me to implement it).

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-18 18:45:45 -07:00
Travis Mosley b9e6dc5a0c Updated vcpkg instructions to aid discoverability (#2610)
Added a line for vcpkg users to discover additional opencolorio features they can build with that tool. This will help avoid people trying to build manually to enable features available via that relatively obscure package manager. Looking in the vcpkg repo isn't as helpful for people unfamiliar with that package manager or how it is configured.
2020-06-18 12:53:18 -07:00
Larry Gritz 4e34d10ff4 Add more exr compliance tests and improve error messages (#2607)
Test more images that have been part of the openexr-images suite for
a while. Three cases:

  * New images that weren't in the suite when I first set up these tests.

  * Images that were "broken" because of (originally) missing features
    in our exr support, that over the years are now supported.

  * Images I was unaware of or somehow fell through the cracks.

In the process, improve and uniformize a number of error messages in
oiiotool, iinfo, openexr reading.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-12 13:06:33 -07:00
Larry Gritz ee07290c2f Use GH CI to upload test output for any job that fails tests (#2606)
This will make it much easier to investigate failures or update ref
output when failures only happen on CI -- any test that fail tests
will produce a downloadable "artifact" consisting of the outputs
of all the failed tests.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-11 22:16:38 -07:00
Larry Gritz 812b8d329b Bump version after developer preview tag
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-10 22:37:37 -07:00
Larry Gritz 23092e6271 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-10 13:39:08 -07:00
Larry Gritz 727c325420 Support Qt 5.15 (#2605)
Homebrew upgrade to Qt 5.15 made it more urgent to change some
deprecated calls to newer idioms.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-10 13:26:57 -07:00
Larry Gritz 5e2b5b64e4 Work around broken OpenEXR definition of OPENEXR_PACKAGE_STRING (#2604)
In at least OpenEXR 2.4 and 2.5, is it quite broken!
But OPENEXR_VERSION_STRING seems ok, so use that.
Issue filed against OpenEXR, but I don't have time to fix it myself tonight.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-10 13:26:38 -07:00
Larry Gritz 6f69687c16 Implement Python version of IBA color_range_check (#2602)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-09 17:44:23 -07:00
Larry Gritz 1b5a726656 RLA: sanity checks to detect corrupt or non-RLA files and prevent crashes (#2600)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-08 10:55:32 -07:00
Larry Gritz 9491e78bcc Document python binding of ImageBufAlgo.nonzero_region
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-06 21:25:20 -07:00
Larry Gritz 7364048e9e Use aswf/osl-2021 container to test the planned VFX Platform 2021
Also unbreak Mac on GH CI

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-04 10:33:25 -07:00
Larry Gritz 710a30ba3d CI: unbreak Mac on GH CI
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-03 23:22:11 -07:00
Larry Gritz 012d3b45e4 Filesystem::write_text_file() (#2597)
One-line utility function to open file, write a string, close file,
return if it succeeded. Analogous to the existing read_text_file().

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-03 14:22:00 -07:00
Richard 1982eba11c Use discovered python executable (#2598)
On Fedora, Python must be run using version specific binaries, python2 or python3. Since we go to the trouble of finding python for the main library, we might as well use the discovered binary name and path.
2020-06-02 00:14:51 -07:00
Larry Gritz f9c64a8a26 SPI: Make sure we're using the non-debug TBB build 2020-06-01 17:43:01 -07:00
Larry Gritz 0d49080c10 CHANGES
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-01 09:56:35 -07:00
Larry Gritz 30ce101ec1 Revise OpenEXR sorting of channel names into canonical order (#2595)
Brief background: OpenEXR sorts channel names alphabetically. Most
formats dont allow channel naming at all, let alone forcing a
particular order contrary to the order the user tries to write it to
the file. OIIO promises that if there is RGB, they will be first and
in that order, next will be alpha if present, then depth, then
everything else.

So our exr reader will reshuffle channels into this canonical order
before presenting to the calling app. In addition to literal R, G, and
B being first, also obvious synonyms are accepted and understood to be
first ("Red", "Green", "Blue", and also "Y" in case it's just a
1-channel intensity and then maybe alpha).

A user noticed an interesting edge case: what if it's a normal map or
positional info, so the channel names are x, y, z? You want it in that
order (coincidentally alphabetical), duh. But the current heuristic
will reorder it as Y (mistaking for intensity), Z (mistaking for
depth), then X (a non-special name, so goes last). Ick!

The solution is that we need a more sophisticaed heuristic. This patch
changes the logic to first just sort by layer, then within each layer,
look to see if there are channels "x", and either "y" or "z", and if
so, then we can conclude that it means something spatial and that Y
isn't really intensity and Z isn't really depth for that particular
layer, so an alternate ordering is used. In all other cases, we
continue to use the old heuristic.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-06-01 09:06:34 -07:00
Larry Gritz d3ab6f631d TypeDesc additional helpers: Pointer, Vector2, Float4, Vector2i (#2592)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-30 14:08:39 -07:00
Larry Gritz a5dcf08dbc Fix minor issue with fmath's OIIO::clamp (#2594)
OIIO::clamp had the property that if `val <= low`, it sets `low`.
But actually, when `val == low`, we want to use `val`, not `low`.

This may seem like the same thing, and it is for ordinary types.  But
OSL uses this clamp template for "dual" types (implementing automatic
differentiation), and it causes a case where `val == low` but `val`
carries derivatives that we want preserved, not written over by the
0-derivatives of the fixed `low` value.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-28 10:52:38 -07:00
Larry Gritz 351f3979fd Extra test for multiplication (#2593)
SSE2 lacks an instruction for 32 bit SIMD int multiply. SSE4 has
it. We simulate it with a trick using unsigned multiply on SSE2. Chris
wondered if this alternate code path was adequately tested for
negative numbers, so I added a test to be sure.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-27 16:32:53 -07:00
Larry Gritz 24dacc7bc6 oiiotool continued refactor (#2589)
* Make sure the opname is always canonicalized

* Refactor to allow setup() to call skip_impl() to skip the impl and
  copy instead.

* --ummip : make OiiotoolOp subclass (but note, it doesn't honor the
  `:subimages=` modifier).

* --chnames : now OiiotoolOp and honors the `:subimages=` modifier.

* --chsum : now OiiotoolOp and honors the `:subimages=` modifier.

* --chappend : now OiiotoolOp and honors the `:subimages=` modifier.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-27 00:32:19 -07:00
Larry Gritz 5ac50bc72d Add CI test to exercise gcc10 (#2590)
* Turns out no code changes were needed for gcc10!

* Also updated some dependency ranges in INSTALL.md.

* Make a new CI test "latest" -- using the latest supported release of
  the toolchain and dependencies. That includes gcc10 in this case.
  (This is different than the "bleeding edge" test, which tests against
  the development master of many dependencies.)

* Make several test matrix entries (including bleeding edge, static
  libs, and sanitizers) no longer test on every push. That makes
  things take too long. They all still run nightly, and if you're
  pushing a branch with the name "RB", "release", or "master", so they
  will catch problems before releases. Also, all tests run any time
  the branch name is "gh", so if you are preparing a patch
  specifically to make changes to CI, make sure to do that. We will
  probably continue to fine-tune exatly when we run all tests, versus
  the common configurations.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-26 21:46:11 -07:00
Larry Gritz 052675f162 Fix config problem
In the changes of PR #2584, set_and_check was the wrong macro to use
when the path might be empty -- because it is an error if the path
doesn't exist. The "check" part bites us. So just use a regular "set".

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-25 15:07:31 -07:00
Larry Gritz 044c1bba59 Lots of minor docs rendering fixes
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-24 21:53:45 -07:00
Larry Gritz 6326c4d97b CI fixes
* The sanitizer test was using wrong setup script -- we switched to
  using a container, but didn't change the dependency install script
  accordingly.

* Mac seems slower and less reliable on GH, so switch the clang-format
  test to run on Linux.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-24 13:32:02 -07:00
Larry Gritz 4de0652f20 CI fixes (#2588)
* Build "bleeding edge" against fmt master

* Tests that build against OpenEXR 2.4.0, bump to 2.4.1.

* The "sanitizer" test, use ane aswf/ci-osl:2020 container.  This is a
  slow test, so may as well speed it up by using the container with
  pre-installed dependencies.

* Modify ci-build-and-test.bash to use straight cmake build and install,
  not the makefile wrapper.

* No need for atomic lib check on Apple

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-23 20:30:39 -07:00
Larry Gritz 5937c5a2eb python: Fix subtle bug that lost certain string args (#2587) 2020-05-23 20:26:26 -07:00
Larry Gritz f161d93001 Overhaul oiiotool internal idioms (#2586)
oiiotool dates from pre-C++11, and has grown by accretion. As a
result, the individual actions are implemented using multiple
different idioms, and there is a lot of complex boilerplate.

A recent PR added subimage selection widely to all commands that use
the idiom of an implementation that inherits from the OiiotoolOp
class. The convinced me that we want to migrate as many actions as
possible to this idiom. I also realized that the current use of
OiiotoolOp could be greatly simplified by using lambdas in most
cases, which weren't available in the pre-C++11 ancient times when
oiiotool was first being developed.

This patch:

* Has the OiiotoolOp base class contain (and accept in its ctr) a
  std::function for the meat of the impl() and setup() methods.

* If init() and setup() are the only bits that need customization for
  a particular action, they can just be passed as lambdas rather than
  needing to subclass OiiotoolOp.

* This eliminates a huge amount of per-action boilerplate, many helper
  subclasses and macros.

* In front of every action implemetation (however it is done), I
  inserted a comment with the command line argument (e.g.,
  `--colormap`) which is an aid for me to quickly find the
  implementation in this huge file.

This patch DOES NOT change any non-OiiotoolOp action idioms to
OiiotoolOp.  That will come later, first I wanted to make these
improvements.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-20 15:48:08 -07:00
Larry Gritz c835a1a656 Put PLUGIN_SEARCH_PATH in the exported config (#2584)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-18 13:55:49 -07:00
Larry Gritz 10d8f4058a oiiotool: allow optional subimages modifier for many ops (#2582)
For a large number of oiiotool commands (anything whose implementation
inherits from the OiiotoolOp class), allow the optional modifier
`:subimages=...` to control how the operation applies to different
subimages (when dealing with multi-subimage images).

Of course, previously, the default is that most commands operate only
on the first subimage, discarding the others. The global `-a` (and for
many commands the optional `:allsubimages=1` modifier) cause all
subimages to be preserved and the operation to be performed on all of
them.

This new `subimages=...` allows more fine-grained control by
specifying which subimages will be active, as a comma-separated list
of either numeric indices (starting at 0) or subimage names. The
special string "all" means all subimages (thus `:subimages=all` is
equivalent to `:allsubimages=1`). Any subimage number or name preceded
by a "-" excludes that subimage from the active list.  The operation
is performed on only on the active subimages, with excluded subimages
merely being copied from the first input image. The presence of any
`subimages` modifier implies that all subimages should be preserved.

For example, if a.exr is a "multi-part" OpenEXR image (what OIIO calls
multi-image):

    # color convert just the first subimage, discard the rest
    oiiotool a.exr --colorconvert linear sRGB -o out.exr

    # color convert and output all subimages: -a
    oiiotool -a a.exr --colorconvert linear sRGB -o out.exr

    # color convert just the subimage named "beauty", but output them all
    oiiotool a.exr --colorconvert:subimages=beauty linear sRGB -o out.exr

    # color convert all EXCEPT the subimage named "normal"
    oiiotool a.exr --colorconvert:subimages=-normal linear sRGB -o out.exr

    # color convert subimages 1, 2, and 5, leave the others unmodified
    oiiotool a.exr --colorconvert:subimages=1,3,5 linear sRGB -o out.exr

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-13 21:20:15 -07:00
Larry Gritz 2f0021a7d4 Docs improvements to the way we discuss optional modifiers
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-11 16:03:06 -07:00
Larry Gritz 37828b8305 Important fixups of the RTD documentation (#2581)
Seems that the default version of the 'breathe' sphinx plugin is broken on
RTD.

* Change minimum breathe version to the specific one that is the most
  recent release that I verified runs correctly on our docs.

* Remove unused and rusting sphinx extensions.

* Remove obsolete Doxyfile config settings

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-10 20:39:44 -07:00
Larry Gritz a04008c48b Prepare for release of libraw 0.20 (#2580)
* Have our CI "bleeding edge" test libraw master

* Update Fuji reference image and other reference output related to changes
  in libraw.

* Update install instructions to indicate LibRaw 0.20 support

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-10 17:51:28 -07:00
Larry Gritz 5cc51b5115 oiiotool --subimage:delete=1 (#2575)
The existing `oiiotool --subimage <n>` replaces the top multi-subimage
image with a single specified subimage.

This patch adds an optional modifier, so that `--subimage:delete=1`
performs the "inverse" operation: removing just the one specified
subimage from the top multi-subimage image.

One way this could be useful is if you want to perform some operation
on just one subimage, but sill leave the others intact. For example,

    oiiotool many.exr -subimage 0 -colorconvert foo bar many.exr -subimage:delete=1 0 -siappend -o new.exr

This command loads a multi-image file, extracts just the first image,
applies a color transformation, then loads the file again and deletes
the first image, then appends the two pieces, yielding a new
multi-image file whose first image is the color corrected first
subimage, then unaltered copies of all the other subimages.

Upon adding a test case to testsuite/oiiotool, I noticed that the
existing tests for subimage operations did not have reference output
images, and thus were not being tested after all! Fixed that now.
(Those commands were all working just fine anyway, just didn't have
their tests quite enabled.)

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-09 09:03:52 -07:00
Larry Gritz ee970e87e4 Add VFXPlatform 2020 based test to CI (#2579)
Add VFXPlatform 2020 based test to CI

Use the new OpenEXR 2.5 in the ~2021 test.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-09 00:02:48 -07:00
Larry Gritz 67a86bee32 SPI fix: bump OpenVDB, fix clang path 2020-05-08 16:06:59 -07:00
Larry Gritz d72e273ac5 Avoid CMake warnings by updating naming of found variable (#2578)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-08 12:31:01 -07:00
Larry Gritz cbd390aa2b Comment to document where to find PNM format descriptions
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-07 09:41:44 -07:00
Nick Black 64de894358 Break infinite loop in FFMpeg::read_frame() (#2576)
Codecs which set the CODEC_CAP_DELAY capability led to infinite
loops during reading (see #2571). Once AVERROR_EOF is returned,
no more packets are going to be received, regardless of internal
buffering. break out of the loop in that case.

I've verified that this resolves the livelock following decoding
of the first packet in the Notcurses AVI test case which
illustrated this problem. I've also verified that said AVI
advertises the CODEC_CAP_DELAY attribute, matching the proposed
fix. In addition, I verified that OIIO continues to decode all
my other test cases without trouble. I hand-inspected the media,
and verified that the frame counts were precisely correct.

It is legal to pass NULL/0 into the decoder regardless of
CODEC_CAP_DELAY, and thus this whole conditional can really
be eliminated (I have no mention of it in my FFmpeg wrappers).
I haven't bothered to do that here, but it's a thought for the
future. Closes #2571.
2020-05-07 09:10:22 -07:00
Larry Gritz 7b6e5ed388 writeable -> writable (#2567)
Nick Black points out that in many places we have used "writeable", which
is (depending on which dictionary you check) is either a less commonly
used variant of "writable", or just an outright misspelling.

Even charitably interpreting it as an alternate spelling, let's standardize
on the more common variant.

There's only one API function where this comes into play, so to preserve
link compatibility, we'll have both ImageBuf::make_writable() and
make_writeable() as a deprecated synonym that will eventually disappear.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-06 09:46:27 -07:00
Larry Gritz 9e911bddf2 Minor formatting changes in ustring with new clang-format (#2574)
From here on, clang-format 10 will be our official reference formatter.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-05 18:32:49 -07:00
Larry Gritz a78e6f476a Whitespace fix
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-05 17:31:05 -07:00
Larry Gritz 3ec69e283c Update ref output after raw change
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-05-05 15:57:57 -07:00
Fabien Servant 61327af960 Add the raw:flip attribute (#2572) 2020-05-05 15:57:18 -07:00
Larry Gritz ca8ca129bb SPI fix 2020-05-05 12:57:00 -07:00
Larry Gritz 6cb51486db Bump version after dev preview release
Signed-off-by: Larry Gritz <lg@larrygritz.com>
2020-04-28 11:35:09 -07:00
467 changed files with 25912 additions and 12587 deletions
+90 -77
View File
@@ -2,26 +2,33 @@ Language: Cpp
BasedOnStyle: WebKit
SpaceBeforeParens: ControlStatements
#AccessModifierOffset: -4
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
#AlignConsecutiveDeclarations: false
#AlignEscapedNewlines: Right
#AlignConsecutiveAssignments: Consecutive
#AlignConsecutiveBitFields: Consecutive
AlignConsecutiveDeclarations: false
#AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
#AllowShortFunctionsOnASingleLine: All
#AllowShortIfStatementsOnASingleLine: false
#AllowShortLoopsOnASingleLine: false
#AlwaysBreakAfterDefinitionReturnType: None
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: TopLevel
#AlwaysBreakBeforeMultilineStrings: false
#AlwaysBreakTemplateDeclarations: MultiLine
#BinPackArguments: true
#BinPackParameters: true
BraceWrapping:
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
@@ -37,83 +44,89 @@ BraceWrapping:
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
#BreakBeforeBinaryOperators: All
#BreakBeforeBraces: WebKit
#BreakBeforeInheritanceComma: false
#BreakInheritanceList: BeforeColon
#BreakBeforeTernaryOperators: true
#BreakConstructorInitializersBeforeComma: false
#BreakConstructorInitializers: BeforeComma
#BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: WebKit
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
#CommentPragmas: '^ IWYU pragma:'
#CompactNamespaces: false
#ConstructorInitializerAllOnOneLineOrOnePerLine: false
#ConstructorInitializerIndentWidth: 4
#ContinuationIndentWidth: 4
#Cpp11BracedListStyle: false
#DerivePointerAlignment: true
#DisableFormat: false
#ExperimentalAutoDetectBinPacking: false
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
#ForEachMacros:
# - foreach
# - Q_FOREACH
# - BOOST_FOREACH
#IncludeBlocks: Preserve
#IncludeCategories:
# - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
# Priority: 2
# - Regex: '^(<|"(gtest|gmock|isl|json)/)'
# Priority: 3
# - Regex: '.*'
# Priority: 1
#IncludeIsMainRegex: '(Test)?$'
#IndentCaseLabels: false
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentExternBlock: NoIndent
IndentPPDirectives: AfterHash
#IndentWidth: 4
#IndentWrappedFunctionNames: false
#JavaScriptQuotes: Leave
#JavaScriptWrapImports: true
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
#MacroBlockBegin: ''
#MacroBlockEnd: ''
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 3
#NamespaceIndentation: Inner
#ObjCBinPackProtocolList: Auto
#ObjCBlockIndentWidth: 4
#ObjCSpaceAfterProperty: true
#ObjCSpaceBeforeProtocolList: true
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 40
PenaltyBreakBeforeFirstCallParameter: 100
#PenaltyBreakComment: 300
#PenaltyBreakFirstLessLess: 120
#PenaltyBreakString: 1000
#PenaltyBreakTemplateDeclaration: 10
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 75
PenaltyReturnTypeOnItsOwnLine: 50
#PointerAlignment: Left
PointerAlignment: Left
ReflowComments: false
#SortIncludes: true
#SortUsingDeclarations: true
#SpaceAfterCStyleCast: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
#SpaceBeforeAssignmentOperators: true
#SpaceBeforeCpp11BracedList: true
#SpaceBeforeCtorInitializerColon: true
#SpaceBeforeInheritanceColon: true
#SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true
#SpaceInEmptyParentheses: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
#SpacesInAngles: false
#SpacesInContainerLiterals: true
#SpacesInCStyleCastParentheses: false
#SpacesInParentheses: false
#SpacesInSquareBrackets: false
#Standard: Cpp11
#TabWidth: 8
#UseTab: Never
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++14
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
#...
+38
View File
@@ -0,0 +1,38 @@
# Reformatting via clang-format (part 1) (#2059)
5e76177f6850a8d04c544dc98128bcdfe55ca40a
# clang-format stage 2: src/libutil (#2064)
1a5b7aa00dd34883a8829875ee05c55b2a1f6736
# clang-format stage 3 -- src/*.imageio/* (#2065)
22e1af2ff0caa2c9aa31c0d7a69eb7762c04302d
# clang-format of src/libtexture and src/libOpenImageIO (#2067)
400e2340cf12ae84792f9a0146426b6022474dc9
# clang-format, final-ish update (#2069)
5af338158ad47fc84e7b0d03086fece04e0e2d24
# Adjustments from clang-format update
3e106c35845715875c3b3ce7b1621cb62ea41f0d
# clang-format fixes (#2137)
e536411711367ed7309ca884ebc9de4cea4d0da0
c31816192691562e96b4ebc10dd7e5fd2e9c801b
# Minor formatting changes in ustring with new clang-format (#2574)
9e911bddf275206867643d0009f0bd7b9a20e463
9fa2a5d42465870ae370afe5e3298433b2ecb56c
# Fix broken clang-format test (#2627)
7e5b841a80ed63b38f6d343889de615ef8cc4316
# Adjustments from clang-format update with clang 8
e83809b77e4d895dbf48fb6c2b5fb914a5f8eb06
# Touch up formatting with clang-format
f701a76b745b6ddba41c77b24a1ea7e1f48ae0b4
# clang-format: Adjust alignment of line continuation backslashes (#2664)
742173e39588e07cf43cbe7b49dd22d624a48388
d8810c5365ea88e2b1bce6155b7b495c18f2f9bc
+882
View File
@@ -0,0 +1,882 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
name: CI
on:
push:
# Skip jobs when only documentation files are changed
paths-ignore:
- '**.md'
- '**.rst'
pull_request:
paths-ignore:
- '**.md'
- '**.rst'
schedule:
# This is an obsolete branch with only occasional patches -- run weekly
# is plenty.
- cron: "0 10 * * 0"
jobs:
linux-gcc48:
name: "Linux 2017-ish: gcc4.8/C++11 py2.7 boost-1.66 exr-2.3"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2019
env:
CXX: /usr/bin/g++
CC: /usr/bin/gcc
CMAKE_CXX_STANDARD: 11
MY_CMAKE_FLAGS: -DBUILD_FMT_VERSION=6.2.1
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
vfxplatform-2019:
name: "Linux VFX Platform 2019: gcc6/C++14 py2.7 boost1.66 exr2.3 ocio1.1"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2019
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 14
USE_SIMD: sse4.2
PUGIXML_VERSION: v1.9
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
vfxplatform-2020:
name: "Linux VFX Platform 2020: gcc6/C++14 py3.7 boost1.70 exr2.4 ocio1.1"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2020
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 14
PYTHON_VERSION: 3.7
USE_SIMD: avx
WEBP_VERSION: v1.1.0
MY_CMAKE_FLAGS: -DBUILD_FMT_VERSION=7.0.1
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: setup
run: |
src/build-scripts/ci-startup.bash
- name: dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
vfxplatform-2021:
# Test VFX Platform 2021 -- mainly, that means gcc9 and C++17.
name: "Linux VFX Platform 2021: gcc9/C++17 py3.7 boost1.73 exr2.5 ocio2.0 qt5.15"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2021
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 17
PYTHON_VERSION: 3.7
USE_SIMD: avx2,f16c
WEBP_VERSION: v1.1.0
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
vfxplatform-2022:
name: "Linux VFX Platform 2022: gcc9/C++17 py3.9 boost1.76 exr3.1 ocio2.1 qt5.15"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2022-clang11
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 17
PYTHON_VERSION: 3.9
PYBIND11_VERSION: v2.6.2
USE_SIMD: avx2,f16c
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
linux-gcc7-cpp14-debug:
# Test against gcc7, and also at the same time, do a Debug build.
name: "Linux debug gcc7/C++14, sse4.2, exr2.4"
runs-on: ubuntu-18.04
env:
CXX: g++-7
CMAKE_CXX_STANDARD: 14
USE_SIMD: sse4.2
OPENEXR_VERSION: v2.4.3
CMAKE_BUILD_TYPE: Debug
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
linux-gcc8:
# Test against gcc8.
name: "Linux gcc8: gcc8 C++17 avx exr2.5"
runs-on: ubuntu-18.04
env:
CXX: g++-8
CMAKE_CXX_STANDARD: 17
USE_SIMD: avx
OPENEXR_VERSION: v2.5.6
PYBIND11_VERSION: v2.5.0
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
linux-gcc10-cpp11:
# Test gcc10 but in C++11 mode
name: "Linux gcc10 / C++11 avx2"
runs-on: ubuntu-20.04
env:
CXX: g++-10
CMAKE_CXX_STANDARD: 11
USE_SIMD: avx2,f16c
PYTHON_VERSION: 3.8
USE_OPENVDB: 0
# The old installed OpenVDB has a TLS conflict with Python 3.8
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
linux-latest-releases:
# Test against latest supported releases of toolchain and dependencies.
name: "Linux latest releases: gcc10 C++17 avx2 exr3.1 ocio2.0"
runs-on: ubuntu-20.04
env:
CXX: g++-10
CMAKE_CXX_STANDARD: 17
USE_SIMD: avx2,f16c
LIBRAW_VERSION: 0.20.2
LIBTIFF_VERSION: v4.3.0
OPENCOLORIO_VERSION: v2.1.0
OPENEXR_VERSION: v3.1.2
PUGIXML_VERSION: v1.11.4
PTEX_VERSION: v2.4.0
PYBIND11_VERSION: v2.8.0
PYTHON_VERSION: 3.8
WEBP_VERSION: v1.2.1
MY_CMAKE_FLAGS: -DBUILD_FMT_VERSION=8.0.0
USE_OPENVDB: 0
# The old installed OpenVDB has a TLS conflict with Python 3.8
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
linux-bleeding-edge:
# Test against development master for relevant dependencies, latest
# supported releases of everything else.
name: "Linux bleeding edge: gcc11 C++20 py38 OCIO/libtiff/exr-master boost1.71 avx2"
runs-on: ubuntu-20.04
env:
CXX: g++-11
CMAKE_CXX_STANDARD: 20
USE_SIMD: avx2,f16c
LIBRAW_VERSION: master
LIBTIFF_VERSION: master
OPENCOLORIO_VERSION: main
OPENEXR_VERSION: main
PUGIXML_VERSION: master
PTEX_VERSION: main
PYBIND11_VERSION: master
PYTHON_VERSION: 3.8
WEBP_VERSION: master
MY_CMAKE_FLAGS: -DBUILD_FMT_VERSION=8.1.1
USE_OPENVDB: 0
# The old installed OpenVDB has a TLS conflict with Python 3.8
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: CCache
id: ccache
if: always()
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
linux-oldest:
# Oldest versions of the dependencies that we can muster, and various
# things disabled (no SSE, OCIO, or OpenCV, don't embed plugins).
name: "Linux oldest/hobbled: gcc4.8/C++11 py2.7 boost-1.66 exr-2.2 no-sse no-ocio"
runs-on: ubuntu-latest
container:
image: aswf/ci-osl:2019
env:
CXX: /usr/bin/g++
CC: /usr/bin/gcc
CMAKE_CXX_STANDARD: 11
USE_SIMD: 0
USE_JPEGTURBO: 0
USE_OPENCOLORIO: 0
USE_OPENCV: 0
EMBEDPLUGINS: 0
OPENEXR_VERSION: v2.2.1
PTEX_VERSION: v2.3.1
PYBIND11_VERSION: v2.4.2
WEBP_VERSION: v1.0.0
MY_CMAKE_FLAGS: -DBUILD_FMT_VERSION=6.1.2
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
sudo rm -rf /usr/local/include/OpenEXR
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
macos-py38:
name: "Mac py38"
runs-on: macOS-latest
env:
CXX: clang++
PYTHON_VERSION: 3.8
CMAKE_CXX_STANDARD: 14
ENABLE_FIELD3D: OFF
ENABLE_OPENVDB: OFF
# No OpenVDB because on Homebrew, OpenVDB still uses OpenEXR 2.5
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /Users/runner/.ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/install_homebrew_deps.bash
src/build-scripts/install_test_images.bash
- name: Build
run: |
export PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
windows-vs2019:
name: "Windows VS2019"
runs-on: windows-2019
env:
PYTHON_VERSION: 3.7
CMAKE_GENERATOR: "Visual Studio 16 2019"
OPENEXR_VERSION: v2.5.6
CTEST_ARGS: "--timeout 120 --repeat after-timeout:5"
steps:
- uses: actions/checkout@v2
- name: Setup Nuget.exe
uses: nuget/setup-nuget@v1
- name: Build setup
shell: bash
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
shell: bash
run: |
src/build-scripts/gh-win-installdeps.bash
- name: Build
shell: bash
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
shell: bash
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
windows-vs2017:
name: "Windows VS2017"
runs-on: windows-2016
env:
PYTHON_VERSION: 3.7
CMAKE_GENERATOR: "Visual Studio 15 2017 Win64"
OPENEXR_VERSION: v2.5.6
CTEST_ARGS: "--timeout 120 --repeat after-timeout:5"
steps:
- uses: actions/checkout@v2
- name: Setup Nuget.exe
uses: nuget/setup-nuget@v1
- name: Build setup
shell: bash
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
shell: bash
run: |
src/build-scripts/gh-win-installdeps.bash
- name: Build
shell: bash
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
shell: bash
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
sanitizer:
# Run sanitizers.
name: "Sanitizers"
runs-on: ubuntu-18.04
container:
image: aswf/ci-osl:2020
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 14
PYTHON_VERSION: 3.7
USE_PYTHON: 0
SANITIZE: address
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
linux-clang10-cpp14:
# Test compiling with clang on Linux.
name: "Linux clang10: clang10 C++14 avx2 exr2.5 ocio2.0"
runs-on: ubuntu-18.04
container:
image: aswf/ci-osl:2021-clang10
env:
CXX: clang++
CMAKE_CXX_STANDARD: 14
PYTHON_VERSION: 3.7
USE_SIMD: avx2,f16c
PYBIND11_VERSION: v2.6.1
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
linux-clang11-cpp17:
# Test compiling with clang and C++17 on Linux.
name: "Linux clang11: clang11 C++17 avx2 exr3.1 ocio2.0"
runs-on: ubuntu-18.04
container:
image: aswf/ci-osl:2021-clang11
env:
CXX: clang++
CMAKE_CXX_STANDARD: 17
PYTHON_VERSION: 3.7
USE_SIMD: avx2,f16c
PYBIND11_VERSION: v2.6.1
OPENEXR_VERSION: v3.1.1
USE_OPENVDB: 0
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
sudo rm -rf /usr/local/include/OpenEXR
sudo rm -rf /usr/local/lib64/cmake/{IlmBase,OpenEXR}
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
linux-static:
# Test building static libs.
name: "Linux static libs: gcc7 C++14 exr2.2"
runs-on: ubuntu-18.04
env:
CXX: g++-7
CMAKE_CXX_STANDARD: 14
BUILD_SHARED_LIBS: OFF
steps:
- uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_keys
run: |
echo "::set-output name=date::`date -u +'%Y-%m-%dT%H:%M:%SZ'`"
- name: ccache
id: ccache
uses: actions/cache@v2
with:
path: /tmp/ccache
key: ${{ github.job }}-${{ steps.ccache_cache_keys.outputs.date }}
restore-keys: |
${{ github.job }}-
- name: Build setup
run: |
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
src/build-scripts/ci-build.bash
- name: Testsuite
run: |
src/build-scripts/ci-test.bash
- uses: actions/upload-artifact@v2
if: failure()
with:
name: ${{ github.job }}
path: |
build/*/testsuite/*/*.*
build/*/CMake*.{txt,log}
# This is an old branch, we don't need to patrol its formatting.
# clang-format:
# # 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).
# name: "clang-format verification"
# runs-on: ubuntu-18.04
# container:
# image: aswf/ci-osl:2021-clang11
# env:
# BUILDTARGET: clang-format
# PYTHON_VERSION: 3.7
# steps:
# - uses: actions/checkout@v2
# - name: Build setup
# run: |
# src/build-scripts/ci-startup.bash
# - name: Dependencies
# run: |
# src/build-scripts/gh-installdeps.bash
# - name: Build
# run: |
# src/build-scripts/ci-build.bash
# - uses: actions/upload-artifact@v2
# if: failure()
# with:
# name: ${{ github.job }}
# path: src/*/*.{cpp,h}
-241
View File
@@ -1,241 +0,0 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
name: CI
on:
push:
# Skip jobs when only documentation files are changed
paths-ignore:
- '**.md'
- '**.rst'
pull_request:
paths-ignore:
- '**.md'
- '**.rst'
schedule:
# Full nightly build
- cron: "0 0 * * *"
jobs:
vfxplatform-2019:
name: "Linux VFX Platform 2019: gcc6/C++14 py2.7 boost-1.66 exr-2.3"
runs-on: ubuntu-latest
container:
#image: aswf/ci-base:2019
image: aswf/ci-vfxall:2019
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 14
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
linux-gcc48:
name: "Linux 2017-ish: gcc4.8/C++11 py2.7 boost-1.66 exr-2.3"
runs-on: ubuntu-latest
container:
#image: aswf/ci-base:2019
image: aswf/ci-vfxall:2019
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: /usr/bin/g++
CC: /usr/bin/gcc
CMAKE_CXX_STANDARD: 11
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
linux-gcc7-cpp14-debug:
name: "Linux debug gcc7/C++14, sse4.2, exr2.4"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++-7
CMAKE_CXX_STANDARD: 14
USE_SIMD: sse4.2
DEBUG: 1
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
linux-gcc8:
name: "Linux next/VFXP2021: gcc8 C++17 avx exr2.4"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++-8
CMAKE_CXX_STANDARD: 17
USE_SIMD: avx
OPENEXR_BRANCH: v2.4.1
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
linux-bleeding-edge:
name: "Linux bleeding edge: gcc9 C++17 avx2 OCIO/libtiff/exr master"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: g++-9
CMAKE_CXX_STANDARD: 17
USE_SIMD: avx2,f16c
OPENEXR_BRANCH: master
OCIO_BRANCH: master
LIBTIFF_BRANCH: master
PYBIND11_BRANCH: master
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
linux-oldest:
# Oldest versions of the dependencies that we can muster, and various
# things disabled (no SSE, OCIO, or OpenCV, don't embed plugins)
name: "Linux oldest/hobbled: gcc4.8/C++11 py2.7 boost-1.66 exr-2.2 no-sse no-ocio"
runs-on: ubuntu-latest
container:
#image: aswf/ci-base:2019
image: aswf/ci-vfxall:2019
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: /usr/bin/g++
CC: /usr/bin/gcc
CMAKE_CXX_STANDARD: 11
USE_SIMD: 0
USE_JPEGTURBO: 0
USE_OPENCOLORIO: 0
USE_OPENCV: 0
EMBEDPLUGINS: 0
OPENEXR_BRANCH: v2.2.0
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps-centos.bash
source src/build-scripts/ci-build-and-test.bash
macos-py37:
name: "Mac py37"
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: clang++
PYTHON_VERSION: 3.7
ENABLE_WEBP: OFF
# ^^ webp seems broken on GH CI Mac. Investigate later.
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/install_homebrew_deps.bash
pip3.7 install numpy
src/build-scripts/install_test_images.bash
export PYTHONPATH=/usr/local/lib/python3.7/site-packages:$PYTHONPATH
source src/build-scripts/ci-build-and-test.bash
windows:
name: "Windows"
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Setup Nuget.exe
uses: warrenbuckley/Setup-Nuget@v1
- name: all
shell: bash
env:
PYTHON_VERSION: 3.6
CMAKE_GENERATOR: "Visual Studio 16 2019"
OPENEXR_BRANCH: v2.4.0
SKIP_TESTS: 1
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-win-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
sanitizer:
name: "Sanitizers"
runs-on: ubuntu-18.04
if: github.event_name == 'pull_request' || contains(github.ref, 'san') || contains(github.ref, 'RB') || contains(github.ref, 'release') || contains(github.ref, 'master') || contains(github.ref, 'gh')
steps:
- uses: actions/checkout@v2
#- uses: docker://aswfstaging/ci-base:2019
- name: all
env:
CXX: g++-7
CMAKE_CXX_STANDARD: 14
SANITIZE: address
USE_PYTHON: 0
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
linux-clang:
name: "Linux clang: clang9 C++14 avx2 exr2.4"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: clang++
LLVM_VERSION: 9.0.0
CMAKE_CXX_STANDARD: 14
USE_SIMD: avx2,f16c
OPENEXR_BRANCH: v2.4.0
OCIO_BRANCH: 1c624651b7
# Pick an OCIO commit that includes a warning fix we need for clang
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
linux-static:
name: "Linux static libs: gcc7 C++14 exr2.4"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
#- uses: docker://aswfstaging/ci-base:2019
- name: all
env:
CXX: g++-7
CMAKE_CXX_STANDARD: 14
BUILD_SHARED_LIBS: OFF
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/gh-installdeps.bash
source src/build-scripts/ci-build-and-test.bash
clang-format:
name: "clang-format verification"
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- name: all
env:
CXX: clang++
BUILDTARGET: clang-format
SKIP_TESTS: 1
BUILD_MISSING_DEPS: 0
run: |
source src/build-scripts/ci-startup.bash
source src/build-scripts/install_homebrew_deps.bash
source src/build-scripts/ci-build-and-test.bash
+1 -1
View File
@@ -12,7 +12,7 @@ sphinx:
# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf
- htmlzip
# Optionally set the version of Python and requirements required to build your docs
python:
-160
View File
@@ -1,160 +0,0 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# .travis.yml for OIIO
language: cpp
osx_image: xcode10
dist: xenial
# Add-ons: specify apt packages for Linux
# We actaully specify packages per-matrix-entry, so these don't do anything
# except to tag them (&add-sources, &common-packages, &common-boost-packages)
# so they can be referened later ('*') to save repetition.
addons:
apt:
sources: &add-sources
- ubuntu-toolchain-r-test
packages: &common-packages
- libgif-dev
- libopenjpeg-dev
- libwebp-dev
- libfreetype6-dev
- libjpeg-turbo8-dev
- dcmtk
- locales
- python-numpy
- libraw-dev
- ninja-build
# - qtbase5-dev # FIXME: enable Qt5 on Linux
# - bzip2
# - libtinyxml-dev
# - liblcms2-dev
# - libyaml-cpp-dev
packages: &common-boost-packages
- libboost1.58-dev
- libboost-filesystem1.58
- libboost-regex1.58
- libboost-system1.58
- libboost-thread1.58
packages: &old-boost-packages
- libboost1.55-dev
- libboost-filesystem1.55
- libboost-regex1.55
- libboost-system1.55
- libboost-thread1.55
cache:
ccache: true
apt: true
directories:
- $HOME/.ccache
- $PWD/oiio-images
- $PWD/libtiffpic
before_install:
- source src/build-scripts/ci-startup.bash
- export WHICHGCC=${WHICHGCC:="4.8"}
- if [ "$CXX" == "g++" ]; then export CXX="g++-${WHICHGCC}" ; fi
install:
- if [ $TRAVIS_OS_NAME == osx ] ; then source src/build-scripts/install_homebrew_deps.bash ; fi
- if [ "$BUILD_CMAKE" == "1" ] ; then source src/build-scripts/build_cmake.bash ; fi
- if [ $TRAVIS_OS_NAME == linux ] ; then CXX="ccache $CXX" source src/build-scripts/build_openexr.bash ; fi
- if [ $TRAVIS_OS_NAME == linux ] ; then CXX="ccache $CXX" source src/build-scripts/build_ocio.bash ; fi
- if [ $TRAVIS_OS_NAME == linux ] ; then source src/build-scripts/build_pybind11.bash ; fi
- src/build-scripts/install_test_images.bash
# before_script:
script:
- export LD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$LD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$DYLD_LIBRARY_PATH
- source src/build-scripts/ci-build-and-test.bash
branches:
only:
- master
- /RB-/
- /lg-/
matrix:
fast_finish: true
include:
# test default compile: C++11, optimized, default compilers, SSE2
- name: "VFX Platform 2017 (gcc48, py27, exr2.2)"
os: linux
dist: trusty
compiler: gcc
env: WHICHGCC=4.8 OPENEXR_BRANCH=v2.2.0 BUILD_CMAKE=1
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *old-boost-packages
- g++-4.8
- name: "Mac (latest clang, py37)"
os: osx
compiler: clang
env: PYTHON_VERSION=3.7
# Make sure Python 2.7 still works on OSX, but only for PRs, master/RB
# pushes, or if the branch name includes "python".
- name: "Mac py27 (latest clang)"
os: osx
compiler: clang
env: PYTHON_VERSION=2.7
# if: branch =~ /(master|RB|travis|python)/ OR type = pull_request
# One more, just for the heck of it, turn all SIMD off, and also make
# sure we're falling back on libjpeg, not jpeg-turbo, no OCIO support,
# and don't embed the plugins (to make sure that doesn't rust away). I
# guess this should/could be both platforms, but in the interest of
# making the tests go faster, don't bother doing it on OSX.
# Only build this case for PRs, direct pushes to master or RB branches,
# or if the branch name includes "simd". Other ordinary work branch
# pushes don't need to run this.
- name: "Oldest everything: gcc4.8, boost 1.55, no simd, no jpegturbo, no OCIO, dso plugins, exr2.2"
os: linux
dist: trusty
compiler: gcc
env: WHICHGCC=4.8 USE_SIMD=0 USE_JPEGTURBO=0 USE_OPENCOLORIO=0 EMBEDPLUGINS=0 OPENEXR_BRANCH=v2.2.0 BUILD_CMAKE=1
# if: branch =~ /(master|RB|travis|simd)/ OR type = pull_request
addons:
apt:
sources: *add-sources
packages:
- *common-packages
- *old-boost-packages
- g++-4.8
# Static analysis: build with clang-tidy.
# Disabled -- this takes so long to run, it can't complete in Travis's
# 50 minute time limit. Left here just to show how it should work.
# - name: "Static analysis / clang-tidy"
# os: linux
# compiler: gcc
# env: CLANG_TIDY=1 CLANG_TIDY_FIX=1 SKIP_TESTS=1
# if: branch =~ /(master|RB|travis|tidy)/ OR type = pull_request
# Build with EMBEDPLUGINS=0, both platforms.
# FIXME: doesn't work yet on Travis
# - os: linux
# compiler: gcc
# env: EMBEDPLUGINS=0
# FIXME: don't have OSX EMBEDPLUGINS=0 working yet on Travis (though
# it works fine on my laptop).
# - os: osx
# compiler: clang
# env: EMBEDPLUGINS=0
notifications:
email:
recipients:
- lg@openimageio.org
on_success: change
on_failure: always
+655 -96
View File
@@ -1,26 +1,361 @@
Release 2.2 (???) -- compared to 2.1
Release 2.2.21 (1 Jul 2022) -- compared to 2.2.20
--------------------------------------------------
* BMP: gain the ability to read some very old varieties of BMP files. #3375
* BMP: better detection of corrupted files with nonsensical image dimensions
or total size. #3434
* BMP: protect against corrupted files that have palette indices out of bound.
#3435
* ffmpeg: Support for ffmpeg 5.0. #3282
* ffmpeg: protect against possible double-free. #3376
* ffmpeg: make the supported file extension check be case-insensitive. This
prevents movie files from being incorrectly unable to recognize their format
if they have the wrong capitalization of the file extension. #3364
* hdr/rgbe files: Avoid possible Windows crash when dealing with characters
with the high bit set. #3310
* TIFF: fix read problems with TIFF files with non-zero y offset. #3419
* Dev goodies: ustring has added a from_hash() static method #3397, and a
ustringhash helper class #3436.
* simd.h fixes for armv7 and aarch32. #3361
Release 2.2.20 (1 Feb 2022) -- compared to 2.2.19
--------------------------------------------------
* Fix some address sanitizer failures. #3160
* Build/CI: Deal with OpenColor renaming its master branch to main. #3169
* Windows: Fix error when compiling with MSVC. #3168
* Fix excessive memory usage when saving EXR with many channels. #3176
* TIFF: now works for 16-bit palette images. #3260
* Fix ImageBuf::read bug for images of mixed per-channel data types. #3088
Release 2.2.19 (1 Nov 2021) -- compared to 2.2.18
--------------------------------------------------
* Better catching of exceptions thrown by OCIO 1.x if it encounters 2.0 config
files. #3089
* Address new warnings revealed by clang 13. #3122
* Fixed some minor python binding bugs. #3074 #3094
* Fix when building with Clang on big-endian architectures. #3133
* Fix occasional build breaks related to OpenCV headers. #3135
* Improvements to NetBSD and OpenBSD support. #3137.
* Fixes to work with the libraw 202110 snapshot. #3143
Release 2.2.18 (1 Sep 2021) -- compared to 2.2.17
--------------------------------------------------
* Honor env variable `CUE_THREADS` (used by OpenCue) to set the default size
of OIIO's thread pool. #3038
* Compatibility with OpenColorIO 2.1. #3050
* Dev: Extend Sysutil::getenv() to take a default if the environment variable
is not found. #3047 #3048
Release 2.2.17 (1 Aug 2021) -- compared to 2.2.16
--------------------------------------------------
* Output to DPX files now supports IOProxy. (Input already did.) #3013
* typedesc.h: TypeDesc can now describe 2D and 3D bounding boxes, as arrays
of 2 VEC2 aggregates (for 2D) or VEC3 aggregates (for 3D) with "BOX"
semantic. The shorthand for these are `TypeBox2`, `TypeBox3` (for float),
and `TypeBox2i` and `TypeBox3i` for integer or pixel coordinte
boxes. #3008
* Build: Fixes for building against fmt 8.0.0. #3007
* Build: Finding boost is more flexible when desiring static libraries. #3031
Release 2.2.16 (1 Jul 2021) -- compared to 2.2.15
--------------------------------------------------
* New UDIM texture name patterns recognized: `%(UDIM)d` is the Houdini
convention, and `_u##v##` is for Animal Logic's internal renderer. #3006
(2.2.16)
* When doing color space transforms on images with > 4 channels -- the
additional channels are now copied unaltered, rather than leaving them
black. #2987 (2.2.16)
* FFMpeg: fix some encodings that didn't correctly recognize that they were
more than 8 bits, or had alpha. #2989 (2.2.16)
* farmhash.h: Clean up all non-namespaced preprocessor symbols that are set
by this header and may pollute the caller's symbols. #3002 (2.2.16)
* Fix crashes on M1 (ARM) based Mac. #2990 (2.2.16)
* Bug fix: avid divide-by-0 error computing chunk size for invalid image
sizes. #2983 (2.2.16)
* `make_texture` (and `maketx` and `oiiotool -otex`) no longer crash if you
try to make a texture out of a "deep" image; instead it will return an
error message. #2991 (2.2.16)
* filesystem.h: Improve exception safety in Filesystem directory iteration.
#2998 (2.2.16)
* Build: Improve finding of OpenJPEG. #2979 (2.2.16)
* Build: Support for building OIIO with gcc 11. #2995 (2.2.16)
* Build: Fixes to accommodate Imath 3.1 upcoming changes. #2996 (2.2.16)
* Build: Finding FFMpeg now correctly detects the version. #2994 (2.2.16)
* Build: clang + C++17 + LibRaw < 0.20 are mutually incompatible. Detect
this combination and warn / disable libraw under those conditions. #3003
(2.2.16)
* Build: Fix CMake behavior for `REQUIRED_DEPS` due to a typo. #3011 (2.2.16)
* Build: Fixes for detecting and using Ptex, among other things got the
version wrong. #3001 (2.2.16)
* Testing: If a feature is disabled, skip its tests rather than reporting
them as broken. #2988 (2.2.16)
* CI: Test the combination of clang and C++17. #3003 (2.2.16)
Release 2.2.15 (1 Jun 2021) -- compared to 2.2.14
--------------------------------------------------
* BMP improvements: now support reading rle-compressed BMP files; writing
single channel grayscale images now save as 8bpp palette images intead of
24bpp; and reading 8bpp where all palette entries have R==G==B looks like
a 1-channel grayscale instead of 3-channel RGB. #2976
* Bug: IBA::render_text did not properly account for alpha of the draw
color. #2981
* Bug: Fix runaway parsing time for pathological XMP metadata. #2968
* Bug: Fixed a crash is ImageCacheFile::read_unmipped when sampling
* Fix exported cmake config files, which could fail if Imath and OpenEXR
weren't the at the same version number. #2975
* Build: Modernize cmake to use targets for PNG and ZLIB. #2957
* Build: Fix to accommodate upcoming OpenColorIO 2.1 deprecation of
parseColorSpaceFromString. #2961
* Build: Changes to make it build against TBB 2021. #2985
* Dev: Add Strutil functions: find, rfind, ifind, irfind. #2960
non-zero-base channels. (#2962)
Release 2.2.14 (1 May 2021) -- compared to 2.2.13
--------------------------------------------------
* JPEG: Improve readin of files with mildly corrupted headers. #2927
* TIFF: Support IOProxy for input. #2921
* BMP: Improve performance by eliminating wasteful per-scanline allocation
and needless data copying. #2934
* Build/CI: Fix all the build_*.bash scripts to not use cmake --config flag,
which was harmlessly ignored but is flagged as an error for CMake 3.20.
#2931
* Build: More fixes related to supporting a wide range of OpenEXR versions,
and making our exported cmake configs correctly transmit dependencies on
OpenEXR include paths. #2935 #2941 #2942 #2947
* ImageBufAlgo::fillholes_pushpull: added logic to correctly set the spec's
alpha_channel field when generating sub-images. #2939
* Python: MakeTxBumpWithSlopes enum value had been inadvertently omitted
from the Python bindings. #2951
Release 2.2.13 (1 Apr 2021) -- compared to 2.2.12
--------------------------------------------------
* Get ready for upcoming Imath/OpenEXR 3.0 release. #2883 #2894 #2897
* GIF: Fix error checking for non-existant GIF files. #2886
* Fix crash related to ImageBuf:set_write_format() when used in conjunction
with a file format that doesn't support per-channel data types. #2885
* Make RAW files handle Unicode filenames on Windows. #2888
* Make sure OIIO builds cleanly with C++20. #2891
* BMP: Several bug fixes when reading an older (V1) variety of BMP files.
#2899
* Targa: fix reading tga files with 0-sized thumbnails. #2903
* TIFF: fix reading of certain tiled TIFF files with the vertical image size
is not a whole multiple of the tile size. #2895
* Avoid OpenColorIO v2 exception when color-conversion of single points (we
didn't pass a correct stride, thinking that stride isn't used for a single
point). #2911
* make_texture: When outputting to a 'half' data format file, clamp filtered
values to the half range so large values don't inadvertently get converted
to half 'infinite' values. #2892
* Improvements to ustring internals to ensure that no two ustrings ever end
up with the same hash() value. #2870
* Fixes for compiler errors when compiling farmhash.h using C++11 mode with
newer gcc (6+). #2914
Release 2.2.12 (1 Mar 2021) -- compared to 2.2.11
--------------------------------------------------
* Bug fix: Improve parsing of XMP records in metadata: more correct handling
of lists/sequences, better inference of types that look like int or float
(rather than forcing unknown fields into strings), fixed bugs in parsing
rational values. #2865
* Bug fix: Fix loading PSB files with cinf tags. #2877
* Build: Improvements to building or linking static libraries. #2854
* Build: Change default STOP_ON_WARNING to OFF for release branches
(including this one) so that small change in compiler warnings after our
release don't break anybody's builds. (Though we still stop on warnings
for CI builds). #2861
* Build: More clear warnings about using OpenVDB 8+ when building for C++11,
because OpenVDB 8 requires C++14 or higher. #2860
* Build: The pkgconfig OpenImageIO.pc was specifying the include path
incorrectly. #2869
* Build: More gracefully handle building against a custom Imath/OpenEXR even
when another exists in the system area. #2876
* Build: Minor fixes to build cleanly against the upcoming Imath 3.0. #2878
* Dev: hash.h: Make many of the hash functions constexpr. #2843
* Dev: Better unit tests to verify correctness and stability over time of
the hash functions. #2853
* Dev: unordered_map_concurrent.h: New methods find_or_insert, nobin_mask().
#2867
* CI: Speed up CI builds by not building OpenEXR example programes. #2857
* CI: Speed up CI by using GitHub 'cache' actions + ccache. #2859
* CI: Separate stages (setup, deps, build, test) into separate GHA "steps"
for better logging and understanding of the timing and performance. #2862
* CI: Now actively testing libheif in Linux CI. #2866
* CI: Remove the last vestiges of Travis-CI, which we no longer use. #2871
* CI: For failed tests, add CMake cache and log part of the saved artifacts.
* PSA: Avoid libheif 1.10 on Mac, it is broken. Libheif 1.11 is fine.
Release 2.2.11.1 (1 Feb 2021) -- compared to 2.2.11.0
-----------------------------------------------------
* Fix build break against Qt 5.15.2 (deprecated enum). #2852
Release 2.2.11 (1 Feb 2021) -- compared to 2.2.10
--------------------------------------------------
* Enabled AVIF decoding of heic files (requires libheif >= 1.7 and for it
to have been built with an AV1 encoder/decoder). #2811 #2812 #2814 #2818
* `oiiotool --help` now prints the OCIO version (where it prints the config
file and known color space). #2849
* Bug fix: ImageBufAlgo::ociolook() and ociofiletransform() internally
reversed the order of their `inverse` and `unpremult` arguments, making it
hard to select the inverse transformation. #2844
* Fix memory leak during decoding of some invalid Exif blocks. #2824
* Build: Fixed warnings when building against python 2.x. #2815
* Build: No longer directly link against python libraries when unnecessary.
#2807
* Build: Better finding of OpenJpeg 2.4. #2829
* Build: On Windows, fix some linkage problems by changing the pybind11
bindings to make a CMake "shared" library rather than "module". Sounds
wrong, but seems to work. We will reverse if this causes problems. #2830
* Build: On Mac, libheif 1.10 is very broken. Don't use that version. #2847
* Build: Fix build break against changes coming in future libtiff, where it
is changing from some libtiff-defined integer types to the equivalent
stdint.h types. #2848
* Build: Some final touches to prepare for release of OpenColor 2.0. #2849
* Build: Fixes to support the libraw 202101 snapshot (their in-progress
0.21.0). #2850
* CI: Got Windows CI fully working, bit by bit. #2796 #2805 #2821 #2826
#2834 #2835 #2836 #2840
* Dev: Some internal rearrangement of span.h and string_view.h (that should
not break source or ABI compatibility). `std::size()` and `std::ssize()`
should work with OIIO::span and OIIO::string_view now. #2827
* Dev: ustring internals now have a way to ask for the list of ustrings
whose hashses collided. #2786
* Dev: New Filesystem::generic_filepath() returnss a filepath in generic
format (not OS specific). #2819
* Dev: ArgParse::abort() lets the response to a command line argument signal
that no further arguments should be parsed. #2820
* Dev: In oiioversion.h, added macros `OIIO_VERSION_GREATER_EQUAL` and
`OIIO_VERSION_LESS`. #2831
* Dev: In platform.h, added macro OIIO_INLINE_CONSTEXPR, which is equivalent
to `inline constexpr` for C++17, but just constexpr for C++ <= 14. #2832
Release 2.2.10 (1 Jan 2021) -- compared to 2.2.9
-------------------------------------------------
* GIF: support for UTF-8 filenames on Windows. #2777
* OpenEXR: Fix rare crash during multithreaded output. #2781
* OpenEXR: Fix potential crash parsing OpenEXR header that contains Rational
attributes with certain values. #2791
* Improved error reporting for IOFile failures to open the file. #2780
* Build: Fix webp compile break on 32 bit systems. #2783
* Build/Windows: Fix symbol definition conflict with pyconfig.h. #2800
* CI: Test the latest fmt, PugiXML, and pybind11 releases. #2778
* Docs: Add explanation of oiiotool -otex modifiers that were missing from
the docs. #2790 Fix some duplicated text. #2785
Release 2.2.9 (1 Dec 2020) -- compared to 2.2.8
-------------------------------------------------
* TIFF: Fix reading files with "separate" planarconfig and rowsperstrip more
than 1. #2757 (2.3.0.1/2.2.9)
* RAW: add "raw:user_flip" input configuration hint to control this option
in the underlying libraw. #2769 (2.3.1.0)
* PNG: Read Exif data from PNG files. #2767
* BMP: Fix reading BMP images with bottom-to-top row order. #2776
* Work to ensure that OIIO will build correctly against the upcoming
Imath 3.0 and OpenEXR 3.0.
* Make the OIIO CMake files work properly if OIIO is a subproject. Also
various other CMake script refactoring. #2770
Release 2.2.8 (1 Nov 2020) -- compared to 2.2.7
-------------------------------------------------
* Fix that ImageBuf images backed by ImageCache, could hold an outdated copy
of the image if it was in the imagecache once, then changed on disk. #2696
* Fix stack overflow crash in IBA::colorconvert of unusually wide images.
#2716
* Fix boost linkage problem on Windows. #2727
* Fix broken reads of 16 bit iff files. #2736
* Fix make_texture incorrectly setting tile sizes. #2737
* Fix incorrect ARM NEON code in simd.h. #2739
* Improve oiiotool --chappend and --siappend, allowing an optional modifier
":n=" to specify the number of images from the stack to be combined by
having their channels or subimages appended. #2709
* WebP: add support for requesting compression "lossless". #2726
* Improve build system for finding Python, now if a specific version is not
requested, default to whichever is found rather than always defaulting to
Python 2.7. #2705 #2764
* Fix deprecation warnings when building with very new PugiXML versions.
#2733
* Fix ImageCache bug: add_tile/get_tile not properly honoring when
`chend < chbegin` it should get all channels. #2742
* Fix build break when strutil.h was included in Cuda 10.1 code. #2743
* Docs: Make readthedocs generate downloadable htm as well as pdf. #2746
* Improve oiiotool's guessing about the desired output format based on
inputs (in the absence of `-d` to specify the format). #2717
* JPEG output: add support for writing progressive JPEGS (set the
attribute "jpeg:progressive" to 1). #2749
* WebP input improvements including: RGB images are kept as RGB instead of
always adding alpha; more efficient by skipping alpha premultiplication
when it's unnecessary; now can read animated WebP images as multi-subimage
files. #2730
* Docs: ImageInput chapter now has an example of reading image data into
separate per-channel buffers. #2756
* Fixes to build against recent changes in OpenColorIO v2 master. #2765
Release 2.2.7 (1 Oct 2020) -- compared to 2.2.6
-------------------------------------------------
* oiiotool new command: `--pastemeta` takes two images as arguments, and
appends all the metadata (only) from the first image onto the second
image's pixels and metadata, producing a combined image. #2708
* TIFF: Fix broken reads of multi-subimage non-spectral files (such as
photometric YCbCr mode). #2692
* Python: When transferring blocks of pixels (e.g., `ImageInput.read_image()`
or `ImageOutput.write_scanline()`), "half" pixels ended up mangled into
uint16, but now they use the correct numpy.float16 type. #2694
* Python: The value passed to `attribute(name, typedesc, value)` can now be
a tuple, list, numpy array, or scalar value. #2695
* `IBA::contrast_remap()` fixes bug that could crash for very large images
#2704
* Warn about recommended minimum versions of some dependencies.
* Windows fix: correct OIIO_API declaration on aligned_malloc, aligned_free
of platform.h. #2701
* Fix oiiotool crash when --resize was used with multi-subimage files. #2711
* Bug fix in Strutil::splits and splitsv: when input is the empty string,
the split should return no pieces. #2712
* Support for libheif 1.9. #2724
* TIFF: Fix spec() and spec_dimensions() for MIPmapped TIFF files, they
did not recognize being asked to return the specs for invalid subimage
indices. #2723
* TIFF: add ability to output 1bpp TIFF files. #2722
Release 2.2 (1 Sept 2020) -- compared to 2.1
----------------------------------------------
New minimum dependencies:
* pybind11 >= 2.4.2
* openjpeg >= 2.0 (if JPEG-2000 support is desired) #2555 (2.2.2)
New file format support:
New major features and public API changes:
* New IOProxy support: ImageInput and ImageOutput now have direct API level
support for IOProxy in their `open()` and `create()` calls, as well as a
new `set_ioproxy()` method in these classes. ImageBuf similarly can specify
a proxy upon construction for reading, and for writing via a
`set_write_ioproxy()` method that applies to subsequent `write` call.
#2434 (2.2.0), #2477 (2.2.1).
* Python bindings have been added for missing ParamValue constructors. We
previously exposed the PV constructors from just a plain int, float, or
string, but there wasn't an easy way to construct from arbitrary data like
there is in C++. Now there is. #2417 (2.2.0)
* Python bindings for `ParamValueList.attribute()`, when being passed
attributes containing multiple values, now can have those values passed
as Python lists and numpy arrays (previously they had to be tuples).
#2437 (2.1.11/2.2.0)
* Improved IOProxy support:
- ImageInput and ImageOutput now have direct API level support for IOProxy
in their `open()` and `create()` calls, as well as a new `set_ioproxy()`
method in these classes. #2434 (2.2.0)
- ImageBuf can now specify a proxy upon construction for reading, and for
writing via a `set_write_ioproxy()` method that applies to subsequent
`write` call. #2477 (2.2.1).
- DPX input now supports IOProxy. #2659 #2665 (2.2.5)
- ImageCache (and ImageBuf backed by ImageCache) entries that use IOProxy
are careful not to fully "close" their proxies when trying to reclaim
space in the file cache (that would be bad, since the proxy can't be
re-opened). #2666 (2.2.5)
* Improved support for multi-subimage files:
- oiiotool: Nearly all operations now allow an optional `:subimages=...`
modifier that restricts the operation to be performed on only a subset
of named or indexed subimages. See docs for details. #2582
- Python `ImageBuf.write()` variety added that takes an open
`ImageOutput`. This is the key to writing a multi-subimage file (such
as a multi-part OpenEXR) using the Python ImageBuf interface. #2640
(2.2.4)
- Fixes to `--croptofull` and `-o` with multi-subimages. #2684 (2.2.6)
* Python bindings:
- Python bindings have been added for missing ParamValue constructors.
We previously exposed the PV constructors from just a plain int, float,
or string, but there wasn't an easy way to construct from arbitrary
data like there is in C++. Now there is. #2417 (2.2.0)
- `ParamValueList.attribute()`, when being passed attributes containing
multiple values, now can have those values passed as Python lists and
numpy arrays (previously they had to be tuples). #2437 (2.1.11/2.2.0)
- `ImageBufAlgo.color_range_check()` is now available to the Python
bindings (was previously only C++). #2602 (2.2.3)
- New variety of `ImageBuf.write()` that takes an open `ImageOutput`.
This is the key to writing a multi-subimage file (such as a multi-part
OpenEXR) using the Python ImageBuf interface. #2640 (2.2.4)
* ImageBuf:
- Easier direct use of IOProxy with ImageBuf: constructor and reset()
for file-reading ImageBuf now take an optional `IProxy*` parameter,
@@ -36,6 +371,12 @@ New major features and public API changes:
- New `max()` and `min()` functions take the pixel-by-pixel maximum
or minimum of two images. #2470 (2.2.1)
* ColorConfig: add OCIO "role" accessors. #2548
* Low-res I/O of images to terminals that support full color and Unicode
characters. Just output to a file ending in ".term", and it will convert
(on certain terminals) to an image displayed directly in the terminal.
#2631 (2.2.4)
Try:
`oiiotool myfile.exr -o out.term`
Performance improvements:
* Greatly improved TextureSystem/ImageCache performance in highly threaded
@@ -51,13 +392,21 @@ Fixes and feature enhancements:
create an image too big to fit in memory. #2414 (2.2.0)
- `--create` and `--proxy` take an additional optional modifier:
`:type=name` that specifies the type of buffer to be created (the
default, as usual is to create an internal float-based buffer). #2414
default, as usual, is to create an internal float-based buffer). #2414
(2.2.0)
- `-o` optional argument `:type=name` is a new (and preferred) synonym
for what used to be `:datatype=`. #2414 (2.2.0)
- `--autotrim` now correctly trims to the union of the nonzero regions
of all subimages, instead of incorrectly trimming all subimages to the
nonzero region of the first subimage. #2497 (2.2.1.2)
- `--subimage` now has an optional `:delete=1` modifier that causes the
operation to delete one named or indexed subimage (versus the default
behavior of extracing one subimage and deleting the others). #2575
(2.2.3)
- The list of dependent libraries (part of `oiiotool --help`) now
correctly reports the OpenEXR version. #2604 (2.2.3)
- Fix: `--eraseattrib` did not correctly apply to all subimages when
`-a` or `:allsubimages=1` were used. #2632 (2.2.4)
* ImageBuf / ImageBufAlgo:
- Huge ImageBuf allocation failures (more than available RAM) now are
caught and treated as an ImageBuf error, rather than crashing with an
@@ -69,27 +418,36 @@ Fixes and feature enhancements:
channels, or data type have not been set validly). #2460
- Fix: `ImageBuf::getchannel()` did not honor its `wrap` parameter.
#2465 (2.2.1/2.1.12)
- Fix: `IBA::reorient()` and `IBA::computePixelHashSHA1()` did not
honor their `nthreads` parameter. #2465 (2.2.1/2.1.12)
- Fix: `IBA::reorient()` and `IBA::computePixelHashSHA1()` did not honor
their `nthreads` parameter. #2465 (2.2.1/2.1.12)
- `resample()` has been modified to more closely match `resize` by using
clamp wrap mode to avoid a black fade at the outer edge of the
resampled area. #2481
- Fix: `ImageBuf::get_pixels()` did not honor the stride parameters.
#2487. (2.1.12/2.2.1)
- Fix `resize()` to avoid a crash / stack overflow in certain cases of
very big images and very large filter kernels. #2643 (2.2.4)
- Minor improvements to ImageBuf error formatting. #2653 (2.2.5)
* ImageCache / TextureSystem / maketx:
- New IC/TS attribute "trust_file_extensions", if nonzero, is a promise
that all files can be counted on for their formats to match their
extensions, which eliminates some redundant opens and format checks
in the IC/TS and can reduce needless network/filesystem work. Use
with caution! #2421 (2.2.0)
in the IC/TS and can reduce needless network/filesystem work. Use with
caution! #2421 (2.2.0)
- texture3d() fixed some cases where derivative results were not
correctly copied to the outputs. #2475 (2.2.1)
- `maketx`/`IBA::make_texture`: better error detection and messages
when using "overscan" textures with formats that can't support it
properly. (Punchline: only OpenEXR textures can do it.) #2521 (2.2.0)
- `maketx`/`IBA::make_texture`: better error detection and messages when
using "overscan" textures with formats that can't support it properly.
(Punchline: only OpenEXR textures can do it.) #2521 (2.2.0)
- Fix possible redundant tile reads in multithread situations (harmless,
but makes for redundant I/O). #2557 (2.2.2)
* Exif read: guard better against out of range offests, fixes crashes when
* Python:
- Fixed a bug that lost certain string arguments, especially when passing
a TypeDesc as its string equivalent. #2587 (2.1.16/2.2.3)
- Fixed broken bindings of ImageSpec.erase_attribute. #2654
(2.1.19/2.2.6)
- Fix missing ImageInput.read_image(). #2677 (2.1.19/2.2.6)
* Exif read: guard better against out of range offsets, fixes crashes when
reading jpeg files with malformed exif blocks. #2429 (2.1.10/2.2.0)
* Fix: `ImageSpec::erase_attribute()` did not honor its `searchtype`
parameter. #2465 (2.2.1/2.1.12)
@@ -97,37 +455,72 @@ Fixes and feature enhancements:
parameters correctly. #2475 (2.1.12)
* Fix: iinfo return code now properly indicates failures for files that
can't be opened. #2511 (2.2.2/2.1.13)
* DPX:
- IOProxy reading is now supported. #2659 (2.2.5)
- DPX: Add support for reading DPX files from IOProxy (such as from a
memory buffer). #2659 #2665 (2.1.19/2.2.6)
* HDR files:
- Improve performance when reading HDR files out of order (when combined
with ImageCache, observed to speed up out-of-order HDR reading by 18x).
#2662 (2.2.5)
* JPEG:
- Fix resolution unit metadata that was not propery set in JPEG output.
- Fix resolution unit metadata that was not properly set in JPEG output.
#2516 (2.2.2/2.1.13)
- Fix loss of 'config' info upon close/reopen. #2549 (2.2.2)
* OpenEXR:
- Add support for reading and writing float vector metadata. #2459 #2486
- Fix bug in the channel sorting order when channels are "X" and
"Y" (was reversing the order by confusing "Y" for "luminance"). #2595
(2.1.16/2.2.3)
- We no longer automatically rename the "worldToNDC" attribute to
"worldtoscreen" and vice versa. #2609 (2.2.4)
* PNG:
- Fix loss of 'config' info upon close/reopen. #2549 (2.2.2)
- Add output configuration hint "png:filter" to control PNG filter
options. #2650 (2.2.5)
- Improved propagation of PNG write errors. #2655 (2.2.5)
- Tell libpng to turn off sRGB profile check, which has a known problem of
false positives. #2655 (2.2.5)
- New output option "png:filter" allows control of the PNG filter
options. #2650 (2.1.19/2.2.6)
* Raw images:
- Support for new Canon .cr3 file, but only if you build against
libraw >= 0.20.0 developer snapshot. #2484 (2.2.1)
libraw >= 0.20.0 developer snapshot. #2484 (2.2.1) #2613 (2.2.4)
- RAW input: set the "raw:flip" attribute if the underlying libraw did a
reorientation. #2572 (2.1.15/2.2.3)
- Avoid errors (in libraw) that resulted from multiple threads opening
raw files at the same time. #2633 (2.2.4)
* RLA:
- Additional sanity checks and error checks/messages for detecting files
that might be first mistaken for RLA files, but actually are not.
#2600 (2.2.3)
* TIFF:
- Internal improvements to handling metadata retrieval for certain
unusual tags. #2504 (2.2.2/2.1.13)
- Fix subtle bug when reading Exif directory in the header. #2540
(2.2.2)
* Video files:
- Fix possible infinite loop in the FFMpeg-based reader. #2576
(2.1.15/2.2.3)
Developer goodies / internals:
* argparse.h:
- Complete overhaul of ArgParse to make it more like Python argparse.
Please read the extensive comments in argparse.h for documentation.
For now, the old ArgParse interface still works, but is considered
deprecated. #2531 (2.2.2)
deprecated. #2531 (2.2.2) #2618 #2622 (2.2.4)
* attrdelegate.h:
- New `as_vec<>` method returns the whole attribute as a std::vector.
#2528 (2.2.2)
* filesystem.h:
- Catch previously uncaught exceptions that could happen in certain
Filesystem utility calls. #2522 (2.2.2/2.1.13)
- New `write_text_file()` convenience function for opening, writing, and
closing a text file all in one step. #2597 (2.2.3)
* fmath.h:
- clamp() is 2x faster. #2491 (2.1.12/2.2.2)
- Very minor fix to OIIO::clamp(), shouldn't affect normal use with
floats at all, but fixed a subtle quasi-bug in OSL. #2594 (2.1.15/2.2.3)
- madd() is improved especially on platforms without fma hardware
#2492 (2.1.12/2.2.2)
- Perf improvements to `fast_sin`, `fast_cos` #2495 (2.1.12/2.2.2)
@@ -135,6 +528,12 @@ Developer goodies / internals:
- New `fast_neg` is faster than simple negation in many cases, if you
don't care that -(0.0) is 0.0 (rather than a true -0.0). #2495
(2.1.12/2.2.2)
- Add vint4, vint8, and vint16 versions of `clamp()`. #2617 (2.2.4)
* oiioversion.h:
- Fix typo that left the OIIO_VERSION_RELEASE_TYPE symbol undefined.
#2616 (2.2.4/2.1.16)
- Add new `OIIO_MAKE_VERSION(maj,min,patch)` macro that constructs the
proper single integer code for a release version. #2641 (2.2.4/2.1.17)
* paramlist.h:
- New `ParamValueList::find_pv()` method that is similar to `find()` but
returns a pointer rather than an iterator and nullptr if the attribute
@@ -154,6 +553,13 @@ Developer goodies / internals:
methods, to more closely match the syntax of Imath::Vec3f. #2437
(2.1.11/2.2.0)
- fix errors in vbool == and !=. #2463 (2.1.11/2.2.1)
- Add float3 versions of abs, sign, ceil, floor, and round (they already
existed for float4, float8, float16, but not float4). #2612 (2.2.4)
- Improved support for ARM NEON SIMD (caveat: this is still not well
tested). #2614 (2.2.4)
- Improve performance for many float8/int8 functions and operators when
running on only 4-wide hardware, by using two 4-wide instructions
instead of reverting to scalar. #2621
* span.h:
- Allow the constructor from `std::vector` to allow vectors with custom
allocators. #2533 (2.2.2)
@@ -167,88 +573,241 @@ Developer goodies / internals:
- `Strutil::repeat()` has been internally rewritten to more efficient by
avoiding any unnecessary copies or temporary heap allocations. #2478
(2.2.1)
* typedesc.h:
- TypeDesc has additional helpers of constexpr values TypeFloat2,
TypeVector2, TypeVector4, TypeVector2i, TypePointer. #2592 (2.1.16/2.2.3)
* unordered_map_concurrent.h:
- Fix missing decrement of `size()` after `erase()`. #2624 (2.2.4)
* More reshuffling of printf-style vs fmt-style string formatting. #2424
(2.2.0)
(2.2.0) #2649 (2.2.4)
* Internals: changed a lot of assertions to only happen in debug build mode,
and changed a lot that happen in release builds to only print the error
but not force a termination. #2435 (2.1.11/2.2.0)
* Internals: Replaced most uses of `boost::thread_specific_ptr` with C++11
`thread_local`. #2431 (2.2.0)
* oiiotool: Big overhaul and simplification of internals. #2586 #2589 (2.2.3)
Build/test system improvements and platform ports:
* Bump the minimum pybind11 vesion that we auto-download, and also be sure
to auto-download if pybind11 is found on the system already but is not an
adequately new version. #2453 (2.1.10.1/2.2.0)
* Pybind11 is no longer auto-downloaded. It is assumed to be pre-installed.
A script `src/build-scripts/build_pybind11.bash` is provided for
convenience if you lack a system install. #2503 (2.2.2)
* Un-embed fmt headers. If they are not found on the system at build time,
they will be auto-downloaded. #2439 (2.2.0)
* CMake build system and scripts:
- New non-default CMake build flag `EXTRA_WARNINGS`, when turned on, will
cause gcc and clang to compile with -Wextra. This identified many new
warnings (mostly about unused parameters) and fixes were applied in
#2464, #2465, #2471, #2475, #2476. (2.2.1)
- FindOpenColorIO.cmake now correctly discerns the OCIO version (2.2.1),
and now sets up a true imported target. #2529 (2.2.2)
- FindOpenEXR.cmake has better detection of debug openexr libraries.
#2505 (2.2.2/2.1.13)
- Additional cmake controls to customize required vs optional
dependencies: `REQUIRED_DEPS` (list of dependencies normally optional
that should be treated as required) and `OPTIONAL_DEPS` (list of
dependencies normally required that should be optional). The main use
case is to force certain optional deps to be required for your studio,
to be sure that missing deps are a full build break, and not a
successful build that silently lacks features you need. #2507
(2.2.2/2.1.13)
- Fix exported cmake config file, it was not ensuring that the Imath
headers properly ended up in the config include path. #2515
(2.2.2/2.1.13)
- Change all CMake references to PACKAGE_FOUND to Package_Found (or
whatever capitalization matches the actual package name). #2569 (2.2.2)
- The exported CMake config files now set cmake variable
`OpenImageIO_PLUGIN_SEARCH_PATH` #2584 (2.1.16/2.2.3)
- Improved hints printed about missing dependencies. #2682 (2.2.6)
* Dependency version support:
- Pybind11 is no longer auto-downloaded. It is assumed to be
pre-installed. A script `src/build-scripts/build_pybind11.bash` is
provided for convenience if you lack a system install. #2503 (2.2.2)
Bump the minimum pybind11 version that we accept, to 2.4.2 #2453,
and add fixes to allow support of pybind11 2.5. #2637 (2.2.4)
- fmt libray: Un-embed fmt headers. If they are not found on the system
at build time, they will be auto-downloaded. #2439 (2.2.0)
- Support for building against libraw 0.20. #2484 (2.2.1) #2580 (2.2.3)
- Build properly against OpenColorIO's current master (which is the
in-progress work on OCIO v2). #2530 (2.2.2)
- Fix static boost to not overlink on Windows. #2537 (2.2.2)
- Fix build breaks against TOT libtiff master, which had `#define`
clashes with our GPSTag enum values. #2539 (2.2.2)
- Ensure compatibility and clean builds with clang 10. #2518 (2.2.2/2.1.3)
- Support verified for gcc 10, added to CI tests. #2590 (2.2.3)
- Support for Qt 5.15. #2605 (2.2.3)
- Fixes to support OpenColorIO 2.0. #2636 (2.2.4)
- Build against more recent versions of fmtlib. #2639 (2.2.4)
- Included scripts to download and build libtiff #2543 (2.1.13/2.2.2),
PugiXML #2648 (2.2.4), zlib, libpng, libjpeg-turbo. #2663 (2.2.5)
- Minor fixes for libheif 1.8. #2685 (2.2.6)
- Add a build_libtiff.bash script to make it easy to build the libtiff
dependency. #2543 (2.1.13/2.2.2)
- "tinyformat" is no longer used, even optionally. We have switched
entirely to fmtlib, which is more similar to the upcoming C++20
std::format. #2647 (2.2.4)
* Testing and Continuous integration (CI) systems:
- Mostly retire TravisCI for ordinary Linux x64 and Mac builds, now we
rely on GitHub Actions CI. Nightly test added. Use ASWF docker images
to test exactly against VFX Platform 2019 and 2020 configurations.
#2563 (2.2.2) #2579 (2.2.3)
- Add Travis test for arm64 (aka aarch64) builds. This is still a work
in progress, and not all testsuite tests pass. #2634 (2.2.4)
- Our CI tests now have a "bleeding edge" matrix entry that tests against
the current TOT master build of libtiff, openexr (#2549), and pybind11
(#2556). (2.2.2)
- GitHub CI tests, when they fail, leave behind an "artifact" tar file
containing the output of the tests, so that they can be easily
downloaded and inspected (or used to create new reference output).
#2606 (2.2.4)
- CI Mac tests switch to Python 3.8. (2.2.4)
- Windows CI switched from using Vcpkg to building its own dependencies.
#2663 (2.2.5)
- Testing of TGA now assumes the test images are in the oiio-images
project, not separately downloaded (the download location disappeared
from the net). #2512 (2.2.2)
- Beef up OpenEXR compliance tests, many more examples from
openexr-images, including many corrupted image failure cases. #2607
(2.2.4)
* Progress on support for using Conan for dependency installation. This is
experimental, it can't yet build all dependencies. Work in progress.
#2461 (2.2.1)
* The version of gif.h that we embed for GIF output has been updated.
#2466 (2.2.1)
* New non-default CMake build flag `EXTRA_WARNINGS`, when turned on, will
cause gcc and clang to compile with -Wextra. This identified many new
warnings (mostly about unused parameters) and fixes were applied in #2464,
#2465, #2471, #2475, #2476. (2.2.1)
* The `farmhash` functions have been cleaned up to be more careful that none
of their internal symbols are left visible to the linker. #2473 (2.2.1)
* Support for building against libraw 0.20. #2484 (2.2.1)
* Clarification about .so name versioning: In supported releases, .so
contains major.minor, but in master (where ABI is not guaranteed stable,
we name major.minor.patch). #2488 (2.2.1)
* FindOpenColorIO.cmake now correctly discerns the OCIO version. (2.2.1)
* FindOpenColorIO.cmake now sets up a true imported target. #2529 (2.2.2)
* Protect against certain compiler preprocessor errors for user programs
that include strutil.h but also inculde `fmt` on its own. #2498.
that include strutil.h but also include `fmt` on its own. #2498.
(2.1.12/2.2.2)
* FindOpenEXR.cmake has better detection of debug openexr libraries. #2505
(2.2.2/2.1.13)
* Additional cmake controls to customize required vs optional dependencies:
`REQUIRED_DEPS` (list of dependencies normally optional that should be
treated as required) and `OPTIONAL_DEPS` (list of dependencies normally
required that should be optional). The main use case is to force certain
optional deps to be required for your studio, to be sure that missing deps
are a full build break, and not a successful build that silently lacks
features you need. #2507 (2.2.2/2.1.13)
* Testing of TGA now assumes the test images are in the oiio-images project,
not separately downloaded (the download location disappered from the net).
#2512 (2.2.2)
* Fix exported cmake config file, it was not ensuring that the Imath headers
properly ended up in the config iclude path. #2515 (2.2.2/2.1.13)
* Ensure compatibility and clean builds with clang 10. #2518 (2.2.2/2.1.3)
* Build: All the `build_foo.bash` helper scripts now use `set -ex` to ensure
that if any individual commands in the script fails, the whole thing will
exit with a failure. #2520 (2.2.2/2.1.3)
* Build properly against OpenColorIO's current master (which is the
in-progress work on OCIO v2). #2530 (2.2.2)
* Fix static boost to not overlink on Windows. #2537 (2.2.2)
* Fix build breaks against TOT libtiff master, which had `#define` clashes
with our GPSTag enum values. #2539 (2.2.2)
* Our CI tests now have a "bleeding edge" matrix entry that tests against
the current TOT master build of libtiff, openexr (#2549), and pybind11
(#2556). (2.2.2)
* Fix compiler warnign about incorrect extra braces. #2554 (2.2.2)
* Fix compiler warning about incorrect extra braces. #2554 (2.2.2)
* All build-scripts bash scripts now use /usr/bin/env to find bash. #2558
(2.2.2)
* Retire TravisCI, now we rely on GitHub Actions CI. Nightly test added.
Start to use ASWF docker images for some tests. #2563 (2.2.2)
* Avoid possible link errors by fully hiding IBA functions taking IplImage
parameters, when no OpenCV headers are encountered. #2568 (2.2.2)
* Change all CMake references to PACKAGE_FOUND to Package_Found (or whatever
capitalization matches the actual package name). #2569 (2.2.2)
* In (obsolete) FindOpenImageIO.cmake, avoid CMake warnings by changing
the name `OPENIMAGEIO_FOUND` -> `OpenImageIO_FOUND`. #2578 (2.2.3)
* Moved headers that are not part of OIIO's supported public API, but that
still must be installed to be transitively included, do a "detail"
subdirectory. #2648 (2.2.4)
* Fix many Mingw compiler warnings. #2657 (2.1.19/2.2.5)
* Windows: Improve Strutil::get_rest_arguments() handling of long path
syntax (`"\\?\"` style). #2661 (2.1.19/2.2.6)
* Fix compilation error with armv7 + x86. #2660 (2.2.6)
Notable documentation changes:
* Many enhancements in the ImageBuf chapter. #2460 (2.1.11/2.2.0)
* The `LICENSE-THIRD-PARTY.md` file has been reorganized to be clearer,
grouping parts with identical licenses. #2469
grouping parts with identical licenses. #2469 (2.2.1) And renamed to
"THIRD-PARTY.md" to avoid confusing GitHub's reporting of the project's
license. (2.2.6)
* Many fixes to the new readthedocs documentation, especially fixes to
section cross-references and links.
* Improved INSTALL instructions. (2.2.2/2.1.13)
* Fix a variety of breaks on ReadTheDocs. #2581
* Improve the way we discuss optional modifiers.
* Document the PNG output controls for compression level. #2642 (2.2.4)
* Lots of spell check / typo fixes in docs and comments. #2678 (2.2.6)
* INSTALL.md: remove misleading old Windows build instructions. #2679 (2.2.6)
* New file .git-blame-ignore-revs lists the hashes of commits that only
performed bulk reformatting, so that they don't misattribute authorship
or modification date. Everybody do this in your local repo:
`git config blame.ignoreRevsFile .git-blame-ignore-revs`
#2683 (2.2.6)
Release 2.1.20 (1 Oct 2020) -- compared to 2.1.19
-------------------------------------------------
* Windows: make sure aligned_malloc and aligned_free are properly declared
as OIIO_API. #2701
* Support for libheif 1.8 and 1.9. #2685 #2724
* Fix crash in IBA::contrast_remap for very large images. #2704
* Bug fix in Strutil::splits and splitsv: when input is the empty string,
the split should return no pieces. #2712
Release 2.1.19 (1 Sep 2020) -- compared to 2.1.18
-------------------------------------------------
* DPX: Add support for reading DPX files from IOProxy (such as from a memory
buffer). #2659 #2665
* PNG: New output option "png:filter" allows control of the PNG filter
options. #2650
* Python: Fix binding of ImageSpec.erase_attribute. #2654
* Python: Fix missing ImageInput.read_image(). #2677
* Windows: Improve Strutil::get_rest_arguments() handling of long path
syntax (`"\\?\"` style). #2661
* MinGW: Fix a variety of compiler warnings on this platform. #2657
* Fix build on Elbrus 2000 architecture. #2671
Release 2.1.18 (1 Aug 2020) -- compared to 2.1.17
-------------------------------------------------
* Python `ImageBuf.write()` added a variety that takes an open ImageOutput.
This is the key to writing multi-subimage files from Python. #2640
* `oiiotool --eraseattrib` fixed: was not applying to all subimages. #2632
* RAW: Improve thread safety when more than one thread might be opening
different raw files at the same time. #2633
* unordered_map_concurrent fixed a missing size decrement upon erase(). #2624
* Fixes to support certain recent pybind11 changes. #2637
* Fixes to support OpenColorIO v2. #2636
* Fixes to support more recent fmtlib versions. #2639
* PNG: document the "png:compressionLevel" output hint. #2642
* In oiioversion.h, add a `OIIO_MAKE_VERSION` macro that constructs the
integer code for a particular major/minor/patch release. #2641
* 2.1.18.1: Fix version number which for 2.1.18.0 unfortunately still
said it was 2.1.17.
Release 2.1.17 (1 Jul 2020) -- compared to 2.1.16
-------------------------------------------------
* Build: Use the discovered python binary name, to address the Fedora
restriction that you must use "python2" or "python3" by name. #2598
* Docs: ImageBufAlgo::nonzero_region had been inadvertently left out of the
Python chapter.
* Improve RLA reader's ability to detect corrupt or non-RLA files, which
fixes crashes you could get from trying to read non-image files. #2600
* Support for building against Qt 5.15. (Note: Qt support is only needed
for the "iv" viewer.) #2605
* Fixes to support LibRaw 0.20 (which is currently in beta3). Note that this
will make it incompatible with 0.20 beta1 and beta2, due to a fixed typo
of a struct field in one of the LibRaw's headers. #2613
* oiioversion.h: fix typo that left the OIIO_VERSION_RELEASE_TYPE symbol
undefined. #2616
Release 2.1.16 (1 Jun 2020) -- compared to 2.1.15
-------------------------------------------------
* OpenEXR: Fix bug in the channel sorting order when channels are "X" and
"Y" (was reversing the order by confusing "Y" for "luminance"). #2595
* Python: Fixed a bug that lost certain string arguments, especially when
passing a TypeDesc as its string equivalent. #2587
* fmath: Very minor fix to OIIO::clamp(), shouldn't affect normal use with
floats at all, but fixed a subtle quasi-bug in OSL. #2594
* TypeDesc has additional helpers of constexpr values TypeFloat2,
TypeVector2, TypeVector4, TypeVector2i, TypePointer. #2592
* Build: The exported CMake config files now set cmake variable
`OpenImageIO_PLUGIN_SEARCH_PATH` #2584
* Docs: improvements and fixes to broken page rendering.
Release 2.1.15 (11 May 2020) -- compared to 2.1.14
--------------------------------------------------
* RAW input: set the "raw:flip" attribute if the underlying libraw did a
reorientation. #2572
* Movie files: Fix possible infinite loop in the FFMpeg-based reader. #2576
* Fixes to allow building against the forthcoming LibRaw 0.20 release. #2484
* Documentation fixes. #2581
Release 2.1.14 (1 May 2020) -- compared to 2.1.13
-------------------------------------------------
* JPEG & PNG: Fix loss of 'config' hints upon close and reopen that could
happen in cases where scanlines were accessed out of order. #2549
* TIFF: Fix subtle bug when reading certain Exif directories in the header.
#2540
* Added OCIO role accessors to the ColorConfig class. #2548
* Improve error messages when overscan textures are not possible. #2521
* Build: fix problems when compiling against current libtiff master (symbol
clash on GPSTAG values). #2539
* Build: Fix static boost to not overlink. #2537.
* Fix some problems with the docs. #2541
* `AttrDelegate::as_vec<>` returns the whole attribute as a std::vector.
#2528
* Add a build_libtiff.bash script to make it easy to build the libtiff
dependency. #2543
Release 2.1.13 (1 Apr 2020) -- compared to 2.1.12
-------------------------------------------------
@@ -260,7 +819,7 @@ Release 2.1.13 (1 Apr 2020) -- compared to 2.1.12
with vectors that have custom allocators. #2533
* Fix: ParamValueList `add_or_replace()` was failing to "replace" if the new
attribute had a different type than the existing one. #2527
* Fix: Fix resolution unit metadata that was not propery set in JPEG output.
* Fix: Fix resolution unit metadata that was not properly set in JPEG output.
#2516
* Build: Additional cmake controls to customize required vs optional
dependencies -- `REQUIRED_DEPS` (list of dependencies normally optional
@@ -270,7 +829,7 @@ Release 2.1.13 (1 Apr 2020) -- compared to 2.1.12
sure that missing deps are a full build break, and not a successful build
that silently lacks features you need. #2507
* Build: Fix exported config file, it was not ensuring that the Imath
headers properly ended up in the config iclude path. #2515
headers properly ended up in the config include path. #2515
* Build: Ensure compatibility and clean builds with clang 10. #2518
* Build: All the `build_foo.bash` helper scripts now use `set -ex` to ensure
that if any individual commands in the script fails, the whole thing will
@@ -303,7 +862,7 @@ Release 2.1.12 (2 Mar 2020) -- compared to 2.1.11
* Build: un-embed the 'fmt' headers, instead auto-download if not found.
#2439
* Build: Protect against certain compiler preprocessor errors for user
programs that include strutil.h but also inculde `fmt` on its own. #2498.
programs that include strutil.h but also include `fmt` on its own. #2498.
Release 2.1.11 (1 Feb 2020) -- compared to 2.1.10
-------------------------------------------------
@@ -331,7 +890,7 @@ Release 2.1.10.1 (10 Jan 2019)
* Fixes to unordered_map_concurrent.h that affect some users who it for
things other than OIIO per se (recent changes to the internals broke its
use for the default underlying std::unordered_map). #2454
* Bump the minimum pybind11 vesion that we auto-download, and also be sure
* Bump the minimum pybind11 version that we auto-download, and also be sure
to auto-download if pybind11 is found on the system already but is not an
adequately new version. #2453
* If libsquish is found on the system at build time, use it, rather than
@@ -402,7 +961,7 @@ Public API changes:
even though there is no such named metadata for OIIO (the results will
assembled from x, y, width, height, etc.). #2110 (2.1.0/2.0.4)
* "Compression" names (where applicable) can now have the quality appended
to the name (e.g., `"jpeg:85"`) insead of requiring quality to be passed
to the name (e.g., `"jpeg:85"`) instead of requiring quality to be passed
as a separate piece of metadata. #2111 (2.1.0/2.0.5)
* Python: define `__version__` for the module. #2096 (2.1.0/2.0.4)
* Python error reporting for `ImageOutput` and `ImageBuf.set_pixels`
@@ -471,7 +1030,7 @@ Fixes and feature enhancements:
interpreted literally, not evaluated as an expression). #2100 (2.1.0/2.0.4)
- `--dumpdata` has more intelligible output for uint8 images. #2124
(2.1.0/2.0.4)
- Fixed but that could prevent `-iconvert oiio:UnassociatedApha 1` from
- Fixed but that could prevent `-iconvert oiio:UnassociatedAlpha 1` from
correctly propagating to the input reader. #2172 (2.1.0/2.0.6)
- `-o:all=1` (which outputs all subimages to separate files) fixed a
crash that would occur if any of the subimages were 0x0 (it could
@@ -517,11 +1076,11 @@ Fixes and feature enhancements:
corresponding pixels had differing numbers of samples. #2381 (2.1.8)
* ImageBuf/ImageBufAlgo:
- `IBA::channel_append()` previously always forced its result to be float,
if it wasn't previously initialized. Now it uses the uaual type-merging
if it wasn't previously initialized. Now it uses the usual type-merging
logic, making the result the "widest" type of the inputs. #2095
(2.1.0/2.0.4)
- IBA `resize()`, `fit()`, and `resample()` are no longer restricted to
source and destination images having the same numer of channels.
source and destination images having the same number of channels.
#2125 (2.1.0/2.0.5)
- Improve numerical precision of the unpremult/premult part of certain
color transformations. #2164 (2.1.0)
@@ -595,7 +1154,7 @@ Fixes and feature enhancements:
#2364 (2.1.5) #2383 (2.1.8)
* Python bindings:
- Fix inability for Python to set timecode attributes (specifically, it
was trouble setting ImageSpec attributes that were unnsigned int
was trouble setting ImageSpec attributes that were unsigned int
arrays). #2279 (2.0.9/2.1.3)
* Improved performance for ustring creation and lookup. #2315 (2.1.3)
* BMP:
@@ -623,7 +1182,7 @@ Fixes and feature enhancements:
were treating as unsigned. #2178 (2.1.0)
* HDR/RGBE:
- Fix bugs related to files with very high resolution (mostly 32 bit
int overflow issues and care to use 64 bit fseeks). Also speed up
int overflow issues and care to use 64 bit fseek). Also speed up
reading and writing very large files. #2406 (2.1.8)
* IFF
- Detect and error requests to open files for writing with resolutions
@@ -758,9 +1317,9 @@ Build/test system improvements and platform ports:
* On non-Windows systems, the build now generates a PkgConfig file, installed
at `CMAKE_INSTALL_PREFIX/lib/pkgconfig/OpenImageIO.pc`. #2158 (2.0.5/2.1.0)
* A new unit test has been backported from master, which tries to perform a
series of read/write tests on every file format. In partcular, this tests
series of read/write tests on every file format. In particular, this tests
certain error conditions, like files not existing, or the directory not
being writeable, etc. #2181, #2189 (2.0.8/2.1.1)
being writable, etc. #2181, #2189 (2.0.8/2.1.1)
* Support for CI tests on CircleCI. #2194 (2.1.1) Retired in #2389 (2.1.8).
* New build-time flag `USE_WEBP=0` can be used to disable building WebP
format support even on platforms where webp libraries are found.
@@ -782,7 +1341,7 @@ Build/test system improvements and platform ports:
#2334 (2.1.4) #2356 (2.1.5) #2395 (2.1.8)
* Updated and improved finding of OpenEXR and `build_openexr.bash` script
that we use for CI. #2343 (2.1.4)
* Upgrade the pybind11 verson that we auto-install when not found (to 2.4.2),
* Upgrade the pybind11 version that we auto-install when not found (to 2.4.2),
and add logic to detect the presence of some pybind11 versions that are
known to be (buggily) incompatible with C++11. #2347 (2.1.5)
* Fix errors in very new MSVS versions where it identified a suspicious
@@ -810,7 +1369,7 @@ Developer goodies / internals:
- New header implements "attribute delegates." (Read header for details)
#2204 (2.1.1)
* dassert.h:
- Spruce up assrtion macros: more uniform wording, and use pretty
- Spruce up assertion macros: more uniform wording, and use pretty
function printing to show what function the failure was in. #2262
- The new preferred assertion macros are `OIIO_ASSERT` and `OIIO_DASSERT`.
The `OIIO_ASSERT` always tests and prints an error message if the test
@@ -827,11 +1386,11 @@ Developer goodies / internals:
* fmath.h:
- `safe_mod()` does integer modulus but protects against mod-by-zero
exceptions. #2121 (2.1.0/2.0.5)
- powwroundup/pow2rounddown have been renamed ceil2/floor2 to reflect
- pow2roundup/pow2rounddown have been renamed ceil2/floor2 to reflect
future C++20 standard. The old names still work, so it's a fully back
compatible change. #2199 (2.0.8/2.1.1)
- To match C++20 notation, use `rotl()` template innstead of separate
rotl32/rotl64 funnctions. #2299, #2309 (2.1.3)
rotl32/rotl64 functions. #2299, #2309 (2.1.3)
* platform.h:
- New `OIIO_RETURNS_NONNULL` macro implements an attribute that marks
a function that returns a pointer as guaranteeing that it's never
@@ -872,12 +1431,12 @@ Developer goodies / internals:
- Add `OIIO_CHECK_IMAGEBUF_STATUS()` test macro. #2394 (2.1.8)
* unordered_map_concurrent.h:
- Performance improvement by avoiding redundant hashing of keys, and
improving the speed and properties of the hash functionn. #2313, #2316
improving the speed and properties of the hash function. #2313, #2316
(2.1.3)
* ustring.h:
- Bug fix in `ustring::compare(string_view)`, in cases where the
string_view was longer than the ustring, but had the same character
sequennce up to the length of the ustring. #2283 (2.0.10/2.1.3)
sequence up to the length of the ustring. #2283 (2.0.10/2.1.3)
* Wide use of declaring methods `noexcept` when we want to promise that
they won't throw exceptions. #2156, #2243 (2.1.0, 2.1.2)
* Changed all (we think) internal string formatting that expects printf
@@ -944,7 +1503,7 @@ Release 2.0.10 (1 Aug, 2019) -- compared to 2.0.9
* `IBA::ociodisplay()` and `oiiotool --ociodisplay`: empty display or view
names imply using the default display or view. #2273
* Bug fix in `ustring::compare(string_view)`, in cases where the string_view
was longer than the ustring, but had the same character sequennce up to
was longer than the ustring, but had the same character sequence up to
the length of the ustring. #2283
* `oiiotool --stats`: Fixed bug where `-iconfig` hints were not being
applied to the file as it was opened to compute the stats. #2288
@@ -1009,7 +1568,7 @@ Release 2.0.8 (3 May, 2019) -- compared to 2.0.7
* Testing: A new unit test has been backported from master, which tries to
perform a series of read/write tests on every file format. In partcular,
this tests certain error conditions, like files not existing, or the
directory not being writeable, etc. #2181
directory not being writable, etc. #2181
* Crashes in the command line utilities now attempt to print a stack trace
to aid in debugging (but only if OIIO is built with Boost >= 1.65, because
it relies on the Boost stacktrace library). #2229
@@ -1754,7 +2313,7 @@ Developer goodies / internals:
#1904 (1.9.2)
Notable documentation changes:
* A new LICENSE-THIRD-PARTY.md file reproduces the full open source licenses
* A new THIRD-PARTY.md file reproduces the full open source licenses
of all code that we distribute with OIIO, incorporate, or derive code from.
They are have very similar license terms to the main OIIO license
("New BSD") -- MIT, Mozilla, Apache 2.0, or public domain. OIIO does not
+35 -248
View File
@@ -3,16 +3,22 @@
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
cmake_minimum_required (VERSION 3.12)
project (OpenImageIO VERSION 2.2.2.0
project (OpenImageIO VERSION 2.2.21.0
HOMEPAGE_URL "https://openimageio.org"
LANGUAGES CXX C)
set (PROJ_NAME OIIO) # short name, caps
string (TOLOWER ${PROJ_NAME} PROJ_NAME_LOWER) # short name lower case
string (TOUPPER ${PROJ_NAME} PROJ_NAME_UPPER) # short name upper case
set (PROJECT_VERSION_RELEASE_TYPE "dev") # "dev", "betaX", "RCY", ""
set (PROJECT_VERSION_RELEASE_TYPE "") # "dev", "betaX", "RCY", ""
set (${PROJECT_NAME}_VERSION_RELEASE_TYPE ${PROJECT_VERSION_RELEASE_TYPE})
set (PROJECT_AUTHORS "Contributors to the OpenImageIO project")
set (${PROJECT_NAME}_SUPPORTED_RELEASE 0) # Change to 1 after release branch
set (${PROJECT_NAME}_SUPPORTED_RELEASE 1) # Change to 1 after release branch
# Identify whether this is included as a subproject of something else
if (NOT "${CMAKE_PROJECT_NAME}" STREQUAL "${PROJECT_NAME}")
set (${PROJECT_NAME}_IS_SUBPROJECT ON)
message (STATUS "${PROJECT_NAME} is configuring as a CMake subproject")
endif ()
# If the user wants to use Conan to build dependencies, they will have done
# this prior to the cmake config:
@@ -25,9 +31,6 @@ if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
endif()
message (STATUS "Building ${PROJECT_NAME} ${PROJECT_VERSION}")
message (STATUS "CMake version is ${CMAKE_VERSION}")
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release")
endif ()
@@ -70,11 +73,9 @@ option (INSTALL_FONTS "If ON, install default fonts" ON)
option (INSTALL_CMAKE_HELPER "If On, install FindOpenImageIO.cmake" ON)
option (EMBEDPLUGINS "Embed format plugins in libOpenImageIO" ON)
set (PLUGIN_SEARCH_PATH "" CACHE STRING "Default plugin search path")
file (TO_NATIVE_PATH "${PLUGIN_SEARCH_PATH}" PLUGIN_SEARCH_PATH_NATIVE)
set (CMAKE_DEBUG_POSTFIX "" CACHE STRING "Library naming postfix for Debug builds (e.g., '_debug')")
set(OIIO_TESTSUITE_IMAGEDIR "${PROJECT_SOURCE_DIR}/.." CACHE PATH
"Location of oiio-images, openexr-images, libtiffpic, etc.." )
option (OIIO_THREAD_ALLOW_DCLP "OIIO threads may use DCLP for speed" ON)
if (NOT OIIO_THREAD_ALLOW_DCLP)
add_definitions ("-DOIIO_THREAD_ALLOW_DCLP=0")
@@ -103,23 +104,31 @@ list (APPEND CMAKE_MODULE_PATH
include (GNUInstallDirs)
# Utilities
include (colors)
include (check_is_enabled)
include (checked_find_package)
include (fancy_add_executable)
include (add_oiio_plugin)
# All the C++ and compiler related options and adjustments live here
# All the C++ and compiler related options and adjustments
include (compiler)
include (oiio_macros)
# All the dependency finding and options are here
include (externalpackages)
# Utilities related to finding python and making python bindings
# Utilities and options related to finding python and making python bindings
include (pythonutils)
# We want CTest for testing, so this must be added before all the calls to
# add_subdirectory, or their add_test commands will not register.
include (CTest)
# Dependency finding utilities and all dependency-related options
include (externalpackages)
# Include all our testing apparatus and utils, but not if it's a subproject
if (NOT ${PROJECT_NAME}_IS_SUBPROJECT)
include (testing)
else ()
macro (oiio_add_tests)
endmacro ()
macro (oiio_add_all_tests)
endmacro ()
endif ()
include_directories (
@@ -127,6 +136,7 @@ include_directories (
"${CMAKE_SOURCE_DIR}/src/include"
"${CMAKE_BINARY_DIR}/src/include"
"${CMAKE_BINARY_DIR}/include"
"${CMAKE_BINARY_DIR}/include/OpenImageIO"
)
# Tell CMake to process the sub-directories
@@ -182,7 +192,7 @@ if (NOT EMBEDPLUGINS AND NOT BUILD_OIIOUTIL_ONLY)
endforeach ()
endif ()
if (USE_PYTHON AND NOT BUILD_OIIOUTIL_ONLY)
if (USE_PYTHON AND Python_Development_FOUND AND NOT BUILD_OIIOUTIL_ONLY)
add_subdirectory (src/python)
endif ()
@@ -203,12 +213,12 @@ if (OIIO_SITE AND EXISTS "${PROJECT_SOURCE_DIR}/site/${OIIO_SITE}/cmake/sitecust
endif ()
# install pkgconfig file
IF ( NOT MSVC )
if (NOT MSVC)
configure_file(src/build-scripts/OpenImageIO.pc.in "${CMAKE_BINARY_DIR}/OpenImageIO.pc" @ONLY)
install (FILES "${CMAKE_BINARY_DIR}/OpenImageIO.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT developer)
ENDIF()
endif()
# Oddball: install the FindOpenImageIO.cmake file
install (FILES src/cmake/modules/FindOpenImageIO.cmake
@@ -255,232 +265,9 @@ install (EXPORT OIIO_EXPORTED_TARGETS
NAMESPACE ${PROJECT_NAME}::)
#########################################################################
# Testing
#
# Just call oiio_add_tests(testname...) for each test. Additional
# optional arguments include:
# FOUNDVAR specifies the name of a CMAKE variable; if not defined,
# the test will not be added for 'make test' (helpful
# for excluding tests for libraries not found).
# IMAGEDIR specifies a directory for test images, one level higher
# than where the oiio top level source lives -- a
# message will be printed if not found.
# URL URL where the test images can be found, will be
# incorporated into the error message if the test
# image directory is not found.
# LABEL If set to "broken", will designate the test as one
# that is known to be broken, so will only be run
# for "make testall", but not "make test".
#
oiio_add_all_tests()
# Make a build/platform/testsuite directory, and copy the master runtest.py
# there. The rest is up to the tests themselves.
file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/testsuite")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/testsuite/common"
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/testsuite")
add_custom_command (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/testsuite/runtest.py"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/testsuite/runtest.py"
"${CMAKE_CURRENT_BINARY_DIR}/testsuite/runtest.py"
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/testsuite/runtest.py")
add_custom_target ( CopyFiles ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/testsuite/runtest.py" )
# Basic tests that apply even to continuous integration tests:
# Tests that require oiio-images:
oiio_add_tests (gpsread
oiiotool oiiotool-attribs oiiotool-copy
oiiotool-readerror oiiotool-xform
oiiotool-fixnan ## maketx & oiiotool-maketx depend on this
maketx oiiotool-maketx
misnamed-file
missingcolor
dpx ico iff png pnm psd rla sgi targa-tgautils zfile
texture-interp-bicubic
texture-blurtube
texture-crop texture-cropover
texture-derivs texture-fill texture-filtersize
texture-flipt texture-gettexels texture-gray
texture-mip-nomip texture-mip-trilinear
texture-overscan texture-pointsample
texture-uint8
texture-width0blur
texture-fat texture-skinny texture-wrapfill
texture-missing texture-res texture-maxres
texture-udim texture-udim2
IMAGEDIR oiio-images
URL "Recent checkout of oiio-images"
)
# Tests that require openexr-images:
oiio_add_tests (oiiotool-deep
IMAGEDIR openexr-images
)
# Remaining freestanding tests:
oiio_add_tests (nonwhole-tiles
oiiotool-composite
oiiotool-pattern
oiiotool-subimage oiiotool-text
diff
dither dup-channels
jpeg-corrupt
null psd-colormodes
rational
)
# Travis + old libjpeg seems to not catch an error in this test, skip it
# for that case.
if (JPEG_TURBO_FOUND OR NOT DEFINED ENV{TRAVIS})
oiio_add_tests (jpeg-corrupt-header)
endif()
# Add tests that require the Python bindings if we built the Python
# bindings. This is mostly the test that are specifically about testing
# the Python bindings themselves, but also a handful of tests that are
# mainly about other things but happen to use Python in order to perform
# thee test.
# We also exclude these tests if this is a sanitizer build on Linux,
# because the Python interpreter itself won't be linked with the right asan
# libraries to run correctly.
if (USE_PYTHON AND NOT BUILD_OIIOUTIL_ONLY AND NOT SANITIZE_ON_LINUX)
oiio_add_tests (
python-typedesc python-paramlist
python-imagespec python-roi python-deep python-colorconfig
python-imageinput python-imageoutput
python-imagebuf python-imagebufalgo
IMAGEDIR oiio-images
)
if (NOT ${PROJECT_NAME}_IS_SUBPROJECT)
include (packaging)
endif ()
# Add tests that require OCIO
if (OPENCOLORIO_FOUND)
oiio_add_tests (oiiotool-color)
endif ()
# Advanced tests that are done by hand and for releases:
# FIXME -- at some point, try to fix these or provide new ref images
if (NOT DEFINED ENV{TRAVIS})
oiio_add_tests (
texture-half texture-uint16
texture-interp-bilinear
texture-interp-closest
texture-mip-onelevel
)
endif ()
if (NOT DEFINED ENV{TRAVIS} AND NOT DEFINED ENV{CIRCLECI} AND NOT DEFINED ENV{GITHUB_ACTIONS})
oiio_add_tests (texture-icwrite)
endif ()
# List testsuites which need special external reference images from the web
# here:
oiio_add_tests (bmp
IMAGEDIR bmpsuite
URL http://entropymine.com/jason/bmpsuite/bmpsuite.zip)
oiio_add_tests (tiff-suite tiff-depths tiff-misc
IMAGEDIR libtiffpic
URL http://www.simplesystems.org/libtiff/images.html)
oiio_add_tests (openexr-suite openexr-multires openexr-chroma openexr-v2 perchannel
IMAGEDIR openexr-images
URL http://www.openexr.com/downloads.html)
oiio_add_tests (gif
FOUNDVAR GIF_FOUND
IMAGEDIR oiio-images
URL "Recent checkout of oiio-images")
oiio_add_tests (jpeg2000
FOUNDVAR OPENJPEG_FOUND
IMAGEDIR j2kp4files_v1_5
URL http://www.itu.int/net/ITU-T/sigdb/speimage/ImageForm-s.aspx?val=10100803)
oiio_add_tests (raw
FOUNDVAR LIBRAW_FOUND
IMAGEDIR oiio-images/raw
URL "Recent checkout of oiio-images")
oiio_add_tests (fits
IMAGEDIR fits-images
URL http://www.cv.nrao.edu/fits/data/tests/)
oiio_add_tests (heif
FOUNDVAR Libheif_FOUND
URL https://github.com/nokiatech/heif/tree/gh-pages/content)
oiio_add_tests (webp
FOUNDVAR Webp_FOUND
IMAGEDIR oiio-images/webp
URL "Recent checkout of oiio-images")
oiio_add_tests (ptex
FOUNDVAR PTEX_FOUND)
oiio_add_tests (texture-field3d field3d
FOUNDVAR Field3D_FOUND)
oiio_add_tests (openvdb
FOUNDVAR OpenVDB_FOUND)
if (SPI_TESTS)
oiio_add_tests (oiiotool-spi
FOUNDVAR SPI_TESTS
IMAGEDIR spi-oiio-tests
URL "noplace -- it's SPI specific tests")
endif ()
#########################################################################
# Packaging
set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
# "Vendor" is only used in copyright notices, so we use the same thing that
# the rest of the copyright notices say.
set (CPACK_PACKAGE_VENDOR ${PROJECT_AUTHORS})
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenImageIO is an open source library for reading and writing image file formats, a nice format-agnostic image viewer, and other image-related classes and utilities.")
set (CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/src/doc/Description.txt")
set (CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
#SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_SOURCE_DIR}")
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/cpack")
file (COPY "${PROJECT_SOURCE_DIR}/LICENSE.md" DESTINATION "${CMAKE_BINARY_DIR}/cpack")
file (RENAME "${CMAKE_BINARY_DIR}/cpack/LICENSE.md" "${CMAKE_BINARY_DIR}/cpack/License.txt")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/cpack/License.txt")
file (COPY "${PROJECT_SOURCE_DIR}/README.md" DESTINATION "${CMAKE_BINARY_DIR}/cpack")
set (CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/cpack/README.md")
set (CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/src/doc/Welcome.txt")
#SET (CPACK_STRIP_FILES Do we need this?)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (CPACK_GENERATOR "TGZ;STGZ;RPM;DEB")
set (CPACK_SOURCE_GENERATOR "TGZ")
endif ()
if (APPLE)
set (CPACK_GENERATOR "TGZ;STGZ;PackageMaker")
set (CPACK_SOURCE_GENERATOR "TGZ")
endif ()
if (WIN32)
set (CPACK_GENERATOR "NSIS")
set(CPACK_PACKAGE_EXECUTABLES "iv" "iv - Image Viewer")
# set(CPACK_CREATE_DESCTOP_LINKS "iv" "iv - Image Viewer")
set(CPACK_NSIS_MODIFY_PATH ON)
include (InstallRequiredSystemLibraries)
endif ()
set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-source)
#set (CPACK_SOURCE_STRIP_FILES Do we need this?)
set (CPACK_SOURCE_IGNORE_FILES ".*~")
set (CPACK_COMPONENT_UNSPECIFIED_HIDDEN TRUE)
set (CPACK_COMPONENT_UNSPECIFIED_REQUIRED TRUE)
set (CPACK_COMPONENTS_ALL user developer documentation Unspecified)
set (CPACK_COMPONENT_USER_DISPLAY_NAME "Applications")
set (CPACK_COMPONENT_DEVELOPER_DISPLAY_NAME "Developer files")
set (CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
set (CPACK_COMPONENT_USER_DESCRIPTION
"Applications: oiotool, iv, iinfo, iconvert, idiff, igrep, maketx and libraries")
set (CPACK_COMPONENT_DEVELOPER_DESCRIPTION "Include files")
set (CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "OpenImageIO documentation")
set (CPACK_COMPONENT_DEVELOPER_DEPENDS user)
include (CPack)
+8 -10
View File
@@ -111,13 +111,11 @@ component that deserves extended discussion or debate among the wider OIIO
community, then it may be prudent to email oiio-dev pointing everybody to
the pull request URL and discussing any issues you think are important.
6. All pull requests automatically launch jobs on [TravisCI](https://travis-ci.org)
for Linux and MacOS and on [Appveyor](http://appveyor.com) for Windows.
This ensures that the build completes and that the tests suite runs
correctly, for a varity of platform, compiler, library, and flag combinations.
The status of the CI tests for your PR will be displayed on the GitHub PR
page. We will not accept PRs that don't build cleanly or pass the existing
testsuite.
6. All pull requests automatically launch CI jobs on GitHub Actions to
ensure that the build completes and that the tests suite runs correctly, for
a varity of platform, compiler, library, and flag combinations. The status
of the CI tests for your PR will be displayed on the GitHub PR page. We will
not accept PRs that don't build cleanly or pass the existing testsuite.
7. The reviewer will look over the code and critique on the "comments" area.
Reviewers may ask for changes, explain problems they found, congratulate the
@@ -145,7 +143,7 @@ and it will automatically reformat your code according to the configuration
file found in the `.clang-format` file at the root directory of the OIIO
source code checkout.
One of the TravisCI test matrix entries runs clang-format and fails if any
One of the CI test matrix entries runs clang-format and fails if any
diffs were generated (that is, if any of your code did not 100% conform to
the `.clang-format` formatting configuration). If it fails, clicking on that
test log will show you the diffs generated, so that you can easily correct
@@ -153,9 +151,9 @@ it on your end and update the PR with the formatting fixes.
If you don't have clang-format set up on your machine, and your patch is not
very long, you may find that it's more convenient to just submit it and hope
for the best, and if it doesn't pass the Travis test, look at the diffs in
for the best, and if it doesn't pass the CI test, look at the diffs in
the log and make the corrections by hand and then submit an update to the
patch (i.e. relying on Travis to run clang-format for you).
patch (i.e. relying on CI to run clang-format for you).
Because the basic formatting is automated by clang-format, we won't
enumerate the rules here.
+21
View File
@@ -13,6 +13,7 @@ lg@openimageio.org
* Alexander Murashko
* Alexandre Gauthier
* Alexis Oblet
* Alister Chowdhury
* Alexy Pawlow
* Aman Shah
* Ananth Garre
@@ -20,14 +21,19 @@ lg@openimageio.org
* Basileios Anastasatos
* Bastien Montagne
* Ben De Luca
* Biswapriyo Nath
* Blair Tennessy
* Blazej Floch
* Brad Smith
* Brecht Van Lommel
* Brent Davis
* Brian Hall
* Brice Gros
* Carl Rand
* Cassian Andrei
* Chad Dombrova
* Changlin Hsieh
* Chris Crosetto
* Chris Foster
* Chris Kulla
* Christoph Willing
@@ -42,15 +48,19 @@ lg@openimageio.org
* Deepak Gopinath
* Delai Felinto
* Dennis Schridde
* Dieter De Baets
* Dinko Galetik
* Dominik Bartkiewicz
* Duncan Chan
* Dustin Rodrigues
* Edgar Velazquez-Armendariz
* Eloi Du Bois
* Elvic Liang
* Fabien Castan
* Fabien Servant
* Frédéric Devernay
* Fredrik Averpil
* Gaurav Bansal
* Ghislain Antony Vaillant
* Gonzalo Garramuño
* Grégoire De Lillo
@@ -61,10 +71,13 @@ lg@openimageio.org
* Henri Fousse
* Harry Mallon
* Hugh Macdonald
* Imarz
* Irena Damsky
* Ismael Cortes
* Jan Hettenkofer
* Jep Hill
* Jeph Alapat
* Jens Lindgren
* Jeremy Rose
* Jeremy Selan
* Jim Hourihan
@@ -77,6 +90,7 @@ lg@openimageio.org
* Justina Mikonyte
* Kazuki Takahashi
* Kevin Brightwell
* Kimball Thurston
* Konrad Kleine
* Krzysztof Blicharski
* Larry Gritz (project leader)
@@ -87,6 +101,7 @@ lg@openimageio.org
* Lucille Caillaud
* Lukas Schrangl
* Lukasz Maliszewski
* Luke Emrose
* M Joonas Pihlaja
* Malcolm Humphreys
* Manuel Gamito
@@ -107,18 +122,22 @@ lg@openimageio.org
* Nandan Dubey
* Nathan Rusch
* Nicholas Yue
* Nick Black
* Nicolas Burtnyk
* Nixon Kwok
* Northon Patrick
* Nuno Cardoso
* Ott Tinn
* Pascal Lecocq
* Patrick Hodoul
* Patrick Piché
* Paul Molodowitch
* Pavel Karneliuk
* Pete Larabell
* Philip Nemec
* Pino Toscano
* Puneet Jain
* Radu Arjocu
* Ramon Montoya
* Ray Molenkamp
* Richard Shaw
@@ -137,6 +156,7 @@ lg@openimageio.org
* Shane Ambler
* Simon Boorer
* Solomon Boulos
* SRHMorris
* Stefan Bruens
* Stefan Stavrev
* Thiago Ize
@@ -154,3 +174,4 @@ lg@openimageio.org
* Xo Wang
* Yang Yang
* Yann Lanthony
* zomgrolf
+42 -108
View File
@@ -2,7 +2,7 @@ Installation instructions for OpenImageIO
=========================================
# Table of Contents
1. [OpenImageIO's Dependences](#dependencies)
1. [OpenImageIO's Dependencies](#dependencies)
2. [Installing binaries from package managers](#installingfrompackagemanagers)
3. [Building OIIO from source](#buildingfromsource)
@@ -14,48 +14,62 @@ NEW or CHANGED MINIMUM dependencies since the last major release are **bold**.
### Required dependencies -- OIIO will not build at all without these
* C++11 (also builds with C++14 and C++17)
* Compilers: gcc 4.8.2 - 9.2, clang 3.3 - 10.0, MSVS 2015 - 2019,
* C++11 (also builds with C++14, C++17, and C++20)
* Compilers: gcc 4.8.2 - 11.2, clang 3.3 - 13, MSVS 2015 - 2019,
icc version 13 or higher
* CMake >= 3.12 (tested up through 3.16)
* OpenEXR >= 2.0 (recommended: 2.2 or higher; tested through 2.4)
* libTIFF >= 3.9 (recommended: 4.0+; tested through 4.1.0)
* CMake >= 3.12 (tested through 3.21)
* OpenEXR/Imath >= 2.0 (recommended: 2.2 or higher; tested through 3.1)
* libTIFF >= 3.9 (recommended: 4.0+; tested through 4.3)
### Optional dependencies -- features may be disabled if not found
* If you are building the `iv` viewer (which will be disabled if any of
these are not found):
* Qt >= 5.6 (tested through 5.14)
* Qt >= 5.6 (tested through 5.15)
* OpenGL
* If you are building the Python bindings or running the testsuite:
* Python >= 2.7 (tested against 2.7, 3.6, 3.7)
* pybind11 >= 2.4.2 (Tested through 2.4.3.)
* Python >= 2.7 (tested against 2.7, 3.6, 3.7, 3.8, 3.9)
* pybind11 >= 2.4.2 (Tested through 2.8.)
* NumPy
* If you want support for camera "RAW" formats:
* libRaw >= 0.15 (tested 0.15 - 0.19; libRaw >= 0.18 is necessary for
ACES support and much better recognition of camera metadata)
* LibRaw >= 0.15 (tested 0.15 - 0.20; LibRaw >= 0.18 is necessary for
ACES support and much better recognition of camera metadata; if
building with C++17 or higher, LibRaw >= 0.20 is necessary)
* If you want support for a wide variety of video formats:
* ffmpeg >= 2.6 (tested through 4.2)
* ffmpeg >= 2.6 (tested through 5.0)
* If you want support for jpeg 2000 images:
* **OpenJpeg >= 2.0** (tested through 2.3)
* **OpenJpeg >= 2.0** (tested through 2.4)
* If you want support for Field3D files:
* Field3D
* Field3D (tested through 1.7.3)
* If you want support for OpenVDB files:
* OpenVDB >= 5.0 (tested through 7.0) and Intel TBB >= 2018 (tested
through 2020_U1)
* OpenVDB >= 5.0 (tested through 8.1) and Intel TBB >= 2018 (tested
through 2021)
* Note that OpenVDB 8.0+ requires C++14 or higher.
* If you want support for converting to and from OpenCV data structures,
or for capturing images from a camera:
* OpenCV 2.x, 3.x, or 4.x (tested through 4.2)
* OpenCV 2.x, 3.x, or 4.x (tested through 4.5)
* If you want support for GIF images:
* giflib >= 4.1 (tested through 5.2; 5.0+ is strongly recommended for
stability and thread safety)
* If you want support for HEIF/HEIC images:
* libheif >= 1.3 (tested through 1.6; older versions may also work, we
haven't tested)
* If you want support for DDS files:
* If you want support for HEIF/HEIC or AVIF images:
* libheif >= 1.3 (1.7 required for AVIF support, tested through 1.11)
* libheif must be built with an AV1 encoder/decoder for AVIF support.
* Avoid libheif 1.10 on Mac, it is very broken. Libheif 1.11 is fine.
* If you want support for DDS files:
* libsquish >= 1.13 (tested through 1.15)
* But... if not found on the system, an embedded version will be used.
* If you want support for DICOM medical image files:
* If you want support for DICOM medical image files:
* DCMTK >= 3.6.1 (tested through 3.6.5)
* If you want support for WebP images:
* WebP >= 0.6.1 (tested through 1.1.0)
* If you want support for OpenColorIO color transformations:
* OpenColorIO >= 1.1 (tested through 2.1)
* If you want support for Ptex:
* Ptex >= 2.3.1 (probably works for older; tested through 2.4.0)
* We use PugiXML for XML parsing. There is a version embedded in the OIIO
tree, but if you want to use an external, system-installed version (as
may be required by some software distrbutions with policies against
embedding other projects), then just build with `-DUSE_EXTERNAL_PUGIXML=1`.
Any PugiXML >= 1.8 should be fine (we have tested through 1.11).
@@ -78,9 +92,10 @@ If all you want to do is install the OIIO libraries, headers, and command
line tools as quickly as possible (don't need OIIO source or any custom
build options), maybe one of these packages managers will do it for you:
* vckpg (https://github.com/Microsoft/vcpkg)
* vcpkg (https://github.com/Microsoft/vcpkg)
* https://github.com/Microsoft/vcpkg/tree/master/ports/openimageio
* `.\vcpkg install openimageio [tools]`
* For a full list of supported build features: `.\vcpkg search openimageio`
* homebrew (https://github.com/Homebrew/brew)
* https://formulae.brew.sh/formula/openimageio
* `brew install openimageio`
@@ -211,7 +226,7 @@ Additionally, a few helpful modifiers alter some build-time options:
| make USE_PYTHON=0 ... | Don't build the Python binding |
| make BUILD_SHARED_LIBS=0 | Build static library instead of shared |
| make LINKSTATIC=1 ... | Link with static external libraries when possible |
| make SOVERSION=nn ... | Include the specifed major version number in the shared object metadata |
| make SOVERSION=nn ... | Include the specified major version number in the shared object metadata |
| make NAMESPACE=name | Wrap everything in another namespace |
The command 'make help' will list all possible options.
@@ -239,91 +254,10 @@ or, if you are using CMake directly,
Building on Windows
-------------------
**Method 1 - Default**
**Method 1 - from source**
1. Check out the trunk or a branch of your choice. The remainder of
these instructions assume that you checked out the trunk to the
D:\OIIO\trunk directory.
2. Download the package with precompiled external libraries from
http://www.openimageio.org/external.zip
Next, unpack it. The directory with downloaded code from the repository
and the directory with unpacked libraries should be siblings. For example,
```
D:
\OIIO
\trunk // this is my tree
\src // directory with src files for OIIO
\build // directory that is created by cmake
\external // this is extracted external package
\dist
\windows
\glew-1.5.1
\ilmbase-1.0.1
\jpeg-6b
\libpng-1.2.3
\openexr-1.6.1
\tbb-21_20080605oss
\zlib-1.2.3
\tiff-3.8.2
```
3. Download precompiled Qt4 binaries for Windows from here:
http://qt.windows.binaries.googlepages.com/index.html
Unpack it (it doesn't matter where). After unpacking, add the path to
the Qt bin directory to the PATH variable. For example, if you unpacked
this package to the D:\qt-win directory, you should add D:\qt-win\bin to
your PATH. It's important to add the Qt bin directory to PATH because
the FindQt4 module uses it to search for qmake applications.
4. Also, just to be safe, add QTDIR to the environment variables. It
should point to directory where you unpacked Qt.
5. Download precompiled BOOST 1.53 or newer libraries from
http://www.boostpro.com/download
Install it on your system. Choose two versions: Multithread Debug, DLL
and Multithread, DLL for Your Visual Studio version.
6. Download precompiled BOOST 1.53 or newer libraries from here (unfficial
mirror) or from here (unofficial mirror, registration required). Install
it on Your system. Choose two versions: Multithread Debug, DLL and
Multithread, DLL for Your Visual Studio version.
7. Install cmake. You can download precompiled binaries from here:
http://www.cmake.org/cmake/resources/software.html
After installing, run cmake-gui. Set the field that specifies the source
code location (for example, to D:\OIIO\trunk\src). Then set the field
that specifies where to build binaries to the directory you want to
build project for OIIO (for example, D:\OIIO\trunk\build).
8. Set the THIRD_PARTY_TOOLS_HOME environment variable to the directory
where are stored unpacked external libraries (for example,
D:\OIIO\external\dist\windows). You can add variables by clicking Add
entry button.
9. Hit the Configure button. Cmake should automatically find externals
libraries and prepare the environment for creating the OIIO project. If
the configuration process ends without errors go to next step. If not,
read the instructions from the end of this tutorial.
10. Hit the Generate button. Cmake will build Visual Studio a solution in
the build directory.
11. That's all. You can open the OpenImageIO solution and start developing
OIIO! Potential problems:
It may happen that cmake won't find zlib, png, tiff or jpeg
libraries. If so you have to set CMAKE_PREFIX_PATH to point to the
directory where the missing libraries are stored. For example, if cmake
can't find ZLIB, add to CMAKE_PREFIX_PATH the
D:\OIIO\external\dist\windows\zlib-1.2.3 directory. If it can't find
ZLIB and PNG, add
D:\OIIO\external\dist\windows\zlib-1.2.3;D:\OIIO\external\dist\windows\libpng-1.2.3.
I really need someone to write correct, modern docs about how to build
from source on Windows.
**Method 2 - Using vcpkg**
+2 -2
View File
@@ -32,7 +32,7 @@ endif
MY_MAKE_FLAGS ?=
MY_NINJA_FLAGS ?=
MY_CMAKE_FLAGS += -g3
MY_CMAKE_FLAGS ?=
BUILDSENTINEL ?= Makefile
NINJA ?= ninja
CMAKE ?= cmake
@@ -95,7 +95,7 @@ MY_CMAKE_FLAGS += -DPYLIB_INCLUDE_SONAME:BOOL=${PYLIB_INCLUDE_SONAME}
endif
ifneq (${USE_EXTERNAL_PUGIXML},)
MY_CMAKE_FLAGS += -DUSE_EXTERNAL_PUGIXML:BOOL=${USE_EXTERNAL_PUGIXML} -DPUGIXML_HOME=${PUGIXML_HOME}
MY_CMAKE_FLAGS += -DUSE_EXTERNAL_PUGIXML:BOOL=${USE_EXTERNAL_PUGIXML}
endif
ifneq (${OPENEXR_ROOT},)
+6 -8
View File
@@ -2,8 +2,7 @@ README for OpenImageIO
======================
[![License](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md)
[![Build Status](https://travis-ci.org/OpenImageIO/oiio.svg?branch=master)](https://travis-ci.org/OpenImageIO/oiio)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/a0l32ti7gcoergtf/branch/master?svg=true)](https://ci.appveyor.com/api/projects/status/a0l32ti7gcoergtf/branch/master)
[![CI](https://github.com/OpenImageIO/oiio/actions/workflows/ci.yml/badge.svg)](https://github.com/OpenImageIO/oiio/actions/workflows/ci.yml)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2694/badge)](https://bestpractices.coreinfrastructure.org/projects/2694)
@@ -19,7 +18,7 @@ OpenImageIO consists of:
* Simple but powerful ImageInput and ImageOutput APIs that provide
an abstraction for reading and writing image files of nearly any
format, without the calling application needing to know any of the
details of these file formats, and indeed without the calling
details of these file formats, and indeed without the calling
application needing to be aware of which formats are available.
* A library that manages subclasses of ImageInput and ImageOutput that
@@ -32,8 +31,8 @@ OpenImageIO consists of:
including TIFF, JPEG/JFIF, OpenEXR, PNG, HDR/RGBE, ICO, BMP, Targa,
JPEG-2000, RMan Zfile, FITS, DDS, Softimage PIC, PNM, DPX, Cineon,
IFF, Field3D, OpenVDB, Ptex, Photoshop PSD, Wavefront RLA, SGI, WebP,
GIF, DICOM, HEIC/HEIF, many "RAW" digital camera formats, and a variety of
movie formats (readable as individual frames). More are being developed
GIF, DICOM, HEIF/HEIC/AVIF, many "RAW" digital camera formats, and a variety
of movie formats (readable as individual frames). More are being developed
all the time.
* Several command line image tools based on these classes, including
@@ -83,7 +82,7 @@ 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
[LICENSE-THIRD-PARTY](LICENSE-THIRD-PARTY.md) file for details.
[THIRD-PARTY](THIRD-PARTY.md) file for details.
Building and Installation
@@ -113,7 +112,7 @@ Simple "how do I...", "I'm having trouble", or "is this a bug" questions are
best asked on the [oiio-dev developer mail
list](http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org).
That's where the most people will see it and potentially be able to answer
your question quickly (moreso than a GH "issue").
your question quickly (more so than a GH "issue").
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
@@ -146,4 +145,3 @@ Mail list subscriptions and archives:
* Developer mail list: http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
* Just release announcements: http://lists.openimageio.org/listinfo.cgi/oiio-announce-openimageio.org
+8 -5
View File
@@ -21,12 +21,19 @@ SPDX-License-Identifier: BSD-3-Clause
OIIO, but since some elements are derived from that, we still acknowledge
the original copyright here.
* Open Shading Language. Copyright Sony Pictures Imageworks Inc.
* Open Shading Language. Copyright contributors to the OSL project.
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
A few parts here and there, notably parts of fmath.h and many of the CMake
files, contain code that was originally developed for Open Shading
Language but subsequently moved to OIIO.
* OpenColorIO (c) Copyright contributors to the OpenColorIO Project.
https://github.com/AcademySoftwareFoundation/OpenColorIO
The sample OpenColorIO configurations in our testsuite are borrowed from
this ASWF project, also BSD-3-Clause licensed.
* DPX reader/writer (c) Copyright 2009 Patrick A. Palmer.
https://github.com/patrickpalmer/dpx
@@ -183,10 +190,6 @@ SPDX-License-Identifier: BSL-1.0
Copyright Naoki Shibata and contributors 2010 - 2017.
https://github.com/shibatch/sleef/blob/master/LICENSE.txt
* tinyformat.h http://github.com/c42f/tinyformat
Copyright (C) 2011, Chris Foster.
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
-112
View File
@@ -1,112 +0,0 @@
version: '{branch}-{build}'
image: Previous Visual Studio 2015
clone_folder: C:\projects\oiio
test: off
configuration:
- Release
# - Debug
platform:
- x64
# branches:
# only:
# - master
environment:
matrix:
- CMAKE_PLATFORM: "Visual Studio 14 2015 Win64"
PYTHON_DIR: "C:\\Python27-x64"
tbs_arch: "x64"
tbs_tools: "msvc14"
tbs_static_runtime: 0
cache:
- C:\tools\vcpkg\installed
#- C:\tools\vcpkg -> appveyor.yml
#- C:\projects\ext -> appveyor.yml
# The -> means that the cache dir is discarded if appveyor.yml has changed
install:
- ps: $OIIO_INSTALL_BEGIN=Get-Date
- cinstall: python
- git submodule update --init --recursive
- set CMAKE_PREFIX_PATH=C:/Sys;%APPVEYOR_BUILD_FOLDER%/ext;c:/tools/vcpkg/installed/%platform%-windows
- set CMAKE_LIBRARY_PATH=C:/Sys/lib;%APPVEYOR_BUILD_FOLDER%/ext/lib
- set CMAKE_INCLUDE_PATH=C:/Sys/include;%APPVEYOR_BUILD_FOLDER%/ext/include
- mkdir c:\sys
- mkdir ext
- cd ext
- mkdir lib
- mkdir include
# Boost
# 1.63 is already installed on appveyor, just use it
- set BOOST_ROOT=C:\Libraries\boost_1_66_0
- set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%BOOST_ROOT%
# Install a bunch of vcpkg dependencies. We rely on the run-to-run caching
# of these, but if the cache is flushed, it takes too long to rebuild them
# all, so we stage it.
- vcpkg list
- vcpkg update
# - vcpkg help triplet
# Dependencies that don't take too long, just build them unconditionally.
- vcpkg install zlib:"%platform%"-windows
- vcpkg install tiff:"%platform%"-windows
- vcpkg install libpng:"%platform%"-windows
- vcpkg install openexr:"%platform%"-windows
- vcpkg install freetype:"%platform%"-windows
- vcpkg install giflib:"%platform%"-windows
- vcpkg install libwebp:"%platform%"-windows
- vcpkg install openjpeg:"%platform%"-windows
- vcpkg install ptex:"%platform%"-windows
- vcpkg install libraw:x64-windows
# Qt
- set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;C:\Qt\5.12
# Expensive optional deps only build if there's plenty of time left.
# If we run out the clock, the cache won't be saved.
# - ps: |
# $OIIO_BUILD_NOW=Get-Date
# if (($OIIO_BUILD_NOW-$OIIO_INSTALL_BEGIN).TotalMinutes -gt 15) {
# Add-AppveyorMessage -Message "OIIO low on time, skippping dependency qt5-base"
# } else {
# vcpkg install qt5-base:x64-windows
# }
# Wish list:
# OpenCV
# ffmpeg
# OpenColorIO
- cd ..
- dir C:\Sys
# - dir C:\Sys\include
# - dir C:\Sys\lib
- vcpkg list
- dir c:\tools\vcpkg
- dir c:\tools\vcpkg\installed\x64-windows
- dir C:\projects\oiio\ext
- dir C:\projects\oiio\ext\include
- dir C:\projects\oiio\ext\lib
build_script:
- echo Running cmake...
- cd c:\projects\oiio
- mkdir build
- mkdir build\windows64
- cd build\windows64
- cmake -G "%CMAKE_PLATFORM%" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_INSTALL_PREFIX=C:\projects\oiio\dist\windows64 \
-DPYTHON_INCLUDE_DIR:PATH=%PYTHON_DIR%/include -DPYTHON_LIBRARY:FILEPATH=%PYTHON_DIR%/libs/python27.lib -DPYTHON_EXECUTABLE:FILEPATH=%PYTHON_DIR%/python.exe -DCMAKE_LIBRARY_PATH=%CMAKE_LIBRARY_PATH% -DCMAKE_INCLUDE_PATH=%CMAKE_INCLUDE_PATH% -DCMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH% -DOPENEXR_ROOT_DIR=C:\projects\oiio\ext -DVERBOSE=1 -DBUILD_MISSING_DEPS=1 ../..
- dir c:\projects\oiio
- dir c:\projects\oiio\build
- dir c:\projects\oiio\build\windows64
- cmake --build . --config %CONFIGURATION% --target install
- dir c:\projects\oiio\dist\windows64
matrix:
fast_finish: true
+30 -18
View File
@@ -60,9 +60,11 @@ ifeq (${SP_OS}, rhel7)
ifeq (${SPI_COMPILER_PLATFORM},gcc-4.8)
SPCOMP2_COMPILER ?= gcc48m64
CMAKE_CXX_STANDARD ?= 11
LLVM_VERSION ?= 9.0.1-1
else
SPCOMP2_COMPILER ?= gcc63
CMAKE_CXX_STANDARD ?= 14
LLVM_VERSION ?= 10.0.0-1
endif
SP_PLATFORM ?= linux
SP_PROC ?= x86_64
@@ -79,7 +81,6 @@ else
$(error Unknown SP_OS=${SP_OS} platform=${platform})
endif # endif ${SP_OS}
PYTHON_VERSION ?= 2.7
MY_CMAKE_FLAGS += -DSP_OS=${SP_OS} -DSP_PLATFORM=${SP_PLATFORM}
MY_CMAKE_FLAGS += -DSP_PROC=${SP_PROC} -DSP_REZ_OS=${SP_REZ_OS}
MY_CMAKE_FLAGS += -DSPI_COMPILER_PLATFORM=${SPI_COMPILER_PLATFORM}
@@ -92,6 +93,7 @@ SPCOMP2_ROOT ?= /shots/spi/home/lib/SpComp2
## Rhel7 (current)
ifeq (${SP_OS}, rhel7)
PYTHON_VERSION ?= 2.7
USE_SIMD ?= sse4.1,aes
CMAKE ?= cmake
USE_NINJA ?= 1
@@ -115,7 +117,6 @@ ifeq (${SP_OS}, rhel7)
#
# A variety of tags can be used to try specific versions of gcc or
# clang from the site-specific places we have installed them.
LLVM_VERSION ?= 10.0.0
LLVM_DIRECTORY ?= /shots/spi/home/software/packages/llvm/${LLVM_VERSION}/${SPI_COMPILER_PLATFORM}
ifeq (${COMPILER},clang7)
LLVM_DIRECTORY := /shots/spi/home/lib/arnold/rhel7/llvm_7.0.1
@@ -129,6 +130,9 @@ ifeq (${SP_OS}, rhel7)
else ifeq (${COMPILER},clang10)
LLVM_DIRECTORY := /shots/spi/home/software/packages/llvm/10.0.0-1/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
else ifeq (${COMPILER},clang11)
LLVM_DIRECTORY := /shots/spi/home/software/packages/llvm/11.0.0/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=${LLVM_DIRECTORY}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_DIRECTORY}/bin/clang++
else ifeq (${COMPILER},clang)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
else ifeq (${COMPILER}, gcc6)
@@ -241,15 +245,17 @@ ifeq (${SP_OS}, rhel7)
ifeq (${OIIO_SPCOMP2},1)
OCIO_SPCOMP_VERSION ?= 2
OpenColorIO_ROOT ?= ${SPCOMP2_ROOT}/OpenColorIO/${SP_OS}-${SPCOMP2_COMPILER}/v${OCIO_SPCOMP_VERSION}
OPENVDB_SPCOMP2_VERSION ?= v6020001
OpenVDB_ROOT ?= ${SPCOMP2_ROOT}/openvdb/${SPCOMP2_FULLBOOST_SUFFIX}/${OPENVDB_SPCOMP2_VERSION}
# OPENVDB_SPCOMP2_VERSION ?= v6020001
# OpenVDB_ROOT ?= ${SPCOMP2_ROOT}/openvdb/${SPCOMP2_FULLBOOST_SUFFIX}/${OPENVDB_SPCOMP2_VERSION}
OPENVDB_VERSION ?= 6.2.2-3
OpenVDB_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenVDB/${OPENVDB_VERSION}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}/boost-${BOOSTVERS}
else
OPENCOLORIO_VERSION ?= 1.1.1-1
OpenColorIO_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenColorIO/${OPENCOLORIO_VERSION}/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DOPENCOLORIO_LIBRARY=${OpenColorIO_ROOT}/lib/libOpenColorIO_SPI.so
# Anybody remember why we needed Field3d disabled for SpComp2?
Field3D_ROOT ?= ${SPCOMP2_ROOT}/Field3D/${SPCOMP2_FULLBOOST_SUFFIX}/v412
OPENVDB_VERSION ?= 6.2.2-1
OPENVDB_VERSION ?= 6.2.2-3
OpenVDB_ROOT ?= ${REZ_PACKAGE_ROOT}/OpenVDB/${OPENVDB_VERSION}/${SPI_COMPILER_PLATFORM}/python-${PYTHON_VERSION}/boost-${BOOSTVERS}
endif
TBB_ROOT ?= /net/apps/rhel7/intel/tbb
@@ -261,11 +267,12 @@ ifeq (${SP_OS}, rhel7)
-DOpenVDB_ROOT=${OpenVDB_ROOT} \
-DTBB_ROOT=${TBB_ROOT} \
-DTBB_LIBRARY=${TBB_LIBRARY} \
-DTBB_USE_DEBUG_BUILD=0 \
-DHDF5_CUSTOM=1 \
-DHDF5_LIBRARIES=/usr/lib64/libhdf5.so \
-DNuke_ROOT=/net/apps/rhel7/foundry/nuke${NUKE_VERSION} \
-DLibheif_ROOT=${Libheif_ROOT} \
-DFFMPEG_INCLUDE_DIR=/usr/include/ffmpegroot/ffmpeg34 \
-DFFMPEG_INCLUDES=/usr/include/ffmpegroot/ffmpeg34 \
-DFFMPEG_LIBRARIES="/usr/lib64/ffmpegroot/ffmpeg345/libavcodec.so;/usr/lib64/ffmpegroot/ffmpeg345/libavformat.so;/usr/lib64/ffmpegroot/ffmpeg345/libavutil.so;/usr/lib64/ffmpegroot/ffmpeg345/libswscale.so;" \
-DUSE_OPENCV=0 \
-DVISIBILITY_MAP_FILE:STRING="${working_dir}/site/spi/hidesymbols.map"
@@ -276,7 +283,7 @@ ifeq (${SP_OS}, rhel7)
MY_CMAKE_FLAGS += -DLIBRAW_LIBDIR_HINT=/usr/lib64/libraw-0.18.11
LIBRAW_LIBDIR = /usr/lib64/libraw-0.18.11
else
LibRaw_ROOT ?= /shots/spi/home/software/packages/LibRaw/0.20.0-dev1/${SPI_COMPILER_PLATFORM}
LibRaw_ROOT ?= /shots/spi/home/software/packages/LibRaw/0.20.0-dev3/${SPI_COMPILER_PLATFORM}
MY_CMAKE_FLAGS += -DLibRaw_ROOT=${LibRaw_ROOT}
LIBRAW_LIBDIR = ${LibRaw_ROOT}/lib
endif
@@ -314,21 +321,26 @@ else ifeq (${platform}, macosx)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER},clang6)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm@6/6.0.1_2/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm@6/6.0.1_1/bin/clang++
else ifeq (${COMPILER}, gcc9)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-9 -DCMAKE_CXX_COMPILER=g++-9
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER}, gcc10)
MY_CMAKE_FLAGS += \
-DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
USE_LIBCPLUSPLUS := 0
else ifeq (${COMPILER},clang7)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm@7/7.1.0_1/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm@7/7.1.0_1/bin/clang++
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@7/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/llvm@7/bin/clang++
else ifeq (${COMPILER},clang8)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm@8/8.0.1_1/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm@8/8.0.1_1/bin/clang++
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@8/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@8/bin/clang++
else ifeq (${COMPILER},clang9)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm@9/9.0.1/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm@9/9.0.1/bin/clang++
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm@9/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm@9/bin/clang++
else ifeq (${COMPILER},clang10)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm/10.0.0/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm/10.0.0/bin/clang++
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++
else ifeq (${COMPILER},clang)
MY_CMAKE_FLAGS += -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
else ifeq (${COMPILER},gcc)
-30
View File
@@ -1,30 +0,0 @@
Build for Rez
-------------
Use the internal 'oiio-feedstock' repo and just do a `rez build` or `rez
release`, per the README instructions in that repository.
SpComp2 build and release
-------------------------
If you are trying to do a legacy SpComp2 release:
First, to make a TEST build and release to your local spcomp2 mock-up
in /net/soft_scratch/users/$USER, use this alternate target:
make OIIO_SPCOMP2=1 spcomp2_install_local
When you are ready for the real thing, you will want to build each of the
following variants:
# Python 2.7, Boost 1.55, C++11/gcc4.8 compat
make nuke
make OIIO_SPCOMP2=1 BOOSTVERS=1.55 OPENEXR_VERSION=2.2.0 SPI_COMPILER_PLATFORM=gcc-4.8 spcomp2_install
# Python 2.7, Boost 1.70, C++11/gcc6.3 compat
make nuke
make OIIO_SPCOMP2=1 BOOSTVERS=1.70 PYTHON_VERSION=2.7 OPENEXR_VERSION=2.4.0 SPI_COMPILER_PLATFORM=gcc-6.3 spcomp2_install
Nobody should do this but lg, except in extraordinary circumstances.
+34 -15
View File
@@ -1,8 +1,16 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#include <cstdio>
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imageio.h>
#include "bmp_pvt.h"
OIIO_PLUGIN_NAMESPACE_BEGIN
namespace bmp_pvt {
@@ -87,7 +95,8 @@ DibInformationHeader::read_header(FILE* fd)
if (!fread(fd, &size))
return false;
if (size == WINDOWS_V3 || size == WINDOWS_V4 || size == WINDOWS_V5) {
if (size == WINDOWS_V3 || size == WINDOWS_V4 || size == WINDOWS_V5
|| size == UNDOCHEADER52 || size == UNDOCHEADER56) {
if (!fread(fd, &width) || !fread(fd, &height) || !fread(fd, &cplanes)
|| !fread(fd, &bpp) || !fread(fd, &compression)
|| !fread(fd, &isize) || !fread(fd, &hres) || !fread(fd, &vres)
@@ -95,16 +104,24 @@ DibInformationHeader::read_header(FILE* fd)
return false;
}
if (size == WINDOWS_V4 || size == WINDOWS_V5 || size == UNDOCHEADER52
|| size == UNDOCHEADER56) {
if (!fread(fd, &red_mask) || !fread(fd, &green_mask)
|| !fread(fd, &blue_mask)) {
return false;
}
if (size != UNDOCHEADER52 && !fread(fd, &alpha_mask)) {
return false;
}
}
if (size == WINDOWS_V4 || size == WINDOWS_V5) {
if (!fread(fd, &red_mask) || !fread(fd, &blue_mask)
|| !fread(fd, &green_mask) || !fread(fd, &alpha_mask)
|| !fread(fd, &cs_type) || !fread(fd, &red_x)
|| !fread(fd, &red_y) || !fread(fd, &red_z)
|| !fread(fd, &green_x) || !fread(fd, &green_y)
|| !fread(fd, &green_z) || !fread(fd, &blue_x)
|| !fread(fd, &blue_y) || !fread(fd, &blue_z)
|| !fread(fd, &gamma_x) || !fread(fd, &gamma_y)
|| !fread(fd, &gamma_z)) {
if (!fread(fd, &cs_type) || !fread(fd, &red_x) || !fread(fd, &red_y)
|| !fread(fd, &red_z) || !fread(fd, &green_x)
|| !fread(fd, &green_y) || !fread(fd, &green_z)
|| !fread(fd, &blue_x) || !fread(fd, &blue_y)
|| !fread(fd, &blue_z) || !fread(fd, &gamma_x)
|| !fread(fd, &gamma_y) || !fread(fd, &gamma_z)) {
return false;
}
}
@@ -116,14 +133,16 @@ DibInformationHeader::read_header(FILE* fd)
}
}
} else if (size == OS2_V1) {
// some of theses fields are smaller then in WINDOWS_Vx headers,
// so we use hardcoded counts
width = 0;
height = 0;
if (!fread(fd, &width, 2) || !fread(fd, &height, 2)
// some of theses fields are smaller than in WINDOWS_Vx headers,
// so we read into 16 bit ints and copy.
uint16_t width16 = 0;
uint16_t height16 = 0;
if (!fread(fd, &width16) || !fread(fd, &height16)
|| !fread(fd, &cplanes) || !fread(fd, &bpp)) {
return false;
}
width = width16;
height = height16;
}
if (bigendian())
swap_endian();
+32 -97
View File
@@ -4,25 +4,26 @@
#pragma once
#include <cstdio>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imageio.h>
OIIO_PLUGIN_NAMESPACE_BEGIN
// Docs reminders:
// https://en.wikipedia.org/wiki/BMP_file_format
// https://web.archive.org/web/20150127132443/https://forums.adobe.com/message/3272950
namespace bmp_pvt {
// size of the BMP file header (the first header that occur in BMP file)
const int BMP_HEADER_SIZE = 14;
// sizes of various DIB haders
const int OS2_V1 = 12;
const int WINDOWS_V3 = 40;
const int WINDOWS_V4 = 108;
const int WINDOWS_V5 = 124;
const int OS2_V1 = 12;
const int WINDOWS_V3 = 40;
const int UNDOCHEADER52 = 52; // 0x34
const int UNDOCHEADER56 = 56; // 0x38
const int WINDOWS_V4 = 108;
const int WINDOWS_V5 = 124;
// bmp magic numbers
const int16_t MAGIC_BM = 0x4D42;
@@ -31,7 +32,11 @@ const int16_t MAGIC_CI = 0x4943;
const int16_t MAGIC_CP = 0x5043;
const int16_t MAGIC_PT = 0x5450;
//const int32_t RLE4_COMPRESSION = 2;
const int32_t NO_COMPRESSION = 0; // BI_RGB
const int32_t RLE8_COMPRESSION = 1; // BI_RLE8
const int32_t RLE4_COMPRESSION = 2; // BI_RLE4
// store informations about BMP file
class BmpFileHeader {
@@ -49,7 +54,7 @@ public:
int32_t fsize; // size of the BMP file
int16_t res1; // reserved
int16_t res2; // reserved
int32_t offset; //offset of image data
int32_t offset; // offset of image data (pixels)
private:
void swap_endian(void);
};
@@ -63,19 +68,21 @@ public:
// writes informations about bitmap
bool write_header(FILE* fd);
int32_t size; // size of the header
int32_t width; // bitmap width in pixels
int32_t height; // bitmap height in pixels
int16_t cplanes; // number of color planes - always 1
int16_t bpp; // number of bits per pixel, image color depth
int32_t compression; // compression used in file
int32_t isize; // size of the raw image data
int32_t hres; // horizontal resolution in pixels per meter
int32_t vres; // vertical resolutions in pixels per meter
int32_t cpalete; // number of entries in the color palete
int32_t important; // number of importatn color used,
// 0 - all colors are important,
// in most cases ignored
int32_t size; // size of the header
int32_t width; // bitmap width in pixels
int32_t height; // bitmap height in pixels
int16_t cplanes; // number of color planes - always 1
int16_t bpp; // number of bits per pixel, image color depth
// Added after Version 1 of the format
int32_t compression = 0; // compression used in file
int32_t isize = 0; // size of the raw image data
int32_t hres = 0; // horizontal resolution in pixels per meter
int32_t vres = 0; // vertical resolutions in pixels per meter
int32_t cpalete = 0; // number of entries in the color palette
int32_t important = 0; // number of important color used,
// 0 - all colors are important,
// in most cases ignored
// added in Version 4 of the format
int32_t red_mask;
@@ -117,76 +124,4 @@ struct color_table {
class BmpInput final : public ImageInput {
public:
BmpInput() { init(); }
virtual ~BmpInput() { close(); }
virtual const char* format_name(void) const override { return "bmp"; }
virtual bool valid_file(const std::string& filename) const override;
virtual bool open(const std::string& name, ImageSpec& spec) override;
virtual bool close(void) override;
virtual bool read_native_scanline(int subimage, int miplevel, int y, int z,
void* data) override;
private:
int64_t m_padded_scanline_size;
int m_pad_size;
FILE* m_fd;
bmp_pvt::BmpFileHeader m_bmp_header;
bmp_pvt::DibInformationHeader m_dib_header;
std::string m_filename;
std::vector<bmp_pvt::color_table> m_colortable;
int64_t m_image_start;
void init(void)
{
m_padded_scanline_size = 0;
m_pad_size = 0;
m_fd = NULL;
m_filename.clear();
m_colortable.clear();
}
bool read_color_table(void);
};
class BmpOutput final : public ImageOutput {
public:
BmpOutput() { init(); }
virtual ~BmpOutput() { close(); }
virtual const char* format_name(void) const override { return "bmp"; }
virtual int supports(string_view feature) const override;
virtual bool open(const std::string& name, const ImageSpec& spec,
OpenMode mode) override;
virtual bool close(void) override;
virtual bool write_scanline(int y, int z, TypeDesc format, const void* data,
stride_t xstride) override;
virtual bool write_tile(int x, int y, int z, TypeDesc format,
const void* data, stride_t xstride,
stride_t ystride, stride_t zstride) override;
private:
int64_t m_padded_scanline_size;
FILE* m_fd;
std::string m_filename;
bmp_pvt::BmpFileHeader m_bmp_header;
bmp_pvt::DibInformationHeader m_dib_header;
int64_t m_image_start;
unsigned int m_dither;
std::vector<unsigned char> m_tilebuffer;
void init(void)
{
m_padded_scanline_size = 0;
m_fd = NULL;
m_filename.clear();
}
void create_and_write_file_header(void);
void create_and_write_bitmap_header(void);
};
OIIO_PLUGIN_NAMESPACE_END
+271 -41
View File
@@ -1,12 +1,69 @@
// Copyright 2008-present Contributors to the OpenImageIO project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#include <cstdio>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/imageio.h>
#include "bmp_pvt.h"
OIIO_PLUGIN_NAMESPACE_BEGIN
using namespace bmp_pvt;
class BmpInput final : public ImageInput {
public:
BmpInput() { init(); }
virtual ~BmpInput() { close(); }
virtual const char* format_name(void) const override { return "bmp"; }
virtual bool valid_file(const std::string& filename) const override;
virtual bool open(const std::string& name, ImageSpec& newspec) override;
virtual bool open(const std::string& name, ImageSpec& newspec,
const ImageSpec& config) override;
virtual bool close(void) override;
virtual bool read_native_scanline(int subimage, int miplevel, int y, int z,
void* data) override;
private:
int64_t m_padded_scanline_size;
int m_pad_size;
FILE* m_fd;
bmp_pvt::BmpFileHeader m_bmp_header;
bmp_pvt::DibInformationHeader m_dib_header;
std::string m_filename;
std::vector<bmp_pvt::color_table> m_colortable;
std::vector<unsigned char> fscanline; // temp space: read from file
std::vector<unsigned char> m_uncompressed; // uncompressed palette image
bool m_allgray;
void init(void)
{
m_padded_scanline_size = 0;
m_pad_size = 0;
m_fd = NULL;
m_filename.clear();
m_colortable.clear();
m_allgray = false;
fscanline.shrink_to_fit();
m_uncompressed.shrink_to_fit();
}
bool read_color_table();
bool color_table_is_all_gray();
bool read_rle_image();
// Safe, clamped access to color table
const bmp_pvt::color_table& colortable(int i)
{
return m_colortable[clamp(i, 0, int(m_colortable.size() - 1))];
}
};
// Obligatory material to make this a recognizeable imageio plugin
OIIO_PLUGIN_EXPORTS_BEGIN
@@ -24,7 +81,7 @@ bmp_input_imageio_create()
return new BmpInput;
}
OIIO_EXPORT const char* bmp_input_extensions[] = { "bmp", nullptr };
OIIO_EXPORT const char* bmp_input_extensions[] = { "bmp", "dib", nullptr };
OIIO_PLUGIN_EXPORTS_END
@@ -44,11 +101,28 @@ BmpInput::valid_file(const std::string& filename) const
bool
BmpInput::open(const std::string& name, ImageSpec& spec)
BmpInput::open(const std::string& name, ImageSpec& newspec)
{
ImageSpec emptyconfig;
return open(name, newspec, emptyconfig);
}
bool
BmpInput::open(const std::string& name, ImageSpec& newspec,
const ImageSpec& config)
{
// saving 'name' for later use
m_filename = name;
// BMP cannot be 1-channel, but config hint "bmp:monochrome_detect" is a
// hint to try to detect when all palette entries are gray and pretend
// that it's a 1-channel image to allow the calling app to save memory
// and time. It does this by default, but setting the hint to 0 turns
// this behavior off.
bool monodetect = config["bmp:monochrome_detect"].get<int>(1);
m_fd = Filesystem::fopen(m_filename, "rb");
if (!m_fd) {
errorf("Could not open file \"%s\"", name);
@@ -67,21 +141,41 @@ BmpInput::open(const std::string& name, ImageSpec& spec)
close();
return false;
}
// Strutil::print(
// "Header: magic={:x} {}{} fsize={} res1={} res2={} offset={}\n",
// m_bmp_header.magic, char(m_bmp_header.magic & 0xff),
// char(m_bmp_header.magic >> 8), m_bmp_header.fsize, m_bmp_header.res1,
// m_bmp_header.res2, m_bmp_header.offset);
if (!m_dib_header.read_header(m_fd)) {
errorf("\"%s\": wrong bitmap header size", m_filename);
close();
return false;
}
// Strutil::print(
// "Header: size={}(0x{:02x}) width={} height={} cplanes={} bpp={}\n",
// m_dib_header.size, m_dib_header.size, m_dib_header.width,
// m_dib_header.height, m_dib_header.cplanes, m_dib_header.bpp);
const int nchannels = (m_dib_header.bpp == 32) ? 4 : 3;
const int height = (m_dib_header.height >= 0) ? m_dib_header.height
: -m_dib_header.height;
: -m_dib_header.height;
m_spec = ImageSpec(m_dib_header.width, height, nchannels, TypeDesc::UINT8);
m_spec.attribute("XResolution", (int)m_dib_header.hres);
m_spec.attribute("YResolution", (int)m_dib_header.vres);
m_spec.attribute("ResolutionUnit", "m");
if (m_dib_header.hres > 0 && m_dib_header.vres > 0) {
m_spec.attribute("XResolution", (int)m_dib_header.hres);
m_spec.attribute("YResolution", (int)m_dib_header.vres);
m_spec.attribute("ResolutionUnit", "m");
}
if (m_spec.width < 1 || m_spec.height < 1 || m_spec.nchannels < 1
|| m_spec.image_bytes() < 1
|| m_spec.image_pixels() > std::numeric_limits<uint32_t>::max()) {
errorfmt(
"Invalid image size {} x {} ({} chans, {}), is likely corrupted",
m_spec.width, m_spec.height, m_spec.nchannels, m_spec.format);
close();
return false;
}
// comupting size of one scanline - this is the size of one scanline that
// computing size of one scanline - this is the size of one scanline that
// is stored in the file, not in the memory
int swidth = 0;
switch (m_dib_header.bpp) {
@@ -97,6 +191,11 @@ BmpInput::open(const std::string& name, ImageSpec& spec)
m_padded_scanline_size = (m_spec.width + 3) & ~3;
if (!read_color_table())
return false;
m_allgray = monodetect && color_table_is_all_gray();
if (m_allgray) {
m_spec.nchannels = 1; // make it look like a 1-channel image
m_spec.default_channel_names();
}
break;
case 4:
swidth = (m_spec.width + 1) / 2;
@@ -110,18 +209,104 @@ BmpInput::open(const std::string& name, ImageSpec& spec)
if (!read_color_table())
return false;
break;
default:
errorfmt("Unsupported BMP bit depth: {}", m_dib_header.bpp);
return false;
}
if (m_dib_header.bpp <= 16)
m_spec.attribute("bmp:bitsperpixel", m_dib_header.bpp);
switch (m_dib_header.size) {
case OS2_V1: m_spec.attribute("bmp:version", 1); break;
case WINDOWS_V3: m_spec.attribute("bmp:version", 3); break;
case WINDOWS_V4: m_spec.attribute("bmp:version", 4); break;
case WINDOWS_V5: m_spec.attribute("bmp:version", 5); break;
}
// file pointer is set to the beginning of image data
// we save this position - it will be helpfull in read_native_scanline
m_image_start = Filesystem::ftell(m_fd);
// Bite the bullet and uncompress now, for simplicity
if (m_dib_header.compression == RLE4_COMPRESSION
|| m_dib_header.compression == RLE8_COMPRESSION) {
if (!read_rle_image()) {
errorfmt("BMP error reading rle-compressed image");
close();
return false;
}
}
spec = m_spec;
newspec = m_spec;
return true;
}
bool
BmpInput::read_rle_image()
{
int rletype = m_dib_header.compression == RLE4_COMPRESSION ? 4 : 8;
m_spec.attribute("bmp:compression", rletype == 4 ? "rle4" : "rle8");
m_uncompressed.clear();
m_uncompressed.resize(m_spec.height * m_spec.width);
// Note: the clear+resize zeroes out the buffer
bool err = false;
int y = 0, x = 0;
while (!err && !feof(m_fd)) {
unsigned char rle_pair[2];
if (fread(rle_pair, 1, 2, m_fd) != 2) {
err = true;
break;
}
int npixels = rle_pair[0];
int value = rle_pair[1];
if (npixels == 0 && value == 0) {
// [0,0] is end of line marker
x = 0;
++y;
} else if (npixels == 0 && value == 1) {
// [0,1] is end of bitmap marker
break;
} else if (npixels == 0 && value == 2) {
// [0,2] is a "delta" -- two more bytes reposition the
// current pixel position that we're reading.
unsigned char offset[2];
err |= (fread(offset, 1, 2, m_fd) != 2);
x += offset[0];
y += offset[1];
} else if (npixels == 0) {
// [0,n>2] is an "absolute" run of pixel data.
// n is the number of pixel indices that follow, but note
// that it pads to word size.
int npixels = value;
int nbytes = (rletype == 4)
? round_to_multiple((npixels + 1) / 2, 2)
: round_to_multiple(npixels, 2);
unsigned char absolute[256];
err |= (fread(absolute, 1, nbytes, m_fd) != size_t(nbytes));
for (int i = 0; i < npixels; ++i, ++x) {
if (rletype == 4)
value = (i & 1) ? (absolute[i / 2] & 0x0f)
: (absolute[i / 2] >> 4);
else
value = absolute[i];
if (x < m_spec.width)
m_uncompressed[y * m_spec.width + x] = value;
}
} else {
// [n>0,p] is a run of n pixels.
for (int i = 0; i < npixels; ++i, ++x) {
int v;
if (rletype == 4)
v = (i & 1) ? (value & 0x0f) : (value >> 4);
else
v = value;
if (x < m_spec.width)
m_uncompressed[y * m_spec.width + x] = v;
}
}
}
return !err;
}
bool
BmpInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
void* data)
@@ -133,15 +318,28 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
if (y < 0 || y > m_spec.height)
return false;
size_t scanline_bytes = m_spec.scanline_bytes();
uint8_t* mscanline = (uint8_t*)data;
if (m_dib_header.compression == RLE4_COMPRESSION
|| m_dib_header.compression == RLE8_COMPRESSION) {
for (int x = 0; x < m_spec.width; ++x) {
int p = m_uncompressed[(m_spec.height - 1 - y) * m_spec.width + x];
auto& c = colortable(p);
mscanline[3 * x] = c.r;
mscanline[3 * x + 1] = c.g;
mscanline[3 * x + 2] = c.b;
}
return true;
}
// if the height is positive scanlines are stored bottom-up
if (m_dib_header.width >= 0)
if (m_dib_header.height >= 0)
y = m_spec.height - y - 1;
const int64_t scanline_off = y * m_padded_scanline_size;
std::unique_ptr<unsigned char[]> fscanline(
new unsigned char[m_padded_scanline_size]);
Filesystem::fseek(m_fd, m_image_start + scanline_off, SEEK_SET);
size_t n = fread(fscanline.get(), 1, m_padded_scanline_size, m_fd);
fscanline.resize(m_padded_scanline_size);
Filesystem::fseek(m_fd, m_bmp_header.offset + scanline_off, SEEK_SET);
size_t n = fread(fscanline.data(), 1, m_padded_scanline_size, m_fd);
if (n != (size_t)m_padded_scanline_size) {
if (feof(m_fd))
errorf("Hit end of file unexpectedly");
@@ -157,13 +355,10 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
for (unsigned int i = 0; i < m_spec.scanline_bytes();
i += m_spec.nchannels)
std::swap(fscanline[i], fscanline[i + 2]);
memcpy(data, fscanline.get(), m_spec.scanline_bytes());
memcpy(data, fscanline.data(), m_spec.scanline_bytes());
return true;
}
size_t scanline_bytes = m_spec.scanline_bytes();
std::unique_ptr<unsigned char[]> mscanline(
new unsigned char[scanline_bytes]);
if (m_dib_header.bpp == 16) {
const uint16_t RED = 0x7C00;
const uint16_t GREEN = 0x03E0;
@@ -176,22 +371,39 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
}
}
if (m_dib_header.bpp == 8) {
for (unsigned int i = 0, j = 0; j < scanline_bytes; ++i, j += 3) {
mscanline[j] = m_colortable[fscanline[i]].r;
mscanline[j + 1] = m_colortable[fscanline[i]].g;
mscanline[j + 2] = m_colortable[fscanline[i]].b;
if (m_allgray) {
// Keep it as 1-channel image because all colors are gray
for (unsigned int i = 0; i < scanline_bytes; ++i) {
mscanline[i] = colortable(fscanline[i]).r;
}
} else {
// Expand palette image into 3-channel RGB (existing code)
for (unsigned int i = 0, j = 0; j < scanline_bytes; ++i, j += 3) {
auto& c = colortable(fscanline[i]);
mscanline[j] = c.r;
mscanline[j + 1] = c.g;
mscanline[j + 2] = c.b;
}
}
}
if (m_dib_header.bpp == 4) {
for (unsigned int i = 0, j = 0; j + 6 < scanline_bytes; ++i, j += 6) {
uint8_t mask = 0xF0;
mscanline[j] = m_colortable[(fscanline[i] & mask) >> 4].r;
mscanline[j + 1] = m_colortable[(fscanline[i] & mask) >> 4].g;
mscanline[j + 2] = m_colortable[(fscanline[i] & mask) >> 4].b;
mask = 0x0F;
mscanline[j + 3] = m_colortable[fscanline[i] & mask].r;
mscanline[j + 4] = m_colortable[fscanline[i] & mask].g;
mscanline[j + 5] = m_colortable[fscanline[i] & mask].b;
for (unsigned int i = 0, j = 0; j < scanline_bytes; ++i, j += 6) {
uint8_t mask = 0xF0;
{
auto& c = colortable((fscanline[i] & mask) >> 4);
mscanline[j] = c.r;
mscanline[j + 1] = c.g;
mscanline[j + 2] = c.b;
}
if (j + 3 >= scanline_bytes)
break;
mask = 0x0F;
{
auto& c = colortable(fscanline[i] & mask);
mscanline[j + 3] = c.r;
mscanline[j + 4] = c.g;
mscanline[j + 5] = c.b;
}
}
}
if (m_dib_header.bpp == 1) {
@@ -202,13 +414,13 @@ BmpInput::read_native_scanline(int subimage, int miplevel, int y, int /*z*/,
int index = 0;
if (fscanline[i] & (1 << j))
index = 1;
mscanline[k] = m_colortable[index].r;
mscanline[k + 1] = m_colortable[index].g;
mscanline[k + 2] = m_colortable[index].b;
auto& c = colortable(index);
mscanline[k] = c.r;
mscanline[k + 1] = c.g;
mscanline[k + 2] = c.b;
}
}
}
memcpy(data, &mscanline[0], scanline_bytes);
return true;
}
@@ -233,10 +445,15 @@ BmpInput::read_color_table(void)
// if this field is 0 - color table has max colors:
// pow(2, m_dib_header.cpalete) otherwise color table have
// m_dib_header.cpalete entries
if (m_dib_header.cpalete < 0
|| m_dib_header.cpalete > (1 << m_dib_header.bpp)) {
errorf("Possible corrupted header, invalid palette size");
return false;
}
const int32_t colors = (m_dib_header.cpalete) ? m_dib_header.cpalete
: 1 << m_dib_header.bpp;
size_t entry_size = 4;
// if the file is OS V2 bitmap color table entr has only 3 bytes, not four
size_t entry_size = 4;
// if the file is OS V2 bitmap color table entry has only 3 bytes, not four
if (m_dib_header.size == OS2_V1)
entry_size = 3;
m_colortable.resize(colors);
@@ -244,8 +461,9 @@ BmpInput::read_color_table(void)
size_t n = fread(&m_colortable[i], 1, entry_size, m_fd);
if (n != entry_size) {
if (feof(m_fd))
errorf(
"Hit end of file unexpectedly while reading color table");
errorfmt(
"Hit end of file unexpectedly while reading color table on color {}/{} (read {}, expected {})",
i, colors, n, entry_size);
else
errorf("read error while reading color table");
return false; // Read failed
@@ -254,4 +472,16 @@ BmpInput::read_color_table(void)
return true; // ok
}
bool
BmpInput::color_table_is_all_gray(void)
{
size_t ncolors = m_colortable.size();
for (size_t i = 0; i < ncolors; i++) {
color_table& color = m_colortable[i];
if (color.b != color.g || color.g != color.r)
return false;
}
return true;
}
OIIO_PLUGIN_NAMESPACE_END
+90 -31
View File
@@ -2,6 +2,10 @@
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#include <cstdio>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/imageio.h>
#include <OpenImageIO/strutil.h>
#include "bmp_pvt.h"
@@ -11,6 +15,47 @@ OIIO_PLUGIN_NAMESPACE_BEGIN
using namespace bmp_pvt;
class BmpOutput final : public ImageOutput {
public:
BmpOutput() { init(); }
virtual ~BmpOutput() { close(); }
virtual const char* format_name(void) const override { return "bmp"; }
virtual int supports(string_view feature) const override;
virtual bool open(const std::string& name, const ImageSpec& spec,
OpenMode mode) override;
virtual bool close(void) override;
virtual bool write_scanline(int y, int z, TypeDesc format, const void* data,
stride_t xstride) override;
virtual bool write_tile(int x, int y, int z, TypeDesc format,
const void* data, stride_t xstride,
stride_t ystride, stride_t zstride) override;
private:
int64_t m_padded_scanline_size;
FILE* m_fd;
std::string m_filename;
bmp_pvt::BmpFileHeader m_bmp_header;
bmp_pvt::DibInformationHeader m_dib_header;
int64_t m_image_start;
unsigned int m_dither;
std::vector<unsigned char> m_tilebuffer;
std::vector<unsigned char> m_scratch;
std::vector<unsigned char> m_buf; // more tmp space for write_scanline
void init(void)
{
m_padded_scanline_size = 0;
m_fd = NULL;
m_filename.clear();
}
void create_and_write_file_header(void);
void create_and_write_bitmap_header(void);
};
// Obligatory material to make this a recognizeable imageio plugin
OIIO_PLUGIN_EXPORTS_BEGIN
@@ -46,7 +91,8 @@ BmpOutput::open(const std::string& name, const ImageSpec& spec, OpenMode mode)
m_filename = name;
m_spec = spec;
if (m_spec.nchannels != 3 && m_spec.nchannels != 4) {
if (m_spec.nchannels != 1 && m_spec.nchannels != 3
&& m_spec.nchannels != 4) {
errorf("%s does not support %d-channel images\n", format_name(),
m_spec.nchannels);
return false;
@@ -68,12 +114,13 @@ BmpOutput::open(const std::string& name, const ImageSpec& spec, OpenMode mode)
return false;
}
// Scanline size is rounded up to align to 4-byte boundary
m_padded_scanline_size = round_to_multiple(m_spec.scanline_bytes(), 4);
create_and_write_file_header();
create_and_write_bitmap_header();
// Scanline size is rounded up to align to 4-byte boundary
m_padded_scanline_size = ((m_spec.width * m_spec.nchannels) + 3) & ~3;
m_image_start = Filesystem::ftell(m_fd);
m_image_start = Filesystem::ftell(m_fd);
// If user asked for tiles -- which this format doesn't support, emulate
// it by buffering the whole image.
@@ -100,21 +147,20 @@ BmpOutput::write_scanline(int y, int z, TypeDesc format, const void* data,
int64_t scanline_off = y * m_padded_scanline_size;
Filesystem::fseek(m_fd, m_image_start + scanline_off, SEEK_SET);
std::vector<unsigned char> scratch;
data = to_native_scanline(format, data, xstride, scratch, m_dither, y, z);
std::vector<unsigned char> buf;
buf.reserve(m_padded_scanline_size); // reserve enough for padded scanline
buf.assign((const unsigned char*)data,
(const unsigned char*)data + m_spec.scanline_bytes());
buf.resize(m_padded_scanline_size, 0); // pad with zeroes if needed
m_scratch.clear();
data = to_native_scanline(format, data, xstride, m_scratch, m_dither, y, z);
m_buf.assign((const unsigned char*)data,
(const unsigned char*)data + m_spec.scanline_bytes());
m_buf.resize(m_padded_scanline_size, 0); // pad with zeroes if needed
// Swap RGB pixels into BGR format
if (m_spec.nchannels >= 3)
for (int i = 0, iend = buf.size() - 2; i < iend; i += m_spec.nchannels)
std::swap(buf[i], buf[i + 2]);
for (int i = 0, iend = m_buf.size() - 2; i < iend;
i += m_spec.nchannels)
std::swap(m_buf[i], m_buf[i + 2]);
size_t byte_count = fwrite(&buf[0], 1, buf.size(), m_fd);
return byte_count == buf.size(); // true if wrote all bytes (no error)
size_t byte_count = fwrite(&m_buf[0], 1, m_buf.size(), m_fd);
return byte_count == m_buf.size(); // true if wrote all bytes (no error)
}
@@ -157,13 +203,13 @@ void
BmpOutput::create_and_write_file_header(void)
{
m_bmp_header.magic = MAGIC_BM;
int64_t data_size = int64_t(m_spec.width) * m_spec.height
* m_spec.nchannels;
int64_t file_size = data_size + BMP_HEADER_SIZE + WINDOWS_V3;
m_bmp_header.fsize = file_size;
m_bmp_header.res1 = 0;
m_bmp_header.res2 = 0;
m_bmp_header.offset = BMP_HEADER_SIZE + WINDOWS_V3;
int64_t data_size = m_padded_scanline_size * m_spec.height;
int palettesize = (m_spec.nchannels == 1) ? 4 * 256 : 0;
int64_t file_size = data_size + BMP_HEADER_SIZE + WINDOWS_V3 + palettesize;
m_bmp_header.fsize = file_size;
m_bmp_header.res1 = 0;
m_bmp_header.res2 = 0;
m_bmp_header.offset = BMP_HEADER_SIZE + WINDOWS_V3 + palettesize;
m_bmp_header.write_header(m_fd);
}
@@ -177,18 +223,24 @@ BmpOutput::create_and_write_bitmap_header(void)
m_dib_header.width = m_spec.width;
m_dib_header.height = m_spec.height;
m_dib_header.cplanes = 1;
m_dib_header.compression = 0;
m_dib_header.compression = NO_COMPRESSION;
m_dib_header.bpp = m_spec.nchannels << 3;
if (m_spec.nchannels == 1) {
// Special case -- write a 1-channel image as a gray palette
m_dib_header.bpp = 8;
m_dib_header.cpalete = 256;
m_dib_header.important = 256;
} else {
m_dib_header.bpp = m_spec.nchannels * 8;
m_dib_header.cpalete = 0;
m_dib_header.important = 0;
}
m_dib_header.isize = m_spec.width * m_spec.height * m_spec.nchannels;
m_dib_header.hres = 0;
m_dib_header.vres = 0;
m_dib_header.cpalete = 0;
m_dib_header.important = 0;
m_dib_header.isize = int32_t(m_spec.image_pixels());
m_dib_header.hres = 0;
m_dib_header.vres = 0;
ParamValue* p = NULL;
p = m_spec.find_attribute("ResolutionUnit", TypeDesc::STRING);
ParamValue* p = m_spec.find_attribute("ResolutionUnit", TypeDesc::STRING);
if (p && p->data()) {
std::string res_units = *(char**)p->data();
if (Strutil::iequals(res_units, "m")
@@ -204,6 +256,13 @@ BmpOutput::create_and_write_bitmap_header(void)
}
m_dib_header.write_header(m_fd);
// Write palette, if there is one. This is only used for grayscale
// images, and the palette is just the 256 possible gray values.
for (int i = 0; i < m_dib_header.cpalete; ++i) {
unsigned char val[4] = { uint8_t(i), uint8_t(i), uint8_t(i), 255 };
fwrite(&val, 1, 4, m_fd);
}
}
OIIO_PLUGIN_NAMESPACE_END
+1 -1
View File
@@ -7,4 +7,4 @@ Name: OpenImageIO
Description: OpenImageIO is a library for reading and writing images.
Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@
Libs: -L${libdir} -lOpenImageIO
Cflags: -I${includedir}/OpenImageIO
Cflags: -I${includedir}
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
# Utility script to download and build OpenJPEG
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of OpenJPEG to download if we don't have it yet
OPENJPEG_REPO=${OPENJPEG_REPO:=https://github.com/uclouvain/openjpeg.git}
OPENJPEG_VERSION=${OPENJPEG_VERSION:=v2.4.0}
# Where to put OpenJPEG repo source (default to the ext area)
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OPENJPEG_SRC_DIR=${OPENJPEG_SRC_DIR:=${LOCAL_DEPS_DIR}/OpenJPEG}
OPENJPEG_BUILD_DIR=${OPENJPEG_BUILD_DIR:=${OPENJPEG_SRC_DIR}/build}
OPENJPEG_INSTALL_DIR=${OPENJPEG_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
#OPENJPEG_CONFIG_OPTS=${OPENJPEG_CONFIG_OPTS:=}
pwd
echo "OpenJPEG install dir will be: ${OPENJPEG_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone OpenJPEG project from GitHub and build
if [[ ! -e ${OPENJPEG_SRC_DIR} ]] ; then
echo "git clone ${OPENJPEG_REPO} ${OPENJPEG_SRC_DIR}"
git clone ${OPENJPEG_REPO} ${OPENJPEG_SRC_DIR}
fi
cd ${OPENJPEG_SRC_DIR}
echo "git checkout ${OPENJPEG_VERSION} --force"
git checkout ${OPENJPEG_VERSION} --force
mkdir -p ${OPENJPEG_BUILD_DIR} && true
cd ${OPENJPEG_BUILD_DIR}
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${OPENJPEG_INSTALL_DIR} \
-DBUILD_CODEC=OFF \
${OPENJPEG_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
# ls -R ${OPENJPEG_INSTALL_DIR}
popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export OpenJPEG_ROOT=$OPENJPEG_INSTALL_DIR
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# Utility script to download and build Ptex
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of ptex to download if we don't have it yet
: ${PTEX_REPO:=https://github.com/wdas/ptex.git}
: ${PTEX_VERSION:=v2.4.0}
: ${PTEX_SRC_DIR:=${PWD}/ext/ptex}
: ${PTEX_BUILD_DIR:=${PTEX_SRC_DIR}/build}
: ${PTEX_INSTALL_DIR:=${PWD}/ext/dist}
pwd
echo "Ptex install dir will be: ${PTEX_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone ptex project from GitHub and build
if [[ ! -e ${PTEX_SRC_DIR} ]] ; then
echo "git clone ${PTEX_REPO} ${PTEX_SRC_DIR}"
git clone ${PTEX_REPO} ${PTEX_SRC_DIR}
fi
cd ${PTEX_SRC_DIR}
echo "git checkout ${PTEX_VERSION} --force"
git checkout ${PTEX_VERSION} --force
mkdir -p ${PTEX_BUILD_DIR}
cd ${PTEX_BUILD_DIR}
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PTEX_INSTALL_DIR} \
${PTEX_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
# ls -R ${PTEX_INSTALL_DIR}
popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export Ptex_ROOT=$PTEX_INSTALL_DIR
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PTEX_INSTALL_DIR}/lib:${PTEX_INSTALL_DIR}/lib64
+17 -2
View File
@@ -12,10 +12,25 @@ CMAKE_VERSION=${CMAKE_VERSION:=3.12.4}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
CMAKE_INSTALL_DIR=${CMAKE_INSTALL_DIR:=${LOCAL_DEPS_DIR}/cmake}
if [[ `uname` == "Linux" ]] ; then
mkdir -p ${CMAKE_INSTALL_DIR} && true
if [[ `uname` == "Linux" && `uname -m` == "x86_64" ]] ; then
mkdir -p ${CMAKE_INSTALL_DIR} || true
curl --location "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh" -o "cmake.sh"
sh cmake.sh --skip-license --prefix=${CMAKE_INSTALL_DIR}
export PATH=${CMAKE_INSTALL_DIR}/bin:$PATH
fi
if [[ `uname` == "Linux" && `uname -m` == "aarch64" ]] ; then
mkdir -p ${CMAKE_INSTALL_DIR} || true
curl --location https://anaconda.org/conda-forge/cmake/3.17.0/download/linux-aarch64/cmake-3.17.0-h28c56e5_0.tar.bz2 -o cmake-3.17.0-h28c56e5_0.tar.bz2
tar -xjf cmake-3.17.0-h28c56e5_0.tar.bz2 -C ${CMAKE_INSTALL_DIR}
export PATH=${CMAKE_INSTALL_DIR}/bin:$PATH
# In case we ever need to build from scratch:
# curl --location "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz" -o cmake.tar.gz
# tar xzf cmake.tar.gz
# pushd cmake-${CMAKE_VERSION}
# CXX="ccache $CXX" ./bootstrap --parallel=${PARALLEL:=4} --enable-ccache
# CXX="ccache $CXX" timeout 2100 time make ${PAR_MAKEFAGS} || true
# export PATH=${CMAKE_INSTALL_DIR}/bin:$PWD/bin:$PATH
# popd
fi
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Utility script to download and build giflib
# Exit the whole script if any command fails.
set -ex
GIFLIB_REPO=${GIFLIB_REPO:=https://gitlab.com/giflib/giflib.git}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
GIFLIB_BUILD_DIR=${GIFLIB_BUILD_DIR:=${LOCAL_DEPS_DIR}/giflib}
GIFLIB_INSTALL_DIR=${GIFLIB_INSTALL_DIR:=${PWD}/ext/dist}
GIFLIB_VERSION=${GIFLIB_VERSION:=5.2.1}
GIFLIB_CC=${GIFLIB_CC:=gcc}
BASEDIR=`pwd`
pwd
echo "giflib install dir will be: ${GIFLIB_INSTALL_DIR}"
mkdir -p ${LOCAL_DEPS_DIR}
pushd ${LOCAL_DEPS_DIR}
# Clone giflib project and build
curl --location https://downloads.sourceforge.net/project/giflib/giflib-${GIFLIB_VERSION}.tar.gz -o giflib.tar.gz
tar xzf giflib.tar.gz
pushd giflib-${GIFLIB_VERSION}
cp Makefile Makefile.old
curl --location https://sourceforge.net/p/giflib/bugs/_discuss/thread/4e811ad29b/c323/attachment/Makefile.patch -o Makefile.patch
patch -p0 < Makefile.patch
popd
cd giflib-${GIFLIB_VERSION}
time make PREFIX=${GIFLIB_INSTALL_DIR} CC=${GIFLIB_CC} install
popd
# ls -R ${GIFLIB_INSTALL_DIR} && true
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export GIF_ROOT=$GIFLIB_INSTALL_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${GIFLIB_INSTALL_DIR}/lib
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
# Utility script to download and build libjpeg-turbo
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# 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}
# Where to put libjpeg-turbo repo source (default to the ext area)
LIBJPEGTURBO_SRC_DIR=${LIBJPEGTURBO_SRC_DIR:=${PWD}/ext/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_CONFIG_OPTS=${LIBJPEGTURBO_CONFIG_OPTS:=}
pwd
echo "libjpeg-turbo install dir will be: ${LIBJPEGTURBO_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone libjpeg-turbo project from GitHub and build
if [[ ! -e ${LIBJPEGTURBO_SRC_DIR} ]] ; then
echo "git clone ${LIBJPEGTURBO_REPO} ${LIBJPEGTURBO_SRC_DIR}"
git clone ${LIBJPEGTURBO_REPO} ${LIBJPEGTURBO_SRC_DIR}
fi
cd ${LIBJPEGTURBO_SRC_DIR}
echo "git checkout ${LIBJPEGTURBO_VERSION} --force"
git checkout ${LIBJPEGTURBO_VERSION} --force
mkdir -p ${LIBJPEGTURBO_BUILD_DIR}
cd ${LIBJPEGTURBO_BUILD_DIR}
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${LIBJPEGTURBO_INSTALL_DIR} \
${LIBJPEGTURBO_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
# ls -R ${LIBJPEGTURBO_INSTALL_DIR}
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
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
# Utility script to download and build libpng
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of libpng to download if we don't have it yet
LIBPNG_REPO=${LIBPNG_REPO:=https://github.com/glennrp/libpng.git}
LIBPNG_VERSION=${LIBPNG_VERSION:=v1.6.35}
# Where to put libpng repo source (default to the ext area)
LIBPNG_SRC_DIR=${LIBPNG_SRC_DIR:=${PWD}/ext/libpng}
# Temp build area (default to a build/ subdir under source)
LIBPNG_BUILD_DIR=${LIBPNG_BUILD_DIR:=${LIBPNG_SRC_DIR}/build}
# Install area for libpng (default to ext/dist)
LIBPNG_INSTALL_DIR=${LIBPNG_INSTALL_DIR:=${PWD}/ext/dist}
#LIBPNG_CONFIG_OPTS=${LIBPNG_CONFIG_OPTS:=}
pwd
echo "libpng install dir will be: ${LIBPNG_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone libpng project from GitHub and build
if [[ ! -e ${LIBPNG_SRC_DIR} ]] ; then
echo "git clone ${LIBPNG_REPO} ${LIBPNG_SRC_DIR}"
git clone ${LIBPNG_REPO} ${LIBPNG_SRC_DIR}
fi
cd ${LIBPNG_SRC_DIR}
echo "git checkout ${LIBPNG_VERSION} --force"
git checkout ${LIBPNG_VERSION} --force
mkdir -p ${LIBPNG_BUILD_DIR}
cd ${LIBPNG_BUILD_DIR}
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${LIBPNG_INSTALL_DIR} \
-DPNG_EXECUTABLES=OFF \
-DPNG_TESTS=OFF \
${LIBPNG_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
# ls -R ${LIBPNG_INSTALL_DIR}
popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export PNG_ROOT=$LIBPNG_INSTALL_DIR
+4 -5
View File
@@ -7,8 +7,7 @@ set -ex
# Which LibRaw to retrieve, how to build it
LIBRAW_REPO=${LIBRAW_REPO:=https://github.com/LibRaw/LibRaw.git}
LIBRAW_VERSION=${LIBRAW_VERSION:=0.19.5}
LIBRAW_BRANCH=${LIBRAW_BRANCH:=${LIBRAW_VERSION}}
LIBRAW_VERSION=${LIBRAW_VERSION:=0.20.2}
# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
@@ -18,7 +17,7 @@ LIBRAW_INSTALL_DIR=${LIBRAW_INSTALL_DIR:=${LOCAL_DEPS_DIR}/libraw-install}
LIBRAW_BUILD_TYPE=${LIBRAW_BUILD_TYPE:=Release}
pwd
echo "Building LibRaw ${LIBRAW_BRANCH}"
echo "Building LibRaw ${LIBRAW_VERSION}"
echo " build dir will be: ${LIBRAW_BUILD_DIR}"
echo " install dir will be: ${LIBRAW_INSTALL_DIR}"
echo " build type is ${LIBRAW_BUILD_TYPE}"
@@ -34,12 +33,12 @@ mkdir -p ${LIBRAW_INSTALL_DIR} && true
mkdir -p ${LIBRAW_BUILD_DIR} && true
pushd ${LIBRAW_SOURCE_DIR}
git checkout ${LIBRAW_BRANCH} --force
git checkout ${LIBRAW_VERSION} --force
aclocal
autoreconf --install
./configure --prefix=${LIBRAW_INSTALL_DIR}
make -j ${PARALLEL:=4} && make install
time make -j ${PARALLEL:=4} && make install
popd
+13 -9
View File
@@ -8,10 +8,11 @@ set -ex
LIBTIFF_REPO=${LIBTIFF_REPO:=https://gitlab.com/libtiff/libtiff.git}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
LIBTIFF_BUILD_DIR=${LIBTIFF_BUILD_DIR:=${LOCAL_DEPS_DIR}/libtiff}
LIBTIFF_INSTALL_DIR=${LIBTIFF_INSTALL_DIR:=${LOCAL_DEPS_DIR}/libtiff/dist}
LIBTIFF_VERSION=${LIBTIFF_VERSION:=4.1.0}
LIBTIFF_BRANCH=${LIBTIFF_BRANCH:=v${LIBTIFF_VERSION}}
LIBTIFF_CXX_FLAGS=${LIBTIFF_CXX_FLAGS:="-Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
LIBTIFF_INSTALL_DIR=${LIBTIFF_INSTALL_DIR:=${PWD}/ext/dist}
LIBTIFF_VERSION=${LIBTIFF_VERSION:=v4.1.0}
if [[ `uname` == `Linux` ]] ; then
LIBTIFF_CXX_FLAGS=${LIBTIFF_CXX_FLAGS:="-O3 -Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
fi
LIBTIFF_BUILDOPTS="${LIBTIFF_BUILDOPTS}"
BASEDIR=`pwd`
pwd
@@ -27,21 +28,24 @@ if [[ ! -e libtiff ]] ; then
fi
cd libtiff
echo "git checkout ${LIBTIFF_BRANCH} --force"
git checkout ${LIBTIFF_BRANCH} --force
echo "git checkout ${LIBTIFF_VERSION} --force"
git checkout ${LIBTIFF_VERSION} --force
mkdir -p build
cd build
time cmake --config Release -DCMAKE_INSTALL_PREFIX=${LIBTIFF_INSTALL_DIR} -DCMAKE_CXX_FLAGS="${LIBTIFF_CXX_FLAGS}" ${LIBTIFF_BUILDOPTS} ..
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${LIBTIFF_INSTALL_DIR} \
-DCMAKE_CXX_FLAGS="${LIBTIFF_CXX_FLAGS}" \
${LIBTIFF_BUILDOPTS} ..
time cmake --build . --config Release --target install
popd
ls -R ${LIBTIFF_INSTALL_DIR}
# ls -R ${LIBTIFF_INSTALL_DIR}
#echo "listing .."
#ls ..
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export TIFF_ROOT=$LIBTIFF_INSTALL_DIR
export LIBTIFF_ROOT=$LIBTIFF_INSTALL_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${LIBTIFF_INSTALL_DIR}/lib
+2 -2
View File
@@ -30,7 +30,7 @@ if [[ `uname` == "Linux" ]] ; then
fi
echo LLVMTAR = $LLVMTAR
curl --location http://releases.llvm.org/${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
ls -l $LLVMTAR
# ls -l $LLVMTAR
tar xf $LLVMTAR
rm -f $LLVMTAR
echo "Installed ${LLVM_VERSION} in ${LLVM_INSTALL_DIR}"
@@ -38,5 +38,5 @@ if [[ `uname` == "Linux" ]] ; then
mv clang+llvm*/* $LLVM_INSTALL_DIR
export LLVM_DIRECTORY=$LLVM_INSTALL_DIR
export PATH=${LLVM_INSTALL_DIR}/bin:$PATH
ls -a $LLVM_DIRECTORY
# ls -a $LLVM_DIRECTORY
fi
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Exit the whole script if any command fails.
set -ex
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
DOWNLOADS_DIR=${DOWNLOADS_DIR:=${LOCAL_DEPS_DIR}/downloads}
NINJA_REPO=${NINJA_REPO:=https://github.com/ninja-build/ninja}
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
fi
tar xf $DOWNLOADS_DIR/ninja-${NINJA_BRANCH}.tar.gz
pushd ninja-${NINJA_VERSION}
./configure.py --bootstrap
mkdir -p ${NINJA_INSTALL_DIR}
cp ninja ${NINJA_INSTALL_DIR}
popd
-52
View File
@@ -1,52 +0,0 @@
#!/usr/bin/env bash
# Utility script to download and build OpenColorIO
# Exit the whole script if any command fails.
set -ex
OCIO_REPO=${OCIO_REPO:=https://github.com/AcademySoftwareFoundation/OpenColorIO.git}
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OCIO_BUILD_DIR=${OCIO_BUILD_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO}
OCIO_INSTALL_DIR=${OCIO_INSTALL_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO/dist}
OCIO_VERSION=${OCIO_VERSION:=1.1.1}
OCIO_BRANCH=${OCIO_BRANCH:=v${OCIO_VERSION}}
OCIO_CXX_FLAGS=${OCIO_CXX_FLAGS:="-Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
# Just need libs:
OCIO_BUILDOPTS="-DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_NUKE=OFF \
-DOCIO_BUILD_DOCS=OFF -DOCIO_BUILD_TESTS=OFF \
-DOCIO_BUILD_PYTHON=OFF -DOCIO_BUILD_PYGLUE=OFF \
-DOCIO_BUILD_JAVA=OFF \
-DOCIO_BUILD_STATIC=${OCIO_BUILD_STATIC:=OFF}"
BASEDIR=`pwd`
pwd
echo "OpenColorIO install dir will be: ${OCIO_INSTALL_DIR}"
mkdir -p ${LOCAL_DEPS_DIR}
pushd ${LOCAL_DEPS_DIR}
# Clone OpenColorIO project from GitHub and build
if [[ ! -e OpenColorIO ]] ; then
echo "git clone ${OCIO_REPO} OpenColorIO"
git clone ${OCIO_REPO} OpenColorIO
fi
cd OpenColorIO
echo "git checkout ${OCIO_BRANCH} --force"
git checkout ${OCIO_BRANCH} --force
mkdir -p build
cd build
time cmake --config Release -DCMAKE_INSTALL_PREFIX=${OCIO_INSTALL_DIR} -DCMAKE_CXX_FLAGS="${OCIO_CXX_FLAGS}" ${OCIO_BUILDOPTS} ..
time cmake --build . --config Release --target install
popd
ls -R ${OCIO_INSTALL_DIR}
#echo "listing .."
#ls ..
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export OpenColorIO_ROOT=$OCIO_INSTALL_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OCIO_INSTALL_DIR}/lib
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
# Utility script to download and build OpenColorIO
# Exit the whole script if any command fails.
set -ex
# Which OCIO to retrieve, how to build it
OPENCOLORIO_REPO=${OPENCOLORIO_REPO:=https://github.com/AcademySoftwareFoundation/OpenColorIO.git}
OPENCOLORIO_VERSION=${OPENCOLORIO_VERSION:=v2.0.1}
# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OPENCOLORIO_SOURCE_DIR=${OPENCOLORIO_BUILD_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO}
OPENCOLORIO_BUILD_DIR=${OPENCOLORIO_BUILD_DIR:=${LOCAL_DEPS_DIR}/OpenColorIO-build}
OPENCOLORIO_INSTALL_DIR=${OPENCOLORIO_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
OPENCOLORIO_CXX_FLAGS=${OPENCOLORIO_CXX_FLAGS:="-Wno-unused-function -Wno-deprecated-declarations -Wno-cast-qual -Wno-write-strings"}
# Just need libs:
OPENCOLORIO_BUILDOPTS="-DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_NUKE=OFF \
-DOCIO_BUILD_DOCS=OFF -DOCIO_BUILD_TESTS=OFF \
-DOCIO_BUILD_GPU_TESTS=OFF \
-DOCIO_BUILD_PYTHON=OFF -DOCIO_BUILD_PYGLUE=OFF \
-DOCIO_BUILD_JAVA=OFF \
-DOCIO_BUILD_STATIC=${OCIO_BUILD_STATIC:=OFF}"
BASEDIR=`pwd`
pwd
echo "OpenColorIO install dir will be: ${OPENCOLORIO_INSTALL_DIR}"
mkdir -p ${LOCAL_DEPS_DIR}
pushd ${LOCAL_DEPS_DIR}
# Clone OpenColorIO project from GitHub and build
if [[ ! -e OpenColorIO ]] ; then
echo "git clone ${OPENCOLORIO_REPO} OpenColorIO"
git clone ${OPENCOLORIO_REPO} OpenColorIO
fi
cd OpenColorIO
echo "git checkout ${OPENCOLORIO_VERSION} --force"
git checkout ${OPENCOLORIO_VERSION} --force
mkdir -p build
cd build
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${OPENCOLORIO_INSTALL_DIR} \
-DCMAKE_CXX_FLAGS="${OPENCOLORIO_CXX_FLAGS}" \
${OPENCOLORIO_BUILDOPTS} ..
time cmake --build . --config Release --target install
popd
# ls -R ${OPENCOLORIO_INSTALL_DIR}
#echo "listing .."
#ls ..
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export OpenColorIO_ROOT=$OPENCOLORIO_INSTALL_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OPENCOLORIO_INSTALL_DIR}/lib
+17 -14
View File
@@ -6,15 +6,14 @@
set -ex
# Which OpenEXR to retrieve, how to build it
OPENEXR_REPO=${OPENEXR_REPO:=https://github.com/openexr/openexr.git}
OPENEXR_VERSION=${OPENEXR_VERSION:=2.4.1}
OPENEXR_BRANCH=${OPENEXR_BRANCH:=v${OPENEXR_VERSION}}
OPENEXR_REPO=${OPENEXR_REPO:=https://github.com/AcademySoftwareFoundation/openexr.git}
OPENEXR_VERSION=${OPENEXR_VERSION:=v2.4.1}
# Where to install the final results
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
OPENEXR_SOURCE_DIR=${OPENEXR_SOURCE_DIR:=${LOCAL_DEPS_DIR}/openexr}
OPENEXR_BUILD_DIR=${OPENEXR_BUILD_DIR:=${LOCAL_DEPS_DIR}/openexr-build}
OPENEXR_INSTALL_DIR=${OPENEXR_INSTALL_DIR:=${LOCAL_DEPS_DIR}/openexr-install}
OPENEXR_INSTALL_DIR=${OPENEXR_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
OPENEXR_BUILD_TYPE=${OPENEXR_BUILD_TYPE:=Release}
CMAKE_GENERATOR=${CMAKE_GENERATOR:="Unix Makefiles"}
OPENEXR_CMAKE_FLAGS=${OPENEXR_CMAKE_FLAGS:=""}
@@ -22,9 +21,9 @@ OPENEXR_CXX_FLAGS=${OPENEXR_CXX_FLAGS:=""}
BASEDIR=$PWD
pwd
echo "Building OpenEXR ${OPENEXR_BRANCH}"
echo "EXR build dir will be: ${OPENEXR_BUILD_DIR}"
echo "EXR install dir will be: ${OPENEXR_INSTALL_DIR}"
echo "Building OpenEXR ${OPENEXR_VERSION}"
echo "OpenEXR build dir will be: ${OPENEXR_BUILD_DIR}"
echo "OpenEXR install dir will be: ${OPENEXR_INSTALL_DIR}"
echo "CMAKE_PREFIX_PATH is ${CMAKE_PREFIX_PATH}"
echo "OpenEXR Build type is ${OPENEXR_BUILD_TYPE}"
@@ -42,19 +41,21 @@ mkdir -p ${OPENEXR_INSTALL_DIR} && true
mkdir -p ${OPENEXR_BUILD_DIR} && true
pushd ${OPENEXR_SOURCE_DIR}
git checkout ${OPENEXR_BRANCH} --force
git checkout ${OPENEXR_VERSION} --force
if [[ ${OPENEXR_BRANCH} == "v2.2.0" ]] || [[ ${OPENEXR_BRANCH} == "v2.2.1" ]] ; then
if [[ ${OPENEXR_VERSION} == "v2.2.0" ]] || [[ ${OPENEXR_VERSION} == "v2.2.1" ]] \
|| [[ ${OPENEXR_VERSION} == "v2.2.2" ]] ; then
mkdir -p ${OPENEXR_BUILD_DIR}/IlmBase && true
mkdir -p ${OPENEXR_BUILD_DIR}/OpenEXR && true
cd ${OPENEXR_BUILD_DIR}/IlmBase
cmake --config ${OPENEXR_BUILD_TYPE} ${OPENEXR_GENERATOR_CMD} \
cmake -DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} ${OPENEXR_GENERATOR_CMD} \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
-DCMAKE_CXX_STANDARD=11 \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}/IlmBase
time cmake --build . --target install --config ${OPENEXR_BUILD_TYPE}
cd ${OPENEXR_BUILD_DIR}/OpenEXR
cmake --config ${OPENEXR_BUILD_TYPE} ${OPENEXR_GENERATOR_CMD} \
cmake -DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} ${OPENEXR_GENERATOR_CMD} \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}\;${OPENEXR_INSTALL_DIR}" \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
@@ -62,10 +63,10 @@ if [[ ${OPENEXR_BRANCH} == "v2.2.0" ]] || [[ ${OPENEXR_BRANCH} == "v2.2.1" ]] ;
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}/OpenEXR
time cmake --build . --target install --config ${OPENEXR_BUILD_TYPE}
elif [[ ${OPENEXR_BRANCH} == "v2.3.0" ]] ; then
elif [[ ${OPENEXR_VERSION} == "v2.3.0" ]] ; then
# Simplified setup for 2.3+
cd ${OPENEXR_BUILD_DIR}
cmake --config ${OPENEXR_BUILD_TYPE} -G "$CMAKE_GENERATOR" \
cmake -DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} -G "$CMAKE_GENERATOR" \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
@@ -78,7 +79,7 @@ elif [[ ${OPENEXR_BRANCH} == "v2.3.0" ]] ; then
else
# Simplified setup for 2.4+
cd ${OPENEXR_BUILD_DIR}
cmake --config ${OPENEXR_BUILD_TYPE} -G "$CMAKE_GENERATOR" \
cmake -DCMAKE_BUILD_TYPE=${OPENEXR_BUILD_TYPE} -G "$CMAKE_GENERATOR" \
-DCMAKE_INSTALL_PREFIX="${OPENEXR_INSTALL_DIR}" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
-DILMBASE_PACKAGE_PREFIX="${OPENEXR_INSTALL_DIR}" \
@@ -86,6 +87,8 @@ else
-DBUILD_TESTING=0 \
-DPYILMBASE_ENABLE=0 \
-DOPENEXR_VIEWERS_ENABLE=0 \
-DINSTALL_OPENEXR_EXAMPLES=0 \
-DOPENEXR_INSTALL_EXAMPLES=0 \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_CXX_FLAGS="${OPENEXR_CXX_FLAGS}" \
${OPENEXR_CMAKE_FLAGS} ${OPENEXR_SOURCE_DIR}
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
# Utility script to download and build pugixml
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of pugixml to download if we don't have it yet
PUGIXML_REPO=${PUGIXML_REPO:=https://github.com/zeux/pugixml.git}
PUGIXML_VERSION=${PUGIXML_VERSION:=v1.11.4}
# Where to put pugixml repo source (default to the ext area)
PUGIXML_SRC_DIR=${PUGIXML_SRC_DIR:=${PWD}/ext/pugixml}
# Temp build area (default to a build/ subdir under source)
PUGIXML_BUILD_DIR=${PUGIXML_BUILD_DIR:=${PUGIXML_SRC_DIR}/build}
# Install area for pugixml (default to ext/dist)
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
PUGIXML_INSTALL_DIR=${PUGIXML_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
#PUGIXML_BUILD_OPTS=${PUGIXML_BUILD_OPTS:=}
pwd
echo "pugixml install dir will be: ${PUGIXML_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone pugixml project from GitHub and build
if [[ ! -e ${PUGIXML_SRC_DIR} ]] ; then
echo "git clone ${PUGIXML_REPO} ${PUGIXML_SRC_DIR}"
git clone ${PUGIXML_REPO} ${PUGIXML_SRC_DIR}
fi
cd ${PUGIXML_SRC_DIR}
echo "git checkout ${PUGIXML_VERSION} --force"
git checkout ${PUGIXML_VERSION} --force
mkdir -p ${PUGIXML_BUILD_DIR}
cd ${PUGIXML_BUILD_DIR}
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PUGIXML_INSTALL_DIR} \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTS=OFF \
${PUGIXML_BUILD_OPTS} ..
time cmake --build . --config Release --target install
# ls -R ${PUGIXML_INSTALL_DIR}
popd
#echo "listing .."
#ls ..
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export pugixml_ROOT=$PUGIXML_INSTALL_DIR
export LD_LIBRARY_PATH=$pugixml_ROOT/lib:$pugixml_ROOT/lib64:$LD_LIBRARY_PATH
+5 -6
View File
@@ -7,8 +7,7 @@ set -ex
# Repo and branch/tag/commit of pybind11 to download if we don't have it yet
PYBIND11_REPO=${PYBIND11_REPO:=https://github.com/pybind/pybind11.git}
PYBIND11_VERSION=${PYBIND11_VERSION:=2.4.3}
PYBIND11_BRANCH=${PYBIND11_BRANCH:=v${PYBIND11_VERSION}}
PYBIND11_VERSION=${PYBIND11_VERSION:=v2.5.0}
# Where to put pybind11 repo source (default to the ext area)
PYBIND11_SRC_DIR=${PYBIND11_SRC_DIR:=${PWD}/ext/pybind11}
@@ -35,18 +34,18 @@ if [[ ! -e ${PYBIND11_SRC_DIR} ]] ; then
git clone ${PYBIND11_REPO} ${PYBIND11_SRC_DIR}
fi
cd ${PYBIND11_SRC_DIR}
echo "git checkout ${PYBIND11_BRANCH} --force"
git checkout ${PYBIND11_BRANCH} --force
echo "git checkout ${PYBIND11_VERSION} --force"
git checkout ${PYBIND11_VERSION} --force
mkdir -p ${PYBIND11_BUILD_DIR}
cd ${PYBIND11_BUILD_DIR}
time cmake --config Release \
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PYBIND11_INSTALL_DIR} \
-DPYBIND11_TEST=OFF \
${PYBIND11_BUILD_OPTS} ..
time cmake --build . --config Release --target install
ls -R ${PYBIND11_INSTALL_DIR}
# ls -R ${PYBIND11_INSTALL_DIR}
popd
#echo "listing .."
+62
View File
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
# Utility script to download and build webp
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of webp to download if we don't have it yet
WEBP_REPO=${WEBP_REPO:=https://github.com/webmproject/libwebp.git}
WEBP_VERSION=${WEBP_VERSION:=v1.1.0}
# Where to put webp repo source (default to the ext area)
LOCAL_DEPS_DIR=${LOCAL_DEPS_DIR:=${PWD}/ext}
WEBP_SRC_DIR=${WEBP_SRC_DIR:=${LOCAL_DEPS_DIR}/webp}
WEBP_BUILD_DIR=${WEBP_BUILD_DIR:=${WEBP_SRC_DIR}/build}
WEBP_INSTALL_DIR=${WEBP_INSTALL_DIR:=${LOCAL_DEPS_DIR}/dist}
#WEBP_CONFIG_OPTS=${WEBP_CONFIG_OPTS:=}
pwd
echo "webp install dir will be: ${WEBP_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone webp project from GitHub and build
if [[ ! -e ${WEBP_SRC_DIR} ]] ; then
echo "git clone ${WEBP_REPO} ${WEBP_SRC_DIR}"
git clone ${WEBP_REPO} ${WEBP_SRC_DIR}
fi
cd ${WEBP_SRC_DIR}
echo "git checkout ${WEBP_VERSION} --force"
git checkout ${WEBP_VERSION} --force
mkdir -p ${WEBP_BUILD_DIR}
cd ${WEBP_BUILD_DIR}
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${WEBP_INSTALL_DIR} \
-DWEBP_BUILD_ANIM_UTILS=OFF \
-DWEBP_BUILD_CWEBP=OFF \
-DWEBP_BUILD_DWEBP=OFF \
-DWEBP_BUILD_VWEBP=OFF \
-DWEBP_BUILD_GIF2WEBPx=OFF \
-DWEBP_BUILD_IMG2WEBP=OFF \
-DWEBP_BUILD_EXTRAS=OFF \
-DBUILD_SHARED_LIBS=ON \
${WEBP_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
# ls -R ${WEBP_INSTALL_DIR}
popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export WebP_ROOT=$WEBP_INSTALL_DIR
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
# Utility script to download and build zlib
#
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Exit the whole script if any command fails.
set -ex
# Repo and branch/tag/commit of zlib to download if we don't have it yet
ZLIB_REPO=${ZLIB_REPO:=https://github.com/madler/zlib.git}
ZLIB_VERSION=${ZLIB_VERSION:=v1.2.11}
# Where to put zlib repo source (default to the ext area)
ZLIB_SRC_DIR=${ZLIB_SRC_DIR:=${PWD}/ext/zlib}
# Temp build area (default to a build/ subdir under source)
ZLIB_BUILD_DIR=${ZLIB_BUILD_DIR:=${ZLIB_SRC_DIR}/build}
# Install area for zlib (default to ext/dist)
ZLIB_INSTALL_DIR=${ZLIB_INSTALL_DIR:=${PWD}/ext/dist}
#ZLIB_CONFIG_OPTS=${ZLIB_CONFIG_OPTS:=}
pwd
echo "zlib install dir will be: ${ZLIB_INSTALL_DIR}"
mkdir -p ./ext
pushd ./ext
# Clone zlib project from GitHub and build
if [[ ! -e ${ZLIB_SRC_DIR} ]] ; then
echo "git clone ${ZLIB_REPO} ${ZLIB_SRC_DIR}"
git clone ${ZLIB_REPO} ${ZLIB_SRC_DIR}
fi
cd ${ZLIB_SRC_DIR}
echo "git checkout ${ZLIB_VERSION} --force"
git checkout ${ZLIB_VERSION} --force
mkdir -p ${ZLIB_BUILD_DIR} && true
cd ${ZLIB_BUILD_DIR}
time cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${ZLIB_INSTALL_DIR} \
${ZLIB_CONFIG_OPTS} ..
time cmake --build . --config Release --target install
# ls -R ${ZLIB_INSTALL_DIR}
popd
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
export ZLIB_ROOT=$ZLIB_INSTALL_DIR
-63
View File
@@ -1,63 +0,0 @@
#!/usr/bin/env bash
# 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
# This script is run when CI system first starts up.
# It expects that ci-setenv.bash was run first, so $PLATFORM and $ARCH
# have been set.
if [[ -e src/build-scripts/ci-setenv.bash ]] ; then
source src/build-scripts/ci-setenv.bash
fi
if [[ ! -e build/$PLATFORM ]] ; then
mkdir -p build/$PLATFORM
fi
if [[ ! -e dist/$PLATFORM ]] ; then
mkdir -p dist/$PLATFORM
fi
if [[ "$ARCH" == "windows64" ]] ; then
pushd build/$PLATFORM
cmake ../.. -G "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX="$OpenImageIO_ROOT" \
-DPYTHON_VERSION="$PYTHON_VERSION" \
$MY_CMAKE_FLAGS -DVERBOSE=1
echo "Parallel build $CMAKE_BUILD_PARALLEL_LEVEL"
# export VERBOSE=1
time cmake --build . --target install --config ${CMAKE_BUILD_TYPE}
popd
else
make $MAKEFLAGS VERBOSE=1 $BUILD_FLAGS config
make $MAKEFLAGS $PAR_MAKEFLAGS $BUILD_FLAGS $BUILDTARGET
fi
echo "OpenImageIO_ROOT $OpenImageIO_ROOT"
ls -R -l "$OpenImageIO_ROOT"
if [[ -e ./build/$PLATFORM/src/include/export.h ]] ; then
echo "export.h is:"
cat ./build/$PLATFORM/src/include/export.h
fi
if [[ "$SKIP_TESTS" == "" ]] ; then
$OpenImageIO_ROOT/bin/oiiotool --help
make $BUILD_FLAGS test
fi
if [[ "$BUILDTARGET" == clang-format ]] ; then
git diff --color
THEDIFF=`git diff`
if [[ "$THEDIFF" != "" ]] ; then
echo "git diff was not empty. Failing clang-format or clang-tidy check."
exit 1
fi
fi
# if [[ "$CODECOV" == 1 ]] ; then
# bash <(curl -s https://codecov.io/bash)
# fi
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# 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
if [[ "$USE_SIMD" != "" ]] ; then
MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"
fi
pushd build/$PLATFORM
cmake ../.. -G "$CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX="$OpenImageIO_ROOT" \
-DPYTHON_VERSION="$PYTHON_VERSION" \
-DCMAKE_INSTALL_LIBDIR="$OpenImageIO_ROOT/lib" \
-DCMAKE_CXX_STANDARD="$CMAKE_CXX_STANDARD" \
$MY_CMAKE_FLAGS -DVERBOSE=1
if [[ "$BUILDTARGET" != "none" ]] ; then
echo "Parallel build " ${CMAKE_BUILD_PARALLEL_LEVEL}
time cmake --build . --target ${BUILDTARGET:=install} --config ${CMAKE_BUILD_TYPE}
fi
popd
if [[ "${DEBUG_CI:=0}" != "0" ]] ; then
echo "PATH=$PATH"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
echo "PYTHONPATH=$PYTHONPATH"
echo "ldd oiiotool"
ldd $OpenImageIO_ROOT/bin/oiiotool
fi
if [[ "$BUILDTARGET" == clang-format ]] ; then
git diff --color
THEDIFF=`git diff`
if [[ "$THEDIFF" != "" ]] ; then
echo "git diff was not empty. Failing clang-format or clang-tidy check."
exit 1
fi
fi
+43 -25
View File
@@ -5,18 +5,21 @@
# with 'source', not in a separate shell.
# Figure out the platform
if [[ $TRAVIS_OS_NAME == osx || $RUNNER_OS == macOS ]] ; then
export ARCH=macosx
fi
if [[ $TRAVIS_OS_NAME == linux || $RUNNER_OS == Linux || $CIRCLECI == true ]] ; then
export ARCH=linux64
fi
if [[ $RUNNER_OS == Windows ]] ; then
export ARCH=windows64
if [[ $RUNNER_OS == macOS ]] ; then
export ARCH=macosx
elif [[ $RUNNER_OS == Linux ]] ; then
export ARCH=linux64
elif [[ $RUNNER_OS == Windows ]] ; then
export ARCH=windows64
elif [[ `uname -m` == aarch64 ]] ; then
export ARCH=aarch64
else
export ARCH=unknown
exit -1
fi
export PLATFORM=$ARCH
if [[ "$DEBUG" == 1 ]] ; then
if [[ "${DEBUG:=0}" != "0" ]] ; then
export PLATFORM=${PLATFORM}.debug
fi
@@ -24,8 +27,15 @@ echo "Architecture is $ARCH"
echo "Build platform name is $PLATFORM"
# Environment variables we always need
export PATH=/usr/local/bin/_ccache:/usr/lib/ccache:$PATH
export USE_CCACHE=${USE_CCACHE:=1}
export CCACHE_CPP2=1
export CCACHE_CPP2=
export CCACHE_DIR=/tmp/ccache
if [[ "${RUNNER_OS}" == "macOS" ]] ; then
export CCACHE_DIR=$HOME/.ccache
fi
mkdir -p $CCACHE_DIR
export OpenImageIO_ROOT=$PWD/dist/$PLATFORM
export DYLD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$OpenImageIO_ROOT/lib:$LD_LIBRARY_PATH
@@ -43,32 +53,40 @@ export CI=true
export USE_NINJA=${USE_NINJA:=1}
export CMAKE_GENERATOR=${CMAKE_GENERATOR:=Ninja}
export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:=Release}
export CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD:=11}
if [[ $TRAVIS == true ]] ; then
export PARALLEL=2
elif [[ $CIRCLECI == true ]] ; then
export PARALLEL=4
elif [[ $GITHUB_ACTIONS == true ]] ; then
export PARALLEL=4
fi
export PARALLEL=${PARALLEL:=4}
export PAR_MAKEFLAGS=-j${PARALLEL}
export CMAKE_BUILD_PARALLEL_LEVEL=${PARALLEL}
export CTEST_PARALLEL_LEVEL=${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}/bin:$PATH
export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/lib:$DYLD_LIBRARY_PATH
export PATH=${LOCAL_DEPS_DIR}/dist/bin:$PATH
export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib64:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=${LOCAL_DEPS_DIR}/dist/lib:$DYLD_LIBRARY_PATH
uname -a
uname -n
export OCIO="$PWD/testsuite/common/OpenColorIO/nuke-default/config.ocio"
export TESTSUITE_CLEANUP_ON_SUCCESS=${TESTSUITE_CLEANUP_ON_SUCCESS:=1}
mkdir -p build/$PLATFORM dist/$PLATFORM
echo "HOME = $HOME"
echo "PWD = $PWD"
echo "LOCAL_DEPS_DIR = $LOCAL_DEPS_DIR"
echo "uname -a: " `uname -a`
echo "uname -m: " `uname -m`
echo "uname -s: " `uname -s`
echo "uname -n: " `uname -n`
pwd
ls
env | sort
if [[ $ARCH == linux64 ]] ; then
if [[ `uname -s` == "Linux" ]] ; then
head -40 /proc/cpuinfo
elif [[ $ARCH == macosx ]] ; then
sysctl machdep.cpu.features
fi
# Save the env for use by other stages
src/build-scripts/save-env.bash
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# 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
$OpenImageIO_ROOT/bin/oiiotool --help || true
echo "Parallel test " ${CTEST_PARALLEL_LEVEL}
pushd build/$PLATFORM
time ctest -C ${CMAKE_BUILD_TYPE} -E broken --force-new-ctest-process \
--output-on-failure --timeout ${CTEST_TEST_TIMEOUT:=180} ${CTEST_ARGS}
popd
# if [[ "$CODECOV" == 1 ]] ; then
# bash <(curl -s https://codecov.io/bash)
# fi
@@ -1,48 +0,0 @@
#!/usr/bin/env bash
#
set -ex
echo "Which g++ " `which g++`
g++ --version && true
ls /usr/bin/g++* && true
/usr/bin/g++ --version && true
export PATH=/opt/rh/devtoolset-6/root/usr/bin:/usr/local/bin:$PATH
#ls /opt/rh/devtoolset-6/root/usr/bin && true
#ls /usr/local/bin
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 Field3D Field3D-devel && true
#sudo rpm -v --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro && true
#sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm && true
sudo yum install -y ffmpeg ffmpeg-devel && true
if [[ "$CXX" == "clang++" ]] ; then
source src/build-scripts/build_llvm.bash
fi
src/build-scripts/install_test_images.bash
source src/build-scripts/build_pybind11.bash
if [[ "$OPENEXR_BRANCH" != "" || "$OPENEXR_VERSION" != "" ]] ; then
source src/build-scripts/build_openexr.bash
fi
if [[ "$LIBTIFF_BRANCH" != "" || "$LIBTIFF_VERSION" != "" ]] ; then
source src/build-scripts/build_libtiff.bash
fi
if [[ "$OCIO_BRANCH" != "" || "$OCIO_VERSION" != "" ]] ; then
# Temporary (?) fix: GH ninja having problems, fall back to make
CMAKE_GENERATOR="Unix Makefiles" \
source src/build-scripts/build_ocio.bash
fi
+116 -65
View File
@@ -3,85 +3,136 @@
set -ex
#dpkg --list
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
time sudo apt-get update
#
# Install system packages when those are acceptable for dependencies.
#
if [[ "$ASWF_ORG" != "" ]] ; then
# Using ASWF CentOS container
time sudo apt-get -q install -y \
git \
cmake \
ninja-build \
g++ \
ccache \
libboost-dev libboost-thread-dev \
libboost-filesystem-dev libboost-regex-dev \
libtiff-dev \
libilmbase-dev libopenexr-dev \
python-dev python-numpy \
libgif-dev \
libpng-dev \
libraw-dev \
libwebp-dev \
libfreetype6-dev \
libavcodec-dev libavformat-dev libswscale-dev libavutil-dev \
locales \
opencolorio-tools \
wget \
libtbb-dev \
libopenvdb-dev \
libopencv-dev \
ptex-base \
dcmtk \
libsquish-dev \
qt5-default \
libhdf5-dev
export PATH=/opt/rh/devtoolset-6/root/usr/bin:/usr/local/bin:$PATH
# Disable libheif on CI for now... seems to make crashes in CI tests.
# Works fine for me in real life. Investigate.
#if [[ "$USE_LIBHEIF" != "0" ]] ; then
# sudo add-apt-repository ppa:strukturag/libde265
# sudo add-apt-repository ppa:strukturag/libheif
# time sudo apt-get -q install -y libheif-dev
#fi
#ls /etc/yum.repos.d
export CMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu:$CMAKE_PREFIX_PATH
sudo yum install -y giflib giflib-devel && true
sudo yum install -y opencv opencv-devel && true
sudo yum install -y Field3D Field3D-devel && true
sudo yum install -y ffmpeg ffmpeg-devel && true
if [[ "${EXTRA_DEP_PACKAGES}" != "" ]] ; then
time sudo yum install -y ${EXTRA_DEP_PACKAGES}
fi
else
# Using native Ubuntu runner
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
time sudo apt-get update
time sudo apt-get -q install -y \
git cmake ninja-build ccache g++ \
libboost-dev libboost-thread-dev \
libboost-filesystem-dev libboost-regex-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 libsquish-dev libopenvdb-dev \
libfreetype6-dev \
locales wget \
libopencolorio-dev \
libopencv-dev \
qt5-default \
libhdf5-dev
if [[ "${EXTRA_DEP_PACKAGES}" != "" ]] ; then
time sudo apt-get -q install -y ${EXTRA_DEP_PACKAGES}
fi
# 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 [[ "$USE_LIBHEIF" != "0" ]] ; then
sudo add-apt-repository ppa:strukturag/libde265
sudo add-apt-repository ppa:strukturag/libheif
time sudo apt-get -q install -y libheif-dev
fi
export CMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu:$CMAKE_PREFIX_PATH
if [[ "$CXX" == "g++-4.8" ]] ; then
time sudo apt-get install -y g++-4.8
elif [[ "$CXX" == "g++-6" ]] ; then
time sudo apt-get install -y g++-6
elif [[ "$CXX" == "g++-7" ]] ; then
time sudo apt-get install -y g++-7
elif [[ "$CXX" == "g++-8" ]] ; then
time sudo apt-get install -y g++-8
elif [[ "$CXX" == "g++-9" ]] ; then
time sudo apt-get install -y g++-9
elif [[ "$CXX" == "g++-10" ]] ; then
time sudo apt-get install -y g++-10
elif [[ "$CXX" == "g++-11" ]] ; then
time sudo apt-get install -y g++-11
fi
if [[ "$CXX" == "g++-4.8" ]] ; then
time sudo apt-get install -y g++-4.8
elif [[ "$CXX" == "g++-6" ]] ; then
time sudo apt-get install -y g++-6
elif [[ "$CXX" == "g++-7" ]] ; then
time sudo apt-get install -y g++-7
elif [[ "$CXX" == "g++-8" ]] ; then
time sudo apt-get install -y g++-8
elif [[ "$CXX" == "g++-9" ]] ; then
time sudo apt-get install -y g++-9
fi
# time sudo apt-get install -y clang
# time sudo apt-get install -y llvm
#time sudo apt-get install -y libopenjpeg-dev
#time sudo apt-get install -y libjpeg-turbo8-dev
echo "Which python3 " `which python3`
python3 --version && true
cmake --version
#dpkg --list
if [[ "$CXX" == "clang++" ]] ; then
#
# 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
source src/build-scripts/build_llvm.bash
fi
src/build-scripts/install_test_images.bash
CXX="ccache $CXX" source src/build-scripts/build_pybind11.bash
CXX="ccache $CXX" source src/build-scripts/build_openexr.bash
#
# Packages we need to build from scratch.
#
if [[ "$LIBTIFF_BRANCH" != "" ]] ; then
CXX="ccache $CXX" source src/build-scripts/build_libtiff.bash
source src/build-scripts/build_pybind11.bash
if [[ "$OPENEXR_VERSION" != "" ]] ; then
source src/build-scripts/build_openexr.bash
fi
# Temporary (?) fix: GH ninja having problems, fall back to make
CMAKE_GENERATOR="Unix Makefiles" \
CXX="ccache $CXX" source src/build-scripts/build_ocio.bash
if [[ "$WEBP_VERSION" != "" ]] ; then
source src/build-scripts/build_webp.bash
fi
if [[ "$LIBTIFF_VERSION" != "" ]] ; then
source src/build-scripts/build_libtiff.bash
fi
if [[ "$LIBRAW_VERSION" != "" ]] ; then
source src/build-scripts/build_libraw.bash
fi
if [[ "$PUGIXML_VERSION" != "" ]] ; then
source src/build-scripts/build_pugixml.bash
export MY_CMAKE_FLAGS+=" -DUSE_EXTERNAL_PUGIXML=1 "
fi
if [[ "$OPENCOLORIO_VERSION" != "" ]] ; then
source src/build-scripts/build_opencolorio.bash
fi
if [[ "$PTEX_VERSION" != "" ]] ; then
source src/build-scripts/build_Ptex.bash
fi
src/build-scripts/install_test_images.bash
# Save the env for use by other stages
src/build-scripts/save-env.bash
+94 -68
View File
@@ -4,92 +4,127 @@
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
if [[ ! -e build/$PLATFORM ]] ; then
mkdir -p build/$PLATFORM
fi
if [[ ! -e dist/$PLATFORM ]] ; then
mkdir -p dist/$PLATFORM
fi
# DEP_DIR="$PWD/ext/dist"
DEP_DIR="$PWD/dist/$PLATFORM"
mkdir -p "$DEP_DIR"
mkdir -p ext && true
INT_DIR="build/$PLATFORM"
VCPKG_INSTALLATION_ROOT=/c/vcpkg
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH:=.}
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$DEP_DIR"
export BOOST_ROOT=${BOOST_ROOT_1_72_0}
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$BOOST_ROOT"
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$VCPKG_INSTALLATION_ROOT/installed/x64-windows"
export PATH="$PATH:$DEP_DIR/bin:$DEP_DIR/lib:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin:/bin"
export PATH="$PATH:$DEP_DIR/bin:$DEP_DIR/lib:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin:/bin:$PWD/ext/dist/bin:$PWD/ext/dist/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DEP_DIR/bin:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DEP_DIR/lib:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib"
# export MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
# export OPENEXR_CMAKE_FLAGS="$OPENEXR_CMAKE_FLAGS -DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
ls -l "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC"
#ls -l "C:/Program Files (x86)/Microsoft Visual Studio/*/Enterprise/VC/Tools/MSVC" && true
#ls -l "C:/Program Files (x86)/Microsoft Visual Studio" && true
if [[ "$PYTHON_VERSION" == "3.6" ]] ; then
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/c/hostedtoolcache/windows/Python/3.6.8/x64"
else
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/c/hostedtoolcache/windows/Python/3.7.9/x64"
export Python_EXECUTABLE="/c/hostedtoolcache/windows/Python/3.7.9/x64/python.exe"
export PYTHONPATH=$OpenImageIO_ROOT/lib/python${PYTHON_VERSION}/site-packages
fi
pip install numpy
########################################################################
# Dependency method #1: Use vcpkg (disabled)
#
# Currently we are not using this, but here it is for reference:
#
echo "All pre-installed VCPkg installs:"
vcpkg list
vcpkg update
echo "---------------"
# vcpkg update
#
# vcpkg install zlib:x64-windows
time vcpkg install boost-asio:x64-windows
time vcpkg install boost-container:x64-windows
time vcpkg install boost-filesystem:x64-windows
time vcpkg install boost-math:x64-windows
time vcpkg install boost-regex:x64-windows
time vcpkg install boost-stacktrace:x64-windows
time vcpkg install boost-system:x64-windows
time vcpkg install boost-thread:x64-windows
time vcpkg install boost-tokenizer:x64-windows
# # vcpkg install zlib:x64-windows
vcpkg install tiff:x64-windows
vcpkg install libpng:x64-windows
vcpkg install giflib:x64-windows
# vcpkg install libpng:x64-windows
# vcpkg install giflib:x64-windows
vcpkg install freetype:x64-windows
# vcpkg install openexr:x64-windows
# vcpkg install libjpeg-turbo:x64-windows
vcpkg install libraw:x64-windows
vcpkg install openjpeg:x64-windows
vcpkg install libsquish:x64-windows
# vcpkg install ffmpeg:x64-windows # takes FOREVER!
# vcpkg install webp:x64-windows # No such vcpkg package?a
echo "$VCPKG_INSTALLATION_ROOT"
ls "$VCPKG_INSTALLATION_ROOT"
echo "$VCPKG_INSTALLATION_ROOT/installed/x64-windows"
ls "$VCPKG_INSTALLATION_ROOT/installed/x64-windows"
echo "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib"
ls "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib"
echo "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
ls "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
# # vcpkg install openexr:x64-windows
vcpkg install libjpeg-turbo:x64-windows
#
# vcpkg install libraw:x64-windows
# vcpkg install openjpeg:x64-windows
# vcpkg install libsquish:x64-windows
# # vcpkg install ffmpeg:x64-windows # takes FOREVER!
# # vcpkg install webp:x64-windows # No such vcpkg package?a
#
# #echo "$VCPKG_INSTALLATION_ROOT"
# #ls "$VCPKG_INSTALLATION_ROOT"
# #echo "$VCPKG_INSTALLATION_ROOT/installed/x64-windows"
# #ls "$VCPKG_INSTALLATION_ROOT/installed/x64-windows"
# #echo "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib"
# #ls "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib"
# #echo "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
# #ls "$VCPKG_INSTALLATION_ROOT/installed/x64-windows/bin"
#
# # 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 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib:$DEP_DIR/lib:$DEP_DIR/bin"
#
echo "All VCPkg installs:"
vcpkg list
#
########################################################################
# curl --location https://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-4.2.1-win64-shared.zip -o ffmpeg-libs.zip
# unzip ffmpeg-libs.zip
curl --location https://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-4.2.1-win64-dev.zip -o ffmpeg-dev.zip
unzip ffmpeg-dev.zip
ls
ls -R *ffmpeg*
FFmpeg_ROOT=$PWD/ffmpeg-4.2.1-win64-dev
########################################################################
# Dependency method #2: Build from source ourselves
#
#
# src/build-scripts/build_zlib.bash
# export ZLIB_ROOT=$PWD/ext/dist
# src/build-scripts/build_libpng.bash
# 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
# We're currently getting jpeg from vcpkg
# LIBJPEGTURBO_CONFIG_OPTS=-DWITH_SIMD=OFF
# # ^^ because we're too lazy to build nasm
# src/build-scripts/build_libjpeg-turbo.bash
# export JPEGTurbo_ROOT=$PWD/ext/dist
source src/build-scripts/build_pybind11.bash
#export pybind11_ROOT=$PWD/ext/dist
# curl --location https://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-4.2.1-win64-dev.zip -o ffmpeg-dev.zip
# unzip ffmpeg-dev.zip
# FFmpeg_ROOT=$PWD/ffmpeg-4.2.1-win64-dev
echo "CMAKE_PREFIX_PATH = $CMAKE_PREFIX_PATH"
mkdir ext
# ZLib
pushd ext
git clone -b v1.2.11 https://github.com/madler/zlib.git
cd zlib
mkdir -p $INT_DIR
cd $INT_DIR
cmake ../.. -G "$CMAKE_GENERATOR" -DCMAKE_CONFIGURATION_TYPES="$CMAKE_BUILD_TYPE" -DCMAKE_PREFIX_PATH="$DEP_DIR" -DCMAKE_INSTALL_PREFIX="$DEP_DIR"
cmake --build . --config $CMAKE_BUILD_TYPE --target install
popd
export MY_CMAKE_FLAGS="$MY_CMAKE_FLAGS -DZLIB_LIBRARY=$DEP_DIR/lib/zlib.lib"
export OPENEXR_CMAKE_FLAGS="$OPENEXR_CMAKE_FLAGS -DZLIB_LIBRARY=$DEP_DIR/lib/zlib.lib"
source src/build-scripts/build_pybind11.bash
OPENEXR_CXX_FLAGS=" /W1 /EHsc /DWIN32=1 "
#OPENEXR_BUILD_TYPE=$CMAKE_BUILD_TYPE
OPENEXR_INSTALL_DIR=$DEP_DIR
OPENEXR_BRANCH=v2.4.0
source src/build-scripts/build_openexr.bash
export PATH="$OPENEXR_INSTALL_DIR/bin:$OPENEXR_INSTALL_DIR/lib:$PATH"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PATH
@@ -101,22 +136,13 @@ echo "DEP_DIR $DEP_DIR :"
ls -R -l "$DEP_DIR"
# 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 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib:$DEP_DIR/lib:$DEP_DIR/bin"
src/build-scripts/install_test_images.bash
ls /c/hostedtoolcache/windows/Python
echo "/c/hostedtoolcache/windows/Python/3.6.8/x64"
ls /c/hostedtoolcache/windows/Python/3.6.8/x64
# source src/build-scripts/build_openexr.bash
# export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$ILMBASE_ROOT;$OPENEXR_ROOT"
# source src/build-scripts/build_ocio.bash
# source src/build-scripts/build_opencolorio.bash
if [[ "$PYTHON_VERSION" == "3.6" ]] ; then
export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;/c/hostedtoolcache/windows/Python/3.6.8/x64"
fi
# Save the env for use by other stages
src/build-scripts/save-env.bash
+30 -40
View File
@@ -16,63 +16,53 @@ if [[ `which brew` == "" ]] ; then
fi
brew update >/dev/null
#brew update >/dev/null
echo ""
echo "Before my brew installs:"
brew list --versions
if [[ "$BUILDTARGET" == "clang-format" ]] ; then
# If we are running for the sake of clang-format only, just install the
# bare minimum packages and return.
brew install --display-times ilmbase openexr llvm clang-format libtiff libpng boost ninja giflib
brew install --display-times python pybind11 && true
brew upgrade --display-times python && true
brew link --overwrite python
brew upgrade --display-times cmake && true
else
# All cases except for clang-format target, we need the dependencies.
brew install --display-times gcc ccache cmake ninja boost && true
brew link --overwrite gcc
brew install --display-times python && true
brew upgrade --display-times python && true
brew link --overwrite python
brew upgrade --display-times cmake && true
brew install --display-times libtiff ilmbase openexr opencolorio
brew install --display-times libpng giflib webp jpeg-turbo openjpeg
brew install --display-times freetype libraw dcmtk pybind11 numpy
brew install --display-times ffmpeg libheif libsquish
brew install --display-times openvdb tbb
brew install --display-times opencv qt ptex
# N.B.: seems that Homebrew has removed field3d, allow failure
brew install --display-times field3d && true
fi
if [[ "$LINKSTATIC" == "1" ]] ; then
brew install --display-times little-cms2 tinyxml szip
brew install --display-times homebrew/dupes/bzip2
brew install --display-times yaml-cpp --with-static-lib
fi
if [[ "$CLANG_TIDY" != "" ]] ; then
# If we are running for the sake of clang-tidy only, we will need
# a modern clang version not just the xcode one.
brew install --display-times llvm
fi
# All cases except for clang-format target, we need the dependencies.
brew install --display-times -q gcc ccache cmake ninja boost || true
brew link --overwrite gcc
brew unlink python@2.7 || true
brew unlink python@3.9 || true
brew unlink python@3.8 || true
brew link --overwrite --force python@${PYTHON_VERSION} || true
brew upgrade --display-times -q cmake || true
brew install --display-times -q libtiff imath openexr opencolorio
brew install --display-times -q libpng giflib webp jpeg-turbo openjpeg
brew install --display-times -q freetype libraw dcmtk pybind11 numpy || true
brew install --display-times -q ffmpeg libheif libsquish ptex || true
brew install --display-times -q tbb || true
# No OpenVDB until it's upgraded to use Imath 3
# brew install --display-times -q openvdb || true
brew install --display-times -q opencv || true
brew install --display-times -q qt@5
brew install --display-times -q field3d || true
echo ""
echo "After brew installs:"
brew list --versions
# Needed on some systems
pip install numpy
if [[ $PYTHON_VERSION != "2.7" ]] ; then
pip3 install numpy
else
pip install numpy
fi
# Set up paths. These will only affect the caller if this script is
# run with 'source' rather than in a separate shell.
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/Cellar/llvm/9.0.0*/bin:$PATH ;
export PATH=/usr/local/opt/llvm/bin:$PATH ;
# If field3d and hdf5 get even slightly out of sync, hdf5 will throw fits.
# This is unnecessary, so we disable the step to make CI more likely to
# pass in cases where they don't exactly match on the Travis/GH instances.
# pass in cases where they don't exactly match on the CI instances.
export HDF5_DISABLE_VERSION_CHECK=1
# Save the env for use by other stages
src/build-scripts/save-env.bash
+7 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
if [[ ! -e ../oiio-images ]] ; then
git clone https://github.com/OpenImageIO/oiio-images.git ../oiio-images
git clone -b RB-2.2 https://github.com/OpenImageIO/oiio-images.git ../oiio-images
fi
if [[ ! -e ../libtiffpic ]] ; then
@@ -12,3 +12,9 @@ fi
if [[ ! -e ../openexr-images ]] ; then
git clone https://github.com/openexr/openexr-images.git ../openexr-images
fi
if [[ ! -e ../bmpsuite ]] ; then
mkdir ../bmpsuite
curl -o bmpsuite.zip http://entropymine.com/jason/bmpsuite/bmpsuite.zip
unzip bmpsuite.zip -d ../bmpsuite
fi
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Save the env for use by other stages. Exclude things that we know aren't
# needed.
printenv \
| sort \
| grep -v ASWF_ \
| grep -v GITHUB_ \
| grep -v NVIDIA_ \
| grep -v RUNNER_ \
| grep -v _= \
| fgrep -v "\*" \
>> $GITHUB_ENV
echo "save-env: GITHUB_ENV=${GITHUB_ENV}"
cat $GITHUB_ENV
echo "---------"
+26 -25
View File
@@ -2,10 +2,11 @@
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
#include <cmath>
#include "libcineon/Cineon.h"
#include <OpenImageIO/dassert.h>
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imageio.h>
#include <OpenImageIO/strutil.h>
#include <OpenImageIO/typedesc.h>
@@ -180,7 +181,7 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
case cineon::kRec709Blue: m_spec.attribute("oiio:ColorSpace", "Rec709");
default:
// either grayscale or printing density
if (!isinf(m_cin.header.Gamma()) && m_cin.header.Gamma() != 0.0f)
if (!std::isinf(m_cin.header.Gamma()) && m_cin.header.Gamma() != 0.0f)
// actual gamma value is read later on
m_spec.attribute("oiio:ColorSpace",
Strutil::sprintf("GammaCorrected%.2g", g));
@@ -188,7 +189,7 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
}
// gamma exponent
if (!isinf(m_cin.header.Gamma()) && m_cin.header.Gamma() != 0.0f)
if (!std::isinf(m_cin.header.Gamma()) && m_cin.header.Gamma() != 0.0f)
m_spec.attribute("oiio:Gamma", (float)m_cin.header.Gamma());
#endif
@@ -222,40 +223,40 @@ CineonInput::open(const std::string& name, ImageSpec& newspec)
// per-file attribs
#define CINEON_SET_ATTRIB_S(x, n, s) m_spec.attribute(s, m_cin.header.x(n))
#define CINEON_SET_ATTRIB(x, n) CINEON_SET_ATTRIB_S(x, n, "cineon:" #x)
#define CINEON_SET_ATTRIB_BYTE(x) \
if (m_cin.header.x() != 0xFF) \
#define CINEON_SET_ATTRIB_BYTE(x) \
if (m_cin.header.x() != 0xFF) \
CINEON_SET_ATTRIB(x, )
#define CINEON_SET_ATTRIB_INT(x) \
if (static_cast<unsigned int>(m_cin.header.x()) != 0xFFFFFFFF) \
#define CINEON_SET_ATTRIB_INT(x) \
if (static_cast<unsigned int>(m_cin.header.x()) != 0xFFFFFFFF) \
CINEON_SET_ATTRIB(x, )
#define CINEON_SET_ATTRIB_FLOAT(x) \
if (!isinf(m_cin.header.x())) \
#define CINEON_SET_ATTRIB_FLOAT(x) \
if (!std::isinf(m_cin.header.x())) \
CINEON_SET_ATTRIB(x, )
#define CINEON_SET_ATTRIB_COORDS(x) \
m_cin.header.x(floats); \
if (!isinf(floats[0]) && !isinf(floats[1]) \
&& !(floats[0] == 0. && floats[1] == 0.)) \
#define CINEON_SET_ATTRIB_COORDS(x) \
m_cin.header.x(floats); \
if (!std::isinf(floats[0]) && !std::isinf(floats[1]) \
&& !(floats[0] == 0. && floats[1] == 0.)) \
m_spec.attribute("cineon:" #x, TypeDesc(TypeDesc::FLOAT, 2), &floats[0])
#define CINEON_SET_ATTRIB_STR(X, x) \
if (m_cin.header.x[0] && m_cin.header.x[0] != char(-1)) \
#define CINEON_SET_ATTRIB_STR(X, x) \
if (m_cin.header.x[0] && m_cin.header.x[0] != char(-1)) \
m_spec.attribute("cineon:" #X, m_cin.header.x)
// per-element attribs
#define CINEON_SET_ATTRIB_N(x, a, t, c) \
for (int i = 0; i < m_cin.header.NumberOfElements(); i++) { \
c(x) a[i] = m_cin.header.x(i); \
} \
m_spec.attribute("cineon:" #x, \
TypeDesc(TypeDesc::t, m_cin.header.NumberOfElements()), \
#define CINEON_SET_ATTRIB_N(x, a, t, c) \
for (int i = 0; i < m_cin.header.NumberOfElements(); i++) { \
c(x) a[i] = m_cin.header.x(i); \
} \
m_spec.attribute("cineon:" #x, \
TypeDesc(TypeDesc::t, m_cin.header.NumberOfElements()), \
&a)
#define CINEON_CHECK_ATTRIB_FLOAT(x) if (!isinf(m_cin.header.x(i)))
#define CINEON_SET_ATTRIB_FLOAT_N(x) \
#define CINEON_CHECK_ATTRIB_FLOAT(x) if (!std::isinf(m_cin.header.x(i)))
#define CINEON_SET_ATTRIB_FLOAT_N(x) \
CINEON_SET_ATTRIB_N(x, floats, FLOAT, CINEON_CHECK_ATTRIB_FLOAT)
#define CINEON_CHECK_ATTRIB_INT(x) if (m_cin.header.x(i) != 0xFFFFFFFF)
#define CINEON_SET_ATTRIB_INT_N(x) \
#define CINEON_SET_ATTRIB_INT_N(x) \
CINEON_SET_ATTRIB_N(x, ints, UINT32, CINEON_CHECK_ATTRIB_INT)
#define CINEON_CHECK_ATTRIB_BYTE(x) if (m_cin.header.x(i) != 0xFF)
#define CINEON_SET_ATTRIB_BYTE_N(x) \
#define CINEON_SET_ATTRIB_BYTE_N(x) \
CINEON_SET_ATTRIB_N(x, ints, UINT32, CINEON_CHECK_ATTRIB_BYTE)
CINEON_SET_ATTRIB_STR(Version, version);
@@ -41,6 +41,7 @@
#include <limits>
#include <OpenImageIO/strutil.h>
#include <OpenImageIO/sysutil.h>
#include "CineonHeader.h"
#include "EndianSwap.h"
@@ -540,7 +541,6 @@ void cineon::IndustryHeader::SetFilmEdgeCode(const char *edge)
void cineon::GenericHeader::SetCreationTimeDate(const long sec)
{
struct tm *tm_time;
char str[32];
#ifdef _WIN32
@@ -548,8 +548,9 @@ void cineon::GenericHeader::SetCreationTimeDate(const long sec)
#endif
const time_t t = time_t(sec);
tm_time = ::localtime(&t);
::strftime(str, 32, "%Y:%m:%d:%H:%M:%S%Z", tm_time);
struct tm localtm;
OIIO::Sysutil::get_local_time(&t, &localtm);
::strftime(str, 32, "%Y:%m:%d:%H:%M:%S%Z", &localtm);
OIIO::Strutil::safe_strcpy(this->creationDate, str, 11);
OIIO::Strutil::safe_strcpy(this->creationTime, str + 11, 12);
}
@@ -557,7 +558,6 @@ void cineon::GenericHeader::SetCreationTimeDate(const long sec)
void cineon::GenericHeader::SetSourceTimeDate(const long sec)
{
struct tm *tm_time;
char str[32];
#ifdef _WIN32
@@ -565,8 +565,9 @@ void cineon::GenericHeader::SetSourceTimeDate(const long sec)
#endif
const time_t t = time_t(sec);
tm_time = ::localtime(&t);
::strftime(str, 32, "%Y:%m:%d:%H:%M:%S%Z", tm_time);
struct tm localtm;
OIIO::Sysutil::get_local_time(&t, &localtm);
::strftime(str, 32, "%Y:%m:%d:%H:%M:%S%Z", &localtm);
OIIO::Strutil::safe_strcpy(this->sourceDate, str, 11);
OIIO::Strutil::safe_strcpy(this->sourceTime, str + 11, 12);
}
@@ -83,12 +83,13 @@ namespace cineon
void RleCompress(IB *src, IB *dst, const int bufsize, const int len, BufferAccess &access)
{
IB ch;
int count;
// int count;
int i;
int index = bufsize - 1;
bool start = true;
//bool match = true;
#if 0 /* This seems to not be used */
// for each data type, have maximum length of rle datum
// subtract one so it the LSBit can be used to state
int maxCount;
@@ -102,13 +103,13 @@ namespace cineon
maxCount = 0xffff - 1;
else
maxCount = 1000000; // high number for floats, doubles
#endif
for (i = len - 1; i >= 0; i--)
{
if (start)
{
count = 1;
// count = 1;
start = false;
ch = src[i];
dst[index--] = ch;
+16 -2
View File
@@ -3,12 +3,26 @@
include(CMakeFindDependencyMacro)
# add here all the find_dependency() whenever switching to config based dependencies
# e.g. if switching to Boost::Boost instead of using ${Boost_LIBRARY_DIRS} the add:
# find_dependency(Boost @Boost_VERSION@)
if (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 3.0)
find_dependency(Imath @Imath_VERSION@
HINTS @Imath_DIR@)
elseif (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 2.4 AND @FOUND_OPENEXR_WITH_CONFIG@)
find_dependency(IlmBase @OpenEXR_VERSION@
HINTS @IlmBase_DIR@ @OpenEXR_DIR@)
find_dependency(OpenEXR @OpenEXR_VERSION@
HINTS @OpenEXR_DIR@)
find_dependency(ZLIB @ZLIB_VERSION@) # Because OpenEXR doesn't do it
find_dependency(Threads) # Because OpenEXR doesn't do it
endif ()
set_and_check (@PROJECT_NAME@_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
set_and_check (@PROJECT_NAME@_INCLUDES "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
set_and_check (@PROJECT_NAME@_LIB_DIR "@CMAKE_INSTALL_FULL_LIBDIR@")
set (@PROJECT_NAME@_PLUGIN_SEARCH_PATH "@PLUGIN_SEARCH_PATH_NATIVE@")
if (NOT @FOUND_OPENEXR_WITH_CONFIG@)
list (APPEND @PROJECT_NAME@_INCLUDES ${IMATH_INCLUDES} ${OPENEXR_INCLUDES})
endif ()
#...logic to determine installedPrefix from the own location...
#set (@PROJECT_NAME@_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@")
+80
View File
@@ -0,0 +1,80 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Macro to add a build target for an IO plugin.
#
# Usage:
#
# add_oiio_plugin ( source1 [source2 ...]
# [ NAME targetname ... ]
# [ SRC source1 ... ]
# [ INCLUDE_DIRS include_dir1 ... ]
# [ LINK_LIBRARIES external_lib1 ... ]
# [ DEFINITIONS -DFOO=bar ... ])
#
# The plugin name can be specified with NAME, otherwise is inferred from the
# subdirectory name. The source files of the binary can be specified with
# SRC, otherwise are inferred to be all the .cpp files within the
# subdirectory. Optional compile DEFINITIONS, private INCLUDE_DIRS, and
# private LINK_LIBRARIES may also be specified. The source is automatically
# linked against OpenImageIO.
#
# The plugin may be disabled individually using any of the usual
# check_is_enabled() conventions (e.g. -DENABLE_<format>=OFF).
#
# What goes on under the covers is quite different depending on whether
# EMBEDPLUGINS is 0 or 1. If EMBEDPLUGINS is 0 (in which case this is
# expected to be called *after* the OpenImageIO target is declared), it will
# create a new target to build the full plugin. On the other hand, if
# EMBEDPLUGINS is 1 (in which case this should be called *before* the
# OpenImageIO target is declared), it will merely append the required
# definitions, includes, and libraries to lists format_plugin_blah that will
# be handed off too the setup of the later OpenImageIO target.
#
macro (add_oiio_plugin)
cmake_parse_arguments (_plugin "" "NAME" "SRC;INCLUDE_DIRS;LINK_LIBRARIES;DEFINITIONS" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
get_filename_component (_plugin_name ${CMAKE_CURRENT_SOURCE_DIR} NAME_WE)
if (NOT _plugin_NAME)
# If NAME is not supplied, infer target name (and therefore the
# executable name) from the directory name.
get_filename_component (_plugin_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
endif ()
# if (NOT _plugin_SRC)
# # If SRC is not supplied, assume local cpp files are its source.
# file (GLOB _plugin_SRC *.cpp)
# endif ()
check_is_enabled (${_plugin_name} _enable_plugin)
if (_enable_plugin)
if (EMBEDPLUGINS)
# Add each source file to the libOpenImageIO_srcs, but it takes some
# bending over backwards to change it in the parent scope.
set (_plugin_all_source ${libOpenImageIO_srcs})
foreach (_plugin_source_file ${_plugin_UNPARSED_ARGUMENTS} )
list (APPEND _plugin_all_source "${CMAKE_CURRENT_SOURCE_DIR}/${_plugin_source_file}")
endforeach ()
set (libOpenImageIO_srcs "${_plugin_all_source}" PARENT_SCOPE)
set (format_plugin_definitions ${format_plugin_definitions} ${_plugin_DEFINITIONS} PARENT_SCOPE)
set (format_plugin_include_dirs ${format_plugin_include_dirs} ${_plugin_INCLUDE_DIRS} PARENT_SCOPE)
set (format_plugin_libs ${format_plugin_libs} ${_plugin_LINK_LIBRARIES} PARENT_SCOPE)
else ()
# Get the name of the current directory and use it as the target name.
get_filename_component (_plugin_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
add_library (${_plugin_name} MODULE ${_plugin_UNPARSED_ARGUMENTS})
target_compile_definitions (${_plugin_name} PRIVATE
${_plugin_DEFINITIONS}
OpenImageIO_EXPORTS)
target_include_directories (${_plugin_name} PRIVATE ${_plugin_INCLUDE_DIRS})
target_link_libraries (${_plugin_name} PUBLIC OpenImageIO
PRIVATE ${_plugin_LINK_LIBRARIES})
set_target_properties (${_plugin_name} PROPERTIES PREFIX "" FOLDER "Plugins")
install_targets (${_plugin_name})
endif ()
else ()
message (STATUS "${ColorRed}Disabling ${_plugin_name} ${ColorReset}")
string (TOUPPER ${_plugin_name} _plugin_name_upper)
set (format_plugin_definitions ${format_plugin_definitions} DISABLE_${_plugin_name_upper} PARENT_SCOPE)
endif ()
endmacro ()
+1 -1
View File
@@ -5,7 +5,7 @@
# Is the named package "enabled" via our disabling convention? If either
# USE_pkgname (or the all-uppercase USE_PKGNAME, or ENABLE_pkgname, or
# ENABLE_PKGNAME) exists as either a CMake or environment variable, is
# nonempty by contains a non-true/nonnzero value, store false in the
# nonempty by contains a non-true/nonzero value, store false in the
# variable named by <enablevar>, otherwise store true.
function (check_is_enabled pkgname enablevar)
string (TOUPPER ${pkgname} pkgname_upper)
+170
View File
@@ -0,0 +1,170 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
set (REQUIRED_DEPS "" CACHE STRING
"Additional dependencies to consider required (semicolon-separated list, or ALL)")
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)
# checked_find_package(Pkgname ...) is a wrapper for find_package, with the
# following extra features:
# * If either `USE_Pkgname` or the all-uppercase `USE_PKGNAME` (or
# `ENABLE_Pkgname` or `ENABLE_PKGNAME`) exists as either a CMake or
# environment variable, is nonempty by contains a non-true/nonzero
# value, do not search for or use the package. The optional ENABLE <var>
# arguments allow you to override the name of the enabling variable. In
# other words, support for the dependency is presumed to be ON, unless
# turned off explicitly from one of these sources.
# * Print a message if the package is enabled but not found. This is based
# on ${Pkgname}_FOUND or $PKGNAME_FOUND.
# * Optional DEFINITIONS <string> are passed to add_definitions if the
# package is found.
# * Optional PRINT <list> is a list of variables that will be printed
# if the package is found, if VERBOSE is on.
# * Optional DEPS <list> is a list of hard dependencies; for each one, if
# dep_FOUND is not true, disable this package with an error message.
# * Optional ISDEPOF <downstream> names another package for which the
# present package is only needed because it's a dependency, and
# therefore if <downstream> is disabled, we don't bother with this
# package either.
# * Optional VERSION_MIN and VERSION_MAX, if supplied, give minimum and
# maximum versions that will be accepted. The min is inclusive, the max
# is exclusive (i.e., check for min <= version < max). Note that this is
# not the same as providing a version number to find_package, which
# checks compatibility, not minimum. Sometimes we really do just want to
# say a minimum or a range. (N.B. When our minimum CMake >= 3.19, the
# built-in way to do this is with version ranges passed to
# find_package.)
# * Optional RECOMMEND_MIN, if supplied, gives a minimum recommended
# version, accepting but warning if it is below this number (even
# if above the true minimum version accepted). The warning message
# can give an optional explanation, passed as RECOMMEND_MIN_REASON.
# * Optional PREFER_CONFIG, if supplied, tries to use an exported config
# file from the package before using a FindPackage.cmake module.
#
# 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,
# not merely the scope for this function.
macro (checked_find_package pkgname)
cmake_parse_arguments(_pkg # prefix
# noValueKeywords:
"REQUIRED;PREFER_CONFIG"
# singleValueKeywords:
"ENABLE;ISDEPOF;VERSION_MIN;VERSION_MAX;RECOMMEND_MIN;RECOMMEND_MIN_REASON"
# multiValueKeywords:
"DEFINITIONS;PRINT;DEPS"
# argsToParse:
${ARGN})
string (TOLOWER ${pkgname} pkgname_lower)
string (TOUPPER ${pkgname} pkgname_upper)
if (NOT VERBOSE)
set (${pkgname}_FIND_QUIETLY true)
set (${pkgname_upper}_FIND_QUIETLY true)
endif ()
if ("${pkgname}" IN_LIST REQUIRED_DEPS OR "ALL" IN_LIST REQUIRED_DEPS)
set (_pkg_REQUIRED 1)
endif ()
if ("${pkgname}" IN_LIST OPTIONAL_DEPS OR "ALL" IN_LIST OPTIONAL_DEPS)
set (_pkg_REQUIRED 0)
endif ()
set (_quietskip false)
check_is_enabled (${pkgname} _enable)
set (_disablereason "")
foreach (_dep ${_pkg_DEPS})
if (_enable AND NOT ${_dep}_FOUND)
set (_enable false)
set (ENABLE_${pkgname} OFF PARENT_SCOPE)
set (_disablereason "(because ${_dep} was not found)")
endif ()
endforeach ()
if (_pkg_ISDEPOF)
check_is_enabled (${_pkg_ISDEPOF} _dep_enabled)
if (NOT _dep_enabled)
set (_enable false)
set (_quietskip true)
endif ()
endif ()
set (_config_status "")
if (_enable OR _pkg_REQUIRED)
if (${pkgname}_FOUND OR ${pkgname_upper}_FOUND)
# was already found
elseif (_pkg_PREFER_CONFIG OR ALWAYS_PREFER_CONFIG)
find_package (${pkgname} CONFIG ${_pkg_UNPARSED_ARGUMENTS})
if (${pkgname}_FOUND OR ${pkgname_upper}_FOUND)
set (_config_status "from CONFIG")
endif ()
endif ()
if (NOT (${pkgname}_FOUND OR ${pkgname_upper}_FOUND))
find_package (${pkgname} ${_pkg_UNPARSED_ARGUMENTS})
endif()
if ((${pkgname}_FOUND OR ${pkgname_upper}_FOUND)
AND ${pkgname}_VERSION
AND (_pkg_VERSION_MIN OR _pkg_VERSION_MAX))
if ((_pkg_VERSION_MIN AND ${pkgname}_VERSION VERSION_LESS _pkg_VERSION_MIN)
OR (_pkg_VERSION_MAX AND ${pkgname}_VERSION VERSION_GREATER _pkg_VERSION_MAX))
message (STATUS "${ColorRed}${pkgname} ${${pkgname}_VERSION} is outside the required range ${_pkg_VERSION_MIN}...${_pkg_VERSION_MAX} ${ColorReset}")
unset (${pkgname}_FOUND)
unset (${pkgname}_VERSION)
unset (${pkgname_upper}_FOUND)
unset (${pkgname_upper}_VERSION)
endif ()
endif ()
if (${pkgname}_FOUND OR ${pkgname_upper}_FOUND)
foreach (_vervar ${pkgname_upper}_VERSION ${pkgname}_VERSION_STRING
${pkgname_upper}_VERSION_STRING)
if (NOT ${pkgname}_VERSION AND ${_vervar})
set (${pkgname}_VERSION ${${_vervar}})
endif ()
endforeach ()
message (STATUS "${ColorGreen}Found ${pkgname} ${${pkgname}_VERSION} ${_config_status}${ColorReset}")
if (VERBOSE)
set (_vars_to_print ${pkgname}_INCLUDES ${pkgname_upper}_INCLUDES
${pkgname}_INCLUDE_DIR ${pkgname_upper}_INCLUDE_DIR
${pkgname}_INCLUDE_DIRS ${pkgname_upper}_INCLUDE_DIRS
${pkgname}_LIBRARIES ${pkgname_upper}_LIBRARIES
${_pkg_PRINT})
list (REMOVE_DUPLICATES _vars_to_print)
foreach (_v IN LISTS _vars_to_print)
if (NOT "${${_v}}" STREQUAL "")
message (STATUS " ${_v} = ${${_v}}")
endif ()
endforeach ()
endif ()
add_definitions (${_pkg_DEFINITIONS})
if (_pkg_RECOMMEND_MIN)
if (${${pkgname}_VERSION} VERSION_LESS ${_pkg_RECOMMEND_MIN})
message (STATUS "${ColorYellow}Recommend ${pkgname} >= ${_pkg_RECOMMEND_MIN} ${_pkg_RECOMMEND_MIN_REASON} ${ColorReset}")
endif ()
endif ()
else ()
message (STATUS "${ColorRed}${pkgname} library not found ${ColorReset}")
if (${pkgname}_ROOT)
message (STATUS "${ColorRed} ${pkgname}_ROOT was: ${${pkgname}_ROOT} ${ColorReset}")
elseif ($ENV{${pkgname}_ROOT})
message (STATUS "${ColorRed} ENV ${pkgname}_ROOT was: ${${pkgname}_ROOT} ${ColorReset}")
else ()
message (STATUS "${ColorRed} Try setting ${pkgname}_ROOT ? ${ColorReset}")
endif ()
if (EXISTS "${PROJECT_SOURCE_DIR}/src/build-scripts/build_${pkgname}.bash")
message (STATUS "${ColorRed} Maybe this will help: src/build-scripts/build_${pkgname}.bash ${ColorReset}")
elseif (EXISTS "${PROJECT_SOURCE_DIR}/src/build-scripts/build_${pkgname_upper}.bash")
message (STATUS "${ColorRed} Maybe this will help: src/build-scripts/build_${pkgname_upper}.bash ${ColorReset}")
elseif (EXISTS "${PROJECT_SOURCE_DIR}/src/build-scripts/build_${pkgname_lower}.bash")
message (STATUS "${ColorRed} Maybe this will help: src/build-scripts/build_${pkgname_lower}.bash ${ColorReset}")
elseif (EXISTS "${PROJECT_SOURCE_DIR}/src/build-scripts/build_lib${pkgname_lower}.bash")
message (STATUS "${ColorRed} Maybe this will help: src/build-scripts/build_lib${pkgname_lower}.bash ${ColorReset}")
endif ()
if (_pkg_REQUIRED)
message (FATAL_ERROR "${ColorRed}${pkgname} is required, aborting.${ColorReset}")
endif ()
endif()
else ()
if (NOT _quietskip)
message (STATUS "${ColorRed}Not using ${pkgname} -- disabled ${_disablereason} ${ColorReset}")
endif ()
endif ()
endmacro()
+54 -47
View File
@@ -80,7 +80,11 @@ endif ()
###########################################################################
# Turn on more detailed warnings and optionally consider warnings as errors
#
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" ON)
if (${PROJECT_NAME}_SUPPORTED_RELEASE)
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" OFF)
else ()
option (STOP_ON_WARNING "Stop building if there are any compiler warnings" ON)
endif()
option (EXTRA_WARNINGS "Enable lots of extra pedantic warnings" OFF)
if (NOT MSVC)
add_compile_options ("-Wall")
@@ -89,9 +93,9 @@ if (NOT MSVC)
endif ()
if (STOP_ON_WARNING OR DEFINED ENV{CI})
add_compile_options ("-Werror")
# N.B. Force CI builds (Travis defines $CI) to use -Werror, even if
# STOP_ON_WARNING has been switched off by default, which we may do
# in release branches.
# N.B. Force CI builds to use -Werror, even if STOP_ON_WARNING has
# been switched off by default, which we may do in release
# branches.
endif ()
endif ()
@@ -116,7 +120,7 @@ if (${CXX_VISIBILITY_PRESET} STREQUAL "hidden" AND
(CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU"))
# Linux/FreeBSD/Hurd: also hide all the symbols of dependent libraries
# to prevent clashes if an app using this project is linked against
# other verions of our dependencies.
# other versions of our dependencies.
set (VISIBILITY_MAP_COMMAND "-Wl,--version-script=${VISIBILITY_MAP_FILE}")
endif ()
@@ -143,7 +147,7 @@ if (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG)
add_compile_options ("-Wno-unused-local-typedefs")
endif ()
if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 3.9)
# Don't warn about using unknown preprocessor symbols in #if'set
# Don't warn about using unknown preprocessor symbols in `#if`
add_compile_options ("-Wno-expansion-to-defined")
endif ()
endif ()
@@ -189,9 +193,9 @@ endif ()
# Use ccache if found
#
# This can really speed up compilation by caching object files that have
# been compiled previously with idential arguments and inputs. Putting this
# been compiled previously with identical arguments and inputs. Putting this
# logic here makes it work even if the user is unaware of ccache. If it's
# not found on the system, it will simply be silnetly not used.
# not found on the system, it will simply be silently not used.
option (USE_CCACHE "Use ccache if found" ON)
find_program (CCACHE_FOUND ccache)
if (CCACHE_FOUND AND USE_CCACHE)
@@ -236,8 +240,8 @@ endif ()
###########################################################################
# SIMD and machine architecture options.
#
# The USE_SIMD optinon may be set to a comma-separated list of machine /
# instruction set optinos, such as "avx3,f16c". The list will be parsed and
# The USE_SIMD option may be set to a comma-separated list of machine /
# instruction set options, such as "avx3,f16c". The list will be parsed and
# the proper compiler directives added to generate code for those ISA
# capabilities.
#
@@ -304,7 +308,7 @@ endif ()
# Check if we need libatomic on this platform. We shouldn't on mainstream
# x86/x86_64, but might on some other platforms.
#
if (NOT MSVC)
if (NOT MSVC AND NOT APPLE)
cmake_push_check_state ()
check_cxx_source_runs(
"#include <atomic>
@@ -432,43 +436,46 @@ endif ()
# correct any deviations. If clang-format is found on the system, a
# "clang-format" build target will trigger a reformatting.
#
set (CLANG_FORMAT_EXE_HINT "" CACHE PATH "clang-format executable's directory (will search if not specified")
set (CLANG_FORMAT_INCLUDES "src/*.h" "src/*.cpp"
CACHE STRING "Glob patterns to include for clang-format")
set (CLANG_FORMAT_EXCLUDES "*pugixml*" "*SHA1*" "*/farmhash.cpp" "*/tinyformat.h"
"src/dpx.imageio/libdpx/*"
"src/cineon.imageio/libcineon/*"
"src/dds.imageio/squish/*"
"src/gif.imageio/gif.h"
"src/hdr.imageio/rgbe.cpp"
"src/libutil/stb_sprintf.h"
CACHE STRING "Glob patterns to exclude for clang-format")
find_program (CLANG_FORMAT_EXE
NAMES clang-format bin/clang-format
HINTS ${CLANG_FORMAT_EXE_HINT} ENV CLANG_FORMAT_EXE_HINT
ENV LLVM_DIRECTORY
NO_DEFAULT_PATH
DOC "Path to clang-format executable")
find_program (CLANG_FORMAT_EXE NAMES clang-format bin/clang-format)
if (CLANG_FORMAT_EXE)
message (STATUS "clang-format found: ${CLANG_FORMAT_EXE}")
# Start with the list of files to include when formatting...
file (GLOB_RECURSE FILES_TO_FORMAT ${CLANG_FORMAT_INCLUDES})
# ... then process any list of excludes we are given
foreach (_pat ${CLANG_FORMAT_EXCLUDES})
file (GLOB_RECURSE _excl ${_pat})
list (REMOVE_ITEM FILES_TO_FORMAT ${_excl})
endforeach ()
#message (STATUS "clang-format file list: ${FILES_TO_FORMAT}")
file (COPY ${CMAKE_CURRENT_SOURCE_DIR}/.clang-format
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target (clang-format
COMMAND "${CLANG_FORMAT_EXE}" -i -style=file ${FILES_TO_FORMAT} )
else ()
message (STATUS "clang-format not found.")
# Note: skip all of this checking, setup, and cmake-format target if this
# is being built as a subproject.
if (NOT ${PROJECT_NAME}_IS_SUBPROJECT)
set (CLANG_FORMAT_EXE_HINT "" CACHE PATH "clang-format executable's directory (will search if not specified")
set (CLANG_FORMAT_INCLUDES "src/*.h" "src/*.cpp"
CACHE STRING "Glob patterns to include for clang-format")
set (CLANG_FORMAT_EXCLUDES "*pugixml*" "*SHA1*" "*/farmhash.cpp"
"src/dpx.imageio/libdpx/*"
"src/cineon.imageio/libcineon/*"
"src/dds.imageio/squish/*"
"src/gif.imageio/gif.h"
"src/hdr.imageio/rgbe.cpp"
"src/libutil/stb_sprintf.h"
CACHE STRING "Glob patterns to exclude for clang-format")
find_program (CLANG_FORMAT_EXE
NAMES clang-format bin/clang-format
HINTS ${CLANG_FORMAT_EXE_HINT} ENV CLANG_FORMAT_EXE_HINT
ENV LLVM_DIRECTORY
NO_DEFAULT_PATH
DOC "Path to clang-format executable")
find_program (CLANG_FORMAT_EXE NAMES clang-format bin/clang-format)
if (CLANG_FORMAT_EXE)
message (STATUS "clang-format found: ${CLANG_FORMAT_EXE}")
# Start with the list of files to include when formatting...
file (GLOB_RECURSE FILES_TO_FORMAT ${CLANG_FORMAT_INCLUDES})
# ... then process any list of excludes we are given
foreach (_pat ${CLANG_FORMAT_EXCLUDES})
file (GLOB_RECURSE _excl ${_pat})
list (REMOVE_ITEM FILES_TO_FORMAT ${_excl})
endforeach ()
#message (STATUS "clang-format file list: ${FILES_TO_FORMAT}")
file (COPY ${CMAKE_CURRENT_SOURCE_DIR}/.clang-format
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target (clang-format
COMMAND "${CLANG_FORMAT_EXE}" -i -style=file ${FILES_TO_FORMAT} )
else ()
message (STATUS "clang-format not found.")
endif ()
endif ()
###########################################################################
# Another way to sneak in custom compiler and DSO linking flags.
#
@@ -528,7 +535,7 @@ endif ()
###########################################################################
# Any extra logic to be run only for CI builds goes here.
#
if (DEFINED ENV{TRAVIS} OR DEFINED ENV{APPVEYOR} OR DEFINED ENV{CI} OR DEFINED ENV{GITHUB_ACTIONS})
if (DEFINED ENV{CI} OR DEFINED ENV{GITHUB_ACTIONS})
add_definitions ("-D${PROJ_NAME}_CI=1" "-DBUILD_CI=1")
if (APPLE)
# Keep Mono framework from being incorrectly searched for include
+111 -145
View File
@@ -25,118 +25,6 @@ set (OIIO_LOCAL_DEPS_PATH "${CMAKE_SOURCE_DIR}/ext/dist" CACHE STRING
"Local area for dependencies added to CMAKE_PREFIX_PATH")
list (APPEND CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/ext/dist)
set (REQUIED_DEPS "" CACHE STRING
"Additional dependencies to consider required (semicolon-separated list, or ALL)")
set (OPTIONAL_DEPS "" CACHE STRING
"Additional dependencies to consider optional (semicolon-separated list, or ALL)")
# checked_find_package(pkgname ..) is a wrapper for find_package, with the
# following extra features:
# * If either `USE_pkgname` or the all-uppercase `USE_PKGNAME` (or
# `ENABLE_pkgname` or `ENABLE_PKGNAME`) exists as either a CMake or
# environment variable, is nonempty by contains a non-true/nonnzero
# value, do not search for or use the package. The optional ENABLE <var>
# arguments allow you to override the name of the enabling variable. In
# other words, support for the dependency is presumed to be ON, unless
# turned off explicitly from one of these sources.
# * Print a message if the package is enabled but not found. This is based
# on ${pkgname}_FOUND or $PKGNNAME_FOUND.
# * Optional DEFINITIONS <string> are passed to add_definitions if the
# package is found.
# * Optional PRINT <list> is a list of variables that will be printed
# if the package is found, if VERBOSE is on.
# * Optional DEPS <list> is a list of hard dependencies; for each one, if
# dep_FOUND is not true, disable this package with an error message.
# * Optional ISDEPOF <downstream> names another package for which the
# present package is only needed because it's a dependency, and
# therefore if <downstream> is disabled, we don't bother with this
# package either.
#
# 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,
# not merely the scope for this function.
macro (checked_find_package pkgname)
cmake_parse_arguments(_pkg "REQUIRED" "ENABLE;ISDEPOF" "DEFINITIONS;PRINT;DEPS" ${ARGN})
# Arguments: <prefix> noValueKeywords singleValueKeywords multiValueKeywords argsToParse
string (TOUPPER ${pkgname} pkgname_upper)
if (NOT VERBOSE)
set (${pkgname}_FIND_QUIETLY true)
set (${pkgname_upper}_FIND_QUIETLY true)
endif ()
if ("${pkgname}" IN_LIST REQUIRED_DEPS OR "ALL" IN_LIST REQUIRED_DEPS)
set (_pkg_REQUIRED 1)
endif ()
if ("${pkgname}" IN_LIST OPTIONAL_DEPS OR "ALL" IN_LIST OPTIONAL_DEPS)
set (_pkg_REQUIRED 0)
endif ()
set (_quietskip false)
check_is_enabled (${pkgname} _enable)
set (_disablereason "")
foreach (_dep ${_pkg_DEPS})
if (_enable AND NOT ${_dep}_FOUND)
set (_enable false)
set (ENABLE_${pkgname} OFF PARENT_SCOPE)
set (_disablereason "(because ${_dep} was not found)")
endif ()
endforeach ()
if (_pkg_ISDEPOF)
check_is_enabled (${_pkg_ISDEPOF} _dep_enabled)
if (NOT _dep_enabled)
set (_enable false)
set (_quietskip true)
endif ()
endif ()
if (_enable OR _pkg_REQUIRED)
find_package (${pkgname} ${_pkg_UNPARSED_ARGUMENTS})
if (${pkgname}_FOUND OR ${pkgname_upper}_FOUND)
foreach (_vervar ${pkgname_upper}_VERSION ${pkgname}_VERSION_STRING
${pkgname_upper}_VERSION_STRING)
if (NOT ${pkgname}_VERSION AND ${_vervar})
set (${pkgname}_VERSION ${${_vervar}})
endif ()
endforeach ()
message (STATUS "${ColorGreen}Found ${pkgname} ${${pkgname}_VERSION} ${ColorReset}")
if (VERBOSE)
set (_vars_to_print ${pkgname}_INCLUDES ${pkgname_upper}_INCLUDES
${pkgname}_INCLUDE_DIR ${pkgname_upper}_INCLUDE_DIR
${pkgname}_INCLUDE_DIRS ${pkgname_upper}_INCLUDE_DIRS
${pkgname}_LIBRARIES ${pkgname_upper}_LIBRARIES
${_pkg_PRINT})
list (REMOVE_DUPLICATES _vars_to_print)
foreach (_v IN LISTS _vars_to_print)
if (NOT "${${_v}}" STREQUAL "")
message (STATUS " ${_v} = ${${_v}}")
endif ()
endforeach ()
endif ()
add_definitions (${_pkg_DEFINITIONS})
else ()
message (STATUS "${ColorRed}${pkgname} library not found ${ColorReset}")
if (${pkgname}_ROOT)
message (STATUS "${ColorRed} ${pkgname}_ROOT was: ${${pkgname}_ROOT} ${ColorReset}")
elseif ($ENV{${pkgname}_ROOT})
message (STATUS "${ColorRed} ENV ${pkgname}_ROOT was: ${${pkgname}_ROOT} ${ColorReset}")
else ()
message (STATUS "${ColorRed} Try setting ${pkgname}_ROOT ? ${ColorReset}")
endif ()
if (EXISTS "${PROJECT_SOURCE_DIR}/src/build-scripts/build_${pkgname}.bash")
message (STATUS "${ColorRed} Maybe this will help: src/build-scripts/build_${pkgname}.bash ${ColorReset}")
endif ()
if (_pkg_REQUIRED)
message (FATAL_ERROR "${ColorRed}${pkgname} is required, aborting.${ColorReset}")
endif ()
endif()
else ()
if (NOT _quietskip)
message (STATUS "${ColorRed}Not using ${pkgname} -- disabled ${_disablereason} ${ColorReset}")
endif ()
endif ()
endmacro()
include (ExternalProject)
option (BUILD_MISSING_DEPS "Try to download and build any missing dependencies" OFF)
@@ -144,16 +32,24 @@ option (BUILD_MISSING_DEPS "Try to download and build any missing dependencies"
###########################################################################
# Boost setup
if (LINKSTATIC)
set (Boost_USE_STATIC_LIBS ON)
if (MSVC)
add_definitions (-DBOOST_ALL_NO_LIB=1)
endif ()
else ()
if (MSVC)
if (MSVC)
# Disable automatic linking using pragma comment(lib,...) of boost libraries upon including of a header
add_definitions (-DBOOST_ALL_NO_LIB=1)
endif ()
# If the build system hasn't been specifically told how to link Boost, link it the same way as other
# OIIO dependencies:
if (NOT DEFINED Boost_USE_STATIC_LIBS)
set (Boost_USE_STATIC_LIBS "${LINKSTATIC}")
endif ()
if (MSVC)
# Not linking Boost as static libraries: either an explicit setting or LINKSTATIC is FALSE:
if (NOT Boost_USE_STATIC_LIBS)
add_definitions (-DBOOST_ALL_DYN_LINK=1)
endif ()
endif ()
if (BOOST_CUSTOM)
set (Boost_FOUND true)
# N.B. For a custom version, the caller had better set up the variables
@@ -168,10 +64,12 @@ else ()
# to set the expected variables printed below. So until that's fixed
# force FindBoost.cmake to use the original brute force path.
set (Boost_NO_BOOST_CMAKE ON)
checked_find_package (Boost 1.53 REQUIRED
COMPONENTS ${Boost_COMPONENTS}
PRINT Boost_INCLUDE_DIRS Boost_LIBRARIES
)
checked_find_package (Boost REQUIRED
VERSION_MIN 1.53
COMPONENTS ${Boost_COMPONENTS}
RECOMMEND_MIN 1.66
RECOMMEND_MIN_REASON "Boost 1.66 is the oldest version our CI tests against"
PRINT Boost_INCLUDE_DIRS Boost_LIBRARIES )
endif ()
# On Linux, Boost 1.55 and higher seems to need to link against -lrt
@@ -192,13 +90,23 @@ link_directories ("${Boost_LIBRARY_DIRS}")
# that we will not complete the build if they are not found.
checked_find_package (ZLIB REQUIRED) # Needed by several packages
checked_find_package (TIFF 3.0 REQUIRED)
checked_find_package (TIFF REQUIRED
VERSION_MIN 3.9
RECOMMEND_MIN 4.0
RECOMMEND_MIN_REASON "to support >4GB files")
# IlmBase & OpenEXR
checked_find_package (OpenEXR 2.0 REQUIRED)
# We use Imath so commonly, may as well include it everywhere.
include_directories ("${OPENEXR_INCLUDES}" "${ILMBASE_INCLUDES}"
"${ILMBASE_INCLUDES}/OpenEXR")
checked_find_package (OpenEXR REQUIRED
VERSION_MIN 2.0
RECOMMEND_MIN 2.2
RECOMMEND_MIN_REASON "for DWA compression"
PRINT IMATH_INCLUDES OPENEXR_INCLUDES)
# Force Imath includes to be before everything else to ensure that we have
# the right Imath/OpenEXR version, not some older version in the system
# library. This shoudn't be necessary, except for the common case of people
# building against Imath/OpenEXR 3.x when there is still a system-level
# install version of 2.x.
include_directories(BEFORE ${IMATH_INCLUDES} ${OPENEXR_INCLUDES})
if (CMAKE_COMPILER_IS_CLANG AND OPENEXR_VERSION VERSION_LESS 2.3)
# clang C++ >= 11 doesn't like 'register' keyword in old exr headers
add_compile_options (-Wno-deprecated-register)
@@ -207,11 +115,18 @@ if (MSVC AND NOT LINKSTATIC)
add_definitions (-DOPENEXR_DLL) # Is this needed for new versions?
endif ()
if (OPENEXR_VERSION VERSION_GREATER_EQUAL 2.5.99)
set (OIIO_USING_IMATH 3)
else ()
set (OIIO_USING_IMATH 2)
endif ()
# JPEG -- prefer Turbo-JPEG to regular libjpeg
checked_find_package (JPEGTurbo
DEFINITIONS -DUSE_JPEG_TURBO=1
PRINT JPEG_INCLUDES JPEG_LIBRARIES)
PRINT JPEG_INCLUDES JPEG_INCLUDE_DIRS
JPEG_LIBRARIES)
if (NOT JPEG_FOUND) # Try to find the non-turbo version
checked_find_package (JPEG REQUIRED)
endif ()
@@ -221,10 +136,15 @@ endif ()
# allow this to be overridden to use the distro-provided package if desired.
option (USE_EXTERNAL_PUGIXML "Use an externally built shared library version of the pugixml library" OFF)
if (USE_EXTERNAL_PUGIXML)
checked_find_package (PugiXML REQUIRED
DEFINITIONS -DUSE_EXTERNAL_PUGIXML=1)
checked_find_package (pugixml REQUIRED
VERSION_MIN 1.8
DEFINITIONS -DUSE_EXTERNAL_PUGIXML=1)
else ()
message (STATUS "Using internal PugiXML")
endif()
# From pythonutils.cmake
find_python()
###########################################################################
@@ -249,25 +169,71 @@ checked_find_package (OpenCV
DEFINITIONS -DUSE_OPENCV=1)
# Intel TBB
set (TBB_USE_DEBUG_BUILD OFF)
checked_find_package (TBB 2017
DEFINITIONS -DUSE_TBB=1
ISDEPOF OpenVDB)
DEFINITIONS -DUSE_TBB=1
PREFER_CONFIG)
checked_find_package (DCMTK 3.6.1) # For DICOM images
checked_find_package (FFmpeg 2.6)
checked_find_package (DCMTK VERSION_MIN 3.6.1) # For DICOM images
checked_find_package (FFmpeg VERSION_MIN 2.6)
checked_find_package (Field3D
DEPS HDF5
DEFINITIONS -DUSE_FIELD3D=1)
checked_find_package (GIF 4)
checked_find_package (Libheif 1.3) # For HEIF/HEIC format
checked_find_package (GIF
VERSION_MIN 4
RECOMMEND_MIN 5.0
RECOMMEND_MIN_REASON "for stability and thread safety")
# For HEIF/HEIC/AVIF formats
checked_find_package (Libheif VERSION_MIN 1.3
RECOMMEND_MIN 1.7
RECOMMEND_MIN_REASON "for AVIF 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)
endif ()
checked_find_package (LibRaw
PRINT LibRaw_r_LIBRARIES)
checked_find_package (OpenJpeg 2.0)
checked_find_package (OpenVDB 5.0
DEPS TBB
DEFINITIONS -DUSE_OPENVDB=1)
checked_find_package (PTex)
checked_find_package (Webp)
RECOMMEND_MIN 0.18
RECOMMEND_MIN_REASON "for ACES support and better camera metadata"
PRINT LibRaw_r_LIBRARIES)
if (LibRaw_FOUND AND LibRaw_VERSION VERSION_LESS 0.20 AND CMAKE_CXX_STANDARD VERSION_GREATER_EQUAL 17)
message (STATUS "${ColorYellow}WARNING When building for C++17, LibRaw should be 0.20 or higher (found ${LibRaw_VERSION}). You may get errors, depending on the compiler.${ColorReset}")
# Currently, we issue the above warning and let them take their chances.
# If we wish to disable the LibRaw<0.20/C++17 combination that may fail,
# just uncomment the following two lines.
# set (LibRaw_FOUND 0)
# set (LIBRAW_FOUND 0)
endif ()
checked_find_package (OpenJPEG VERSION_MIN 2.0)
checked_find_package (OpenVDB
VERSION_MIN 5.0
DEPS TBB
DEFINITIONS -DUSE_OPENVDB=1)
if (OpenVDB_FOUND AND OpenVDB_VERSION VERSION_GREATER_EQUAL 8.0
AND CMAKE_CXX_STANDARD VERSION_LESS 14)
set (OpenVDB_FOUND OFF)
add_definitions (-UUSE_OPENVDB)
message (WARNING
"${ColorYellow}OpenVDB 8.0+ requires C++14 or higher (was ${CMAKE_CXX_STANDARD}). "
"To build against this OpenVDB ${OpenVDB_VERSION}, you need to set "
"build option CMAKE_CXX_STANDARD=14 (or higher). The minimum requirements "
"for that are gcc >= 5.1, clang >= 3.5, Apple clang >= 7, icc >= 7, MSVS >= 2017. "
"If you must use C++11, you need to build against OpenVDB 7 or earlier. ${ColorReset}")
message (STATUS "${ColorRed}Not using OpenVDB -- OpenVDB ${OpenVDB_VERSION} requires C++14 or later. ${ColorReset}")
endif ()
checked_find_package (Ptex PREFER_CONFIG)
if (NOT Ptex_FOUND OR NOT Ptex_VERSION)
# Fallback for inadequate Ptex exported configs. This will eventually
# disappear when we can 100% trust Ptex's exports.
unset (Ptex_FOUND)
checked_find_package (Ptex)
endif ()
checked_find_package (WebP)
option (USE_R3DSDK "Enable R3DSDK (RED camera) support" OFF)
checked_find_package (R3DSDK) # RED camera
@@ -347,7 +313,7 @@ endif ()
option (BUILD_FMT_FORCE "Force local download/build of fmt even if installed" OFF)
option (BUILD_MISSING_FMT "Local download/build of fmt if not installed" ON)
set (BUILD_FMT_VERSION "6.1.2" CACHE STRING "Preferred fmtlib/fmt version, when downloading/building our own")
set (BUILD_FMT_VERSION "7.1.3" CACHE STRING "Preferred fmtlib/fmt version, when downloading/building our own")
macro (find_or_download_fmt)
# If we weren't told to force our own download/build of fmt, look
+55
View File
@@ -0,0 +1,55 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Macro to add an executable build target. The executable name can be
# specified with NAME, otherwise is inferred from the subdirectory name. The
# source files of the binary can be specified with SRC, otherwise are
# inferred to be all the .cpp files within the subdirectory. Optional
# compile DEFINITIONS, private INCLUDE_DIRS, and private LINK_LIBRARIES may
# also be specified.
#
# The executable may be disabled individually using any of the usual
# check_is_enabled() conventions (e.g. -DENABLE_<executable>=OFF).
#
# Usage:
#
# fancy_add_executable ([ NAME targetname ... ]
# [ SRC source1 ... ]
# [ INCLUDE_DIRS include_dir1 ... ]
# [ DEFINITIONS -DFOO=bar ... ])
# [ LINK_LIBRARIES external_lib1 ... ]
#
macro (fancy_add_executable)
cmake_parse_arguments (_target "" "NAME" "SRC;INCLUDE_DIRS;SYSTEM_INCLUDE_DIRS;LINK_LIBRARIES;DEFINITIONS" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
if (NOT _target_NAME)
# If NAME is not supplied, infer target name (and therefore the
# executable name) from the directory name.
get_filename_component (_target_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
endif ()
if (NOT _target_SRC)
# If SRC is not supplied, assume local cpp files are its source.
file (GLOB _target_SRC *.cpp)
endif ()
check_is_enabled (${_target_NAME} _target_NAME_enabled)
if (_target_NAME_enabled)
add_executable (${_target_NAME} ${_target_SRC})
if (_target_INCLUDE_DIRS)
target_include_directories (${_target_NAME} PRIVATE ${_target_INCLUDE_DIRS})
endif ()
if (_target_SYSTEM_INCLUDE_DIRS)
target_include_directories (${_target_NAME} SYSTEM PRIVATE ${_target_SYSTEM_INCLUDE_DIRS})
endif ()
if (_target_DEFINITIONS)
target_compile_definitions (${_target_NAME} PRIVATE ${_target_DEFINITIONS})
endif ()
if (_target_LINK_LIBRARIES)
target_link_libraries (${_target_NAME} PRIVATE ${_target_LINK_LIBRARIES})
endif ()
set_target_properties (${_target_NAME} PROPERTIES FOLDER "Tools")
install_targets (${_target_NAME})
else ()
message (STATUS "${ColorRed}Disabling ${_target_NAME} ${ColorReset}")
endif ()
endmacro ()
+52 -6
View File
@@ -39,6 +39,7 @@ else ()
HINTS ${_FFMPEG_AVCODEC_INCLUDE_DIRS}
PATH_SUFFIXES ffmpeg libav
)
set (FFMPEG_INCLUDES ${FFMPEG_AVCODEC_INCLUDE_DIR})
find_library(FFMPEG_LIBAVCODEC
NAMES avcodec
@@ -55,15 +56,61 @@ else ()
find_library(FFMPEG_LIBSWSCALE
NAMES swscale
HINTS ${_FFMPEG_SWSCALE_LIBRARY_DIRS} )
endif ()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (FFmpeg
if (FFMPEG_INCLUDES)
file(STRINGS "${FFMPEG_INCLUDES}/libavcodec/version.h" TMP
REGEX "^#define LIBAVCODEC_VERSION_MAJOR .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" LIBAVCODEC_VERSION_MAJOR ${TMP})
file(STRINGS "${FFMPEG_INCLUDES}/libavcodec/version.h" TMP
REGEX "^#define LIBAVCODEC_VERSION_MINOR .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" LIBAVCODEC_VERSION_MINOR ${TMP})
file(STRINGS "${FFMPEG_INCLUDES}/libavcodec/version.h" TMP
REGEX "^#define LIBAVCODEC_VERSION_MICRO .*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" LIBAVCODEC_VERSION_MICRO ${TMP})
set (LIBAVCODEC_VERSION "${LIBAVCODEC_VERSION_MAJOR}.${LIBAVCODEC_VERSION_MINOR}.${LIBAVCODEC_VERSION_MICRO}")
if (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 59.18.100)
set (FFMPEG_VERSION 5.0)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 58.134.100)
set (FFMPEG_VERSION 4.4)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 58.91.100)
set (FFMPEG_VERSION 4.3)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 58.54.100)
set (FFMPEG_VERSION 4.2)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 58.35.100)
set (FFMPEG_VERSION 4.1)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 58.18.100)
set (FFMPEG_VERSION 4.0)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 57.107.100)
set (FFMPEG_VERSION 3.4)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 57.89.100)
set (FFMPEG_VERSION 3.3)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 57.64.100)
set (FFMPEG_VERSION 3.2)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 57.48.100)
set (FFMPEG_VERSION 3.1)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 57.24.100)
set (FFMPEG_VERSION 3.0)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 56.60.100)
set (FFMPEG_VERSION 2.8)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 56.41.100)
set (FFMPEG_VERSION 2.7)
elseif (LIBAVCODEC_VERSION VERSION_GREATER_EQUAL 56.26.100)
set (FFMPEG_VERSION 2.6)
else ()
set (FFMPEG_VERSION 1.0)
endif ()
set (FFmpeg_VERSION ${FFMPEG_VERSION})
endif ()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (FFmpeg
REQUIRED_VARS FFMPEG_LIBAVCODEC
FFMPEG_LIBAVFORMAT
FFMPEG_AVCODEC_INCLUDE_DIR
)
)
if (FFmpeg_FOUND)
if (FFmpeg_FOUND)
set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR})
set(FFMPEG_INCLUDES ${FFMPEG_AVCODEC_INCLUDE_DIR})
set(FFMPEG_LIBRARIES
@@ -72,10 +119,9 @@ else ()
${FFMPEG_LIBAVUTIL}
${FFMPEG_LIBSWSCALE}
)
endif ()
endif ()
mark_as_advanced (
FFMPEG_INCLUDES FFMPEG_LIBRARIES
)
+7 -2
View File
@@ -86,7 +86,12 @@ MARK_AS_ADVANCED(LibRaw_VERSION_STRING
if (LINKSTATIC)
# Necessary?
find_package (Jasper)
find_library (LCMS2_LIBRARIES NAMES lcms2)
set (LibRaw_r_LIBRARIES ${LibRaw_r_LIBRARIES} ${JASPER_LIBRARIES} ${LCMS2_LIBRARIES})
if (LCMS2_LIBRARIES)
set (LibRaw_r_LIBRARIES ${LibRaw_r_LIBRARIES} ${LCMS2_LIBRARIES})
endif()
if (MSVC)
set (LibRaw_r_DEFINITIONS ${LibRaw_r_DEFINITIONS} -DLIBRAW_NODLL)
set (LibRaw_DEFINITIONS ${LibRaw_DEFINITIONS} -DLIBRAW_NODLL)
endif()
endif ()
+25 -11
View File
@@ -1,7 +1,7 @@
# Module to find OpenColorIO
#
# This module will first look into the directories hinted by the variables:
# - OpenColorIO_ROOT, OPENCOLORIO_INCLUDE_PATH, OPENCOLORIO_LIBRARY_PATH
# - OpenColorIO_ROOT
#
# This module defines the following variables:
#
@@ -23,8 +23,23 @@ find_path (OPENCOLORIO_INCLUDE_DIR
/opt/local/include
DOC "The directory where OpenColorIO/OpenColorIO.h resides")
if (EXISTS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h")
# Search twice, because this symbol changed between OCIO 1.x and 2.x
file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" TMP
REGEX "^#define OCIO_VERSION_STR[ \t].*$")
if (NOT TMP)
file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" TMP
REGEX "^#define OCIO_VERSION[ \t].*$")
endif ()
string (REGEX MATCHALL "([0-9]+)\\.([0-9]+)\\.[0-9]+" OPENCOLORIO_VERSION ${TMP})
set (OPENCOLORIO_VERSION_MAJOR ${CMAKE_MATCH_1})
set (OPENCOLORIO_VERSION_MINOR ${CMAKE_MATCH_2})
endif ()
find_library (OPENCOLORIO_LIBRARY
NAMES OCIO OpenColorIO
NAMES
OpenColorIO
OpenColorIO_${OPENCOLORIO_VERSION_MAJOR}_${OPENCOLORIO_VERSION_MINOR}
HINTS
${OPENCOLORIO_LIBRARY_PATH}
ENV OPENCOLORIO_LIBRARY_PATH
@@ -35,19 +50,13 @@ find_library (OPENCOLORIO_LIBRARY
/opt/local/lib
DOC "The OCIO library")
if (EXISTS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h")
file(STRINGS "${OPENCOLORIO_INCLUDE_DIR}/OpenColorIO/OpenColorABI.h" TMP
REGEX "^#define OCIO_VERSION[ \t].*$")
string (REGEX MATCHALL "[0-9]+[.0-9]+" OPENCOLORIO_VERSION ${TMP})
endif ()
find_package_handle_standard_args (OpenColorIO
REQUIRED_VARS OPENCOLORIO_INCLUDE_DIR OPENCOLORIO_LIBRARY
FOUND_VAR OPENCOLORIO_FOUND
VERSION_VAR OPENCOLORIO_VERSION
)
if (OPENCOLORIO_FOUND)
if (OpenColorIO_FOUND)
set (OPENCOLORIO_INCLUDES ${OPENCOLORIO_INCLUDE_DIR})
set (OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARY})
set (OPENCOLORIO_DEFINITIONS "")
@@ -59,10 +68,15 @@ if (OPENCOLORIO_FOUND)
set_property(TARGET OpenColorIO::OpenColorIO APPEND PROPERTY
IMPORTED_LOCATION "${OPENCOLORIO_LIBRARIES}")
if (LINKSTATIC)
set_target_properties(OpenColorIO::OpenColorIO PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "-DOpenColorIO_STATIC")
target_compile_definitions(OpenColorIO::OpenColorIO
INTERFACE "-DOpenColorIO_STATIC")
endif()
endif ()
if (NOT TARGET OpenColorIO::OpenColorIOHeaders)
add_library(OpenColorIO::OpenColorIOHeaders INTERFACE IMPORTED)
set_target_properties(OpenColorIO::OpenColorIOHeaders PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENCOLORIO_INCLUDES}")
endif ()
endif ()
if (OpenColorIO_FOUND AND LINKSTATIC)
+113 -5
View File
@@ -1,15 +1,118 @@
# Module to find OpenEXR.
# Module to find OpenEXR and Imath.
#
# I'm afraid this is a mess, due to needing to support a wide range of
# OpenEXR versions.
#
# For OpenEXR & Imath 3.0, this will establish the following imported
# targets:
#
# Imath::Imath
# Imath::Half
# OpenEXR::OpenEXR
# OpenEXR::Iex
# OpenEXR::IlmThread
#
# For OpenEXR 2.4 & 2.5, it will establish the following imported targets:
#
# IlmBase::Imath
# IlmBase::Half
# IlmBase::Iex
# IlmBase::IlmThread
# OpenEXR::IlmImf
#
# For all versions -- but for OpenEXR < 2.4 the only thing this sets --
# are the following CMake variables:
#
# This module will set
# OPENEXR_FOUND true, if found
# OPENEXR_INCLUDES directory where headers are found
# OPENEXR_INCLUDES directory where OpenEXR headers are found
# OPENEXR_LIBRARIES libraries for OpenEXR + IlmBase
# ILMBASE_LIBRARIES libraries just IlmBase
# OPENEXR_VERSION OpenEXR version (accurate for >= 2.0.0,
# otherwise will just guess 1.6.1)
# IMATH_INCLUDES directory where Imath headers are found
# ILMBASE_INCLUDES directory where IlmBase headers are found
# ILMBASE_LIBRARIES libraries just IlmBase
#
#
# First, try to fine just the right config files
find_package(Imath CONFIG)
if (NOT TARGET Imath::Imath)
# Couldn't find Imath::Imath, maybe it's older and has IlmBase?
find_package(IlmBase CONFIG)
endif ()
find_package(OpenEXR CONFIG)
if (TARGET OpenEXR::OpenEXR AND TARGET Imath::Imath)
# OpenEXR 3.x if both of these targets are found
set (FOUND_OPENEXR_WITH_CONFIG 1)
if (NOT OpenEXR_FIND_QUIETLY)
message (STATUS "Found CONFIG for OpenEXR 3 (OPENEXR_VERSION=${OpenEXR_VERSION})")
endif ()
# Mimic old style variables
set (OPENEXR_VERSION ${OpenEXR_VERSION})
get_target_property(IMATH_INCLUDES Imath::Imath INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(ILMBASE_INCLUDES Imath::Imath INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(ILMBASE_IMATH_LIBRARY Imath::Imath INTERFACE_LINK_LIBRARIES)
get_target_property(IMATH_LIBRARY Imath::Imath INTERFACE_LINK_LIBRARIES)
get_target_property(OPENEXR_IEX_LIBRARY OpenEXR::Iex INTERFACE_LINK_LIBRARIES)
get_target_property(OPENEXR_ILMTHREAD_LIBRARY OpenEXR::IlmThread INTERFACE_LINK_LIBRARIES)
set (ILMBASE_LIBRARIES ${ILMBASE_IMATH_LIBRARY})
set (ILMBASE_FOUND true)
get_target_property(OPENEXR_INCLUDES OpenEXR::OpenEXR INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(OPENEXR_ILMIMF_LIBRARY OpenEXR::OpenEXR INTERFACE_LINK_LIBRARIES)
set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ILMBASE_LIBRARIES})
set (OPENEXR_FOUND true)
# Link with pthreads if required
find_package (Threads)
if (CMAKE_USE_PTHREADS_INIT)
list (APPEND ILMBASE_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif ()
elseif (TARGET OpenEXR::IlmImf AND TARGET IlmBase::Imath AND
(OPENEXR_VERSION VERSION_GREATER_EQUAL 2.4 OR OpenEXR_VERSION VERSION_GREATER_EQUAL 2.4))
# OpenEXR 2.4 or 2.5 with exported config
set (FOUND_OPENEXR_WITH_CONFIG 1)
if (NOT OpenEXR_FIND_QUIETLY)
message (STATUS "Found CONFIG for OpenEXR 2 (OPENEXR_VERSION=${OpenEXR_VERSION})")
endif ()
# Mimic old style variables
get_target_property(ILMBASE_INCLUDES IlmBase::IlmBaseConfig INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(IMATH_INCLUDES IlmBase::IlmBaseConfig INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(ILMBASE_Imath_LIBRARY IlmBase::Imath INTERFACE_LINK_LIBRARIES)
get_target_property(ILMBASE_IMATH_LIBRARY IlmBase::Imath INTERFACE_LINK_LIBRARIES)
get_target_property(ILMBASE_HALF_LIBRARY IlmBase::Half INTERFACE_LINK_LIBRARIES)
get_target_property(OPENEXR_IEX_LIBRARY IlmBase::Iex INTERFACE_LINK_LIBRARIES)
get_target_property(OPENEXR_ILMTHREAD_LIBRARY IlmBase::IlmThread INTERFACE_LINK_LIBRARIES)
set (ILMBASE_LIBRARIES ${ILMBASE_IMATH_LIBRARY} ${ILMBASE_HALF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY})
set (ILMBASE_FOUND true)
get_target_property(OPENEXR_INCLUDES OpenEXR::IlmImfConfig INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(OPENEXR_ILMIMF_LIBRARY OpenEXR::IlmImf INTERFACE_LINK_LIBRARIES)
set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${ILMBASE_LIBRARIES})
set (OPENEXR_FOUND true)
# Link with pthreads if required
find_package (Threads)
if (CMAKE_USE_PTHREADS_INIT)
list (APPEND ILMBASE_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif ()
# Correct for how old OpenEXR config exports set the directory one
# level lower than we prefer it.
string(REGEX REPLACE "include/OpenEXR$" "include" ILMBASE_INCLUDES "${ILMBASE_INCLUDES}")
string(REGEX REPLACE "include/OpenEXR$" "include" IMATH_INCLUDES "${IMATH_INCLUDES}")
string(REGEX REPLACE "include/OpenEXR$" "include" OPENEXR_INCLUDES "${OPENEXR_INCLUDES}")
else ()
# OpenEXR 2.x older versions without a config or whose configs we don't
# trust.
set (FOUND_OPENEXR_WITH_CONFIG 0)
# Other standard issue macros
include (FindPackageHandleStandardArgs)
include (SelectLibraryConfigurations)
@@ -131,17 +234,20 @@ find_package_handle_standard_args (OpenEXR
REQUIRED_VARS ILMBASE_INCLUDE_PATH OPENEXR_INCLUDE_PATH
OPENEXR_IMATH_LIBRARY OPENEXR_ILMIMF_LIBRARY
OPENEXR_IEX_LIBRARY OPENEXR_HALF_LIBRARY
VERSION_VAR OPENEXR_VERSION
)
if (OPENEXR_FOUND)
set (OpenEXR_VERSION ${OPENEXR_VERSION})
set (ILMBASE_FOUND TRUE)
set (ILMBASE_INCLUDES ${ILMBASE_INCLUDE_PATH})
set (IMATH_INCLUDES ${ILMBASE_INCLUDE_PATH})
set (OPENEXR_INCLUDES ${OPENEXR_INCLUDE_PATH})
set (ILMBASE_INCLUDE_DIR ${ILMBASE_INCLUDE_PATH})
set (IMATH_INCLUDE_DIR ${ILMBASE_INCLUDE_PATH})
set (OPENEXR_INCLUDE_DIR ${OPENEXR_INCLUDE_PATH})
set (ILMBASE_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ILMBASE_PTHREADS} CACHE STRING "The libraries needed to use IlmBase")
set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${ILMBASE_LIBRARIES} ${ZLIB_LIBRARIES} CACHE STRING "The libraries needed to use OpenEXR")
set (FINDOPENEXR_FALLBACK TRUE)
endif ()
mark_as_advanced(
@@ -153,3 +259,5 @@ mark_as_advanced(
# Restore the original CMAKE_FIND_LIBRARY_SUFFIXES
set (CMAKE_FIND_LIBRARY_SUFFIXES ${_openexr_orig_suffixes})
endif ()
+4 -3
View File
@@ -12,7 +12,7 @@
# CMake module to find OpenImageIO
#
# This module will set
# OPENIMAGEIO_FOUND True, if found
# OpenImageIO_FOUND True, if found
# OPENIMAGEIO_INCLUDES directory where headers are found
# OPENIMAGEIO_LIBRARIES libraries for OIIO
# OPENIMAGEIO_LIBRARY_DIRS library dirs for OIIO
@@ -87,13 +87,14 @@ endif ()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (OpenImageIO
FOUND_VAR OPENIMAGEIO_FOUND
FOUND_VAR OpenImageIO_FOUND
REQUIRED_VARS OPENIMAGEIO_INCLUDE_DIR OPENIMAGEIO_LIBRARY
OPENIMAGEIO_VERSION
VERSION_VAR OPENIMAGEIO_VERSION
)
set (OPENIMAGEIO_FOUND ${OpenImageIO_FOUND}) # Old name
if (OPENIMAGEIO_FOUND)
if (OpenImageIO_FOUND)
set (OPENIMAGEIO_INCLUDES ${OPENIMAGEIO_INCLUDE_DIR})
set (OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY})
get_filename_component (OPENIMAGEIO_LIBRARY_DIRS "${OPENIMAGEIO_LIBRARY}" DIRECTORY)
@@ -1,7 +1,7 @@
# Module to find OpenJpeg.
#
# This module will first look into the directories defined by the variables:
# - OpenJpeg_ROOT
# - OpenJPEG_ROOT
#
# This module defines the following variables:
#
@@ -56,18 +56,21 @@ endmacro ()
# Generic search paths
set (OpenJpeg_include_paths
/usr/local/include/openjpeg-2.4
/usr/local/include/openjpeg-2.3
/usr/local/include/openjpeg-2.2
/usr/local/include/openjpeg-2.1
/usr/local/include/openjpeg-2.0
/usr/local/include/openjpeg
/usr/local/include
/usr/include/openjpeg-2.4
/usr/include/openjpeg-2.3
/usr/include/openjpeg-2.2
/usr/include/openjpeg-2.1
/usr/include/openjpeg
/usr/include
/opt/local/include
/opt/local/include/openjpeg-2.4
/opt/local/include/openjpeg-2.3
/opt/local/include/openjpeg-2.2
/opt/local/include/openjpeg-2.1
@@ -80,20 +83,21 @@ set (OpenJpeg_library_paths
/sw/lib
/opt/local/lib)
if (OpenJpeg_ROOT)
if (OpenJPEG_ROOT)
set (OpenJpeg_library_paths
${OpenJpeg_ROOT}/lib
${OpenJpeg_ROOT}/lib64
${OpenJpeg_ROOT}/bin
${OpenJPEG_ROOT}/lib
${OpenJPEG_ROOT}/lib64
${OpenJPEG_ROOT}/bin
${OpenJpeg_library_paths}
)
set (OpenJpeg_include_paths
${OpenJpeg_ROOT}/include/openjpeg-2.3
${OpenJpeg_ROOT}/include/openjpeg-2.2
${OpenJpeg_ROOT}/include/openjpeg-2.1
${OpenJpeg_ROOT}/include/openjpeg-2.0
${OpenJpeg_ROOT}/include/openjpeg
${OpenJpeg_ROOT}/include
${OpenJPEG_ROOT}/include/openjpeg-2.4
${OpenJPEG_ROOT}/include/openjpeg-2.3
${OpenJPEG_ROOT}/include/openjpeg-2.2
${OpenJPEG_ROOT}/include/openjpeg-2.1
${OpenJPEG_ROOT}/include/openjpeg-2.0
${OpenJPEG_ROOT}/include/openjpeg
${OpenJPEG_ROOT}/include
${OpenJpeg_include_paths}
)
endif()
@@ -149,7 +153,7 @@ else ()
endif ()
# Use the standard function to handle OPENJPEG_FOUND
FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenJpeg
FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenJPEG
VERSION_VAR OPENJPEG_VERSION
REQUIRED_VARS OPENJPEG_INCLUDE_DIR ${OpenJpeg_libvars})
@@ -92,13 +92,13 @@ if (PTEX_INCLUDE_DIR AND EXISTS "${PTEX_INCLUDE_DIR}/PtexVersion.h" )
file(STRINGS "${PTEX_INCLUDE_DIR}/PtexVersion.h" TMP REGEX "^#define PtexAPIVersion.*$")
string(REGEX MATCHALL "[0-9]+" API ${TMP})
file(STRINGS "${PTEX_INCLUDE_DIR}/PtexVersion.h" TMP REGEX "^#define PtexFileMajorVersion.*$")
file(STRINGS "${PTEX_INCLUDE_DIR}/PtexVersion.h" TMP REGEX "^#define PtexLibraryMajorVersion.*$")
string(REGEX MATCHALL "[0-9]+" MAJOR ${TMP})
file(STRINGS "${PTEX_INCLUDE_DIR}/PtexVersion.h" TMP REGEX "^#define PtexFileMinorVersion.*$")
file(STRINGS "${PTEX_INCLUDE_DIR}/PtexVersion.h" TMP REGEX "^#define PtexLibraryMinorVersion.*$")
string(REGEX MATCHALL "[0-9]+" MINOR ${TMP})
set(PTEX_VERSION ${API}.${MAJOR}.${MINOR})
set(PTEX_VERSION ${MAJOR}.${MINOR})
elseif (PTEX_INCLUDE_DIR AND EXISTS "${PTEX_INCLUDE_DIR}/Ptexture.h" )
@@ -111,13 +111,13 @@ elseif (PTEX_INCLUDE_DIR AND EXISTS "${PTEX_INCLUDE_DIR}/Ptexture.h" )
file(STRINGS "${PTEX_INCLUDE_DIR}/Ptexture.h" TMP REGEX "^#define PtexFileMinorVersion.*$")
string(REGEX MATCHALL "[0-9]+" MINOR ${TMP})
set(PTEX_VERSION ${API}.${MAJOR}.${MINOR})
set(PTEX_VERSION ${MAJOR}.${MINOR})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PTex
find_package_handle_standard_args(Ptex
REQUIRED_VARS
PTEX_INCLUDE_DIR
PTEX_LIBRARY
@@ -126,7 +126,19 @@ find_package_handle_standard_args(PTex
)
if (PTEX_FOUND)
set(Ptex_FOUND TRUE)
set(PTEX_LIBRARIES ${PTEX_LIBRARY})
set(PTEX_INCLUDES ${PTEX_INCLUDE_DIR})
set(Ptex_VERSION ${PTEX_VERSION})
if (NOT TARGET Ptex::Ptex_dynamic)
add_library(Ptex::Ptex_dynamic UNKNOWN IMPORTED)
set_target_properties(Ptex::Ptex_dynamic PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${PTEX_INCLUDES}")
if (PTEX_LIBRARIES)
set_property(TARGET Ptex::Ptex_dynamic APPEND PROPERTY
IMPORTED_LOCATION "${PTEX_LIBRARIES}")
endif ()
endif ()
else ()
set (PTEX_INCLUDE_DIR "")
endif()
-26
View File
@@ -1,26 +0,0 @@
# Find the pugixml XML parsing library.
#
# Sets the usual variables expected for find_package scripts:
#
# PUGIXML_INCLUDES - header location
# PUGIXML_LIBRARIES - library to link against
# PUGIXML_FOUND - true if pugixml was found.
find_path (PUGIXML_INCLUDE_DIR
NAMES pugixml.hpp
HINTS /usr/local/include/pugixml-1.8)
find_library (PUGIXML_LIBRARY
NAMES pugixml
HINTS /usr/local/lib/pugixml-1.8)
# Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found.
include (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (PugiXML DEFAULT_MSG PUGIXML_LIBRARY
PUGIXML_INCLUDE_DIR)
if (PUGIXML_FOUND)
set (PUGIXML_INCLUDES ${PUGIXML_INCLUDE_DIR})
set (PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
endif()
mark_as_advanced (PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
+1 -1
View File
@@ -134,7 +134,7 @@ if(NOT TBB_FOUND)
# Find the TBB include dir
##################################
find_path(TBB_INCLUDE_DIRS tbb/tbb.h
find_path(TBB_INCLUDE_DIRS tbb/tbb_stddef.h
HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
PATHS ${TBB_DEFAULT_SEARCH_DIR})
+63
View File
@@ -0,0 +1,63 @@
# Module to find Webp
#
# This module will first look into the directories defined by the variables:
# - Webp_ROOT, WEBP_INCLUDE_PATH, WEBP_LIBRARY_PATH
#
# This module defines the following variables:
#
# WebP_FOUND True if Webp was found.
# WEBP_INCLUDES Where to find Webp headers
# WEBP_LIBRARIES List of libraries to link against when using Webp
#
# This doesn't work, because the webp headers don't seem to include any
# definitions giving the version:
# WEBP_VERSION Version of Webp (e.g., 3.6.2)
include (FindPackageHandleStandardArgs)
find_path (WEBP_INCLUDE_DIR webp/encode.h
HINTS
${WEBP_INCLUDE_PATH}
ENV WEBP_INCLUDE_PATH
DOC "The directory where Webp headers reside")
find_library (WEBP_LIBRARY webp
HINTS
${WEBP_LIBRARY_PATH}
ENV WEBP_LIBRARY_PATH)
find_library (WEBPDEMUX_LIBRARY webpdemux
HINTS
${WEBP_LIBRARY_PATH}
ENV WEBP_LIBRARY_PATH)
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (WebP
REQUIRED_VARS WEBP_INCLUDE_DIR
WEBP_LIBRARY WEBPDEMUX_LIBRARY
)
if (WebP_FOUND)
set (WEBP_INCLUDES "${WEBP_INCLUDE_DIR}")
set (WEBP_LIBRARIES ${WEBP_LIBRARY} ${WEBPDEMUX_LIBRARY})
if (NOT TARGET WebP::WebP)
add_library(WebP::WebP UNKNOWN IMPORTED)
set_target_properties(WebP::WebP PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${WEBP_INCLUDES})
set_property(TARGET WebP::WebP APPEND PROPERTY
IMPORTED_LOCATION ${WEBP_LIBRARY})
endif ()
if (NOT TARGET WebP::WebPDemux)
add_library(WebP::WebPDemux UNKNOWN IMPORTED)
set_target_properties(WebP::WebPDemux PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${WEBP_INCLUDES})
set_property(TARGET WebP::WebPDemux APPEND PROPERTY
IMPORTED_LOCATION ${WEBPDEMUX_LIBRARY})
endif ()
endif ()
mark_as_advanced (
WEBP_INCLUDE_DIR
WEBP_LIBRARY
WEBPDEMUX_LIBRARY
)
-49
View File
@@ -1,49 +0,0 @@
# Module to find Webp
#
# This module will first look into the directories defined by the variables:
# - Webp_ROOT, WEBP_INCLUDE_PATH, WEBP_LIBRARY_PATH
#
# This module defines the following variables:
#
# Webp_FOUND True if Webp was found.
# WEBP_INCLUDES Where to find Webp headers
# WEBP_LIBRARIES List of libraries to link against when using Webp
# WEBP_VERSION Version of Webp (e.g., 3.6.2)
include (FindPackageHandleStandardArgs)
find_path (WEBP_INCLUDE_DIR webp/encode.h
HINTS
${WEBP_INCLUDE_PATH}
ENV WEBP_INCLUDE_PATH
DOC "The directory where Webp headers reside")
find_library (WEBP_LIBRARY webp
HINTS
${WEBP_LIBRARY_PATH}
ENV WEBP_LIBRARY_PATH
DOC "The directory where Webp libraries reside")
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (Webp
REQUIRED_VARS WEBP_INCLUDE_DIR
WEBP_LIBRARY
)
if (Webp_FOUND)
set (WEBP_INCLUDES "${WEBP_INCLUDE_DIR}")
set (WEBP_LIBRARIES "${WEBP_LIBRARY}")
if (NOT TARGET Webp::Webp)
add_library(Webp::Webp UNKNOWN IMPORTED)
set_target_properties(Webp::Webp PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${WEBP_INCLUDES}")
set_property(TARGET Webp::Webp APPEND PROPERTY
IMPORTED_LOCATION "${WEBP_LIBRARIES}")
endif ()
endif ()
mark_as_advanced (
WEBP_INCLUDE_DIR
WEBP_LIBRARY
)
+79
View File
@@ -0,0 +1,79 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio
# Find the pugixml XML parsing library.
#
# Sets the usual variables expected for find_package scripts:
#
# PUGIXML_INCLUDES - header location
# PUGIXML_LIBRARIES - library to link against
# PUGIXML_FOUND - true if pugixml was found.
# First try the config files and hope they're good enough
find_package (pugixml CONFIG)
if (TARGET pugixml::pugixml)
# New pugixml (>= 1.11) has nice config files we can rely on and makes a
# pugixml::pugixml target.
if (VERBOSE)
message (STATUS "Found CONFIG for pugixml (>=1.11)")
endif ()
set (PUGIXML_FOUND true)
set (pugixml_FOUND true)
get_target_property(PUGIXML_INCLUDES pugixml::pugixml INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(PUGIXML_LIBRARIES pugixml::pugixml INTERFACE_LINK_LIBRARIES)
# elseif (TARGET pugixml)
# # But older pugixml (<= 1.10) has mediocre config files that are not
# # reliable in practice. They also only define a "pugixml" target but
# # not "pugixml::pugixml". So just fall through to the "no config" case
# # below, and figure everything out by hand.
else ()
# If no config file is found for PugiXML, do it the old fashioned way.
find_path (PUGIXML_INCLUDE_DIR
NAMES pugixml.hpp
PATH_SUFFIXES pugixml-1.8 pugixml-1.9 pugixml-1.10)
set (pugixml_required_vars PUGIXML_INCLUDE_DIR)
find_library (PUGIXML_LIBRARY
NAMES pugixml
PATH_SUFFIXES pugixml-1.8 pugixml-1.9 pugixml-1.10)
if (PUGIXML_INCLUDE_DIR)
file (STRINGS "${PUGIXML_INCLUDE_DIR}/pugixml.hpp" TMP REGEX "define PUGIXML_VERSION .*$")
string (REGEX MATCHALL "[0-9]+" PUGIXML_CODED_VERSION ${TMP})
if (PUGIXML_CODED_VERSION VERSION_GREATER_EQUAL 1000)
math (EXPR PUGIXML_VERSION_MAJOR "${PUGIXML_CODED_VERSION} / 1000")
math (EXPR PUGIXML_VERSION_MINOR "(${PUGIXML_CODED_VERSION} % 1000) / 10")
else ()
math (EXPR PUGIXML_VERSION_MAJOR "${PUGIXML_CODED_VERSION} / 100")
math (EXPR PUGIXML_VERSION_MINOR "(${PUGIXML_CODED_VERSION} % 100) / 10")
endif ()
set (PUGIXML_VERSION ${PUGIXML_VERSION_MAJOR}.${PUGIXML_VERSION_MINOR})
endif ()
# Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found.
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (pugixml DEFAULT_MSG
PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
if (PUGIXML_FOUND OR pugixml_FOUND)
set (PUGIXML_INCLUDES ${PUGIXML_INCLUDE_DIR})
set (PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
if (NOT TARGET pugixml::pugixml)
add_library(pugixml::pugixml UNKNOWN IMPORTED)
set_target_properties(pugixml::pugixml PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${PUGIXML_INCLUDES}")
if (PUGIXML_LIBRARIES)
set_property(TARGET pugixml::pugixml APPEND PROPERTY
IMPORTED_LOCATION "${PUGIXML_LIBRARIES}")
endif ()
endif ()
endif ()
mark_as_advanced (PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
endif()
-240
View File
@@ -1,240 +0,0 @@
# Copyright 2008-present Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md
# Macro to add a build target for an IO plugin.
#
# Usage:
#
# add_oiio_plugin ( source1 [source2 ...]
# [ NAME targetname ... ]
# [ SRC source1 ... ]
# [ INCLUDE_DIRS include_dir1 ... ]
# [ LINK_LIBRARIES external_lib1 ... ]
# [ DEFINITIONS -DFOO=bar ... ])
#
# The plugin name can be specified with NAME, otherwise is inferred from the
# subdirectory name. The source files of the binary can be specifeied with
# SRC, otherwise are inferred to be all the .cpp files within the
# subdirectory. Optional compile DEFINITIONS, private INCLUDE_DIRS, and
# priviate LINK_LIBRARIES may also be specified. The source is automatically
# linked against OpenImageIO.
#
# The plugin may be disabled individually using any of the usual
# check_is_enabled() conventions (e.g. -DENABLE_<format>=OFF).
#
# What goes on under the covers is quite different depending on whether
# EMBEDPLUGINS is 0 or 1. If EMBEDPLUGINS is 0 (in which case this is
# expected to be called *after* the OpenImageIO target is declared), it will
# create a new target to build the full plugin. On the other hand, if
# EMBEDPLUGINS is 1 (in which case this should be called *before* the
# OpenImageIO target is declared), it will merely append the required
# definitions, includs, and libraries to lists format_plugin_blah that will
# be handed off too the setup of the later OpenImageIO target.
#
macro (add_oiio_plugin)
cmake_parse_arguments (_plugin "" "NAME" "SRC;INCLUDE_DIRS;LINK_LIBRARIES;DEFINITIONS" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
get_filename_component (_plugin_name ${CMAKE_CURRENT_SOURCE_DIR} NAME_WE)
if (NOT _plugin_NAME)
# If NAME is not supplied, infer target name (and therefore the
# executable name) from the directory name.
get_filename_component (_plugin_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
endif ()
# if (NOT _plugin_SRC)
# # If SRC is not supplied, assume local cpp files are its source.
# file (GLOB _plugin_SRC *.cpp)
# endif ()
check_is_enabled (${_plugin_name} _enable_plugin)
if (_enable_plugin)
if (EMBEDPLUGINS)
# Add each source file to the libOpenImageIO_srcs, but it takes some
# bending over backwards to change it in the parent scope.
set (_plugin_all_source ${libOpenImageIO_srcs})
foreach (_plugin_source_file ${_plugin_UNPARSED_ARGUMENTS} )
list (APPEND _plugin_all_source "${CMAKE_CURRENT_SOURCE_DIR}/${_plugin_source_file}")
endforeach ()
set (libOpenImageIO_srcs "${_plugin_all_source}" PARENT_SCOPE)
set (format_plugin_definitions ${format_plugin_definitions} ${_plugin_DEFINITIONS} PARENT_SCOPE)
set (format_plugin_include_dirs ${format_plugin_include_dirs} ${_plugin_INCLUDE_DIRS} PARENT_SCOPE)
set (format_plugin_libs ${format_plugin_libs} ${_plugin_LINK_LIBRARIES} PARENT_SCOPE)
else ()
# Get the name of the current directory and use it as the target name.
get_filename_component (_plugin_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
add_library (${_plugin_name} MODULE ${_plugin_UNPARSED_ARGUMENTS})
target_compile_definitions (${_plugin_name} PRIVATE
${_plugin_DEFINITIONS}
OpenImageIO_EXPORTS)
target_include_directories (${_plugin_name} PRIVATE ${_plugin_INCLUDE_DIRS})
target_link_libraries (${_plugin_name} PUBLIC OpenImageIO
PRIVATE ${_plugin_LINK_LIBRARIES})
set_target_properties (${_plugin_name} PROPERTIES PREFIX "" FOLDER "Plugins")
install_targets (${_plugin_name})
endif ()
else ()
message (STATUS "${ColorRed}Disabling ${_plugin_name} ${ColorReset}")
string (TOUPPER ${_plugin_name} _plugin_name_upper)
set (format_plugin_definitions ${format_plugin_definitions} DISABLE_${_plugin_name_upper} PARENT_SCOPE)
endif ()
endmacro ()
# Macro to add an executable build target. The executable name can be
# specified with NAME, otherwise is inferred from the subdirectory name. The
# source files of the binary can be specifeied with SRC, otherwise are
# inferred to be all the .cpp files within the subdirectory. Optional
# compile DEFINITIONS, private INCLUDE_DIRS, and priviate LINK_LIBRARIES may
# also be specified.
#
# The executable may be disabled individually using any of the usual
# check_is_enabled() conventions (e.g. -DENABLE_<executable>=OFF).
#
# Usage:
#
# fancy_add_executable ([ NAME targetname ... ]
# [ SRC source1 ... ]
# [ INCLUDE_DIRS include_dir1 ... ]
# [ DEFINITIONS -DFOO=bar ... ])
# [ LINK_LIBRARIES external_lib1 ... ]
#
macro (fancy_add_executable)
cmake_parse_arguments (_target "" "NAME" "SRC;INCLUDE_DIRS;SYSTEM_INCLUDE_DIRS;LINK_LIBRARIES;DEFINITIONS" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
if (NOT _target_NAME)
# If NAME is not supplied, infer target name (and therefore the
# executable name) from the directory name.
get_filename_component (_target_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
endif ()
if (NOT _target_SRC)
# If SRC is not supplied, assume local cpp files are its source.
file (GLOB _target_SRC *.cpp)
endif ()
check_is_enabled (${_target_NAME} _target_NAME_enabled)
if (_target_NAME_enabled)
add_executable (${_target_NAME} ${_target_SRC})
if (_target_INCLUDE_DIRS)
target_include_directories (${_target_NAME} PRIVATE ${_target_INCLUDE_DIRS})
endif ()
if (_target_SYSTEM_INCLUDE_DIRS)
target_include_directories (${_target_NAME} SYSTEM PRIVATE ${_target_SYSTEM_INCLUDE_DIRS})
endif ()
if (_target_DEFINITIONS)
target_compile_definitions (${_target_name} PRIVATE ${_target_DEFINITIONS})
endif ()
if (_target_LINK_LIBRARIES)
target_link_libraries (${_target_NAME} PRIVATE ${_target_LINK_LIBRARIES})
endif ()
set_target_properties (${_target_NAME} PROPERTIES FOLDER "Tools")
install_targets (${_target_NAME})
else ()
message (STATUS "${ColorRed}Disabling ${_target_NAME} ${ColorReset}")
endif ()
endmacro ()
# oiio_set_testenv() - add environment variables to a test
#
# Usage:
# oiio_set_testenv ( testname
# testsuite - The root of all tests ${CMAKE_SOURCE_DIR}/testsuite
# testsrcdir - Current test directory in ${CMAKE_SOURCE_DIR}
# testdir - Current test sandbox in ${CMAKE_BINARY_DIR}
# IMAGEDIR - Optional path to image reference/compare directory)
#
macro (oiio_set_testenv testname testsuite testsrcdir testdir IMAGEDIR)
set_property(TEST ${testname} PROPERTY ENVIRONMENT
"OIIO_TESTSUITE_ROOT=${testsuite}"
";OIIO_TESTSUITE_SRC=${testsrcdir}"
";OIIO_TESTSUITE_CUR=${testdir}")
if (NOT ${IMAGEDIR} STREQUAL "")
set_property(TEST ${testname} APPEND PROPERTY ENVIRONMENT
"OIIO_TESTSUITE_IMAGEDIR=${IMAGEDIR}")
endif()
endmacro ()
# oiio_add_tests() - add a set of test cases.
#
# Usage:
# oiio_add_tests ( test1 [ test2 ... ]
# [ IMAGEDIR name_of_reference_image_directory ]
# [ URL http://find.reference.cases.here.com ] )
#
# The optional argument IMAGEDIR is used to check whether external test images
# (not supplied with OIIO) are present, and to disable the test cases if
# they're not. If IMAGEDIR is present, URL should also be included to tell
# the user where to find such tests.
#
macro (oiio_add_tests)
cmake_parse_arguments (_ats "" "" "URL;IMAGEDIR;LABEL;FOUNDVAR;TESTNAME" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
set (_ats_testdir "${OIIO_TESTSUITE_IMAGEDIR}/${_ats_IMAGEDIR}")
# If there was a FOUNDVAR param specified and that variable name is
# not defined, mark the test as broken.
if (_ats_FOUNDVAR AND NOT ${_ats_FOUNDVAR})
set (_ats_LABEL "broken")
endif ()
if (_ats_IMAGEDIR AND NOT EXISTS ${_ats_testdir})
# If the directory containig reference data (images) for the test
# isn't found, point the user at the URL.
message (STATUS "\n\nDid not find ${_ats_testdir}")
message (STATUS " -> Will not run tests ${_ats_UNPARSED_ARGUMENTS}")
message (STATUS " -> You can find it at ${_ats_URL}\n")
else ()
# Add the tests if all is well.
set (_has_generator_expr TRUE)
foreach (_testname ${_ats_UNPARSED_ARGUMENTS})
set (_testsuite "${CMAKE_SOURCE_DIR}/testsuite")
set (_testsrcdir "${_testsuite}/${_testname}")
set (_testdir "${CMAKE_BINARY_DIR}/testsuite/${_testname}")
if (_ats_TESTNAME)
set (_testname "${_ats_TESTNAME}")
endif ()
if (_ats_LABEL MATCHES "broken")
set (_testname "${_testname}-broken")
endif ()
set (_runtest python "${CMAKE_SOURCE_DIR}/testsuite/runtest.py" ${_testdir})
if (MSVC_IDE)
set (_runtest ${_runtest} --devenv-config $<CONFIGURATION>
--solution-path "${CMAKE_BINARY_DIR}" )
endif ()
file (MAKE_DIRECTORY "${_testdir}")
add_test ( NAME ${_testname}
COMMAND ${_runtest} )
oiio_set_testenv("${_testname}" "${_testsuite}"
"${_testsrcdir}" "${_testdir}" "${_ats_testdir}")
# For texture tests, add a second test using batch mode as well.
if (_testname MATCHES "texture")
set (_testname ${_testname}.batch)
set (_testdir ${_testdir}.batch)
set (_runtest python "${CMAKE_SOURCE_DIR}/testsuite/runtest.py" ${_testdir})
if (MSVC_IDE)
set (_runtest ${_runtest} --devenv-config $<CONFIGURATION>
--solution-path "${CMAKE_BINARY_DIR}" )
endif ()
file (MAKE_DIRECTORY "${_testdir}")
add_test ( NAME "${_testname}"
COMMAND env TESTTEX_BATCH=1 ${_runtest} )
oiio_set_testenv("${_testname}" "${_testsuite}"
"${_testsrcdir}" "${_testdir}.batch" "${_ats_testdir}")
endif ()
#if (VERBOSE)
# message (STATUS "TEST ${_testname}: ${_runtest}")
#endif ()
endforeach ()
if (VERBOSE)
message (STATUS "TESTS: ${_ats_UNPARSED_ARGUMENTS}")
endif ()
endif ()
endmacro ()
+54
View File
@@ -0,0 +1,54 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/
#########################################################################
# Packaging
set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
# "Vendor" is only used in copyright notices, so we use the same thing that
# the rest of the copyright notices say.
set (CPACK_PACKAGE_VENDOR ${PROJECT_AUTHORS})
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenImageIO is an open source library for reading and writing image file formats, a nice format-agnostic image viewer, and other image-related classes and utilities.")
set (CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/src/doc/Description.txt")
set (CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
#SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_SOURCE_DIR}")
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/cpack")
file (COPY "${PROJECT_SOURCE_DIR}/LICENSE.md" DESTINATION "${CMAKE_BINARY_DIR}/cpack")
file (RENAME "${CMAKE_BINARY_DIR}/cpack/LICENSE.md" "${CMAKE_BINARY_DIR}/cpack/License.txt")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/cpack/License.txt")
file (COPY "${PROJECT_SOURCE_DIR}/README.md" DESTINATION "${CMAKE_BINARY_DIR}/cpack")
set (CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/cpack/README.md")
set (CPACK_RESOURCE_FILE_WELCOME "${PROJECT_SOURCE_DIR}/src/doc/Welcome.txt")
#SET (CPACK_STRIP_FILES Do we need this?)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set (CPACK_GENERATOR "TGZ;STGZ;RPM;DEB")
set (CPACK_SOURCE_GENERATOR "TGZ")
endif ()
if (APPLE)
set (CPACK_GENERATOR "TGZ;STGZ;PackageMaker")
set (CPACK_SOURCE_GENERATOR "TGZ")
endif ()
if (WIN32)
set (CPACK_GENERATOR "NSIS")
set(CPACK_PACKAGE_EXECUTABLES "iv" "iv - Image Viewer")
# set(CPACK_CREATE_DESCTOP_LINKS "iv" "iv - Image Viewer")
set(CPACK_NSIS_MODIFY_PATH ON)
include (InstallRequiredSystemLibraries)
endif ()
set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-source)
#set (CPACK_SOURCE_STRIP_FILES Do we need this?)
set (CPACK_SOURCE_IGNORE_FILES ".*~")
set (CPACK_COMPONENT_UNSPECIFIED_HIDDEN TRUE)
set (CPACK_COMPONENT_UNSPECIFIED_REQUIRED TRUE)
set (CPACK_COMPONENTS_ALL user developer documentation Unspecified)
set (CPACK_COMPONENT_USER_DISPLAY_NAME "Applications")
set (CPACK_COMPONENT_DEVELOPER_DISPLAY_NAME "Developer files")
set (CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
set (CPACK_COMPONENT_USER_DESCRIPTION
"Applications: oiiotool, iv, iinfo, iconvert, idiff, igrep, maketx and libraries")
set (CPACK_COMPONENT_DEVELOPER_DESCRIPTION "Include files")
set (CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "OpenImageIO documentation")
set (CPACK_COMPONENT_DEVELOPER_DEPENDS user)
include (CPack)
+49 -40
View File
@@ -4,18 +4,19 @@
# Python-related options.
option (USE_PYTHON "Build the Python bindings" ON)
set (PYTHON_VERSION "2.7" CACHE STRING "Target version of python to find")
set (PYTHON_VERSION "" CACHE STRING "Target version of python to find")
option (PYLIB_INCLUDE_SONAME "If ON, soname/soversion will be set for Python module library" OFF)
option (PYLIB_LIB_PREFIX "If ON, prefix the Python module with 'lib'" OFF)
set (PYMODULE_SUFFIX "" CACHE STRING "Suffix to add to Python module init namespace")
if (WIN32)
set (PYLIB_LIB_TYPE SHARED CACHE STRING "Type of library to build for python module (MODULE or SHARED)")
else ()
set (PYLIB_LIB_TYPE MODULE CACHE STRING "Type of library to build for python module (MODULE or SHARED)")
endif ()
# Find Python. This macro should only be called if python is required. If
# Python cannot be found, it will be a fatal error.
# Variables set by this macro:
# PYTHON_INCLUDES_PATH - directory where python headers are found
# PYTHON_LIBRARIES - python libraries to link
# PYTHON_SITE_DIR - our own install dir where our python moduels go
macro (find_python)
if (NOT VERBOSE)
set (PythonInterp_FIND_QUIETLY true)
@@ -24,31 +25,38 @@ macro (find_python)
# Attempt to find the desired version, but fall back to other
# additional versions.
checked_find_package (PythonInterp ${PYTHON_VERSION} REQUIRED)
unset (_req)
if (USE_PYTHON)
set (_req REQUIRED)
if (PYTHON_VERSION)
list (APPEND _req EXACT)
endif ()
endif ()
checked_find_package (Python ${PYTHON_VERSION}
${_req}
COMPONENTS Interpreter Development
PRINT Python_VERSION Python_EXECUTABLE
Python_LIBRARIES
Python_Development_FOUND
Python_Interpreter_FOUND )
# The version that was found may not be the default or user
# defined one.
set (PYTHON_VERSION_FOUND ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
set (PYTHON_VERSION_FOUND ${Python_VERSION_MAJOR}.${Python_VERSION_MINOR})
if (NOT ${PYTHON_VERSION} VERSION_EQUAL ${PYTHON_VERSION_FOUND} )
message (WARNING "The requested version ${PYTHON_VERSION} was not found.")
message (WARNING "Using ${PYTHON_VERSION_FOUND} instead.")
endif ()
checked_find_package (PythonLibs ${PYTHON_VERSION_FOUND} REQUIRED)
if (VERBOSE)
message (STATUS " Python include dirs ${PYTHON_INCLUDE_PATH}")
message (STATUS " Python libraries ${PYTHON_LIBRARIES}")
message (STATUS " Python site packages dir ${PYTHON_SITE_DIR}")
message (STATUS " Python to include 'lib' prefix: ${PYLIB_LIB_PREFIX}")
message (STATUS " Python to include SO version: ${PYLIB_INCLUDE_SONAME}")
message (STATUS " Python version ${PYTHON_VERSION_STRING}")
message (STATUS " Python version major: ${PYTHON_VERSION_MAJOR} minor: ${PYTHON_VERSION_MINOR}")
endif ()
# Give hints to subsequent pybind11 searching to ensure that it finds
# exactly the same version that we found.
set (PythonInterp_FIND_VERSION PYTHON_VERSION_FOUND)
set (PythonInterp_FIND_VERSION_MAJOR ${Python_VERSION_MAJOR})
if (NOT DEFINED PYTHON_SITE_DIR)
set (PYTHON_SITE_DIR "${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_FOUND}/site-packages")
endif ()
if (VERBOSE)
message (STATUS " Python site packages dir ${PYTHON_SITE_DIR}")
message (STATUS " Python to include 'lib' prefix: ${PYLIB_LIB_PREFIX}")
message (STATUS " Python to include SO version: ${PYLIB_INCLUDE_SONAME}")
endif ()
endmacro()
@@ -66,20 +74,19 @@ macro (setup_python_module)
set_property (SOURCE ${lib_SOURCES} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-macro-redefined ")
endif ()
# Add the library itself
add_library (${target_name} MODULE ${lib_SOURCES})
# Set up include dirs for python & pybind11
target_include_directories (${target_name} SYSTEM PRIVATE ${PYTHON_INCLUDE_PATH})
pybind11_add_module(${target_name} ${PYLIB_LIB_TYPE} ${lib_SOURCES})
# # Add the library itself
# add_library (${target_name} MODULE ${lib_SOURCES})
#
# Declare the libraries it should link against
target_link_libraries (${target_name} PRIVATE
pybind11::pybind11 ${lib_LIBS} ${SANITIZE_LIBRARIES})
if (APPLE)
set_target_properties (${target_name} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else ()
target_link_libraries (${target_name} PRIVATE ${PYTHON_LIBRARIES})
endif ()
target_link_libraries (${target_name}
PRIVATE ${lib_LIBS} ${SANITIZE_LIBRARIES})
# if (APPLE)
# set_target_properties (${target_name} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
# endif ()
# Exclude the 'lib' prefix from the name
if (NOT PYLIB_LIB_PREFIX)
@@ -87,7 +94,8 @@ macro (setup_python_module)
PRIVATE "PYMODULE_NAME=${lib_MODULE}")
set_target_properties (${target_name} PROPERTIES
OUTPUT_NAME ${lib_MODULE}
PREFIX "")
# PREFIX ""
)
else ()
target_compile_definitions(${target_name}
PRIVATE "PYMODULE_NAME=Py${lib_MODULE}")
@@ -96,6 +104,7 @@ macro (setup_python_module)
PREFIX lib)
endif ()
# This is only needed for SpComp2
if (PYLIB_INCLUDE_SONAME)
if (VERBOSE)
message(STATUS "Setting Py${lib_MODULE} SOVERSION to: ${SOVERSION}")
@@ -105,11 +114,11 @@ macro (setup_python_module)
SOVERSION ${SOVERSION} )
endif()
if (WIN32)
set_target_properties (${target_name} PROPERTIES
DEBUG_POSTFIX "_d"
SUFFIX ".pyd")
endif()
# if (WIN32)
# set_target_properties (${target_name} PROPERTIES
# DEBUG_POSTFIX "_d"
# SUFFIX ".pyd")
# endif()
# In the build area, put it in lib/python so it doesn't clash with the
# non-python libraries of the same name (which aren't prefixed by "lib"
+310
View File
@@ -0,0 +1,310 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/OpenImageIO/oiio/
include (CTest)
# Make a build/platform/testsuite directory, and copy the master runtest.py
# there. The rest is up to the tests themselves.
file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/testsuite")
file (COPY "${CMAKE_CURRENT_SOURCE_DIR}/testsuite/common"
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/testsuite")
add_custom_command (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/testsuite/runtest.py"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/testsuite/runtest.py"
"${CMAKE_CURRENT_BINARY_DIR}/testsuite/runtest.py"
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/testsuite/runtest.py")
add_custom_target ( CopyFiles ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/testsuite/runtest.py" )
set(OIIO_TESTSUITE_IMAGEDIR "${PROJECT_SOURCE_DIR}/.." CACHE PATH
"Location of oiio-images, openexr-images, libtiffpic, etc.." )
# oiio_set_testenv() - add environment variables to a test
#
# Usage:
# oiio_set_testenv ( testname
# testsuite - The root of all tests ${CMAKE_SOURCE_DIR}/testsuite
# testsrcdir - Current test directory in ${CMAKE_SOURCE_DIR}
# testdir - Current test sandbox in ${CMAKE_BINARY_DIR}
# IMAGEDIR - Optional path to image reference/compare directory)
#
macro (oiio_set_testenv testname testsuite testsrcdir testdir IMAGEDIR)
set_property(TEST ${testname} PROPERTY ENVIRONMENT
"OIIO_TESTSUITE_ROOT=${testsuite}"
";OIIO_TESTSUITE_SRC=${testsrcdir}"
";OIIO_TESTSUITE_CUR=${testdir}")
if (NOT ${IMAGEDIR} STREQUAL "")
set_property(TEST ${testname} APPEND PROPERTY ENVIRONMENT
"OIIO_TESTSUITE_IMAGEDIR=${IMAGEDIR}")
endif()
endmacro ()
# oiio_add_tests() - add a set of test cases.
#
# Usage:
# oiio_add_tests ( test1 [ test2 ... ]
# [ IMAGEDIR name_of_reference_image_directory ]
# [ URL http://find.reference.cases.here.com ]
# [ FOUNDVAR variable_name ... ]
# [ ENABLEVAR variable_name ... ]
# )
#
# The optional argument IMAGEDIR is used to check whether external test images
# (not supplied with OIIO) are present, and to disable the test cases if
# they're not. If IMAGEDIR is present, URL should also be included to tell
# the user where to find such tests.
#
# The optional FOUNDVAR introduces variables (typically Foo_FOUND) that if
# not existing and true, will skip the test.
#
# The optional ENABLEVAR introduces variables (typically ENABLE_Foo) that
# if existing and yet false, will skip the test.
#
macro (oiio_add_tests)
cmake_parse_arguments (_ats "" "" "URL;IMAGEDIR;LABEL;FOUNDVAR;ENABLEVAR;TESTNAME" ${ARGN})
# Arguments: <prefix> <options> <one_value_keywords> <multi_value_keywords> args...
set (_ats_testdir "${OIIO_TESTSUITE_IMAGEDIR}/${_ats_IMAGEDIR}")
# If there was a FOUNDVAR param specified and that variable name is
# not defined, mark the test as broken.
foreach (_var ${_ats_FOUNDVAR})
if (NOT ${_var})
set (_ats_LABEL "broken")
endif ()
endforeach ()
set (_test_disabled 0)
foreach (_var ${_ats_ENABLEVAR})
if ((NOT "${${_var}}" STREQUAL "" AND NOT "${${_var}}") OR
(NOT "$ENV{${_var}}" STREQUAL "" AND NOT "$ENV{${_var}}"))
set (_ats_LABEL "broken")
set (_test_disabled 1)
endif ()
endforeach ()
if (_test_disabled)
message (STATUS "Skipping test(s) ${_ats_UNPARSED_ARGUMENTS} because of disabled ${_ats_ENABLEVAR}")
elseif (_ats_IMAGEDIR AND NOT EXISTS ${_ats_testdir})
# If the directory containing reference data (images) for the test
# isn't found, point the user at the URL.
message (STATUS "\n\nDid not find ${_ats_testdir}")
message (STATUS " -> Will not run tests ${_ats_UNPARSED_ARGUMENTS}")
message (STATUS " -> You can find it at ${_ats_URL}\n")
else ()
# Add the tests if all is well.
set (_has_generator_expr TRUE)
foreach (_testname ${_ats_UNPARSED_ARGUMENTS})
set (_testsuite "${CMAKE_SOURCE_DIR}/testsuite")
set (_testsrcdir "${_testsuite}/${_testname}")
set (_testdir "${CMAKE_BINARY_DIR}/testsuite/${_testname}")
if (_ats_TESTNAME)
set (_testname "${_ats_TESTNAME}")
endif ()
if (_ats_LABEL MATCHES "broken")
set (_testname "${_testname}-broken")
endif ()
set (_runtest ${Python_EXECUTABLE} "${CMAKE_SOURCE_DIR}/testsuite/runtest.py" ${_testdir})
if (MSVC_IDE)
set (_runtest ${_runtest} --devenv-config $<CONFIGURATION>
--solution-path "${CMAKE_BINARY_DIR}" )
endif ()
file (MAKE_DIRECTORY "${_testdir}")
add_test ( NAME ${_testname}
COMMAND ${_runtest} )
oiio_set_testenv("${_testname}" "${_testsuite}"
"${_testsrcdir}" "${_testdir}" "${_ats_testdir}")
# For texture tests, add a second test using batch mode as well.
if (_testname MATCHES "texture")
set (_testname ${_testname}.batch)
set (_testdir ${_testdir}.batch)
set (_runtest ${Python_EXECUTABLE} "${CMAKE_SOURCE_DIR}/testsuite/runtest.py" ${_testdir})
if (MSVC_IDE)
set (_runtest ${_runtest} --devenv-config $<CONFIGURATION>
--solution-path "${CMAKE_BINARY_DIR}" )
endif ()
file (MAKE_DIRECTORY "${_testdir}")
add_test ( NAME "${_testname}"
COMMAND env TESTTEX_BATCH=1 ${_runtest} )
oiio_set_testenv("${_testname}" "${_testsuite}"
"${_testsrcdir}" "${_testdir}.batch" "${_ats_testdir}")
endif ()
#if (VERBOSE)
# message (STATUS "TEST ${_testname}: ${_runtest}")
#endif ()
endforeach ()
if (VERBOSE)
message (STATUS "TESTS: ${_ats_UNPARSED_ARGUMENTS}")
endif ()
endif ()
endmacro ()
# The tests are organized into a macro so it can be called after all the
# directories with plugins are included.
#
macro (oiio_add_all_tests)
# Tests that require oiio-images:
oiio_add_tests (gpsread
oiiotool oiiotool-attribs oiiotool-copy
oiiotool-xform
maketx oiiotool-maketx
misnamed-file
texture-crop texture-cropover
texture-filtersize
texture-overscan
texture-wrapfill
texture-res texture-maxres
IMAGEDIR oiio-images URL "Recent checkout of oiio-images"
)
# Remaining freestanding tests:
oiio_add_tests (
cmake-consumer
nonwhole-tiles
oiiotool-composite
oiiotool-fixnan
oiiotool-pattern
oiiotool-readerror
oiiotool-subimage oiiotool-text
diff
dither dup-channels
jpeg-corrupt
missingcolor
null
rational
texture-derivs texture-fill
texture-flipt texture-gettexels texture-gray
texture-interp-bicubic
texture-blurtube
texture-half texture-uint16
texture-interp-bilinear
texture-interp-closest
texture-mip-nomip texture-mip-onelevel
texture-mip-trilinear
texture-missing
texture-pointsample
texture-udim texture-udim2
texture-uint8
texture-width0blur
texture-fat texture-skinny
)
# Add tests that require the Python bindings if we built the Python
# bindings. This is mostly the test that are specifically about testing
# the Python bindings themselves, but also a handful of tests that are
# mainly about other things but happen to use Python in order to perform
# thee test.
# We also exclude these tests if this is a sanitizer build on Linux,
# because the Python interpreter itself won't be linked with the right asan
# libraries to run correctly.
if (USE_PYTHON AND NOT BUILD_OIIOUTIL_ONLY AND NOT SANITIZE_ON_LINUX)
oiio_add_tests (
python-typedesc python-paramlist
python-imagespec python-roi python-deep python-colorconfig
python-imageinput python-imageoutput
python-imagebuf python-imagebufalgo
IMAGEDIR oiio-images
)
endif ()
oiio_add_tests (oiiotool-color
FOUNDVAR OPENCOLORIO_FOUND)
if (NOT DEFINED ENV{CI} AND NOT DEFINED ENV{GITHUB_ACTIONS})
oiio_add_tests (texture-icwrite)
endif ()
# List testsuites for specific formats or features which might be not found
# or be intentionally disabled, or which need special external reference
# images from the web that if not found, should skip the tests:
oiio_add_tests (bmp
ENABLEVAR ENABLE_BMP
IMAGEDIR bmpsuite
URL http://entropymine.com/jason/bmpsuite/bmpsuite.zip)
oiio_add_tests (dpx
ENABLEVAR ENABLE_DPX
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (field3d texture-field3d
FOUNDVAR Field3D_FOUND ENABLEVAR ENABLE_FIELD3D)
oiio_add_tests (fits
ENABLEVAR ENABLE_FITS
IMAGEDIR fits-images
URL http://www.cv.nrao.edu/fits/data/tests/)
oiio_add_tests (gif
FOUNDVAR GIF_FOUND ENABLEVAR ENABLE_GIF
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (heif
FOUNDVAR Libheif_FOUND ENABLEVAR ENABLE_Libheif
URL https://github.com/nokiatech/heif/tree/gh-pages/content)
oiio_add_tests (ico
ENABLEVAR ENABLE_ICO
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (iff
ENABLEVAR ENABLE_IFF
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (jpeg2000
FOUNDVAR OPENJPEG_FOUND
IMAGEDIR j2kp4files_v1_5
URL http://www.itu.int/net/ITU-T/sigdb/speimage/ImageForm-s.aspx?val=10100803)
oiio_add_tests (openexr-suite openexr-multires openexr-chroma
openexr-v2 openexr-window perchannel
oiiotool-deep
IMAGEDIR openexr-images
URL http://www.openexr.com/downloads.html)
if (NOT DEFINED ENV{CI} AND NOT DEFINED ENV{GITHUB_ACTIONS})
oiio_add_tests (openexr-damaged
IMAGEDIR openexr-images
URL http://www.openexr.com/downloads.html)
endif ()
oiio_add_tests (openvdb
FOUNDVAR OpenVDB_FOUND ENABLEVAR ENABLE_OpenVDB)
oiio_add_tests (png
ENABLEVAR ENABLE_PNG
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (pnm
ENABLEVAR ENABLE_PNM
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (psd psd-colormodes
ENABLEVAR ENABLE_PSD
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (ptex
FOUNDVAR PTEX_FOUND ENABLEVAR ENABLE_PTEX)
oiio_add_tests (raw
FOUNDVAR LIBRAW_FOUND ENABLEVAR ENABLE_LIBRAW
IMAGEDIR oiio-images/raw
URL "Recent checkout of oiio-images")
oiio_add_tests (rla
ENABLEVAR ENABLE_RLA
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (sgi
ENABLEVAR ENABLE_SGI
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (targa-tgautils
ENABLEVAR ENABLE_TARGA
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
oiio_add_tests (tiff-suite tiff-depths tiff-misc
IMAGEDIR libtiffpic
URL http://www.simplesystems.org/libtiff/images.html)
oiio_add_tests (webp
FOUNDVAR WebP_FOUND ENABLEVAR ENABLE_WebP
IMAGEDIR oiio-images/webp URL "Recent checkout of oiio-images")
oiio_add_tests (zfile ENABLEVAR ENABLE_ZFILE
IMAGEDIR oiio-images URL "Recent checkout of oiio-images")
if (SPI_TESTS)
oiio_add_tests (oiiotool-spi
FOUNDVAR SPI_TESTS
IMAGEDIR spi-oiio-tests
URL "noplace -- it's SPI specific tests")
endif ()
endmacro()
-3
View File
@@ -4,9 +4,6 @@
#pragma once
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/fmath.h>
OIIO_PLUGIN_NAMESPACE_BEGIN
+7 -7
View File
@@ -6,13 +6,13 @@
#include <cstdio>
#include <cstdlib>
#include "dds_pvt.h"
#include <OpenImageIO/dassert.h>
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/fmath.h>
#include <OpenImageIO/imageio.h>
#include <OpenImageIO/typedesc.h>
#include "dds_pvt.h"
#include "squish.h"
OIIO_PLUGIN_NAMESPACE_BEGIN
@@ -139,10 +139,10 @@ DDSInput::open(const std::string& name, ImageSpec& newspec)
}
// due to struct packing, we may get a corrupt header if we just load the
// struct from file; to adress that, read every member individually
// struct from file; to address that, read every member individually
// save some typing
#define RH(memb) \
if (!fread(&m_dds.memb, sizeof(m_dds.memb), 1)) \
#define RH(memb) \
if (!fread(&m_dds.memb, sizeof(m_dds.memb), 1)) \
return false
RH(fourCC);
@@ -431,7 +431,7 @@ DDSInput::seek_subimage(int subimage, int miplevel)
// create imagespec for the 3x2 cube map layout
#ifdef DDS_3X2_CUBE_MAP_LAYOUT
m_spec = ImageSpec(w * 3, h * 2, m_nchans, TypeDesc::UINT8);
#else // 1x6 layout
#else // 1x6 layout
m_spec = ImageSpec(w, h * 6, m_nchans, TypeDesc::UINT8);
#endif // DDS_3X2_CUBE_MAP_LAYOUT
m_spec.depth = d;
@@ -667,7 +667,7 @@ DDSInput::read_native_tile(int subimage, int miplevel, int x, int y, int z,
internal_seek_subimage(((x / m_spec.tile_width) << 1)
+ y / m_spec.tile_height,
m_miplevel, w, h, d);
#else // 1x6 layout
#else // 1x6 layout
internal_seek_subimage(y / m_spec.tile_height, m_miplevel, w, h, d);
#endif // DDS_3X2_CUBE_MAP_LAYOUT
if (!w && !h && !d)
+1 -1
View File
@@ -53,6 +53,6 @@ private:
bool m_transparent;
};
} // namespace sqish
} // namespace squish
#endif // ndef SQUISH_COLOURSET_H
+3 -6
View File
@@ -6,7 +6,7 @@ project(documentation)
set (public_docs
"${OpenImageIO_SOURCE_DIR}/LICENSE.md"
"${OpenImageIO_SOURCE_DIR}/LICENSE-THIRD-PARTY.md"
"${OpenImageIO_SOURCE_DIR}/THIRD-PARTY.md"
"${OpenImageIO_SOURCE_DIR}/CHANGES.md"
CHANGES-0.x.md
CHANGES-1.x.md
@@ -21,10 +21,7 @@ endif()
# generate man pages using txt2man and a tiny python script to munge the
# result of "$tool --help"
find_program(TXT2MAN txt2man)
if (NOT PYTHONINTERP_FOUND)
find_package(PythonInterp)
endif ()
if (UNIX AND TXT2MAN AND PYTHONINTERP_FOUND)
if (UNIX AND TXT2MAN AND Python_Interpreter_FOUND)
message (STATUS "Unix man page documentation will be generated")
set (cli_tools oiiotool iinfo maketx idiff igrep iconvert)
@@ -37,7 +34,7 @@ if (UNIX AND TXT2MAN AND PYTHONINTERP_FOUND)
list (APPEND manpage_files ${outfile})
add_custom_command (OUTPUT ${outfile}
COMMAND ${tool} --help |
${PYTHON_EXECUTABLE} "${documentation_SOURCE_DIR}/help2man_preformat.py" |
${Python_EXECUTABLE} "${documentation_SOURCE_DIR}/help2man_preformat.py" |
${TXT2MAN} -v OpenImageIO -s 1 -t ${tool} > ${outfile}
DEPENDS ${tool} help2man_preformat.py)
endforeach()
+3 -20
View File
@@ -254,12 +254,6 @@ TAB_SIZE = 4
ALIASES = "rst=\verbatim embed:rst:leading-slashes"
ALIASES += "endrst=\endverbatim"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
@@ -900,11 +894,7 @@ RECURSIVE = YES
EXCLUDE = ../../src/include/OpenImageIO/filter.h \
../../src/include/OpenImageIO/plugin.h \
../../src/include/OpenImageIO/pugixml.cpp \
../../src/include/OpenImageIO/pugixml.hpp \
../../src/include/OpenImageIO/SHA1.h \
../../src/include/OpenImageIO/tinyformat.h \
../../src/include/OpenImageIO/fmt \
../../src/include/OpenImageIO/detail \
../../src/doc \
../../src/libOpenImageIO \
../../src/libtexture \
@@ -2165,8 +2155,10 @@ INCLUDE_FILE_PATTERNS = *.h
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS \
OIIO_DOXYGEN_ONLY:=1 \
OIIO_NO_SANITIZE_ADDRESS:= \
OIIO_API:= \
OIIO_HOSTDEVICE= \
OIIO_NAMESPACE_BEGIN="namespace OIIO {" \
OIIO_NAMESPACE_END="}" \
OIIO_CONSTEXPR14=constexpr \
@@ -2257,15 +2249,6 @@ EXTERNAL_PAGES = YES
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+221 -18
View File
@@ -24,6 +24,28 @@ It only supports unsigned integer 1-, 2-, 4-, and 8- bits per channel; only
grayscale, RGB, and RGBA; does not support MIPmaps, multiimage, or
tiles.
**Configuration settings for BMP input**
When opening a BMP ImageInput with a *configuration* (see
Section :ref:`sec-inputwithconfig`), the following special configuration
options are supported:
.. list-table::
:widths: 30 10 65
:header-rows: 1
* - Input Configuration Attribute
- Type
- Meaning
* - ``bmp:monochrome_detect``
- int
- If nonzero, try to detect when all palette entries are gray and pretend
that it's a 1-channel image to allow the calling app to save memory
and time (even though the BMP format does not actually support
grayscale images per se. It is 1 by default, but by setting the hint
to 0, you can disable this behavior.
**BMP Attributes**
.. list-table::
:widths: 30 10 65
@@ -41,7 +63,24 @@ tiles.
* - ``ResolutionUnit``
- string
- always ``"m"`` (pixels per meter)
* - ``bmp:bitsperpixel``
- int
- When not a whole number of bytes per channel, this describes the
bits per pixel in the file (16 for R4G4B4, 8 for a 256-color palette
image, 4 for a 16-color palette image, 1 for a 2-color palette image).
* - ``bmp:version``
- int
- Version of the BMP file format
**BMP Limitations**
* OIIO's current implementation will only write uncompessed 8bpp (from a
1-channel source), 24bpp (if 3 channel), or 32bpp (if 4 channel). Reads,
however, can handle RLE compression as well as 1, 4, or 16 bpp input.
* Only 1, 3, and 4-channel images are supported with BMP due to limitations
of the file format itself.
* BMP only supports uint8 pixel data types. Requests for other pixel data
types will automatically be converted to uint8.
|
@@ -163,6 +202,10 @@ options are supported:
- If nonzero, reading images with non-RGB color models (such as YCbCr)
will return unaltered pixel values (versus the default OIIO behavior
of automatically converting to RGB).
* - ``oiio:ioproxy``
- ptr
- Pointer to a ``Filesystem::IOProxy`` that will handle the I/O, for
example by reading from memory rather than the file system.
**Configuration settings for DPX output**
@@ -183,6 +226,17 @@ control aspects of the writing itself:
will keep unaltered pixel values (versus the default OIIO behavior
of automatically converting from RGB to the designated color space
as the pixels are written).
* - ``oiio:ioproxy``
- ptr
- Pointer to a ``Filesystem::IOProxy`` that will handle the I/O, for
example by writing to memory rather than the file system.
**Custom I/O Overrides**
DPX input and output both support the "custom I/O" feature via the
special ``"oiio:ioproxy"`` attributes (see Sections
:ref:`sec-imageoutput-ioproxy` and :ref:`sec-imageinput-ioproxy`) as well as
the `set_ioproxy()` methods.
**DPX Attributes**
@@ -503,10 +557,13 @@ despite its technical limitations.
- Frames per second
* - ``oiio:Movie``
- int
- If nonzero, indicates that it's an animated GIF.
* - ``gif:LoopCount``
- If nonzero, indicates that it's a multi-subimage file indended to represent an animation.
* - ``oiio:LoopCount``
- int
- Number of times the animation should be played (0-65535, 0 stands for infinity).
* - ``gif:LoopCount``
- int
- Deprecated synonym for ``oiio:LoopCount``.
* - ``ImageDescription``
- string
- The GIF comment field.
@@ -565,17 +622,18 @@ preferred except when legacy file access is required.
.. _sec-bundledplugins-heif:
HEIF/HEIC
HEIF/HEIC/AVIF
===============================================
HEIF is a container format for images compressed with the HEIC compression
standard (same compression as HEVC/H.265). It is used commonly for iPhone
camera pictures, but it is not Apple-specific and will probably become more
popualar on other platforms in coming years. HEIF files usually use the file
extension :file:`.HEIC`.
HEIF is a container format for images compressed with various compression
standards (HEIC is based on HEVC/H.265, AVIF is based on AV1). HEIC is used
commonly for iPhone camera pictures, but it is not Apple-specific and will
probably become more popular on other platforms in coming years. HEIF files
usually use the file extension :file:`.HEIC` or :file:`.AVIF` depending on their
main compression type.
HEIC compression is lossy, but is higher visual quality than JPEG while
taking only half the file size. Currently, OIIO's HEIF reader supports
HEIC and AVIF compression formats are lossy, but are higher visual quality than
JPEG while taking <= half the file size. Currently, OIIO's HEIF reader supports
reading files as RGB or RGBA, uint8 pixel values. Multi-image files are
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
@@ -596,9 +654,9 @@ control aspects of the writing itself:
- HEIF header data or explanation
* - ``Compression``
- string
- If supplied, must be ``"heic"``, but may optionally have a quality
value appended, like ``"heic:90"``. Quality can be 1-100, with 100
meaning lossless. The default is 75.
- If supplied, can be ``"heic"`` or ``"avif"``, but may optionally have a
quality value appended, like ``"heic:90"``. Quality can be 1-100, with
100 meaning lossless. The default is 75.
@@ -729,6 +787,36 @@ anywhere near the acceptance of the original JPEG/JFIF format.
Appendix :ref:`chap-stdmetadata` is properly translated when using
JPEG files.
**Configuration settings for JPEG output**
When opening a JPEG ImageOutput, the following special metadata tokens
control aspects of the writing itself:
.. list-table::
:widths: 30 10 65
:header-rows: 1
* - Output Configuration Attribute
- Type
- Meaning
* - ``oiio:dither``
- int
- If nonzero and outputting UINT8 values in the file, will add a small
amount of random dither to combat the appearance of banding.
* - ``oiio:ioproxy``
- ptr
- Pointer to a ``Filesystem::IOProxy`` that will handle the I/O, for
example by reading from memory rather than the file system.
* - ``jpeg:progressive``
- int
- If nonzero, will write a progressive JPEG file.
**Custom I/O Overrides**
JPEG input (but, currently, not output) supports the "custom I/O" feature
via the `ImageInput::set_ioproxy()` method and the special
``"oiio:ioproxy"`` attributes (see Section :ref:`sec-imageinput-ioproxy`).
**Limitations**
@@ -909,6 +997,9 @@ The official OpenEXR site is http://www.openexr.com/.
- matrix
- worldToCamera
* - ``worldtoscreen``
- matrix
- worldToScreen
* - ``worldtoNDC``
- matrix
- worldToNDC
* - ``ImageDescription``
@@ -1029,8 +1120,9 @@ control aspects of the writing itself:
**Custom I/O Overrides**
OpenEXR input and output both support the "custom I/O" feature via the
special ``"oiio:ioproxy"`` attributes (see
Sections :ref:`sec-imageoutput-ioproxy` and :ref:`sec-imageinput-ioproxy`).
special ``"oiio:ioproxy"`` attributes (see Sections
:ref:`sec-imageoutput-ioproxy` and :ref:`sec-imageinput-ioproxy`) as well as
the `set_ioproxy()` methods.
**A note on channel names**
@@ -1179,6 +1271,19 @@ control aspects of the writing itself:
* - Output Configuration Attribute
- Type
- Meaning
* - ``png:compressionLevel``
- int
- Compression level for zip/deflate compression, on a scale from 0
(fastest, minimal compression) to 9 (slowest, maximal compression).
The default is 6. PNG compression is always lossless.
* - ``png:filter``
- int
- Controls the "row filters" that prepare the image for optimal
compression. The default is 0 (``PNG_NO_FILTERS``), but other values
(which may be "or-ed" or summed to combine their effects) are 8
(``PNG_FILTER_NONE``), 16 (``PNG_FILTER_SUB``), 32
(``PNG_FILTER_UP``), 64 (``PNG_FILTER_AVG``), or 128
(``PNG_FILTER_PAETH``).
* - ``oiio:ioproxy``
- ptr
- Pointer to a ``Filesystem::IOProxy`` that will handle the I/O, for
@@ -1190,8 +1295,11 @@ control aspects of the writing itself:
**Custom I/O Overrides**
PNG output supports the "custom I/O" feature via the special
``"oiio:ioproxy"`` attributes (see Section :ref:`sec-imageoutput-ioproxy`).
PNG input and output both support the "custom I/O" feature via the special
``"oiio:ioproxy"`` attributes (see Sections :ref:`sec-imageoutput-ioproxy`
and :ref:`sec-imageinput-ioproxy`) as well as the `set_ioproxy()` methods.
**Limitations**
@@ -1400,6 +1508,10 @@ options are supported:
- int
- Set libraw highlight mode processing: 0 = clip, 1 = unclip, 2 =
blend, 3+ = rebuild. (Default: 0.)
* - ``raw:user_flip``
- int
- Set libraw user flip value : -1 ignored, other values are between [0; 8] with the same
definition than the Exif orientation code.
@@ -1649,6 +1761,64 @@ is the total number of channel samples in the thumbnail).
than 4 color channels.
|
.. _sec-bundledplugins-term:
Term (Terminal)
===============================================
This *experimental* output-only "format" is actually a procedural output
that writes a low-res representation of the image to the console output. It
requires a terminal application that supports Unicode and 24 bit color
extensions.
The `term` ImageOutput supports the following special metadata tokens to
control aspects of the writing itself:
.. list-table::
:widths: 30 10 65
:header-rows: 1
* - Output Configuration Attribute
- Type
- Meaning
* - ``term:method``
- string
- May be one of `iterm2`, `24bit` (default), `24bit-space`, `256color`,
or `dither`.
* - ``term:fit``
- int
- If 1 (the default), the image will be resized to fit on the console
window.
The `iterm2` mode is the best quality and is the default mode when actually
running on a Mac and launching using iTerm2 as the terminal. This mode uses
iTerm2's nonstandard extension to directly output an pixel array to be
visible in the terminal.
The default in other circumstances is the `24bit` mode, which displays two
approximately square pixels vertically in each character cell, by outputting
the Unicode "upper half block" glyph (`\u2508`) with the foreground color
set to the top pixel's color and the background color set to the bottom
pixel's color.
If this doesn't look right, or your terminal doesn't support Unicode,
the `24bit-space` is an alternate mode that displays one elongated pixel
in each character cell, writing a space character with the correct color.
There's also a `256color` method that just uses the 6x6x6 color space in the
256 color palette -- which looks horrible -- and an experimental `dither`
which does a half-assed Floyd-Steinberg dithering, horizontally only, and
frankly is not an improvement unless you squint really hard. These may
change or be eliminted in the future.
In all cases, the image will automatically be resized to fit in the terminal
and keep approximately the correct aspect ratio, as well as converted to
sRGB so it looks kinda ok.
|
.. _sec-bundledplugins-tiff:
@@ -1710,6 +1880,10 @@ options are supported:
- If nonzero, reading images with non-RGB color models (such as YCbCr)
will return unaltered pixel values (versus the default OIIO behavior
of automatically converting to RGB).
* - ``oiio:ioproxy``
- ptr
- Pointer to a ``Filesystem::IOProxy`` that will handle the I/O, for
example by reading from memory rather than the file system.
**Configuration settings for TIFF output**
@@ -1794,6 +1968,12 @@ part of the format name):
``T85``
``thunderscan``
**Custom I/O Overrides**
TIFF input (but, currently, not output) supports the "custom I/O" feature
via the `ImageInput::set_ioproxy()` method and the special
``"oiio:ioproxy"`` attributes (see Section :ref:`sec-imageinput-ioproxy`).
**Limitations**
OpenImageIO's TIFF reader and writer have some limitations you should be
@@ -1934,8 +2114,31 @@ aware of:
Webp
===============================================
FIXME
WebP is an image file format developed by Google that is intended to be an
open standard for lossy-compressed images for use on the web.
.. list-table::
:widths: 30 10 65
:header-rows: 1
* - ImageSpec Attribute
- Type
- WebP header data or explanation
* - ``oiio:Movie``
- int
- If nonzero, indicates that it's a multi-subimage file indended to
represent an animation.
* - ``oiio:LoopCount``
- int
- Number of times the animation should be played (0-65535, 0 stands for infinity).
* - ``gif:LoopCount``
- int
- Deprecated synonym for ``oiio:LoopCount``.
**Limitations**
* WebP only supports 3-channel (RGB) or 4-channel (RGBA) images and must
be 8-bit unsigned integer pixel values (uint8).
|
+2 -17
View File
@@ -62,30 +62,15 @@ print ("OIIO docs version = {}, release = {}".format(version, release))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
# sphinxtr extensions:
# https://github.com/jterrace/sphinxtr
# Copyright (c) 2012, Jeff Terrace
# BSD 2-clause license.
# add custom extensions directory to python path
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), 'extensions/sphinxtr'))
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), '../../ext/breathe'))
#import html_mods
#import latex_mods
extensions = [
'breathe',
# sphinxtr extensions:
#'fix_equation_ref',
#'sphinx.ext.mathjax',
#'sphinx.ext.ifconfig',
#'subfig',
#'numfig',
'numsec',
#'natbib',
#'figtable',
#'singlehtml_toc',
#'singletext',
'sphinx_tabs.tabs'
]
# Add any paths that contain templates here, relative to this directory.
+1 -1
View File
@@ -29,4 +29,4 @@ http://creativecommons.org/licenses/by/3.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/LICENSE-THIRD-PARTY.md
https://github.com/OpenImageIO/oiio/blob/master/THIRD-PARTY.md
-316
View File
@@ -1,316 +0,0 @@
import collections
Set = set
try:
from collections import OrderedDict
except ImportError:
class OrderedDict(dict):
'Dictionary that remembers insertion order'
# An inherited dict maps keys to values.
# The inherited dict provides __getitem__, __len__, __contains__, and get.
# The remaining methods are order-aware.
# Big-O running times for all methods are the same as for regular dictionaries.
# The internal self.__map dictionary maps keys to links in a doubly linked list.
# The circular doubly linked list starts and ends with a sentinel element.
# The sentinel element never gets deleted (this simplifies the algorithm).
# Each link is stored as a list of length three: [PREV, NEXT, KEY].
def __init__(self, *args, **kwds):
'''Initialize an ordered dictionary. Signature is the same as for
regular dictionaries, but keyword arguments are not recommended
because their insertion order is arbitrary.
'''
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
try:
self.__root
except AttributeError:
self.__root = root = [] # sentinel node
root[:] = [root, root, None]
self.__map = {}
self.__update(*args, **kwds)
def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
'od.__setitem__(i, y) <==> od[i]=y'
# Setting a new item creates a new link which goes at the end of the linked
# list, and the inherited dictionary is updated with the new key/value pair.
if key not in self:
root = self.__root
last = root[0]
last[1] = root[0] = self.__map[key] = [last, root, key]
dict_setitem(self, key, value)
def __delitem__(self, key, dict_delitem=dict.__delitem__):
'od.__delitem__(y) <==> del od[y]'
# Deleting an existing item uses self.__map to find the link which is
# then removed by updating the links in the predecessor and successor nodes.
dict_delitem(self, key)
link_prev, link_next, key = self.__map.pop(key)
link_prev[1] = link_next
link_next[0] = link_prev
def __iter__(self):
'od.__iter__() <==> iter(od)'
root = self.__root
curr = root[1]
while curr is not root:
yield curr[2]
curr = curr[1]
def __reversed__(self):
'od.__reversed__() <==> reversed(od)'
root = self.__root
curr = root[0]
while curr is not root:
yield curr[2]
curr = curr[0]
def clear(self):
'od.clear() -> None. Remove all items from od.'
try:
for node in self.__map.itervalues():
del node[:]
root = self.__root
root[:] = [root, root, None]
self.__map.clear()
except AttributeError:
pass
dict.clear(self)
def popitem(self, last=True):
'''od.popitem() -> (k, v), return and remove a (key, value) pair.
Pairs are returned in LIFO order if last is true or FIFO order if false.
'''
if not self:
raise KeyError('dictionary is empty')
root = self.__root
if last:
link = root[0]
link_prev = link[0]
link_prev[1] = root
root[0] = link_prev
else:
link = root[1]
link_next = link[1]
root[1] = link_next
link_next[0] = root
key = link[2]
del self.__map[key]
value = dict.pop(self, key)
return key, value
# -- the following methods do not depend on the internal structure --
def keys(self):
'od.keys() -> list of keys in od'
return list(self)
def values(self):
'od.values() -> list of values in od'
return [self[key] for key in self]
def items(self):
'od.items() -> list of (key, value) pairs in od'
return [(key, self[key]) for key in self]
def iterkeys(self):
'od.iterkeys() -> an iterator over the keys in od'
return iter(self)
def itervalues(self):
'od.itervalues -> an iterator over the values in od'
for k in self:
yield self[k]
def iteritems(self):
'od.iteritems -> an iterator over the (key, value) items in od'
for k in self:
yield (k, self[k])
def update(*args, **kwds):
'''od.update(E, **F) -> None. Update od from dict/iterable E and F.
If E is a dict instance, does: for k in E: od[k] = E[k]
If E has a .keys() method, does: for k in E.keys(): od[k] = E[k]
Or if E is an iterable of items, does: for k, v in E: od[k] = v
In either case, this is followed by: for k, v in F.items(): od[k] = v
'''
if len(args) > 2:
raise TypeError('update() takes at most 2 positional '
'arguments (%d given)' % (len(args),))
elif not args:
raise TypeError('update() takes at least 1 argument (0 given)')
self = args[0]
# Make progressively weaker assumptions about "other"
other = ()
if len(args) == 2:
other = args[1]
if isinstance(other, dict):
for key in other:
self[key] = other[key]
elif hasattr(other, 'keys'):
for key in other.keys():
self[key] = other[key]
else:
for key, value in other:
self[key] = value
for key, value in kwds.items():
self[key] = value
__update = update # let subclasses override update without breaking __init__
__marker = object()
def pop(self, key, default=__marker):
'''od.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised.
'''
if key in self:
result = self[key]
del self[key]
return result
if default is self.__marker:
raise KeyError(key)
return default
def setdefault(self, key, default=None):
'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'
if key in self:
return self[key]
self[key] = default
return default
def __repr__(self, _repr_running={}):
'od.__repr__() <==> repr(od)'
call_key = id(self), _get_ident()
if call_key in _repr_running:
return '...'
_repr_running[call_key] = 1
try:
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.items())
finally:
del _repr_running[call_key]
def __reduce__(self):
'Return state information for pickling'
items = [[k, self[k]] for k in self]
inst_dict = vars(self).copy()
for k in vars(OrderedDict()):
inst_dict.pop(k, None)
if inst_dict:
return (self.__class__, (items,), inst_dict)
return self.__class__, (items,)
def copy(self):
'od.copy() -> a shallow copy of od'
return self.__class__(self)
@classmethod
def fromkeys(cls, iterable, value=None):
'''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S
and values equal to v (which defaults to None).
'''
d = cls()
for key in iterable:
d[key] = value
return d
def __eq__(self, other):
'''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive
while comparison to a regular mapping is order-insensitive.
'''
if isinstance(other, OrderedDict):
return len(self)==len(other) and self.items() == other.items()
return dict.__eq__(self, other)
def __ne__(self, other):
return not self == other
# -- the following methods are only used in Python 2.7 --
def viewkeys(self):
"od.viewkeys() -> a set-like object providing a view on od's keys"
return KeysView(self)
def viewvalues(self):
"od.viewvalues() -> an object providing a view on od's values"
return ValuesView(self)
def viewitems(self):
"od.viewitems() -> a set-like object providing a view on od's items"
return ItemsView(self)
KEY, PREV, NEXT = range(3)
class OrderedSet(collections.MutableSet):
"""
From: http://code.activestate.com/recipes/576694/
"""
def __init__(self, iterable=None):
self.end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.map = {} # key --> [key, prev, next]
if iterable is not None:
self |= iterable
def __len__(self):
return len(self.map)
def __contains__(self, key):
return key in self.map
def add(self, key):
if key not in self.map:
end = self.end
curr = end[PREV]
curr[NEXT] = end[PREV] = self.map[key] = [key, curr, end]
def discard(self, key):
if key in self.map:
key, prev, next = self.map.pop(key)
prev[NEXT] = next
next[PREV] = prev
def __iter__(self):
end = self.end
curr = end[NEXT]
while curr is not end:
yield curr[KEY]
curr = curr[NEXT]
def __reversed__(self):
end = self.end
curr = end[PREV]
while curr is not end:
yield curr[KEY]
curr = curr[PREV]
def pop(self, last=True):
if not self:
raise KeyError('set is empty')
key = next(reversed(self)) if last else next(iter(self))
self.discard(key)
return key
def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, list(self))
def __eq__(self, other):
if isinstance(other, OrderedSet):
return len(self) == len(other) and list(self) == list(other)
return set(self) == set(other)
def __del__(self):
self.clear() # remove circular references
-90
View File
@@ -1,90 +0,0 @@
"""
Adds a new directive called 'figtable' that creates a figure
around a table.
"""
from docutils import nodes
import docutils.parsers.rst.directives as directives
from docutils.parsers.rst import Directive
from sphinx import addnodes
class figtable(nodes.General, nodes.Element):
pass
def visit_figtable_node(self, node):
pass
def depart_figtable_node(self, node):
pass
def visit_figtable_tex(self, node):
if node['nofig']:
self.body.append('\n\n\\begin{table}\n\\capstart\n\\begin{center}\n')
else:
self.body.append('\n\n\\begin{figure}[tbp]\n\\capstart\n\\begin{center}\n')
def depart_figtable_tex(self, node):
if node['nofig']:
self.body.append('\n\\end{center}\n\\end{table}\n')
else:
self.body.append('\n\\end{center}\n\\end{figure}\n')
def visit_figtable_html(self, node):
atts = {'class': 'figure align-center'}
self.body.append(self.starttag(node, 'div', **atts) + '<center>')
def depart_figtable_html(self, node):
self.body.append('</center></div>')
class FigTableDirective(Directive):
has_content = True
optional_arguments = 5
final_argument_whitespace = True
option_spec = {'label': directives.uri,
'spec': directives.unchanged,
'caption': directives.unchanged,
'alt': directives.unchanged,
'nofig': directives.flag}
def run(self):
label = self.options.get('label', None)
spec = self.options.get('spec', None)
caption = self.options.get('caption', None)
alt = self.options.get('alt', None)
nofig = 'nofig' in self.options
figtable_node = figtable('', ids=[label] if label is not None else [])
figtable_node['nofig'] = nofig
if spec is not None:
table_spec_node = addnodes.tabular_col_spec()
table_spec_node['spec'] = spec
figtable_node.append(table_spec_node)
node = nodes.Element()
self.state.nested_parse(self.content, self.content_offset, node)
tablenode = node[0]
if alt is not None:
tablenode['alt'] = alt
figtable_node.append(tablenode)
if caption is not None:
caption_node = nodes.caption('', '', nodes.Text(caption))
figtable_node.append(caption_node)
if label is not None:
targetnode = nodes.target('', '', ids=[label])
figtable_node.append(targetnode)
return [figtable_node]
def setup(app):
app.add_node(figtable,
html=(visit_figtable_html, depart_figtable_html),
singlehtml=(visit_figtable_html, depart_figtable_html),
latex=(visit_figtable_tex, depart_figtable_tex),
text=(visit_figtable_node, depart_figtable_node))
app.add_directive('figtable', FigTableDirective)
@@ -1,31 +0,0 @@
"""
Fixes equation references from Sphinx math domain
from Equation (1) to Equation 1, which is what they
should be. Must be before sphinx.ext.math* in
extensions list.
"""
from docutils import nodes
import sphinx.ext.mathbase
from sphinx.ext.mathbase import displaymath, eqref
def number_equations(app, doctree, docname):
num = 0
numbers = {}
for node in doctree.traverse(displaymath):
if node['label'] is not None:
num += 1
node['number'] = num
numbers[node['label']] = num
else:
node['number'] = None
for node in doctree.traverse(eqref):
if node['target'] not in numbers:
continue
num = '%d' % numbers[node['target']]
node[0] = nodes.Text(num, num)
sphinx.ext.mathbase.number_equations = number_equations
def setup(app):
pass
-68
View File
@@ -1,68 +0,0 @@
import re
from docutils import nodes
import sphinx.writers.html
BaseTranslator = sphinx.writers.html.HTMLTranslator
class CustomHTMLTranslator(BaseTranslator):
def visit_tabular_col_spec(self, node):
self.table_spec = re.split(r'[\s\|]+', node['spec'])
raise nodes.SkipNode
def bulk_text_processor(self, text):
if '~' in text:
text = text.replace('~', '&nbsp;')
return text
def visit_entry(self, node):
atts = {'class': []}
if isinstance(node.parent.parent, nodes.thead):
atts['class'].append('head')
if node.parent.parent.parent.stubs[node.parent.column]:
# "stubs" list is an attribute of the tgroup element
atts['class'].append('stub')
if atts['class']:
tagname = 'th'
atts['class'] = ' '.join(atts['class'])
else:
tagname = 'td'
del atts['class']
table_spec = getattr(self, 'table_spec', None)
if (tagname == 'td' or tagname == 'th') and table_spec is not None:
if len(table_spec) > node.parent.column:
colspec = table_spec[node.parent.column]
horiz_align = ''
vert_align = ''
if 'raggedright' in colspec or colspec == 'l':
horiz_align = ' align-left'
elif 'raggedleft' in colspec or colspec == 'r':
horiz_align = ' align-right'
elif 'center' in colspec or colspec == 'c':
horiz_align = ' align-center'
if 'p{' in colspec:
vert_align = ' align-top'
elif 'm{' in colspec:
vert_align = ' align-middle'
elif 'b{' in colspec:
vert_align = ' align-bottom'
align_type = {'l': 'left',
'r': 'right',
'c': 'center'}
atts['class'] = (atts.get('class', '') + horiz_align + vert_align)
node.parent.column += 1
if 'morerows' in node:
atts['rowspan'] = node['morerows'] + 1
if 'morecols' in node:
atts['colspan'] = node['morecols'] + 1
node.parent.column += node['morecols']
self.body.append(self.starttag(node, tagname, '', **atts))
self.context.append('</%s>\n' % tagname.lower())
if len(node) == 0: # empty cell
self.body.append('&nbsp;')
self.set_first_last(node)
sphinx.writers.html.SmartyPantsHTMLTranslator = CustomHTMLTranslator
-357
View File
@@ -1,357 +0,0 @@
# -*- coding: utf-8 -*-
import os
from docutils.io import FileOutput
from docutils.frontend import OptionParser
from docutils import nodes
from docutils.utils import smartquotes
import sphinx.builders.latex
# from sphinx.util.smartypants import educate_quotes_latex
from sphinx.writers.latex import LaTeXWriter
from sphinx.util.console import bold
from sphinx.util.osutil import copyfile
from sphinx.util.texescape import tex_escape_map
import sphinx.writers.latex
# remove usepackage for sphinx here, we add it later in the preamble in conf.py
# sphinx.writers.latex.HEADER = sphinx.writers.latex.HEADER.replace('\usepackage{sphinx}', '')
import re
# Constants for quote education.
punct_class = r"""[!"#\$\%'()*+,-.\/:;<=>?\@\[\\\]\^_`{|}~]"""
end_of_word_class = r"""[\s.,;:!?)]"""
close_class = r"""[^\ \t\r\n\[\{\(\-]"""
dec_dashes = r"""&#8211;|&#8212;"""
# Special case if the very first character is a quote
# followed by punctuation at a non-word-break. Close the quotes by brute force:
single_quote_start_re = re.compile(r"""^'(?=%s\\B)""" % (punct_class,))
double_quote_start_re = re.compile(r"""^"(?=%s\\B)""" % (punct_class,))
# Special case for double sets of quotes, e.g.:
# <p>He said, "'Quoted' words in a larger quote."</p>
double_quote_sets_re = re.compile(r""""'(?=\w)""")
single_quote_sets_re = re.compile(r"""'"(?=\w)""")
# Special case for decade abbreviations (the '80s):
decade_abbr_re = re.compile(r"""\b'(?=\d{2}s)""")
# Get most opening double quotes:
opening_double_quotes_regex = re.compile(r"""
(
\s | # a whitespace char, or
&#160; | # a non-breaking space entity, or
-- | # dashes, or
&[mn]dash; | # named dash entities
%s | # or decimal entities
&\#x201[34]; # or hex
)
" # the quote
(?=\w) # followed by a word character
""" % (dec_dashes,), re.VERBOSE)
# Double closing quotes:
closing_double_quotes_regex = re.compile(r"""
#(%s)? # character that indicates the quote should be closing
"
(?=%s)
""" % (close_class, end_of_word_class), re.VERBOSE)
closing_double_quotes_regex_2 = re.compile(r"""
(%s) # character that indicates the quote should be closing
"
""" % (close_class,), re.VERBOSE)
# Get most opening single quotes:
opening_single_quotes_regex = re.compile(r"""
(
\s | # a whitespace char, or
&#160; | # a non-breaking space entity, or
-- | # dashes, or
&[mn]dash; | # named dash entities
%s | # or decimal entities
&\#x201[34]; # or hex
)
' # the quote
(?=\w) # followed by a word character
""" % (dec_dashes,), re.VERBOSE)
closing_single_quotes_regex = re.compile(r"""
(%s)
'
(?!\s | s\b | \d)
""" % (close_class,), re.VERBOSE)
closing_single_quotes_regex_2 = re.compile(r"""
(%s)
'
(\s | s\b)
""" % (close_class,), re.VERBOSE)
def educate_quotes_latex(s, dquotes=("``", "''")):
"""
Parameter: String.
Returns: The string, with double quotes corrected to LaTeX quotes.
Example input: "Isn't this fun?"
Example output: ``Isn't this fun?'';
"""
# Special case if the very first character is a quote
# followed by punctuation at a non-word-break. Close the quotes
# by brute force:
s = single_quote_start_re.sub("\x04", s)
s = double_quote_start_re.sub("\x02", s)
# Special case for double sets of quotes, e.g.:
# <p>He said, "'Quoted' words in a larger quote."</p>
s = double_quote_sets_re.sub("\x01\x03", s)
s = single_quote_sets_re.sub("\x03\x01", s)
# Special case for decade abbreviations (the '80s):
s = decade_abbr_re.sub("\x04", s)
s = opening_single_quotes_regex.sub("\\1\x03", s)
s = closing_single_quotes_regex.sub("\\1\x04", s)
s = closing_single_quotes_regex_2.sub("\\1\x04\\2", s)
# Any remaining single quotes should be opening ones:
s = s.replace("'", "\x03")
s = opening_double_quotes_regex.sub("\\1\x01", s)
s = closing_double_quotes_regex.sub("\x02", s)
s = closing_double_quotes_regex_2.sub("\\1\x02", s)
# Any remaining quotes should be opening ones.
s = s.replace('"', "\x01")
# Finally, replace all helpers with quotes.
return s.replace("\x01", dquotes[0]).replace("\x02", dquotes[1]).\
replace("\x03", "`").replace("\x04", "'")
BaseTranslator = sphinx.writers.latex.LaTeXTranslator
class DocTranslator(BaseTranslator):
def __init__(self, *args, **kwargs):
BaseTranslator.__init__(self, *args, **kwargs)
self.verbatim = None
def visit_caption(self, node):
caption_idx = node.parent.index(node)
if caption_idx > 0:
look_node = node.parent.children[caption_idx - 1]
else:
look_node = node.parent
short_caption = unicode(look_node.get('alt', '')).translate(tex_escape_map)
if short_caption != "":
short_caption = '[%s]' % short_caption
self.in_caption += 1
self.body.append('\\caption%s{' % short_caption)
def depart_caption(self, node):
self.body.append('}')
self.in_caption -= 1
def visit_Text(self, node):
if self.verbatim is not None:
self.verbatim += node.astext()
else:
text = self.encode(node.astext())
if '\\textasciitilde{}' in text:
text = text.replace('\\textasciitilde{}', '~')
if not self.no_contractions:
# text = smartquotes(text)
text = educate_quotes_latex(text)
self.body.append(text)
def visit_table(self, node):
if self.table:
raise UnsupportedError(
'%s:%s: nested tables are not yet implemented.' %
(self.curfilestack[-1], node.line or ''))
self.table = sphinx.writers.latex.Table()
self.table.longtable = False
self.tablebody = []
self.tableheaders = []
# Redirect body output until table is finished.
self._body = self.body
self.body = self.tablebody
def depart_table(self, node):
self.body = self._body
colspec = self.table.colspec or ''
if 'p{' in colspec or 'm{' in colspec or 'b{' in colspec:
self.body.append('\n\\bodyspacing\n')
self.body.append('\n\\begin{tabular}')
if colspec:
self.body.append(colspec)
else:
self.body.append('{|' + ('l|' * self.table.colcount) + '}')
self.body.append('\n')
if self.table.caption is not None:
for id in self.next_table_ids:
self.body.append(self.hypertarget(id, anchor=False))
self.next_table_ids.clear()
self.body.append('\\toprule\n')
self.body.extend(self.tableheaders)
self.body.append('\\midrule\n')
self.body.extend(self.tablebody)
self.body.append('\\bottomrule\n')
self.body.append('\n\\end{tabular}\n')
self.table = None
self.tablebody = None
def depart_row(self, node):
if self.previous_spanning_row == 1:
self.previous_spanning_row = 0
self.body.append('\\\\\n')
else:
self.body.append('\\\\\n')
self.table.rowcount += 1
def depart_literal_block(self, node):
code = self.verbatim.rstrip('\n')
lang = self.hlsettingstack[-1][0]
linenos = code.count('\n') >= self.hlsettingstack[-1][1] - 1
highlight_args = node.get('highlight_args', {})
if 'language' in node:
# code-block directives
lang = node['language']
highlight_args['force'] = True
if 'linenos' in node:
linenos = node['linenos']
def warner(msg):
self.builder.warn(msg, (self.curfilestack[-1], node.line))
hlcode = self.highlighter.highlight_block(code, lang, warn=warner,
linenos=linenos, **highlight_args)
hlcode = hlcode.replace('\$', '$')
hlcode = hlcode.replace('\%', '%')
# workaround for Unicode issue
hlcode = hlcode.replace(u'€', u'@texteuro[]')
# must use original Verbatim environment and "tabular" environment
if self.table:
hlcode = hlcode.replace('\\begin{Verbatim}',
'\\begin{OriginalVerbatim}')
self.table.has_problematic = True
self.table.has_verbatim = True
# get consistent trailer
hlcode = hlcode.rstrip()[:-14] # strip \end{Verbatim}
hlcode = hlcode.rstrip() + '\n'
hlcode = '\n' + hlcode + '\\end{%sVerbatim}\n' % (self.table and 'Original' or '')
hlcode = hlcode.replace('Verbatim', 'lstlisting')
begin_bracket = hlcode.find('[')
end_bracket = hlcode.find(']')
hlcode = hlcode[:begin_bracket] + '[]' + hlcode[end_bracket+1:]
self.body.append(hlcode)
self.verbatim = None
def visit_figure(self, node):
ids = ''
for id in self.next_figure_ids:
ids += self.hypertarget(id, anchor=False)
self.next_figure_ids.clear()
if 'width' in node and node.get('align', '') in ('left', 'right'):
self.body.append('\\begin{wrapfigure}{%s}{%s}\n\\centering' %
(node['align'] == 'right' and 'r' or 'l',
node['width']))
self.context.append(ids + '\\end{wrapfigure}\n')
else:
if (not 'align' in node.attributes or
node.attributes['align'] == 'center'):
# centering does not add vertical space like center.
align = '\n\\centering'
align_end = ''
else:
# TODO non vertical space for other alignments.
align = '\\begin{flush%s}' % node.attributes['align']
align_end = '\\end{flush%s}' % node.attributes['align']
self.body.append('\\begin{figure}[tbp]%s\n' % align)
if any(isinstance(child, nodes.caption) for child in node):
self.body.append('\\capstart\n')
self.context.append(ids + align_end + '\\end{figure}\n')
# sphinx.writers.latex.LaTeXTranslator = DocTranslator
class CustomLaTeXTranslator(DocTranslator):
def astext(self):
return (#HEADER % self.elements +
#self.highlighter.get_stylesheet() +
u''.join(self.body)
#'\n' + self.elements['footer'] + '\n' +
#self.generate_indices() +
#FOOTER % self.elements
)
def unknown_departure(self, node):
if node.tagname == 'only':
return
return super(CustomLaTeXTranslator, self).unknown_departure(node)
def unknown_visit(self, node):
if node.tagname == 'only':
return
return super(CustomLaTeXTranslator, self).unknown_visit(node)
class CustomLaTeXBuilder(sphinx.builders.latex.LaTeXBuilder):
def write(self, *ignored):
super(CustomLaTeXBuilder, self).write(*ignored)
backup_translator = sphinx.writers.latex.LaTeXTranslator
sphinx.writers.latex.LaTeXTranslator = CustomLaTeXTranslator
backup_doc = sphinx.writers.latex.BEGIN_DOC
sphinx.writers.latex.BEGIN_DOC = ''
# output these as include files
for docname in ['abstract', 'dedication', 'acknowledgements']:
destination = FileOutput(
destination_path=os.path.join(self.outdir, '%s.inc' % docname),
encoding='utf-8')
docwriter = LaTeXWriter(self)
doctree = self.env.get_doctree(docname)
docsettings = OptionParser(
defaults=self.env.settings,
components=(docwriter,)).get_default_values()
doctree.settings = docsettings
docwriter.write(doctree, destination)
sphinx.writers.latex.LaTeXTranslator = backup_translator
sphinx.writers.latex.BEGIN_DOC = backup_doc
def finish(self, *args, **kwargs):
super(CustomLaTeXBuilder, self).finish(*args, **kwargs)
# copy additional files again *after* tex support files so we can override them!
if self.config.latex_additional_files:
self.info(bold('copying additional files again...'), nonl=1)
for filename in self.config.latex_additional_files:
self.info(' '+filename, nonl=1)
copyfile(os.path.join(self.confdir, filename),
os.path.join(self.outdir, os.path.basename(filename)))
self.info()
# monkey patch the shit out of it
# sphinx.builders.latex.LaTeXBuilder = CustomLaTeXBuilder
@@ -1,550 +0,0 @@
from docutils import nodes, transforms
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
from sphinx import addnodes
from sphinx.domains import Domain, ObjType
from sphinx.locale import l_, _
from sphinx.roles import XRefRole
from pybtex.database.input import bibtex
import pybtex.style.names.plain
import pybtex.style.names.lastfirst
import pybtex.backends.plaintext
import collections
import latex_codec
import os
import re
from backports import OrderedSet
# fix pybtex bug in some versions
try:
import pybtex.utils
def _fixed_pybtex_get(self, item, default=None):
"""A case insensitive get."""
try:
return self[self._keys[item.lower()]]
except KeyError:
return default
pybtex.utils.CaseInsensitiveDict.get = _fixed_pybtex_get
except:
pass
latex_codec.register()
DEFAULT_CONF = {
'file': '',
'brackets': '()',
'separator': ';',
'style': 'authoryear', # 'numbers', 'super'
'sort': False,
'sort_compress': False
}
ROLES = [
'p', 'ps', 'alp', 'alps',
't', 'ts', 'alt', 'alts',
'author', 'authors', 'year', 'yearpar', 'text', 'title'
]
SUBSUP_RE = re.compile(r'([\s\S^\^\_]*)([\^\_]){?([\S\s^}]*)}?')
def latex_to_nodes(text):
"""
Convert '_{}' and '^{}' text to node representation.
TODO: This doesn't work yet
"""
return nodes.inline(text, text)
m = SUBSUP_RE.findall(text)
if m:
n += latex_to_nodes(m[0][0])
if m[0][1] == '^':
n += nodes.superscript(latex_to_nodes(m[0][2]))
elif m[0][1] == '_':
n += nodes.subscript(latex_to_nodes(m[0][2]))
else:
n = nodes.inline(text, text)
return n
def parse_keys(rawtext):
# Get the keys and any pre- and post-ciation text
# Spaces nor commas are allowed in cite keys, so we split on commas
# first. This will give us a list of keys, however, the last item may have
# pre- and post-citation text (in brackets "[pre][post]")
#
# TODO: This isn't the best implementation and this should also
# handle errors
pre = u''
post = u''
keys = []
for k in rawtext.split(','):
k = k.strip() # Remove leading and trailing whitespace
k = k.split(' ', 1) # Split on the first space in the key, if any
if len(k) > 1:
# We have some extra text here
k, text = k
bo, bc = 0, 0
for c in text.strip():
if c == "[" and bo == bc:
bo += 1
elif c == "]" and bo == bc + 1:
bc += 1
else:
if bc == 0:
pre += c
else:
post += c
if bc == bo and bc == 1:
post = pre
pre = u''
else:
k = k[0]
keys.append(k)
return (keys, pre, post)
class Citations(object):
def __init__(self, env):
self.conf = DEFAULT_CONF.copy()
self.conf.update(env.config.natbib)
self.file_name = None
self.parser = None
self.data = None
self.ref_map = {}
file_name = self.conf.get('file')
if file_name:
self.file_name = file_name
self.parser = bibtex.Parser()
self.data = self.parser.parse_file(self.file_name)
def get(self, key):
return self.data.entries.get(key)
class CitationTransform(object):
"""
This class is meant to be applied to a ``docutils.nodes.pending`` node when a
``cite`` role is encountered. Later (during the resolve_xref stage) this
class can be used to generate the proper citation reference nodes for
insertion into the actual document.
"""
def __init__(self, refs, pre, post, typ, global_keys, config):
self.refs = refs
self.pre = pre
self.post = post
self.config = config
self.typ = typ
self.global_keys = global_keys
def __repr__(self):
return '<%s>' % self.__str__()
def __str__(self):
return ','.join([r.key for r in self.refs])
def get_ref_num(self, key):
for i, k in enumerate(self.global_keys):
if k == key:
return i + 1
def get_author(self, authors, all_authors=False):
if len(authors) == 0:
author = ''
elif len(authors) > 2 and not all_authors:
author = u'%s et al.' % authors[0].last()[0]
else:
author = u"%s and %s" % (u', '.join([a.last()[0] for a in authors[:-1]]),
authors[-1].last()[0])
author = author.replace('{', '')
author = author.replace('}', '')
return author
def cite(self, cmd, refuri, global_keys=None):
"""
Return a docutils Node consisting of properly formatted citations children
nodes.
"""
if global_keys is not None:
self.global_keys = global_keys
bo, bc = self.config['brackets']
sep = u'%s ' % self.config['separator']
style = self.config['style']
all_auths = (cmd.endswith('s'))
alt = (cmd.startswith('alt') or \
(cmd.startswith('alp')) or \
(style == 'citeyear'))
if (cmd.startswith('p') or cmd == 'yearpar') and style != 'super':
node = nodes.inline(bo, bo, classes=['citation'])
else:
node = nodes.inline('', '', classes=['citation'])
if self.pre:
pre = u"%s " % self.pre.decode('latex')
node += nodes.inline(pre, pre, classes=['pre'])
for i, ref in enumerate(self.refs):
authors = ref.persons.get('author', [])
author_text = self.get_author(authors, all_auths).decode('latex')
lrefuri = refuri + '#citation-' + nodes.make_id(ref.key)
if i > 0 and i < len(self.refs):
if style == "authoryear":
node += nodes.inline(sep, sep)
else:
if style == "super":
node += nodes.superscript(', ', ', ')
else:
node += nodes.inline(', ', ', ')
if cmd == 'title':
title = ref.fields.get('title')
if title is None:
title = ref.fields.get('key', '')
author_text = title
if (style == "authoryear" and (cmd.startswith('p') or cmd.startswith('alp'))) or \
(cmd.startswith('t') or cmd.startswith('alt') or cmd.startswith('author')):
node += nodes.reference(author_text, author_text, internal=True, refuri=lrefuri)
if cmd.startswith('p') or cmd.startswith('alp'):
node += nodes.inline(', ', ', ')
else:
node += nodes.inline(' ', ' ')
# Add in either the year or the citation number
if cmd == 'title':
pass
elif cmd.startswith('author'):
pass
else:
if style != 'authoryear':
num = self.get_ref_num(ref.key)
else:
num = ref.fields.get('year')
refnode = nodes.reference(str(num), str(num), internal=True, refuri=lrefuri)
if cmd.startswith('t') and style != 'super':
node += nodes.inline(bo, bo)
if style == 'super':
node += nodes.superscript('', '', refnode)
else:
node += refnode
if cmd.startswith('t') and style != 'super':
node += nodes.inline(bc, bc)
if self.post:
post = u", %s" % self.post.decode('latex')
node += nodes.inline(post, post, classes=['post'])
if (cmd.startswith('p') or cmd == 'yearpar') and style != 'super':
node += nodes.inline(bc, bc, classes=['citation'])
return node
def sort_references(refs, citations):
def sortkey(key):
# sort by author last names, but if no author, sort by title
citation = citations.get(key)
authorsort = u''.join(map(unicode, citation.persons.get('author', '')))
if len(authorsort) > 0:
authorsort = authorsort.replace('{', '')
authorsort = authorsort.replace('}', '')
return authorsort.upper()
titlesort = citation.fields.get('title', '')
titlesort = titlesort.replace('{', '')
titlesort = titlesort.replace('}', '')
return titlesort.upper()
sortedrefs = sorted(refs, key=sortkey)
return OrderedSet(sortedrefs)
class CitationXRefRole(XRefRole):
def __call__(self, typ, rawtext, text, lineno, inliner, options={}, \
content=[]):
"""
When a ``cite`` role is encountered, we replace it with a
``docutils.nodes.pending`` node that uses a ``CitationTrasform`` for
generating the proper citation reference representation during the
resolve_xref phase.
"""
rnodes = super(CitationXRefRole, self).__call__(typ, rawtext, text, lineno,
inliner, options, content)
rootnode = rnodes[0][0]
env = inliner.document.settings.env
citations = env.domains['cite'].citations
# Get the config at this point in the document
config = {}
for opt in ['style', 'brackets', 'separator', 'sort', 'sort_compress']:
config[opt] = env.temp_data.get("cite_%s" % opt, env.domaindata['cite']['conf'].get(opt, DEFAULT_CONF[opt]))
if typ == "cite:text":
# A ``text`` citation is unique because it doesn't reference a cite-key
keys = []
pre, post = text, ''
else:
keys, pre, post = parse_keys(text)
for key in keys:
if citations.get(key) is None:
env.warn(env.docname, "cite-key `%s` not found in bibtex file" % key, lineno)
continue
env.domaindata['cite']['keys'].add(key)
env.domaindata['cite']['keys'] = sort_references(env.domaindata['cite']['keys'], citations)
data = {'keys': keys,
'pre': pre,
'post': post,
'typ': typ,
'global_keys': env.domaindata['cite']['keys'],
'config': config}
rootnode += nodes.pending(CitationTransform, data)
return [rootnode], []
class CitationConfDirective(Directive):
"""
Allows the user to change the citation style on a per-page or
per-block basis.
"""
has_content = False
required_arguments = 0
optional_arguments = 1
option_spec = {
'brackets': directives.unchanged,
'separator': directives.unchanged,
'style': directives.unchanged,
'sort': directives.flag,
'sort_compress': directives.flag,
}
def run(self):
env = self.state.document.settings.env
# TODO: verify options
if self.arguments:
env.temp_data['cite_style'] = self.arguments[0]
else:
env.temp_data['cite_style'] = self.options.get('style', DEFAULT_CONF['style'])
try:
self.options.pop('style')
except:
pass
for k, v in self.options.items():
env.temp_data['cite_%s' % k] = v
return []
class CitationReferencesDirective(Directive):
"""
Generates the actual reference list.
"""
has_content = False
required_arguments = 0
optional_arguments = 0
# TODO: Implement support for multiple bib files
option_spec = {
'path': directives.unchanged,
}
def get_reference_node(self, ref):
node = nodes.inline('', '', classes=[ref.type, 'reference'])
namestyler = pybtex.style.names.plain.NameStyle()
plaintext = pybtex.backends.plaintext.Backend()
# Authors
authors = ref.persons.get('author', [])
for i, author in enumerate(authors):
authortext = namestyler.format(author, abbr=True).format().render(plaintext)
authortext = authortext.replace('{', '')
authortext = authortext.replace('}', '')
authortext = authortext.decode('latex')
text = authortext
text = text.strip()
auth_node = latex_to_nodes(text)
auth_node['classes'].append('author')
node += auth_node
if i + 1 < len(authors):
node += nodes.inline(', ', ', ')
else:
ending = '%s ' % ('' if text.endswith('.') else '.')
node += nodes.inline(ending, ending)
# Title
title = ref.fields.get('title')
if title is None:
title = ref.fields.get('key')
if title:
title = title.decode('latex')
title = title.replace('{', '')
title = title.replace('}', '')
node += nodes.inline(title, title, classes=['title'])
node += nodes.inline('. ', '. ')
# @phdthesis
if ref.type == 'phdthesis':
school = ref.fields.get('school')
school = school.decode('latex')
text = 'PhD Thesis, %s, ' % school
node += nodes.inline(text, text)
# Publication
pub = ref.fields.get('journal')
if not pub:
pub = ref.fields.get('booktitle')
if pub:
pub = pub.decode('latex')
pub = pub.replace('{', '')
pub = pub.replace('}', '')
node += nodes.emphasis(pub, pub, classes=['publication'])
node += nodes.inline(', ', ', ')
vol = ref.fields.get('volume')
pages = ref.fields.get('pages')
year = ref.fields.get('year')
if pub is None:
howpub = ref.fields.get('howpublished')
if howpub is not None and howpub.startswith('\url{'):
url = howpub[5:-1]
refnode = nodes.reference('', '', internal=False, refuri=url)
refnode += nodes.Text(url, url)
node += refnode
if vol or pages or year:
node += nodes.inline(', ', ', ')
if vol:
vol = vol.decode('latex')
node += nodes.inline(vol, vol, classes=['volume'])
node += nodes.inline(':', ':')
if pages:
pages = pages.decode('latex')
node += nodes.inline(pages, pages, classes=['pages'])
node += nodes.inline(', ', ', ')
if year:
year = year.decode('latex')
node += nodes.inline(year, year, classes=['year'])
node += nodes.inline('.', '.')
return node
def run(self):
"""
Generate the definition list that displays the actual references.
"""
env = self.state.document.settings.env
keys = env.domaindata['cite']['keys']
env.domaindata['cite']['refdoc'] = env.docname
citations = env.domains['cite'].citations
# TODO: implement
#env.domaindata['cite']['refdocs'][env.docname] = Citations(env, path)
tbody = nodes.tbody('')
for i, key in enumerate(keys):
row = nodes.row('')
nid = "citation-%s" % nodes.make_id(key)
row['classes'].append('footnote')
row['ids'].append(nid)
row['names'].append(nid)
numcol = nodes.entry('', nodes.paragraph('', '[%d]' % (i + 1)))
definition = self.get_reference_node(citations.get(key))
refcol = nodes.entry('', nodes.paragraph('', '', definition))
row.extend([numcol, refcol])
tbody.append(row)
table_spec_node = addnodes.tabular_col_spec()
table_spec_node['spec'] = 'cl'
node = nodes.table('',
table_spec_node,
nodes.tgroup('',
nodes.colspec(colwidth=10, classes=['label']),
nodes.colspec(colwidth=90),
tbody))
return [node]
class CitationDomain(Domain):
name = "cite"
label = "citation"
object_types = {
'citation': ObjType(l_('citation'), *ROLES, searchprio= -1),
}
directives = {
'conf': CitationConfDirective,
'refs': CitationReferencesDirective
}
roles = dict([(r, CitationXRefRole()) for r in ROLES])
initial_data = {
'keys': OrderedSet(), # Holds cite-keys in order of reference
'conf': DEFAULT_CONF,
'refdocs': {}
}
def __init__(self, env):
super(CitationDomain, self).__init__(env)
# Update conf
env.domaindata['cite']['conf'].update(env.config.natbib)
# TODO: warn if citations can't parse bibtex file
self.citations = Citations(env)
def resolve_xref(self, env, fromdocname, builder,
typ, target, node, contnode):
refdoc = env.domaindata['cite'].get('refdoc')
if not refdoc:
env.warn(fromdocname , 'no `refs` directive found; citations will have dead links', node.line)
refuri = ''
else:
refuri = builder.get_relative_uri(fromdocname, refdoc)
for nd in node.children:
if isinstance(nd, nodes.pending):
nd.details['refs'] = []
if builder.name == 'latex':
cite_keys = nd.details['keys']
cite_keys = ','.join(cite_keys)
cite_node = nodes.citation_reference(cite_keys, cite_keys)
return cite_node
for key in nd.details.pop('keys'):
ref = self.citations.get(key)
if ref is None:
continue
nd.details['refs'].append(ref)
transform = nd.transform(**nd.details)
node = transform.cite(typ, refuri, global_keys=env.domaindata['cite']['keys'])
return node
def setup(app):
app.add_config_value('natbib', DEFAULT_CONF, 'env')
app.add_domain(CitationDomain)
@@ -1,527 +0,0 @@
"""latex.py
Character translation utilities for LaTeX-formatted text.
Usage:
- unicode(string,'latex')
- ustring.decode('latex')
are both available just by letting "import latex" find this file.
- unicode(string,'latex+latin1')
- ustring.decode('latex+latin1')
where latin1 can be replaced by any other known encoding, also
become available by calling latex.register().
We also make public a dictionary latex_equivalents,
mapping ord(unicode char) to LaTeX code.
D. Eppstein, October 2003.
"""
from __future__ import generators
import codecs
import re
from backports import Set
def register():
"""Enable encodings of the form 'latex+x' where x describes another encoding.
Unicode characters are translated to or from x when possible, otherwise
expanded to latex.
"""
codecs.register(_registry)
def getregentry():
"""Encodings module API."""
return _registry('latex')
def _registry(encoding):
if encoding == 'latex':
encoding = None
elif encoding.startswith('latex+'):
encoding = encoding[6:]
else:
return None
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
"""Convert unicode string to latex."""
output = []
for c in input:
if encoding:
try:
output.append(c.encode(encoding))
continue
except:
pass
if ord(c) in latex_equivalents:
output.append(latex_equivalents[ord(c)])
else:
output += ['{\\char', str(ord(c)), '}']
return ''.join(output), len(input)
def decode(self,input,errors='strict'):
"""Convert latex source string to unicode."""
if encoding:
input = unicode(input,encoding,errors)
# Note: we may get buffer objects here.
# It is not permussable to call join on buffer objects
# but we can make them joinable by calling unicode.
# This should always be safe since we are supposed
# to be producing unicode output anyway.
x = map(unicode,_unlatex(input))
return u''.join(x), len(input)
class StreamWriter(Codec,codecs.StreamWriter):
pass
class StreamReader(Codec,codecs.StreamReader):
pass
return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
def _tokenize(tex):
"""Convert latex source into sequence of single-token substrings."""
start = 0
try:
# skip quickly across boring stuff
pos = _stoppers.finditer(tex).next().span()[0]
except StopIteration:
yield tex
return
while 1:
if pos > start:
yield tex[start:pos]
if tex[start] == '\\' and not (tex[pos-1].isdigit() and tex[start+1].isalpha()):
while pos < len(tex) and tex[pos].isspace(): # skip blanks after csname
pos += 1
while pos < len(tex) and tex[pos] in _ignore:
pos += 1 # flush control characters
if pos >= len(tex):
return
start = pos
if tex[pos:pos+2] in {'$$':None, '/~':None}: # protect ~ in urls
pos += 2
elif tex[pos].isdigit():
while pos < len(tex) and tex[pos].isdigit():
pos += 1
elif tex[pos] == '-':
while pos < len(tex) and tex[pos] == '-':
pos += 1
elif tex[pos] != '\\' or pos == len(tex) - 1:
pos += 1
elif not tex[pos+1].isalpha():
pos += 2
else:
pos += 1
while pos < len(tex) and tex[pos].isalpha():
pos += 1
if tex[start:pos] == '\\char' or tex[start:pos] == '\\accent':
while pos < len(tex) and tex[pos].isdigit():
pos += 1
class _unlatex:
"""Convert tokenized tex into sequence of unicode strings. Helper for decode()."""
def __iter__(self):
"""Turn self into an iterator. It already is one, nothing to do."""
return self
def __init__(self,tex):
"""Create a new token converter from a string."""
self.tex = tuple(_tokenize(tex)) # turn tokens into indexable list
self.pos = 0 # index of first unprocessed token
self.lastoutput = 'x' # lastoutput must always be nonempty string
def __getitem__(self,n):
"""Return token at offset n from current pos."""
p = self.pos + n
t = self.tex
return p < len(t) and t[p] or None
def next(self):
"""Find and return another piece of converted output."""
if self.pos >= len(self.tex):
raise StopIteration
nextoutput = self.chunk()
if self.lastoutput[0] == '\\' and self.lastoutput[-1].isalpha() and nextoutput[0].isalpha():
nextoutput = ' ' + nextoutput # add extra space to terminate csname
self.lastoutput = nextoutput
return nextoutput
def chunk(self):
"""Grab another set of input tokens and convert them to an output string."""
for delta,c in self.candidates(0):
if c in _l2u:
self.pos += delta
return unichr(_l2u[c])
elif len(c) == 2 and c[1] == 'i' and (c[0],'\\i') in _l2u:
self.pos += delta # correct failure to undot i
return unichr(_l2u[(c[0],'\\i')])
elif len(c) == 1 and c[0].startswith('\\char') and c[0][5:].isdigit():
self.pos += delta
return unichr(int(c[0][5:]))
# nothing matches, just pass through token as-is
self.pos += 1
return self[-1]
def candidates(self,offset):
"""Generate pairs delta,c where c is a token or tuple of tokens from tex
(after deleting extraneous brackets starting at pos) and delta
is the length of the tokens prior to bracket deletion.
"""
t = self[offset]
if t in _blacklist:
return
elif t == '{':
for delta,c in self.candidates(offset+1):
if self[offset+delta+1] == '}':
yield delta+2,c
elif t == '\\mbox':
for delta,c in self.candidates(offset+1):
yield delta+1,c
elif t == '$' and self[offset+2] == '$':
yield 3, (t,self[offset+1],t)
else:
q = self[offset+1]
if q == '{' and self[offset+3] == '}':
yield 4, (t,self[offset+2])
elif q:
yield 2, (t,q)
yield 1, t
latex_equivalents = {
0x0009: ' ',
0x000a: '\n',
0x0023: '{\#}',
0x0026: '{\&}',
0x00a0: '{~}',
0x00a1: '{!`}',
0x00a2: '{\\not{c}}',
0x00a3: '{\\pounds}',
0x00a7: '{\\S}',
0x00a8: '{\\"{}}',
0x00a9: '{\\copyright}',
0x00af: '{\\={}}',
0x00ac: '{\\neg}',
0x00ad: '{\\-}',
0x00b0: '{\\mbox{$^\\circ$}}',
0x00b1: '{\\mbox{$\\pm$}}',
0x00b2: '{\\mbox{$^2$}}',
0x00b3: '{\\mbox{$^3$}}',
0x00b4: "{\\'{}}",
0x00b5: '{\\mbox{$\\mu$}}',
0x00b6: '{\\P}',
0x00b7: '{\\mbox{$\\cdot$}}',
0x00b8: '{\\c{}}',
0x00b9: '{\\mbox{$^1$}}',
0x00bf: '{?`}',
0x00c0: '{\\`A}',
0x00c1: "{\\'A}",
0x00c2: '{\\^A}',
0x00c3: '{\\~A}',
0x00c4: '{\\"A}',
0x00c5: '{\\AA}',
0x00c6: '{\\AE}',
0x00c7: '{\\c{C}}',
0x00c8: '{\\`E}',
0x00c9: "{\\'E}",
0x00ca: '{\\^E}',
0x00cb: '{\\"E}',
0x00cc: '{\\`I}',
0x00cd: "{\\'I}",
0x00ce: '{\\^I}',
0x00cf: '{\\"I}',
0x00d1: '{\\~N}',
0x00d2: '{\\`O}',
0x00d3: "{\\'O}",
0x00d4: '{\\^O}',
0x00d5: '{\\~O}',
0x00d6: '{\\"O}',
0x00d7: '{\\mbox{$\\times$}}',
0x00d8: '{\\O}',
0x00d9: '{\\`U}',
0x00da: "{\\'U}",
0x00db: '{\\^U}',
0x00dc: '{\\"U}',
0x00dd: "{\\'Y}",
0x00df: '{\\ss}',
0x00e0: '{\\`a}',
0x00e1: "{\\'a}",
0x00e2: '{\\^a}',
0x00e3: '{\\~a}',
0x00e4: '{\\"a}',
0x00e5: '{\\aa}',
0x00e6: '{\\ae}',
0x00e7: '{\\c{c}}',
0x00e8: '{\\`e}',
0x00e9: "{\\'e}",
0x00ea: '{\\^e}',
0x00eb: '{\\"e}',
0x00ec: '{\\`\\i}',
0x00ed: "{\\'\\i}",
0x00ee: '{\\^\\i}',
0x00ef: '{\\"\\i}',
0x00f1: '{\\~n}',
0x00f2: '{\\`o}',
0x00f3: "{\\'o}",
0x00f4: '{\\^o}',
0x00f5: '{\\~o}',
0x00f6: '{\\"o}',
0x00f7: '{\\mbox{$\\div$}}',
0x00f8: '{\\o}',
0x00f9: '{\\`u}',
0x00fa: "{\\'u}",
0x00fb: '{\\^u}',
0x00fc: '{\\"u}',
0x00fd: "{\\'y}",
0x00ff: '{\\"y}',
0x0100: '{\\=A}',
0x0101: '{\\=a}',
0x0102: '{\\u{A}}',
0x0103: '{\\u{a}}',
0x0104: '{\\c{A}}',
0x0105: '{\\c{a}}',
0x0106: "{\\'C}",
0x0107: "{\\'c}",
0x0108: "{\\^C}",
0x0109: "{\\^c}",
0x010a: "{\\.C}",
0x010b: "{\\.c}",
0x010c: "{\\v{C}}",
0x010d: "{\\v{c}}",
0x010e: "{\\v{D}}",
0x010f: "{\\v{d}}",
0x0112: '{\\=E}',
0x0113: '{\\=e}',
0x0114: '{\\u{E}}',
0x0115: '{\\u{e}}',
0x0116: '{\\.E}',
0x0117: '{\\.e}',
0x0118: '{\\c{E}}',
0x0119: '{\\c{e}}',
0x011a: "{\\v{E}}",
0x011b: "{\\v{e}}",
0x011c: '{\\^G}',
0x011d: '{\\^g}',
0x011e: '{\\u{G}}',
0x011f: '{\\u{g}}',
0x0120: '{\\.G}',
0x0121: '{\\.g}',
0x0122: '{\\c{G}}',
0x0123: '{\\c{g}}',
0x0124: '{\\^H}',
0x0125: '{\\^h}',
0x0128: '{\\~I}',
0x0129: '{\\~\\i}',
0x012a: '{\\=I}',
0x012b: '{\\=\\i}',
0x012c: '{\\u{I}}',
0x012d: '{\\u\\i}',
0x012e: '{\\c{I}}',
0x012f: '{\\c{i}}',
0x0130: '{\\.I}',
0x0131: '{\\i}',
0x0132: '{IJ}',
0x0133: '{ij}',
0x0134: '{\\^J}',
0x0135: '{\\^\\j}',
0x0136: '{\\c{K}}',
0x0137: '{\\c{k}}',
0x0139: "{\\'L}",
0x013a: "{\\'l}",
0x013b: "{\\c{L}}",
0x013c: "{\\c{l}}",
0x013d: "{\\v{L}}",
0x013e: "{\\v{l}}",
0x0141: '{\\L}',
0x0142: '{\\l}',
0x0143: "{\\'N}",
0x0144: "{\\'n}",
0x0145: "{\\c{N}}",
0x0146: "{\\c{n}}",
0x0147: "{\\v{N}}",
0x0148: "{\\v{n}}",
0x014c: '{\\=O}',
0x014d: '{\\=o}',
0x014e: '{\\u{O}}',
0x014f: '{\\u{o}}',
0x0150: '{\\H{O}}',
0x0151: '{\\H{o}}',
0x0152: '{\\OE}',
0x0153: '{\\oe}',
0x0154: "{\\'R}",
0x0155: "{\\'r}",
0x0156: "{\\c{R}}",
0x0157: "{\\c{r}}",
0x0158: "{\\v{R}}",
0x0159: "{\\v{r}}",
0x015a: "{\\'S}",
0x015b: "{\\'s}",
0x015c: "{\\^S}",
0x015d: "{\\^s}",
0x015e: "{\\c{S}}",
0x015f: "{\\c{s}}",
0x0160: "{\\v{S}}",
0x0161: "{\\v{s}}",
0x0162: "{\\c{T}}",
0x0163: "{\\c{t}}",
0x0164: "{\\v{T}}",
0x0165: "{\\v{t}}",
0x0168: "{\\~U}",
0x0169: "{\\~u}",
0x016a: "{\\=U}",
0x016b: "{\\=u}",
0x016c: "{\\u{U}}",
0x016d: "{\\u{u}}",
0x016e: "{\\r{U}}",
0x016f: "{\\r{u}}",
0x0170: "{\\H{U}}",
0x0171: "{\\H{u}}",
0x0172: "{\\c{U}}",
0x0173: "{\\c{u}}",
0x0174: "{\\^W}",
0x0175: "{\\^w}",
0x0176: "{\\^Y}",
0x0177: "{\\^y}",
0x0178: '{\\"Y}',
0x0179: "{\\'Z}",
0x017a: "{\\'Z}",
0x017b: "{\\.Z}",
0x017c: "{\\.Z}",
0x017d: "{\\v{Z}}",
0x017e: "{\\v{z}}",
0x01c4: "{D\\v{Z}}",
0x01c5: "{D\\v{z}}",
0x01c6: "{d\\v{z}}",
0x01c7: "{LJ}",
0x01c8: "{Lj}",
0x01c9: "{lj}",
0x01ca: "{NJ}",
0x01cb: "{Nj}",
0x01cc: "{nj}",
0x01cd: "{\\v{A}}",
0x01ce: "{\\v{a}}",
0x01cf: "{\\v{I}}",
0x01d0: "{\\v\\i}",
0x01d1: "{\\v{O}}",
0x01d2: "{\\v{o}}",
0x01d3: "{\\v{U}}",
0x01d4: "{\\v{u}}",
0x01e6: "{\\v{G}}",
0x01e7: "{\\v{g}}",
0x01e8: "{\\v{K}}",
0x01e9: "{\\v{k}}",
0x01ea: "{\\c{O}}",
0x01eb: "{\\c{o}}",
0x01f0: "{\\v\\j}",
0x01f1: "{DZ}",
0x01f2: "{Dz}",
0x01f3: "{dz}",
0x01f4: "{\\'G}",
0x01f5: "{\\'g}",
0x01fc: "{\\'\\AE}",
0x01fd: "{\\'\\ae}",
0x01fe: "{\\'\\O}",
0x01ff: "{\\'\\o}",
0x02c6: '{\\^{}}',
0x02dc: '{\\~{}}',
0x02d8: '{\\u{}}',
0x02d9: '{\\.{}}',
0x02da: "{\\r{}}",
0x02dd: '{\\H{}}',
0x02db: '{\\c{}}',
0x02c7: '{\\v{}}',
0x03c0: '{\\mbox{$\\pi$}}',
# consider adding more Greek here
0xfb01: '{fi}',
0xfb02: '{fl}',
0x2013: '{--}',
0x2014: '{---}',
0x2018: "{`}",
0x2019: "{'}",
0x201c: "{``}",
0x201d: "{''}",
0x2020: "{\\dag}",
0x2021: "{\\ddag}",
0x2122: "{\\mbox{$^\\mbox{TM}$}}",
0x2022: "{\\mbox{$\\bullet$}}",
0x2026: "{\\ldots}",
0x2202: "{\\mbox{$\\partial$}}",
0x220f: "{\\mbox{$\\prod$}}",
0x2211: "{\\mbox{$\\sum$}}",
0x221a: "{\\mbox{$\\surd$}}",
0x221e: "{\\mbox{$\\infty$}}",
0x222b: "{\\mbox{$\\int$}}",
0x2248: "{\\mbox{$\\approx$}}",
0x2260: "{\\mbox{$\\neq$}}",
0x2264: "{\\mbox{$\\leq$}}",
0x2265: "{\\mbox{$\\geq$}}",
}
for _i in range(0x0020):
if _i not in latex_equivalents:
latex_equivalents[_i] = ''
for _i in range(0x0020,0x007f):
if _i not in latex_equivalents:
latex_equivalents[_i] = chr(_i)
# Characters that should be ignored and not output in tokenization
_ignore = Set([chr(i) for i in range(32)+[127]]) - Set('\t\n\r')
# Regexp of chars not in blacklist, for quick start of tokenize
_stoppers = re.compile('[\x00-\x1f!$\\-?\\{~\\\\`\']')
_blacklist = Set(' \n\r')
_blacklist.add(None) # shortcut candidate generation at end of data
# Construction of inverse translation table
_l2u = {
'\ ':ord(' ') # unexpanding space makes no sense in non-TeX contexts
}
for _tex in latex_equivalents:
if _tex <= 0x0020 or (_tex <= 0x007f and len(latex_equivalents[_tex]) <= 1):
continue # boring entry
_toks = tuple(_tokenize(latex_equivalents[_tex]))
if _toks[0] == '{' and _toks[-1] == '}':
_toks = _toks[1:-1]
if _toks[0].isalpha():
continue # don't turn ligatures into single chars
if len(_toks) == 1 and (_toks[0] == "'" or _toks[0] == "`"):
continue # don't turn ascii quotes into curly quotes
if _toks[0] == '\\mbox' and _toks[1] == '{' and _toks[-1] == '}':
_toks = _toks[2:-1]
if len(_toks) == 4 and _toks[1] == '{' and _toks[3] == '}':
_toks = (_toks[0],_toks[2])
if len(_toks) == 1:
_toks = _toks[0]
_l2u[_toks] = _tex
# Shortcut candidate generation for certain useless candidates:
# a character is in _blacklist if it can not be at the start
# of any translation in _l2u. We use this to quickly skip through
# such characters before getting to more difficult-translate parts.
# _blacklist is defined several lines up from here because it must
# be defined in order to call _tokenize, however it is safe to
# delay filling it out until now.
for i in range(0x0020,0x007f):
_blacklist.add(chr(i))
_blacklist.remove('{')
_blacklist.remove('$')
for candidate in _l2u:
if isinstance(candidate,tuple):
if not candidate or not candidate[0]:
continue
firstchar = candidate[0][0]
else:
firstchar = candidate[0]
_blacklist.discard(firstchar)
-200
View File
@@ -1,200 +0,0 @@
from docutils import nodes
from sphinx.roles import XRefRole
import figtable
import subfig
from backports import OrderedDict, OrderedSet
# Element classes
class page_ref(nodes.reference):
pass
class num_ref(nodes.reference):
pass
# Visit/depart functions
def skip_page_ref(self, node):
raise nodes.SkipNode
def latex_visit_page_ref(self, node):
self.body.append("\\pageref{%s:%s}" % (node['refdoc'], node['reftarget']))
raise nodes.SkipNode
def latex_visit_num_ref(self, node):
fields = node['reftarget'].split('#')
if len(fields) > 1:
label, target = fields
else:
label = None
target = fields[0]
if target not in self.builder.env.docnames_by_figname:
raise nodes.SkipNode
targetdoc = self.builder.env.docnames_by_figname[target]
ref_link = '%s:%s' % (targetdoc, target)
if label is None:
latex = '\\ref{%s}' % ref_link
else:
latex = "\\hyperref[%s]{%s \\ref*{%s}}" % (ref_link, label, ref_link)
self.body.append(latex)
raise nodes.SkipNode
def doctree_read(app, doctree):
# first generate figure numbers for each figure
env = app.builder.env
docname_figs = getattr(env, 'docname_figs', {})
docnames_by_figname = getattr(env, 'docnames_by_figname', {})
for figure_info in doctree.traverse(lambda n: isinstance(n, nodes.figure) or \
isinstance(n, subfig.subfigend) or \
isinstance(n, figtable.figtable)):
for id in figure_info['ids']:
fig_docname = docnames_by_figname[id] = env.docname
if fig_docname not in docname_figs:
docname_figs[fig_docname] = OrderedDict()
if isinstance(figure_info.parent, subfig.subfig):
mainid = figure_info.parent['mainfigid']
else:
mainid = id
if mainid not in docname_figs[fig_docname]:
docname_figs[fig_docname][mainid] = OrderedSet()
if isinstance(figure_info.parent, subfig.subfig):
docname_figs[fig_docname][mainid].add(id)
env.docnames_by_figname = docnames_by_figname
env.docname_figs = docname_figs
def figname_is_id(s):
"determine if string is 'idX' where X is an integer"
if s.startswith('id') and len(s) > 2:
isint = False
try:
isint = int(s[2:]) is not None
except ValueError:
isint = False
return isint
def doctree_resolved(app, doctree, docname):
# replace numfig nodes with links
if app.builder.name in ('html', 'singlehtml', 'epub'):
env = app.builder.env
docname_figs = getattr(env, 'docname_figs', {})
docnames_by_figname = env.docnames_by_figname
figids = getattr(env, 'figids', {})
secnums = []
fignames_by_secnum = {}
for figdocname, figurelist in env.docname_figs.iteritems():
if figdocname not in env.toc_secnumbers:
continue
secnum = env.toc_secnumbers[figdocname]['']
secnums.append(secnum)
fignames_by_secnum[secnum] = figurelist
last_secnum = 0
secnums = sorted(secnums)
figid = 1
for secnum in secnums:
if secnum[0] != last_secnum:
figid = 1
for figname, subfigs in fignames_by_secnum[secnum].iteritems():
if figname_is_id(figname):
continue
figids[figname] = str(secnum[0]) + '.' + str(figid)
isub = 0
for subfigname in subfigs:
subfigid = figids[figname] + chr(ord('a') + isub)
figids[subfigname] = subfigid
if not figname_is_id(subfigname):
isub += 1
figid += 1
last_secnum = secnum[0]
env.figids = figids
for figure_info in doctree.traverse(lambda n: isinstance(n, nodes.figure) or \
isinstance(n, subfig.subfigend) or \
isinstance(n, figtable.figtable)):
try:
id = figure_info['ids'][0]
fignum = figids[id]
except (IndexError, KeyError):
continue
for cap in figure_info.traverse(nodes.caption):
cap.insert(1, nodes.Text(" %s" % cap[0]))
if fignum[-1] in map(str, range(10)):
boldcaption = "%s %s:" % (app.config.figure_caption_prefix, fignum)
else:
boldcaption = "(%s)" % fignum[-1]
cap[0] = nodes.strong('', boldcaption)
for ref_info in doctree.traverse(num_ref):
if '#' in ref_info['reftarget']:
label, target = ref_info['reftarget'].split('#')
labelfmt = label + " %s"
else:
labelfmt = '%s'
target = ref_info['reftarget']
if target not in docnames_by_figname:
app.warn('Target figure not found: %s' % target)
link = "#%s" % target
linktext = target
else:
target_doc = docnames_by_figname[target]
if app.builder.name == 'singlehtml':
link = "#%s" % target
else:
link = "%s#%s"%(app.builder.get_relative_uri(docname,
target_doc),
target)
if target in figids:
linktext = labelfmt % figids[target]
else:
linktext = target
html = '<a href="%s">%s</a>' % (link, linktext)
ref_info.replace_self(nodes.raw(html, html, format='html'))
def setup(app):
app.add_config_value('number_figures', True, True)
app.add_config_value('figure_caption_prefix', "Figure", True)
app.add_node(page_ref,
text=(skip_page_ref, None),
html=(skip_page_ref, None),
singlehtml=(skip_page_ref, None),
latex=(latex_visit_page_ref, None))
app.add_role('page', XRefRole(nodeclass=page_ref))
app.add_node(num_ref,
latex=(latex_visit_num_ref, None),
text=(skip_page_ref, None))
app.add_role('num', XRefRole(nodeclass=num_ref))
app.connect('doctree-read', doctree_read)
app.connect('doctree-resolved', doctree_resolved)
-51
View File
@@ -1,51 +0,0 @@
"""
Changes section references to be the section number
instead of the title of the section.
"""
from docutils import nodes
import sphinx.domains.std
class CustomStandardDomain(sphinx.domains.std.StandardDomain):
def __init__(self, env):
env.settings['footnote_references'] = 'superscript'
sphinx.domains.std.StandardDomain.__init__(self, env)
def resolve_xref(self, env, fromdocname, builder,
typ, target, node, contnode):
res = super(CustomStandardDomain, self).resolve_xref(env, fromdocname, builder,
typ, target, node, contnode)
if res is None:
return res
if typ == 'ref' and not node['refexplicit']:
docname, labelid, sectname = self.data['labels'].get(target, ('','',''))
res['refdocname'] = docname
return res
def doctree_resolved(app, doctree, docname):
secnums = app.builder.env.toc_secnumbers
for node in doctree.traverse(nodes.reference):
if 'refdocname' in node:
refdocname = node['refdocname']
if refdocname in secnums:
secnum = secnums[refdocname]
toclist = app.builder.env.tocs[refdocname]
for child in node.traverse():
if isinstance(child, nodes.Text):
text = child.astext()
anchorname = None
for refnode in toclist.traverse(nodes.reference):
if refnode.astext() == text:
anchorname = refnode['anchorname']
if anchorname is None:
continue
linktext = '.'.join(map(str, secnum[anchorname]))
child.parent.replace(child, nodes.Text(linktext))
def setup(app):
app.override_domain(CustomStandardDomain)
app.connect('doctree-resolved', doctree_resolved)
@@ -1,39 +0,0 @@
"""
Fixes the table of contents in singlehtml mode so that section titles have the
correct section number in front.
"""
from docutils import nodes
from sphinx import addnodes
def stringize_secnum(secnum):
return '.'.join(map(str, secnum))
def doctree_resolved(app, doctree, fromdocname):
if app.builder.name == 'singlehtml':
secnums = app.builder.env.toc_secnumbers
for filenode in doctree.traverse(addnodes.start_of_file):
docname = filenode['docname']
if docname not in secnums:
continue
doc_secnums = secnums[docname]
first_title_node = filenode.next_node(nodes.title)
if first_title_node is not None and '' in doc_secnums:
file_secnum = stringize_secnum(doc_secnums[''])
title_text_node = first_title_node.children[0]
newtext = file_secnum + ' ' + title_text_node.astext()
first_title_node.replace(title_text_node, nodes.Text(newtext))
for section_node in filenode.traverse(nodes.section):
for id in section_node['ids']:
if '#' + id in doc_secnums:
subsection_num = stringize_secnum(doc_secnums['#' + id])
first_title_node = section_node.next_node(nodes.title)
if first_title_node is not None:
title_text_node = first_title_node.children[0]
newtext = subsection_num + ' ' + title_text_node.astext()
first_title_node.replace(title_text_node, nodes.Text(newtext))
def setup(app):
app.connect('doctree-resolved', doctree_resolved)
-61
View File
@@ -1,61 +0,0 @@
import codecs
from os import path
from docutils.io import StringOutput
from sphinx.util.console import bold, darkgreen, brown
from sphinx.util.nodes import inline_all_toctrees
from sphinx.util.osutil import ensuredir, os_path
from sphinx.builders.text import TextBuilder
from sphinx.writers.text import TextWriter, TextTranslator
class SingleFileTextTranslator(TextTranslator):
def visit_start_of_file(self, node):
pass
def depart_start_of_file(self, node):
pass
class SingleFileTextWriter(TextWriter):
def translate(self):
visitor = SingleFileTextTranslator(self.document, self.builder)
self.document.walkabout(visitor)
self.output = visitor.body
class SingleFileTextBuilder(TextBuilder):
"""
A TextBuilder subclass that puts the whole document tree in one text file.
"""
name = 'singletext'
copysource = False
def get_outdated_docs(self):
return 'all documents'
def assemble_doctree(self):
master = self.config.master_doc
tree = self.env.get_doctree(master)
tree = inline_all_toctrees(
self, set(), master, tree, darkgreen, [master])
tree['docname'] = master
self.env.resolve_references(tree, master, self)
return tree
def prepare_writing(self, docnames):
self.writer = SingleFileTextWriter(self)
def write(self, *ignored):
docnames = self.env.all_docs
self.info(bold('preparing documents... '), nonl=True)
self.prepare_writing(docnames)
self.info('done')
self.info(bold('assembling single document... '), nonl=True)
doctree = self.assemble_doctree()
self.info()
self.info(bold('writing... '), nonl=True)
self.write_doc(self.config.master_doc, doctree)
self.info('done')
def setup(app):
app.add_builder(SingleFileTextBuilder)
-164
View File
@@ -1,164 +0,0 @@
"""
Adds subfigure functionality
"""
from docutils import nodes
import docutils.parsers.rst.directives as directives
from docutils.parsers.rst import Directive
from sphinx import addnodes
class subfig(nodes.General, nodes.Element):
pass
def skip_visit(self, node):
raise nodes.SkipNode
def visit_subfig_tex(self, node):
self.__body = self.body
self.body = []
def depart_subfig_tex(self, node):
figoutput = ''.join(self.body)
figoutput = figoutput.replace('[tbp]', '[t]{%s\\linewidth}' % node['width'])
figoutput = figoutput.replace('figure', 'subfigure')
self.body = self.__body
self.body.append(figoutput)
def visit_subfig_html(self, node):
self.__body = self.body
self.body = []
def depart_subfig_html(self, node):
figoutput = ''.join(self.body)
figoutput = figoutput.replace('class="figure', 'style="width: %g%%" class="subfigure' % (float(node['width']) * 100))
self.body = self.__body
self.body.append(figoutput)
class subfigstart(nodes.General, nodes.Element):
pass
def visit_subfigstart_tex(self, node):
self.body.append('\n\\begin{figure}\n\\centering\n\\capstart\n')
def depart_subfigstart_tex(self, node):
pass
def visit_subfigstart_html(self, node):
atts = {'class': 'figure compound align-center'}
self.body.append(self.starttag(node['subfigend'], 'div', **atts))
def depart_subfigstart_html(self, node):
pass
class subfigend(nodes.General, nodes.Element):
pass
def visit_subfigend_tex(self, node):
pass
def depart_subfigend_tex(self, node):
self.body.append('\n\n\\end{figure}\n\n')
def visit_subfigend_html(self, node):
pass
def depart_subfigend_html(self, node):
self.body.append('</div>')
class SubFigEndDirective(Directive):
has_content = True
optional_arguments = 3
final_argument_whitespace = True
option_spec = {'label': directives.uri,
'alt': directives.unchanged,
'width': directives.unchanged_required}
def run(self):
label = self.options.get('label', None)
width = self.options.get('width', None)
alt = self.options.get('alt', None)
node = subfigend('', ids=[label] if label is not None else [])
if width is not None:
node['width'] = width
if alt is not None:
node['alt'] = alt
if self.content:
anon = nodes.Element()
self.state.nested_parse(self.content, self.content_offset, anon)
first_node = anon[0]
if isinstance(first_node, nodes.paragraph):
caption = nodes.caption(first_node.rawsource, '',
*first_node.children)
node += caption
if label is not None:
targetnode = nodes.target('', '', ids=[label])
node.append(targetnode)
return [node]
class SubFigStartDirective(Directive):
has_content = False
optional_arguments = 0
def run(self):
node = subfigstart()
return [node]
def doctree_read(app, doctree):
secnums = app.builder.env.toc_secnumbers
for node in doctree.traverse(subfigstart):
parentloc = node.parent.children.index(node)
subfigendloc = parentloc
while subfigendloc < len(node.parent.children):
n = node.parent.children[subfigendloc]
if isinstance(n, subfigend):
break
subfigendloc += 1
if subfigendloc == len(node.parent.children):
return
between_nodes = node.parent.children[parentloc:subfigendloc]
subfigend_node = node.parent.children[subfigendloc]
node['subfigend'] = subfigend_node
for i, n in enumerate(between_nodes):
if isinstance(n, nodes.figure):
children = [n]
prevnode = between_nodes[i-1]
if isinstance(prevnode, nodes.target):
node.parent.children.remove(prevnode)
children.insert(0, prevnode)
nodeloc = node.parent.children.index(n)
node.parent.children[nodeloc] = subfig('', *children)
node.parent.children[nodeloc]['width'] = subfigend_node['width']
node.parent.children[nodeloc]['mainfigid'] = subfigend_node['ids'][0]
def setup(app):
app.add_node(subfigstart,
html=(visit_subfigstart_html, depart_subfigstart_html),
singlehtml=(visit_subfigstart_html, depart_subfigstart_html),
text=(skip_visit, None),
latex=(visit_subfigstart_tex, depart_subfigstart_tex))
app.add_node(subfig,
html=(visit_subfig_html, depart_subfig_html),
singlehtml=(visit_subfig_html, depart_subfig_html),
text=(skip_visit, None),
latex=(visit_subfig_tex, depart_subfig_tex))
app.add_node(subfigend,
html=(visit_subfigend_html, depart_subfigend_html),
singlehtml=(visit_subfigend_html, depart_subfigend_html),
text=(skip_visit, None),
latex=(visit_subfigend_tex, depart_subfigend_tex))
app.add_directive('subfigstart', SubFigStartDirective)
app.add_directive('subfigend', SubFigEndDirective)
app.connect('doctree-read', doctree_read)
+10
View File
@@ -45,6 +45,10 @@ Glossary
that an image was scanned, the camera settings used when a photograph
was taken, etc.
Multi-part image / multi-part file
This is what OpenEXR calls a file containing multiple subimages.
Native data format
The *data format* used in the disk file representing an image. Note that
@@ -70,6 +74,12 @@ Glossary
into horizontal scanlines, typically with the ability to read or write
an entire scanline at once. See also :term:`tiled image`.
Subimage
Some image file formats allow the storage of multiple images in each
file. These are called *subimages* in OpenImageIO. Note that in OpenEXR,
these are called :term:`multi-part` files.
Tile
A rectangular region of pixels of an image. A rectangular tile is more
+1 -1
View File
@@ -10,7 +10,7 @@ import sys
lines = [l.rstrip().replace('\t', ' '*8) for l in sys.stdin.readlines()]
print('TITLE')
print('NAME')
print(lines[0])
print()
+26 -26
View File
@@ -42,37 +42,37 @@ Making an empty or uninitialized ImageBuf
Constructing a readable ImageBuf
--------------------------------
.. doxygenfunction:: OIIO::ImageBuf::ImageBuf(string_view, int, int, ImageCache *, const ImageSpec *, Filesystem::IOProxy *)
.. doxygenfunction:: OIIO::ImageBuf::reset(string_view, int, int, ImageCache *, const ImageSpec *, Filesystem::IOProxy *)
.. doxygenfunction:: OIIO::ImageBuf::ImageBuf(string_view name, int subimage = 0, int miplevel = 0, ImageCache *imagecache = nullptr, const ImageSpec *config = nullptr, Filesystem::IOProxy *ioproxy = nullptr)
.. doxygenfunction:: OIIO::ImageBuf::reset(string_view name, int subimage = 0, int miplevel = 0, ImageCache *imagecache = nullptr, const ImageSpec *config = nullptr, Filesystem::IOProxy *ioproxy = nullptr)
Constructing a writeable ImageBuf
Constructing a writable ImageBuf
--------------------------------------------------
.. doxygenfunction:: OIIO::ImageBuf::ImageBuf(const ImageSpec&, InitializePixels)
.. doxygenfunction:: OIIO::ImageBuf::reset(const ImageSpec&, InitializePixels)
.. doxygenfunction:: OIIO::ImageBuf::make_writeable
.. doxygenfunction:: OIIO::ImageBuf::ImageBuf(const ImageSpec &spec, InitializePixels zero = InitializePixels::Yes)
.. doxygenfunction:: OIIO::ImageBuf::reset(const ImageSpec &spec, InitializePixels zero = InitializePixels::Yes)
.. doxygenfunction:: OIIO::ImageBuf::make_writable
Constructing an ImageBuf that "wraps" an application buffer
-------------------------------------------------------------
.. doxygenfunction:: OIIO::ImageBuf::ImageBuf(const ImageSpec&, void *)
.. doxygenfunction:: OIIO::ImageBuf::reset(const ImageSpec&, void *)
.. doxygenfunction:: OIIO::ImageBuf::ImageBuf(const ImageSpec &spec, void *buffer)
.. doxygenfunction:: OIIO::ImageBuf::reset(const ImageSpec &spec, void *buffer)
Reading and Writing disk images
-------------------------------
.. doxygenfunction:: OIIO::ImageBuf::read(int, int, bool, TypeDesc, ProgressCallback, void *)
.. doxygenfunction:: OIIO::ImageBuf::read(int, int, int, int, bool, TypeDesc, ProgressCallback, void *)
.. doxygenfunction:: OIIO::ImageBuf::read(int subimage = 0, int miplevel = 0, bool force = false, TypeDesc convert = TypeDesc::UNKNOWN, ProgressCallback progress_callback = nullptr, void *progress_callback_data = nullptr)
.. doxygenfunction:: OIIO::ImageBuf::read(int subimage, int miplevel, int chbegin, int chend, bool force, TypeDesc convert, ProgressCallback progress_callback = nullptr, void *progress_callback_data = nullptr)
.. doxygenfunction:: OIIO::ImageBuf::init_spec
.. doxygenfunction:: OIIO::ImageBuf::write(string_view, TypeDesc, string_view, ProgressCallback, void *) const
.. doxygenfunction:: OIIO::ImageBuf::write(ImageOutput *, ProgressCallback, void *) const
.. doxygenfunction:: OIIO::ImageBuf::set_write_format(TypeDesc)
.. doxygenfunction:: OIIO::ImageBuf::set_write_format(cspan<TypeDesc>)
.. doxygenfunction:: OIIO::ImageBuf::write(string_view filename, TypeDesc dtype = TypeUnknown, string_view fileformat = string_view(), ProgressCallback progress_callback = nullptr, void *progress_callback_data = nullptr) const
.. doxygenfunction:: OIIO::ImageBuf::write(ImageOutput *out, ProgressCallback progress_callback = nullptr, void *progress_callback_data = nullptr) const
.. doxygenfunction:: OIIO::ImageBuf::set_write_format(TypeDesc format)
.. doxygenfunction:: OIIO::ImageBuf::set_write_format(cspan<TypeDesc> format)
.. doxygenfunction:: OIIO::ImageBuf::set_write_tiles
.. doxygenfunction:: OIIO::ImageBuf::set_write_ioproxy
@@ -133,17 +133,17 @@ Getting and setting information about an ImageBuf
.. doxygenfunction:: OIIO::ImageBuf::contains_roi
.. doxygenfunction:: OIIO::ImageBuf::pixeltype
.. doxygenfunction:: OIIO::ImageBuf::threads() const
.. doxygenfunction:: OIIO::ImageBuf::threads(int) const
.. doxygenfunction:: OIIO::ImageBuf::threads(int n) const
Copying ImageBuf's and blocks of pixels
========================================
.. doxygenfunction:: OIIO::ImageBuf::operator=(const ImageBuf&)
.. doxygenfunction:: OIIO::ImageBuf::operator=(ImageBuf&&)
.. doxygenfunction:: OIIO::ImageBuf::copy(const ImageBuf&, TypeDesc)
.. doxygenfunction:: OIIO::ImageBuf::copy(TypeDesc) const
.. doxygenfunction:: OIIO::ImageBuf::operator=(const ImageBuf &src)
.. doxygenfunction:: OIIO::ImageBuf::operator=(ImageBuf &&src)
.. doxygenfunction:: OIIO::ImageBuf::copy(const ImageBuf &src, TypeDesc format = TypeUnknown)
.. doxygenfunction:: OIIO::ImageBuf::copy(TypeDesc format) const
.. doxygenfunction:: OIIO::ImageBuf::copy_metadata
.. doxygenfunction:: OIIO::ImageBuf::copy_pixels
.. doxygenfunction:: OIIO::ImageBuf::swap
@@ -156,15 +156,15 @@ Getting and setting pixel values
**Getting and setting individual pixels -- slow**
.. doxygenfunction:: OIIO::ImageBuf::getchannel
.. doxygenfunction:: OIIO::ImageBuf::getpixel(int, int, int, float *, int, WrapMode) const
.. doxygenfunction:: OIIO::ImageBuf::getpixel(int x, int y, int z, float *pixel, int maxchannels = 1000, WrapMode wrap = WrapBlack) const
.. doxygenfunction:: OIIO::ImageBuf::interppixel
.. doxygenfunction:: OIIO::ImageBuf::interppixel_bicubic
.. doxygenfunction:: OIIO::ImageBuf::interppixel_NDC
.. doxygenfunction:: OIIO::ImageBuf::interppixel_bicubic_NDC
.. doxygenfunction:: OIIO::ImageBuf::setpixel(int, int, int, const float *, int)
.. doxygenfunction:: OIIO::ImageBuf::setpixel(int, const float *, int)
.. doxygenfunction:: OIIO::ImageBuf::setpixel(int x, int y, int z, cspan<float> pixel)
.. doxygenfunction:: OIIO::ImageBuf::setpixel(int i, cspan<float> pixel)
|
@@ -183,10 +183,10 @@ Deep data in an ImageBuf
.. doxygenfunction:: OIIO::ImageBuf::set_deep_samples
.. doxygenfunction:: OIIO::ImageBuf::deep_insert_samples
.. doxygenfunction:: OIIO::ImageBuf::deep_erase_samples
.. doxygenfunction:: OIIO::ImageBuf::deep_value(int, int, int, int, int) const
.. doxygenfunction:: OIIO::ImageBuf::deep_value_uint(int, int, int, int, int) const
.. doxygenfunction:: OIIO::ImageBuf::set_deep_value(int, int, int, int, int, float)
.. doxygenfunction:: OIIO::ImageBuf::set_deep_value(int, int, int, int, int, uint32_t)
.. doxygenfunction:: OIIO::ImageBuf::deep_value(int x, int y, int z, int c, int s) const
.. doxygenfunction:: OIIO::ImageBuf::deep_value_uint(int x, int y, int z, int c, int s) const
.. doxygenfunction:: OIIO::ImageBuf::set_deep_value(int x, int y, int z, int c, int s, float value)
.. doxygenfunction:: OIIO::ImageBuf::set_deep_value(int x, int y, int z, int c, int s, uint32_t value)
.. doxygenfunction:: OIIO::ImageBuf::deep_pixel_ptr
.. cpp:function:: DeepData& OIIO::ImageBuf::deepdata()
+7 -7
View File
@@ -58,13 +58,13 @@ constructed \ImageBuf using the default constructor.
\apiend
\subsection*{Constructing and initializing a writeable \ImageBuf}
\subsection*{Constructing and initializing a writable \ImageBuf}
\apiitem{{\ce ImageBuf} (const ImageSpec \&spec, \\
\bigspc\bigspc InitializePixels zero = InitializePixels::Yes) \\
{\ce ImageBuf} (string_view name, const ImageSpec \&spec, \\
\bigspc\bigspc InitializePixels zero = InitializePixels::Yes) }
Constructs a writeable \ImageBuf with the given specification (including
Constructs a writable \ImageBuf with the given specification (including
resolution, data type, metadata, etc.).
The {\cf zero} parameter controls whether the pixel values are filled with
black/empty, or are left uninitialized after being allocated (if set to
@@ -75,7 +75,7 @@ Optionally, you may name the \ImageBuf.
\apiitem{void {\ce reset} (const ImageSpec \&spec, bool zero = true) \\
void {\ce reset} (string_view name, const ImageSpec \&spec, bool zero = true)}
Destroys any previous contents of the \ImageBuf and re-initializes it
as a writeable all-black \ImageBuf with the given specification (including
as a writable all-black \ImageBuf with the given specification (including
resolution, data type, metadata, etc.).
The {\cf zero} parameter controls whether the pixel values are filled with
black/empty, or are left uninitialized after being allocated (if set to
@@ -84,8 +84,8 @@ Optionally, you may name the \ImageBuf.
\ImageBuf.
\apiend
\apiitem{bool make_writeable (bool keep_cache_type = false)}
Force the \ImageBuf to be writeable. That means that if it was previously
\apiitem{bool make_writable (bool keep_cache_type = false)}
Force the \ImageBuf to be writable. That means that if it was previously
backed by an \ImageCache (storage was {\cf IMAGECACHE}), it will force a
full read so that the whole image is in local memory.
This will invalidate any current iterators on the image. It has
@@ -94,7 +94,7 @@ it works (including if no read was necessary), {\cf false} if something went
horribly wrong. If {\cf keep_cache_type} is true, it preserves any
\ImageCache-forced data types (you might want to do this if it is critical
that the apparent data type doesn't change, for example if you are calling
make_writeable from within a type-specialized function).
make_writable from within a type-specialized function).
\apiend
\subsection*{Constructing a readable \ImageBuf and reading from a file}
@@ -382,7 +382,7 @@ of the pixel data window.
\apiend
\apiitem{ImageSpec \& {\ce specmod} ()}
This returns a \emph{writeable} reference to the \ImageSpec describing
This returns a \emph{writable} reference to the \ImageSpec describing
the buffer. It's ok to modify most of the metadata, but if you modify
the spec's {\cf format}, {\cf width}, {\cf height}, or {\cf depth}
fields, you get the pain you deserve, as the \ImageBuf will no longer
+164 -111
View File
@@ -33,15 +33,25 @@ Most ImageBufAlgo functions that produce image data come in two forms:
error, the result image returned can have any error conditions checked with
`has_error()` and `geterror()`.
.. code-block:: cpp
.. tabs::
// Method 1: Return an image result
ImageBuf fg ("fg.exr"), bg ("bg.exr");
ImageBuf dst = ImageBufAlgo::over (fg, bg);
if (dst.has_error())
std::cout << "error: " << dst.geterror() << "\n";
.. 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())
2. Pass a destination ImageBuf reference as the first parameter.
The function is passed a *destination* ImageBuf where the results will
@@ -50,15 +60,26 @@ Most ImageBufAlgo functions that produce image data come in two forms:
destination ImageBuf (the one that is being altered) will have an error
message set.
.. code-block:: cpp
// 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";
.. 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())
The first option (return an ImageBuf directly) is a more compact and
@@ -151,7 +172,8 @@ pre-allocated `dst` nor a non-default ROI.
zero() -- create a black image
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: zero(ROI, int)
.. doxygenfunction:: zero(ROI roi, int nthreads = 0)
..
Examples::
@@ -175,7 +197,7 @@ zero() -- create a black image
Result-as-parameter version:
.. doxygenfunction:: zero(ImageBuf&, ROI, int)
.. doxygenfunction:: zero(ImageBuf &dst, ROI roi = {}, int nthreads = 0)
|
@@ -206,7 +228,7 @@ fill() -- fill a region with a solid color or gradient
checker() -- make a checker pattern
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: checker(int, int, int, cspan<float>, cspan<float>, int, int, int, ROI, int)
.. doxygenfunction:: checker(int width, int height, int depth, cspan<float> color1, cspan<float> color2, int xoffset, int yoffset, int zoffset, ROI roi, int nthreads = 0)
..
Examples::
@@ -224,7 +246,7 @@ checker() -- make a checker pattern
Result-as-parameter version:
.. doxygenfunction:: checker(ImageBuf&, int, int, int, cspan<float>, cspan<float>, int, int, int, ROI, int)
.. doxygenfunction:: checker(ImageBuf &dst, int width, int height, int depth, cspan<float> color1, cspan<float> color2, int xoffset = 0, int yoffset = 0, int zoffset = 0, ROI roi = {}, int nthreads = 0)
|
@@ -233,7 +255,7 @@ checker() -- make a checker pattern
noise() -- make a noise pattern
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: noise(string_view, float, float, bool, int, ROI, int)
.. doxygenfunction:: noise(string_view noisetype, float A = 0.0f, float B = 0.1f, bool mono = false, int seed = 0, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -271,7 +293,7 @@ noise() -- make a noise pattern
Result-as-parameter version:
.. doxygenfunction:: noise(ImageBuf&, string_view, float, float, bool, int, ROI, int)
.. doxygenfunction:: noise(ImageBuf &dst, string_view noisetype, float A = 0.0f, float B = 0.1f, bool mono = false, int seed = 0, ROI roi = {}, int nthreads = 0)
|
@@ -328,7 +350,7 @@ Drawing shapes: points, lines, boxes
Drawing text
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: render_text(ImageBuf&, int, int, string_view, int, string_view, cspan<float>, TextAlignX, TextAlignY, int, ROI, int)
.. doxygenfunction:: render_text(ImageBuf &dst, int x, int y, string_view text, int fontsize = 16, string_view fontname = "", cspan<float> textcolor = 1.0f, TextAlignX alignx = TextAlignX::Left, TextAlignY aligny = TextAlignY::Baseline, int shadow = 0, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -385,7 +407,7 @@ Image transformations and data movement
Shuffling channels
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. doxygenfunction:: channels(const ImageBuf&, int, cspan<int>, cspan<float>, cspan<std::string>, bool, int)
.. doxygenfunction:: channels(const ImageBuf &src, int nchannels, cspan<int> channelorder, cspan<float> channelvalues = {}, cspan<std::string> newchannelnames = {}, bool shuffle_channel_names = false, int nthreads = 0)
..
Examples::
@@ -418,12 +440,12 @@ Shuffling channels
Result-as-parameter version:
.. doxygenfunction:: channels(ImageBuf&, const ImageBuf&, int, cspan<int>, cspan<float>, cspan<std::string>, bool, int)
.. doxygenfunction:: channels(ImageBuf &dst, const ImageBuf &src, int nchannels, cspan<int> channelorder, cspan<float> channelvalues = {}, cspan<std::string> newchannelnames = {}, bool shuffle_channel_names = false, int nthreads = 0)
|
.. doxygenfunction:: channel_append(const ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: channel_append(const ImageBuf &A, const ImageBuf &B, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -434,12 +456,12 @@ Shuffling channels
Result-as-parameter version:
.. doxygenfunction:: channel_append(ImageBuf&, const ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: channel_append(ImageBuf &dst, const ImageBuf &A, const ImageBuf &B, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: copy(const ImageBuf&, TypeDesc, ROI, int)
.. doxygenfunction:: copy(const ImageBuf &src, TypeDesc convert = TypeUnknown, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -450,12 +472,12 @@ Shuffling channels
Result-as-parameter version:
.. doxygenfunction:: copy(ImageBuf&, const ImageBuf&, TypeDesc, ROI, int)
.. doxygenfunction:: copy(ImageBuf &dst, const ImageBuf &src, TypeDesc convert = TypeUnknown, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: crop(const ImageBuf&, ROI, int)
.. doxygenfunction:: crop(const ImageBuf &src, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -466,12 +488,12 @@ Shuffling channels
Result-as-parameter version:
.. doxygenfunction:: crop(ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: crop(ImageBuf &dst, const ImageBuf &src, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: cut(const ImageBuf&, ROI, int)
.. doxygenfunction:: cut(const ImageBuf &src, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -483,7 +505,7 @@ Shuffling channels
Result-as-parameter version:
.. doxygenfunction:: cut(ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: cut(ImageBuf &dst, const ImageBuf &src, ROI roi = {}, int nthreads = 0)
|
@@ -557,7 +579,7 @@ Shuffling channels
.. doxygenfunction:: reorient(const ImageBuf&, int)
.. doxygenfunction:: reorient(const ImageBuf &src, int nthreads = 0)
..
Examples::
@@ -567,13 +589,13 @@ Shuffling channels
Result-as-parameter version:
.. doxygenfunction:: reorient(ImageBuf&, const ImageBuf&, int)
.. doxygenfunction:: reorient(ImageBuf &dst, const ImageBuf &src, int nthreads = 0)
|
.. doxygenfunction:: circular_shift(const ImageBuf&, int, int, int, ROI, int)
.. doxygenfunction:: circular_shift(const ImageBuf &src, int xshift, int yshift, int zshift = 0, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -593,7 +615,7 @@ Shuffling channels
Result-as-parameter version:
.. doxygenfunction:: circular_shift(ImageBuf&, const ImageBuf&, int, int, int, ROI, int)
.. doxygenfunction:: circular_shift(ImageBuf &dst, const ImageBuf &src, int xshift, int yshift, int zshift = 0, ROI roi = {}, int nthreads = 0)
..
|
@@ -633,7 +655,7 @@ Shuffling channels
|
.. doxygenfunction:: resample(const ImageBuf&, bool, ROI, int)
.. doxygenfunction:: resample(const ImageBuf &src, bool interpolate = true, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -645,7 +667,7 @@ Shuffling channels
Result-as-parameter version:
.. doxygenfunction:: resample(ImageBuf&, const ImageBuf&, bool, ROI, int)
.. doxygenfunction:: resample(ImageBuf &dst, const ImageBuf &src, bool interpolate = true, ROI roi = {}, int nthreads = 0)
..
|
@@ -686,7 +708,7 @@ Shuffling channels
Image arithmetic
================
.. doxygenfunction:: add(Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: add(Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -704,14 +726,14 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: add(ImageBuf&, Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: add(ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: sub(Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: sub(Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -722,13 +744,13 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: sub(ImageBuf&, Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: sub(ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: absdiff(Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: absdiff(Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -739,12 +761,12 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: absdiff(ImageBuf&, Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: absdiff(ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: abs(const ImageBuf&, ROI, int)
.. doxygenfunction:: abs(const ImageBuf &A, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -754,13 +776,13 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: abs(ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: abs(ImageBuf &dst, const ImageBuf &A, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: mul(Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: mul(Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -776,13 +798,13 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: mul(ImageBuf&, Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: mul(ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: div(Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: div(Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -798,12 +820,12 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: div(ImageBuf&, Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: div(ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: mad(Image_or_Const, Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: mad(Image_or_Const A, Image_or_Const B, Image_or_Const C, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -822,12 +844,12 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: mad(ImageBuf&, Image_or_Const, Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: mad(ImageBuf &dst, Image_or_Const A, Image_or_Const B, Image_or_Const C, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: over(const ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: over(const ImageBuf &A, const ImageBuf &B, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -838,11 +860,12 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: over(ImageBuf&, const ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: over(ImageBuf &dst, const ImageBuf &A, const ImageBuf &B, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: zover(const ImageBuf&, const ImageBuf&, bool, ROI, int)
.. doxygenfunction:: zover(const ImageBuf &A, const ImageBuf &B, bool z_zeroisinf = false, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -853,11 +876,12 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: zover(ImageBuf&, const ImageBuf&, const ImageBuf&, bool, ROI, int)
.. doxygenfunction:: zover(ImageBuf &dst, const ImageBuf &A, const ImageBuf &B, bool z_zeroisinf = false, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: invert(const ImageBuf&, ROI, int)
.. doxygenfunction:: invert(const ImageBuf &A, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -886,12 +910,12 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: invert(ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: invert(ImageBuf &dst, const ImageBuf &A, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: pow(const ImageBuf&, cspan<float>, ROI, int)
.. doxygenfunction:: pow(const ImageBuf &A, cspan<float> B, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -903,11 +927,12 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: pow(ImageBuf&, const ImageBuf&, cspan<float>, ROI, int)
.. doxygenfunction:: pow(ImageBuf &dst, const ImageBuf &A, cspan<float> B, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: channel_sum(const ImageBuf&, cspan<float>, ROI, int)
.. doxygenfunction:: channel_sum(const ImageBuf &src, cspan<float> weights = 1.0f, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -920,12 +945,13 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: channel_sum(ImageBuf&, const ImageBuf&, cspan<float>, ROI, int)
.. doxygenfunction:: channel_sum(ImageBuf &dst, const ImageBuf &src, cspan<float> weights = 1.0f, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: max(Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: min(Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: max(Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
.. doxygenfunction:: min(Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -943,12 +969,13 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: max(ImageBuf&, Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: min(ImageBuf&, Image_or_Const, Image_or_Const, ROI, int)
.. doxygenfunction:: max(ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
.. doxygenfunction:: min(ImageBuf &dst, Image_or_Const A, Image_or_Const B, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: clamp(const ImageBuf&, cspan<float>, cspan<float>, bool, ROI, int)
.. doxygenfunction:: clamp(const ImageBuf &src, cspan<float> min = -std::numeric_limits<float>::max(), cspan<float> max = std::numeric_limits<float>::max(), bool clampalpha01 = false, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -969,11 +996,12 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: clamp(ImageBuf&, const ImageBuf&, cspan<float>, cspan<float>, bool, ROI, int)
.. doxygenfunction:: clamp(ImageBuf &dst, const ImageBuf &src, cspan<float> min = -std::numeric_limits<float>::max(), cspan<float> max = std::numeric_limits<float>::max(), bool clampalpha01 = false, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: contrast_remap(const ImageBuf&, cspan<float>, cspan<float>, cspan<float>, cspan<float>, cspan<float>, cspan<float>, ROI, int)
.. doxygenfunction:: contrast_remap(const ImageBuf &src, cspan<float> black = 0.0f, cspan<float> white = 1.0f, cspan<float> min = 0.0f, cspan<float> max = 1.0f, cspan<float> scontrast = 1.0f, cspan<float> sthresh = 0.5f, ROI = {}, int nthreads = 0)
..
Examples::
@@ -1011,10 +1039,11 @@ Image arithmetic
Result-as-parameter version:
.. doxygenfunction:: contrast_remap(ImageBuf&, const ImageBuf&, cspan<float>, cspan<float>, cspan<float>, cspan<float>, cspan<float>, cspan<float>, ROI, int)
.. doxygenfunction:: contrast_remap(ImageBuf &dst, const ImageBuf &src, cspan<float> black = 0.0f, cspan<float> white = 1.0f, cspan<float> min = 0.0f, cspan<float> max = 1.0f, cspan<float> scontrast = 1.0f, cspan<float> sthresh = 0.5f, ROI = {}, int nthreads = 0)
|
.. doxygengroup:: color_map
..
@@ -1081,7 +1110,7 @@ Image arithmetic
Image comparison and statistics
===============================
.. doxygenfunction:: computePixelStats(const ImageBuf&, ROI, int)
.. doxygenfunction:: computePixelStats
..
The PixelStats structure is defined as follows::
@@ -1114,7 +1143,8 @@ Image comparison and statistics
|
.. doxygenfunction:: compare(const ImageBuf&, const ImageBuf&, float, float, ROI, int)
.. doxygenfunction:: compare(const ImageBuf &A, const ImageBuf &B, float failthresh, float warnthresh, ROI roi = {}, int nthreads = 0)
..
The CompareResults structure is defined as follows::
@@ -1147,12 +1177,14 @@ Image comparison and statistics
|
.. doxygenfunction:: compare_Yee(const ImageBuf&, const ImageBuf&, CompareResults&, float, float, ROI, int)
.. doxygenfunction:: compare_Yee
..
|
.. doxygenfunction:: isConstantColor(const ImageBuf&, float, span<float>, ROI, int)
.. doxygenfunction:: isConstantColor
..
Examples::
@@ -1170,7 +1202,8 @@ Image comparison and statistics
|
.. doxygenfunction:: isConstantChannel(const ImageBuf&, int, float, float, ROI, int)
.. doxygenfunction:: isConstantChannel
..
Examples::
@@ -1186,7 +1219,8 @@ Image comparison and statistics
|
.. doxygenfunction:: isMonochrome(const ImageBuf&, float, ROI, int)
.. doxygenfunction:: isMonochrome
..
Examples::
@@ -1199,7 +1233,8 @@ Image comparison and statistics
|
.. doxygenfunction:: color_count(const ImageBuf&, imagesize_t *, int, cspan<float>, cspan<float>, ROI, int)
.. doxygenfunction:: color_count
..
Examples::
@@ -1220,7 +1255,8 @@ Image comparison and statistics
|
.. doxygenfunction:: color_range_check(const ImageBuf&, imagesize_t *, imagesize_t *, imagesize_t *, cspan<float>, cspan<float>, ROI, int)
.. doxygenfunction:: color_range_check
..
Examples::
@@ -1242,6 +1278,7 @@ Image comparison and statistics
|
.. doxygenfunction:: nonzero_region
..
@@ -1256,6 +1293,7 @@ Image comparison and statistics
|
.. doxygenfunction:: computePixelHashSHA1
..
@@ -1267,7 +1305,8 @@ Image comparison and statistics
|
.. doxygenfunction:: histogram(const ImageBuf&, int, int, float, float, bool, ROI, int)
.. doxygenfunction:: histogram
..
Examples::
@@ -1292,7 +1331,7 @@ Image comparison and statistics
Convolutions and frequency-space algorithms
===========================================
.. doxygenfunction:: make_kernel(string_view, float, float, float, bool)
.. doxygenfunction:: make_kernel
..
Examples::
@@ -1301,7 +1340,8 @@ Convolutions and frequency-space algorithms
|
.. doxygenfunction:: convolve(const ImageBuf&, const ImageBuf&, bool, ROI, int)
.. doxygenfunction:: convolve(const ImageBuf &src, const ImageBuf &kernel, bool normalize = true, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -1325,12 +1365,13 @@ Convolutions and frequency-space algorithms
Result-as-parameter version:
.. doxygenfunction:: convolve(ImageBuf&, const ImageBuf&, const ImageBuf&, bool, ROI, int)
.. doxygenfunction:: convolve(ImageBuf &dst, const ImageBuf &src, const ImageBuf &kernel, bool normalize = true, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: laplacian(const ImageBuf&, ROI, int)
.. doxygenfunction:: laplacian(const ImageBuf &src, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -1350,10 +1391,11 @@ Convolutions and frequency-space algorithms
| original | Laplacian image |
+-----------------+-----------------+
.. doxygenfunction:: laplacian(ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: laplacian(ImageBuf &dst, const ImageBuf &src, ROI roi = {}, int nthreads = 0)
|
.. doxygengroup:: fft-ifft
..
@@ -1370,6 +1412,7 @@ Convolutions and frequency-space algorithms
|
.. doxygengroup:: complex-polar
..
@@ -1394,7 +1437,7 @@ Convolutions and frequency-space algorithms
Image Enhancement / Restoration
===============================
.. doxygenfunction:: fixNonFinite(const ImageBuf&, NonFiniteFixMode, int *, ROI, int)
.. doxygenfunction:: fixNonFinite(const ImageBuf &src, NonFiniteFixMode mode = NONFINITE_BOX3, int *pixelsFixed = nullptr, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -1406,11 +1449,12 @@ Image Enhancement / Restoration
std::cout << "Repaired " << pixelsFixed << " non-finite pixels\n";
Result-as-parameter version:
.. doxygenfunction:: fixNonFinite(ImageBuf&, const ImageBuf&, NonFiniteFixMode, int *, ROI, int)
.. doxygenfunction:: fixNonFinite(ImageBuf &dst, const ImageBuf &src, NonFiniteFixMode mode = NONFINITE_BOX3, int *pixelsFixed = nullptr, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: fillholes_pushpull(const ImageBuf&, ROI, int)
.. doxygenfunction:: fillholes_pushpull(const ImageBuf &src, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -1419,17 +1463,19 @@ Image Enhancement / Restoration
ImageBuf Filled = ImageBufAlgo::fillholes_pushpull (Src);
Result-as-parameter version:
.. doxygenfunction:: fillholes_pushpull(ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: fillholes_pushpull(ImageBuf &dst, const ImageBuf &src, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: median_filter(ImageBuf&, const ImageBuf&, int, int, ROI, int)
.. doxygenfunction:: median_filter(const ImageBuf &src, int width = 3, int height = -1, ROI roi = {}, int nthreads = 0)
..
Examples::
ImageBuf Noisy ("tahoe.exr");
ImageBuf Clean = ImageBufAlgo::median_filter (Noisy, 3, 3);
..
.. |medimage1| image:: figures/tahoe-small.jpg
@@ -1447,11 +1493,12 @@ Image Enhancement / Restoration
+-----------------+-----------------+-----------------+
Result-as-parameter version:
.. doxygenfunction:: median_filter(ImageBuf&, const ImageBuf&, int, int, ROI, int)
.. doxygenfunction:: median_filter(ImageBuf &dst, const ImageBuf &src, int width = 3, int height = -1, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: unsharp_mask(const ImageBuf&, string_view, float, float, float, ROI, int)
.. doxygenfunction:: unsharp_mask(const ImageBuf &src, string_view kernel = "gaussian", float width = 3.0f, float contrast = 1.0f, float threshold = 0.0f, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -1460,7 +1507,7 @@ Image Enhancement / Restoration
ImageBuf Sharp = ImageBufAlgo::unsharp_mask (Blurry, "gaussian", 5.0f);
Result-as-parameter version:
.. doxygenfunction:: unsharp_mask(ImageBuf&, const ImageBuf&, string_view, float, float, float, ROI, int)
.. doxygenfunction:: unsharp_mask(ImageBuf &dst, const ImageBuf &src, string_view kernel = "gaussian", float width = 3.0f, float contrast = 1.0f, float threshold = 0.0f, ROI roi = {}, int nthreads = 0)
|
@@ -1468,19 +1515,20 @@ Image Enhancement / Restoration
Morphological filters
=====================
.. doxygenfunction:: dilate(const ImageBuf&, int, int, ROI, int)
.. doxygenfunction:: dilate(const ImageBuf &src, int width = 3, int height = -1, ROI roi = {}, int nthreads = 0)
..
Result-as-parameter version:
.. doxygenfunction:: dilate(ImageBuf&, const ImageBuf&, int, int, ROI, int)
.. doxygenfunction:: dilate(ImageBuf &dst, const ImageBuf &src, int width = 3, int height = -1, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: erode(const ImageBuf&, int, int, ROI, int)
.. doxygenfunction:: erode(const ImageBuf &src, int width = 3, int height = -1, ROI roi = {}, int nthreads = 0)
..
Result-as-parameter version:
.. doxygenfunction:: erode(ImageBuf&, const ImageBuf&, int, int, ROI, int)
.. doxygenfunction:: erode(ImageBuf &dst, const ImageBuf &src, int width = 3, int height = -1, ROI roi = {}, int nthreads = 0)
|
@@ -1577,7 +1625,8 @@ Color space conversion
|
.. doxygenfunction:: colormatrixtransform(const ImageBuf&, const Imath::M44f&, bool, ROI, int)
.. doxygenfunction:: colormatrixtransform(const ImageBuf &src, const Imath::M44f &M, bool unpremult = true, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -1603,12 +1652,12 @@ Color space conversion
+-----------------+-----------------+
Result-as-parameter version:
.. doxygenfunction:: colormatrixtransform(ImageBuf&, const ImageBuf&, const Imath::M44f&, bool, ROI, int)
.. doxygenfunction:: colormatrixtransform(ImageBuf &dst, const ImageBuf &src, const Imath::M44f &M, bool unpremult = true, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: ociolook(const ImageBuf&, string_view, string_view, string_view, bool, bool, string_view, string_view, ColorConfig *, ROI, int)
.. 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)
..
Examples::
@@ -1618,11 +1667,11 @@ Color space conversion
true, false, "SHOT", "pe0012");
Result-as-parameter version:
.. doxygenfunction:: ociolook(ImageBuf&, const ImageBuf&, string_view, string_view, string_view, bool, bool, string_view, string_view, ColorConfig *, ROI, int)
.. 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:: ociodisplay(const ImageBuf&, string_view, string_view, string_view, string_view, bool, string_view, string_view, ColorConfig *, ROI, int)
.. 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)
..
Examples::
@@ -1632,11 +1681,12 @@ Color space conversion
"", true, "SHOT", "pe0012");
Result-as-parameter version:
.. doxygenfunction:: ociodisplay(ImageBuf&, const ImageBuf&, string_view, string_view, string_view, string_view, bool, string_view, string_view, ColorConfig *, ROI, int)
.. 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:: ociofiletransform(const ImageBuf&, string_view, bool, bool, ColorConfig *, ROI, int)
.. doxygenfunction:: ociofiletransform(const ImageBuf &src, string_view name, bool unpremult = true, bool inverse = false, ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -1646,10 +1696,11 @@ Color space conversion
Result-as-parameter version:
.. doxygenfunction:: ociofiletransform(ImageBuf&, const ImageBuf&, string_view, bool, bool, ColorConfig *, ROI, int)
.. doxygenfunction:: ociofiletransform(ImageBuf &dst, const ImageBuf &src, string_view name, bool unpremult = true, bool inverse = false, ColorConfig *colorconfig = nullptr, ROI roi = {}, int nthreads = 0)
|
.. doxygengroup:: premult
..
@@ -1730,7 +1781,8 @@ Functions specific to deep images
|
.. doxygenfunction:: deepen(const ImageBuf&, float, ROI, int)
.. doxygenfunction:: deepen(const ImageBuf &src, float zvalue = 1.0f, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -1739,11 +1791,12 @@ Functions specific to deep images
ImageBuf Deep = ImageBufAlgo::deepen (Flat);
Result-as-parameter version:
.. doxygenfunction:: deepen(ImageBuf&, const ImageBuf&, float, ROI, int)
.. doxygenfunction:: deepen(ImageBuf &dst, const ImageBuf &src, float zvalue = 1.0f, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: flatten(const ImageBuf&, ROI, int)
.. doxygenfunction:: flatten(const ImageBuf &src, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -1752,12 +1805,12 @@ Functions specific to deep images
ImageBuf Flat = ImageBufAlgo::flatten (Deep);
Result-as-parameter version:
.. doxygenfunction:: flatten(ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: flatten(ImageBuf &dst, const ImageBuf &src, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: deep_merge(const ImageBuf&, const ImageBuf&, bool, ROI, int)
.. doxygenfunction:: deep_merge(const ImageBuf &A, const ImageBuf &B, bool occlusion_cull = true, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -1767,13 +1820,13 @@ Functions specific to deep images
ImageBuf Merged = ImageBufAlgo::deep_merge (DeepA, DeepB);
Result-as-parameter version:
.. doxygenfunction:: deep_merge(ImageBuf&, const ImageBuf&, const ImageBuf&, bool, ROI, int)
.. doxygenfunction:: deep_merge(ImageBuf &dst, const ImageBuf &A, const ImageBuf &B, bool occlusion_cull = true, ROI roi = {}, int nthreads = 0)
|
.. doxygenfunction:: deep_holdout(const ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: deep_holdout(const ImageBuf &src, const ImageBuf &holdout, ROI roi = {}, int nthreads = 0)
..
Examples::
@@ -1783,7 +1836,7 @@ Functions specific to deep images
ImageBuf Merged = ImageBufAlgo::deep_holdout (Src, Holdout);
Result-as-parameter version:
.. doxygenfunction:: deep_holdout(ImageBuf&, const ImageBuf&, const ImageBuf&, ROI, int)
.. doxygenfunction:: deep_holdout(ImageBuf &dst, const ImageBuf &src, const ImageBuf &holdout, ROI roi = {}, int nthreads = 0)
|

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