# lane-tx64x16 r1 — the 1:4 pair at 64x64 (TX_64X16 / TX_16X64) Branch `lane-tx64x16`, worktree `edith_codecs-tx64x16`, off main `dc5553f`. ## STATUS: INCOMPLETE — gate RED. The refusal is narrowed in the code but NOT proven: a real `PARTITION_VERT_4` stream with coefficients still mismatches. Do not merge as is. ## Premises re-measured (charter carried two stale ones) - "the refusal string now names the 1:4 pair" — FALSE at `dc5553f`. It read *"a superblock-level partition type other than NONE or SPLIT"* (`refusal_inventory.rs:48`) while `decode.rs` already coded HORZ/VERT; the AB arms part32-r5 reports are NOT on main. Command: `grep -n "64" crates/ec-av1/src/refusal_inventory.rs`. - "requires the transform primitives (TX_64X16 / TX_16X64 …)" — FALSE. They already exist: `inverse_transform_2d_typed_wh` (transform.rs:817) is generic in (w,h), already zeroes everything past the low 32 on a 64-length axis (`transform.rs:842`), already gets the rect scale right (fires only at log2 ratio 1, i.e. never for 4:1 — `transform.rs:837`, and its comment already names 16x64/64x16), and `row_shift_wh` (transform.rs:288) already carries `(16,64)|(64,16) => 2` and `(8,32)|(32,8) => 2`, both verified against `av1_inv_txfm_shift_ls` / `inv_shift_64x16` == `{-2,-4}` (`~/.cache/aom-oracle/src/av1/common/av1_inv_txfm2d.c:150`). Dequant is area-keyed (`dq_denom_area`), and `av1_get_tx_scale` is too (1024 pels → 1). Nothing was owed here; the real work was entropy wiring + partition wiring. ## What changed - `crates/ec-av1/src/decode.rs` - `SCAN_32X8` / `SCAN_8X32` (new, ~line 1650): row-major transcriptions of libaom `default_scan_32x8` / `default_scan_8x32`, converted with `row*w+col = (p % h)*w + (p / h)` from libaom's COLUMN-major `p`. The rule was validated by reproducing this repo's existing `SCAN_16X8` byte for byte from `default_scan_16x8` before generating anything new — and libaom's `default_scan_16x8` literal is byte-identical to this repo's `SCAN_8X16`, i.e. a naive copy installs the transpose (class reference-layout-not-spec). - `decode_block_rect64`: luma corner generalised from a hardcoded 32x32 to `(bw.min(32), bh.min(32))`, reading 32x16/16x32 through `read_coeffs_rect` with `SCAN_32X16`/`SCAN_16X32` and `TxbSet::LumaRect32x16`; chroma set/scan picked per shape, 32x8/8x32 reading `TxbSet::Chroma16` with the new scans. Why no new CDF tables are owed, all read out of the oracle source: `av1_get_adjusted_tx_size` maps TX_64X16→TX_32X16, TX_16X64→TX_16X32 (`blockd.h:1361`); `av1_scan_orders` gives TX_64X16 `default_scan_32x16` ("tx32's scan order is used", `scan.c`); `get_txsize_entropy_ctx` is 3 for both TX_64X16 and TX_32X16 and 2 for both TX_32X8 and TX_16X16; `txsize_log2_minus4` is 5 for TX_64X16 *and* TX_32X16, 4 for TX_32X8 *and* TX_16X16 (`common_data.h:346`) so the eob alphabet matches too; and `av1_nz_map_ctx_offset[TX_64X16]` is literally `av1_nz_map_ctx_offset_32x16` (`txb_common.c:340`) — which is what `base_ctx_rect(32,16)` computes, since both raw and coded dims are w>h. - `PARTITION_HORZ_4`/`PARTITION_VERT_4` (8/9) wired at the superblock level: four strips, `quarter_step` = 1 SUB unit, with libaom's `i > 0` frame-edge break. - New per-orientation hit counters `sb_rect4_horz_hits()` / `sb_rect4_vert_hits()`. - `crates/ec-av1/src/refusal_inventory.rs`: SB-level string narrowed to "a superblock-level HORZ_A/HORZ_B/VERT_A/VERT_B partition (… codes NONE, SPLIT, HORZ, VERT and the 1:4 pair at 64x64)". - `crates/ec-av1/src/stream.rs`: new gate `a_real_aomenc_stream_with_a_superblock_level_1to4_partition_decodes_pixel_exact`. - `crates/ec-av1/fixtures/tx64x16-vert4-mismatch-seed73.obu`: the failing stream, pinned. ## Gate `cargo test -p ec-av1 --lib -- --exact stream::tests::a_real_aomenc_stream_with_a_superblock_level_1to4_partition_decodes_pixel_exact` (`EC_TX64X16_GATE_ATTEMPTS`, default 40). aomenc recipe = the sbpart gate's, with `--enable-1to4-partitions=1` and `--min-partition-size=16`; odd attempts render the generator rotated 90 degrees (`transpose=1`) because aomenc picks VERT_4 on this content and essentially never HORZ_4, and the two arms are a transposed pair. Attempts whose decode fired zero 1:4 strips are counted and printed, never asserted on — selection is on "the stream contains the feature", never on "the stream decoded correctly". RESULT: **FAIL**. `seed 73` (a stream with four real 16x64 `PARTITION_VERT_4` strips at mi(16,16..28)) mismatches ffmpeg: 10754 wrong luma samples, first at (64, 56) — one row band ABOVE the strips, i.e. across the y=64 deblock edge. An earlier 13-attempt run (before the transpose arm) had VERT_4 fire 4 strips and decode PIXEL-EXACT, so the skip/low-energy case works and the coded case does not. EVIDENCE: /home/user/Documents/Code/Rust/edith_codecs-tx64x16/crates/ec-av1/fixtures/tx64x16-vert4-mismatch-seed73.obu | decode_probe dump vs `ffmpeg -f rawvideo`, EC_AV1_TRACE partition trace | 10754/24576 luma samples differ, first (64,56); trace shows `partition_w64 value=9` then four `TRACE_RECT64_END bw=16 bh=64` EVIDENCE: gate stdout above | 40 aomenc attempts, seeds 42..81, `--enable-1to4-partitions=1` | 21 named refusals, VERT_4 arm reached a real decode, HORZ_4 arm never selected by aomenc on this content ## Open, with dispositions - **fix-now (r2)**: the coded-16x64 mismatch above. Not yet root-caused. Ruled out by reading the oracle source, NOT by experiment: shift chain (`inv_shift_64x16`/`inv_shift_16x64` = {-2,-4} = our `row_shift_wh` 2), rect scale (4:1 gets none), dequant denominator (area 1024 → 2), eob alphabet (512), CDF set, scan choice, nz-map offset table. Untested suspects, in order: (1) the deblock grid for a 1:4 strip (`fill_lf_grid_rect(.., tx_w=16, tx_h=64, 0)`) — the first diffs are on the OTHER side of the edge; (2) 16x64 intra prediction edge reach; (3) the chroma 8x32 plane. First move should be a prefilt dump (`EC_AV1_PREFILT_DUMP`) to split "reconstruction wrong" from "deblock wrong" — the diff band starting above the block is exactly the tell that cost lane-tiny a round. - **deferred(a green 64-level gate)**: the 32x32-level 1:4 arms. They ARE requested by this recipe — `a 32x32 partition type this decoder does not code (value=9)` appears in the sweep — and need TX_32X8/TX_8X32 luma (`TxbSet::Luma16` exactly: entropy ctx 2, eob 256) plus 16x4/4x16 chroma (`TxbSet::Chroma8`: ctx 1, eob 64) and two more scans. Same shape of work, not started. - **flagged, not this lane's shape (pre-existing)**: with `--min-partition-size=16`, seed 55 of this recipe decodes 3944 wrong luma samples with ZERO 1:4 blocks in the stream (trace: SB(1,0) SPLIT with a 32x32 `PARTITION_HORZ`, SB(1,2) a 64x32 `PARTITION_HORZ`), first diff at (154, 59). My diff cannot reach that stream (every path it touches needs a 16-with-64 dimension pair), so it is a pre-existing defect of the 32x16 / 64x32 strip shapes exposed by a recipe the existing sbpart gate (`--min-partition-size=32`) never uses. Stream: rerun the gate with `EC_AV1_GATE_DUMP` at `EC_TX64X16_GATE_ATTEMPTS=14`. - **accepted**: `palette_bsize_ctx_wh` has no rect caller at all (`read_intra_mode_rect` never reads a palette symbol), so 64x16/16x64 need no entry there; a screen-content rect strip is a different lane's hole. ## Suite totals `cargo test -p ec-av1 --lib` (worktree, `CARGO_TARGET_DIR=~/.cache/cargo-target-tx64x16`, 1347s under a 10-lane concurrent load): **256 passed, 17 failed, 22 ignored, 0 filtered out.** Two of the 17 captured by name -- `stream::tests::a_real_aomenc_superres_key_frame_sequence_decodes_pixel_exact` and `stream::tests::real_aomenc_film_grain_streams_decode_pixel_exact` -- are outside anything this diff can reach (no 16-with-64 dimension pair), plus this lane's own new gate. The remaining 14 were NOT enumerated: the capture pipeline dropped the failure list and a re-run costs another 22 minutes, which the tool budget did not have. A successor MUST re-run this and diff the failure set against `main` before attributing any of it to this branch. Note: `crates/ec-av1/fixtures/` is covered by `.gitignore:2 (fixtures)`, so the pinned mismatching stream is NOT in the commit -- it is on disk in the worktree at `crates/ec-av1/fixtures/tx64x16-vert4-mismatch-seed73.obu` (sha256 0d9c3dd8a178a96309ea7165f3018146b5e09e660fd78a6870da2a5b5b1b60c1) and regenerable by the gate with `EC_AV1_GATE_DUMP`.