Skip to main content

Module managed

Module managed 

Source
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 unsafe code 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§

ColorInfo
Color information
ContentLightLevel
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
InloopFilters
Inloop filter flags
MasteringDisplay
HDR mastering display color volume (SMPTE 2086)
PlaneView8
Zero-copy view of an 8-bit plane
PlaneView16
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§

ColorPrimaries
Color primaries (CIE 1931 xy chromaticity coordinates)
ColorRange
Color range
CpuLevel
CPU feature level for SIMD dispatch control.
DecodeFrameType
Which frame types to decode
Error
Decoder errors
MatrixCoefficients
Matrix coefficients (YUV to RGB conversion)
PixelLayout
Pixel layout (chroma subsampling)
Planes
Zero-copy access to pixel planes
TransferCharacteristics
Transfer characteristics (EOTF / gamma curve)

Functions§

enabled_features
Returns a comma-delimited string of enabled compile-time feature flags.
is_unchecked
Returns true if the unchecked feature is enabled.

Type Aliases§

Result