# lane-sb128c r8 -- the INTRA (key-frame) 128x64 / 64x128 block Branch `lane-sb128c`, worktree `edith_codecs-sb128c`, `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sb128c`. ## What changed - `crates/ec-av1/src/decode.rs:10101` `decode_block_128rect` (NEW): a rect intra block at the 128 root. libaom `decode_block` -> `predict_and_reconstruct_intra_block` per transform unit, with the 128 geometry: `max_txsize_rect_lookup[BLOCK_128X64] == TX_64X64` so every luma unit is SQUARE and there are >= two (depth 0: 64x64 x2, 1: 32x32 x8, 2: 16x16 x32 -- `bsize_to_tx_size_cat` counts the `sub_tx_size_map` chain TX_64X64->32->16->8->4, i.e. cat 3, the CDF a 64x64 square block reads); `av1_get_max_uv_txsize` = `av1_get_adjusted_tx_size( max_txsize_rect_lookup[BLOCK_64X32])` caps at TX_32X32, so the 64x32 uv plane block is TWO 32x32 chroma units per plane, one per 64x64 "mu" chunk, Y then U then V inside each chunk (`decode_token_recon_block`); `get_txb_ctx` puts chroma on the offset-10 rows (uv plane block > uv tx). Mode info goes through `read_intra_mode_rect` with `cfl = false` (`is_cfl_allowed` caps at 32x32); filter intra and palette do not exist at this size (`av1_filter_intra_allowed_bsize` 32x32, `palette_bsize_ctx_wh` returns `None` above 64) and are refused by name if one ever appears. Per-TU edge availability through `tu_reach` (`has_top_right` false for a block whose long side is > 64, via `Reach::of_rect`); lf/skip grids stamped with the resolved unit size. - `crates/ec-av1/src/decode.rs:14027` key-frame path: the 128 root's HORZ/VERT arm is no longer refused. It decodes `BLOCK_128X64` at (mi_row, mi_col) plus a second at (mi_row + 16, mi_col) only `if (mi_row + hbs < mi_rows)` (VERT mirrors it on the column, libaom `decode_partition` decodeframe.c:1554), each half reading its OWN `cdef_idx` literal, fanned out over the 64x64 CDEF units it covers. - `crates/ec-av1/src/decode.rs:9346` / `:9247` `PlaneBuf::reconstruct` + `reconstruct_rect`: bottom/right frame-edge CLIP. ROOT CAUSE of two `index out of bounds` panics on the 1080p film's key frames (len 1536000, index 1536000/1536384): our frame buffer is padded to 32 (`block_grid`) while libaom's is superblock aligned, so a 64x64 unit of a 128x64 block at y=768 of a 792-row frame wants 832 rows of an 800-row buffer. Those samples are outside the frame -- never output, never referenced. - `crates/ec-av1/src/stream.rs:95` `intra_sb128_counters()`, `crates/ec-av1/src/decode.rs:10101` `INTRA_SB128_{HORZ,VERT,DEPTH}_HITS`. - `crates/ec-av1/src/refusal_inventory.rs:48`: the intra-128x64 refusal is REPLACED by the defensive CfL/filter-intra/palette one. ## Gate (GREEN) `cargo test -p ec-av1 --lib intra_rect_block -- --nocapture` (`a_real_aomenc_sb128_intra_rect_block_decodes_pixel_exact`): 5 real aomenc streams, `--sb-size=128 --cpu-used=0 --min-partition-size=64 --enable-rect-partitions=1 --kf-max-dist=1`, every decode-order frame compared against the instrumented aomdec, hard asserts on the HORZ counter, the VERT counter and depth[0]. arm 42 cq55 384x320 8bit HORZ txsearch=0: 5 frames exact, 128x64 +28 depth [28,0,0] arm 43 cq32 384x320 10bit HORZ txsearch=1: 5 frames exact, 128x64 +30 depth [30,0,0] arm 44 cq8 256x192 8bit HORZ txsearch=1: 5 frames exact, 128x64 +14 depth [14,0,0] arm 46 cq55 192x256 8bit VERT txsearch=0: 5 frames exact, 64x128 +10 depth [10,0,0] arm 45 cq45 192x256 10bit VERT txsearch=1: 5 frames exact, 64x128 +10 depth [10,0,0] test result: ok. 1 passed; 0 failed Sources are `geq` long-period sinusoids, NOT lavfi `gradients`: gradients ignores its seed and gave a different picture every run (one arm passed and then failed with an unchanged decoder -- the flake was the fixture). EVIDENCE: $HOME/.cache/sb128c-gate-r8.log | cargo test -p ec-av1 --lib intra_rect_block --nocapture | 5/5 arms 5 frames each pixel-exact vs aomdec, 96 intra 128-rect blocks, 0 out of scope Sibling gate re-run GREEN (COMMON's SIBLING GATES rule): `gathered_edge_horz` 4/4 arms pixel-exact, edge +2/+24/+2/+2. ## Film (1080p 10-bit AV1, 4 extracts) | extract | r7 | r8 | edge_horz | inter_128x64 | |---|---|---|---|---| | 2 s head (1920x792) | OK 48/48 | **OK, 49/49 dumps bit-exact vs aomdec** | 720 | 720 | | `~/.cache/reelc-head.obu` | OK 48/48 | OK, decodes to completion | 720 | 720 | | `-ss 8100` 2 s | stopped: split intra strip TU 32x64 | PANICKED with the arm live, now stops at "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding" | 1 | 0 | | `-ss 9000` 2 s | stopped: non-skip rect strip | now stops DEEPER, at "an inter SB-level AB partition" | 12 | 0 | EVIDENCE: $HOME/.cache/sb128c-r8/d2 vs $HOME/.cache/sb128c-r7/o2 | EC_AV1_FINAL_DUMP decode_probe head2s.obu, cmp per frame | dumps_compared=49 frames_differing=0 The two panics the r8 arm exposed on the film are the frame-edge clip above; without it this round would have shipped a crash on his own film. ## AB shapes at the 128 root -- MEASURED, still refused 16-attempt sweep (512x512 and 384x320 geq sinusoids x cq 18/32/45/55 x 8+10 bit, `--sb-size=128 --min-partition-size=64 --enable-ab-partitions=1`, `$HOME/.cache/sb128c-r8/ab.sh`): **aomenc DOES pick them** -- 2 of 16 attempts refuse with "a 128x128 superblock AB partition" (512x512 cq18 and cq45, 8-bit), and one more with the inter SB-level AB refusal. So the r7 residue "whether aomenc ever picks them is unmeasured" is now answered YES; they cannot be closed by measurement and need the implementation. ## Suite `cargo test -p ec-av1 --lib` under a systemd unit (MemoryMax=10G): **387 passed; 0 failed; 35 ignored** in 1216 s -- `$HOME/.cache/sb128c-suite-r8.log` (r7 was 386/0/35; +1 is this round's gate). ## Residue - deferred: the four AB shapes at the 128 root (key and inter) -- MEASURED to be reachable (above). Unblocked by this round's `decode_block_128rect` (the 128x64/64x128 piece each AB shape needs) plus the libaom visit order in `lanes/sb128c-r6.handoff.md`; the sweep script pins the recipe that produces one. - deferred: intra `tx_depth` > 0 at the 128 root (32x32 / 16x16 units) is implemented but UNEXERCISED -- every arm, including cq 8 with `--enable-tx-size-search=1`, resolved depth 0. Unblocked by finding an encoder setting that splits a 128x64's transform; the gate prints the per-depth counters so the round that finds one sees it immediately. - accepted: an inter frame of the 192x256 smooth source mismatches at frame 1 (`$HOME/.cache/sb128c-r8/vert46.obu`, byte 12033, 36073 bytes differ). It is NOT this lane's shape: the key frames of that same stream are exact, and the r7 inter gate is green on its own source. Left pinned for a hunter.