# lane-ab16 r1 — the four AB partitions at 16x16, arm by arm Branch `lane-ab16`, off `lane-rectx` `fad4d5a`. ## What changed - `crates/ec-av1/src/decode.rs` ~7140: the 16x16-level `PARTITION_HORZ_A/_B/VERT_A/_B` arms (replacing the old VERT_B-only arm and the "codes only the square arms" refusal). libaom `decode_partition` visit order: HORZ_A = TL 8x8, TR 8x8, bottom 16x8; HORZ_B = top 16x8, BL, BR; VERT_A = TL, BL, right 8x16; VERT_B = left 8x16, TR, BR. Squares go through `decode_leaf8`, strips through `decode_leaf_rect` (lane-rectx's real non-skip 16x8/8x16 coefficient path — the old VERT_B arm used `decode_block_rect`, which refuses non-skip at this size). `write_back_split_modes` for the coarse slot; mi-granular records come from the two leaf writers. VERT_A/_B take `Reach::vert_ab_partition()` (TL,BL,TR,BR visit order). - `crates/ec-av1/src/decode.rs` ~7395: the surviving refusal is narrowed to the 1:4 case, `"a 1:4 partition below 16x16 (PARTITION_HORZ_4/VERT_4 ...)"`. The arm test is `(PARTITION_HORZ_A..=PARTITION_VERT_B).contains(&part16)` — values 8/9 must NOT fall into it. - `crates/ec-av1/src/decode.rs` ~3401: `decode_block_rect`'s `"a coded (non-skip) HORZ_B/VERT_B rect strip below 16x16"` branch deleted — every remaining call site passes 32x16 or 16x32, so it was dead once VERT_B moved to `decode_leaf_rect`. - `crates/ec-av1/src/decode.rs` ~430: `AB16_HITS: [usize; 4]` + `ab16_hits_by_arm()`. - **Coordinator-reported base defects, fixed here too** (same hunks are being made on lane-sub8 r6 / lane-rectx r5 — semantically identical, keep either at merge): - `mode_above_mi`/`mode_left_mi` guard with `> self.tile_row0_mi` / `> self.tile_col0_mi` instead of `> 0`, and the mi-exact mode maps are reset in `start_tile` (col span) and `start_row` (`decode.rs` ~2037/~2304/~2581). - `encode.rs` `top_right_rect`/`bottom_left_rect` index with `blk_row << (5 - bw_log2)` (libaom `MAX_MIB_SIZE_LOG2`), not 4. - `crates/ec-av1/src/encode.rs`: lane-part32 `fd1a2eb`'s encode half cherry-picked (`HAS_TOP_RIGHT_VERT`/`HAS_BOTTOM_LEFT_VERT`, `VERT_AB_PARTITION`, `VertAbGuard`, `Reach::vert_ab_partition()`). Their decode.rs/stream.rs halves were NOT taken (they depend on part32's own 32-level AB arms and counters) — a merge of both branches touches the same two `top_right`/`bottom_left` table-pick hunks. - `crates/ec-av1/src/stream.rs` ~5460: the gate. `crates/ec-av1/src/refusal_inventory.rs`: one refusal deleted, one narrowed. `gate_coverage.rs` needed no edit (`--enable-ab-partitions` is now positively exercised and was never on a NEVER_EXERCISED list; this base has no `NEVER_EXERCISED_10BIT` list — that is on main `79d4f16`, so the merge must delete the AB entry there if present). ## Gate `a_real_aomenc_stream_with_ab_partitions_below_16x16_decodes_pixel_exact`, 6 real-aomenc streams (`--enable-ab-partitions=1 --enable-rect-partitions=1 --min-partition-size=8 --max-partition-size=16`, reproducibility-checked, per-arm counter sampled per attempt and summed only over attempts that decoded AND compared, each arm hard-asserted `> 0`). ``` CARGO_TARGET_DIR=$HOME/.cache/cargo-target-ab16 EC_AV1_REQUIRE_AOMENC=1 \ cargo test -p ec-av1 --lib -- ab_partitions_below_16x16 --nocapture ``` EVIDENCE: gate stdout | 6 aomenc streams (yuvtestsrc cq22 8b, rgbtestsrc cq20/cq50 8b, mandelbrot start_x=-1.0 cq14 8b, yuvtestsrc cq30 10b, mandelbrot start_x=0.4 cq30 10b), each decoded and compared plane-by-plane against ffmpeg | `pixel-exact on 6 streams, ab16 arms(HORZ_A,HORZ_B,VERT_A,VERT_B)=[2, 1, 2, 1]`, `test result: ok. 1 passed`. EVIDENCE: /tmp/.../scratchpad/{c30.obu,po30.f0,pa30.f0} | instrumented aomdec `EC_TRACE_MODE` vs our `EC_TRACE_MODE_STEP` on a 4-arm stream | every mode/uv_mode value AND msac range match (52624 / 55900 / 38256 / 35312 / 59042 / 54968 / 64576) — the AB arms are entropy-exact; the residual mismatch in that stream starts at luma (40,9), inside a plain SPLIT 8x8 leaf with `mode=9` (SMOOTH), i.e. reconstruction, not desync, and not an AB block. Scoped run after the fixes: `-- ab_partitions_below_16x16 refusal_inventory gate_coverage coded_rect_strip` → `7 passed; 0 failed`. ## Refusals - LIFTED `"a HORZ_A/HORZ_B/VERT_A partition below 16x16 ..."` → replaced by the 1:4-only string. HORZ_A/HORZ_B/VERT_A/VERT_B at 16x16 are real-stream-proven above. - LIFTED `"a coded (non-skip) HORZ_B/VERT_B rect strip below 16x16 ..."` (branch deleted; the gate's HORZ_B/VERT_B strips run the real coefficient path). ## Open residue - **fix-now(not this lane): full-suite gate `a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact` FAILS on this branch.** It is not any of this lane's three change groups: it still fails with the mi-map/tile hunks reverted, and with the `5 - bw_log2` fix reverted, and the AB arms never run in it (SB-level partitions). It is therefore pre-existing on `lane-rectx fad4d5a` or comes from the part32 `encode.rs` cherry-pick. Not re-measured on the base commit (turn cap) — the orchestrator should reconcile with lane-rectx r5 / lane-part32. - deferred(base chroma/SMOOTH prediction defect — a lane of its own): at `--max-partition-size=16` most cells of a ~200-cell sweep decode to completion but mismatch, first error always in a plain (non-AB) 8x8 SPLIT leaf, luma-exact-then-chroma-off or SMOOTH-mode luma. Reproducer: `mandelbrot=size=64x64:start_x=-0.6 cq30`, recipe as the gate. - deferred(base tile defect): the charter's `--tile-columns=1` arm is NOT in the gate. Reproducer: `mandelbrot=size=96x96:start_x=-0.6 cq32 --tile-columns=1`, same recipe → 491 luma diffs at x=32..63,y=80..95 (last SB of tile 0); the failing superblock's partitions are `value=0` (NONE) and `value=2` (VERT), no AB symbol, and this survives the mi-map tile fixes above. - accepted: 10-bit proves HORZ_A + VERT_A only; the 10-bit HORZ_B/VERT_B cells of the sweep all trip the base chroma defect above. - deferred(turn cap): full `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib` totals — the run was SIGTERMed by the memguard runner partway (one FAILED test observed, the SB-level one above; the AB gate passed inside that same run).