Skip to content
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c8d2dbd
Add Google Highway SIMD resampling to ImageBufAlgo
ssh4net Dec 25, 2025
f13876b
Add Highway-based SIMD fast paths for pixel math ops
ssh4net Dec 25, 2025
0ea3dff
Remove all GitHub Actions workflow files
ssh4net Dec 25, 2025
b1b8be0
Refactor SIMD math to use imagebufalgo_hwy_pvt.h
ssh4net Dec 26, 2025
2cac746
Improve SIMD support and type handling in imagebufalgo
ssh4net Dec 26, 2025
2c0f517
Add HWY arithmetic and resample benchmark scripts
ssh4net Dec 27, 2025
9c5808b
Add SIMD-optimized range and premult/unpremult pixel math
ssh4net Jan 3, 2026
20960da
Add Highway SIMD toggle and update pixel math logic
ssh4net Jan 3, 2026
f0552f7
Revamp Highway SIMD benchmark with detailed tests
ssh4net Jan 3, 2026
7229160
Apply pixel-center convention in resample_hwy interpolation
ssh4net Jan 4, 2026
ed0c40b
Move and integrate hwy_test into src directory
ssh4net Jan 4, 2026
d6809ff
Add SIMD (Highway) acceleration for pixel math ops
ssh4net Jan 4, 2026
d6fbbc7
Add clamp benchmark and format code in mad_impl_hwy
ssh4net Jan 5, 2026
45d6beb
Optimize ImageBufAlgo integer ops with native SIMD
ssh4net Jan 5, 2026
b87f054
Add Highway SIMD for invert and contrast_remap ops
ssh4net Jan 6, 2026
1640275
Normalize integer image data to 0-1 in SIMD math
ssh4net Jan 6, 2026
53b0294
Revert "Remove all GitHub Actions workflow files"
ssh4net Jan 6, 2026
f2fe675
Improve SIMD normalization for signed integer image types
ssh4net Jan 6, 2026
699196b
Update hwy_test.cpp
ssh4net Jan 6, 2026
87421c4
Update imagebufalgo_xform.cpp
ssh4net Jan 7, 2026
37089ae
Refactor ImageBufAlgo SIMD helpers and usage
ssh4net Jan 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ if (SKBUILD)
set (ENABLE_idiff OFF)
set (ENABLE_igrep OFF)
set (ENABLE_iinfo OFF)
set (ENABLE_hwy_test OFF)
set (ENABLE_testtex OFF)
set (ENABLE_iv OFF)
endif ()
Expand All @@ -286,6 +287,7 @@ if (OIIO_BUILD_TOOLS AND NOT BUILD_OIIOUTIL_ONLY)
add_subdirectory (src/idiff)
add_subdirectory (src/igrep)
add_subdirectory (src/iinfo)
add_subdirectory (src/hwy_test)
add_subdirectory (src/maketx)
add_subdirectory (src/oiiotool)
add_subdirectory (src/testtex)
Expand Down
3 changes: 3 additions & 0 deletions src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ if (USE_QT AND OPENGL_FOUND)
endif ()


# Google Highway for SIMD
checked_find_package (hwy REQUIRED)

Comment on lines +229 to +230
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this be an optional dependency,

Suggested change
checked_find_package (hwy REQUIRED)
checked_find_package (hwy
DEFINITIONS USE_HWY)

And then #ifdef USE_HWY in the cpp files to conditionally compile the parts that need hwy.

If we add a hard dependency, it precludes backporting any part of it to 3.1, since we don't change minimum dependencies in a released branch.

# Tessil/robin-map
checked_find_package (Robinmap REQUIRED
VERSION_MIN 1.2.0
Expand Down
62 changes: 62 additions & 0 deletions src/doc/imagebufalgo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,68 @@ the computation without spawning additional threads, which might tend to
crowd out the other application threads.


SIMD Performance and Data Types
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Many ImageBufAlgo operations use SIMD (Single Instruction, Multiple Data)
optimizations powered by the Google Highway library to achieve significant
performance improvements, particularly for integer image formats.

**Integer Type Optimizations:**

OpenImageIO treats all integer images as normalized Standard Dynamic Range
(SDR) data:

* Unsigned integers (``uint8``, ``uint16``, ``uint32``, ``uint64``) are
normalized to the [0.0, 1.0] range: ``float_value = int_value / max_value``
* Signed integers (``int8``, ``int16``, ``int32``, ``int64``) are normalized
to approximately the [-1.0, 1.0] range: ``float_value = int_value / max_value``

Most ImageBufAlgo operations convert integer data to float, perform the
operation, and convert back. Highway SIMD provides 3-5x speedup for these
operations compared to scalar code.

**Scale-Invariant Operations:**

Certain operations are *scale-invariant*, meaning they produce identical
results whether performed on raw integers or normalized floats. For these
operations, OpenImageIO uses native integer SIMD paths that avoid float
conversion entirely, achieving 6-12x speedup (2-3x faster than the float
promotion path):

* ``add``, ``sub`` (with saturation)
* ``min``, ``max``
* ``abs``, ``absdiff``

These optimizations automatically activate when all input and output images
have matching integer types (e.g., all ``uint8``). When types differ or when
mixing integer and float images, the standard float promotion path is used.

**Controlling SIMD Optimizations:**

Highway SIMD is enabled by default. To disable it globally::

OIIO::attribute("enable_hwy", 0);

Or via environment variable::

export OPENIMAGEIO_ENABLE_HWY=0

This is primarily useful for debugging or performance comparison. In normal
use, the optimizations should remain enabled for best performance.

**Performance Expectations:**

Typical speedups with Highway SIMD (compared to scalar code):

* Float operations: 3-5x faster
* Integer operations (with float conversion): 3-5x faster
* Integer scale-invariant operations (native int): 6-12x faster
* Half-float operations: 3-5x faster

Actual performance depends on the specific operation, image size, data types,
and hardware capabilities (AVX2, AVX-512, ARM NEON, etc.).


.. _sec-iba-patterns:

Expand Down
32 changes: 26 additions & 6 deletions src/doc/imageioapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -397,16 +397,36 @@ inside the source code.
line, but not the full human-readable command line. (This was added in
OpenImageIO 2.5.11.)

.. cpp:var:: OPENIMAGEIO_ENABLE_HWY

Controls whether to use Google Highway SIMD library optimizations for
ImageBufAlgo operations. If set to "1" (the default), Highway SIMD
optimizations will be enabled for supported operations, providing
significant performance improvements (typically 3-12x faster) on integer
image types. If set to "0", these optimizations will be disabled and fall
back to scalar implementations.

This can also be controlled at runtime via::

OIIO::attribute("enable_hwy", 1); // enable (default)
OIIO::attribute("enable_hwy", 0); // disable

Note: Highway SIMD optimizations are particularly beneficial for integer
image formats (uint8, uint16, int8, int16, uint32, int32, etc.) and provide
additional speedup for scale-invariant operations (add, sub, min, max,
absdiff) that can operate directly on integer data without float conversion.
(This was added in OpenImageIO 3.1.)

.. cpp:var:: OPENIMAGEIO_PYTHON_LOAD_DLLS_FROM_PATH

Windows only. Mimics the DLL-loading behavior of Python 3.7 and earlier.
If set to "1", all directories under ``PATH`` will be added to the DLL load
Windows only. Mimics the DLL-loading behavior of Python 3.7 and earlier.
If set to "1", all directories under ``PATH`` will be added to the DLL load
path before attempting to import the OpenImageIO module. (This was added in
OpenImageIO 3.0.3.0)

Note: This "opt-in-style" behavior replaces and inverts the "opt-out-style"
Windows DLL-loading behavior governed by the now-defunct `OIIO_LOAD_DLLS_FROM_PATH`
environment variable (added in OpenImageIO 2.4.0/2.3.18).
Note: This "opt-in-style" behavior replaces and inverts the "opt-out-style"
Windows DLL-loading behavior governed by the now-defunct `OIIO_LOAD_DLLS_FROM_PATH`
environment variable (added in OpenImageIO 2.4.0/2.3.18).

In other words, to reproduce the default Python-module-loading behavior of
In other words, to reproduce the default Python-module-loading behavior of
earlier versions of OIIO, set ``OPENIMAGEIO_PYTHON_LOAD_DLLS_FROM_PATH=1``.
5 changes: 5 additions & 0 deletions src/hwy_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO

fancy_add_executable (LINK_LIBRARIES OpenImageIO)
Loading
Loading