zune-hdr
A fast,small versatile hdr decoder and encoder
This crate contains a small and fast Radiance (.hdr) decoder and encoder.
Usage
To use this crate, add zune-hdr
to your Cargo.toml
or run cargo add zune-hdr
Here is an example of loading a hdr image
use Error;
use read;
use HdrDeocder;
Here is an example of writing a hdr, this generates a black image
use HdrEncoder;
use EncoderOptions;
Performance
The crate boasts an optimized decoder, with it being about 2.5x faster than image-rs/hdr
decoder,
the following is a benchmark run on the
following image
This can be replicated with
git clone
cd ./zune-image
cargo bench --workspace "hdr"
Formatted output
field | image-rs/hdr | zune-hdr |
---|---|---|
time | 16.561 ms | 6.4180 ms |
thrpt | 77.363 MiB/s | 199.63 MiB/s |
Raw criterion output
Running benches/decode_hdr.rs (deps/decode_hdr-b0d728bd626a2ee2)
hdr: Simple decode(memorial-hdr)/image-rs/hdr
time: [16.542 ms 16.561 ms 16.581 ms]
thrpt: [77.271 MiB/s 77.363 MiB/s 77.454 MiB/s]
hdr: Simple decode(memorial-hdr)/zune-image/hdr
time: [6.3522 ms 6.4180 ms 6.4848 ms]
thrpt: [197.58 MiB/s 199.63 MiB/s 201.70 MiB/s]
Security
The crate has been extensively fuzzed, additionaly the CI does fuzz testing every day to catch unintended bugs
The crate does not use unsafe
and uses #[forbid(unsafe)]
to prevent any from creeping in