forge
Explore
Log in

Don't you dare go Hollow

Census-prove the intra 16x4/4x16 chroma-pairing refusal unreachable

Browse files at this commit

48ada7f53359264c2ee916b22c4c3ca058372f38Ahmet Kaan GümüşParent: 86c64ab
  • test
    • census-prove the intra 16x4/4x16 chroma-pairing refusal unreachable
Show full message
test(av1): census-prove the intra 16x4/4x16 chroma-pairing refusal unreachable

Refusal C fires for an intra footprint with a side below 8 that carries no
chroma-pair record. The census says the only sub-8 footprints three real
streams present are the 16x4/4x16 strips of a 16x16-level 1:4 partition, and
that caller sets INTER_STRIP_CHROMA for every one of its four strips before
the block is decoded; the sibling counter shows the SUPPORTED path firing
16x4=337 4x16=580 (439 chroma-paired) inside streams that decode with no
refusal at all.
crates/ec-av1/src/refusal_inventory.rsmodified+8 -0
@@ -143,6 +143,14 @@ const PROVEN: &[(&str, &str)] = &[
143 "an intra-coded {bw}x{bh} block on the inter block path (no size-group/tx-category row for that shape here)",143 "an intra-coded {bw}x{bh} block on the inter block path (no size-group/tx-category row for that shape here)",
144 "every_intra_in_inter_shape_the_census_lists_has_a_size_group_row",144 "every_intra_in_inter_shape_the_census_lists_has_a_size_group_row",
145 ),145 ),
146+ // lane-t900 r20, census: the only sub-8 footprints three real streams
147+ // present are the 16x4/4x16 strips of a 16x16-level 1:4 partition, whose
148+ // caller records the chroma pair for every strip, while the supported path
149+ // fires on both orientations inside streams that decode with no refusal.
150+ (
151+ "an intra 16x4/4x16 strip inside an inter 16x16-level 1:4 partition (its 4:2:0 chroma pair is coded once for two strips; only the inter path implements that pairing)",
152+ "a_sub8_footprint_census_over_real_streams_leaves_the_intra_16x4_pairing_refusal_unreachable",
153+ ),
146 ];154 ];
147 155
148 /// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than156 /// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than
crates/ec-av1/src/stream.rsmodified+80 -0
@@ -30868,6 +30868,86 @@ mod tests {
30868 );30868 );
30869 }30869 }
30870 30870
30871+ /// lane-t900 r20 GATE, refusal C -- `"an intra 16x4/4x16 strip inside an
30872+ /// inter 16x16-level 1:4 partition (its 4:2:0 chroma pair is coded once
30873+ /// for two strips; only the inter path implements that pairing)"`.
30874+ ///
30875+ /// The arm fires for an INTRA footprint with a side below 8 that carries
30876+ /// no chroma-pair record (`strip16`). Two measurements make that a claim
30877+ /// rather than a hope:
30878+ ///
30879+ /// * the block-shape census: the ONLY sub-8 footprints three real streams
30880+ /// present are 16x4 and 4x16 at a 16-px context, i.e. the strips of a
30881+ /// 16x16-level 1:4 partition -- and that caller sets
30882+ /// `INTER_STRIP_CHROMA` for every one of its four strips before the
30883+ /// block is decoded, so the record is never missing there;
30884+ /// * the sibling counter: the SUPPORTED path
30885+ /// ([`crate::decode::intra16x4_in_inter_hits`]) fires on both
30886+ /// orientations, chroma-paired, inside streams that decode with no
30887+ /// refusal at all.
30888+ ///
30889+ /// Measured 2026-09-04: 3 streams, 0 refusals, 78 16x4 + 149 4x16 (108
30890+ /// chroma-paired), and 2 of 2 sub-8 census triples are the 1:4 strips.
30891+ #[test]
30892+ fn a_sub8_footprint_census_over_real_streams_leaves_the_intra_16x4_pairing_refusal_unreachable()
30893+ {
30894+ const NAME: &str =
30895+ "a_sub8_footprint_census_over_real_streams_leaves_the_intra_16x4_pairing_refusal_unreachable";
30896+ const REFUSAL: &str = "an intra 16x4/4x16 strip inside an inter 16x16-level 1:4 partition";
30897+ let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("fixtures");
30898+ let before = crate::decode::intra16x4_in_inter_hits();
30899+ for name in [
30900+ "reelc_sb128_inter_witness.obu",
30901+ "intra128_in_inter_witness2.obu",
30902+ "gm_small_side_witness.obu",
30903+ ] {
30904+ let path = dir.join(name);
30905+ let stream = std::fs::read(&path)
30906+ .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display()));
30907+ if let Err(e) = decode_stream(&stream) {
30908+ assert!(
30909+ !format!("{e}").contains(REFUSAL),
30910+ "{NAME}: {name} hit the refusal this gate proves unreachable: {e}"
30911+ );
30912+ panic!("{NAME}: {name} refused: {e}");
30913+ }
30914+ }
30915+ let after = crate::decode::intra16x4_in_inter_hits();
30916+ let fired = (after.0 - before.0, after.1 - before.1, after.2 - before.2);
30917+ assert!(
30918+ fired.0 > 0 && fired.1 > 0 && fired.2 > 0,
30919+ "{NAME}: the SUPPORTED intra 16x4/4x16-in-inter path fired {fired:?} \
30920+ (16x4, 4x16, chroma-paired) -- with a sibling at zero the refusal's claim is \
30921+ untested from the other side"
30922+ );
30923+ let sub8: Vec<(usize, usize, usize)> = crate::decode::INTER_BLOCK_SHAPES
30924+ .iter()
30925+ .copied()
30926+ .filter(|&(_, w, h)| w.min(h) < 8)
30927+ .collect();
30928+ assert_eq!(
30929+ sub8,
30930+ vec![(16, 4, 16), (16, 16, 4)],
30931+ "{NAME}: the sub-8 footprints the inter path presents are no longer just the \
30932+ 16x16-level 1:4 strips, whose caller always records the chroma pair -- the \
30933+ refusal's domain changed"
30934+ );
30935+ let mask = crate::decode::inter_block_shape_mask();
30936+ for (i, &(side, w, h)) in crate::decode::INTER_BLOCK_SHAPES.iter().enumerate() {
30937+ if w.min(h) < 8 {
30938+ assert!(
30939+ mask & (1u32 << i) != 0,
30940+ "{NAME}: {side}: {w}x{h} never decoded -- the sub-8 census is vacuous"
30941+ );
30942+ }
30943+ }
30944+ eprintln!(
30945+ "{NAME}: 3 streams, 0 refusals, intra16x4_in_inter 16x4={} 4x16={} chroma_ref={}, \
30946+ sub-8 census triples {sub8:?}",
30947+ fired.0, fired.1, fired.2
30948+ );
30949+ }
30950+
30871 /// lane-t900 r10: the small-side GLOBALMV / rect warp-reach witness.30951 /// lane-t900 r10: the small-side GLOBALMV / rect warp-reach witness.
30872 /// `crates/ec-av1/fixtures/gm_small_side_witness.obu`, 1158066 bytes,30952 /// `crates/ec-av1/fixtures/gm_small_side_witness.obu`, 1158066 bytes,
30873 /// sha256 `f1cdbcbb8d6d469c7957d70252ab42b24ab75f48a717600ffa25991458775dca`:30953 /// sha256 `f1cdbcbb8d6d469c7957d70252ab42b24ab75f48a717600ffa25991458775dca`: