Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions content/en/av1.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ weight: 16

`github.com/go-avkit/av1` is a clean-room AV1 decoder in pure Go, built in
stages S0 to S8. **Stages S0 and S1 (v0.2.0) parse syntax; stage S2 (v0.3.0, v0.3.1)
reconstructs intra frames before the loop filters**, see
[Intra reconstruction](#intra). Inter prediction and the loop filters are not
there yet. S0 and S1 cover OBU headers and Section 5 or Annex B streams, the sequence header,
reconstructs intra frames before the loop filters; stage S4 (v0.4.0) adds the
post-filters and an intra-only decoder**, see
[Intra reconstruction](#intra) and [Post-filters](#postfilter). Inter prediction
is not there yet: `Decode` refuses inter frames and `show_existing_frame` with
`ErrUnsupported`. S0 and S1 cover OBU headers and Section 5 or Annex B streams, the sequence header,
the frame header with its decoder state, and the tile syntax of every frame
type (the `block` package: intra and inter mode info, reference frames, the
motion vector stack, motion field estimation, intra block copy, palette,
Expand Down Expand Up @@ -59,6 +61,23 @@ y := f.Plane(0) // CurrFrame as uint16, after the last tile, before any loop fil
The code is scalar; SIMD kernels are tracked in
[go-avkit/av1#6](https://github.com/go-avkit/av1/issues/6).

## Post-filters and the decoder {#postfilter}

From v0.4.0 the `postfilter` package ports, literally from the specification,
the deblocking filter (7.14), CDEF (7.15), super-resolution (7.16), loop
restoration (7.17, Wiener and self-guided) and film grain synthesis (7.18.3,
applied to a copy so references stay clean). `Pipeline.Run` does not allocate
once warm. The root package ties it together for intra-only streams:

```go
dec := av1.Decoder{Limits: av1.Limits{}}
pics, err := dec.Decode(temporalUnit) // key, intra-only and intra block copy frames
```

`Decode` returns the shown pictures. Inter frames and `show_existing_frame`
return `av1.ErrUnsupported`; `OperatingPoint` selects the layers kept.
`block.NewFrame` still allocates for every frame.

## What it claims, and how it was checked {#claims}

The parsers were written from the AV1 specification alone. The oracle is a set
Expand All @@ -81,8 +100,22 @@ added in v0.3.1 ([go-avkit/av1#7](https://github.com/go-avkit/av1/issues/7)). Ea
specification, and the tile decoder is fuzzed with quantizer matrices and
lossless coding.

For the post-filters (S4), `TestPostFilterGoldens` compares every stage of the
283 intra frames with the reference hashes: **all match**. `TestAllIntraMD5`
compares decoded pictures with libaom's per-frame `.md5`
(`av1-1-b8-02-allintra`, the key frames of the size matrix, film grain at 8 and
10 bits, quantizer-00, monochrome, and the two intra block copy frames):
**all match**. `FuzzDecode` and `FuzzPipeline` ran 60 s each without a finding
(corpus committed), and a bomb test asserts a typed `LimitError` under a memory
limit.

What the oracle does not cover:

- **Super-resolution**: no vector uses it, so it is a literal port with fuzzing
and no oracle.
- **4:4:4 and monochrome post-filters**: synthetic tests only (monochrome key
frames are also covered by the monochrome vectors).
- **Film grain**: only two intra outputs are checked.
- **Quantizer matrices** (`using_qmatrix`): no available vector sets the flag,
so they are tested with hand-built bitstreams only and are not oracle-checked.
- **SVC L2T1 and L2T2** are compared against the 16-frame list.
Expand Down
Loading