Expand description
Safe Rust bindings for Google’s libultrahdr,
the reference implementation of UltraHDR gain-map JPEG encoding/decoding.
The crate exposes a small, stateful API that mirrors the C library while handling memory ownership and validation for you:
Decoderreads JPEGs, exposes gain-map metadata (if present), and produces packed pixel views.Encoderwrites UltraHDR or plain JPEGs from packed pixel buffers or compressed inputs.RawImage,CompressedImage, andDecodedPackedViewdescribe image buffers without requiring you to depend onsysdirectly.
For a higher-level walkthrough, see examples/ultrahdr_app.rs in this crate and the
CLI in the companion ultrahdr-bake package.
Re-exports§
pub use ultrahdr_sys as sys;
Structs§
- Compressed
Image - Borrowed descriptor over a caller-provided compressed JPEG buffer.
- Decoded
Packed - Owned packed pixels plus metadata returned by a [
Decoder]. - Decoded
Packed View - Borrowed view over packed pixels owned by a [
Decoder]. - Decoder
- UltraHDR JPEG decoder. Owns the underlying
uhdr_codec_private_tand provides safe access to decoded pixel buffers and gain-map metadata. - Encoded
Image - Owned compressed JPEG (and optional gain-map) returned by an [
Encoder]. - Encoded
View - Borrowed view over an encoded stream owned by an [
Encoder] or [Decoder]. - Encoder
- UltraHDR JPEG encoder. Owns the underlying
uhdr_codec_private_tand can be reused across multiple encodes by callingreset. - Error
- Error produced by the safe wrappers around
libultrahdr. - Gain
MapMetadata - Parsed metadata describing an embedded gain map.
- Owned
Packed Image - Owns a packed raw buffer and exposes it as
uhdr_raw_image. - RawImage
- Borrowed descriptor over a caller-provided packed pixel buffer.
Constants§
- SDR_
WHITE_ NITS - Nominal SDR diffuse white used by libultrahdr for capacity math (ISO/TS 22028-5).
Functions§
- bytes_
per_ pixel - Bytes-per-pixel helper for the supported packed formats.
Type Aliases§
- Codec
- Output codec to write.
- Color
Gamut - Scene-referred color gamut.
- Color
Range - Chroma sample range.
- Color
Transfer - Transfer function describing the relationship between encoded values and scene light.
- EncPreset
- Encoder tuning preset.
- Error
Code - Error codes returned by the underlying C API.
- ImgFormat
- Pixel layout for packed buffers accepted/returned by libultrahdr.
- ImgLabel
- Whether an image is the base view or the gain map.
- Result
- Result alias used throughout the crate.