forge
Explore
Log in

Don't you dare go Hollow

The four AB partitions at the 128x128 superblock root, key and inter -- 128x64/64x128 half plus two 64x64 quadrants in libaom decode_partition's visit order, per-piece cdef unit and vert-AB reach

Browse files at this commit

9fbbf1aa8a9e27d4818b3665136da39e78b86160Ahmet Kaan GümüşParent: 56e5abe
  • feat
    • the four AB partitions at the 128x128 superblock root, key and inter -- 128x64/64x128 half plus two 64x64 quadrants in libaom decode_partition's visit order, per-piece cdef unit and vert-AB reach
    • gate is RED on a pre-existing 512x512 128-rect VERT divergence proven independent of this arm
Show full message
feat(av1): the four AB partitions at the 128x128 superblock root, key and inter -- 128x64/64x128 half plus two 64x64 quadrants in libaom decode_partition's visit order, per-piece cdef unit and vert-AB reach; gate is RED on a pre-existing 512x512 128-rect VERT divergence proven independent of this arm
crates/ec-av1/src/decode.rsmodified+226 -1
@@ -13683,6 +13683,14 @@ thread_local! {
1368313683 /// only shape a 1080p (mi_rows = 270) stream reaches.
1368413684 pub(crate) static PART128_EDGE_HORZ_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
1368513685 pub(crate) static PART128_EDGE_VERT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
13686+ /// lane-sb128c r9: 128 roots that resolved to one of the four AB shapes,
13687+ /// in `PARTITION_HORZ_A`, `_HORZ_B`, `_VERT_A`, `_VERT_B` order.
13688+ pub(crate) static PART128_AB_HITS: std::cell::Cell<[usize; 4]> = const { std::cell::Cell::new([0; 4]) };
13689+}
13690+
13691+/// [`PART128_AB_HITS`], for a gate's own before/after delta.
13692+pub(crate) fn part128_ab_hits() -> [usize; 4] {
13693+ PART128_AB_HITS.with(std::cell::Cell::get)
1368613694 }
1368713695
1368813696 /// [`PART128_NONE_HITS`], for a gate's own before/after delta.
@@ -13804,9 +13812,19 @@ fn read_sb128_root(
1380413812 PARTITION_NONE => PART128_NONE_HITS.with(|c| c.set(c.get() + 1)),
1380513813 PARTITION_HORZ => PART128_HORZ_HITS.with(|c| c.set(c.get() + 1)),
1380613814 PARTITION_VERT => PART128_VERT_HITS.with(|c| c.set(c.get() + 1)),
13815+ // lane-sb128c r9: the four AB shapes at the 128 root -- one
13816+ // 128x64/64x128 half plus two 64x64 quadrants, decoded by both tile
13817+ // paths below in libaom `decode_partition`'s own visit order.
13818+ p if (PARTITION_HORZ_A..=PARTITION_VERT_B).contains(&p) => {
13819+ PART128_AB_HITS.with(|c| {
13820+ let mut h = c.get();
13821+ h[p - PARTITION_HORZ_A] += 1;
13822+ c.set(h);
13823+ });
13824+ }
1380713825 _ => {
1380813826 return Err(unsupported(
13809- "a 128x128 superblock AB partition (HORZ_A/HORZ_B/VERT_A/VERT_B at the 128 root)",
13827+ "a 128x128 superblock partition value outside the 8-symbol alphabet",
1381013828 ));
1381113829 }
1381213830 }
@@ -14021,6 +14039,131 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
1402114039 mi_cols,
1402214040 mi_rows,
1402314041 )?;
14042+ if (PARTITION_HORZ_A..=PARTITION_VERT_B).contains(&part128) {
14043+ // lane-sb128c r9: the four AB shapes at the 128 root.
14044+ // libaom `decode_partition` (decodeframe.c) codes each as
14045+ // two `bsize2` (64x64) squares plus one `subsize`
14046+ // (128x64 / 64x128) half, visited HORZ_A = TL, TR, bottom
14047+ // half; HORZ_B = top half, BL, BR; VERT_A = TL, BL, right
14048+ // half; VERT_B = left half, TR, BR. AB values only come
14049+ // from the FULL alphabet symbol, which is only read when
14050+ // both halves of the root are inside the frame, so no
14051+ // piece needs libaom's `i > 0` frame-edge break (a piece
14052+ // may still overhang the bottom/right, which
14053+ // `PlaneBuf::reconstruct`'s r8 clip handles).
14054+ sb128_none = true;
14055+ let at128 = ((sb_r & !1) as usize * 4, (sb_c & !1) as usize * 4);
14056+ let (br, bc) = (at128.0 + 4, at128.1 + 4);
14057+ let (q_r, q_c) = ((sb_r & !1) as usize, (sb_c & !1) as usize);
14058+ // Only the VERTICAL arms reorder the squares (TL, BL, TR,
14059+ // BR), so only they switch libaom's `has_tr_vert_*` /
14060+ // `has_bl_vert_*` tables (lane-sb128c r6 visit order).
14061+ let _vert_ab =
14062+ (part128 == PARTITION_VERT_A || part128 == PARTITION_VERT_B)
14063+ .then(crate::encode::Reach::vert_ab_partition);
14064+ // One `cdef_idx` literal per CODED BLOCK, at the first
14065+ // non-skip one of each 64x64 CDEF unit; the 128x64 /
14066+ // 64x128 half covers two units and its read lands in the
14067+ // unit holding its origin, so that value is copied to the
14068+ // other one (libaom: every mi of the block points at the
14069+ // same `MB_MODE_INFO`).
14070+ let cdef_copy = |src: (usize, usize), dst: (usize, usize)| {
14071+ CDEF_IDX_GRID.with(|g| {
14072+ let mut g = g.borrow_mut();
14073+ let cols = CDEF_SB_COLS.with(|c| c.get());
14074+ if cols == 0 {
14075+ return;
14076+ }
14077+ let (si, di) = (
14078+ (q_r + src.0) * cols + q_c + src.1,
14079+ (q_r + dst.0) * cols + q_c + dst.1,
14080+ );
14081+ if q_c + src.1 < cols
14082+ && q_c + dst.1 < cols
14083+ && si < g.len()
14084+ && di < g.len()
14085+ {
14086+ g[di] = g[si];
14087+ }
14088+ });
14089+ };
14090+ macro_rules! square64 {
14091+ ($at:expr) => {{
14092+ CDEF_TRANSMITTED.with(|c| c.set(false));
14093+ decode_block(
14094+ &mut dec,
14095+ &mut cdfs,
14096+ &mut neighbours,
14097+ $at,
14098+ SB,
14099+ TxbSet::Luma64,
14100+ TxbSet::Chroma32,
14101+ TX32,
14102+ TX32,
14103+ (&scan32, &scan32),
14104+ false,
14105+ &mut y,
14106+ &mut u,
14107+ &mut v,
14108+ base_q_idx,
14109+ enable_filter_intra,
14110+ allow_screen_content_tools,
14111+ allow_intrabc,
14112+ &scan32,
14113+ &scan16,
14114+ &scan8,
14115+ &scan4,
14116+ tx_select,
14117+ reduced_tx_set,
14118+ )?
14119+ }};
14120+ }
14121+ macro_rules! half128 {
14122+ ($at:expr, $bw:expr, $bh:expr, $src:expr, $dst:expr) => {{
14123+ CDEF_TRANSMITTED.with(|c| c.set(false));
14124+ decode_block_128rect(
14125+ &mut dec,
14126+ &mut cdfs,
14127+ &mut neighbours,
14128+ $at,
14129+ $bw,
14130+ $bh,
14131+ &mut y,
14132+ &mut u,
14133+ &mut v,
14134+ base_q_idx,
14135+ enable_filter_intra,
14136+ allow_screen_content_tools,
14137+ tx_select,
14138+ reduced_tx_set,
14139+ )?;
14140+ cdef_copy($src, $dst);
14141+ }};
14142+ }
14143+ match part128 {
14144+ PARTITION_HORZ_A => {
14145+ square64!(at128);
14146+ square64!((at128.0, bc));
14147+ half128!((br, at128.1), 128, 64, (1, 0), (1, 1));
14148+ }
14149+ PARTITION_HORZ_B => {
14150+ half128!(at128, 128, 64, (0, 0), (0, 1));
14151+ square64!((br, at128.1));
14152+ square64!((br, bc));
14153+ }
14154+ PARTITION_VERT_A => {
14155+ square64!(at128);
14156+ square64!((br, at128.1));
14157+ half128!((at128.0, bc), 64, 128, (0, 1), (1, 1));
14158+ }
14159+ _ => {
14160+ half128!(at128, 64, 128, (0, 0), (1, 0));
14161+ square64!((at128.0, bc));
14162+ square64!((br, bc));
14163+ }
14164+ }
14165+ continue;
14166+ }
1402414167 if matches!(part128, PARTITION_HORZ | PARTITION_VERT) {
1402514168 // lane-sb128c r8: libaom `decode_partition`
1402614169 // (decodeframe.c:1554) codes PARTITION_HORZ at the 128
@@ -22191,6 +22334,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
2219122334 }
2219222335 {
2219322336 let mut sb128_rect = None;
22337+ let mut sb128_ab = None;
2219422338 if sb128 && sb_start {
2219522339 let part128 = read_sb128_root(
2219622340 &mut dec,
@@ -22204,6 +22348,13 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
2220422348 mi_cols,
2220522349 mi_rows,
2220622350 )?;
22351+ if (PARTITION_HORZ_A..=PARTITION_VERT_B).contains(&part128) {
22352+ // lane-sb128c r9: an AB shape at the 128 root -- one
22353+ // 128x64/64x128 half plus two 64x64 quadrants, same visit
22354+ // order as the key-frame path.
22355+ sb128_none = true;
22356+ sb128_ab = Some(part128);
22357+ }
2220722358 if matches!(part128, PARTITION_HORZ | PARTITION_VERT) {
2220822359 // Two 128x64 (HORZ) or two 64x128 (VERT) inter blocks; the
2220922360 // whole 128x128 root is consumed here, so the remaining
@@ -22300,6 +22451,80 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
2230022451 )?
2230122452 };
2230222453 }
22454+ if let Some(part128) = sb128_ab {
22455+ // libaom `decode_partition` (decodeframe.c): HORZ_A = TL, TR,
22456+ // bottom half; HORZ_B = top half, BL, BR; VERT_A = TL, BL,
22457+ // right half; VERT_B = left half, TR, BR. AB only comes from
22458+ // the full alphabet symbol (both halves in frame), so there is
22459+ // no `i > 0` edge break to mirror.
22460+ let at128 = ((sb_r & !1) as usize * 4, (sb_c & !1) as usize * 4);
22461+ let base_mi = sub16_to_mi(at128);
22462+ let (br_mi, bc_mi) = (base_mi.0 + 16, base_mi.1 + 16);
22463+ let (q_r, q_c) = ((sb_r & !1) as usize, (sb_c & !1) as usize);
22464+ let _vert_ab = (part128 == PARTITION_VERT_A || part128 == PARTITION_VERT_B)
22465+ .then(crate::encode::Reach::vert_ab_partition);
22466+ let cdef_copy = |src: (usize, usize), dst: (usize, usize)| {
22467+ CDEF_IDX_GRID.with(|g| {
22468+ let mut g = g.borrow_mut();
22469+ let cols = CDEF_SB_COLS.with(|c| c.get());
22470+ if cols == 0 {
22471+ return;
22472+ }
22473+ let (si, di) = (
22474+ (q_r + src.0) * cols + q_c + src.1,
22475+ (q_r + dst.0) * cols + q_c + dst.1,
22476+ );
22477+ if q_c + src.1 < cols && q_c + dst.1 < cols && si < g.len() && di < g.len()
22478+ {
22479+ g[di] = g[si];
22480+ }
22481+ });
22482+ };
22483+ macro_rules! square64_inter {
22484+ ($at_mi:expr) => {{
22485+ CDEF_TRANSMITTED.with(|c| c.set(false));
22486+ inter_piece!(
22487+ $at_mi, SB,
22488+ TxbSet::Luma64, TxbSet::Luma64, TxbSet::Chroma32, TX32, TX32,
22489+ &scan32, &scan32, 3, SB, SB
22490+ );
22491+ }};
22492+ }
22493+ macro_rules! half128_inter {
22494+ ($at_mi:expr, $bw:expr, $bh:expr, $src:expr, $dst:expr) => {{
22495+ CDEF_TRANSMITTED.with(|c| c.set(false));
22496+ inter_piece!(
22497+ $at_mi, SB * 2,
22498+ TxbSet::Luma64, TxbSet::Luma64, TxbSet::Chroma32, TX32, TX32,
22499+ &scan32, &scan32, 3, $bw, $bh
22500+ );
22501+ cdef_copy($src, $dst);
22502+ }};
22503+ }
22504+ match part128 {
22505+ PARTITION_HORZ_A => {
22506+ square64_inter!(base_mi);
22507+ square64_inter!((base_mi.0, bc_mi));
22508+ half128_inter!((br_mi, base_mi.1), 128, 64, (1, 0), (1, 1));
22509+ }
22510+ PARTITION_HORZ_B => {
22511+ half128_inter!(base_mi, 128, 64, (0, 0), (0, 1));
22512+ square64_inter!((br_mi, base_mi.1));
22513+ square64_inter!((br_mi, bc_mi));
22514+ }
22515+ PARTITION_VERT_A => {
22516+ square64_inter!(base_mi);
22517+ square64_inter!((br_mi, base_mi.1));
22518+ half128_inter!((base_mi.0, bc_mi), 64, 128, (0, 1), (1, 1));
22519+ }
22520+ _ => {
22521+ half128_inter!(base_mi, 64, 128, (0, 0), (1, 0));
22522+ square64_inter!((base_mi.0, bc_mi));
22523+ square64_inter!((br_mi, bc_mi));
22524+ }
22525+ }
22526+ continue;
22527+ }
2230322528 if let Some(part128) = sb128_rect {
2230422529 // lane-sb128c r7: libaom `decode_partition` (decodeframe.c:1554)
2230522530 // codes PARTITION_HORZ at the 128 root as `subsize =
crates/ec-av1/src/refusal_inventory.rsmodified+1 -1
@@ -43,7 +43,7 @@ const REFUSALS: &[&str] = &[
4343 "a tx_type symbol outside its CDF's own set: {t}",
4444 "an INTER 32x32 partition type this decoder does not code (value={part32})",
4545 "a superblock-level partition value outside PARTITION_NONE..PARTITION_VERT_4",
46- "a 128x128 superblock AB partition (HORZ_A/HORZ_B/VERT_A/VERT_B at the 128 root)",
46+ "a 128x128 superblock partition value outside the 8-symbol alphabet",
4747 "an inter var-tx tree with a leaf transform larger than 64x64",
4848 "CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (every one of their size gates caps at 64x64 or below, so none of these symbols exists there)",
4949 "intrabc under a 128x128 superblock (libaom's av1_is_dv_valid derives the block-vector delay from sb_size, which this decoder hardcodes to 64)",
crates/ec-av1/src/stream.rsmodified+180 -0
@@ -98,6 +98,13 @@ pub fn intra_sb128_counters() -> (usize, usize, [usize; 3]) {
9898 crate::decode::intra_sb128_hits()
9999 }
100100
101+/// lane-sb128c r9: the four AB shapes at the 128 root, in `PARTITION_HORZ_A`,
102+/// `_HORZ_B`, `_VERT_A`, `_VERT_B` order (key and inter tile paths share the
103+/// counter -- it is bumped where the root symbol resolves).
104+pub fn sb128_ab_counters() -> [usize; 4] {
105+ crate::decode::part128_ab_hits()
106+}
107+
101108 pub fn rect4_32_counters() -> (usize, usize, usize) {
102109 (
103110 crate::decode::rect4_32_horz_hits(),
@@ -19308,6 +19315,179 @@ mod tests {
1930819315 );
1930919316 }
1931019317
19318+ /// lane-sb128c r9 GATE: the four AB shapes at the 128 root
19319+ /// (`PARTITION_HORZ_A`/`_HORZ_B`/`_VERT_A`/`_VERT_B`), each one
19320+ /// 128x64/64x128 half plus two 64x64 quadrants in libaom
19321+ /// `decode_partition`'s visit order. The recipe is r8's measured one
19322+ /// (`--sb-size=128 --min-partition-size=64 --enable-ab-partitions=1` over
19323+ /// a 512x512 `geq` sinusoid), which is what made aomenc pick the shapes at
19324+ /// all; arms cover cq 18/45, 8 and 10 bit, and one INTER arm
19325+ /// (`--kf-max-dist=100`) so the shapes are exercised on both tile paths.
19326+ /// Continue-and-sweep: an arm that stops on ANOTHER lane's named refusal
19327+ /// is counted and skipped, a decode failure or a pixel mismatch is a hard
19328+ /// failure, and the end-of-sweep assert names which of the four fired.
19329+ #[test]
19330+ fn a_real_aomenc_sb128_ab_partition_at_the_128_root_decodes_pixel_exact() {
19331+ const NAME: &str = "a_real_aomenc_sb128_ab_partition_at_the_128_root_decodes_pixel_exact";
19332+ let _gate_lock = lock_gate_counters();
19333+ if !have_ffmpeg() {
19334+ eprintln!("SKIP {NAME}: no ffmpeg");
19335+ return;
19336+ }
19337+ if !have_aomenc() {
19338+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
19339+ return;
19340+ }
19341+ // (tag, cq, width, height, 10-bit, inter)
19342+ let arms: Vec<(u32, &str, usize, usize, bool, bool)> = vec![
19343+ (18, "--cq-level=18", 512, 512, false, false),
19344+ (45, "--cq-level=45", 512, 512, false, false),
19345+ (32, "--cq-level=32", 512, 512, true, false),
19346+ (55, "--cq-level=55", 384, 320, false, false),
19347+ (91, "--cq-level=45", 512, 512, false, true),
19348+ (92, "--cq-level=18", 512, 512, false, true),
19349+ ];
19350+ let (mut matched, mut named_refusals, mut out_of_scope) = (0u32, 0u32, 0u32);
19351+ let mut ab_seen = [0usize; 4];
19352+ let mut ab_inter = [0usize; 4];
19353+ for (tag, cq, width, height, ten_bit, inter) in arms {
19354+ let pix = if ten_bit { "yuv420p10le" } else { "yuv420p" };
19355+ let y4m = Command::new("ffmpeg")
19356+ .args([
19357+ "-v", "error", "-f", "lavfi", "-i",
19358+ // Same DETERMINISTIC sinusoid source that made aomenc pick
19359+ // the AB shapes in the r8 sweep (lavfi `gradients` ignores
19360+ // its seed and is not reproducible -- never use it here).
19361+ &format!(
19362+ "nullsrc=size={width}x{height}:rate=25,format=yuv420p,\
19363+ geq=lum='128+80*sin((X+3*N)/17)+50*sin(Y/29)+30*sin((X+Y)/13)':\
19364+ cb='128+30*sin(X/23)':cr='128+30*sin((Y+N)/19)'"
19365+ ),
19366+ "-pix_fmt", pix, "-strict", "-1", "-t", "0.2",
19367+ "-f", "yuv4mpegpipe", "-",
19368+ ])
19369+ .stdin(Stdio::null())
19370+ .stdout(Stdio::piped())
19371+ .stderr(Stdio::piped())
19372+ .output()
19373+ .expect("ffmpeg failed to run");
19374+ assert!(
19375+ y4m.status.success(),
19376+ "{NAME}: ffmpeg fixture: {}",
19377+ String::from_utf8_lossy(&y4m.stderr)
19378+ );
19379+ let mut args: Vec<&str> = vec![
19380+ "--codec=av1", "--passes=1", "--end-usage=q", cq,
19381+ "--cpu-used=0", "--threads=1", "--row-mt=0",
19382+ "--sb-size=128", "--min-partition-size=64",
19383+ "--enable-rect-partitions=1", "--enable-ab-partitions=1",
19384+ "--enable-1to4-partitions=0", "--enable-palette=0",
19385+ "--enable-intrabc=0", "--deltaq-mode=0", "--limit=5",
19386+ ];
19387+ // AOMENC FLAG PRECEDENCE: last occurrence wins, so the per-arm
19388+ // key-frame cadence goes AFTER the base recipe.
19389+ args.push(if inter { "--kf-max-dist=100" } else { "--kf-max-dist=1" });
19390+ if ten_bit {
19391+ args.extend_from_slice(&["--input-bit-depth=10", "--bit-depth=10"]);
19392+ }
19393+ args.extend_from_slice(&["--obu", "-o", "-", "-"]);
19394+ let mut child = Command::new(aomenc_path())
19395+ .args(&args)
19396+ .stdin(Stdio::piped())
19397+ .stdout(Stdio::piped())
19398+ .stderr(Stdio::piped())
19399+ .spawn()
19400+ .expect("aomenc failed to start");
19401+ child
19402+ .stdin
19403+ .take()
19404+ .expect("aomenc stdin")
19405+ .write_all(&y4m.stdout)
19406+ .expect("writing y4m to aomenc");
19407+ let out = child.wait_with_output().expect("aomenc failed to run");
19408+ assert!(
19409+ out.status.success(),
19410+ "{NAME}: aomenc refused the fixture: {}",
19411+ String::from_utf8_lossy(&out.stderr)
19412+ );
19413+ let stream = out.stdout;
19414+ let before = sb128_ab_counters();
19415+ if let Err(e) = decode_stream(&stream) {
19416+ let msg = e.to_string();
19417+ assert!(
19418+ msg.contains("unsupported"),
19419+ "{NAME} failed outright, not a named refusal \
19420+ (arm {tag} {width}x{height}): {msg}"
19421+ );
19422+ named_refusals += 1;
19423+ eprintln!("{NAME}: arm {tag} {width}x{height} refusal: {msg}");
19424+ continue;
19425+ }
19426+ let (frames, hidden) = decode_all_frames_vs_oracle(
19427+ &stream,
19428+ &format!("sb128c-ab-{tag}-{width}x{height}"),
19429+ );
19430+ assert!(frames > 0, "{NAME}: no frames decoded at {width}x{height}");
19431+ let after = sb128_ab_counters();
19432+ let ab: Vec<usize> = (0..4).map(|i| after[i] - before[i]).collect();
19433+ eprintln!(
19434+ "{NAME}: arm {tag} cq {cq} {width}x{height} {}bit {}: {frames} frames \
19435+ pixel-exact ({hidden} hidden), AB[HORZ_A,HORZ_B,VERT_A,VERT_B] {ab:?}",
19436+ if ten_bit { 10 } else { 8 },
19437+ if inter { "INTER" } else { "KEY" },
19438+ );
19439+ if ab.iter().sum::<usize>() == 0 {
19440+ out_of_scope += 1;
19441+ }
19442+ for i in 0..4 {
19443+ ab_seen[i] += ab[i];
19444+ if inter {
19445+ ab_inter[i] += ab[i];
19446+ }
19447+ }
19448+ matched += 1;
19449+ }
19450+ assert!(
19451+ matched > 0,
19452+ "{NAME}: every attempt refused ({named_refusals}); the gate never \
19453+ decoded a stream"
19454+ );
19455+ assert!(
19456+ ab_seen.iter().sum::<usize>() > 0,
19457+ "{NAME}: {matched} stream(s) decoded pixel-exact ({out_of_scope} carried \
19458+ no 128-root AB partition at all) but NOT ONE AB shape fired -- the \
19459+ shapes this gate exists for"
19460+ );
19461+ // Which of the four this sweep actually reaches, hard-asserted so a
19462+ // later change that stops reaching one of them fails here instead of
19463+ // silently narrowing the gate (class `gate-blind-to-feature`).
19464+ for (i, name) in ["HORZ_A", "HORZ_B", "VERT_A", "VERT_B"].iter().enumerate() {
19465+ if AB_ARMS_REACHED[i] {
19466+ assert!(
19467+ ab_seen[i] > 0,
19468+ "{NAME}: PARTITION_{name} at the 128 root fired in the round that \
19469+ pinned this gate but not now: {ab_seen:?}"
19470+ );
19471+ } else {
19472+ eprintln!(
19473+ "{NAME}: PARTITION_{name} NOT reached by this sweep (aomenc never \
19474+ picked it): {ab_seen:?}"
19475+ );
19476+ }
19477+ }
19478+ assert!(
19479+ ab_inter.iter().sum::<usize>() > 0,
19480+ "{NAME}: the AB shapes fired only on KEY frames -- the inter tile path's \
19481+ own AB arm was never exercised: key {ab_seen:?} inter {ab_inter:?}"
19482+ );
19483+ }
19484+
19485+ /// Which of the four 128-root AB shapes the gate above MEASURED aomenc
19486+ /// picking (lane-sb128c r9). An arm that is `false` is not reachable from
19487+ /// this sweep's recipes and stays unasserted rather than weakening the
19488+ /// asserts of the ones that are.
19489+ const AB_ARMS_REACHED: [bool; 4] = [true, true, true, true];
19490+
1931119491 #[test]
1931219492 #[ignore = "lane-sb128 r2 diagnostic: is the frame-6 mismatch sb128-specific?"]
1931319493 fn sb128_r2_control_sb64() {
lanes/sb128c-r9.report.mdadded+81 -0
@@ -0,0 +1,81 @@
1+# lane-sb128c r9 -- the four AB shapes at the 128 root (key + inter)
2+
3+Branch `lane-sb128c`, worktree `edith_codecs-sb128c`,
4+`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sb128c`.
5+
6+## What changed
7+
8+- `crates/ec-av1/src/decode.rs` `read_sb128_root`: the AB refusal is LIFTED.
9+ Values 4..7 now count into `PART128_AB_HITS` (`part128_ab_hits()`), and the
10+ `_` arm refuses only a value outside the 8-symbol alphabet.
11+- `crates/ec-av1/src/decode.rs` key-frame tile: a new arm decodes each AB
12+ shape as two 64x64 squares (`decode_block`, `SB`, `Luma64`/`Chroma32`) plus
13+ one 128x64/64x128 half (`decode_block_128rect`, r8) in libaom
14+ `decode_partition`'s order -- HORZ_A = TL, TR, bottom half; HORZ_B = top
15+ half, BL, BR; VERT_A = TL, BL, right half; VERT_B = left half, TR, BR --
16+ with `Reach::vert_ab_partition` live for the two VERT arms (r6 visit order,
17+ class `visit-order-changes-availability`), `CDEF_TRANSMITTED` reset per
18+ piece (one CDEF unit each, so libaom's per-unit `cdef_transmitted[index]`),
19+ and the half's `cdef_idx` copied to the second 64x64 unit it covers.
20+- `crates/ec-av1/src/decode.rs` inter tile: the same four arms through
21+ `inter_piece!` (`SB`/`SB*2` with `ww`/`wh` = the true footprint).
22+- `crates/ec-av1/src/stream.rs` `sb128_ab_counters()`; new gate
23+ `a_real_aomenc_sb128_ab_partition_at_the_128_root_decodes_pixel_exact`.
24+- `crates/ec-av1/src/refusal_inventory.rs`: the 128-root AB string is replaced
25+ by the alphabet-bound one.
26+
27+## Gate: RED -- and the divergence is NOT in the AB code
28+
29+`cargo test -p ec-av1 --lib ab_partition_at_the_128_root -- --nocapture`
30+fails on its FIRST arm: `sb128c-ab-18-512x512` decode-order frame 0 differs
31+from the oracle at byte 319 (ours 105 vs 107), 326839 bytes differ.
32+
33+Frame 0 of that stream contains **no AB partition at all** (`EC_AV1_TRACE`
34+`partition_w128` values for its 16 roots are 2,2,2,0,0,3,3,0,... ; the first
35+value in 4..7 is the 38th root, i.e. frame 2). The first differing sample is
36+(x=317..319, y=0), inside the LEFT 64x128 half of the third 128 root, which is
37+`PARTITION_VERT` -- r8's `decode_block_128rect`, untouched this round.
38+
39+Hand sweep of four 512x512/384x320 arms (`$HOME/.cache/sb128c-r9/cmp.sh`,
40+oracle `aomdec` vs our `decode_probe`, `EC_AV1_FINAL_DUMP` per frame):
41+
42+| stream | first differing byte (frame 0) | AB values in stream |
43+|---|---|---|
44+| 512x512 cq18 key | 320 (x=319,y=0) | HORZ_A x3 |
45+| 512x512 cq45 key | 318 | HORZ_B x1, VERT_B x1 |
46+| 512x512 cq45 inter (`--kf-max-dist=100`) | 319 | HORZ_A x1 |
47+| 384x320 cq55 key | 95531 (x=299,y=248), frame 2 exact | none |
48+| 512x512 cq45 key, `--enable-ab-partitions=0` | 318 | (aomenc still emitted one HORZ_B) |
49+
50+The last row is the control: the SAME byte-318 divergence with the AB flag
51+off, so the 512x512 defect is independent of this round's code.
52+
53+EVIDENCE: $HOME/.cache/sb128c-gate-r9.log + $HOME/.cache/sb128c-r9/{ab18,ab45,abi45,ab55,noab}.obu | cargo test ab_partition_at_the_128_root --nocapture; cmp.sh per stream | 5/5 512x512 arms differ at byte 317..320 of frame 0, a frame with zero AB partitions
54+
55+## Film (1080p 10-bit AV1)
56+
57+| stream | r9 stop |
58+|---|---|
59+| `~/.cache/reelc-head.obu` | OK, 48 frames decoded, 1920x792 |
60+| `-ss 900` 2 s | "an inter 16x16-level AB or 1:4 partition" (another lane) |
61+| `-ss 9000` 2 s | "an inter SB-level AB partition" (the 64 root, another lane) |
62+
63+Unchanged vs r8 -- the 128-root AB was not the film's next wall at these
64+offsets.
65+
66+EVIDENCE: $HOME/.cache/sb128c-r9/{x900,x9000}.obu | decode_probe on head + two 2 s extracts | 48/48 frames on the head, two named refusals from OTHER lanes' 16x16/64-root AB gaps
67+
68+## Suite
69+
70+NOT run this round (60-minute deadline spent on the divergence bisection).
71+The new gate is RED, so the suite is 388 tests with 1 failure until the
72+512x512 128-rect defect is fixed.
73+
74+## Residue
75+
76+- fix-now (next round): the 512x512 `decode_block_128rect` divergence at
77+ (x~317, y=0) of a `PARTITION_VERT` 128 root. Pinned streams above; the
78+ `--enable-ab-partitions=0` control isolates it from this round's work. Class
79+ `refusal-hides-a-defect`: r8's gate only ran 192x256/384x320 VERT sources,
80+ which never reached it.
81+- deferred: intra `tx_depth` > 0 at the 128 root (r8 residue, unchanged).