forge
Explore
Log in

Don't you dare go Hollow

stream: pin eight single-key-frame oracle counts, three of them by hoisting

Browse files at this commit

222f4c5a8ab879cbfeeef05a80e361d67b62eacfAhmet Kaan GümüşParent: 31ca760
Five of these gates already carried 'assert_eq!(frames.len(), 1)' but BELOW
the ffmpeg call, which is exactly why the sweep still read them as unpinned:
by the time the assert ran, the oracle had already been handed frames.len().
Hoisted above the call they are what they were meant to be -- a check on the
encode, taken before the budget is spent. The chroma-edge-filter gate's assert
is hoisted past both the 8-bit and the 10-bit arm, so one assert covers both
of its sites.

count-vacuity sweep: 25 unpinned -> 17.
crates/ec-av1/src/stream.rsmodified+31 -7
@@ -27765,8 +27765,12 @@ pub(crate) mod tests {
2776527765 "{NAME}: the stream decoded but no coded (non-skip) rect leaf fired -- \
2776627766 the gate proves nothing"
2776727767 );
27768- let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len());
27768+ // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is
27769+ // rendered with `-t 1` and `-vframes 1` (27566) -- one frame at the
27770+ // source's default rate 25 -- and aomenc runs with no `--limit` and
27771+ // `--kf-max-dist=0` (27593), so the stream codes exactly 1 frame.
2776927772 assert_eq!(frames.len(), 1, "{NAME}: expected one key frame");
27773+ let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len());
2777027774 assert_eq!(
2777127775 ffmpeg_frames.len(),
2777227776 frames.len(),
@@ -27893,8 +27897,13 @@ pub(crate) mod tests {
2789327897 // Counted only on an attempt that actually decoded AND is compared
2789427898 // below -- a refusal never contributes to the firing assert.
2789527899 let overrides = crate::decode::mode_mi_override_hits() - before;
27896- let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len());
27900+ // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is
27901+ // rendered ONCE outside this loop with `-t 1` and `-vframes 1`
27902+ // (27792) -- one frame at the source's default rate 25 -- and aomenc
27903+ // runs with no `--limit` and `--kf-max-dist=0` (27726), so both
27904+ // (rtx, filter_intra) arms code exactly 1 frame.
2789727905 assert_eq!(frames.len(), 1, "{NAME}: expected one key frame");
27906+ let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len());
2789827907 assert_eq!(
2789927908 ffmpeg_frames.len(),
2790027909 frames.len(),
@@ -28061,16 +28070,20 @@ pub(crate) mod tests {
2806128070 let cfl_blocks = crate::decode::cfl_block_hits() - before_cfl;
2806228071 let angle_blocks = crate::decode::uv_angle_delta_hits() - before_angle;
2806328072 let uv_overrides = crate::decode::uv_mode_mi_override_hits() - before_uv;
28064- let ffmpeg_frames = if depth == 10 {
28065- ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
28066- } else {
28067- ffmpeg_decode_sequence(&stream, width, height, frames.len())
28068- };
28073+ // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is
28074+ // rendered with `-t 1` and `-vframes 1` (27852) -- one frame at the
28075+ // source's default rate 25 -- and aomenc runs with no `--limit` and
28076+ // `--kf-max-dist=0` (27890), so both depths code exactly 1 frame.
2806928077 assert_eq!(
2807028078 frames.len(),
2807128079 1,
2807228080 "{NAME}: expected one key frame (depth={depth})"
2807328081 );
28082+ let ffmpeg_frames = if depth == 10 {
28083+ ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
28084+ } else {
28085+ ffmpeg_decode_sequence(&stream, width, height, frames.len())
28086+ };
2807428087 assert_eq!(
2807528088 ffmpeg_frames.len(),
2807628089 frames.len(),
@@ -28257,6 +28270,12 @@ pub(crate) mod tests {
2825728270 // Counters read only on an attempt that decoded AND is compared.
2825828271 let after = crate::decode::reelc_chroma_counters();
2825928272 let (skip_cfl, dir_pairs) = (after.0 - before.0, after.1 - before.1);
28273+ // The ENCODE's frame count: the y4m is rendered with `-t 1` and
28274+ // `-vframes 1` (28056) -- one frame at the source's default rate 25
28275+ // -- and aomenc runs with no `--limit` and `--kf-max-dist=0`
28276+ // (28088), so both depths code exactly 1 frame. Asserted ABOVE the
28277+ // oracle call.
28278+ assert_eq!(frames.len(), 1, "{NAME}: depth={depth} key frame");
2826028279 let ffmpeg_frames = if depth == 10 {
2826128280 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
2826228281 } else {
@@ -28584,6 +28603,11 @@ pub(crate) mod tests {
2858428603 let after = crate::decode::ab16_hits_by_arm();
2858528604 let this: Vec<usize> = (0..4).map(|i| after[i] - before[i]).collect();
2858628605 eprintln!("{NAME}: {desc} decoded, arms this attempt={this:?}");
28606+ // The ENCODE's frame count: every attempt's y4m is rendered with
28607+ // `-t 1` and `-vframes 1` (28367) -- one frame whatever the source's
28608+ // rate -- and aomenc carries `--limit=1` (28401), so all six arms
28609+ // code exactly 1 frame. Asserted ABOVE the oracle call.
28610+ assert_eq!(frames.len(), 1, "{NAME}: {desc} key frame");
2858728611 let want = if a.ten_bit {
2858828612 ffmpeg_decode_sequence_10bit(&stream, a.w, a.h, frames.len())
2858928613 } else {