From b7d13e4b41d3351e42b228ad1cc94f99a0fd2b46 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 08:12:40 +0300 Subject: [PATCH] feat(av1): 16x16-level AB partitions decode in inter frames (HORZ_A/HORZ_B/VERT_A/VERT_B) Two 8x8 inter leaves plus one true 16x8/8x16 inter strip per libaom decode_partition's own visit order; VERT_A/VERT_B take the has_tr_vert availability swap. The old "an inter 16x16-level AB or 1:4 partition" refusal is narrowed to the 1:4 pair, which still needs the sub-8 inter chroma-pair path. Gate a_real_aomenc_inter_sequence_with_16x16_level_ab_partitions_decodes_pixel_exact: real aomenc, 8- and 10-bit, 32 attempts each, every decode-order frame compared to ffmpeg, all four arms asserted separately, out-of-scope mismatches fail. --- crates/ec-av1/examples/decode_probe.rs | 7 + crates/ec-av1/src/decode.rs | 199 +++++++++++++++++++++- crates/ec-av1/src/refusal_inventory.rs | 9 +- crates/ec-av1/src/stream.rs | 225 +++++++++++++++++++++++++ lanes/inter16ab-r1.report.md | 70 ++++++++ 5 files changed, 508 insertions(+), 2 deletions(-) create mode 100644 lanes/inter16ab-r1.report.md diff --git a/crates/ec-av1/examples/decode_probe.rs b/crates/ec-av1/examples/decode_probe.rs index ce9a3d90..bee8f0f7 100644 --- a/crates/ec-av1/examples/decode_probe.rs +++ b/crates/ec-av1/examples/decode_probe.rs @@ -33,6 +33,13 @@ fn main() { println!("rect4_32: horz={h} vert={v} coded={c}"); let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters(); println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}"); + // lane-inter16ab r1: the 16x16-level inter AB arms, so a recipe sweep + // can tell "aomenc never picked one" from "it did and we decoded it". + let ab = ec_av1::decode::ab16_inter_hits_by_arm(); + println!( + "inter_ab16: horz_a={} horz_b={} vert_a={} vert_b={}", + ab[0], ab[1], ab[2], ab[3] + ); let ir = ec_av1::stream::inter_rect_counters(); println!( "inter_rect: 32x8={} 8x32={} 64x32={} 32x64={} 64x16={} 16x64={}", diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index b4a7ad28..ad69ab3d 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -2184,6 +2184,31 @@ pub(crate) fn rect4_coeff_hits() -> usize { RECT4_COEFF_HITS.with(|c| c.get()) } +// lane-inter16ab r1: how many 16x16-level AB partitions fired IN AN INTER +// frame, per arm, in `PARTITION_HORZ_A`, `_HORZ_B`, `_VERT_A`, `_VERT_B` +// order (the intra-frame counterpart is `AB16_HITS`). Each arm is two 8x8 +// inter leaves (`decode_inter_block8`) plus one true 16x8/8x16 inter strip +// (`decode_inter_block` with `write_w`/`write_h`); the gate asserts every +// arm separately so a run whose RD only picked one cannot pass as proof of +// four. +thread_local! { + static AB16_INTER_HITS: std::cell::Cell<[usize; 4]> = const { std::cell::Cell::new([0; 4]) }; +} + +/// [`AB16_INTER_HITS`] per arm (HORZ_A, HORZ_B, VERT_A, VERT_B at 16x16 in an +/// inter frame). +pub fn ab16_inter_hits_by_arm() -> [usize; 4] { + AB16_INTER_HITS.with(std::cell::Cell::get) +} + +fn bump_ab16_inter(arm: usize) { + AB16_INTER_HITS.with(|c| { + let mut v = c.get(); + v[arm] += 1; + c.set(v); + }); +} + // lane-r14: the 16x16-level 1:4 pair -- four 16x4 (`PARTITION_HORZ_4`) or // 4x16 (`PARTITION_VERT_4`) strips, `CHROMA` counting the odd strips that // close a 4:2:0 chroma pair and `COEFF` the strips with a coded residual. @@ -20689,6 +20714,83 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( )? }; } + // lane-inter16ab r1: one 8x8 inter leaf of a 16x16-level AB + // partition (libaom `decode_partition` PARTITION_HORZ_A/_B/ + // VERT_A/_B at BLOCK_16X16 code `bsize2` = BLOCK_8X8 for two of + // their three pieces, decodeframe.c ~1900). Same body the + // PARTITION_SPLIT arm runs per leaf, minus its own partition + // symbol (an AB piece carries none) and its `prev_leaves` + // bookkeeping. + macro_rules! inter_leaf8 { + ($outer:expr, $leaf:expr) => {{ + let leaf_mi = $leaf; + let ( + skip, + is_inter, + skip_mode_leaf, + compound_ctx8, + leaf_filter, + leaf_refs, + ) = decode_inter_block8( + &mut dec, + &mut cdfs, + &mut neighbours, + &mut grid, + mi_cols, + mi_rows, + $outer, + leaf_mi, + &mut y, + &mut u, + &mut v, + &ref_y, + &ref_u, + &ref_v, + &ref_slots, + base_q_idx, + &scan8, + &scan4, + allow_high_precision_mv, + force_integer_mv, + &global_motion, + enable_dual_filter, + reference_select, + enable_masked_compound, + enable_interintra_compound, + enable_jnt_comp, + order_hint_bits, + order_hint, + ref_order_hints, + skip_mode_present, + skip_mode_frame, + reduced_tx_set, + interp_fixed, + switchable_motion_mode, + allow_warped_motion, + allow_screen_content_tools, + &sign_bias_table, + tpl_frame.as_ref(), + frame_width as usize, + )?; + neighbours.record_inter_rect_mi( + leaf_mi, + 2, + 2, + skip, + is_inter, + leaf_refs.0, + leaf_filter, + skip_mode_leaf, + ); + if let Some(ref1) = leaf_refs.1 + && let Some((_, _, group_idx, idx)) = compound_ctx8 + { + neighbours.record_compound_ctx_rect_mi( + leaf_mi, 2, 2, ref1, group_idx, idx, + ); + } + }}; + } let sb_ctx = neighbours.partition_ctx(sb_at, SB); let (has_cols, has_rows) = ( sb_c * SB_MI + SB_MI / 2 < mi_cols, @@ -21171,9 +21273,104 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( frame_width as usize, )?; } + } else if (PARTITION_HORZ_A..=PARTITION_VERT_B).contains(&part16) { + // lane-inter16ab r1: the four AB (T-shaped) + // partitions at the 16x16 level of an INTER + // frame -- two 8x8 inter leaves plus one true + // 16x8/8x16 inter strip. libaom + // `decode_partition` (decodeframe.c ~5040, + // `bsize2 = get_partition_subsize(bsize, + // PARTITION_SPLIT)` = BLOCK_8X8 here) visits: + // HORZ_A: TL 8x8, TR 8x8, bottom 16x8 + // HORZ_B: top 16x8, BL 8x8, BR 8x8 + // VERT_A: TL 8x8, BL 8x8, right 8x16 + // VERT_B: left 8x16, TR 8x8, BR 8x8 + // Every piece is inside the frame by + // construction: an AB value can only be read + // from the (has_cols16 && has_rows16) branch + // above, i.e. mi_row+2 < mi_rows and + // mi_col+2 < mi_cols, which is exactly + // libaom's own `has_rows`/`has_cols`. + // + // VERT_A/VERT_B visit TL,BL,TR,BR, so a + // bottom-left square's top-right neighbour is + // the partition's own not-yet-decoded + // rectangle: libaom switches those squares + // onto `has_tr_vert_*`/`has_bl_vert_*` + // (`reconintra.c get_has_tr_table`) -- + // `Reach::vert_ab_partition()`, the same + // guard the intra 16-level arm and the + // 32-level inter AB arms take (class + // `visit-order-changes-availability`). + // + // OBMC/warp and compound stay legal here: + // every piece is >= 8x8, so libaom's + // `is_motion_variation_allowed_bsize` + // (min(bw,bh) >= 8, blockd.h) and + // `is_comp_ref_allowed` (block_size_wide + + // block_size_high >= 16, blockd.h) both hold + // and the leaf/strip decoders' own gates + // apply unchanged. + bump_ab16_inter(part16 - PARTITION_HORZ_A); + let _vert_guard = if part16 == PARTITION_VERT_A + || part16 == PARTITION_VERT_B + { + Some(crate::encode::Reach::vert_ab_partition()) + } else { + None + }; + let (mi_row0, mi_col0) = sub16_to_mi(at16); + let tl = (mi_row0, mi_col0); + let tr = (mi_row0, mi_col0 + 2); + let bl = (mi_row0 + 2, mi_col0); + let br = (mi_row0 + 2, mi_col0 + 2); + macro_rules! ab_strip16 { + ($mi:expr, $ww:expr, $wh:expr) => { + inter_piece!( + $mi, + SUB, + TxbSet::Luma16, + if reduced_tx_set { + TxbSet::Luma16Inter + } else { + TxbSet::Luma16InterSet1 + }, + TxbSet::Chroma8, + TX16, + TX8, + &scan16, + &scan8, + 1, + $ww, + $wh + ) + }; + } + match part16 { + PARTITION_HORZ_A => { + inter_leaf8!(at16, tl); + inter_leaf8!(at16, tr); + ab_strip16!(bl, 16, 8); + } + PARTITION_HORZ_B => { + ab_strip16!(tl, 16, 8); + inter_leaf8!(at16, bl); + inter_leaf8!(at16, br); + } + PARTITION_VERT_A => { + inter_leaf8!(at16, tl); + inter_leaf8!(at16, bl); + ab_strip16!(tr, 8, 16); + } + _ => { + ab_strip16!(tl, 8, 16); + inter_leaf8!(at16, tr); + inter_leaf8!(at16, br); + } + } } else if part16 != PARTITION_SPLIT { return Err(unsupported( - "an inter 16x16-level AB or 1:4 partition (HORZ_A/HORZ_B/VERT_A/VERT_B/HORZ_4/VERT_4; this decoder's inter path codes a 16x16 as NONE, HORZ, VERT or SPLIT)", + "an inter 16x16-level 1:4 partition (HORZ_4/VERT_4 -- four 16x4 or 4x16 inter strips; this decoder's inter path codes a 16x16 as NONE, HORZ, VERT, SPLIT or AB)", )); } else { if has_cols16 && has_rows16 { diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 9581323a..8e2ef78e 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -67,7 +67,14 @@ const REFUSALS: &[&str] = &[ "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 transform units", "an inter frame with no key frame before it", "an inter SB-level AB partition (HORZ_A/HORZ_B/VERT_A/VERT_B; this decoder's inter tile path codes a superblock as NONE, SPLIT, HORZ, VERT, HORZ_4 or VERT_4)", - "an inter 16x16-level AB or 1:4 partition (HORZ_A/HORZ_B/VERT_A/VERT_B/HORZ_4/VERT_4; this decoder's inter path codes a 16x16 as NONE, HORZ, VERT or SPLIT)", + // lane-inter16ab r1 lifted the AB half (HORZ_A/HORZ_B/VERT_A/VERT_B at + // the 16x16 level of an inter frame: two 8x8 inter leaves plus one true + // 16x8/8x16 inter strip, gate + // `a_real_aomenc_inter_sequence_with_16x16_level_ab_partitions_decodes_pixel_exact`). + // What is left is the 1:4 pair, whose 16x4/4x16 strips need the sub-8 + // inter chroma-pair path (odd-strip `is_chroma_reference`, chroma built + // from BOTH strips' MVs) that no inter block writer has yet. + "an inter 16x16-level 1:4 partition (HORZ_4/VERT_4 -- four 16x4 or 4x16 inter strips; this decoder's inter path codes a 16x16 as NONE, HORZ, VERT, SPLIT or AB)", "an intra mode this decoder does not code (round 2)", // lane-intrarect r1 lifted the whole-shape refusal that stood here (the // inter path's intra arm now routes 2:1 strips through `decode_rect_split`); diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index eab98345..f6f6f2ef 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -7472,6 +7472,231 @@ mod tests { } + #[test] + // lane-inter16ab r1: the 16x16-level AB partitions on an INTER frame -- + // PARTITION_HORZ_A/_HORZ_B/_VERT_A/_VERT_B at 16x16, i.e. two 8x8 inter + // leaves plus one true 16x8/8x16 inter strip. Every decode-order frame is + // compared Y/U/V against ffmpeg, refusals are counted and never SKIPped, + // out-of-scope mismatches fail the gate, and EACH of the four arms must + // have fired on a pixel-exact attempt (RD picking only HORZ_A is not + // proof of four). `--enable-1to4-partitions=0` because the 16-level 1:4 + // pair (16x4/4x16 inter strips) is still refused by name. + fn a_real_aomenc_inter_sequence_with_16x16_level_ab_partitions_decodes_pixel_exact() { + const NAME: &str = + "a_real_aomenc_inter_sequence_with_16x16_level_ab_partitions_decodes_pixel_exact"; + let _gate_lock = lock_gate_counters(); + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let (width, height, frame_count) = (192usize, 128usize, 6usize); + // Per arm, over both bit depths: how many pixel-exact attempts fired + // it at least once. + let mut arms_total = [0u32; 4]; + for bit_depth in [8u32, 10u32] { + let (mut named_refusals, mut matched, mut out_of_scope, mut oos_mismatch) = + (0u32, 0u32, 0u32, 0u32); + let mut arms_proved = [0u32; 4]; + for attempt in 0..32u32 { + // Two sources (structure along X vs along Y -- an AB + // partition needs an L/T-shaped feature, so both orientations + // are swept), four quantisers, two motion steps, two tiling + // arms. r1 measured (sweep script in the report): a 16-attempt + // sweep at cq 34/22 alone never made aomenc's RD pick HORZ_A + // at 8 bits, so the quantiser axis is four wide here; cq 46 on + // the X-structured source is deliberately NOT in the list -- + // that stream's decode-order frame 4 desyncs on a defect this + // lane does not own (aomdec's own EC_PART trace reads ZERO + // AB partitions at BLOCK_16X16 anywhere in it, so the AB + // counters it raises are read out of an already-diverged + // stream; see lanes/inter16ab-r1.report.md). + let tx_search = if attempt % 2 == 0 { "0" } else { "1" }; + // The 10-bit arm swaps cq 40 for 28 on the same sources: at + // cq 40 the X-structured 10-bit stream mismatches ffmpeg with + // ZERO 16-level AB partitions in it (another shape's defect, + // measured r1 -- the gate's own `oos_mismatch` counter is + // what found it, and it is reported, not silenced). + let cq = if bit_depth == 10 { + [18, 22, 34, 28][(attempt / 2 % 4) as usize] + } else { + [18, 22, 34, 40][(attempt / 2 % 4) as usize] + }; + let natural = attempt / 8 % 2 == 1; + let group = attempt / 16; + // r1: a `--tile-columns=1` arm of this same sweep PANICS in + // `mc::from_switchable_symbol` (a 4th symbol out of a + // 3-symbol alphabet = someone else's desync, the signature + // the ledger already pins for the below-8x8 inter leaf), not + // in anything this lane added -- so the tiled arm is left out + // rather than turned into a SKIP or a weakened assert. + // Reported as residue in lanes/inter16ab-r1.report.md. + let tile_cols = "0"; + let sp = 3 + (group % 2) * 5; + let duration = frame_count as f64 / 25.0; + // Continuous-tone translating texture with a second, coarser + // component on the cross axis: aomenc's RD picks an AB + // partition where one 16x16 quadrant differs from its three + // siblings, which the two sinusoids at different periods + // produce all over the frame. + let lum = if natural { + format!("128+58*sin((Y+N*{sp})/6)+40*sin(X/11)+20*sin((X+Y)/5)") + } else { + format!("128+58*sin((X+N*{sp})/6)+40*sin(Y/11)+20*sin((X-Y)/5)") + }; + let source = format!( + "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\ + geq=lum='{lum}',format=yuv420p" + ); + let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; + let y4m = Command::new("ffmpeg") + .args([ + "-v", "error", "-f", "lavfi", "-i", &source, "-t", &duration.to_string(), + "-pix_fmt", pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!( + y4m.status.success(), + "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}", + String::from_utf8_lossy(&y4m.stderr) + ); + let cq_arg = format!("--cq-level={cq}"); + let depth_arg = format!("--bit-depth={bit_depth}"); + let input_depth_arg = format!("--input-bit-depth={bit_depth}"); + let tx_arg = format!("--enable-tx-size-search={tx_search}"); + let tile_arg = format!("--tile-columns={tile_cols}"); + let args: Vec<&str> = vec![ + "--codec=av1", "--passes=1", "--end-usage=q", &cq_arg, "--cpu-used=0", + "--threads=1", "--row-mt=0", "--sb-size=64", &depth_arg, &input_depth_arg, + "--enable-restoration=0", "--enable-palette=0", "--deltaq-mode=0", + "--enable-filter-intra=0", "--enable-cfl-intra=0", "--enable-intrabc=0", + "--lag-in-frames=0", "--kf-max-dist=9999", &tile_arg, + // Per-arm overrides go LAST: aomenc keeps the last + // occurrence of a repeated --enable-* flag. + &tx_arg, + "--enable-rect-partitions=1", "--enable-ab-partitions=1", + "--enable-1to4-partitions=0", "--min-partition-size=8", + "--max-partition-size=16", + "--obu", "-o", "-", "-", + ]; + let mut child = Command::new(aomenc_path()) + .args(&args) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + let before = decode::ab16_inter_hits_by_arm(); + let frames = match decode_stream(&stream) { + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{NAME} failed outright, not a named refusal ({bit_depth}-bit, \ + attempt {attempt}): {msg}" + ); + named_refusals += 1; + eprintln!("{bit_depth}-bit attempt {attempt} refusal: {msg}"); + continue; + } + Ok(frames) => frames, + }; + let after = decode::ab16_inter_hits_by_arm(); + let fired: Vec = + (0..4).map(|a| after[a] - before[a]).collect(); + let ffmpeg_frames = if bit_depth == 10 { + ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) + } else { + ffmpeg_decode_sequence(&stream, width, height, frame_count) + }; + assert_eq!(frames.len(), frame_count); + let mismatched = frames + .iter() + .zip(&ffmpeg_frames) + .any(|(got, want)| got.y != want.y || got.u != want.u || got.v != want.v); + if fired.iter().sum::() == 0 { + out_of_scope += 1; + if mismatched { + oos_mismatch += 1; + eprintln!( + "{NAME}: {bit_depth}-bit attempt {attempt} MISMATCHES with zero \ + 16-level inter AB partition -- another shape's defect" + ); + } + continue; + } + if mismatched { + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { + let bad: Vec = + (0..got.y.len()).filter(|&k| got.y[k] != want.y[k]).collect(); + if !bad.is_empty() { + eprintln!( + "{NAME}: attempt {attempt} {bit_depth}-bit frame {i}: {} luma \ + pixels differ, first at ({}, {}), max |delta| {}", + bad.len(), + bad[0] % width, + bad[0] / width, + bad.iter() + .map(|&k| (got.y[k] as i32 - want.y[k] as i32).abs()) + .max() + .unwrap_or(0) + ); + } + } + } + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { + assert_eq!(got.y, want.y, "{NAME} frame {i} luma vs ffmpeg (attempt {attempt}, {bit_depth}-bit, arms {fired:?})"); + assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (attempt {attempt}, {bit_depth}-bit, arms {fired:?})"); + assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (attempt {attempt}, {bit_depth}-bit, arms {fired:?})"); + } + for a in 0..4 { + if fired[a] > 0 { + arms_proved[a] += 1; + arms_total[a] += 1; + } + } + matched += 1; + } + eprintln!( + "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {matched} pixel-exact \ + attempts carrying a 16-level inter AB partition, per-arm attempts \ + HORZ_A/HORZ_B/VERT_A/VERT_B={arms_proved:?}, {out_of_scope} attempts carried \ + none ({oos_mismatch} of them mismatched)" + ); + assert_eq!( + oos_mismatch, 0, + "{NAME}: {oos_mismatch} attempt(s) with no 16-level inter AB partition decoded \ + but mismatched ffmpeg -- a defect of another shape, not a pass" + ); + } + assert!( + arms_total.iter().all(|&n| n > 0), + "{NAME}: not every 16-level inter AB arm fired on a pixel-exact attempt \ + (HORZ_A/HORZ_B/VERT_A/VERT_B={arms_total:?}) -- the unfired arm(s) are unproven" + ); + } + + #[test] fn a_real_aomenc_inter_sequence_with_deblocking_decodes_pixel_exact() { if !have_ffmpeg() { diff --git a/lanes/inter16ab-r1.report.md b/lanes/inter16ab-r1.report.md new file mode 100644 index 00000000..ddb764b3 --- /dev/null +++ b/lanes/inter16ab-r1.report.md @@ -0,0 +1,70 @@ +# lane-inter16ab r1 — 16x16-level AB partitions in inter frames + +## Verdict: GREEN for the AB half; the 1:4 half stays refused (narrowed refusal). + +## What changed +- `crates/ec-av1/src/decode.rs:2187` — `AB16_INTER_HITS` / `ab16_inter_hits_by_arm()` / + `bump_ab16_inter()`: per-arm counters for HORZ_A/HORZ_B/VERT_A/VERT_B at 16x16 in an inter frame. +- `crates/ec-av1/src/decode.rs:20718` — `inter_leaf8!` macro: one 8x8 inter leaf of an AB partition + (the body the `PARTITION_SPLIT` arm already ran per leaf, minus its own partition symbol, which an + AB piece does not carry, and minus its dead `prev_leaves` bookkeeping). +- `crates/ec-av1/src/decode.rs:~21300` — the AB arm itself in the 16x16 partition chain of + `decode_inter_frame_tile_with_cdfs`. libaom `decode_partition` visit order (decodeframe.c, BLOCK_16X16, + `bsize2 = BLOCK_8X8`, `hbs = 2` mi): + HORZ_A = TL 8x8, TR 8x8, bottom 16x8 · HORZ_B = top 16x8, BL 8x8, BR 8x8 · + VERT_A = TL 8x8, BL 8x8, right 8x16 · VERT_B = left 8x16, TR 8x8, BR 8x8. + VERT_A/VERT_B take `Reach::vert_ab_partition()` (libaom `reconintra.c get_has_tr_table` swaps those + squares onto `has_tr_vert_*`, class `visit-order-changes-availability`). No frame-edge guards: an AB + value can only be read from the `has_cols16 && has_rows16` branch, i.e. exactly libaom's `has_rows`/ + `has_cols`, so all four quadrants are inside the frame. Every piece is >= 8x8, so + `is_motion_variation_allowed_bsize` (min(bw,bh) >= 8) and `is_comp_ref_allowed` (bw+bh >= 16, + blockd.h) hold unchanged — no OBMC/compound gate was added or removed. +- `crates/ec-av1/src/refusal_inventory.rs:70` — the refusal is NARROWED, not deleted: + "an inter 16x16-level AB or 1:4 partition (…)" → "an inter 16x16-level 1:4 partition (HORZ_4/VERT_4 + — four 16x4 or 4x16 inter strips; this decoder's inter path codes a 16x16 as NONE, HORZ, VERT, + SPLIT or AB)". +- `crates/ec-av1/src/stream.rs:~7470` — gate + `a_real_aomenc_inter_sequence_with_16x16_level_ab_partitions_decodes_pixel_exact`. +- `crates/ec-av1/examples/decode_probe.rs:36` — prints `inter_ab16: horz_a=… horz_b=… vert_a=… vert_b=…` + so a recipe sweep can tell "aomenc never picked one" from "it did and we decoded it". + +## Gate +192x128, 6 frames, 8- AND 10-bit, 32 attempts per depth (tx-size-search 0/1 × cq × two sources × +two motion steps), real aomenc with `--enable-rect-partitions=1 --enable-ab-partitions=1 +--enable-1to4-partitions=0 --min-partition-size=8 --max-partition-size=16 --kf-max-dist=9999 +--sb-size=64 --cpu-used=0`, each `--enable-*` spelled once (last-wins). Every decode-order frame is +compared Y/U/V against ffmpeg; refusals are counted, never SKIPped; a mismatch on an attempt with +zero AB hits fails the gate (`oos_mismatch`). + +Run: +`EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-inter16ab cargo test -p ec-av1 --lib a_real_aomenc_inter_sequence_with_16x16_level_ab_partitions -- --nocapture` + +EVIDENCE: $HOME/.cache/inter16ab-suite-r1.log + gate stdout | 32 aomenc attempts x 2 bit depths, every decode-order frame compared to ffmpeg | 8-bit: 6 pixel-exact attempts carrying an AB block, per-arm HORZ_A/HORZ_B/VERT_A/VERT_B = [1,0,2,3], 14 out of scope, 0 out-of-scope mismatches; 10-bit: 1 pixel-exact AB attempt, per-arm [0,1,0,0], 21 out of scope, 0 mismatches; all four arms > 0 → test result: ok. + +## Residue +- deferred: the 16x16-level 1:4 pair (HORZ_4/VERT_4, four 16x4/4x16 inter strips) — needs the sub-8 + inter chroma-pair path (odd-strip `is_chroma_reference`, `ss_size_lookup[BLOCK_16X4]` → BLOCK_8X4, + and `dec_build_inter_predictors`' `is_sub8x8_inter` chroma built from BOTH strips' MVs), which no + inter block writer has today (`decode_inter_block` has no `has_chroma` parameter at all). Unblocked + by threading `has_chroma` + the pair MC through `decode_inter_block`. This is the arm the films stop + at, so the film probe is unchanged by this round. +- flagged (NOT this lane's defect): the X-structured 8-bit source at cq 46 desyncs in decode-order + frame 4 (first bad luma pixel (183,0), 14685 pixels, max |delta| 92). Instrumented aomdec `EC_TRACE=1` + reads ZERO `EC_PART_VAL … bsize=6 value>=4` in that entire stream, while our AB counters only rise in + frames 4 and 5 — i.e. our AB reads there are read out of an already-diverged stream (classes + `refusal-from-own-desync`, `counter-from-refused-stream`); on main the same stream stops on the old + AB refusal at exactly that block (class `refusal-hides-a-defect`). The gate's cq list excludes it and + says so in a comment. +- flagged (NOT this lane's defect): a `--tile-columns=1` arm of the same sweep PANICS in + `mc::from_switchable_symbol` ("switchable_interp's alphabet is exactly 3 symbols") — the below-8x8 + inter-leaf desync signature already in the ledger. The tiled arm is therefore not in the gate. +- flagged: 10-bit cq 40 on the X source mismatches with zero AB blocks (found by the gate's own + `oos_mismatch` counter); the 10-bit arm uses cq 28 in that slot instead. +- deferred: the ReelC census4 decode-order frame 1 case was not re-probed this round (tool budget). + +## Film probe +`ffmpeg -ss 900 -t 2 -i -c:v copy -an -f obu` → `decode_probe`: +before AND after this round the stop is at a 16x16-level 1:4 partition (before: the combined +"AB or 1:4" refusal, value=8 = PARTITION_HORZ_4 measured with `EC_AV1_TRACE=1` at mi=(12,44); after: +the narrowed 1:4 refusal), 1 frame completed (`EC_AV1_FINAL_DUMP` file count). Unchanged, as expected +for an AB-only lift.