MCPcopy Index your code
hub / github.com/Twinklebear/oidn-rs

github.com/Twinklebear/oidn-rs @2.4.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.4.1 ↗ · + Follow
173 symbols 457 edges 14 files 37 documented · 21% updated 32d ago2.4.1 · 2026-06-07★ 37

Browse by type

Functions 153 Types & classes 20
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

oidn

Crates.io CI

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:

cargo run -p xtask -- build-examples
cargo run -p xtask -- build-test
cargo run -p xtask -- generate-sys-bindings
cargo run -p xtask -- download-oidn-package

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:

oidn = { version = "2.5.0", features = ["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;

fn main() {
    // Load scene, render image, etc.

    let input_img: Vec<f32> = // A float3 RGB image produced by your renderer
    let mut filter_output = vec![0.0f32; input_img.len()];

    let device = oidn::Device::new();
    oidn::RayTracing::new(&device)
        // Optionally add float3 normal and albedo buffers as well
        .srgb(true)
        .image_dimensions(input.width() as usize, input.height() as usize);
        .filter(&input_img[..], &mut filter_output[..])
        .expect("Filter config error!");

    if let Err(e) = device.get_error() {
        println!("Error denoising image: {}", e.1);
    }

    // Save out or display filter_output image
}

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.

Core symbols most depended-on inside this repo

Shape

Function 88
Method 65
Class 17
Enum 3

Languages

Rust100%

Modules by API surface

src/filter.rs30 symbols
src/tests.rs29 symbols
xtask/src/main.rs27 symbols
src/buffer.rs22 symbols
shared/helper.rs17 symbols
src/device.rs16 symbols
examples/denoise_exr.rs9 symbols
src/sys.rs8 symbols
src/lib.rs5 symbols
build.rs5 symbols
tests/bundled_runtime.rs2 symbols
examples/simple.rs1 symbols

For agents

$ claude mcp add oidn-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page