oidn
Rust bindings to Intel’s Open Image Denoise library. Crate version numbers track the OIDN version they correspond to.
Documentation
Rust docs can be found here.
Open Image Denoise documentation can be found here.
Development tasks
Repository maintenance commands live in the Rust xtask tool instead of
platform-specific shell scripts:
build-test uses OIDN_DIR when it is set. Otherwise it looks for an
extracted oidn-<version>.<platform> package in the repository root and sets
the host runtime library path before running Cargo. The binding generator
defaults to src/sys.rs and finds oidn.h from OIDN_HEADER, OIDN_DIR,
OIDN_BUNDLED_DIR, an extracted OIDN package in the repository root, or the
bundled package under target. Explicit header and output paths can also be
passed to generate-sys-bindings. The binding generator expects bindgen and
a usable libclang installation to be available.
When bumping the Open Image Denoise version, update the crate version,
.github/workflows/main.yml's OIDN_VERSION, and the bundled package
SHA-256 values in helpers/shared.rs. The bundled CI job verifies the host archive
against the pinned checksum.
Bundled OIDN binaries
By default this crate links against an Open Image Denoise installation found
through OIDN_DIR or pkg-config. Enable the bundled feature to have the
build script download the matching official Open Image Denoise binary package
and link against it:
= { = "2.5.0", = ["bundled"] }
The bundled feature supports the official OIDN packages for x86_64 Linux,
x86_64 Windows, and x86_64/aarch64 macOS. Downloaded archives are verified
against pinned SHA-256 checksums for the crate's OIDN version. Set
OIDN_BUNDLED_DIR to a pre-extracted OIDN package root if you want to provide
the files yourself or avoid a network download during the build. The feature
still links the dynamic OIDN libraries, so applications that redistribute
binaries must also ship the runtime libraries from the bundled package's lib
or bin directory. For local cargo run, examples, and tests, the build
script copies bundled runtime libraries into the active Cargo target output
directories and uses relative runtime search paths on Linux and macOS.
Example
The crate provides a lightweight wrapper over the Open Image Denoise library,
along with raw C bindings exposed under oidn::sys. Below is an example of
using the RT filter from Open Image Denoise (the RayTracing filter) to
denoise an image.
extern crate oidn;
The simple example loads a JPG, denoises it, and saves the
output image to a JPG. The denoise_exr example loads an
HDR color EXR file, denoises it and saves the tonemapped result out to a JPG.
The denoise_exr app can also take albedo and normal data through additional
EXR files.