Lane-realworld r4 charter -- delta_q/delta_lf
Browse files at this commitbf8d564e09b4d68352a851c62f8e24679b2856f9Parent: 5e92401- docs
- lane-realworld r4 charter -- delta_q/delta_lf
1 changed file +52 -0
lanes/realworld-r4.charter.mdadded+52 -0
| @@ -0,0 +1,52 @@ | |||
| 1 | +# lane-realworld r4 — delta_q / delta_lf | ||
| 2 | + | ||
| 3 | +At the lane tip (main merged in). Read `lanes/realworld-r3.report.md` — it is a | ||
| 4 | +typing plan, verified against the real libaom source. Do NOT re-derive it | ||
| 5 | +(class `worker-cap-spent-reading`). Job 1 (the part64 silent desync) is CLOSED | ||
| 6 | +and merged to main. | ||
| 7 | + | ||
| 8 | +## What r3 verified for you | ||
| 9 | +- Default CDFs, from `~/.cache/aom-oracle/src/av1/common/entropymode.c:840-852`: | ||
| 10 | + `DELTA_Q`, `DELTA_LF` and `DELTA_LF_MULTI[4]` are all | ||
| 11 | + `[28160, 32120, 32677, 32768, 0]`. `FRAME_LF_COUNT = 4`, | ||
| 12 | + `MAX_LOOP_FILTER = 63`, `DELTA_Q_SMALL = DELTA_LF_SMALL = 3`. | ||
| 13 | +- The read gate collapses to a per-superblock `Cell<bool>` exactly like | ||
| 14 | + `CDEF_TRANSMITTED` (decode.rs:82) — libaom's `b_row == 0 && b_col == 0` check | ||
| 15 | + is always true for a partition tree's first-decoded leaf. | ||
| 16 | +- Only FOUR call sites need the new read, the same four `maybe_read_cdef_idx` | ||
| 17 | + already uses: `read_intra_mode_rect`, `read_intra_mode`, `decode_inter_block`, | ||
| 18 | + `decode_inter_block8` (line numbers have shifted since r3 — find them by the | ||
| 19 | + `maybe_read_cdef_idx` calls). | ||
| 20 | +- `base_q_idx: u8` is passed through ~90 sites but READ at only 2, both | ||
| 21 | + `dequant_and_inverse_typed` calls. A `CURRENT_Q_IDX` thread-local reset per | ||
| 22 | + tile and read at those 2 sites reproduces AV1's running quantizer without | ||
| 23 | + threading a parameter through every signature. | ||
| 24 | +- Open design question, the one genuinely new piece: `DeltaLF` reaching the | ||
| 25 | + deblocker (`lf_level` / `edge_params`) has no per-block carrier — | ||
| 26 | + `MiGrid` / `fill_lf_grid` needs a new field. Do the quantizer half first and | ||
| 27 | + commit it; the loop-filter half can refuse by name in between. | ||
| 28 | + | ||
| 29 | +## CDF wiring is four sites | ||
| 30 | +Struct field, defaults array, save/restore, per-frame counter reset. In this | ||
| 31 | +codebase `reset2`/`reset3` are length-generic and save/restore is a whole-struct | ||
| 32 | +Clone, so the defaults array is what needs hand-checking — but VERIFY the | ||
| 33 | +counter reset covers the new tables (class `cdf-counter-not-reset`: a missing | ||
| 34 | +reset gives right values at the wrong adaptation rate). | ||
| 35 | + | ||
| 36 | +## Then the gate | ||
| 37 | +Remove the stream.rs refusal ("a frame with delta_q_present or delta_lf_present | ||
| 38 | +set"), and gate it: `EC_AV1_REQUIRE_AOMENC=1`, `-t <seconds>` on the ffmpeg | ||
| 39 | +generate, fixture through `gradients_source`, aomenc `--threads=1 --row-mt=0 | ||
| 40 | +--sb-size=64` (this decoder hardcodes 64px superblocks) plus whatever turns | ||
| 41 | +delta_q on (`--deltaq-mode=`, and `--aq-mode`); the fixture needs MORE THAN ONE | ||
| 42 | +SUPERBLOCK or a per-superblock symbol can never fire. HARD-assert a thread-local | ||
| 43 | +firing count. | ||
| 44 | + | ||
| 45 | +Merge note: main is at 53b319b with `gate_coverage.rs` and | ||
| 46 | +`refusal_inventory.rs`. Report every refusal string you add or remove, verbatim. | ||
| 47 | + | ||
| 48 | +Hard rules: `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-realworld`; foreground | ||
| 49 | +`nice -n 19 cargo ... -j4`; every `cargo test` a timeout >= 600000 ms. Sibling | ||
| 50 | +worktrees have live agents — never build in or edit them. Never push, never | ||
| 51 | +merge, never touch `main`. 75-turn cap, does not reset: COMMIT AT EVERY GREEN | ||
| 52 | +STEP. End with `lanes/realworld-r4.report.md`, VERDICT on line 1. | ||