# lane-sb128 r1 — 128x128 superblocks, key frames Branch `lane-sb128` off main `a59645c`, worktree `edith_codecs-sb128`. ## Film first (the ReelC blocker) `reelc5.obu` (1.1 MB, 1920x792 yuv420p10le, `use_128x128_superblock=1`) now decodes the 128 superblock root and stops at a NAMED, unrelated refusal instead of desyncing: EVIDENCE: /tmp/claude-1000/.../cdc46329-.../scratchpad/reelc5.obu | `decode_probe reelc5.obu` after this round | `REFUSED: unsupported: AV1 tile (a HORZ/VERT intra strip below 16x16 with a split transform (per-unit rect prediction is not ported))` — a sub-16 intra-strip gap owned by another lane, reached deep inside the tile (78 frame headers parsed, single tile). Not measured: the exact pre-change refusal string on this same file (no baseline binary was built before the patch landed). deferred: film pixel compare — the stream still refuses, so there is no frame to `cmp` — unblocked by the sub-16 split-transform strip lane. ## What changed - `crates/ec-av1/src/decode.rs` - `SB128` thread-local + `set_sb128` (also sets `Reach`'s superblock size), `sb_mi_cur()`. - `sb_visit_order()`: at sb128 the tile walks each 128x128 superblock's four 64x64 quadrants (TL, TR, BL, BR) before the next superblock — libaom `decode_partition`'s recursion order, not raster over 64x64 superblocks. - key-frame tile loop: per 128 superblock, one `read_lr` over the whole 128x128 and one `partition_w128` symbol (8-symbol alphabet, no HORZ_4/VERT_4 at BLOCK_128X128; forced-split gather `gather_of` + `VERT_ALIKE128`/`HORZ_ALIKE128` at the frame edge). SPLIT recurses into the existing 64 path; the other seven arms refuse by name. - `maybe_read_delta_q` / `maybe_read_delta_lf` key off `sb_mi_cur()` (once per 128x128, not four times), and `is_whole_sb` is ignored at sb128 (no leaf can be a whole 128 superblock). - `NO_NEIGHBOUR_SIDE = 128` replaces `SB` as the partition-context sentinel — ROOT CAUSE 1. - intrabc under sb128 refuses by name (`av1_is_dv_valid`'s delay is sb_size-derived). - `crates/ec-av1/src/encode.rs`: `Reach`'s `has_top_right`/`has_bottom_left` masked the block position with a hardcoded 64 superblock; now `reach_sb_px()` (64 or 128) — ROOT CAUSE 2. The tables themselves were already 128-relative (`table_stride`), only the masks were wrong. - `crates/ec-av1/src/cdf.rs` / `cdf_state.rs`: `PARTITION_W128` (entropymode.c:154's four `AOM_CDF8` rows), stored, reset per frame like `partition_w64`. - `crates/ec-av1/src/stream.rs`: `set_sb128` per frame, scoped inter refusal, two gates. - `crates/ec-av1/src/refusal_inventory.rs`: the three new refusals listed. Two defects found and fixed, both invisible at 64: 1. the no-neighbour partition-context sentinel (64) set the ctx bit at the 128 root — our ctx was 3 where aomdec printed `ctx=16` (= `bsl*4 + 0`, row 0). Identical at every level <= 64, so no existing gate could see it. 2. `has_top_right`/`has_bottom_left` answered against a 64 superblock — a bounded 1391-luma-pixel band (x 124..255, y 44..67) with the entropy stream still in sync. ## Gates `a_real_aomenc_stream_with_128x128_superblocks_decodes_pixel_exact` — real `aomenc --sb-size=128 --max-partition-size=64`, 6 arms (256x192 seeds 42/43/44 8-bit, 384x384 8-bit, 256x192 10-bit, 384x384 10-bit), sequence header asserted `use_128x128_superblock == true` at the arm's bit depth, every frame Y/U/V vs ffmpeg, hard asserts on `part128_symbols`/`part128_split_hits`. No SKIP except a missing tool. EVIDENCE: `cargo test -p ec-av1 --lib 128x128 -- --nocapture` | 6 aomenc encodes decoded and compared plane-by-plane | `6 pixel-exact, 0 named refusals, part128_symbols=26 part128_split_hits=34`; `a_real_aomenc_128x128_inter_stream_refuses_by_name ... ok`. EVIDENCE: scratchpad/sb128/{ref128.yuv,our128.yuv} | seed 44 encoded at `--sb-size=128` and `--sb-size=64`, both decoded through `decode_probe` and `cmp`ed against `ffmpeg -f rawvideo -pix_fmt yuv420p` | before the two fixes: sb64 EXACT / sb128 DIFF at byte 1 (ctx defect) then at byte 11518 (reach defect); after: `seed44 sb128 EXACT`. ## Refused by name (still), each with its string - `a 128x128 superblock partition other than SPLIT (NONE/HORZ/VERT and the four AB arms at the 128 root are not decoded)` — the six 128-level non-SPLIT arms + a 128x128 leaf. The gate pins `--max-partition-size=64` so the encoder never chooses them. deferred: 128-level NONE/HORZ/VERT (a 128x128 block is 2x2 TX_64X64 luma + 2x2 TX_32X32 chroma; `decode_block` codes ONE luma TU per block outside the `tx_select` multi-TU branch and one chroma TU always) — unblocked by a multi-TU chroma path in `decode_block`. - `an inter frame under a 128x128 superblock (this decoder's inter tile path recurses a 64x64 superblock root only)` — scoped to frames > 64x64 (a <=64x64 frame's 128 root reads no symbol). deferred: inter at 128 — the second `for sb_r/sb_c` loop in `decode.rs` (~line 17800) plus OBMC and mvstack neighbour caps — unblocked by porting `sb_visit_order` + the 128 prologue there. - `intrabc under a 128x128 superblock (...)` — accepted for this round. ## Suite `cargo test -p ec-av1 --lib` (systemd unit, log `$HOME/.cache/sb128-suite.log`): see the tail appended below by the run. ``` test result: ok. 350 passed; 0 failed; 31 ignored; 0 measured; 0 filtered out; finished in 313.69s ``` (31 ignored = the pre-existing ignore list, unchanged by this lane.)