forge
Explore
Log in

Don't you dare go Hollow

lanes: vp8.report.md (M1 verified, M2 WIP red witnesses, M3/M4 status)

Browse files at this commit

a5b02e04eaba8a237c0fd4415fb9380352e12f73Ahmet Kaan GümüşParent: 5b0ae03
lanes/vp8.report.mdadded+93 -0
@@ -0,0 +1,93 @@
1+# lane-vp8 — native VP8 decoder (ec-vp8), RFC 6386
2+
3+Base: `a8f2186a` (main), worktree `edith_codecs-vp8`, branch `lane-vp8`.
4+Never merged, never pushed. Pins untouched (no ec-av1 changes at all).
5+
6+## Milestone table
7+
8+| Milestone | State | Evidence |
9+|---|---|---|
10+| M1 bool decoder + frame tag + full first-partition header | **done/verified** | commit `57b5a53a`; 12 unit tests green; real vpxenc/ffmpeg streams (6 sizes/q, 8-token-partition, WebP still) parse with exact partition tiling, correct dims (incl. 76x52 non-MB-aligned), 0 desyncs |
11+| M2 key-frame-only decode, sample-exact vs ffmpeg | **implemented, NOT verified** | commit `20f7d742`; 49 lib tests + 4 header tests green (all kernels differential-fuzzed vs libvpx C); ffmpeg byte-compare witnesses (`tests/keyframe_exact.rs`) RED — see "known gap" |
12+| M3 inter frames | **not attempted** (fixtures + spec recon done) | `clip-obs-320x192.ivf` (169 fr, 4 KFs), `altref-160x96.ivf`, `mparts-160x96.ivf` (8 partitions), `gop-160x96.ivf`; §16-18 read; inter trees/tables in `modes.rs` |
13+| M4 public API + docs | **not attempted** | `Decoder::decode(&[u8]) -> Result<Option<Picture>>` exists; ec-av1-style `decode_stream` not yet |
14+
15+## What shipped (M1 `57b5a53a`, M2 WIP `20f7d742`)
16+
17+- `bool.rs`: RFC §7.3 decoder verbatim (bool/literal/signed/maybe-signed/
18+ prob7/tree + EOB-skipping token form), zero-extend init for tiny
19+ partitions, overread counter as desync detector; test-only RFC encoder.
20+- `frame.rs`/`header.rs`: 3-byte LE tag, key-frame start code/dims,
21+ complete partition-1 header in dixie field order (colour space,
22+ segmentation w/ cross-frame state, LF type/level/sharpness/deltas,
23+ token partition size table, quant indices, reference refresh/copies/
24+ sign-bias, coef-prob updates, mb_no_skip_coeff, inter prob_intra/last/gf
25+ + ymode/uv/MV updates). `PersistedState` carries entropy/segmentation/
26+ LF deltas across frames, resets at key frames.
27+- `tables.rs`: GENERATED from the RFC text by `scripts/extract_vp8_tables.py`
28+ (element counts asserted; page-header stripping; Pcat sentinels kept):
29+ default+update coefficient probs, kf_bmode_prob, coeff_bands, dequant
30+ lookups, Pcat1-6, default+update MV probs.
31+- `tokens.rs`: §13 GetCoeffs port — bands incl. sentinel entry, 3-context
32+ model (above/left per-plane, Y2 last-MB-with-Y2 semantics), EOB skipped
33+ after zero, dequant-on-write (DC at first coded position), Y2-first
34+ block order, dixie skip-MB reset (Y2 slots survive iff no Y2 block).
35+- `modes.rs`: all trees/tables; NOTE SPLITMV partition leaves use the RFC
36+ enum values (top_bottom=0, left_right=1, quarters=2, MV_16=3).
37+- `transform.rs` (subagent): idct4x4/iwht4x4 + shortcuts + dequant;
38+ 400,000-vector bit-exact fuzz vs verbatim libvpx idctllm.c; dequant
39+ differentially fuzzed vs libvpx C over 528 q x 15 deltas x 5 channels.
40+- `intra.rs` (subagent): all 16x16/8x8/4x4 predictors; 20,000-stream
41+ machine diff vs libvpx intrapred.c — 28.8M/28.8M samples equal; svg2p
42+ RFC typo handled (avg2p).
43+- `loopfilter.rs` (subagent): normal+simple kernels and frame driver in
44+ dixie order (V-MB, V-sub, H-MB, H-sub; level 0 skips; combined
45+ blim/mblim for simple), dixie-table-exact limits, frame-type-exact hev
46+ via `filter_frame_ex(..., is_keyframe)`; 10 tests incl. Python-oracle
47+ full-frame driver order.
48+- `decode.rs`: per-row pipeline (modes -> tokens -> reconstruct),
49+ bordered planes (127 top incl. corner / 129 left), above-right
50+ synthesis (shared extras for right-edge subblocks, replicate on
51+ rightmost MB, 127 on top row), B_PRED interleaved predict+residual
52+ (subblocks chain through reconstructed pixels), Y2 WHT DC override,
53+ per-MB LF level with dixie DOUBLE-clamp, LF post-pass (order-equivalent
54+ to dixie's row-delayed filtering for non-threaded decode; frame-level
55+ level==0 gate).
56+- Fixtures: `scripts/gen_vp8_fixtures.sh` + local libvpx build recipe
57+ (`~/.cache/vp8/libvpx-src`, gives vpxenc for --token-parts; ffmpeg 8's
58+ wrapper has no token-part option). CQ quirk: `-crf` inside the
59+ qmin/qmax band is mandatory.
60+
61+## Witnesses
62+
63+- M1: `cargo test -p ec-vp8 --test header_parse` — 4 tests on real
64+ libvpx/vpxenc bitstreams: dims, start code, partition tiling
65+ (`token_data_offset + 3*(n-1) + sum(sizes) == frame len`), 8
66+ partitions, inter header coexists with persisted entropy, VP8-in-WebP
67+ chunk parses. ALL PASS.
68+- M2: `cargo test -p ec-vp8 --test keyframe_exact` — ffmpeg byte-compare
69+ (`ffmpeg -v error -i F -f rawvideo -pix_fmt yuv420p -`) on 6 kf fixtures
70+ + mparts + WebP still. **FAILING — 0/3** (see below).
71+
72+## Known gap (the M2 blocker), localized as far as budget allowed
73+
74+Single 16x16 black q=0 frame: chroma decodes exact (u=v=128), luma is
75+~99-130 where ffmpeg says 16. The MB is B_PRED, coeffs plausible
76+(Y0 = [-216,-8,-4,4] dequantized, y1dc=4). Predicted: wrong luma
77+residual application or subblock-mode/border interaction in the B_PRED
78+path; LF excluded (pixel (0,0) is never filtered; failure predates it).
79+Debug aids left in place: `EC_VP8_DEBUG=1` per-MB coeff dump,
80+`examples/dbg_first.rs`. Next steps for the session that picks this up:
81+(1) hand-decode the 44-byte black frame partition-0 + token partition
82+against dixie by script; (2) check B_PRED sub-mode context indexing
83+(above/left border MBs) and the per-subblock predict->write->add
84+sequencing against dixie predict.c/idct_add.c; (3) the missing
85+`reset_left` per MB row was found and fixed during the sweep — re-check
86+its dixie position (row start, after above reset).
87+
88+## Repro
89+
90+```
91+CARGO_TARGET_DIR=~/.cache/cargo-target-vp8 cargo test -p ec-vp8
92+scripts/gen_vp8_fixtures.sh # fixtures/vp8/*.ivf (gitignored)
93+```