Skip to main content

Crate rusty_av2f

Crate rusty_av2f 

Source
Expand description

§rusty_av2f — AV2F, an experimental still-image container for AV2

AV2F packages a single AV2 still picture in an ISOBMFF/HEIF file, in the same shape AVIF uses for AV1: ftyp + meta + mdat, one image item, with a codec configuration property.

§Read this before producing files

This is not an AOM standard. AVIF is defined by a published AOM specification that fixes its brand, item type and configuration record. No equivalent document exists for AV2 — so AV2F’s four-character codes are chosen, not specified, and every one of them lives in fourcc so a real specification can be adopted by editing one file.

Concretely: files written by this crate are readable by this crate and by nothing else. Do not ship them anywhere that expects interoperability. They are useful for pipeline work, for measuring AV2 against AVIF on still images, and for having the container ready the day a specification lands.

§Payload restriction, and why

encode requires an AV2 still picture coded with the full still-picture header (avmenc --full-still-picture-hdr, i.e. single_picture_header_flag = 0).

The compact alternative is what a still-image format would naturally use, but rusty_av2d does not yet decode it bit-exactly and currently refuses it, so writing such a payload would produce a file our own decoder rejects. Encoding the full-header form sidesteps that entirely and is byte-identical against the reference decoder today. When the compact form lands, relax the check in encode and set Config::full_still_picture_header to false.

§Example

use rusty_av2f::{encode, decode, Config, Params};

let file = encode(&Params { width: 432, height: 240, config: Config::default() }, &av2_still)?;
let img = decode(&file)?;
assert_eq!((img.width, img.height), (432, 240));

Re-exports§

pub use config::Config;
pub use config::Subsampling;

Modules§

boxes
Minimal ISOBMFF box writing and walking.
config
The av2C configuration record.
fourcc
The entire experimental surface of this format, in one place.

Structs§

Image
A decoded AV2F file: the image description, and the coded AV2 payload.
Params
What encode needs beyond the payload itself.

Enums§

Error
Everything that can go wrong reading or writing an AV2F file.

Functions§

decode
Parse an AV2F file, returning the image description and a borrow of the payload.
encode
Package an AV2 still picture as an AV2F file.
probe
Score data as an AV2F file, 0–100, in the shape format probes conventionally use.