aom-decode

Crates.ioaom-decode
lib.rsaom-decode
version0.2.13
sourcesrc
created_at2020-09-09 16:20:34.895762
updated_at2024-10-17 12:26:29.555141
descriptionMinimal safe wrapper for libaom AV1 decoder
homepagehttps://lib.rs/aom-decode
repositoryhttps://gitlab.com/kornelski/aom-decode
max_upload_size
id286742
size46,715
Kornel (kornelski)

documentation

README

Rust wrapper for AOMedia AV1 decoder

It's a minimal safe wrapper that allows decoding individual AV1 frames. It's meant for decoding AVIF images.

Usage

See examples/topng.rs for the full code.

You'll need the avif-parse crate to get AV1 data out of an AVIF file, and the yuv crate to convert YUV pixels into RGB.

let avif = avif_parse::read_avif(file)?;

let mut d = Decoder::new(&Config {
    threads: std::thread::available_parallelism().map(|v| v.get()).unwrap_or(4),
})?;

let img = d.decode_frame(&avif.primary_item)?;
match img.rows_iter()? {
    RowsIters::YuvPlanes8 {y,u,v,chroma_sampling} => {
        match chroma_sampling {
            color::ChromaSampling::Cs444 => {
                yuv_444(y, u, v).map(|px| {
                    // here's your YUV pixel
                });
            },
        }
    },
}
Commit count: 32

cargo fmt