Expand description
100% safe Rust API for AV1 decoding
This module provides a fully safe, zero-copy API wrapping rav1d’s internal decoder. 100% Safe Rust API for rav1d-safe decoder
This module provides a fully safe, zero-copy API for decoding AV1 video.
It wraps the internal rav1d decoder with type-safe, lifetime-safe abstractions.
§Features
- 100% Safe Rust - No
unsafecode in this module - Zero-Copy - Direct access to decoded pixel data without copying
- Type Safety - Enums and strong types instead of raw integers
- HDR Support - Full access to HDR10, HLG metadata
- Multi-threaded - Configurable thread pool for parallel decoding
§Example
use rav1d_safe::src::managed::{Decoder, Settings, Planes};
let mut decoder = Decoder::new()?;
let obu_data = b"..."; // AV1 OBU bitstream data
if let Some(frame) = decoder.decode(obu_data)? {
println!("Decoded {}x{} frame at {}-bit",
frame.width(), frame.height(), frame.bit_depth());
// Zero-copy access to pixel data
match frame.planes() {
Planes::Depth8(planes) => {
let y_plane = planes.y();
for row in y_plane.rows() {
// Process 8-bit row data
}
}
Planes::Depth16(planes) => {
let y_plane = planes.y();
let pixel = y_plane.pixel(0, 0);
println!("Top-left pixel: {}", pixel);
}
}
}Structs§
- Color
Info - Color information
- Content
Light Level - HDR content light level (SMPTE 2086 / CTA-861.3)
- Decoder
- Safe AV1 decoder instance
- Frame
- A decoded AV1 frame with zero-copy access to pixel data
- Inloop
Filters - Inloop filter flags
- Mastering
Display - HDR mastering display color volume (SMPTE 2086)
- Plane
View8 - Zero-copy view of an 8-bit plane
- Plane
View16 - Zero-copy view of a 10/12-bit plane
- Planes8
- 8-bit pixel plane accessor
- Planes16
- 10/12-bit pixel plane accessor
- Settings
- Decoder configuration settings
Enums§
- Color
Primaries - Color primaries (CIE 1931 xy chromaticity coordinates)
- Color
Range - Color range
- CpuLevel
- CPU feature level for SIMD dispatch control.
- Decode
Frame Type - Which frame types to decode
- Error
- Decoder errors
- Matrix
Coefficients - Matrix coefficients (YUV to RGB conversion)
- Pixel
Layout - Pixel layout (chroma subsampling)
- Planes
- Zero-copy access to pixel planes
- Transfer
Characteristics - Transfer characteristics (EOTF / gamma curve)
Functions§
- enabled_
features - Returns a comma-delimited string of enabled compile-time feature flags.
- is_
unchecked - Returns
trueif theuncheckedfeature is enabled.