forge
Explore
Log in

Don't you dare go Hollow

wip(sbab): partial from the interrupted round

Browse files at this commit

f7609421bc4f5f3d0e872948f4ad666474225eedAhmet Kaan GümüşParent: 566a617
Superblock-level inter AB partition arms (HORZ_A/HORZ_B/VERT_A/VERT_B at
64x64 in an inter frame) plus a per-arm hit counter; refusal line removed.
No gate yet.
crates/ec-av1/examples/decode_probe.rsmodified+6 -0
@@ -44,6 +44,12 @@ fn main() {
44 "inter_ab16: horz_a={} horz_b={} vert_a={} vert_b={}",44 "inter_ab16: horz_a={} horz_b={} vert_a={} vert_b={}",
45 ab[0], ab[1], ab[2], ab[3]45 ab[0], ab[1], ab[2], ab[3]
46 );46 );
47+ // lane-sbab r1: the superblock-level inter AB arms.
48+ let sbab = ec_av1::decode::sb_ab_inter_hits_by_arm();
49+ println!(
50+ "inter_ab64: horz_a={} horz_b={} vert_a={} vert_b={}",
51+ sbab[0], sbab[1], sbab[2], sbab[3]
52+ );
47 let ir = ec_av1::stream::inter_rect_counters();53 let ir = ec_av1::stream::inter_rect_counters();
48 println!(54 println!(
49 "inter_rect: 32x8={} 8x32={} 64x32={} 32x64={} 64x16={} 16x64={}",55 "inter_rect: 32x8={} 8x32={} 64x32={} 32x64={} 64x16={} 16x64={}",
crates/ec-av1/src/decode.rsmodified+150 -6
@@ -2219,6 +2219,22 @@ pub(crate) fn rect4_coeff_hits() -> usize {
2219 RECT4_COEFF_HITS.with(|c| c.get())2219 RECT4_COEFF_HITS.with(|c| c.get())
2220 }2220 }
2221 2221
2222+// lane-sbab r1: how many superblock-level (64x64) AB partitions fired IN AN
2223+// INTER frame, per arm, in `PARTITION_HORZ_A`, `_HORZ_B`, `_VERT_A`,
2224+// `_VERT_B` order (the intra-frame counterpart is `SB_AB_HITS`). Each arm is
2225+// two 32x32 inter squares plus one true 64x32/32x64 inter strip; the gate
2226+// asserts the arms it proves separately so a run whose RD only picked one
2227+// cannot pass as proof of the others.
2228+thread_local! {
2229+ static SB_AB_INTER_HITS: std::cell::Cell<[usize; 4]> = const { std::cell::Cell::new([0; 4]) };
2230+}
2231+
2232+/// [`SB_AB_INTER_HITS`] per arm (HORZ_A, HORZ_B, VERT_A, VERT_B at 64x64 in an
2233+/// inter frame).
2234+pub fn sb_ab_inter_hits_by_arm() -> [usize; 4] {
2235+ SB_AB_INTER_HITS.with(std::cell::Cell::get)
2236+}
2237+
2222 // lane-inter16ab r1: how many 16x16-level AB partitions fired IN AN INTER2238 // lane-inter16ab r1: how many 16x16-level AB partitions fired IN AN INTER
2223 // frame, per arm, in `PARTITION_HORZ_A`, `_HORZ_B`, `_VERT_A`, `_VERT_B`2239 // frame, per arm, in `PARTITION_HORZ_A`, `_HORZ_B`, `_VERT_A`, `_VERT_B`
2224 // order (the intra-frame counterpart is `AB16_HITS`). Each arm is two 8x82240 // order (the intra-frame counterpart is `AB16_HITS`). Each arm is two 8x8
@@ -21467,13 +21483,141 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
21467 }21483 }
21468 continue;21484 continue;
21469 }21485 }
21470- if part64 != PARTITION_SPLIT {21486+ if (PARTITION_HORZ_A..=PARTITION_VERT_B).contains(&part64) {
21471- return Err(unsupported(21487+ // lane-sbab r1: the four superblock-level AB arms on the
21472- "an inter SB-level AB partition (HORZ_A/HORZ_B/VERT_A/VERT_B; this \21488+ // INTER path -- two 32x32 inter squares plus one true
21473- decoder's inter tile path codes a superblock as NONE, SPLIT, HORZ, \21489+ // 64x32/32x64 inter strip, in libaom `decode_partition`'s own
21474- VERT, HORZ_4 or VERT_4)",21490+ // order (decodeframe.c: HORZ_A = TL, TR, bottom strip;
21475- ));21491+ // HORZ_B = top strip, BL, BR; VERT_A = TL, BL, right strip;
21492+ // VERT_B = left strip, TR, BR). Every piece is one this
21493+ // decoder already proves elsewhere: the 32x32 square is the
21494+ // `PARTITION_NONE`-under-SPLIT block below, the strip is the
21495+ // `PARTITION_HORZ`/`VERT` piece above (`inter_piece!`, which
21496+ // keeps `side = SB` for syntax/CDF and names its true
21497+ // footprint through `write_w`/`write_h`). The intra-frame
21498+ // twin of this arm is lane-part32 r4's `SB_AB_HITS` block.
21499+ SB_AB_INTER_HITS.with(|c| {
21500+ let mut h = c.get();
21501+ h[part64 - PARTITION_HORZ_A] += 1;
21502+ c.set(h);
21503+ });
21504+ // lane-part32 r5 / class visit-order-changes-availability:
21505+ // only the two VERTICAL arms visit TL, BL, TR, BR, so only
21506+ // they switch libaom's `has_tr`/`has_bl` tables.
21507+ let _vert_guard = (part64 == PARTITION_VERT_A || part64 == PARTITION_VERT_B)
21508+ .then(crate::encode::Reach::vert_ab_partition);
21509+ let (mi_row0, mi_col0) = (
21510+ sb_r as usize * SB_MI as usize,
21511+ sb_c as usize * SB_MI as usize,
21512+ );
21513+ // 32 px = 8 MI units.
21514+ let tl = (mi_row0, mi_col0);
21515+ let tr = (mi_row0, mi_col0 + 8);
21516+ let bl = (mi_row0 + 8, mi_col0);
21517+ let br = (mi_row0 + 8, mi_col0 + 8);
21518+ macro_rules! ab_strip64 {
21519+ ($mi:expr, $ww:expr, $wh:expr) => {
21520+ inter_piece!(
21521+ $mi,
21522+ SB,
21523+ TxbSet::Luma64,
21524+ TxbSet::Luma64,
21525+ TxbSet::Chroma32,
21526+ TX32,
21527+ TX32,
21528+ &scan32,
21529+ &scan32,
21530+ 3,
21531+ $ww,
21532+ $wh
21533+ )
21534+ };
21535+ }
21536+ // The 32x32 squares carry a full square residual, so unlike
21537+ // `inter_piece!` (which hardcodes `reject_residual = true`
21538+ // for its strips) they pass `false`.
21539+ macro_rules! ab_square32 {
21540+ ($mi:expr) => {
21541+ decode_inter_block(
21542+ &mut dec,
21543+ &mut cdfs,
21544+ &mut neighbours,
21545+ &mut grid,
21546+ $mi,
21547+ BLOCK,
21548+ mi_cols,
21549+ mi_rows,
21550+ &mut y,
21551+ &mut u,
21552+ &mut v,
21553+ &ref_y,
21554+ &ref_u,
21555+ &ref_v,
21556+ &ref_slots,
21557+ &sign_bias_table,
21558+ &global_motion,
21559+ base_q_idx,
21560+ TxbSet::Luma32,
21561+ TxbSet::Luma32Inter,
21562+ TxbSet::Chroma16,
21563+ TX32,
21564+ TX16,
21565+ &scan32,
21566+ &scan16,
21567+ 3,
21568+ allow_high_precision_mv,
21569+ force_integer_mv,
21570+ interp_fixed,
21571+ enable_dual_filter,
21572+ tpl_frame.as_ref(),
21573+ reference_select,
21574+ enable_masked_compound,
21575+ enable_interintra_compound,
21576+ enable_jnt_comp,
21577+ order_hint_bits,
21578+ order_hint,
21579+ ref_order_hints,
21580+ skip_mode_present,
21581+ skip_mode_frame,
21582+ switchable_motion_mode,
21583+ allow_warped_motion,
21584+ false,
21585+ BLOCK,
21586+ BLOCK,
21587+ allow_screen_content_tools,
21588+ frame_width as usize,
21589+ )?
21590+ };
21591+ }
21592+ match part64 {
21593+ PARTITION_HORZ_A => {
21594+ ab_square32!(tl);
21595+ ab_square32!(tr);
21596+ ab_strip64!(bl, 64, 32);
21597+ }
21598+ PARTITION_HORZ_B => {
21599+ ab_strip64!(tl, 64, 32);
21600+ ab_square32!(bl);
21601+ ab_square32!(br);
21602+ }
21603+ PARTITION_VERT_A => {
21604+ ab_square32!(tl);
21605+ ab_square32!(bl);
21606+ ab_strip64!(tr, 32, 64);
21607+ }
21608+ _ => {
21609+ ab_strip64!(tl, 32, 64);
21610+ ab_square32!(tr);
21611+ ab_square32!(br);
21612+ }
21613+ }
21614+ continue;
21476 }21615 }
21616+ // Every value of the 10-symbol `partition_w64` alphabet is now
21617+ // handled above except SPLIT, which falls through to the quadrant
21618+ // loop below (lane-sbab r1 took the AB four; the rect/1:4 arms
21619+ // and NONE `continue` earlier).
21620+ debug_assert_eq!(part64, PARTITION_SPLIT);
21477 21621
21478 for quadrant in 0..4 {21622 for quadrant in 0..4 {
21479 let (r32, c32) = (sb_r * 2 + quadrant / 2, sb_c * 2 + quadrant % 2);21623 let (r32, c32) = (sb_r * 2 + quadrant / 2, sb_c * 2 + quadrant % 2);
crates/ec-av1/src/refusal_inventory.rsmodified+0 -1
@@ -67,7 +67,6 @@ const REFUSALS: &[&str] = &[
67 // the 8x8 leaf's TX_4X4 2x2 grid is still refused here.67 // the 8x8 leaf's TX_4X4 2x2 grid is still refused here.
68 "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 transform units",68 "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 transform units",
69 "an inter frame with no key frame before it",69 "an inter frame with no key frame before it",
70- "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)",
71 // lane-inter16ab r1 lifted the AB half (HORZ_A/HORZ_B/VERT_A/VERT_B at70 // lane-inter16ab r1 lifted the AB half (HORZ_A/HORZ_B/VERT_A/VERT_B at
72 // the 16x16 level of an inter frame: two 8x8 inter leaves plus one true71 // the 16x16 level of an inter frame: two 8x8 inter leaves plus one true
73 // 16x8/8x16 inter strip, gate72 // 16x8/8x16 inter strip, gate