Lane-realworld r1 charter (cdef index + delta q/lf)
Browse files at this commit929da2f098e6c36818e22e21b3efe4ec87f352b5Parent: 94033af- docs
- lane-realworld r1 charter (cdef index + delta q/lf)
1 changed file +69 -0
lanes/realworld-r1.charter.mdadded+69 -0
| @@ -0,0 +1,69 @@ | ||
| 1 | +# lane-realworld r1 charter — the first two blockers on a DEFAULT stream | |
| 2 | + | |
| 3 | +## Where you are | |
| 4 | +Worktree /home/user/Documents/Code/Rust/edith_codecs-realworld, branch | |
| 5 | +lane-realworld @ main. | |
| 6 | +Build/test ONLY: | |
| 7 | + `env CARGO_TARGET_DIR=$HOME/.cache/cargo-target-realworld CARGO_BUILD_JOBS=4 nice -n 19 cargo test -p ec-av1 --release --lib <name> -- --nocapture` | |
| 8 | +FOREGROUND, EC_AV1_REQUIRE_AOMENC=1 on gates. Never push. Never touch the main | |
| 9 | +checkout or the sibling -chroma worktree. WIP COMMIT after every green step. | |
| 10 | + | |
| 11 | +## The measurement this lane exists for | |
| 12 | +Every gate in this crate encodes with a long list of `--enable-*=0` flags. A | |
| 13 | +stream encoded with DEFAULT settings — nothing disabled — refuses on the very | |
| 14 | +first frame. Walking the chain by disabling one feature at a time gives the | |
| 15 | +real-world blocker order: | |
| 16 | + | |
| 17 | + 1. `cdef_bits > 0` <- a default stream stops here | |
| 18 | + 2. `delta_q_present || delta_lf_present` | |
| 19 | + 3. a block that actually uses a palette | |
| 20 | + 4. a partition below 8x8 | |
| 21 | + 5. a smooth or paeth chroma mode (lane-chroma has this) | |
| 22 | + 6. a partition below 16x16 other than a clean split | |
| 23 | + | |
| 24 | +This lane takes 1 and 2, because nothing else matters until a default stream | |
| 25 | +gets past them. | |
| 26 | + | |
| 27 | +## 1. CDEF index (the bigger win, do it first) | |
| 28 | +The CDEF FILTER is already implemented and working — `cdef` appears ~108 times | |
| 29 | +in this crate and streams with `cdef_bits == 0` decode pixel-exact today. What | |
| 30 | +is missing is only the per-64x64 `cdef_idx` SYMBOL: when `cdef_bits > 0` the | |
| 31 | +frame header carries 2^bits strength pairs and each 64x64 block reads an index | |
| 32 | +selecting which pair applies. | |
| 33 | + | |
| 34 | +Read `read_cdef` in `~/.cache/aom-oracle/src/av1/decoder/decodeframe.c` and the | |
| 35 | +spec's `read_cdef` (5.11.56). Points to get right: | |
| 36 | +- the symbol is a LITERAL of `cdef_bits` bits, not an adapting CDF; | |
| 37 | +- it is read once per 64x64 in the superblock, skipped when the block is | |
| 38 | + entirely skip, and NOT read at all when `coded_lossless` or `allow_intrabc`; | |
| 39 | +- the index selects into the header's already-parsed strength arrays, which | |
| 40 | + this crate's syntax layer reads — check before re-parsing anything. | |
| 41 | + | |
| 42 | +## 2. delta_q / delta_lf | |
| 43 | +Per-superblock `delta_q_abs` / `delta_lf_abs` symbols with their own CDFs, plus | |
| 44 | +carrying the running quantizer (and per-plane loop-filter deltas) through the | |
| 45 | +block decode. Anchor: spec 5.11.15 `read_delta_qindex` / 5.11.16 | |
| 46 | +`read_delta_lflevel`, and libaom's `read_delta_q`/`read_delta_lf` in decodemv.c. | |
| 47 | +Any new adapting CDF must be wired at ALL FOUR sites — struct field, defaults, | |
| 48 | +save/restore, per-frame counter reset. | |
| 49 | + | |
| 50 | +## Method and gates | |
| 51 | +Refuse-by-name first, decode second: a desync is never acceptable, a precise | |
| 52 | +refusal always is. On a pixel mismatch, self-pin with `EC_AV1_GATE_DUMP` and | |
| 53 | +compare the msac RANGE (never `tell()`) against the instrumented oracle — the | |
| 54 | +rungs are `EC_TRACE=1` (partitions), `EC_TRACE_MODE=1` (inter AND intra mode | |
| 55 | +info), `EC_TRACE_COEFF=1` (coefficients). Class rule worth remembering: if the | |
| 56 | +oracle's range is UNCHANGED where ours moves, we are reading a symbol it never | |
| 57 | +wrote — check that before suspecting a table. | |
| 58 | + | |
| 59 | +Add a GATE for each feature, with a hard-asserted firing count, following the | |
| 60 | +shape of the existing gates. A gate that cannot fire the feature it names | |
| 61 | +measures nothing; this batch has already fixed three of those. | |
| 62 | + | |
| 63 | +## Done criteria | |
| 64 | +Full lib suite stays green (232 passed / 0 failed on main today). A stream | |
| 65 | +encoded with `--enable-cdef=1` (the default) and one with delta-q enabled each | |
| 66 | +decode pixel-exact against ffmpeg, proven by a hard-asserted gate. REPORT | |
| 67 | +`lanes/realworld-r1.report.md`, VERDICT on the FIRST line, and re-walk the | |
| 68 | +blocker chain at the end so the report says exactly which blocker a default | |
| 69 | +stream now stops at. |