stream: pin eight single-key-frame oracle counts, three of them by hoisting
Browse files at this commit222f4c5a8ab879cbfeeef05a80e361d67b62eacfParent: 31ca7601 changed file +31 -7
- crates/ec-av1/src/stream.rs +31 -7
crates/ec-av1/src/stream.rsmodified+31 -7
| @@ -27765,8 +27765,12 @@ pub(crate) mod tests { | |||
| 27765 | "{NAME}: the stream decoded but no coded (non-skip) rect leaf fired -- \ | 27765 | "{NAME}: the stream decoded but no coded (non-skip) rect leaf fired -- \ |
| 27766 | the gate proves nothing" | 27766 | the gate proves nothing" |
| 27767 | ); | 27767 | ); |
| 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. | ||
| 27769 | assert_eq!(frames.len(), 1, "{NAME}: expected one key frame"); | 27772 | assert_eq!(frames.len(), 1, "{NAME}: expected one key frame"); |
| 27773 | + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len()); | ||
| 27770 | assert_eq!( | 27774 | assert_eq!( |
| 27771 | ffmpeg_frames.len(), | 27775 | ffmpeg_frames.len(), |
| 27772 | frames.len(), | 27776 | frames.len(), |
| @@ -27893,8 +27897,13 @@ pub(crate) mod tests { | |||
| 27893 | // Counted only on an attempt that actually decoded AND is compared | 27897 | // Counted only on an attempt that actually decoded AND is compared |
| 27894 | // below -- a refusal never contributes to the firing assert. | 27898 | // below -- a refusal never contributes to the firing assert. |
| 27895 | let overrides = crate::decode::mode_mi_override_hits() - before; | 27899 | 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. | ||
| 27897 | assert_eq!(frames.len(), 1, "{NAME}: expected one key frame"); | 27905 | assert_eq!(frames.len(), 1, "{NAME}: expected one key frame"); |
| 27906 | + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len()); | ||
| 27898 | assert_eq!( | 27907 | assert_eq!( |
| 27899 | ffmpeg_frames.len(), | 27908 | ffmpeg_frames.len(), |
| 27900 | frames.len(), | 27909 | frames.len(), |
| @@ -28061,16 +28070,20 @@ pub(crate) mod tests { | |||
| 28061 | let cfl_blocks = crate::decode::cfl_block_hits() - before_cfl; | 28070 | let cfl_blocks = crate::decode::cfl_block_hits() - before_cfl; |
| 28062 | let angle_blocks = crate::decode::uv_angle_delta_hits() - before_angle; | 28071 | let angle_blocks = crate::decode::uv_angle_delta_hits() - before_angle; |
| 28063 | let uv_overrides = crate::decode::uv_mode_mi_override_hits() - before_uv; | 28072 | let uv_overrides = crate::decode::uv_mode_mi_override_hits() - before_uv; |
| 28064 | - let ffmpeg_frames = if depth == 10 { | 28073 | + // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is |
| 28065 | - ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) | 28074 | + // rendered with `-t 1` and `-vframes 1` (27852) -- one frame at the |
| 28066 | - } else { | 28075 | + // source's default rate 25 -- and aomenc runs with no `--limit` and |
| 28067 | - ffmpeg_decode_sequence(&stream, width, height, frames.len()) | 28076 | + // `--kf-max-dist=0` (27890), so both depths code exactly 1 frame. |
| 28068 | - }; | ||
| 28069 | assert_eq!( | 28077 | assert_eq!( |
| 28070 | frames.len(), | 28078 | frames.len(), |
| 28071 | 1, | 28079 | 1, |
| 28072 | "{NAME}: expected one key frame (depth={depth})" | 28080 | "{NAME}: expected one key frame (depth={depth})" |
| 28073 | ); | 28081 | ); |
| 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 | + }; | ||
| 28074 | assert_eq!( | 28087 | assert_eq!( |
| 28075 | ffmpeg_frames.len(), | 28088 | ffmpeg_frames.len(), |
| 28076 | frames.len(), | 28089 | frames.len(), |
| @@ -28257,6 +28270,12 @@ pub(crate) mod tests { | |||
| 28257 | // Counters read only on an attempt that decoded AND is compared. | 28270 | // Counters read only on an attempt that decoded AND is compared. |
| 28258 | let after = crate::decode::reelc_chroma_counters(); | 28271 | let after = crate::decode::reelc_chroma_counters(); |
| 28259 | let (skip_cfl, dir_pairs) = (after.0 - before.0, after.1 - before.1); | 28272 | 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"); | ||
| 28260 | let ffmpeg_frames = if depth == 10 { | 28279 | let ffmpeg_frames = if depth == 10 { |
| 28261 | ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) | 28280 | ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) |
| 28262 | } else { | 28281 | } else { |
| @@ -28584,6 +28603,11 @@ pub(crate) mod tests { | |||
| 28584 | let after = crate::decode::ab16_hits_by_arm(); | 28603 | let after = crate::decode::ab16_hits_by_arm(); |
| 28585 | let this: Vec<usize> = (0..4).map(|i| after[i] - before[i]).collect(); | 28604 | let this: Vec<usize> = (0..4).map(|i| after[i] - before[i]).collect(); |
| 28586 | eprintln!("{NAME}: {desc} decoded, arms this attempt={this:?}"); | 28605 | 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"); | ||
| 28587 | let want = if a.ten_bit { | 28611 | let want = if a.ten_bit { |
| 28588 | ffmpeg_decode_sequence_10bit(&stream, a.w, a.h, frames.len()) | 28612 | ffmpeg_decode_sequence_10bit(&stream, a.w, a.h, frames.len()) |
| 28589 | } else { | 28613 | } else { |