# lane-sb128c r4 -> r5 handoff Tip `lane-sb128c` (worktree `edith_codecs-sb128c`, `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sb128c`). Detail: `lanes/sb128c-r4.report.md` (written before the uv-cap correction below -- this file supersedes its fix description). ## (0) r3 suite result line `sb128c-suite-r3-1788327685.service`, `$HOME/.cache/sb128c-suite-r3.log`: `test result: FAILED. 371 passed; 1 failed; 32 ignored; 0 measured; 0 filtered out; finished in 797.36s` The single failure was r3's own known-RED gate. ## (1) The x=64 deblock band -- ROOT CAUSE, FIXED Stage bisection (aomdec rungs, decode order) on `$HOME/.cache/sb128c-work/g-61-8-0.obu`: decode-order frames 0..4 pre-filter EXACT, frame 4 post-deblock WRONG (98 luma px in a 9-px band at x=64, 274 chroma) => loop filter, not a symbol. Decisive: aomdec's own post-deblock dump changes ZERO pixels in luma cols 50..78 of that frame; ours changed 98 (peak 26 at col 63). libaom filters that edge not at all. libaom `av1/common/av1_loopfilter.c`, `set_one_param_for_line_luma` (~line 690) and `set_one_param_for_line_chroma`: ```c const int32_t pu_edge = mi_prev != mbmi; if (!pu_edge) curr_skipped = mbmi->skip_txfm && is_inter_block(mbmi); if ((pu_edge || !curr_skipped) && level) { params->filter_length = ...; } ``` `get_transform_size` still reports TX_64X64 (luma) / TX_32X32 (chroma) for a SKIP 128x128 INTER block, so the TU edge at x=64 / y=64 exists -- it is suppressed because it is not a PU edge and the block is skipped. Every 128 block in the gate stream is `is_inter=1 skip=1`. GRID WRITE (`crates/ec-av1/src/decode.rs`), final shape: - the per-leaf `fill_lf_grid_rect` loop in `decode_inter_block` is gated on `!(skip && is_inter)`, so the block-level publication (`write_w = 128`) stays and no internal LUMA edge exists. The 128 root is the only block reaching that loop skipped (`read_block_tx_size` returns four TX_64X64 leaves for `side > 64` regardless of `skip`; every `side <= 64` skip inter block gets `None`). - new `Neighbours::suppress_internal_lf_edges(at_mi, w_mi, h_mi)` writes the UNCAPPED chroma extent (64 for a 128 block) into `uv_tx_grid`/`uv_tx_h_grid`, called ONLY from the `skip && is_inter` branch of `decode_inter_block`. - `dump_stage` now indexes its file per decode-order picture (`EC_AV1_POSTDEBLOCK_DUMP` overwrote `.f0` every frame, so only the last picture was comparable against aomdec's indexed rung). This is the instrument that found the defect. ## (1b) THE UV-CAP TRAP (cost one suite run; do not repeat) My first fix instead removed the `.min(32)` TX_32X32 cap inside `fill_lf_grid_rect` outright, reasoning it was inert for every block up to 64 wide. It is inert only for the INTER path. libaom's `curr_skipped` term contains `is_inter_block(mbmi)`, so an INTRA 128x128 block's internal chroma TU edges (every 32 chroma px, `av1_get_max_uv_txsize(BLOCK_128X128) == TX_32X32`) ARE filtered. Removing the cap broke the sibling gate `a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact` (caught mid-suite at 293/404). The cap is restored; suppression is now explicit and inter-only. Both gates re-run together after the correction: `key_frame_with_a_128x128_none_partition ... ok`, inter gate now fails one frame LATER (see below). Class: `fix-trades-sibling-gate`. ## (1c) cdef_idx per 64x64 quadrant -- the r4 charter's suspicion is WRONG `read_cdef` (`av1/decoder/decodemv.c`) reads at most ONE literal per CALL and is called once per BLOCK. A `PARTITION_NONE` 128 root is one block, so exactly ONE `cdef_idx` symbol is read (`index = cdef_unit_col_in_sb + 2*cdef_unit_row_in_sb` = 0 at the SB origin) and stored in the block's own `MB_MODE_INFO`, which all four 64x64 CDEF units point at. r1's "replicated over 4 quadrants" is CORRECT; no change was made. Four symbols are read only when the root SPLITs into four non-skip 64s -- and for a 128-level HORZ/VERT root there are TWO blocks, hence up to TWO literals: re-derive the index from that function, do not assume. ## GATE STATES - `a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact` -- **GREEN** - `a_real_aomenc_inter_128x128_none_root_decodes_pixel_exact` -- **RED**, advanced from `decode-order frame 4 of 9` (deblock) to `decode-order frame 5 of 9` (reconstruction): `differs at byte 32264 (ours 140 vs 141), 24858 bytes differ`. - Full suite r4: NOT COMPLETED -- I stopped `sb128c-suite-r4-1788328542.service` at 293/404 to apply the uv-cap correction. It had exactly two failures, both named above; the key-frame one is now fixed. r5 must run a fresh full suite. ## EXACT NEXT STEP (r5's first job) Decode-order frame 5 of `$HOME/.cache/sb128c-work/g-61-8-0.obu` is wrong ALREADY AT PRE-FILTER, and every reference it uses is now exact at every stage (pre-filter, post-deblock and `EC_AV1_FINAL_DUMP` incl. the hidden frame, frames 0..4 all zero-diff). So this is a genuine reconstruction defect, not propagation. ``` frame 5 pre-filter Y: 19609 px, rows 128..255, cols 0..255, maxd 33, first bad (128,0) frame 5 pre-filter C: 5207 px per-64x64 quadrant Y: [0,0,0,0] [0,0,0,0] [3707,844,3137,3889] [183,177,3844,3828] ``` The whole BOTTOM superblock row (both 128x128 SBs); rows 0..127 exact. Our mode trace lists that row as two `side=128 is_inter=1 skip=1` blocks -- pure motion compensation. Entropy stays in sync for all 9 frames (no refusal, no desync). The quadrant diff is content-dependent (flat quadrants mostly match, detailed ones do not) = a slightly wrong PREDICTOR, not a wrong write geometry. Frame 4's own `(32,0)` 128 skip block is exact, so 128-wide MC itself works. Suspects in order: the block's mv (mv-stack / GLOBALMV resolution), `ref_frame`, `switchable_interp`, `motion_mode`/OBMC at 128x128. Reproduce: ``` cd $HOME/.cache/sb128c-work && rm -f pf-o.f* pf-m.f* systemd-run --user --scope -q -p MemoryMax=6G env EC_AV1_PREFILT_DUMP=$PWD/pf-o \ ~/.cache/aom-oracle/build/aomdec --rawvideo -o /dev/null g-61-8-0.obu systemd-run --user --scope -q -p MemoryMax=6G env EC_NOMEMGUARD=1 EC_AV1_PREFILT_DUMP=$PWD/pf-m \ $HOME/.cache/cargo-target-sb128c/debug/examples/decode_probe g-61-8-0.obu # 256x256 yuv420p8, pf-o.fN vs pf-m.fN ``` Oracle rungs: `EC_AV1_PREFILT_DUMP`, `EC_AV1_POSTDEBLOCK_DUMP`, `EC_AV1_FINAL_DUMP` (all indexed, decode order, hidden frames included), `EC_TRACE_MODE` (`EC_MODE_MV`/`EC_MODE_VAL` carry mode/ref0/ref1/mv0/stack/rng -- only 62 lines on this stream and NONE in the failing bottom SB row, so a skip block's mv needs `EC_PRED`/`EC_PREDOUT` or a new rung). NOTE (ledger constraint): our `EC_AV1_POSTDEBLOCK_DUMP` site runs AFTER `apply_cdef` on the inter path -- pair it with `EC_AV1_DEBUG_SKIP_CDEF=1` or a CDEF defect reads as a deblock defect. ## (3) 128-level HORZ/VERT + AB -- NOT STARTED deferred: 128x64 / 64x128 and AB at the 128 root, key and inter paths -- r4's budget went to the stage bisection and the uv-cap correction; unblocked by nothing. Both ReelC extracts (`$HOME/.cache/sb128c-work/reelc2s.obu` and `$HOME/.cache/reelc-head.obu`, 1428 B, `use_128x128_superblock=true bit_depth=10`) still stop at `a 128x128 superblock HORZ/VERT or AB partition (only SPLIT and NONE are decoded at the 128 root)`, `EC_AV1_FINAL_DUMP` count 1 -- and that one frame is BYTE-IDENTICAL to ffmpeg's `yuv420p10le` decode (4561920 B, `cmp` clean).