R3 report -- the 128 NONE block is pixel-exact (mu-chunk plane order, offset-10 chroma txb_skip rows, per-unit chroma context), the 10-bit reds were a recipe defect, suite 371/0
Browse files at this commitd685b049c94c7fdb3411eb70dd04e9050decbf3cParent: f00f0e1- docs
- r3 report -- the 128 NONE block is pixel-exact (mu-chunk plane order, offset-10 chroma txb_skip rows, per-unit chroma context), the 10-bit reds were a recipe defect, suite 371/0
1 changed file +101 -0
- lanes/sb128b-r3.report.md +101 -0
lanes/sb128b-r3.report.mdadded+101 -0
| @@ -0,0 +1,101 @@ | ||
| 1 | +# lane-sb128b r3 — the 128x128 PARTITION_NONE block decodes PIXEL-EXACT (3 root causes), the 10-bit reds were a recipe defect | |
| 2 | + | |
| 3 | +Branch `lane-sb128b`, worktree `edith_codecs-sb128b`, commits `dd6f934` (merge main 7a47fc1 + TASK B), | |
| 4 | +`f2b6f1c` (TASK A), `7ceb309` (merge main 18bf7dc / lane-sb128 5ea5ec8). | |
| 5 | + | |
| 6 | +## TASK A — the 128 NONE residual: THREE root causes, none of them where r2 pointed | |
| 7 | + | |
| 8 | +r2 read "our first TX_64X64 luma unit reads AC coefficients libaom never wrote". Measured with a | |
| 9 | +range ladder (instrumented `aomdec` `EC_TRACE_COEFF` vs our `EC_TRACE_COEFF`) that premise is | |
| 10 | +WRONG: the first luma unit is identical symbol for symbol and range for range | |
| 11 | +(`all_zero ctx=1 rng=59208 / eob=3 rng=41268 / base_eob level=5 rng=44688 / ... / rng=36616`). | |
| 12 | +The divergence is at the SECOND element of the block, and it is three separate defects: | |
| 13 | + | |
| 14 | +1. **Plane order.** libaom's `decode_token_recon_block` loops 64x64 luma "mu" chunks | |
| 15 | + (`mu_blocks_wide/high = mi_size_wide[BLOCK_64X64]`) and codes EVERY PLANE of a chunk before the | |
| 16 | + next chunk. The oracle ladder is Y(0,0) U(0,0) V(0,0) Y(0,16) U(0,8) V(0,8) ... — Y,U,V per | |
| 17 | + quadrant. We read all four luma units and then all chroma units. Below 128 a block is one chunk, | |
| 18 | + so the fix (`nchunk = side/64`, luma TUs then chroma units per chunk) is byte-for-byte the old | |
| 19 | + order at every size the decoder already handled. | |
| 20 | +2. **The chroma `txb_skip_ctx` offset.** `get_txb_ctx`: chroma ctx is | |
| 21 | + `combine_entropy_contexts(above,left)` **+7** normally, **+10** when the plane block is LARGER | |
| 22 | + than the transform. A 128 block's 64x64 uv plane block with TX_32X32 units is AV1's only such | |
| 23 | + case, and our chroma table only ever carried the offset-7 rows (`txb_skip_chroma_*: [[u16;3];3]`). | |
| 24 | + Oracle read ctx=10, we read ctx=0. Added `TXB_SKIP_CHROMA_32_BIG{,_Q0,_Q1,_Q3}` from | |
| 25 | + `av1_default_txb_skip_cdfs[q][TX_32X32][10..13]` (token_cdfs.h, all four q contexts, verified by | |
| 26 | + re-deriving the existing offset-7 rows from the same array), `txb_skip_chroma_32` is six rows, | |
| 27 | + caller adds 3 when `cn > 1`. | |
| 28 | +3. **Deferred chroma context writes.** r2 recorded each chroma unit's coefficient context only | |
| 29 | + after the whole block, so the second quadrant read ctx 10 where the oracle reads 11 (base 1 from | |
| 30 | + its left neighbour inside the same block). Now recorded per unit inside the loop; the | |
| 31 | + post-`record_split_luma` replay stays, because that call would otherwise clobber them whole-block. | |
| 32 | + | |
| 33 | +Files: `crates/ec-av1/src/decode.rs` (mu-chunk loop + `chroma_ctx_offset` + per-unit record + | |
| 34 | +`read_plane`'s chroma `skip_ctx`), `crates/ec-av1/src/cdf.rs` (4 tables), | |
| 35 | +`crates/ec-av1/src/cdf_state.rs` (`txb_skip_chroma_32` 3 -> 6 rows). | |
| 36 | + | |
| 37 | +EVIDENCE: `$HOME/.cache/sb128b-work/{s44.obu,ref44.yuv,ours44.yuv.f0.yuv,ref.ladder}` | | |
| 38 | +aomenc gate-arm-3 recipe (seed 44 gradients 256x256 cq63 `--sb-size=128 --cpu-used=0 | |
| 39 | +--enable-tx-size-search=0 ...`), `EC_TRACE_COEFF` ladders of aomdec and `dump_yuv`, then | |
| 40 | +`dump_yuv` vs `ffmpeg -pix_fmt yuv420p` | **48 `txb_skip` symbols, ranges identical one for one; | |
| 41 | +0 of 98304 samples differ (pixel-exact)**. Before the fix: 60857 luma samples differed. | |
| 42 | + | |
| 43 | +REFUSAL LIFTED (with its gate): `a 128x128 PARTITION_NONE block (...)` deleted from `decode.rs` and | |
| 44 | +`refusal_inventory.rs`; `a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact` | |
| 45 | +un-`#[ignore]`d. | |
| 46 | +EVIDENCE: `cargo test -p ec-av1 --lib -- a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact --nocapture` | | |
| 47 | +4 real-aomenc arms (384x384 seed 42 cq63, 384x384 seed 43 cq55, 256x256 seed 44 cq63, 384x384 seed 45 | |
| 48 | +10-bit) decoded vs ffmpeg | **ok — 4/4 pixel-exact, 0 named refusals, `part128_none_hits=31`** | |
| 49 | +(9+9+4+9 128-NONE roots). Sibling gates `a_real_aomenc_128x128_superblock_stream_decodes_pixel_exact`, | |
| 50 | +`refusal_inventory`, `gate_coverage` re-run green in the same invocation (14 passed / 0 failed). | |
| 51 | + | |
| 52 | +## TASK B — the 2 inherited 10-bit reds were an ENCODER RECIPE defect | |
| 53 | + | |
| 54 | +`git show main:crates/ec-av1/src/stream.rs` vs the lane's: r2 rewrote `--min-partition-size=16` to | |
| 55 | +`32` at **13** call sites that main has at 16, including both failing gates. 32 removes the 16-level | |
| 56 | +the rect/AB gates assert. Reverted all 13 (the lane's own two 128 gates keep their deliberate 32). | |
| 57 | +EVIDENCE: `cargo test -p ec-av1 --lib -- a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact a_real_aomenc_10bit_stream_with_a_32_level_ab_partition_decodes_pixel_exact refusal_inventory gate_coverage` | | |
| 58 | +recipe reverted, rebuilt, re-run | **ok — 14 passed, 0 failed**. Class: | |
| 59 | +[[gate-recipe-confound]] / the ledger's "a gate that decodes pixel-exact with counter 0 is an | |
| 60 | +encoder-recipe defect". Swept: those 13 are every 16->32 rewrite in the lane. | |
| 61 | + | |
| 62 | +## TASK C — merges | |
| 63 | + | |
| 64 | +`git merge main` twice: 7a47fc1 (one conflict, `decode.rs`'s skipped-block arm: took main's | |
| 65 | +lane-hgkf per-TU prediction + `true_width` guard + `SKIP_SPLIT_TX_HITS`, broadened its condition | |
| 66 | +from `tx_select && logical_tx < side` to `logical_tx < side` because a 128 block's transform is | |
| 67 | +TX_64X64 with no tx-depth syntax; the counter keeps its narrow `tx_select` meaning), then 18bf7dc | |
| 68 | +(= lane-sb128 5ea5ec8; three conflicts in `stream.rs`, ALL resolved to main's side per the batch | |
| 69 | +coordinator, so main's single seam gate `a_real_aomenc_128x128_superblock_stream_decodes_pixel_exact` | |
| 70 | +survives and lane-oddh's seam refusal stays deleted). `cdf.rs` merged clean; its NZ_MAP and | |
| 71 | +FILTER_INTRA regions are byte-identical to main's (`git diff main -- crates/ec-av1/src/cdf.rs` shows | |
| 72 | +only the four new `TXB_SKIP_CHROMA_32_BIG*` tables). | |
| 73 | + | |
| 74 | +## Suite | |
| 75 | + | |
| 76 | +EVIDENCE: `$HOME/.cache/sb128b-suite-r3.log` (unit `sb128b-suite-r3-1788323779.service`, tip | |
| 77 | +`7ceb309`) | `EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -j3` | | |
| 78 | +**test result: ok. 371 passed; 0 failed; 32 ignored; 473.61s** — GREEN. | |
| 79 | + | |
| 80 | +## ReelC key frame | |
| 81 | + | |
| 82 | +EVIDENCE: `$HOME/.cache/sb128b-work/{reelckf0.obu,reelcours.yuv.f0.yuv,ref.yuv}` | r2's recipe | |
| 83 | +(`ffmpeg -t 2 -c:v copy -f obu` off the film, 1920x792 yuv420p10le), `dump_yuv` under a 6G scope vs | |
| 84 | +ffmpeg's rawvideo | **`cmp` says BYTES EQUAL — 4 561 920 bytes, 0 differing samples.** | |
| 85 | + | |
| 86 | +Film probe on the 2 s cut (`decode_probe reelc2s.obu`) still stops at | |
| 87 | +`an inter frame under a 128x128 superblock (this decoder's inter tile path recurses a 64x64 | |
| 88 | +superblock root only)` — main 18bf7dc (lane-sb128 5ea5ec8) did NOT lift this one on this tree. | |
| 89 | + | |
| 90 | +## Open residue | |
| 91 | + | |
| 92 | +- deferred: `a 128x128 superblock HORZ/VERT or AB partition` — not started; every 128 root in the | |
| 93 | + four gate arms resolves NONE or SPLIT, so nothing here is measured. Unblocked by an aomenc recipe | |
| 94 | + that actually emits a 128-level HORZ/VERT (r2's seed-42 "HORZ/VERT at 128" sighting was our own | |
| 95 | + desync talking — class [[refusal-from-own-desync]]: with the entropy fixed, that same stream | |
| 96 | + reads nine NONE roots). | |
| 97 | +- deferred: `a 128x128 superblock PARTITION_NONE root on an inter frame` and | |
| 98 | + `an inter frame under a 128x128 superblock` (the ReelC blocker) — inter path untouched this round; | |
| 99 | + unblocked by the inter tile path recursing a 128 root. | |
| 100 | +- deferred: the `--enable-tx-size-search=1` arm at 128 (a read tx_depth under a 128 NONE root) — | |
| 101 | + the four arms all pin `=0`; unblocked now that the NONE arm is exact, so it is a one-arm follow-up. |