forge
Explore
Log in

Don't you dare go Hollow

lane-av1-444interband: pin t6 as the 444 inter-strip band gate

Browse files at this commit

edc72e040b282fbd01b5f4a7924b2f270b84ab7bAhmet Kaan GümüşParent: 808012f
Main-review P2: the t6 exactness claim had no in-tree gate. Pin the
fixture (force-added, 32487 bytes, sha256 1e6dd4e05038c8d51e2c8d29f8c337
130c4fea0aed629415535e6e53af9a2c72, FNV1a64 52789f0fce2d1e52 per the
crate's pin convention) and add a_lossless_444_defaultp_inter_strip_
stream_decodes_byte_exact: len+FNV pin, the 1:4 counter delta pinned to
horz4=20 vert4=28 chroma_pairs=0, and the env-conditional aomdec arm
requiring all 6 frames sample-exact (av1llpredgate2's pattern).

Mutation-proven load-bearing: reverting the ss-0 filter makes the gate
fail at the pre-fix Golomb-tail refusal; restored, green -- the
a_lossless battery is now 8 passed 0 failed, cargo check 0 warnings.
crates/ec-av1/fixtures/ll444_defaultp_inter_strip.obuadded+0 -0

Binary file changed

crates/ec-av1/src/stream.rsmodified+108 -0
@@ -5745,6 +5745,114 @@ pub(crate) mod tests {
5745 }5745 }
5746 }5746 }
5747 5747
5748+ /// lane-av1-444interband: the DEFAULT-partition lossless 4:4:4 pin for
5749+ /// the inter 16x4/4x16 strip's chroma band stamping (the pair_chroma
5750+ /// 4:2:0-only gate, commit d5325172). Fixture pinned into `fixtures/`:
5751+ /// testsrc2 128x96 yuv444p, aomenc `--profile=1 --lossless=1
5752+ /// --enable-palette=0 --enable-intrabc=0 --passes=1 --cpu-used=4
5753+ /// --limit=6 --obu` (the av1llkf.report.md recipe), 6 frames; 32487
5754+ /// bytes, sha256
5755+ /// `1e6dd4e05038c8d51e2c8d29f8c337130c4fea0aed629415535e6e53af9a2c72`.
5756+ ///
5757+ /// This is the stream whose frame 1 desynced at the 16x4 inter strip
5758+ /// mi(2,8) -- its U bc=0 `txb_skip` read base 0 where aom reads base 1,
5759+ /// because the skipped strip (1,8)'s pair-form context stamp smeared
5760+ /// zero over `left[2][1]`. Two pins, both measured at d5325172:
5761+ /// end-to-end, every sample of every frame must match the oracle
5762+ /// aomdec exactly (the pre-fix tree refuses mid-frame-1, so the gate
5763+ /// is red by refusal, not by silent pass), and the 1:4 counter delta
5764+ /// must show the strips decoded WITHOUT the pair rewrite firing
5765+ /// (`horz4=20 vert4=28 chroma_pairs=0` -- chroma_pairs > 0 on this
5766+ /// pairless 4:4:4 stream is the defect reappearing, the
5767+ /// class `pair-rewrite-at-ss0`).
5768+ #[test]
5769+ fn a_lossless_444_defaultp_inter_strip_stream_decodes_byte_exact() {
5770+ const NAME: &str = "a_lossless_444_defaultp_inter_strip_stream_decodes_byte_exact";
5771+ const FIXTURE_LEN: usize = 32487;
5772+ const FIXTURE_FNV: u64 = 0x5278_9f0f_ce2d_1e52;
5773+ const W: usize = 128;
5774+ const H: usize = 96;
5775+ const FRAMES: usize = 6;
5776+ let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
5777+ .join("fixtures/ll444_defaultp_inter_strip.obu");
5778+ let stream = std::fs::read(&obu).unwrap_or_else(|e| {
5779+ panic!(
5780+ "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot run, \
5781+ which is a failure, not a skip",
5782+ obu.display()
5783+ )
5784+ });
5785+ assert_eq!(stream.len(), FIXTURE_LEN, "{NAME}: fixture length moved");
5786+ assert_eq!(fnv1a64(&stream), FIXTURE_FNV, "{NAME}: fixture bytes moved");
5787+
5788+ let _guard = lock_gate_counters();
5789+ let strips_before = decode::inter16_rect4_counters();
5790+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
5791+ panic!("{NAME}: the pinned stream no longer decodes cleanly: {e}")
5792+ });
5793+ let strips_after = decode::inter16_rect4_counters();
5794+ assert_eq!(frames.len(), FRAMES, "{NAME}: frame count");
5795+ for f in &frames {
5796+ assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions");
5797+ }
5798+ // The 1:4 strips must have fired, and the 4:2:0 pair rewrite must
5799+ // NOT have (there are no chroma pairs at ss 0/0).
5800+ let (horz4, vert4, chroma_pairs) = (
5801+ strips_after.0 - strips_before.0,
5802+ strips_after.1 - strips_before.1,
5803+ strips_after.2 - strips_before.2,
5804+ );
5805+ assert_eq!(horz4, 20, "{NAME}: HORZ_4 strip count moved");
5806+ assert_eq!(vert4, 28, "{NAME}: VERT_4 strip count moved");
5807+ assert_eq!(
5808+ chroma_pairs, 0,
5809+ "{NAME}: chroma pairs closed on a 4:4:4 stream \
5810+ (class pair-rewrite-at-ss0)"
5811+ );
5812+
5813+ // The oracle aomdec, rawvideo out: FRAMES concatenated yuv444p frames.
5814+ if aomdec_path().is_file() {
5815+ let dir = std::env::temp_dir().join(format!("ec-av1-ll444dp-{}", std::process::id()));
5816+ let _ = std::fs::remove_dir_all(&dir);
5817+ std::fs::create_dir_all(&dir).expect("scratch dir");
5818+ let raw = dir.join("aomdec.raw");
5819+ let out = Command::new(aomdec_path())
5820+ .args(["--codec=av1", "--rawvideo", "-o"])
5821+ .arg(&raw)
5822+ .arg(&obu)
5823+ .stdin(Stdio::null())
5824+ .stdout(Stdio::piped())
5825+ .stderr(Stdio::piped())
5826+ .output()
5827+ .expect("aomdec failed to run");
5828+ assert!(
5829+ out.status.success(),
5830+ "{NAME}: the oracle aomdec refused the stream: {}",
5831+ String::from_utf8_lossy(&out.stderr)
5832+ );
5833+ let ref_raw = std::fs::read(&raw).expect("aomdec rawvideo output");
5834+ let _ = std::fs::remove_dir_all(&dir);
5835+ assert_eq!(ref_raw.len(), W * H * 3 * FRAMES, "{NAME}: aomdec raw size");
5836+ for (i, f) in frames.iter().enumerate() {
5837+ let base = i * W * H * 3;
5838+ for ((plane, off), p) in [(&f.y, 0usize), (&f.u, W * H), (&f.v, 2 * W * H)]
5839+ .into_iter()
5840+ .zip(["y", "u", "v"])
5841+ {
5842+ let want = &ref_raw[base + off..base + off + W * H];
5843+ let bad = plane.iter().zip(want).filter(|&(&a, &b)| a as u8 != b).count();
5844+ assert_eq!(
5845+ bad, 0,
5846+ "{NAME}: aomdec frame {i} plane {p}: {bad} samples differ \
5847+ (class pair-rewrite-at-ss0)"
5848+ );
5849+ }
5850+ }
5851+ } else {
5852+ eprintln!("SKIP {NAME} aomdec arm: no oracle aomdec at {}", aomdec_path().display());
5853+ }
5854+ }
5855+
5748 /// lane-lossless128: a LOSSLESS key frame that codes a 128-axis5856 /// lane-lossless128: a LOSSLESS key frame that codes a 128-axis
5749 /// (`BLOCK_64X128`) intra block -- the shape libaom's `read_tx_size` forces5857 /// (`BLOCK_64X128`) intra block -- the shape libaom's `read_tx_size` forces
5750 /// to `TX_4X4` on its very first line (`decodeframe.c:1183`), so every plane5858 /// to `TX_4X4` on its very first line (`decodeframe.c:1183`), so every plane
lanes/av1444interband.report.mdmodified+14 -0
@@ -94,6 +94,20 @@ Sibling ownership clean: the edit is in `decode_inter_block`'s tail
94 untouched).94 untouched).
95 - Commit d5325172 on lane-av1-444interband. Not pushed.95 - Commit d5325172 on lane-av1-444interband. Not pushed.
96 96
97+### Addendum (review P2): the t6 pin is now an in-tree gate
98+
99+Main's review follow-up: commit
100+`ll444_defaultp_inter_strip.obu` (force-added fixture, 32487 bytes,
101+sha256 `1e6dd4e05038c8d51e2c8d29f8c337130c4fea0aed629415535e6e53af9a2c72`,
102+FNV1a64 `52789f0fce2d1e52` per the crate's pin convention) and gate
103+`a_lossless_444_defaultp_inter_strip_stream_decodes_byte_exact`
104+(stream.rs, av1llpredgate2's pinned-fixture pattern): len + FNV pin,
105+the 1:4 counter delta pinned to `horz4=20 vert4=28 chroma_pairs=0`,
106+and the env-conditional aomdec arm requiring all 6 frames sample-exact.
107+Mutation-proven load-bearing: with the ss-0 filter reverted the gate
108+fails at the pre-fix refusal; restored, it is green (8 passed in the
109+a_lossless battery).
110+
97 ## Named, not chased (spoken)111 ## Named, not chased (spoken)
98 112
99 1. `Neighbour::level` clamps `cul_level` to 7 while aom stores up to 15113 1. `Neighbour::level` clamps `cul_level` to 7 while aom stores up to 15