From df61f890c8d507fcf2e584928b779b88a682aadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 8 Sep 2026 17:33:14 +0300 Subject: [PATCH] docs(av1): lane-b128r report --- lanes/b128r.report.md | 142 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 lanes/b128r.report.md diff --git a/lanes/b128r.report.md b/lanes/b128r.report.md new file mode 100644 index 00000000..d84ad5c7 --- /dev/null +++ b/lanes/b128r.report.md @@ -0,0 +1,142 @@ +# lane-b128r — a residual and a compound arm at the 128 root + +Two of the three arms the charter names are implemented and measured; the +third is deferred with its reason. One decoder defect was found on the way. + +| arm | state | +|---|---| +| 1. the 128 NONE block WITH a residual | written, witnessed, **opt-in** (`EC_AV1_B128RES=1`) — measured INERT and it leaves a filter-stage mismatch | +| 2. the 128 NONE **compound** arm | written, witnessed, **shipped on**: film A −0.2/−0.2, film B −0.2/−0.3 | +| 3. HORZ / VERT at the 128 root | **deferred**, untouched — see the disposition | + +## 1. The residual arm (opt-in) + +`search_root_128` now prices the winner's own prediction with a real +residual against the skip arm it just committed to the planes, and +`write_inter_block_128` codes it: per 64x64 mu chunk one TX_64X64 luma unit +(its coded 32x32 corner, `TxbSet::Luma64`, DCT-only at this size) then one +TX_32X32 unit per chroma plane on the offset-10 `txb_skip` rows, each +publishing its own coefficient context before the next unit reads it, with +the var-tx tree's four depth-0 `txfm_partition` symbols in front. Levels +travel as one 64-wide grid per plane, chunk (cr, cc) at (cr\*32, cc\*32). +Quantized at the qindex the ROOT signals (the delta_q unit is the 128 +superblock, lane-b128m), var-tx depth 0 only. + +**Witness** — `encode::tests::a_128_root_block_with_a_real_residual_decodes_exact_through_both_decoders` +(`--ignored`, the arm and the root forced so the clip codes the shape +rather than waiting for content): + + 128x128 blocks WITH a residual: search won 420, writer coded 420 + test ... ok + +420 residual 128x128 blocks over 8 frames at 1280x768, every frame +sample-exact against the encoder's own reconstruction through +`decode_stream` AND through ffmpeg. RED before the lane by construction +(the writer refused a non-skip 128 block) and RED again on the first draft: + +- **defect (writer)**: `write_inter_block_128` recorded `skip = true` in its + own neighbour band whatever the block was, so the NEXT root's `skip` + symbol took CDF row 1 (16515) where the reader takes row 0 (31739) — + first divergent symbol index 33, found with `EC_AV1_SYMTRACE`. + +**Why it ships off.** Two measurements: + +- it is INERT on content: over the native 12-frame gate the RD takes it + **0–2 times per frame** against ~90 whole 128 roots per frame + (`EC_AV1_B128_CENSUS=1`); +- switched on, `bd_rate_screen_native`'s bars 2160p row at q=90 frame 11 + has **8 luma samples** (rows 126..127, cols 1611..1616 — the two rows + above a 128-superblock horizontal edge) where ffmpeg and this encoder's + own reconstruction disagree. The arm's own witness is byte-exact through + ffmpeg over 420 blocks at 1280x768, so the open half is a FILTER-stage + interaction at a 128 block's own edge, not the coefficient path. + +An inert candidate does not buy a live filter mismatch. `EC_AV1_B128RES=1` +turns it on; the default encoder is byte-identical to the control (pins and +both 2160p gate rows reproduce the standing table to the digit). + +## 2. A decoder defect: one `cdef_idx` literal covers every unit its block spans + +libaom stores the `cdef_idx` it reads at the ORIGIN mi of the 64x64 CDEF +unit and `av1_cdef_frame` reads each unit's strength back off that origin — +so a block WIDER than one unit (the 128 root's block, the only one there +is) drives every unit it covers with its single literal. `maybe_read_cdef_idx` +stamped the reading block's own cell alone. No stream could reach it before +the 128 root carried a residual (class *branch dropped as unreachable*), and +the residual witness is its gate. Fixed with the block's own mi span, which +is a no-op for every block of one unit or less. + +## 3. The compound arm (shipped on) + +`search_root_128` passed an empty compound list, so a 128x128 block could +only ever name ONE reference — while the writer has had the path since +lane-b128 (`write_compound_block` for a block that names a second one). The +root now builds the `LAST`+`GOLDEN` / `LAST`+`ALTREF` stacks at its own +32x32-mi window, exactly as the 64 root builds them per superblock, and +offers the same three modes (`NEAREST_NEARESTMV`, `GLOBAL_GLOBALMV`, +`NEW_NEARESTMV`). `EC_AV1_B128COMP=0` is the attribution control. + +**It fires on real content** — census, compound 128x128 blocks per frame: + +| row | compound 128 blocks / frame | +|---|---| +| film B (2160p) | up to **80**, tens on most frames | +| bars 2160p | tens | +| screen capture | 0 (the screen path gates compound off) | +| synthetic bars pan | 1 per 8 frames | + +**Witness** — `encode::tests::a_128_root_compound_block_decodes_exact_through_both_decoders` +(`--ignored`, root forced): + + COMPOUND 128x128 blocks: search won 216, writer coded 432 + test ... ok + +(the writer count is the higher one because the filter search re-codes each +tile). 12 frames of `testsrc2` at 1280x768, sample-exact through +`decode_stream` and ffmpeg. RED before the lane: the count was 0. + +### The deciding gate + +`bd_rate_screen_native`, 12 frames, four quantizers, BD-rate vs libaom +`cpu-used 6` / rav1e `speed 6` (lower is better). Control = the standing +table of `lanes/table-20260908.md`, reproduced on this tree with the arm +off (both 2160p rows re-run here, to the digit): + +| row | control | + the 128 compound arm | +|---|---|---| +| bars 1080p | −3.4 / −19.0 | −3.4 / −19.0 | +| bars 2160p | +8.6 / −13.8 | +8.6 / −13.7 | +| film A (1080p) | +18.1 / −6.2 | **+17.9 / −6.4** | +| film B (2160p) | +23.8 / −2.8 | **+23.6 / −3.1** | +| screen capture | +14.4 / −33.2 | +14.4 / −33.2 | + +Both film rows are DOWN on both columns; screen is unchanged; bars 2160p +moves +0.1 on the rav1e column (inside the ±0.3 flat band). Wall on the 4K +film row 124.7s → 138.2s (+10.8%, under the +15% ceiling). + +## Pins + +Re-taken for the compound arm, which moves every inter frame that carries +`reference_select`: `(150, 8364, 0xcb2ad7936d5127c5)`, `(60, 33257, +0x87db250ba556e5a6)` — was `(150, 8354, ...)`, `(60, 33222, ...)`. +`EC_AV1_B128COMP=0` restores 8354 / 33222 exactly, which is also the proof +that nothing else in this lane moves the shipped stream. Green at the +default and at `EC_AV1_SPEED=6`. No other byte pin moved. + +## Disposition + +- `deferred`: **HORZ / VERT at the 128 root** (two 128x64 / 64x128 blocks), + untouched. The writer has no rect neighbour recording at this size and the + search no rect trial; `write_inter_block_128` is square throughout + (`record`/`record_inter`/`record_planes` all take one side). Unblocked by + a rect `record_inter`/`record` pair plus a rect trial in + `search_root_128`. The decoder reads both already (lane-sb128c r7). + Not attempted: the residual arm's own writer/reader bisect consumed the + budget this would have needed. +- `open`: the residual arm's **8-sample filter mismatch** (bars 2160p, q=90, + frame 11, rows 126..127 / cols 1611..1616, ffmpeg vs our reconstruction). + Next step: dump the deblock/CDEF decision at that 128 superblock's own + bottom edge for a block that carries a residual, against aomdec. Until + then the arm stays behind `EC_AV1_B128RES=1`. +- `open` (inherited): search-time vs write-time mv stacks still differ + (lane-sb128b's second open item).