R5 report -- VERT_A/_B has_tr table root cause, 4 AB arms gated, residue
Browse files at this commitfb6a2f16c2f0f53539a81898c5db56b6a7266b41Parent: 02e331f- docs
- r5 report -- VERT_A/_B has_tr table root cause, 4 AB arms gated, residue
1 changed file +137 -0
- lanes/part32-r5.report.md +137 -0
lanes/part32-r5.report.mdadded+137 -0
| @@ -0,0 +1,137 @@ | |||
| 1 | +# lane-part32 r5 — SB-level AB partitions at 64x64, proven arm by arm | ||
| 2 | + | ||
| 3 | +Branch `lane-part32`, commit `fd1a2eb` on top of r4's WIP snapshot `25cac7d` | ||
| 4 | +(itself rebased on main `3808cf8`). | ||
| 5 | + | ||
| 6 | +## What r4 actually left (verified, not assumed) | ||
| 7 | + | ||
| 8 | +r4's last words claimed SB-level HORZ/VERT 64 was green. It was not: with | ||
| 9 | +`EC_AV1_REQUIRE_AOMENC=1` both | ||
| 10 | +`a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact` | ||
| 11 | +and its new `..._ab_partition_...` sibling FAILED on seed 63 (luma mismatch, | ||
| 12 | +`test result: FAILED. 0 passed; 2 failed`). r4's two real fixes — | ||
| 13 | +`EOB_PT_512_CHROMA` q-context split (`cdf.rs:269`, `cdf_state.rs:1013`) and | ||
| 14 | +the four AB arms in `decode.rs` — were correct but incomplete. | ||
| 15 | + | ||
| 16 | +## Root cause found and fixed this round | ||
| 17 | + | ||
| 18 | +`PARTITION_VERT_A`/`_B` visit their square sub-blocks **TL, BL, TR, BR**, not | ||
| 19 | +in raster order, so the bottom-left square's top-right neighbour is the | ||
| 20 | +partition's own right-hand rectangle — not yet decoded. libaom switches | ||
| 21 | +`has_top_right`/`has_bottom_left` onto `has_tr_vert_*`/`has_bl_vert_*` for | ||
| 22 | +exactly these two partition types (`reconintra.c` `get_has_tr_table`, | ||
| 23 | +`get_has_bl_table`). This crate's `Reach` carried only the raster tables: | ||
| 24 | +for the BL 32x32 (blk_row_in_sb=1, blk_col_in_sb=0, bit index 4) | ||
| 25 | +`has_tr_32x32[0]=95` bit 4 = **1** while `has_tr_vert_32x32[0]=15` bit 4 = **0**. | ||
| 26 | +One availability bit → 4683 wrong luma pixels. | ||
| 27 | + | ||
| 28 | +Failure chain on the pinned stream: BL square predicts (V_PRED, angle_delta=2) | ||
| 29 | +off never-written above-right samples → its right columns decay | ||
| 30 | +(150,150,150 → 130,93,39 at x=157..159) → the 32x64 strip to its right | ||
| 31 | +DC-predicts off that corrupted left column and comes out flat **107** instead | ||
| 32 | +of ~149 → the next superblock row's V_PRED copies 107 down the whole frame. | ||
| 33 | + | ||
| 34 | +Decisive evidence that this was reconstruction, not entropy: instrumented | ||
| 35 | +`aomdec` (`EC_TRACE=1 EC_TRACE_MODE=1`) agrees with us on every symbol — | ||
| 36 | +`EC_PART_VAL mi_row=0 mi_col=32 value=6` (VERT_A), every `EC_IMODE_VAL` | ||
| 37 | +mode/uv_mode, and the msac **range** at `mi_row=0 mi_col=40` is `53240` in | ||
| 38 | +both decoders (ours: `TRACE_RECT_PREFI ... rng=53240`). | ||
| 39 | + | ||
| 40 | +## Files changed | ||
| 41 | + | ||
| 42 | +- `crates/ec-av1/src/encode.rs:1049` — `HAS_TOP_RIGHT_VERT` / | ||
| 43 | + `HAS_BOTTOM_LEFT_VERT` transcribed verbatim from libaom | ||
| 44 | + (`has_tr_vert_8x8/16x16/32x32`, `has_bl_vert_*`), a `VERT_AB_PARTITION` | ||
| 45 | + thread-local + `VertAbGuard`, `Reach::vert_ab_partition()`, and the table | ||
| 46 | + pick inside `top_right`/`bottom_left`. Rect sub-blocks deliberately keep | ||
| 47 | + the non-vert tables (libaom's own comment) — `Reach::of_rect` untouched. | ||
| 48 | +- `crates/ec-av1/src/decode.rs:7535,7610` — the 32x32-level intra VERT_A/VERT_B | ||
| 49 | + arms take the guard (same defect one level down, swept in the same round). | ||
| 50 | +- `crates/ec-av1/src/decode.rs:7766` — the SB-level AB arm takes it only for | ||
| 51 | + the two vertical arms. | ||
| 52 | +- `crates/ec-av1/src/decode.rs:13432,13595` — the two inter AB VERT arms take | ||
| 53 | + it too (class sweep; inter intra-mode blocks read the same `Reach`). | ||
| 54 | +- `crates/ec-av1/src/decode.rs:767,772` — `SB_AB_HITS` is now `[usize; 4]`, | ||
| 55 | + incremented by arm, with `sb_ab_hits_by_arm()`. | ||
| 56 | +- `crates/ec-av1/src/stream.rs:9665` — the AB gate hard-asserts **each** of | ||
| 57 | + HORZ_A/HORZ_B/VERT_A/VERT_B fired, not just the sum. | ||
| 58 | +- `crates/ec-av1/src/stream.rs:9467,9628` — both gates' stale r2 comment | ||
| 59 | + ("AB-at-64 is a different, unlanded capability") replaced with the r5 truth. | ||
| 60 | +- `crates/ec-av1/src/refusal_inventory.rs:50` — (r4) the refusal is now | ||
| 61 | + narrowed to the 1:4 pair only. `gate_coverage.rs` needed no edit: | ||
| 62 | + `--enable-ab-partitions=1` is now positively exercised and the flag was | ||
| 63 | + never on `NEVER_EXERCISED`; both its tests are green in the run below. | ||
| 64 | + | ||
| 65 | +## Gates | ||
| 66 | + | ||
| 67 | +``` | ||
| 68 | +CARGO_TARGET_DIR=$HOME/.cache/cargo-target-part32 EC_AV1_REQUIRE_AOMENC=1 \ | ||
| 69 | + cargo test -p ec-av1 --lib -- --test-threads=1 --nocapture superblock_level | ||
| 70 | +``` | ||
| 71 | +`test result: ok. 2 passed; 0 failed; 1 ignored` (was 0 passed; 2 failed). | ||
| 72 | + | ||
| 73 | +EVIDENCE: /tmp/.../scratchpad/r5gate.txt, r5ab.txt | 40 real-aomenc streams per gate, `--sb-size=64 --enable-rect-partitions=1 --enable-ab-partitions=1`, seeds 42..81, decoded and compared to ffmpeg | ab gate 37 pixel-exact / 3 named refusals, `sb_ab_hits=13 arms(HORZ_A,HORZ_B,VERT_A,VERT_B)=[2, 5, 3, 3]`; horz/vert gate 37 pixel-exact, `sb_rect_hits=61` | ||
| 74 | + | ||
| 75 | +EVIDENCE: /tmp/.../scratchpad/r5full.txt | `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib` | `test result: ok. 269 passed; 0 failed; 24 ignored; 0 measured` in 1094s | ||
| 76 | + | ||
| 77 | +EVIDENCE: /tmp/.../scratchpad/pre63o.f0 vs our63_nf.y | oracle `EC_AV1_PREFILT_DUMP` vs ours with deblock+CDEF disabled, on the pinned seed-63 stream (pre-fix) | 4683 luma samples differ, bbox x=[151,191] y=[0,127]; post-fix the gate is pixel-exact | ||
| 78 | + | ||
| 79 | +## Refusal lifted | ||
| 80 | + | ||
| 81 | +`"a superblock-level partition type other than NONE or SPLIT (this decoder's | ||
| 82 | +intra tile path codes only those two at 64x64)"` → replaced by | ||
| 83 | +`"a superblock-level 1:4 partition (PARTITION_HORZ_4/VERT_4 at 64x64, four | ||
| 84 | +64x16/16x64 strips)"`. HORZ/VERT/HORZ_A/HORZ_B/VERT_A/VERT_B at 64x64 are all | ||
| 85 | +now real-stream-proven. | ||
| 86 | + | ||
| 87 | +## Film check | ||
| 88 | + | ||
| 89 | +`ffmpeg -t 0.4 -i ReelC...mkv -c:v copy -f obu reelc_r5.obu` (418 B), then | ||
| 90 | +`cargo run -p ec-av1 --example decode_probe -- reelc_r5.obu`: | ||
| 91 | + | ||
| 92 | +``` | ||
| 93 | +REFUSED: unsupported: AV1 tile (filter intra on a HORZ/VERT strip (this decoder predicts square-only)) | ||
| 94 | +``` | ||
| 95 | + | ||
| 96 | +ReelC reaches an SB-level HORZ/VERT strip and now stops on filter-intra-on-a-strip. | ||
| 97 | +deferred: the matching "before" probe on main `3808cf8` — not re-measured this | ||
| 98 | +round (would need a full rebuild of a second target dir at the turn ceiling); | ||
| 99 | +unblocked by any lane that already has a main-based build of `decode_probe`. | ||
| 100 | + | ||
| 101 | +## Coordinator's two facts, answered | ||
| 102 | + | ||
| 103 | +1. **rectsplit seed 50 / `decode_block_rect64` split-transform residual** — NOT | ||
| 104 | + fixed here; my change never runs for a HORZ/VERT strip (the guard is set | ||
| 105 | + only under VERT_A/_B, and rect blocks go through `Reach::of_rect`, which is | ||
| 106 | + untouched). But the hypothesis is now concrete and shares this round's | ||
| 107 | + class: `decode.rs:5099` and `decode.rs:5425` compute per-TU availability as | ||
| 108 | + `Reach::of(logical_tx, tu_px, tu_py, ...)` — i.e. they treat the transform | ||
| 109 | + unit as if it were a *block at frame coordinates* and consult the | ||
| 110 | + superblock-position table. libaom does not: in `has_top_right`, when | ||
| 111 | + `row_off > 0` it never reaches a table at all, it returns | ||
| 112 | + `col_off + tx_size_wide_unit < plane_bw_unit` — purely block-relative. For | ||
| 113 | + a depth-2 TX_16X16 inside a 64x32 strip that is exactly the sub-TU at | ||
| 114 | + `row_off > 0` case. That is where I would look first for the (171,56) | ||
| 115 | + 147-vs-148 sample. `rectsplit` keeps ownership. | ||
| 116 | +2. **scaledref's masked Golomb defect at seed 67** — appears RESOLVED on this | ||
| 117 | + branch. Both r5 gate runs cover seeds 42..81; the only refusals were seeds | ||
| 118 | + 45/46/59 (screen-content palette strip), and seed 67 decoded **pixel-exact | ||
| 119 | + against ffmpeg**, which is stronger than "no Golomb refusal". Most likely | ||
| 120 | + killed by r4's `EOB_PT_512_CHROMA` q-context fix, with this round's | ||
| 121 | + availability fix removing the seed-63 sibling. scaledref should re-run with | ||
| 122 | + the raised cap after merge; if it still reproduces, the cause is elsewhere. | ||
| 123 | + | ||
| 124 | +## Residue | ||
| 125 | + | ||
| 126 | +- fix-now(next lane): `PARTITION_HORZ_4`/`VERT_4` at 64x64 — still refused by | ||
| 127 | + name. Not attempted: `decode_block_rect64` is hardwired to 64x32/32x64 | ||
| 128 | + (`TxbSet::Luma64` + `TX32` scan for luma, `ChromaRect32x16` + `SCAN_32X16/ | ||
| 129 | + 16X32` for chroma, `decode.rs:3846-3990`); a 64x16 strip needs a real | ||
| 130 | + TX_64X16 luma transform plus 32x8 chroma scans/EOB tables, which is a | ||
| 131 | + transform-primitive lane, not a partition-wiring one. | ||
| 132 | +- accepted: `Reach::table(64)` maps to the 16x16 table row (pre-existing); | ||
| 133 | + harmless because a 64x64 block in a 64 superblock always takes the | ||
| 134 | + `row == 0` early return before any table is read. | ||
| 135 | +- accepted: the per-TU `Reach::of` shape described above is left to rectsplit | ||
| 136 | + rather than fixed blind here, since every gate on this branch is green and a | ||
| 137 | + speculative change to it would risk them. | ||