Skip to content

Vertexwahn/rules_oidn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Support Ukraine

rules_oidn -- Bazel build rules for Intel Open Image Denoise

Rules for using Intel Open Image Denoise in your Bazel builds.

What it does?

Open Image Denoise can be used to denoise your images. Given a noisy input image Open Image Denoise can produce a denoised output image:

Denoised

More comparison images can be found here.

rules_oidn helps you to embed Open Image Denoise 1.4.3 into your Bazel builds.

Current status

Currently, these rules compile on Ubuntu 22.04 (other Linux distributions should also work), Windows and macOS (Intel and arm64).

The goal of rules_oidn is not to reproduce a 1:1 binary compatible library that is equal to a CMake build. The focus is on the compilation of a working library that can be used in Bazel projects and is close to the CMake build. The following table compares the precompiled version of OIDN to this Bazel build:

Dependency Bazel Precompiled Open Image Denoise v1.4.3
oneDNN 2.7.3 2.2.4
Intel® Implicit SPMD Program Compiler v1.19.0 ?
ComputeLibrary 22.11 ?
oneTBB 5b2a49008c32c7ba3df7c9e137a894ff53710b64 oneTBB 2021.5.0

Quick start

Prerequisites:

The following tools should be installed:

  • Git
  • Bazel
  • A C++ compiler (GCC, Visual Studio, Clang, etc.)

Checkout, build, and run:

All platforms:

git clone https://github.com/Vertexwahn/rules_oidn.git
cd rules_oidn
cd tests

Run example with Ubuntu 22.04:

bazel run --config=gcc11 //:example

Run example with Visual Studio 2022:

bazel run --config=vs2022 //:example

Run example with macOS:

bazel run --config=macos //:example

See tests/.bazelrc for other supported build configs.

You can also provide the filenames of the input and output image as an argument, e.g. on Ubuntu 22.04:

bazel run --config=gcc11 //:example -- --input=${HOME}/rules_oidn/tests/data/cornell_box.naive_diffuse.box_filter.spp64.embree.exr --output=${HOME}/denoised_spp64.exr

More about the example

The example provides a noisy rendering of the Cornell Box.

Noisy

Additionally, there is a corresponding albedo image:

Noisy

And a normal image:

Noisy

Currently, only the noisy rendering serves as an input for the example. The albedo and normal images are not used. But the example code can be easily modified to use them.

Generating weights manually

python3 .\scripts\blob_to_cpp.py .\weights\rt_alb.tza -o .\weights\rt_alb.tza.cpp -H .\weights\rt_alb.tza.h
python3 .\scripts\blob_to_cpp.py .\weights\rt_hdr.tza -o .\weights\rt_hdr.tza.cpp -H .\weights\rt_hdr.tza.h
python3 .\scripts\blob_to_cpp.py .\weights\rt_hdr_alb.tza -o .\weights\rt_hdr_alb.tza.cpp -H .\weights\rt_hdr_alb.tza.h
python3 .\scripts\blob_to_cpp.py .\weights\rt_hdr_alb_nrm.tza -o .\weights\rt_hdr_alb_nrm.tza.cpp -H .\weights\rt_hdr_alb_nrm.tza.h
python3 .\scripts\blob_to_cpp.py .\weights\rt_hdr_calb_cnrm.tza -o .\weightsrt_hdr_calb_cnrm.tza.cpp -H .\weights\rt_hdr_calb_cnrm.tza.h
python3 .\scripts\blob_to_cpp.py .\weights\rt_ldr.tza -o .\weights\rt_ldr.tza.cpp -H .\weights\rt_ldr.tza.h
python3 .\scripts\blob_to_cpp.py .\weights\rt_ldr_alb.tza -o .\weights\rt_ldr_alb.tza.cpp -H .\weights\rt_ldr_alb.tza.h
python3 .\scripts\blob_to_cpp.py .\weights\rt_ldr_alb_nrm.tza -o .\weights\rt_ldr_alb_nrm.tza.cpp -H .\weights\rt_ldr_alb_nrm.tza.h
python3 .\scripts\blob_to_cpp.py .\weights\rt_ldr_calb_cnrm.tza -o .\weights\rt_ldr_calb_cnrm.tza.cpp -H .\weights\rt_ldr_calb_cnrm.tza.h
python3 .\scripts\blob_to_cpp.py .\weights\rt_nrm.tza -o .\weights\rt_nrm.tza.cpp -H .\weights\rt_nrm.tza.h
python3 .\scripts\blob_to_cpp.py .\weights\rtlightmap_dir.tza -o .\weights\rtlightmap_dir.tza.cpp -H .\weights\rtlightmap_dir.tza.h
python3 .\scripts\blob_to_cpp.py .\weights\rtlightmap_hdr.tza -o .\weights\rtlightmap_hdr.tza.cpp -H .\weights\rtlightmap_hdr.tza.h

Reading material

License

This work is published under the Apache 2.0 License.

Notes on copyright

This repository contains code copied from TensorFlow which is also under the Apache 2.0 License. The copyright of the corresponding files belongs to the TensorFlow authors.