From 85bf4d6aa637fe97d12348aa6f2ee35a34025df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Sep 2026 00:05:17 +0300 Subject: [PATCH] fix(av1): a transform unit is not a block of its own size -- Reach::of_tu The TX4 sub-grid of an 8x8 square inside a PARTITION_VERT_A/_B indexed a 4x4 row of the three-row has_tr_vert/has_bl_vert tables and panicked on a real --enable-tx-size-search=1 stream. libaom has no such row on purpose (has_tr_vert_tables[BLOCK_4X4] is NULL): a transform unit inside a block answers from the block's geometry, and only its top row / left column reaches the table -- the BLOCK's row, at the BLOCK's position. Both TU sites (decode_block's multi-TU branch, decode_leaf8's TX4 grid) go through the transcription; a unit test pins it equal to the old unit-as-block answer everywhere outside a vertical AB partition. The AB gate no longer pins --enable-tx-size-search=0 (aomenc's default is ON, which is what hid the panic): four attempts run with it on, tolerate only an 'unsupported' refusal from another lane, and hard-assert a TX4 unit inside a vertical AB partition was reached. --- crates/ec-av1/src/decode.rs | 19 +++++- crates/ec-av1/src/encode.rs | 88 +++++++++++++++++++++++++++ crates/ec-av1/src/stream.rs | 93 +++++++++++++++++++++++++---- lanes/ab16-r2.report.md | 116 ++++++++++++++++++++++++++++++++++++ 4 files changed, 301 insertions(+), 15 deletions(-) create mode 100644 lanes/ab16-r2.report.md diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 5a554625..42aef227 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -423,6 +423,18 @@ thread_local! { } /// [`AB16_HITS`] per arm (HORZ_A, HORZ_B, VERT_A, VERT_B at 16x16). +thread_local! { + /// 4x4 transform units decoded inside an 8x8 square of a + /// `PARTITION_VERT_A`/`_B` -- the exact call that panicked before + /// [`crate::encode::Reach::of_tu`] (lane-ab16 r2), so the gate can prove + /// a real `--enable-tx-size-search=1` stream reaches it. + static VERT_AB_TX4_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +pub(crate) fn vert_ab_tx4_hits() -> usize { + VERT_AB_TX4_HITS.with(std::cell::Cell::get) +} + pub(crate) fn ab16_hits_by_arm() -> [usize; 4] { AB16_HITS.with(std::cell::Cell::get) } @@ -5209,7 +5221,7 @@ fn decode_block( let tu_px = px + tu_col * logical_tx; let tu_py = py + tu_row * logical_tx; let tu_around = neighbours.around_mi(tu_mi, logical_tx)[0]; - let tu_reach = Reach::of(logical_tx, tu_px, tu_py, y.width, y.height); + let tu_reach = Reach::of_tu(side, logical_tx, tu_px, tu_py, y.width, y.height); // This transform unit's own bsize (`logical_tx`) is smaller // than the block it sits in (`side`), so `txb_skip_ctx` is // the neighbour-magnitude table, not the lone-TU 0 (spec @@ -5581,7 +5593,10 @@ fn decode_leaf8( let tu_px = px + tu_col * 4; let tu_py = py + tu_row * 4; let tu_around = neighbours.around_mi(tu_mi, 4)[0]; - let tu_reach = Reach::of(4, tu_px, tu_py, y.width, y.height); + if crate::encode::Reach::in_vert_ab() { + VERT_AB_TX4_HITS.with(|c| c.set(c.get() + 1)); + } + let tu_reach = Reach::of_tu(8, 4, tu_px, tu_py, y.width, y.height); let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, 1); let tu_grid = read_plane( dec, diff --git a/crates/ec-av1/src/encode.rs b/crates/ec-av1/src/encode.rs index a4e6c418..130ff201 100644 --- a/crates/ec-av1/src/encode.rs +++ b/crates/ec-av1/src/encode.rs @@ -1192,6 +1192,39 @@ impl Reach { } } + /// [`Self::of`] for one transform unit of a square block whose transform + /// is smaller than itself (libaom `has_top_right`/`has_bottom_left` with + /// non-zero `row_off`/`col_off`): interior units answer from the block's + /// own geometry, and only a unit on the block's top row (resp. left + /// column) reaches the table -- which is the BLOCK's table read at the + /// BLOCK's position, never a table row for the transform's size. Letting + /// the unit stand in for a block of its own size agrees with libaom for + /// the ordinary tables, but the `has_tr_vert_*`/`has_bl_vert_*` pair has + /// no 4x4 row at all (`has_tr_vert_tables[BLOCK_4X4]` is NULL), so a TX4 + /// unit inside an 8x8 square of a `PARTITION_VERT_A`/`_B` panicked on a + /// real `--enable-tx-size-search=1` stream (lane-ab16 r2). + pub(crate) fn of_tu( + block: usize, + tx: usize, + x: usize, + y: usize, + width: usize, + height: usize, + ) -> Self { + let (row_off, col_off) = ((y % block) / tx, (x % block) / tx); + let n = block / tx; + let (bx, by) = (x - col_off * tx, y - row_off * tx); + Self { + above_right: y > 0 + && x + tx < width + && (col_off + 1 < n || (row_off == 0 && Self::top_right(block, bx, by))), + below_left: x > 0 + && y + tx < height + && col_off == 0 + && (row_off + 1 < n || Self::bottom_left(block, bx, by)), + } + } + /// libaom `has_top_right` at block granularity (`row_off`/`col_off` 0, /// the transform covering the whole block, luma): everything before the /// table lookup is that function's own early-exit ladder. @@ -1249,6 +1282,13 @@ impl Reach { VertAbGuard(VERT_AB_PARTITION.with(|c| c.replace(true))) } + /// Whether a `PARTITION_VERT_A`/`_B`'s sub-blocks are being decoded + /// right now ([`Self::vert_ab_partition`]'s guard is alive), so a caller + /// can count the sub-block work that partition creates. + pub(crate) fn in_vert_ab() -> bool { + VERT_AB_PARTITION.with(std::cell::Cell::get) + } + /// Neither, which is all a mode that reads no further than its own edges /// needs. pub(crate) fn none() -> Self { @@ -3537,6 +3577,54 @@ mod tests { assert_eq!(decoded.v, encoded.reconstruction.v, "854x480: V"); } + /// [`Reach::of_tu`] against libaom's `has_top_right`/`has_bottom_left` + /// transform-unit path, for every 4x4 unit of every 8x8 block of a + /// superblock, both partition tables: + /// + /// 1. outside a `PARTITION_VERT_A`/`_B` it must answer exactly what the + /// unit-as-its-own-block `Reach::of(4, ..)` answered before r2, so + /// wiring the TU sites onto it changes no existing stream; + /// 2. inside one it must not panic -- `has_tr_vert_tables[BLOCK_4X4]` is + /// NULL in libaom because that lookup never happens, and reading a + /// 4x4 row out of the three-row vert tables is what crashed a real + /// `--enable-tx-size-search=1` stream (r2); + /// 3. and it must be the BLOCK's vert answer where the two tables + /// disagree: the top-right 4x4 unit of the 8x8 block at superblock + /// row 1, column 0 reads its above-right samples from the 8x8 to its + /// upper right, which a vertical AB partition codes AFTER it + /// (`has_tr_vert_8x8` bit 16 = 0, ordinary `has_tr_8x8` bit 16 = 1). + #[test] + fn of_tu_keeps_the_ordinary_answer_and_uses_the_block_row_under_vert_ab() { + let (w, h) = (SUPERBLOCK * 2, SUPERBLOCK * 2); + for y in (0..h).step_by(4) { + for x in (0..w).step_by(4) { + let tu = Reach::of_tu(8, 4, x, y, w, h); + let as_block = Reach::of(4, x, y, w, h); + assert_eq!( + (tu.above_right, tu.below_left), + (as_block.above_right, as_block.below_left), + "of_tu(8, 4) at ({x}, {y}) differs from the unit-as-block answer" + ); + // (2): under the vert tables the same lookup must answer at + // all rather than index a row that does not exist. + let _guard = Reach::vert_ab_partition(); + let _ = Reach::of_tu(8, 4, x, y, w, h); + } + } + // (3): the disagreeing cell, both ways round. + let (x, y) = (4, 8); + assert!( + Reach::of_tu(8, 4, x, y, SUPERBLOCK, SUPERBLOCK).above_right, + "ordinary table: the 8x8 above-right of the block at sb row 1 col 0 is coded first" + ); + let guard = Reach::vert_ab_partition(); + assert!( + !Reach::of_tu(8, 4, x, y, SUPERBLOCK, SUPERBLOCK).above_right, + "vert AB: that 8x8 is the partition's own later-coded right half" + ); + drop(guard); + } + /// `Reach::top_right`/`bottom_left` against a from-scratch transcription /// of libaom's `has_top_right`/`has_bottom_left` (`av1/common/ /// reconintra.c`), for every 16x16 and 32x32 block position across three diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 381c9489..6d91388c 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -5470,9 +5470,11 @@ mod tests { /// attempt and summed only over attempts that actually decoded AND were /// compared, and EACH of the four arms must have fired -- a run where /// aomenc's RD only ever picked HORZ_A cannot pass as proof of four - /// ([[gate-blind-to-feature]]). 8-bit and 10-bit, and one attempt with - /// `--tile-columns=1` so the mi-exact mode map's tile-relative reset is - /// exercised at a real tile boundary. + /// ([[gate-blind-to-feature]]). 8-bit and 10-bit; `--tile-columns=1` is + /// NOT among the attempts (base tile defect, reproducer in the r1 + /// report), and `--enable-tx-size-search` is left at aomenc's default + /// (ON) -- pinning it off hid a panic in the TX4 sub-grid of an 8x8 + /// square inside a `PARTITION_VERT_A`/`_B` (r2). #[test] fn a_real_aomenc_stream_with_ab_partitions_below_16x16_decodes_pixel_exact() { const NAME: &str = @@ -5493,6 +5495,11 @@ mod tests { cq: u32, ten_bit: bool, tile_cols: u32, + /// Left at aomenc's default (ON) instead of pinned off: reaches + /// the TX4 sub-grid of an 8x8 square inside a + /// `PARTITION_VERT_A`/`_B` (r2's panic), at the cost of the + /// strip-level split transform lane-rectx still refuses. + tx_size_search: bool, } // Recipes chosen by a ~200-cell sweep of {source, size, cq} at this // level (r1 report): one cell per arm that is pixel-exact end to end, @@ -5501,19 +5508,33 @@ mod tests { // in the failing superblock, i.e. a base tile defect this lane // neither introduced nor owns (reproducer pinned in the r1 report). let attempts = [ - Attempt { src: "yuvtestsrc=size=64x64", w: 64, h: 64, cq: 22, ten_bit: false, tile_cols: 0 }, - Attempt { src: "rgbtestsrc=size=64x64", w: 64, h: 64, cq: 20, ten_bit: false, tile_cols: 0 }, - Attempt { src: "rgbtestsrc=size=64x64", w: 64, h: 64, cq: 50, ten_bit: false, tile_cols: 0 }, - Attempt { src: "mandelbrot=size=64x64:start_x=-1.0", w: 64, h: 64, cq: 14, ten_bit: false, tile_cols: 0 }, + Attempt { src: "yuvtestsrc=size=64x64", w: 64, h: 64, cq: 22, ten_bit: false, tile_cols: 0, tx_size_search: false }, + Attempt { src: "rgbtestsrc=size=64x64", w: 64, h: 64, cq: 20, ten_bit: false, tile_cols: 0, tx_size_search: false }, + Attempt { src: "rgbtestsrc=size=64x64", w: 64, h: 64, cq: 50, ten_bit: false, tile_cols: 0, tx_size_search: false }, + Attempt { src: "mandelbrot=size=64x64:start_x=-1.0", w: 64, h: 64, cq: 14, ten_bit: false, tile_cols: 0, tx_size_search: false }, // 10-bit: the only two cells of the sweep that are exact at this // depth (HORZ_A and VERT_A); the 10-bit HORZ_B/VERT_B cells all // trip the base chroma defect the r1 report pins, so those two // arms are proven 8-bit only. - Attempt { src: "yuvtestsrc=size=64x64", w: 64, h: 64, cq: 30, ten_bit: true, tile_cols: 0 }, - Attempt { src: "mandelbrot=size=64x64:start_x=0.4", w: 64, h: 64, cq: 30, ten_bit: true, tile_cols: 0 }, + Attempt { src: "yuvtestsrc=size=64x64", w: 64, h: 64, cq: 30, ten_bit: true, tile_cols: 0, tx_size_search: false }, + Attempt { src: "mandelbrot=size=64x64:start_x=0.4", w: 64, h: 64, cq: 30, ten_bit: true, tile_cols: 0, tx_size_search: false }, + // `--enable-tx-size-search` at aomenc's default: an 8x8 square of + // a VERT_A/VERT_B resolves to a 2x2 grid of TX4 units, which is + // the reach lookup that had no table row and panicked (r2). These + // attempts may legitimately stop at lane-rectx's still-standing + // "strip with a split transform" refusal -- an `unsupported` + // message is tolerated, a panic or a pixel mismatch is not, and + // at least one of them must reach a TX4 unit inside a vertical AB + // partition. + Attempt { src: "yuvtestsrc=size=64x64", w: 64, h: 64, cq: 55, ten_bit: false, tile_cols: 0, tx_size_search: true }, + Attempt { src: "yuvtestsrc=size=64x64", w: 64, h: 64, cq: 22, ten_bit: false, tile_cols: 0, tx_size_search: true }, + Attempt { src: "rgbtestsrc=size=64x64", w: 64, h: 64, cq: 20, ten_bit: false, tile_cols: 0, tx_size_search: true }, + Attempt { src: "mandelbrot=size=64x64:start_x=-1.0", w: 64, h: 64, cq: 14, ten_bit: false, tile_cols: 0, tx_size_search: true }, ]; let mut arms = [0usize; 4]; let mut compared = 0usize; + let mut tx4_reached = 0usize; + let mut tx4_compared = 0usize; for a in &attempts { let desc = format!("{} cq={} {}bit tiles={}", a.src, a.cq, if a.ten_bit { 10 } else { 8 }, a.tile_cols); @@ -5543,7 +5564,8 @@ mod tests { "--row-mt=0".into(), "--sb-size=64".into(), "--kf-max-dist=0".into(), "--limit=1".into(), "--enable-rect-partitions=1".into(), "--enable-ab-partitions=1".into(), - "--enable-1to4-partitions=0".into(), "--enable-tx-size-search=0".into(), + "--enable-1to4-partitions=0".into(), + format!("--enable-tx-size-search={}", u8::from(a.tx_size_search)), // Filter intra ON a rect strip is a separate, still-refused // predictor; this gate is about the AB partition wiring. "--enable-filter-intra=0".into(), @@ -5572,8 +5594,27 @@ mod tests { assert!(!stream.is_empty(), "{NAME}: {desc}: aomenc wrote an empty stream"); assert_eq!(stream, encode(), "{NAME}: {desc}: aomenc output is not reproducible"); let before = crate::decode::ab16_hits_by_arm(); - let frames = decode_stream(&stream) - .unwrap_or_else(|e| panic!("{NAME}: {desc}: decode failed, not a pixel mismatch: {e}")); + let tx4_before = crate::decode::vert_ab_tx4_hits(); + let decoded = decode_stream(&stream); + let tx4_this = crate::decode::vert_ab_tx4_hits() - tx4_before; + // Counted even when the attempt later stops at another lane's + // refusal: reaching this lookup at all is what r2 fixed. + tx4_reached += tx4_this; + let frames = match decoded { + Ok(frames) => frames, + // Only lane-rectx's split-transform strip refusal may stop a + // tx-size-search attempt; a panic never reaches here at all. + Err(e) if a.tx_size_search => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{NAME}: {desc}: decode failed with a non-refusal error: {msg}" + ); + eprintln!("{NAME}: {desc} refused after {tx4_this} vert-AB TX4 units: {msg}"); + continue; + } + Err(e) => panic!("{NAME}: {desc}: decode failed, not a pixel mismatch: {e}"), + }; let after = crate::decode::ab16_hits_by_arm(); let this: Vec = (0..4).map(|i| after[i] - before[i]).collect(); eprintln!("{NAME}: {desc} decoded, arms this attempt={this:?}"); @@ -5589,13 +5630,39 @@ mod tests { assert_eq!(got.v, w.v, "{NAME}: {desc} frame {i} V vs ffmpeg"); } // Counted only now: the attempt decoded AND compared exact. + if a.tx_size_search { + tx4_compared += 1; + eprintln!("{NAME}: {desc} pixel-exact, vert-AB TX4 units={tx4_this}"); + continue; + } for i in 0..4 { arms[i] += after[i] - before[i]; } compared += 1; eprintln!("{NAME}: {desc} pixel-exact"); } - assert_eq!(compared, attempts.len(), "{NAME}: every attempt must decode and compare"); + assert_eq!( + compared, + attempts.iter().filter(|a| !a.tx_size_search).count(), + "{NAME}: every fixed-transform attempt must decode and compare" + ); + // The tx-size-search attempts cannot be compared pixel by pixel yet: + // every 16x16 AB partition contains a strip, and with a free + // transform size aomenc splits at least one of them in every stream + // of a 40-cell {source, cq} sweep (r2 report), so they all stop at + // lane-rectx's "strip with a split transform" refusal (or the 1:4 / + // sub-8x8 ones) before the frame is done. What they DO prove is that + // the TX4 sub-grid of an 8x8 square inside a VERT_A/VERT_B is reached + // on a real stream and answers -- it used to panic there, and a panic + // cannot be tolerated by the `unsupported` arm above. The values it + // answers are pinned separately against libaom in + // `of_tu_keeps_the_ordinary_answer_and_uses_the_block_row_under_vert_ab`. + let _ = tx4_compared; + assert!( + tx4_reached > 0, + "{NAME}: no --enable-tx-size-search=1 attempt reached a TX4 unit inside a \ + vertical AB partition -- the r2 panic path is unproven" + ); for (i, arm) in ["HORZ_A", "HORZ_B", "VERT_A", "VERT_B"].iter().enumerate() { assert!(arms[i] > 0, "{NAME}: PARTITION_{arm} at 16x16 never fired across {compared} \ compared streams -- the gate proves nothing about that arm (arms={arms:?})"); diff --git a/lanes/ab16-r2.report.md b/lanes/ab16-r2.report.md new file mode 100644 index 00000000..7488caff --- /dev/null +++ b/lanes/ab16-r2.report.md @@ -0,0 +1,116 @@ +# lane-ab16 r2 — the panic the gate's `--enable-tx-size-search=0` was hiding, and where seed 43 really diverges + +Branch `lane-ab16` (off `lane-rectx` `fad4d5a`). r1 verdict was FAIL on four findings; this +round closes (1) and (3), and answers (2) and (4) with measurements rather than a fix. + +## (1) PANIC — fixed at the root: a TX unit is not a block of its own size + +`encode.rs` `Reach::of(4, ..)` inside a `PARTITION_VERT_A`/`_B` indexed +`HAS_TOP_RIGHT_VERT[Reach::table(4)] == [_; 3][3]` and panicked +("index out of bounds: len 3 index 3"), because the vert tables have no 4x4 row at all — +libaom's `has_tr_vert_tables[BLOCK_4X4]` is literally `NULL`. It is NULL because that lookup +never happens there: for a 4x4 transform unit inside an 8x8 square, libaom's +`has_top_right`/`has_bottom_left` (`reconintra.c`) take the BLOCK's `bsize` with a non-zero +`row_off`/`col_off`, answer interior units from the block geometry alone +(`col_off + tx_units < block_units`), and reach the table only for a unit on the block's top +row / left column — where the table read is the BLOCK's row at the BLOCK's position. + +- `crates/ec-av1/src/encode.rs` (+`Reach::of_tu`, ~line 1215): that rule, transcribed. +- `crates/ec-av1/src/decode.rs` 5212 / 5584: both TU loops (`decode_block`'s multi-TU branch + and `decode_leaf8`'s TX4 sub-grid) now call `Reach::of_tu(block, tx, ..)` instead of + `Reach::of(tx, ..)`. Root, not per-symptom: these are the only two sites in the crate that + ask a reach question for a sub-block transform unit (`grep -n "Reach::of("`). +- `crates/ec-av1/src/encode.rs` `Reach::in_vert_ab()` + `decode.rs` `vert_ab_tx4_hits()`: + counter for the exact call that used to panic, so the gate can hard-assert it is reached. + +The fix is behaviour-preserving outside a vertical AB partition — pinned, not hoped: +`of_tu_keeps_the_ordinary_answer_and_uses_the_block_row_under_vert_ab` (encode.rs tests) +asserts `of_tu(8, 4, ..) == of(4, ..)` at every 4x4 position of a 2x2-superblock frame, that +the vert-table path answers at every one of them (the panic regression), and that the two +tables genuinely disagree where libaom says they must (top-right 4x4 unit of the 8x8 at +superblock row 1, column 0: `has_tr_8x8` bit 16 = 1, `has_tr_vert_8x8` bit 16 = 0). + +EVIDENCE: gate stdout | `--enable-tx-size-search=1` attempt (yuvtestsrc 64x64 cq55) decoded +through the AB partitions instead of aborting | `refused after 4 vert-AB TX4 units: +unsupported: AV1 tile (a HORZ/VERT intra strip with a split transform ...)` — before this +round the same stream died with `panicked at encode.rs:1279 index out of bounds: len 3 +index 3` (decode_probe rc=101). + +## The gate, with tx-size search no longer pinned off + +`--enable-tx-size-search=0` is gone from the recipe builder; it is now per attempt: + +- the six comparison attempts keep it OFF and stay pixel-exact (all four arms fired); +- four new attempts leave it at aomenc's default (ON). They reach the formerly-panicking + lookup and are allowed to stop at another lane's refusal — an `unsupported` message is + tolerated, a panic or a pixel mismatch is not — and the gate hard-asserts that at least one + TX4 unit inside a vertical AB partition was decoded. + +Why the ON attempts cannot be compared pixel by pixel yet, measured not assumed: every 16x16 +AB partition contains a 16x8/8x16 strip, and with a free transform size aomenc splits at +least one strip in **40/40** cells of a `{yuvtestsrc, rgbtestsrc, mandelbrot, smptebars, +testsrc2} x {8,14,22,30,40,50,55,60}` sweep, so every one of them stops at lane-rectx's +still-standing "a HORZ/VERT intra strip with a split transform (per-unit rect prediction is +not ported)" refusal (or the 1:4 / sub-8x8 / palette ones). A pixel-exact tx-size-search arm +therefore needs that refusal lifted first — lane-rectx's, not this lane's. + +EVIDENCE: gate stdout | `cargo test -p ec-av1 --lib -- ab_partitions_below_16x16 of_tu_keeps +--nocapture` | `pixel-exact on 6 streams, ab16 arms(HORZ_A,HORZ_B,VERT_A,VERT_B)=[2, 1, 2, 1]`, +`yuvtestsrc cq=55 refused after 4 vert-AB TX4 units`, `test result: ok. 2 passed; 0 failed`. + +## (3) Stale docstring — fixed + +The gate's doc no longer claims a `--tile-columns=1` attempt (there is none; r1's reproducer +for the base tile defect stands) and now states why tx-size search is left at aomenc's +default. + +## (2) Seed 43 of the merged SB gate: NOT the AB arms — a 64x32 strip coefficient desync + +`a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact` still +FAILS on this branch at seed 43, frame 0 luma. Bisected against the instrumented oracle +(`EC_TRACE_MODE_STEP` both sides, ranges compared element by element): + +``` +first divergent element: mi_row=8 mi_col=16 name=skip oracle rng=60402 ours rng=58410 +last matching element: mi_row=0 mi_col=16 name=angle_uv val=3 rng=49760 (identical) +``` + +Everything up to and including the mode info of the **first 64x32 strip** at mi (0,16) — +pixel (64,0), `mode=7` (D203), `angle_y=3`, `uv_mode=7`, `angle_uv=3` — is bit-identical. +The streams part inside that block's **coefficients** (between its `angle_uv` and the next +block's `skip`), i.e. in the TX_64X32 residual path, and never resync: the oracle codes 16 +mode-info elements for the frame, we code 44. + +This is upstream of every AB symbol in the stream. The stream's partition trace is +`w64: NONE, HORZ, SPLIT | ... | w16 mi=(2,11) value=4 (HORZ_A)` — the single AB16 block sits +in the third superblock, decoded long after the divergence. The luma error map confirms it: +superblock 0 is exact except its right/bottom 7-pixel deblock spill, and everything from +x >= 64 is wrong. + +Why it was green at base: base `fad4d5a` refuses seed 43 — but that refusal is *itself* a +consequence of this desync (it decodes a garbage partition value once the arithmetic decoder +has drifted). Lifting the AB16 refusal did not break seed 43; it removed the mask +([[refusal-hides-a-defect]]). The defect lives in lane-rectx's 64x32 strip coefficient path, +not in this lane's arms, and this branch changes nothing on that path (`Reach` answers only +affect prediction, never symbol consumption). + +Disposition: **deferred(lane-rectx / a 64x32-strip coefficient lane — this lane owns no code +on that path)**. Merge blocker either way: the gate is red on this branch until it is fixed, +and it is red for a real defect, so it must not be papered over. + +EVIDENCE: `/ab16/{seed43.obu,o.all,u.all,ours.yuv,ff.yuv}` | `EC_AV1_GATE_DUMP` ++ `EC_TRACE_MODE_STEP=1` on `aomdec` and `decode_probe`, `diff` of the element traces, and a +per-8x8 luma error map vs `ffmpeg -f rawvideo` | first divergent element +`mi(8,16) skip rng 60402 vs 58410`; 20494/24576 luma bytes differ, all at x >= 56. + +## (4) The chroma-only residue (mandelbrot 64x64 start_x=-0.6 cq30) + +Not re-measured this round (turn budget went to (1) and (2)); r1's characterisation stands: +670 differing bytes, first at byte 4247 (U plane), luma exact. Whether AB blocks are present +in that stream is still unanswered. +Disposition: **deferred(a chroma/SMOOTH prediction lane — r1 already scoped it)**. + +## Test totals + +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib` (log: `~/.cache/ab16-r2-suite.log`): +see the HANDOFF line — the only failure is the seed-43 SB gate above.