Add the dependency

In your project’s ziran.toml; pin ref to a commit for reproducible builds.

[dependencies.av1]
git = "https://github.com/ziranlang/av1.git"
ref = "master"

Overview

It matches the pinned libaom decoder bit-exactly on the local test corpus and on 275 of the 279 KEY temporal units in libaom's pinned test vectors. That is not a full AV1 conformance claim. The authored decoder remains slower than libaom on five of the six benchmark clips; tests/av1_benchmark.sh measures it. See docs/AV1.md for the module layout, contracts and tests.

sh tests/av1_critical_path.sh

libaom and dav1d are pinned test oracles only; no product module calls a native codec. tests/common.sh and tests/av1_headers.sh build them under ignored build/native when missing. Ported libaom constants keep their notices in src/LICENSE.libaom and src/PATENTS.libaom.

av1/src/decoder.zi

decoder

Import with #import "av1/decoder".

Av1YUVResult :: struct { is_ok: bool; sequence: SequenceHeader; frame: StillFrameHeader; y: Plane; u: Plane; v: Plane; error: DecodeError; }

Owned source-domain samples, independent of the encoded input. Monochrome returns Y alone; color returns independent Y/U/V planes of the source depth.

Av1Failure :: (error: DecodeError) -> Av1YUVResult
Av1StillWorkingBytes :: 1048576

Authored scalar subset, not a full AV1 engine: 8/10/12-bit mono/420/422/444 shown KEY frames with intra tools, palette, CfL, filter intra, lossy and lossless transforms, segmentation, delta q/lf, multiple tiles, deblocking, CDEF, loop restoration and film grain. Superres, quantizer matrices and intra block copy reject explicitly; no bridge or native decoder is called. Do not switch the AVIF default until the full required frame/plane corpus passes.

ApplyIntraFrameGrain :: (samples: []u16, scratch: []s16, intra: *IntraFrame, sequence: *SequenceHeader, frame: *StillFrameHeader, cancellation: *Cancellation) -> DecodeError

Authored scalar subset, not a full AV1 engine: 8/10/12-bit mono/420/422/444 shown KEY frames with intra tools, palette, CfL, filter intra, lossy and lossless transforms, segmentation, delta q/lf, multiple tiles, deblocking, CDEF, loop restoration and film grain. Superres, quantizer matrices and intra block copy reject explicitly; no bridge or native decoder is called. Do not switch the AVIF default until the full required frame/plane corpus passes. Film grain in place over the filtered frame planes, whole picture.

StoreSampleRow :: (source: []u16, destination: []u8) -> DecodeError

Stores one row of at most 65536 samples, as wide as a frame, as bytes: the low byte first when a sample takes two.

DecodeAv1YUV :: (input: BorrowedBytes, options: *DecodeOptions) -> Av1YUVResult

Source ↗

Documents