forge
Explore
Log in

Don't you dare go Hollow

Two gate counters incremented and never read now report and assert

Browse files at this commit

9c001a3dc30366234b6ad9b39a957a4ec971029cAhmet Kaan GümüşParent: d6f9cd4
  • test
    • two gate counters incremented and never read now report and assert
Show full message
test(av1): two gate counters incremented and never read now report and assert

class [[gate-blind-to-feature]], two instances in stream.rs `mod tests`:

- the 16x16 1:4-partition gate's `rect_residual_refusals` counted attempts
  stopping on "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs
  rectangular residual coding" and never printed or asserted it. The refusal
  string still exists in decode.rs but is narrowed past this shape: the sweep
  now reaches it ZERO times at either depth (attempt 1, the recipe r5
  recorded stopping there, decodes). Reported in the summary and pinned at 0.

- the superres census's `other` was incremented and then panicked on in the
  same arm, so the CENSUS line -- the gate's whole output -- never printed
  when an unknown refusal fired. Unknown strings are collected instead,
  counted in the summary, and asserted empty after it.
crates/ec-av1/src/stream.rsmodified+32 -4
@@ -1854,7 +1854,13 @@ mod tests {
18541854 ("auto 320x180 cq50", 320, 180, vec!["--cpu-used=4", "--superres-mode=3", "--cq-level=50"]),
18551855 ("auto 192x128 cq50", 192, 128, vec!["--cpu-used=4", "--superres-mode=3", "--cq-level=50"]),
18561856 ];
1857- let (mut decoded, mut warp, mut sub8, mut leaf8, mut other) = (0, 0, 0, 0, 0);
1857+ let (mut decoded, mut warp, mut sub8, mut leaf8) = (0, 0, 0, 0);
1858+ // lane-t900 r36 (class [[gate-blind-to-feature]]): unknown refusal
1859+ // strings used to `other += 1` and panic on the spot, so the census
1860+ // summary below -- the whole point of the gate -- never printed when
1861+ // one fired. They are collected instead, reported in the summary, and
1862+ // asserted after it.
1863+ let mut other: Vec<String> = Vec::new();
18581864 for (name, w, h, extra) in &recipes {
18591865 let mut args = extra.clone();
18601866 args.extend_from_slice(&common);
@@ -1877,14 +1883,19 @@ mod tests {
18771883 } else if e.contains(LEAF8) {
18781884 leaf8 += 1;
18791885 } else {
1880- other += 1;
1881- panic!("{name}: a superres stream stopped on a string this census does not know: {e}");
1886+ other.push(format!("{name}: {e}"));
18821887 }
18831888 }
18841889 }
18851890 }
18861891 eprintln!(
1887- "SUPERRES CENSUS: 6 streams, {decoded} decoded, warp {warp}x, sub8 {sub8}x, leaf8 {leaf8}x, other {other}x"
1892+ "SUPERRES CENSUS: 6 streams, {decoded} decoded, warp {warp}x, sub8 {sub8}x, leaf8 {leaf8}x, other {}x",
1893+ other.len()
1894+ );
1895+ assert!(
1896+ other.is_empty(),
1897+ "{} superres stream(s) stopped on a string this census does not know: {other:?}",
1898+ other.len()
18881899 );
18891900 // Measured r27: the four FIXED-denominator recipes all stop at the
18901901 // 8x8-leaf refusal, and the two `--superres-mode=3` (auto) streams
@@ -12992,6 +13003,23 @@ mod tests {
1299213003 but mismatched ffmpeg -- a defect of another shape, not a pass"
1299313004 );
1299413005 }
13006+ // lane-t900 r36 (class [[gate-blind-to-feature]]): this counter was
13007+ // incremented and never read. What it was there to prove is that the
13008+ // VERT_4 / split-tx arms' blocker is still the rect-residual refusal.
13009+ // It no longer is: `decode.rs`'s "a non-skip rectangular
13010+ // (HORZ/VERT/HORZ_B) strip needs rectangular residual coding" still
13011+ // exists but is narrowed (lane-rectres + lane-inter4 +
13012+ // lane-intrarect), and this sweep now reaches it ZERO times at either
13013+ // depth -- attempt 1, the one recipe r5 recorded stopping there,
13014+ // decodes. So the counter is reported and pinned at 0: a non-zero
13015+ // reading means the refusal came back for this shape.
13016+ eprintln!("{NAME}: rect-residual refusals over both depths: {rect_residual_refusals}");
13017+ assert_eq!(
13018+ rect_residual_refusals, 0,
13019+ "{NAME}: {rect_residual_refusals} attempt(s) stopped on \"a non-skip rectangular \
13020+ (HORZ/VERT/HORZ_B) strip needs rectangular residual coding\" -- that refusal was \
13021+ lifted for this shape and must not block the VERT_4 / split-tx arms again"
13022+ );
1299513023 // Arms 1/3/4 (HORZ_4, the odd-strip `is_chroma_reference` pair, the
1299613024 // `build_inter_predictors_sub8x8` two-mv chroma build) are proven
1299713025 // outright.