forge
Explore
Log in

Don't you dare go Hollow

The encode:: tests take the knob lock the encoder:: gates already take

Browse files at this commit

c1c9418b2d40e2b6924d5409c183e5a73a61002eAhmet Kaan GümüşParent: 5c50b7f
  • test
    • the encode:: tests take the knob lock the encoder:: gates already take
Show full message
test(av1): the encode:: tests take the knob lock the encoder:: gates already take

Same shape as 963327d2, now for `encode::tests`: `speed::KNOBS` only protects a
setter from a concurrent encode if EVERY encoding test holds the read side, and
half the crate's encodes live in this module -- `force_intrabc`,
`force_filter_intra`, `force_screen` (via `favourite_mode`),
`set_verify_final_replay` and the census counter resets are all process-global
writes that were racing the `encoder::` gates and each other under the default
`--test-threads`.

11 tests that SET a global take `knob_write()`, 41 that only encode take
`knob_read()`, and 7 pure table tests (the rect-reach/of_tu/vert_ab tables and
the tpl factor unit test) take nothing because they never reach the encoder.
tile.rs and filter_search.rs need nothing: no test there calls the search or a
knob setter. Test-only, no production path touched.

Gates: `cargo test -p ec-av1 --release --lib -- encode:: tile::` 80 passed,
the two thread-count gates `--include-ignored` 2 passed, the crate suite
548 passed / 43 ignored, `cargo check --workspace --all-targets -j4` 0 errors
and 0 ec-av1 warnings, pins 8590 / 28535 unchanged.
crates/ec-av1/src/encode.rsmodified+52 -0
@@ -10335,6 +10335,7 @@ mod tests {
10335 /// encode::tests::the_filter_search_picks_real_filters10335 /// encode::tests::the_filter_search_picks_real_filters
10336 #[test]10336 #[test]
10337 fn the_filter_search_picks_real_filters() {10337 fn the_filter_search_picks_real_filters() {
10338+ let _knobs = crate::speed::knob_read();
10338 let fctx = &crate::decode::FrameCtx::new();10339 let fctx = &crate::decode::FrameCtx::new();
10339 let pictures: Vec<_> = (0..3).map(|i| panned_test_card(128, 128, i * 3)).collect();10340 let pictures: Vec<_> = (0..3).map(|i| panned_test_card(128, 128, i * 3)).collect();
10340 let encoded = encode_sequence_with_ctx(&pictures, 120, 0.5, fctx).unwrap();10341 let encoded = encode_sequence_with_ctx(&pictures, 120, 0.5, fctx).unwrap();
@@ -10414,6 +10415,7 @@ mod tests {
10414 /// which is why this is an equality and not a tolerance.10415 /// which is why this is an equality and not a tolerance.
10415 #[test]10416 #[test]
10416 fn ffmpeg_decodes_exactly_what_the_encoder_reconstructed() {10417 fn ffmpeg_decodes_exactly_what_the_encoder_reconstructed() {
10418+ let _knobs = crate::speed::knob_read();
10417 let fctx = &crate::decode::FrameCtx::new();10419 let fctx = &crate::decode::FrameCtx::new();
10418 if !have_ffmpeg() {10420 if !have_ffmpeg() {
10419 eprintln!("SKIP ffmpeg_decodes_exactly_what_the_encoder_reconstructed: no ffmpeg");10421 eprintln!("SKIP ffmpeg_decodes_exactly_what_the_encoder_reconstructed: no ffmpeg");
@@ -10495,6 +10497,7 @@ mod tests {
10495 /// keeps every non-screen stream byte-identical.10497 /// keeps every non-screen stream byte-identical.
10496 #[test]10498 #[test]
10497 fn a_screen_content_picture_codes_palette_blocks_ffmpeg_decodes_exactly() {10499 fn a_screen_content_picture_codes_palette_blocks_ffmpeg_decodes_exactly() {
10500+ let _knobs = crate::speed::knob_read();
10498 let fctx = &crate::decode::FrameCtx::new();10501 let fctx = &crate::decode::FrameCtx::new();
10499 let (width, height) = (192usize, 96usize);10502 let (width, height) = (192usize, 96usize);
10500 let _ = crate::tile::take_palette_hits();10503 let _ = crate::tile::take_palette_hits();
@@ -10605,6 +10608,7 @@ mod tests {
10605 #[test]10608 #[test]
10606 #[ignore = "needs the real-library manifest and ffmpeg"]10609 #[ignore = "needs the real-library manifest and ffmpeg"]
10607 fn probe_intrabc_key_frame() {10610 fn probe_intrabc_key_frame() {
10611+ let _knobs = crate::speed::knob_write();
10608 let fctx = &crate::decode::FrameCtx::new();10612 let fctx = &crate::decode::FrameCtx::new();
10609 let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))10613 let fixtures = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
10610 .join("../../fixtures");10614 .join("../../fixtures");
@@ -10654,6 +10658,7 @@ mod tests {
10654 /// exactly what the encoder did.10658 /// exactly what the encoder did.
10655 #[test]10659 #[test]
10656 fn a_repeated_pattern_key_frame_codes_intrabc_blocks_ffmpeg_decodes_exactly() {10660 fn a_repeated_pattern_key_frame_codes_intrabc_blocks_ffmpeg_decodes_exactly() {
10661+ let _knobs = crate::speed::knob_write();
10657 let fctx = &crate::decode::FrameCtx::new();10662 let fctx = &crate::decode::FrameCtx::new();
10658 // Wide enough for the wavefront rule (`INTRABC_DELAY_SB64` = 410663 // Wide enough for the wavefront rule (`INTRABC_DELAY_SB64` = 4
10659 // superblocks of 64) and tall enough for a source superblock row10664 // superblocks of 64) and tall enough for a source superblock row
@@ -10712,6 +10717,7 @@ mod tests {
10712 /// same coefficient syntax decodes clean on every intra key-frame gate).10717 /// same coefficient syntax decodes clean on every intra key-frame gate).
10713 #[test]10718 #[test]
10714 fn a_nearestmv_block_with_one_nonzero_coefficient_decodes_clean() {10719 fn a_nearestmv_block_with_one_nonzero_coefficient_decodes_clean() {
10720+ let _knobs = crate::speed::knob_write();
10715 let fctx = &crate::decode::FrameCtx::new();10721 let fctx = &crate::decode::FrameCtx::new();
10716 if !have_ffmpeg() {10722 if !have_ffmpeg() {
10717 eprintln!(10723 eprintln!(
@@ -10846,6 +10852,7 @@ mod tests {
10846 /// restoration search reads are bit-identical over the frame's own crop.10852 /// restoration search reads are bit-identical over the frame's own crop.
10847 #[test]10853 #[test]
10848 fn the_final_filter_replay_matches_the_capture_decode_at_odd_sizes() {10854 fn the_final_filter_replay_matches_the_capture_decode_at_odd_sizes() {
10855+ let _knobs = crate::speed::knob_write();
10849 let fctx = &crate::decode::FrameCtx::new();10856 let fctx = &crate::decode::FrameCtx::new();
10850 crate::decode::set_verify_final_replay(true);10857 crate::decode::set_verify_final_replay(true);
10851 for &(width, height) in10858 for &(width, height) in
@@ -10874,6 +10881,7 @@ mod tests {
10874 /// `ffprobe` is asserted to report below.10881 /// `ffprobe` is asserted to report below.
10875 #[test]10882 #[test]
10876 fn a_frame_round_trips_at_its_own_size() {10883 fn a_frame_round_trips_at_its_own_size() {
10884+ let _knobs = crate::speed::knob_read();
10877 let fctx = &crate::decode::FrameCtx::new();10885 let fctx = &crate::decode::FrameCtx::new();
10878 if !have_ffmpeg() {10886 if !have_ffmpeg() {
10879 eprintln!("SKIP a_frame_round_trips_at_its_own_size: no ffmpeg");10887 eprintln!("SKIP a_frame_round_trips_at_its_own_size: no ffmpeg");
@@ -10940,6 +10948,7 @@ mod tests {
10940 /// the header's own size before output).10948 /// the header's own size before output).
10941 #[test]10949 #[test]
10942 fn an_854x480_picture_round_trips_through_its_padding() {10950 fn an_854x480_picture_round_trips_through_its_padding() {
10951+ let _knobs = crate::speed::knob_read();
10943 let fctx = &crate::decode::FrameCtx::new();10952 let fctx = &crate::decode::FrameCtx::new();
10944 if !have_ffmpeg() {10953 if !have_ffmpeg() {
10945 return;10954 return;
@@ -11185,6 +11194,7 @@ mod tests {
11185 /// or the block coder would happen to fail on it.11194 /// or the block coder would happen to fail on it.
11186 #[test]11195 #[test]
11187 fn odd_dimensions_are_refused() {11196 fn odd_dimensions_are_refused() {
11197+ let _knobs = crate::speed::knob_read();
11188 let fctx = &crate::decode::FrameCtx::new();11198 let fctx = &crate::decode::FrameCtx::new();
11189 for &(width, height) in &[(1921usize, 1080usize), (1920, 1081), (63, 63)] {11199 for &(width, height) in &[(1921usize, 1080usize), (1920, 1081), (63, 63)] {
11190 let picture = Picture::grey(width, height);11200 let picture = Picture::grey(width, height);
@@ -11203,6 +11213,7 @@ mod tests {
11203 /// own (padded) reconstruction.11213 /// own (padded) reconstruction.
11204 #[test]11214 #[test]
11205 fn sequence_round_trips_at_a_non_multiple_size() {11215 fn sequence_round_trips_at_a_non_multiple_size() {
11216+ let _knobs = crate::speed::knob_read();
11206 let fctx = &crate::decode::FrameCtx::new();11217 let fctx = &crate::decode::FrameCtx::new();
11207 if !have_ffmpeg() {11218 if !have_ffmpeg() {
11208 eprintln!("SKIP sequence_round_trips_at_a_non_multiple_size: no ffmpeg");11219 eprintln!("SKIP sequence_round_trips_at_a_non_multiple_size: no ffmpeg");
@@ -11246,6 +11257,7 @@ mod tests {
11246 /// inter tile writer's parity with it across a real multi-frame export.11257 /// inter tile writer's parity with it across a real multi-frame export.
11247 #[test]11258 #[test]
11248 fn a_sequence_round_trips_at_the_exactly_half_straddle_size() {11259 fn a_sequence_round_trips_at_the_exactly_half_straddle_size() {
11260+ let _knobs = crate::speed::knob_read();
11249 let fctx = &crate::decode::FrameCtx::new();11261 let fctx = &crate::decode::FrameCtx::new();
11250 if !have_ffmpeg() {11262 if !have_ffmpeg() {
11251 eprintln!("SKIP a_sequence_round_trips_at_the_exactly_half_straddle_size: no ffmpeg");11263 eprintln!("SKIP a_sequence_round_trips_at_the_exactly_half_straddle_size: no ffmpeg");
@@ -11291,6 +11303,7 @@ mod tests {
11291 /// actually exercised).11303 /// actually exercised).
11292 #[test]11304 #[test]
11293 fn key_frame_and_inter_frame_both_encode_at_half_straddle_size() {11305 fn key_frame_and_inter_frame_both_encode_at_half_straddle_size() {
11306+ let _knobs = crate::speed::knob_read();
11294 let fctx = &crate::decode::FrameCtx::new();11307 let fctx = &crate::decode::FrameCtx::new();
11295 let (width, height) = (640usize, 360usize);11308 let (width, height) = (640usize, 360usize);
11296 let picture = Picture::grey(width, height);11309 let picture = Picture::grey(width, height);
@@ -11310,6 +11323,7 @@ mod tests {
11310 /// only encoder-clean.11323 /// only encoder-clean.
11311 #[test]11324 #[test]
11312 fn a_640x360_half_straddle_round_trips_through_ffmpeg_across_three_frames() {11325 fn a_640x360_half_straddle_round_trips_through_ffmpeg_across_three_frames() {
11326+ let _knobs = crate::speed::knob_read();
11313 let fctx = &crate::decode::FrameCtx::new();11327 let fctx = &crate::decode::FrameCtx::new();
11314 if !have_ffmpeg() {11328 if !have_ffmpeg() {
11315 eprintln!(11329 eprintln!(
@@ -11335,6 +11349,7 @@ mod tests {
11335 /// encoder-clean (the test above) but decoder-clean against ffmpeg too.11349 /// encoder-clean (the test above) but decoder-clean against ffmpeg too.
11336 #[test]11350 #[test]
11337 fn a_640x360_half_straddle_sequence_round_trips_through_ffmpeg() {11351 fn a_640x360_half_straddle_sequence_round_trips_through_ffmpeg() {
11352+ let _knobs = crate::speed::knob_read();
11338 let fctx = &crate::decode::FrameCtx::new();11353 let fctx = &crate::decode::FrameCtx::new();
11339 if !have_ffmpeg() {11354 if !have_ffmpeg() {
11340 eprintln!(11355 eprintln!(
@@ -11394,6 +11409,7 @@ mod tests {
11394 #[test]11409 #[test]
11395 #[ignore = "a sweep, not a gate"]11410 #[ignore = "a sweep, not a gate"]
11396 fn probe_lambda() {11411 fn probe_lambda() {
11412+ let _knobs = crate::speed::knob_read();
11397 let fctx = &crate::decode::FrameCtx::new();11413 let fctx = &crate::decode::FrameCtx::new();
11398 let mut pictures = vec![11414 let mut pictures = vec![
11399 ("test card".to_string(), test_card(160, 96)),11415 ("test card".to_string(), test_card(160, 96)),
@@ -11425,6 +11441,7 @@ mod tests {
11425 #[test]11441 #[test]
11426 #[ignore = "a sweep, not a gate"]11442 #[ignore = "a sweep, not a gate"]
11427 fn probe_ladder() {11443 fn probe_ladder() {
11444+ let _knobs = crate::speed::knob_read();
11428 let fctx = &crate::decode::FrameCtx::new();11445 let fctx = &crate::decode::FrameCtx::new();
11429 for (name, picture) in sweep_pictures() {11446 for (name, picture) in sweep_pictures() {
11430 let all = ladder(&picture, &KEY_FRAME_MODES, fctx);11447 let all = ladder(&picture, &KEY_FRAME_MODES, fctx);
@@ -11443,6 +11460,7 @@ mod tests {
11443 #[test]11460 #[test]
11444 #[ignore = "a sweep, not a gate"]11461 #[ignore = "a sweep, not a gate"]
11445 fn probe_split() {11462 fn probe_split() {
11463+ let _knobs = crate::speed::knob_read();
11446 let fctx = &crate::decode::FrameCtx::new();11464 let fctx = &crate::decode::FrameCtx::new();
11447 for (name, picture) in sweep_pictures() {11465 for (name, picture) in sweep_pictures() {
11448 let ladder = |split: bool| {11466 let ladder = |split: bool| {
@@ -11524,6 +11542,7 @@ mod tests {
11524 /// over a whole picture and the reconstruction gated against ffmpeg.11542 /// over a whole picture and the reconstruction gated against ffmpeg.
11525 #[test]11543 #[test]
11526 fn every_mode_decodes_to_what_the_encoder_predicted() {11544 fn every_mode_decodes_to_what_the_encoder_predicted() {
11545+ let _knobs = crate::speed::knob_write();
11527 let fctx = &crate::decode::FrameCtx::new();11546 let fctx = &crate::decode::FrameCtx::new();
11528 if !have_ffmpeg() {11547 if !have_ffmpeg() {
11529 eprintln!("SKIP every_mode_decodes_to_what_the_encoder_predicted: no ffmpeg");11548 eprintln!("SKIP every_mode_decodes_to_what_the_encoder_predicted: no ffmpeg");
@@ -11567,6 +11586,7 @@ mod tests {
11567 /// while leaving every fidelity gate intact.11586 /// while leaving every fidelity gate intact.
11568 #[test]11587 #[test]
11569 fn the_search_picks_the_direction_the_picture_runs() {11588 fn the_search_picks_the_direction_the_picture_runs() {
11589+ let _knobs = crate::speed::knob_write();
11570 let fctx = &crate::decode::FrameCtx::new();11590 let fctx = &crate::decode::FrameCtx::new();
11571 // Same confound as [`every_mode_decodes_to_what_the_encoder_predicted`]:11591 // Same confound as [`every_mode_decodes_to_what_the_encoder_predicted`]:
11572 // a filter-intra block is coded `DC_PRED` whatever mode the arm11592 // a filter-intra block is coded `DC_PRED` whatever mode the arm
@@ -11674,6 +11694,7 @@ mod tests {
11674 /// directional pair has.11694 /// directional pair has.
11675 #[test]11695 #[test]
11676 fn the_search_beats_dc_alone() {11696 fn the_search_beats_dc_alone() {
11697+ let _knobs = crate::speed::knob_read();
11677 let fctx = &crate::decode::FrameCtx::new();11698 let fctx = &crate::decode::FrameCtx::new();
11678 for (name, picture, want) in [11699 for (name, picture, want) in [
11679 ("test card", test_card(160, 96), -0.05),11700 ("test card", test_card(160, 96), -0.05),
@@ -11716,6 +11737,7 @@ mod tests {
11716 #[test]11737 #[test]
11717 #[ignore = "a sweep, not a gate"]11738 #[ignore = "a sweep, not a gate"]
11718 fn probe_directional() {11739 fn probe_directional() {
11740+ let _knobs = crate::speed::knob_write();
11719 let fctx = &crate::decode::FrameCtx::new();11741 let fctx = &crate::decode::FrameCtx::new();
11720 for (name, picture) in sweep_pictures() {11742 for (name, picture) in sweep_pictures() {
11721 let dc = ladder(&picture, &[DC_PRED], fctx);11743 let dc = ladder(&picture, &[DC_PRED], fctx);
@@ -11790,6 +11812,7 @@ mod tests {
11790 /// the above row where it should read the left column, would swap these.11812 /// the above row where it should read the left column, would swap these.
11791 #[test]11813 #[test]
11792 fn the_search_picks_the_diagonal_the_picture_runs() {11814 fn the_search_picks_the_diagonal_the_picture_runs() {
11815+ let _knobs = crate::speed::knob_write();
11793 let fctx = &crate::decode::FrameCtx::new();11816 let fctx = &crate::decode::FrameCtx::new();
11794 for (down_right, want) in [(true, D135_PRED), (false, D45_PRED)] {11817 for (down_right, want) in [(true, D135_PRED), (false, D45_PRED)] {
11795 let picture = diagonal(160, 96, down_right);11818 let picture = diagonal(160, 96, down_right);
@@ -11809,6 +11832,7 @@ mod tests {
11809 /// it, which is what costing the mode symbol is for.11832 /// it, which is what costing the mode symbol is for.
11810 #[test]11833 #[test]
11811 fn the_diagonals_beat_the_modes_that_read_no_further() {11834 fn the_diagonals_beat_the_modes_that_read_no_further() {
11835+ let _knobs = crate::speed::knob_read();
11812 let fctx = &crate::decode::FrameCtx::new();11836 let fctx = &crate::decode::FrameCtx::new();
11813 for (name, picture, want) in [11837 for (name, picture, want) in [
11814 ("down-right", diagonal(160, 96, true), -0.20),11838 ("down-right", diagonal(160, 96, true), -0.20),
@@ -11832,6 +11856,7 @@ mod tests {
11832 /// something else, and a search with nothing to choose from likewise.11856 /// something else, and a search with nothing to choose from likewise.
11833 #[test]11857 #[test]
11834 fn a_mode_the_encoder_cannot_predict_is_refused() {11858 fn a_mode_the_encoder_cannot_predict_is_refused() {
11859+ let _knobs = crate::speed::knob_read();
11835 let fctx = &crate::decode::FrameCtx::new();11860 let fctx = &crate::decode::FrameCtx::new();
11836 let picture = test_card(64, 64);11861 let picture = test_card(64, 64);
11837 let message = encode_key_frame_with_modes_with_ctx(&picture, 100, 0.5, &[13], fctx)11862 let message = encode_key_frame_with_modes_with_ctx(&picture, 100, 0.5, &[13], fctx)
@@ -11851,6 +11876,7 @@ mod tests {
11851 /// right picture.11876 /// right picture.
11852 #[test]11877 #[test]
11853 fn the_encoded_picture_is_the_one_that_went_in() {11878 fn the_encoded_picture_is_the_one_that_went_in() {
11879+ let _knobs = crate::speed::knob_read();
11854 let fctx = &crate::decode::FrameCtx::new();11880 let fctx = &crate::decode::FrameCtx::new();
11855 let picture = test_card(160, 96);11881 let picture = test_card(160, 96);
11856 let encoded = encode_key_frame_with_ctx(&picture, 100, 0.5, fctx).unwrap();11882 let encoded = encode_key_frame_with_ctx(&picture, 100, 0.5, fctx).unwrap();
@@ -11873,6 +11899,7 @@ mod tests {
11873 /// loop above this will assume.11899 /// loop above this will assume.
11874 #[test]11900 #[test]
11875 fn fidelity_and_rate_move_with_the_quantizer() {11901 fn fidelity_and_rate_move_with_the_quantizer() {
11902+ let _knobs = crate::speed::knob_read();
11876 let fctx = &crate::decode::FrameCtx::new();11903 let fctx = &crate::decode::FrameCtx::new();
11877 let picture = test_card(128, 128);11904 let picture = test_card(128, 128);
11878 let mut previous: Option<(usize, f64)> = None;11905 let mut previous: Option<(usize, f64)> = None;
@@ -11940,6 +11967,7 @@ mod tests {
11940 /// average, which is the picture's own value, and codes nothing.11967 /// average, which is the picture's own value, and codes nothing.
11941 #[test]11968 #[test]
11942 fn a_flat_picture_costs_almost_nothing() {11969 fn a_flat_picture_costs_almost_nothing() {
11970+ let _knobs = crate::speed::knob_read();
11943 let fctx = &crate::decode::FrameCtx::new();11971 let fctx = &crate::decode::FrameCtx::new();
11944 let mut picture = Picture::grey(128, 128);11972 let mut picture = Picture::grey(128, 128);
11945 picture.y.fill(97);11973 picture.y.fill(97);
@@ -11976,6 +12004,7 @@ mod tests {
11976 /// still refused is a malformed picture.12004 /// still refused is a malformed picture.
11977 #[test]12005 #[test]
11978 fn a_picture_off_the_block_grid_encodes_and_a_malformed_one_is_refused() {12006 fn a_picture_off_the_block_grid_encodes_and_a_malformed_one_is_refused() {
12007+ let _knobs = crate::speed::knob_read();
11979 let fctx = &crate::decode::FrameCtx::new();12008 let fctx = &crate::decode::FrameCtx::new();
11980 encode_key_frame_with_ctx(&Picture::grey(40, 40), 100, 0.5, fctx)12009 encode_key_frame_with_ctx(&Picture::grey(40, 40), 100, 0.5, fctx)
11981 .expect("40x40 cuts a 16x16 leaf on both axes, which is an inferred split");12010 .expect("40x40 cuts a 16x16 leaf on both axes, which is an inferred split");
@@ -12059,6 +12088,7 @@ mod tests {
12059 /// right-most) leaf's mode. The stream now round-trips through ffmpeg.12088 /// right-most) leaf's mode. The stream now round-trips through ffmpeg.
12060 #[test]12089 #[test]
12061 fn a_single_axis_straddle_round_trips_through_ffmpeg() {12090 fn a_single_axis_straddle_round_trips_through_ffmpeg() {
12091+ let _knobs = crate::speed::knob_read();
12062 let fctx = &crate::decode::FrameCtx::new();12092 let fctx = &crate::decode::FrameCtx::new();
12063 if !have_ffmpeg() {12093 if !have_ffmpeg() {
12064 eprintln!("SKIP a_single_axis_straddle_round_trips_through_ffmpeg: no ffmpeg");12094 eprintln!("SKIP a_single_axis_straddle_round_trips_through_ffmpeg: no ffmpeg");
@@ -12088,6 +12118,7 @@ mod tests {
12088 /// synthetic pictures — real video reaches contexts a test card does not.12118 /// synthetic pictures — real video reaches contexts a test card does not.
12089 #[test]12119 #[test]
12090 fn a_frame_of_real_video_decodes_to_what_the_encoder_reconstructed() {12120 fn a_frame_of_real_video_decodes_to_what_the_encoder_reconstructed() {
12121+ let _knobs = crate::speed::knob_read();
12091 let fctx = &crate::decode::FrameCtx::new();12122 let fctx = &crate::decode::FrameCtx::new();
12092 let Ok(clip) = std::env::var("EC_AV1_CLIP") else {12123 let Ok(clip) = std::env::var("EC_AV1_CLIP") else {
12093 eprintln!(12124 eprintln!(
@@ -12219,6 +12250,7 @@ mod tests {
12219 /// just the last one, and why this is an equality and not a tolerance.12250 /// just the last one, and why this is an equality and not a tolerance.
12220 #[test]12251 #[test]
12221 fn every_frame_of_a_sequence_decodes_to_what_the_encoder_reconstructed() {12252 fn every_frame_of_a_sequence_decodes_to_what_the_encoder_reconstructed() {
12253+ let _knobs = crate::speed::knob_read();
12222 let fctx = &crate::decode::FrameCtx::new();12254 let fctx = &crate::decode::FrameCtx::new();
12223 if !have_ffmpeg() {12255 if !have_ffmpeg() {
12224 eprintln!(12256 eprintln!(
@@ -12260,6 +12292,7 @@ mod tests {
12260 /// names the first differing frame, plane and position.12292 /// names the first differing frame, plane and position.
12261 #[test]12293 #[test]
12262 fn every_frame_of_a_sequence_decodes_through_our_own_decoder() {12294 fn every_frame_of_a_sequence_decodes_through_our_own_decoder() {
12295+ let _knobs = crate::speed::knob_read();
12263 let fctx = &crate::decode::FrameCtx::new();12296 let fctx = &crate::decode::FrameCtx::new();
12264 // 256x128, not the 128x64 this started at: once a leaf could search12297 // 256x128, not the 128x64 this started at: once a leaf could search
12265 // its second reference (lane-av1comp4) the small card's every12298 // its second reference (lane-av1comp4) the small card's every
@@ -12325,6 +12358,7 @@ mod tests {
12325 /// expected to be the larger of the two).12358 /// expected to be the larger of the two).
12326 #[test]12359 #[test]
12327 fn predicted_coeff_bits_track_the_tile_the_writer_wrote() {12360 fn predicted_coeff_bits_track_the_tile_the_writer_wrote() {
12361+ let _knobs = crate::speed::knob_read();
12328 let fctx = &crate::decode::FrameCtx::new();12362 let fctx = &crate::decode::FrameCtx::new();
12329 let (width, height) = (256usize, 128usize);12363 let (width, height) = (256usize, 128usize);
12330 let pictures: Vec<Picture> = (0..5)12364 let pictures: Vec<Picture> = (0..5)
@@ -12429,6 +12463,7 @@ mod tests {
12429 /// printed and only the total is asserted on.12463 /// printed and only the total is asserted on.
12430 #[test]12464 #[test]
12431 fn pricer_error_census_by_block_class() {12465 fn pricer_error_census_by_block_class() {
12466+ let _knobs = crate::speed::knob_read();
12432 let fctx = &crate::decode::FrameCtx::new();12467 let fctx = &crate::decode::FrameCtx::new();
12433 let (width, height) = (256usize, 128usize);12468 let (width, height) = (256usize, 128usize);
12434 let pictures: Vec<Picture> = (0..5)12469 let pictures: Vec<Picture> = (0..5)
@@ -12479,6 +12514,7 @@ mod tests {
12479 #[test]12514 #[test]
12480 #[ignore = "reads the real library, needs ffmpeg"]12515 #[ignore = "reads the real library, needs ffmpeg"]
12481 fn pricer_error_census_on_clips() {12516 fn pricer_error_census_on_clips() {
12517+ let _knobs = crate::speed::knob_write();
12482 if !have_ffmpeg() {12518 if !have_ffmpeg() {
12483 eprintln!("SKIP pricer_error_census_on_clips: no ffmpeg");12519 eprintln!("SKIP pricer_error_census_on_clips: no ffmpeg");
12484 return;12520 return;
@@ -12546,6 +12582,7 @@ mod tests {
12546 /// asserted on beyond being reachable at all.12582 /// asserted on beyond being reachable at all.
12547 #[test]12583 #[test]
12548 fn low_motion_makes_an_inter_frame_smaller_than_the_key_frame() {12584 fn low_motion_makes_an_inter_frame_smaller_than_the_key_frame() {
12585+ let _knobs = crate::speed::knob_read();
12549 let fctx = &crate::decode::FrameCtx::new();12586 let fctx = &crate::decode::FrameCtx::new();
12550 let (width, height) = (256usize, 128usize);12587 let (width, height) = (256usize, 128usize);
12551 let pictures: Vec<Picture> = (0..5)12588 let pictures: Vec<Picture> = (0..5)
@@ -12583,6 +12620,7 @@ mod tests {
12583 #[test]12620 #[test]
12584 #[ignore = "a perf probe, not a gate"]12621 #[ignore = "a perf probe, not a gate"]
12585 fn stage_timing_breakdown() {12622 fn stage_timing_breakdown() {
12623+ let _knobs = crate::speed::knob_read();
12586 let fctx = &crate::decode::FrameCtx::new();12624 let fctx = &crate::decode::FrameCtx::new();
12587 use std::time::Instant;12625 use std::time::Instant;
12588 12626
@@ -12705,6 +12743,7 @@ mod tests {
12705 #[test]12743 #[test]
12706 #[ignore = "a perf probe, not a gate"]12744 #[ignore = "a perf probe, not a gate"]
12707 fn stage_timing_breakdown_inter() {12745 fn stage_timing_breakdown_inter() {
12746+ let _knobs = crate::speed::knob_read();
12708 let fctx = &crate::decode::FrameCtx::new();12747 let fctx = &crate::decode::FrameCtx::new();
12709 use std::time::Instant;12748 use std::time::Instant;
12710 12749
@@ -12753,6 +12792,7 @@ mod tests {
12753 #[test]12792 #[test]
12754 #[ignore = "needs real clips and ffmpeg; prints numbers for the lane report to judge"]12793 #[ignore = "needs real clips and ffmpeg; prints numbers for the lane report to judge"]
12755 fn prune_k_quality_sweep() {12794 fn prune_k_quality_sweep() {
12795+ let _knobs = crate::speed::knob_read();
12756 let fctx = &crate::decode::FrameCtx::new();12796 let fctx = &crate::decode::FrameCtx::new();
12757 if !have_ffmpeg() {12797 if !have_ffmpeg() {
12758 eprintln!("SKIP prune_k_quality_sweep: no ffmpeg");12798 eprintln!("SKIP prune_k_quality_sweep: no ffmpeg");
@@ -12853,6 +12893,7 @@ mod tests {
12853 #[test]12893 #[test]
12854 #[ignore = "needs real clips and ffmpeg; prints numbers for the lane report to judge"]12894 #[ignore = "needs real clips and ffmpeg; prints numbers for the lane report to judge"]
12855 fn prune_k_quality_sweep_inter() {12895 fn prune_k_quality_sweep_inter() {
12896+ let _knobs = crate::speed::knob_read();
12856 let fctx = &crate::decode::FrameCtx::new();12897 let fctx = &crate::decode::FrameCtx::new();
12857 if !have_ffmpeg() {12898 if !have_ffmpeg() {
12858 eprintln!("SKIP prune_k_quality_sweep_inter: no ffmpeg");12899 eprintln!("SKIP prune_k_quality_sweep_inter: no ffmpeg");
@@ -13008,6 +13049,7 @@ mod tests {
13008 /// measured - 0.5 dB; byte ceiling = measured * 1.15).13049 /// measured - 0.5 dB; byte ceiling = measured * 1.15).
13009 #[test]13050 #[test]
13010 fn real_clip_encodes_within_its_quality_and_size_budget() {13051 fn real_clip_encodes_within_its_quality_and_size_budget() {
13052+ let _knobs = crate::speed::knob_read();
13011 let fctx = &crate::decode::FrameCtx::new();13053 let fctx = &crate::decode::FrameCtx::new();
13012 if !have_ffmpeg() {13054 if !have_ffmpeg() {
13013 eprintln!("SKIP real_clip_encodes_within_its_quality_and_size_budget: no ffmpeg");13055 eprintln!("SKIP real_clip_encodes_within_its_quality_and_size_budget: no ffmpeg");
@@ -13069,6 +13111,7 @@ mod tests {
13069 /// floor = measured - 0.5 dB; byte ceiling = measured * 1.15).13111 /// floor = measured - 0.5 dB; byte ceiling = measured * 1.15).
13070 #[test]13112 #[test]
13071 fn real_clip_encodes_within_its_quality_and_size_budget_at_a_straddle_size() {13113 fn real_clip_encodes_within_its_quality_and_size_budget_at_a_straddle_size() {
13114+ let _knobs = crate::speed::knob_read();
13072 let fctx = &crate::decode::FrameCtx::new();13115 let fctx = &crate::decode::FrameCtx::new();
13073 if !have_ffmpeg() {13116 if !have_ffmpeg() {
13074 eprintln!(13117 eprintln!(
@@ -13126,6 +13169,7 @@ mod tests {
13126 #[test]13169 #[test]
13127 #[ignore = "a perf probe, not a gate"]13170 #[ignore = "a perf probe, not a gate"]
13128 fn sequence_bench_sanity() {13171 fn sequence_bench_sanity() {
13172+ let _knobs = crate::speed::knob_read();
13129 let fctx = &crate::decode::FrameCtx::new();13173 let fctx = &crate::decode::FrameCtx::new();
13130 use std::time::Instant;13174 use std::time::Instant;
13131 let (width, height) = (1280usize, 720usize);13175 let (width, height) = (1280usize, 720usize);
@@ -13149,6 +13193,7 @@ mod tests {
13149 #[test]13193 #[test]
13150 #[ignore = "a calibration probe, not a gate"]13194 #[ignore = "a calibration probe, not a gate"]
13151 fn calibration_sweep_base_q_idx() {13195 fn calibration_sweep_base_q_idx() {
13196+ let _knobs = crate::speed::knob_read();
13152 let fctx = &crate::decode::FrameCtx::new();13197 let fctx = &crate::decode::FrameCtx::new();
13153 if !have_ffmpeg() {13198 if !have_ffmpeg() {
13154 eprintln!("SKIP calibration_sweep_base_q_idx: no ffmpeg");13199 eprintln!("SKIP calibration_sweep_base_q_idx: no ffmpeg");
@@ -13472,6 +13517,7 @@ mod tests {
13472 /// (`EC_AV1_ANGLE=0` restores that half).13517 /// (`EC_AV1_ANGLE=0` restores that half).
13473 #[test]13518 #[test]
13474 fn the_encoders_own_streams_are_byte_identical_to_their_pins() {13519 fn the_encoders_own_streams_are_byte_identical_to_their_pins() {
13520+ let _knobs = crate::speed::knob_read();
13475 if !have_ffmpeg() {13521 if !have_ffmpeg() {
13476 eprintln!("SKIP the_encoders_own_streams_are_byte_identical_to_their_pins: no ffmpeg");13522 eprintln!("SKIP the_encoders_own_streams_are_byte_identical_to_their_pins: no ffmpeg");
13477 return;13523 return;
@@ -13556,6 +13602,7 @@ mod tests {
13556 #[test]13602 #[test]
13557 #[ignore = "reads the real library"]13603 #[ignore = "reads the real library"]
13558 fn probe_screen_detect() {13604 fn probe_screen_detect() {
13605+ let _knobs = crate::speed::knob_read();
13559 if !have_ffmpeg() {13606 if !have_ffmpeg() {
13560 eprintln!("SKIP probe_screen_detect: no ffmpeg");13607 eprintln!("SKIP probe_screen_detect: no ffmpeg");
13561 return;13608 return;
@@ -13649,6 +13696,7 @@ mod tests {
13649 #[test]13696 #[test]
13650 #[ignore = "reads the real library"]13697 #[ignore = "reads the real library"]
13651 fn probe_screen_library() {13698 fn probe_screen_library() {
13699+ let _knobs = crate::speed::knob_read();
13652 if !have_ffmpeg() {13700 if !have_ffmpeg() {
13653 eprintln!("SKIP probe_screen_library: no ffmpeg");13701 eprintln!("SKIP probe_screen_library: no ffmpeg");
13654 return;13702 return;
@@ -13993,6 +14041,7 @@ mod tests {
13993 #[test]14041 #[test]
13994 #[ignore = "the encoder BD-rate baseline: minutes per clip, needs ffmpeg"]14042 #[ignore = "the encoder BD-rate baseline: minutes per clip, needs ffmpeg"]
13995 fn bd_rate_vs_libaom_and_rav1e() {14043 fn bd_rate_vs_libaom_and_rav1e() {
14044+ let _knobs = crate::speed::knob_write();
13996 if !have_ffmpeg() {14045 if !have_ffmpeg() {
13997 eprintln!("SKIP bd_rate_vs_libaom_and_rav1e: no ffmpeg");14046 eprintln!("SKIP bd_rate_vs_libaom_and_rav1e: no ffmpeg");
13998 return;14047 return;
@@ -14579,6 +14628,7 @@ mod tests {
14579 #[test]14628 #[test]
14580 #[ignore = "the native-resolution BD arm: minutes per row, needs ffmpeg"]14629 #[ignore = "the native-resolution BD arm: minutes per row, needs ffmpeg"]
14581 fn bd_rate_screen_native() {14630 fn bd_rate_screen_native() {
14631+ let _knobs = crate::speed::knob_read();
14582 native_bd_arm("bd_rate_screen_native", 12, false);14632 native_bd_arm("bd_rate_screen_native", 12, false);
14583 }14633 }
14584 14634
@@ -14611,6 +14661,7 @@ mod tests {
14611 #[test]14661 #[test]
14612 #[ignore = "the long-GOP native BD arm: ~7 minutes per film row, needs ffmpeg"]14662 #[ignore = "the long-GOP native BD arm: ~7 minutes per film row, needs ffmpeg"]
14613 fn bd_rate_film_long_gop() {14663 fn bd_rate_film_long_gop() {
14664+ let _knobs = crate::speed::knob_write();
14614 native_bd_arm("bd_rate_film_long_gop", 48, true);14665 native_bd_arm("bd_rate_film_long_gop", 48, true);
14615 }14666 }
14616 14667
@@ -14775,6 +14826,7 @@ mod tests {
14775 #[test]14826 #[test]
14776 #[ignore = "needs ffmpeg and the film fixtures"]14827 #[ignore = "needs ffmpeg and the film fixtures"]
14777 fn tpl_intra_denominator_histogram() {14828 fn tpl_intra_denominator_histogram() {
14829+ let _knobs = crate::speed::knob_read();
14778 if !have_ffmpeg() {14830 if !have_ffmpeg() {
14779 eprintln!("SKIP tpl_intra_denominator_histogram: no ffmpeg");14831 eprintln!("SKIP tpl_intra_denominator_histogram: no ffmpeg");
14780 return;14832 return;