From 50503af092ea77b052d6770536f4108003fdabdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Sep 2026 02:33:57 +0300 Subject: [PATCH] test(av1): force_integer_mv motion-mode gate asserts non-vacuity per attempt The r1 gate asserted `force_integer_mv frames > 0` and `forced-2-symbol blocks > 0` only in aggregate over its 6 cq/step cells, so one lucky cell would have carried five silently vacuous ones (class gate-blind-to-feature). Both counters are now snapshotted per attempt and asserted after that attempt's pixel compare: all 6/6 cells of each bit-depth arm carry force_integer_mv=1 frames AND blocks forced onto the 2-symbol obmc alphabet (114 frames / 342 blocks per arm). Also documents at the `ref_is_scaled` site why libaom `av1_is_scaled`'s y_scale_fp half is unreachable in this decoder: a reference whose height differs from the frame's true size is refused before any tile decodes (decode.rs ~14681), so the x-only test is exact here and the y term belongs to whoever lifts that refusal. --- crates/ec-av1/src/decode.rs | 6 ++++++ crates/ec-av1/src/stream.rs | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 0d33199b..3dc1d6d2 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -12395,6 +12395,12 @@ fn decode_inter_block( // per-frame value (spec 5.9.2: coded per frame only when // `seq_force_integer_mv == SELECT_INTEGER_MV`, threaded from // `FrameHeader::force_integer_mv`). + // libaom `av1_is_scaled` is `x_scale_fp != REF_NO_SCALE || + // y_scale_fp != REF_NO_SCALE`; the y half is unreachable here + // because a reference whose height differs from this frame's + // true size is refused before any tile decodes ("a reference + // picture whose height does not match this frame's own true + // size", ~14681). Whoever lifts that refusal adds the y term. let ref_is_scaled = mc::scale_factor(py_ref.width, frame_width) != mc::REF_NO_SCALE; let proj_ok = num_proj_ref( diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 3927809a..7e1d560a 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -8171,6 +8171,13 @@ mod tests { for cq in [32u32, 45, 55] { for step in [4u32, 8] { attempts += 1; + // lane-fimv r1: per-attempt snapshots. The aggregate + // assertions below are satisfied by a single lucky cq/step + // cell; these prove EVERY attempt that decoded and + // pixel-compared really carried the header state and the + // forced alphabet under test (class gate-blind-to-feature). + let attempt_fimv_before = crate::decode::fimv_frame_hits(); + let attempt_alphabet_before = crate::decode::fimv_alphabet_hits(); let duration = frame_count as f64 / 25.0; // Flat screen-content tiles with hard edges, translating by a // whole number of pixels per frame: static enough for @@ -8306,6 +8313,19 @@ mod tests { assert_eq!(got.u, want.u, "{name} frame {i} U vs ffmpeg (cq {cq} step {step})"); assert_eq!(got.v, want.v, "{name} frame {i} V vs ffmpeg (cq {cq} step {step})"); } + assert!( + crate::decode::fimv_frame_hits() > attempt_fimv_before, + "{name} (cq {cq} step {step}): decoded and compared all \ + frames but no frame header had force_integer_mv=1 -- \ + this attempt is vacuous" + ); + assert!( + crate::decode::fimv_alphabet_hits() > attempt_alphabet_before, + "{name} (cq {cq} step {step}): no block was forced onto the \ + 2-symbol obmc alphabet by force_integer_mv while \ + allow_warped_motion=1 and num_proj_ref>=1 -- this attempt \ + is vacuous" + ); matched += 1; } }