# lane-inter4 r3 — the 16x16-level rectangular INTER leaf Branch `lane-inter4`, worktree `/home/user/Documents/Code/Rust/edith_codecs-inter4`, off r2's `d2d7327` (main `11633d7`). No rebase needed (main unchanged since r2). ## What shipped (commit `d913935`) The refusal r2 named as the reach blocker is gone: `PARTITION_HORZ`/`PARTITION_VERT` at 16x16 on an inter frame now decodes two 16x8 / 8x16 inter blocks. - `crates/ec-av1/src/decode.rs` (16-level partition site, ~17930): the HORZ/VERT arms. `side = SUB` keeps every CDF / prediction-buffer decision square (the corner-cut the 32-level rect arm already ships), `write_w`/`write_h` carry the true 16x8 / 8x16 footprint into the mv stack, the motion-mode row, the neighbour stamps and the rect residual path. AB / 1:4 at 16 refuse by name. - `rect_inter_residual_supported` + `rect_inter_luma_set` / `rect_inter_chroma_set` (decode.rs ~9020): 16x8/8x16 joins 32x16/16x32; the residual call sites pick the TxbSet from the block's TRUE shape instead of the hard-coded 32x16 pair. - `TxbSet::LumaRect16x8Inter` / `LumaRect16x8InterSet1` (cdf_state.rs): `LumaRect16x8`'s coefficient tables with the INTER `tx_type` alphabet. `av1_get_ext_tx_set_type(TX_16X8, is_inter=1, reduced)` = `EXT_TX_SET_DCT_IDTX` reduced, `EXT_TX_SET_ALL16` otherwise (`tx_size_sqr == TX_8X8`, not TX_16X16), both at the **TX_8X8** CDF row -- i.e. the existing `inter_tx_type_8` / `inter_tx_type_8_set1` tables, no new CDF and no new counter-reset entry. **r2's report was wrong here** (it predicted the 12-symbol `default_inter_ext_tx_cdf[2][TX_8X8]`); checked against `blockd.h:1092-1122` + `av1_num_ext_tx_set = {1,2,5,7,12,16}` in the oracle tree. - **Defect found in shipped code (class: table narrowed to the reachable sizes):** `eob_pt_128_luma_class1` and `eob_pt_32_chroma_class1` did not exist, so `LumaRect16x8`/`LumaRect16x8Set1` (the INTRA rect leaf, already shipping) and `ChromaRect8x4` fell back to the 2D `eob_pt` alphabet for `V_DCT`/`H_DCT` units. Added from `token_cdfs.h:792-848` (plane 0 / plane 1, class index 1), wired into all four `LumaRect16x8*` sets, `ChromaRect8x4`, and the per-frame `reset1` list. - **Second defect in shipped code:** `obmc_blend`'s `max_nb` closure was `1..=4 => 2`, while libaom's `max_neighbor_obmc[] = {0,1,2,3,4,4}` indexed by `mi_size_{wide,high}_log2` gives 0 for 1 mi and 1 for 2 mi. Only a block under 16 px on that axis can expose it -- i.e. exactly this round's leaves. - `size_group_wh` (decode.rs): `y_mode` (intra block in an inter frame) and the `interintra` / `interintra_mode` rows now come from `size_group_lookup[bsize]` of the block's TRUE footprint. The 32-level rect strips were reading the square row (3 where libaom says 2); a 16x8 leaf would have read 2 where libaom says 1. Deviation from charter: not requested, but it is the same defect shape and one helper covers every caller. - `MOTION_MODE` / `OBMC` CDFs extended from 12 to 14 packed rows with libaom's `BLOCK_8X16` (index 4) and `BLOCK_16X8` (index 5) entries. ## Gate — GREEN `a_real_aomenc_inter_sequence_with_a_16_level_rect_leaf_decodes_pixel_exact` (stream.rs): 16 attempts x {2 axis-structured sources, 2 quantisers, 2 `--enable-tx-size-search` arms, 2 motion steps} x {8-bit, 10-bit}, 192x128, 6 frames, `--enable-rect-partitions=1 --enable-ab-partitions=0 --enable-1to4-partitions=0 --min-partition-size=8 --max-partition-size=16 --enable-obmc=0`, per-arm overrides LAST. Every decoded frame compared Y/U/V vs ffmpeg; a refusal is counted, never SKIPped; an attempt carrying no 16-level rect leaf is still required pixel-exact (`oos_mismatch == 0`). Hard asserts: a pixel-exact attempt carrying a 16x8 leaf AND one carrying an 8x16 leaf, per bit depth, plus at least one coded (non-skip) rectangular inter transform unit across the two depths. cargo test -p ec-av1 --lib 16_level_rect_leaf -- --nocapture EVIDENCE: $HOME/.cache/inter4-suite-r3.log (gate line) | 32 aomenc encodes, decode + ffmpeg Y/U/V compare of every frame | 8-bit: 6 refusals, 5 pixel-exact leaf-carrying attempts, 16x8=3, 8x16=2, coded rect TUs=2, 0 mismatches; 10-bit: 2 refusals, 4 leaf-carrying attempts, 16x8=2, 8x16=3, 0 mismatches ## Refusals Lifted: `"an inter partition below 16x16 other than SPLIT (16x8/8x16 rect inter leaves are not coded yet)"`. Added (both in `refusal_inventory.rs`, both named, both narrow): - `"an inter 16x16-level AB or 1:4 partition (HORZ_A/HORZ_B/VERT_A/VERT_B/HORZ_4/VERT_4; ...)"` - `"OBMC on a 16x8/8x16 inter leaf (blend mismatches the reference on this shape)"` ## The OBMC residue (open, instrumented) With `--enable-obmc=1` and everything else identical, attempt 10 (8-bit, cq 22, tx-size-search off) decodes all 6 frames but frame 5 has **5302 luma pixels wrong, max |delta| 84, first at (176,0)**; frames 0-4 are exact. The same recipe with `--enable-obmc=0` decodes 5 leaf-carrying attempts pixel-exact, and a run with obmc/warp/interintra/masked-compound ALL off is also exact -- re-enabling obmc alone reproduces it, so warp, interintra and masked compound are exonerated for this shape. The blend geometry in `obmc_blend` was checked element by element against libaom `build_obmc_inter_pred_above`/`_left` and `av1_skip_u4x4_pred_in_obmc` and matches for these shapes; `max_neighbor_obmc` was wrong and is fixed, but the fix left the mismatch byte-identical, so the cause is upstream of the blend (the neighbour walk's `size`/`size_h` stamps for a rect leaf, or `has_top_right`, whose doc still says "no rectangular partition ever produces an inter leaf here"). Refused by name rather than shipped. EVIDENCE: gate run with `--enable-obmc=1` | same 16 attempts, decode + ffmpeg compare | attempt 10 frame 5: 5302 luma pixels differ, max |delta| 84; with `--enable-obmc=0`: 0 mismatches over 5 leaf-carrying attempts ## Suite $HOME/.cache/inter4-suite-r3.log (systemd user unit inter4-suite-1788315557) test result: ok. 324 passed; 0 failed; 31 ignored; finished in 412.37s Same 323 as r2's baseline plus this round's new gate; the one ignored addition is still r2's own 32x16/16x32 gate. Sibling gates inside that run: every `inter_sequence*`, `8x8_leaf_split`, `tx_select`, `superblock_level_rect_partition`, `obmc`, `warp`, `globalmv`, `force_integer_mv`, `refusal_inventory`, `gate_coverage` -- all green, including the ones that read the tables this round touched (`MOTION_MODE`/`OBMC` rows, `LumaRect16x8*`, `ChromaRect8x4`). EVIDENCE: $HOME/.cache/inter4-suite-r3.log | ec-av1 --lib under a systemd user unit at d913935 | 324 passed / 0 failed / 31 ignored ## Residue - **fix-now (r4): OBMC on a 16x8/8x16 leaf** -- named refusal today. Next step is `has_top_right` for rect inter blocks (libaom's `xd->width < xd->height` / `> ` / `PARTITION_VERT_A` branches are dropped in our copy) and the `overlappable_above/left` step caps (`AOMMIN(xd->width, mi_size_wide[nb])`). - **deferred: r2's 32x16/16x32 gate** (`..._with_a_coded_rectangular_residual_...`) -- still `#[ignore]`d; not re-measured this round (budget). With the 16-level leaves reachable it may now get past its first rect strip; unblocked by simply re-running it, which r4 should do before anything else. - **deferred: 16x16 SPLIT under this recipe** -- the gate counts `16x16 SPLITs=0` on every attempt (aomenc picks NONE/HORZ/VERT at 16 here); the 8x8-leaf path is gated by its own sibling test, so the count is printed, not asserted. - **accepted: the 10-bit arm proves no residual** -- every 10-bit rect leaf in this recipe is `skip` at cq 34/22, and cq 30/26 or 24/12 stops reaching a rect leaf at all (measured). The residual half is asserted across both depths. - **accepted: `_size_group` is now a dead parameter** of `decode_inter_block` (superseded by `size_group_wh`), kept rather than editing twenty call sites.