forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 214cdf2befd543569feaaaf45888fe80e40318dfFiltered to crates/ec-av1/src/sequence.rsClear filter

2026-08-25

feat(av1): write the key-frame header OBUAhmet Kaan Gümüş · e203345
feat(av1): write the key-frame header OBU

The inverse of `ec_av1_syntax`'s `parse_uncompressed_header`, for the
subset a stateless encoder emits: a shown key frame in a sequence with no
decoder model, no frame id numbers and no still-picture shortcut. It
covers tile info (uniform spacing), quantization, segmentation, delta q
and delta lf, loop filter, CDEF, loop restoration, transform mode and the
reduced transform set, plus `frame_obu` to carry the header and a tile
group in one OBU.

Two of the codings are not the value they look like and are spelled out
here: the restoration type is remapped (None 0, Switchable 1, Wiener 2,
Sgrproj 3, not the enum's discriminant) and a CDEF secondary strength of
4 is coded as 3.

Everything outside the subset is refused by name rather than written
wrong: a superres denominator other than 8, film grain synthesis, frame
id numbers, decoder model timing, `show_existing_frame`, any non-key or
hidden frame, and non-uniform tile spacing.

The tests parse back every stream they write through `Av1Parser` and
compare the whole `FrameHeader`, including the derived fields the format
never codes (the header's own bit length, the tile start ramps, the
segmentation id range), across a one-tile frame, a four-tile-column
frame, a segmented frame with delta q and delta lf, and a frame using
loop restoration.

2026-08-24

feat(ec-av1): OBU header/framing writer + sequence-header writerAhmet Kaan Gümüş · 4cb83b2
feat(ec-av1): OBU header/framing writer + sequence-header writer

Bit-exact inverse writers of the parsers in ec-av1-syntax:

obu.rs:
- obu_type_code: ObuType -> 4-bit code (inverse of ObuType::from_code)
- write_obu_header: writes OBU header (spec 5.3.2), forbidden/reserved bits 0
- wrap_obu: frames payload as low-overhead OBU (header + leb128 size + payload)
- temporal_delimiter: the two-byte 0x12 0x00 temporal-unit marker

sequence.rs:
- write_sequence_header: full sequence-header payload (spec 5.5.1)
- write_color_config: color_config() inverse (spec 5.5.2)
- sequence_header_obu: wraps the payload as a SequenceHeader OBU

Supported subset only (unsupported configs return Error::unsupported):
- reduced_still_picture_header == false (still-image header not implemented)
- no timing_info
- no decoder_model_info
- exactly one operating point

Roundtrip tests: write -> parse back -> assert equality for both OBU headers
(plain + extension) and sequence headers; wrapped OBU leb128 size asserted to
match payload length; temporal delimiter asserted to be [0x12, 0x00].

Gates: cargo test --release -p ec-av1 (13 passed), cargo clippy --release
-p ec-av1 --all-targets (clean), cargo fmt.