#av1 #decoder #libaom #unavif #cest-lavif

aom-decode

Minimal safe wrapper for libaom AV1 decoder

11 releases

0.2.13 Oct 17, 2024
0.2.10 Jul 7, 2024
0.2.7 Nov 20, 2023
0.2.6 Jun 15, 2023
0.1.1 Nov 21, 2020

#919 in Images

Download history 167/week @ 2024-08-30 114/week @ 2024-09-06 118/week @ 2024-09-13 221/week @ 2024-09-20 84/week @ 2024-09-27 147/week @ 2024-10-04 543/week @ 2024-10-11 327/week @ 2024-10-18 149/week @ 2024-10-25 96/week @ 2024-11-01 159/week @ 2024-11-08 150/week @ 2024-11-15 259/week @ 2024-11-22 117/week @ 2024-11-29 225/week @ 2024-12-06 146/week @ 2024-12-13

775 downloads per month
Used in 8 crates (4 directly)

BSD-2-Clause

37KB
786 lines

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
                });
            },
        }
    },
}

Dependencies

~20MB
~407K SLoC