Every real-aomenc gate pixel-compares each successful decode, counter or not
Browse files at this commit64df83b1c98726c26f220b94362d9fbfe53ce945Parent: 4463654- test
- every real-aomenc gate pixel-compares each successful decode, counter or not
1 changed file +265 -81
- crates/ec-av1/src/stream.rs +265 -81
crates/ec-av1/src/stream.rsmodified+265 -81
| @@ -973,6 +973,18 @@ mod tests { | |||
| 973 | /// mutex makes firing detection honest again (matches the existing | 973 | /// mutex makes firing detection honest again (matches the existing |
| 974 | /// cdf-forwarding-gate flake shape, ledger `omp-liveness-pgrep-self-match`). | 974 | /// cdf-forwarding-gate flake shape, ledger `omp-liveness-pgrep-self-match`). |
| 975 | static GATE_COUNTER_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(()); | 975 | static GATE_COUNTER_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(()); |
| 976 | + /// Three-bucket gate summary (class [[gate-skips-on-its-own-failure]]): | ||
| 977 | + /// every attempt lands in exactly one bucket -- decoded pixel-exact WITH | ||
| 978 | + /// the feature counter moving, decoded pixel-exact WITHOUT it, or a named | ||
| 979 | + /// refusal -- and the three sum to the attempts made. | ||
| 980 | + fn gate_buckets(name: &str, counted_exact: u32, uncounted_exact: u32, named_refusals: usize) { | ||
| 981 | + eprintln!( | ||
| 982 | + "{name}: buckets counted-exact={counted_exact} uncounted-exact={uncounted_exact} \ | ||
| 983 | + named-refusals={named_refusals} (attempts {})", | ||
| 984 | + counted_exact as usize + uncounted_exact as usize + named_refusals | ||
| 985 | + ); | ||
| 986 | + } | ||
| 987 | + | ||
| 976 | fn lock_gate_counters() -> std::sync::MutexGuard<'static, ()> { | 988 | fn lock_gate_counters() -> std::sync::MutexGuard<'static, ()> { |
| 977 | GATE_COUNTER_LOCK.lock().unwrap_or_else(|e| e.into_inner()) | 989 | GATE_COUNTER_LOCK.lock().unwrap_or_else(|e| e.into_inner()) |
| 978 | } | 990 | } |
| @@ -3277,6 +3289,7 @@ mod tests { | |||
| 3277 | } | 3289 | } |
| 3278 | let (width, height) = (64usize, 64usize); | 3290 | let (width, height) = (64usize, 64usize); |
| 3279 | let mut refusals = Vec::new(); | 3291 | let mut refusals = Vec::new(); |
| 3292 | + let mut uncounted_exact = 0u32; | ||
| 3280 | for attempt in 0..40u32 { | 3293 | for attempt in 0..40u32 { |
| 3281 | let seed = 42 + attempt; | 3294 | let seed = 42 + attempt; |
| 3282 | // A flat gradient never has enough local detail for the RD | 3295 | // A flat gradient never has enough local detail for the RD |
| @@ -3391,11 +3404,16 @@ mod tests { | |||
| 3391 | continue; | 3404 | continue; |
| 3392 | } | 3405 | } |
| 3393 | }; | 3406 | }; |
| 3394 | - if decode::tx_depth_hits() == before { | 3407 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 3408 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 3409 | + // the attempt counts toward the firing total. | ||
| 3410 | + let counted = decode::tx_depth_hits() != before; | ||
| 3411 | + if !counted { | ||
| 3412 | + uncounted_exact += 1; | ||
| 3395 | refusals.push(format!( | 3413 | refusals.push(format!( |
| 3396 | - "seed {seed}: decoded, but no block resolved a split tx_depth" | 3414 | + "seed {seed}: decoded and pixel-compared, but no block resolved a split \ |
| 3415 | + tx_depth" | ||
| 3397 | )); | 3416 | )); |
| 3398 | - continue; | ||
| 3399 | } | 3417 | } |
| 3400 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); | 3418 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); |
| 3401 | assert_eq!( | 3419 | assert_eq!( |
| @@ -3404,8 +3422,22 @@ mod tests { | |||
| 3404 | ); | 3422 | ); |
| 3405 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); | 3423 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); |
| 3406 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); | 3424 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); |
| 3407 | - return; | 3425 | + if counted { |
| 3426 | + gate_buckets( | ||
| 3427 | + "a_real_aomenc_intra_stream_with_tx_select_decodes_pixel_exact", | ||
| 3428 | + 1, | ||
| 3429 | + uncounted_exact, | ||
| 3430 | + refusals.len() - uncounted_exact as usize, | ||
| 3431 | + ); | ||
| 3432 | + return; | ||
| 3433 | + } | ||
| 3408 | } | 3434 | } |
| 3435 | + gate_buckets( | ||
| 3436 | + "a_real_aomenc_intra_stream_with_tx_select_decodes_pixel_exact", | ||
| 3437 | + 0, | ||
| 3438 | + uncounted_exact, | ||
| 3439 | + refusals.len() - uncounted_exact as usize, | ||
| 3440 | + ); | ||
| 3409 | eprintln!( | 3441 | eprintln!( |
| 3410 | "SKIP a_real_aomenc_intra_stream_with_tx_select_decodes_pixel_exact: every attempt \ | 3442 | "SKIP a_real_aomenc_intra_stream_with_tx_select_decodes_pixel_exact: every attempt \ |
| 3411 | hit a named refusal or never split a transform:\n{}", | 3443 | hit a named refusal or never split a transform:\n{}", |
| @@ -3455,6 +3487,7 @@ mod tests { | |||
| 3455 | } | 3487 | } |
| 3456 | let (width, height, frame_count) = (64usize, 64usize, 4usize); | 3488 | let (width, height, frame_count) = (64usize, 64usize, 4usize); |
| 3457 | let mut refusals = Vec::new(); | 3489 | let mut refusals = Vec::new(); |
| 3490 | + let mut uncounted_exact = 0u32; | ||
| 3458 | for attempt in 0..40u32 { | 3491 | for attempt in 0..40u32 { |
| 3459 | let seed = 42 + attempt; | 3492 | let seed = 42 + attempt; |
| 3460 | // Detail is what makes aomenc's RD prefer a split transform; a | 3493 | // Detail is what makes aomenc's RD prefer a split transform; a |
| @@ -3592,11 +3625,16 @@ mod tests { | |||
| 3592 | decode::txfm_split_reads() - reads_before, | 3625 | decode::txfm_split_reads() - reads_before, |
| 3593 | decode::txfm_split_hits() - hits_before, | 3626 | decode::txfm_split_hits() - hits_before, |
| 3594 | ); | 3627 | ); |
| 3595 | - if hits == 0 { | 3628 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 3629 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 3630 | + // the attempt counts toward the firing total. | ||
| 3631 | + let counted = hits != 0; | ||
| 3632 | + if !counted { | ||
| 3633 | + uncounted_exact += 1; | ||
| 3596 | refusals.push(format!( | 3634 | refusals.push(format!( |
| 3597 | - "seed {seed}: decoded, but no block took a txfm_split ({reads} symbols read)" | 3635 | + "seed {seed}: decoded and pixel-compared, but no block took a txfm_split \ |
| 3636 | + ({reads} symbols read)" | ||
| 3598 | )); | 3637 | )); |
| 3599 | - continue; | ||
| 3600 | } | 3638 | } |
| 3601 | let ffmpeg_frames = if bit_depth == 10 { | 3639 | let ffmpeg_frames = if bit_depth == 10 { |
| 3602 | ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) | 3640 | ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) |
| @@ -3644,8 +3682,22 @@ mod tests { | |||
| 3644 | assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})"); | 3682 | assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})"); |
| 3645 | assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); | 3683 | assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); |
| 3646 | } | 3684 | } |
| 3647 | - return; | 3685 | + if counted { |
| 3686 | + gate_buckets( | ||
| 3687 | + &format!("tx_select_inter_gate({bit_depth})"), | ||
| 3688 | + 1, | ||
| 3689 | + uncounted_exact, | ||
| 3690 | + refusals.len() - uncounted_exact as usize, | ||
| 3691 | + ); | ||
| 3692 | + return; | ||
| 3693 | + } | ||
| 3648 | } | 3694 | } |
| 3695 | + gate_buckets( | ||
| 3696 | + &format!("tx_select_inter_gate({bit_depth})"), | ||
| 3697 | + 0, | ||
| 3698 | + uncounted_exact, | ||
| 3699 | + refusals.len() - uncounted_exact as usize, | ||
| 3700 | + ); | ||
| 3649 | panic!( | 3701 | panic!( |
| 3650 | "tx_select_inter_gate({bit_depth}) never observed a taken txfm_split:\n{}", | 3702 | "tx_select_inter_gate({bit_depth}) never observed a taken txfm_split:\n{}", |
| 3651 | refusals.join("\n") | 3703 | refusals.join("\n") |
| @@ -3678,6 +3730,7 @@ mod tests { | |||
| 3678 | let (width, height) = (64usize, 64usize); | 3730 | let (width, height) = (64usize, 64usize); |
| 3679 | let mut refusals = Vec::new(); | 3731 | let mut refusals = Vec::new(); |
| 3680 | let mut fired_runs = 0u32; | 3732 | let mut fired_runs = 0u32; |
| 3733 | + let mut uncounted_exact = 0u32; | ||
| 3681 | for attempt in 0..40u32 { | 3734 | for attempt in 0..40u32 { |
| 3682 | let seed = 42 + attempt; | 3735 | let seed = 42 + attempt; |
| 3683 | let source = format!( | 3736 | let source = format!( |
| @@ -3767,13 +3820,19 @@ mod tests { | |||
| 3767 | continue; | 3820 | continue; |
| 3768 | } | 3821 | } |
| 3769 | }; | 3822 | }; |
| 3770 | - if decode::smooth_luma_hits() == smooth_before { | 3823 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 3824 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 3825 | + // the attempt counts toward the firing total. | ||
| 3826 | + let counted = decode::smooth_luma_hits() != smooth_before; | ||
| 3827 | + if counted { | ||
| 3828 | + fired_runs += 1; | ||
| 3829 | + } else { | ||
| 3830 | + uncounted_exact += 1; | ||
| 3771 | refusals.push(format!( | 3831 | refusals.push(format!( |
| 3772 | - "seed {seed}: decoded, but no smooth-luma-neighbour block fired" | 3832 | + "seed {seed}: decoded and pixel-compared, but no smooth-luma-neighbour block \ |
| 3833 | + fired" | ||
| 3773 | )); | 3834 | )); |
| 3774 | - continue; | ||
| 3775 | } | 3835 | } |
| 3776 | - fired_runs += 1; | ||
| 3777 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); | 3836 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); |
| 3778 | assert_eq!( | 3837 | assert_eq!( |
| 3779 | frames[0].y, ffmpeg_frames[0].y, | 3838 | frames[0].y, ffmpeg_frames[0].y, |
| @@ -3782,9 +3841,21 @@ mod tests { | |||
| 3782 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); | 3841 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); |
| 3783 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); | 3842 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); |
| 3784 | if fired_runs >= 4 { | 3843 | if fired_runs >= 4 { |
| 3844 | + gate_buckets( | ||
| 3845 | + "a_real_aomenc_stream_with_smooth_luma_neighbour_decodes_pixel_exact", | ||
| 3846 | + fired_runs, | ||
| 3847 | + uncounted_exact, | ||
| 3848 | + refusals.len() - uncounted_exact as usize, | ||
| 3849 | + ); | ||
| 3785 | return; | 3850 | return; |
| 3786 | } | 3851 | } |
| 3787 | } | 3852 | } |
| 3853 | + gate_buckets( | ||
| 3854 | + "a_real_aomenc_stream_with_smooth_luma_neighbour_decodes_pixel_exact", | ||
| 3855 | + fired_runs, | ||
| 3856 | + uncounted_exact, | ||
| 3857 | + refusals.len() - uncounted_exact as usize, | ||
| 3858 | + ); | ||
| 3788 | assert!( | 3859 | assert!( |
| 3789 | fired_runs > 0, | 3860 | fired_runs > 0, |
| 3790 | "every attempt hit a named refusal or never exercised a smooth luma neighbour:\n{}", | 3861 | "every attempt hit a named refusal or never exercised a smooth luma neighbour:\n{}", |
| @@ -3817,6 +3888,7 @@ mod tests { | |||
| 3817 | let (width, height) = (64usize, 64usize); | 3888 | let (width, height) = (64usize, 64usize); |
| 3818 | let mut refusals = Vec::new(); | 3889 | let mut refusals = Vec::new(); |
| 3819 | let mut fired_runs = 0u32; | 3890 | let mut fired_runs = 0u32; |
| 3891 | + let mut uncounted_exact = 0u32; | ||
| 3820 | for attempt in 0..40u32 { | 3892 | for attempt in 0..40u32 { |
| 3821 | let seed = 42 + attempt; | 3893 | let seed = 42 + attempt; |
| 3822 | let source = format!( | 3894 | let source = format!( |
| @@ -3893,13 +3965,18 @@ mod tests { | |||
| 3893 | continue; | 3965 | continue; |
| 3894 | } | 3966 | } |
| 3895 | }; | 3967 | }; |
| 3896 | - if decode::smooth_uv_hits() == smooth_before { | 3968 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 3969 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 3970 | + // the attempt counts toward the firing total. | ||
| 3971 | + let counted = decode::smooth_uv_hits() != smooth_before; | ||
| 3972 | + if counted { | ||
| 3973 | + fired_runs += 1; | ||
| 3974 | + } else { | ||
| 3975 | + uncounted_exact += 1; | ||
| 3897 | refusals.push(format!( | 3976 | refusals.push(format!( |
| 3898 | - "seed {seed}: decoded, but no smooth/paeth uv_mode fired" | 3977 | + "seed {seed}: decoded and pixel-compared, but no smooth/paeth uv_mode fired" |
| 3899 | )); | 3978 | )); |
| 3900 | - continue; | ||
| 3901 | } | 3979 | } |
| 3902 | - fired_runs += 1; | ||
| 3903 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); | 3980 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); |
| 3904 | assert_eq!( | 3981 | assert_eq!( |
| 3905 | frames[0].y, ffmpeg_frames[0].y, | 3982 | frames[0].y, ffmpeg_frames[0].y, |
| @@ -3908,9 +3985,21 @@ mod tests { | |||
| 3908 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); | 3985 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); |
| 3909 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); | 3986 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); |
| 3910 | if fired_runs >= 4 { | 3987 | if fired_runs >= 4 { |
| 3988 | + gate_buckets( | ||
| 3989 | + "a_real_aomenc_stream_with_smooth_paeth_chroma_decodes_pixel_exact", | ||
| 3990 | + fired_runs, | ||
| 3991 | + uncounted_exact, | ||
| 3992 | + refusals.len() - uncounted_exact as usize, | ||
| 3993 | + ); | ||
| 3911 | return; | 3994 | return; |
| 3912 | } | 3995 | } |
| 3913 | } | 3996 | } |
| 3997 | + gate_buckets( | ||
| 3998 | + "a_real_aomenc_stream_with_smooth_paeth_chroma_decodes_pixel_exact", | ||
| 3999 | + fired_runs, | ||
| 4000 | + uncounted_exact, | ||
| 4001 | + refusals.len() - uncounted_exact as usize, | ||
| 4002 | + ); | ||
| 3914 | assert!( | 4003 | assert!( |
| 3915 | fired_runs > 0, | 4004 | fired_runs > 0, |
| 3916 | "every attempt hit a named refusal or never exercised smooth/paeth chroma:\n{}", | 4005 | "every attempt hit a named refusal or never exercised smooth/paeth chroma:\n{}", |
| @@ -3945,6 +4034,7 @@ mod tests { | |||
| 3945 | let (width, height) = (64usize, 64usize); | 4034 | let (width, height) = (64usize, 64usize); |
| 3946 | let mut refusals = Vec::new(); | 4035 | let mut refusals = Vec::new(); |
| 3947 | let mut fired_runs = 0u32; | 4036 | let mut fired_runs = 0u32; |
| 4037 | + let mut uncounted_exact = 0u32; | ||
| 3948 | for attempt in 0..40u32 { | 4038 | for attempt in 0..40u32 { |
| 3949 | let seed = 42 + attempt; | 4039 | let seed = 42 + attempt; |
| 3950 | let source = format!( | 4040 | let source = format!( |
| @@ -4045,16 +4135,20 @@ mod tests { | |||
| 4045 | continue; | 4135 | continue; |
| 4046 | } | 4136 | } |
| 4047 | }; | 4137 | }; |
| 4048 | - if decode::directional_uv_hits() == uv_before | 4138 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 4049 | - && decode::angle_delta_hits() == angle_before | 4139 | + // is ALWAYS pixel-compared below; the hit counter only decides whether |
| 4050 | - { | 4140 | + // the attempt counts toward the firing total. |
| 4141 | + let counted = decode::directional_uv_hits() != uv_before | ||
| 4142 | + || decode::angle_delta_hits() != angle_before; | ||
| 4143 | + if counted { | ||
| 4144 | + fired_runs += 1; | ||
| 4145 | + } else { | ||
| 4146 | + uncounted_exact += 1; | ||
| 4051 | refusals.push(format!( | 4147 | refusals.push(format!( |
| 4052 | - "seed {seed}: decoded, but neither a directional uv_mode nor a \ | 4148 | + "seed {seed}: decoded and pixel-compared, but neither a directional uv_mode \ |
| 4053 | - nonzero angle delta fired" | 4149 | + nor a nonzero angle delta fired" |
| 4054 | )); | 4150 | )); |
| 4055 | - continue; | ||
| 4056 | } | 4151 | } |
| 4057 | - fired_runs += 1; | ||
| 4058 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); | 4152 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); |
| 4059 | assert_eq!( | 4153 | assert_eq!( |
| 4060 | frames[0].y, ffmpeg_frames[0].y, | 4154 | frames[0].y, ffmpeg_frames[0].y, |
| @@ -4063,9 +4157,21 @@ mod tests { | |||
| 4063 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); | 4157 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); |
| 4064 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); | 4158 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); |
| 4065 | if fired_runs >= 4 { | 4159 | if fired_runs >= 4 { |
| 4160 | + gate_buckets( | ||
| 4161 | + "a_real_aomenc_stream_with_directional_chroma_decodes_pixel_exact", | ||
| 4162 | + fired_runs, | ||
| 4163 | + uncounted_exact, | ||
| 4164 | + refusals.len() - uncounted_exact as usize, | ||
| 4165 | + ); | ||
| 4066 | return; | 4166 | return; |
| 4067 | } | 4167 | } |
| 4068 | } | 4168 | } |
| 4169 | + gate_buckets( | ||
| 4170 | + "a_real_aomenc_stream_with_directional_chroma_decodes_pixel_exact", | ||
| 4171 | + fired_runs, | ||
| 4172 | + uncounted_exact, | ||
| 4173 | + refusals.len() - uncounted_exact as usize, | ||
| 4174 | + ); | ||
| 4069 | assert!( | 4175 | assert!( |
| 4070 | fired_runs > 0, | 4176 | fired_runs > 0, |
| 4071 | "every attempt hit a named refusal or never exercised directional chroma:\n{}", | 4177 | "every attempt hit a named refusal or never exercised directional chroma:\n{}", |
| @@ -5017,12 +5123,14 @@ mod tests { | |||
| 5017 | } | 5123 | } |
| 5018 | Ok(frames) => frames, | 5124 | Ok(frames) => frames, |
| 5019 | }; | 5125 | }; |
| 5020 | - if decode::non_last_ref_hits() == before { | 5126 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 5021 | - // This seed's RD search never actually picked GOLDEN_FRAME -- | 5127 | + // is ALWAYS pixel-compared below; the hit counter only decides whether |
| 5022 | - // a genuine miss, not a refusal. Try the next seed rather | 5128 | + // the attempt counts toward the firing total. |
| 5023 | - // than claiming coverage this attempt did not exercise. | 5129 | + // This seed's RD search may never have picked GOLDEN_FRAME -- a |
| 5130 | + // genuine miss, not a refusal, and not a reason to skip the pixels. | ||
| 5131 | + let counted = decode::non_last_ref_hits() != before; | ||
| 5132 | + if !counted { | ||
| 5024 | never_fired += 1; | 5133 | never_fired += 1; |
| 5025 | - continue; | ||
| 5026 | } | 5134 | } |
| 5027 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 5135 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 5028 | assert_eq!(frames.len(), frame_count); | 5136 | assert_eq!(frames.len(), frame_count); |
| @@ -5043,12 +5151,26 @@ mod tests { | |||
| 5043 | assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})"); | 5151 | assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})"); |
| 5044 | assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); | 5152 | assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); |
| 5045 | } | 5153 | } |
| 5046 | - eprintln!( | 5154 | + if counted { |
| 5047 | - "FIRING seed {seed}: non_last_ref_hits advanced by {}", | 5155 | + eprintln!( |
| 5048 | - decode::non_last_ref_hits() - before | 5156 | + "FIRING seed {seed}: non_last_ref_hits advanced by {}", |
| 5049 | - ); | 5157 | + decode::non_last_ref_hits() - before |
| 5050 | - return; | 5158 | + ); |
| 5159 | + gate_buckets( | ||
| 5160 | + "a_real_aomenc_inter_sequence_with_a_golden_reference_decodes_pixel_exact", | ||
| 5161 | + 1, | ||
| 5162 | + never_fired, | ||
| 5163 | + refusals.len(), | ||
| 5164 | + ); | ||
| 5165 | + return; | ||
| 5166 | + } | ||
| 5051 | } | 5167 | } |
| 5168 | + gate_buckets( | ||
| 5169 | + "a_real_aomenc_inter_sequence_with_a_golden_reference_decodes_pixel_exact", | ||
| 5170 | + 0, | ||
| 5171 | + never_fired, | ||
| 5172 | + refusals.len(), | ||
| 5173 | + ); | ||
| 5052 | eprintln!( | 5174 | eprintln!( |
| 5053 | "SKIP a_real_aomenc_inter_sequence_with_a_golden_reference_decodes_pixel_exact: \ | 5175 | "SKIP a_real_aomenc_inter_sequence_with_a_golden_reference_decodes_pixel_exact: \ |
| 5054 | {never_fired} attempts decoded but never fired GOLDEN_FRAME, and every other \ | 5176 | {never_fired} attempts decoded but never fired GOLDEN_FRAME, and every other \ |
| @@ -5198,9 +5320,12 @@ mod tests { | |||
| 5198 | } | 5320 | } |
| 5199 | Ok(frames) => frames, | 5321 | Ok(frames) => frames, |
| 5200 | }; | 5322 | }; |
| 5201 | - if decode::ref_hits(target_ref) == before { | 5323 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 5324 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 5325 | + // the attempt counts toward the firing total. | ||
| 5326 | + let counted = decode::ref_hits(target_ref) != before; | ||
| 5327 | + if !counted { | ||
| 5202 | never_fired += 1; | 5328 | never_fired += 1; |
| 5203 | - continue; | ||
| 5204 | } | 5329 | } |
| 5205 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 5330 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 5206 | assert_eq!(frames.len(), frame_count); | 5331 | assert_eq!(frames.len(), frame_count); |
| @@ -5228,12 +5353,16 @@ mod tests { | |||
| 5228 | "{gate_name} frame {i} V vs ffmpeg (seed {seed})" | 5353 | "{gate_name} frame {i} V vs ffmpeg (seed {seed})" |
| 5229 | ); | 5354 | ); |
| 5230 | } | 5355 | } |
| 5231 | - eprintln!( | 5356 | + if counted { |
| 5232 | - "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}", | 5357 | + eprintln!( |
| 5233 | - decode::ref_hits(target_ref) - before | 5358 | + "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}", |
| 5234 | - ); | 5359 | + decode::ref_hits(target_ref) - before |
| 5235 | - return; | 5360 | + ); |
| 5361 | + gate_buckets(gate_name, 1, never_fired, refusals.len()); | ||
| 5362 | + return; | ||
| 5363 | + } | ||
| 5236 | } | 5364 | } |
| 5365 | + gate_buckets(gate_name, 0, never_fired, refusals.len()); | ||
| 5237 | eprintln!( | 5366 | eprintln!( |
| 5238 | "SKIP {gate_name}: {never_fired} attempts decoded but never fired {target_ref_name}, \ | 5367 | "SKIP {gate_name}: {never_fired} attempts decoded but never fired {target_ref_name}, \ |
| 5239 | and every other attempt hit a named refusal:\n{}", | 5368 | and every other attempt hit a named refusal:\n{}", |
| @@ -5403,9 +5532,12 @@ mod tests { | |||
| 5403 | continue; | 5532 | continue; |
| 5404 | } | 5533 | } |
| 5405 | Ok(frames) => { | 5534 | Ok(frames) => { |
| 5406 | - if decode::comp_mode_hits() == before { | 5535 | + // class [[gate-skips-on-its-own-failure]]: a decode that |
| 5536 | + // succeeded is ALWAYS pixel-compared below; the hit counter | ||
| 5537 | + // only decides whether the attempt counts as firing. | ||
| 5538 | + let counted = decode::comp_mode_hits() != before; | ||
| 5539 | + if !counted { | ||
| 5407 | never_fired += 1; | 5540 | never_fired += 1; |
| 5408 | - continue; | ||
| 5409 | } | 5541 | } |
| 5410 | // Outcome (c): plain COMPOUND_AVERAGE decoded fully -- | 5542 | // Outcome (c): plain COMPOUND_AVERAGE decoded fully -- |
| 5411 | // non-negotiable pixel exactness, no tolerance. | 5543 | // non-negotiable pixel exactness, no tolerance. |
| @@ -5446,15 +5578,19 @@ mod tests { | |||
| 5446 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 5578 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 5447 | } | 5579 | } |
| 5448 | } | 5580 | } |
| 5449 | - eprintln!( | 5581 | + if counted { |
| 5450 | - "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \ | 5582 | + eprintln!( |
| 5451 | - fully and pixel-exact", | 5583 | + "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \ |
| 5452 | - decode::comp_mode_hits() - before | 5584 | + fully and pixel-exact", |
| 5453 | - ); | 5585 | + decode::comp_mode_hits() - before |
| 5454 | - return; | 5586 | + ); |
| 5587 | + gate_buckets(NAME, 1, never_fired, refusals.len()); | ||
| 5588 | + return; | ||
| 5589 | + } | ||
| 5455 | } | 5590 | } |
| 5456 | } | 5591 | } |
| 5457 | } | 5592 | } |
| 5593 | + gate_buckets(NAME, 0, never_fired, refusals.len()); | ||
| 5458 | eprintln!( | 5594 | eprintln!( |
| 5459 | "SKIP {NAME}: {never_fired} attempts decoded fully (reference_select never drove a \ | 5595 | "SKIP {NAME}: {never_fired} attempts decoded fully (reference_select never drove a \ |
| 5460 | block to COMPOUND_REFERENCE) and every other attempt hit a named refusal that never \ | 5596 | block to COMPOUND_REFERENCE) and every other attempt hit a named refusal that never \ |
| @@ -5593,9 +5729,12 @@ mod tests { | |||
| 5593 | } | 5729 | } |
| 5594 | Ok(frames) => frames, | 5730 | Ok(frames) => frames, |
| 5595 | }; | 5731 | }; |
| 5596 | - if decode::skip_mode_hits() == before { | 5732 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 5733 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 5734 | + // the attempt counts toward the firing total. | ||
| 5735 | + let counted = decode::skip_mode_hits() != before; | ||
| 5736 | + if !counted { | ||
| 5597 | never_fired += 1; | 5737 | never_fired += 1; |
| 5598 | - continue; | ||
| 5599 | } | 5738 | } |
| 5600 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 5739 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 5601 | assert_eq!(frames.len(), frame_count); | 5740 | assert_eq!(frames.len(), frame_count); |
| @@ -5628,12 +5767,16 @@ mod tests { | |||
| 5628 | ); | 5767 | ); |
| 5629 | } | 5768 | } |
| 5630 | } | 5769 | } |
| 5631 | - eprintln!( | 5770 | + if counted { |
| 5632 | - "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}", | 5771 | + eprintln!( |
| 5633 | - decode::skip_mode_hits() - before | 5772 | + "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}", |
| 5634 | - ); | 5773 | + decode::skip_mode_hits() - before |
| 5635 | - return; | 5774 | + ); |
| 5775 | + gate_buckets(NAME, 1, never_fired, refusals.len()); | ||
| 5776 | + return; | ||
| 5777 | + } | ||
| 5636 | } | 5778 | } |
| 5779 | + gate_buckets(NAME, 0, never_fired, refusals.len()); | ||
| 5637 | eprintln!( | 5780 | eprintln!( |
| 5638 | "SKIP {NAME}: {never_fired} attempts decoded but never fired skip_mode, and every \ | 5781 | "SKIP {NAME}: {never_fired} attempts decoded but never fired skip_mode, and every \ |
| 5639 | other attempt hit a named refusal:\n{}", | 5782 | other attempt hit a named refusal:\n{}", |
| @@ -5769,9 +5912,12 @@ mod tests { | |||
| 5769 | } | 5912 | } |
| 5770 | Ok(frames) => frames, | 5913 | Ok(frames) => frames, |
| 5771 | }; | 5914 | }; |
| 5772 | - if decode::obmc_hits() == before { | 5915 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 5916 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 5917 | + // the attempt counts toward the firing total. | ||
| 5918 | + let counted = decode::obmc_hits() != before; | ||
| 5919 | + if !counted { | ||
| 5773 | never_fired += 1; | 5920 | never_fired += 1; |
| 5774 | - continue; | ||
| 5775 | } | 5921 | } |
| 5776 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 5922 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 5777 | assert_eq!(frames.len(), frame_count); | 5923 | assert_eq!(frames.len(), frame_count); |
| @@ -5790,12 +5936,16 @@ mod tests { | |||
| 5790 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 5936 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 5791 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 5937 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 5792 | } | 5938 | } |
| 5793 | - eprintln!( | 5939 | + if counted { |
| 5794 | - "{NAME} FIRING seed {seed}: obmc hits advanced by {}", | 5940 | + eprintln!( |
| 5795 | - decode::obmc_hits() - before | 5941 | + "{NAME} FIRING seed {seed}: obmc hits advanced by {}", |
| 5796 | - ); | 5942 | + decode::obmc_hits() - before |
| 5797 | - return; | 5943 | + ); |
| 5944 | + gate_buckets(NAME, 1, never_fired, refusals.len()); | ||
| 5945 | + return; | ||
| 5946 | + } | ||
| 5798 | } | 5947 | } |
| 5948 | + gate_buckets(NAME, 0, never_fired, refusals.len()); | ||
| 5799 | eprintln!( | 5949 | eprintln!( |
| 5800 | "SKIP {NAME}: {never_fired} attempts decoded but never fired obmc, and every \ | 5950 | "SKIP {NAME}: {never_fired} attempts decoded but never fired obmc, and every \ |
| 5801 | other attempt hit a named refusal:\n{}", | 5951 | other attempt hit a named refusal:\n{}", |
| @@ -5960,9 +6110,12 @@ mod tests { | |||
| 5960 | }; | 6110 | }; |
| 5961 | let fired8 = decode::obmc_hits_8() - before8; | 6111 | let fired8 = decode::obmc_hits_8() - before8; |
| 5962 | total_obmc8 += fired8; | 6112 | total_obmc8 += fired8; |
| 5963 | - if fired8 == 0 { | 6113 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 6114 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 6115 | + // the attempt counts toward the firing total. | ||
| 6116 | + let counted = fired8 != 0; | ||
| 6117 | + if !counted { | ||
| 5964 | never_fired += 1; | 6118 | never_fired += 1; |
| 5965 | - continue; | ||
| 5966 | } | 6119 | } |
| 5967 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 6120 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 5968 | assert_eq!(frames.len(), frame_count); | 6121 | assert_eq!(frames.len(), frame_count); |
| @@ -5981,11 +6134,15 @@ mod tests { | |||
| 5981 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 6134 | assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); |
| 5982 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 6135 | assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); |
| 5983 | } | 6136 | } |
| 5984 | - eprintln!( | 6137 | + if counted { |
| 5985 | - "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})" | 6138 | + eprintln!( |
| 5986 | - ); | 6139 | + "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})" |
| 5987 | - return; | 6140 | + ); |
| 6141 | + gate_buckets(NAME, 1, never_fired, refusals.len()); | ||
| 6142 | + return; | ||
| 6143 | + } | ||
| 5988 | } | 6144 | } |
| 6145 | + gate_buckets(NAME, 0, never_fired, refusals.len()); | ||
| 5989 | eprintln!( | 6146 | eprintln!( |
| 5990 | "SKIP {NAME}: {never_fired} attempts decoded but never fired an 8x8 obmc block \ | 6147 | "SKIP {NAME}: {never_fired} attempts decoded but never fired an 8x8 obmc block \ |
| 5991 | ({total_obmc8} total 8x8 obmc hits across all attempts), and every other attempt \ | 6148 | ({total_obmc8} total 8x8 obmc hits across all attempts), and every other attempt \ |
| @@ -8701,9 +8858,12 @@ mod tests { | |||
| 8701 | } | 8858 | } |
| 8702 | Ok(frames) => frames, | 8859 | Ok(frames) => frames, |
| 8703 | }; | 8860 | }; |
| 8704 | - if decode::tmv_hits() == before { | 8861 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 8862 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 8863 | + // the attempt counts toward the firing total. | ||
| 8864 | + let counted = decode::tmv_hits() != before; | ||
| 8865 | + if !counted { | ||
| 8705 | never_fired += 1; | 8866 | never_fired += 1; |
| 8706 | - continue; | ||
| 8707 | } | 8867 | } |
| 8708 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 8868 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 8709 | assert_eq!(frames.len(), frame_count); | 8869 | assert_eq!(frames.len(), frame_count); |
| @@ -8731,12 +8891,16 @@ mod tests { | |||
| 8731 | "{gate_name} frame {i} V vs ffmpeg (seed {seed})" | 8891 | "{gate_name} frame {i} V vs ffmpeg (seed {seed})" |
| 8732 | ); | 8892 | ); |
| 8733 | } | 8893 | } |
| 8734 | - eprintln!( | 8894 | + if counted { |
| 8735 | - "{gate_name} FIRING seed {seed}: tmv_hits advanced by {}", | 8895 | + eprintln!( |
| 8736 | - decode::tmv_hits() - before | 8896 | + "{gate_name} FIRING seed {seed}: tmv_hits advanced by {}", |
| 8737 | - ); | 8897 | + decode::tmv_hits() - before |
| 8738 | - return; | 8898 | + ); |
| 8899 | + gate_buckets(gate_name, 1, never_fired, refusals.len()); | ||
| 8900 | + return; | ||
| 8901 | + } | ||
| 8739 | } | 8902 | } |
| 8903 | + gate_buckets(gate_name, 0, never_fired, refusals.len()); | ||
| 8740 | eprintln!( | 8904 | eprintln!( |
| 8741 | "SKIP {gate_name}: {never_fired} attempts decoded but never fired a temporal MV \ | 8905 | "SKIP {gate_name}: {never_fired} attempts decoded but never fired a temporal MV \ |
| 8742 | candidate, and every other attempt hit a named refusal:\n{}", | 8906 | candidate, and every other attempt hit a named refusal:\n{}", |
| @@ -8879,6 +9043,7 @@ mod tests { | |||
| 8879 | let (width, height) = (64usize, 64usize); | 9043 | let (width, height) = (64usize, 64usize); |
| 8880 | let mut refusals = Vec::new(); | 9044 | let mut refusals = Vec::new(); |
| 8881 | let mut fired_runs = 0u32; | 9045 | let mut fired_runs = 0u32; |
| 9046 | + let mut uncounted_exact = 0u32; | ||
| 8882 | for attempt in 0..60u32 { | 9047 | for attempt in 0..60u32 { |
| 8883 | let cq = 20 + (attempt % 5) * 10; | 9048 | let cq = 20 + (attempt % 5) * 10; |
| 8884 | let period = [4u32, 6, 8, 12, 16][(attempt as usize / 5) % 5]; | 9049 | let period = [4u32, 6, 8, 12, 16][(attempt as usize / 5) % 5]; |
| @@ -8972,11 +9137,16 @@ mod tests { | |||
| 8972 | continue; | 9137 | continue; |
| 8973 | } | 9138 | } |
| 8974 | }; | 9139 | }; |
| 8975 | - if decode::tx_class1_hits() == before { | 9140 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 9141 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 9142 | + // the attempt counts toward the firing total. | ||
| 9143 | + let counted = decode::tx_class1_hits() != before; | ||
| 9144 | + if !counted { | ||
| 9145 | + uncounted_exact += 1; | ||
| 8976 | refusals.push(format!( | 9146 | refusals.push(format!( |
| 8977 | - "cq={cq} period={period}: decoded, but no block read a V_DCT/H_DCT tx_type" | 9147 | + "cq={cq} period={period}: decoded and pixel-compared, but no block read a \ |
| 9148 | + V_DCT/H_DCT tx_type" | ||
| 8978 | )); | 9149 | )); |
| 8979 | - continue; | ||
| 8980 | } | 9150 | } |
| 8981 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); | 9151 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); |
| 8982 | assert_eq!( | 9152 | assert_eq!( |
| @@ -8991,11 +9161,25 @@ mod tests { | |||
| 8991 | frames[0].v, ffmpeg_frames[0].v, | 9161 | frames[0].v, ffmpeg_frames[0].v, |
| 8992 | "V vs ffmpeg (cq={cq} period={period})" | 9162 | "V vs ffmpeg (cq={cq} period={period})" |
| 8993 | ); | 9163 | ); |
| 8994 | - fired_runs += 1; | 9164 | + if counted { |
| 8995 | - if fired_runs >= 4 { | 9165 | + fired_runs += 1; |
| 8996 | - return; | 9166 | + if fired_runs >= 4 { |
| 9167 | + gate_buckets( | ||
| 9168 | + "a_real_aomenc_min8_stream_with_tx_class1_decodes_pixel_exact", | ||
| 9169 | + fired_runs, | ||
| 9170 | + uncounted_exact, | ||
| 9171 | + refusals.len() - uncounted_exact as usize, | ||
| 9172 | + ); | ||
| 9173 | + return; | ||
| 9174 | + } | ||
| 8997 | } | 9175 | } |
| 8998 | } | 9176 | } |
| 9177 | + gate_buckets( | ||
| 9178 | + "a_real_aomenc_min8_stream_with_tx_class1_decodes_pixel_exact", | ||
| 9179 | + fired_runs, | ||
| 9180 | + uncounted_exact, | ||
| 9181 | + refusals.len() - uncounted_exact as usize, | ||
| 9182 | + ); | ||
| 8999 | panic!( | 9183 | panic!( |
| 9000 | "fewer than 4 firing+pixel-exact runs out of 60 attempts:\n{}", | 9184 | "fewer than 4 firing+pixel-exact runs out of 60 attempts:\n{}", |
| 9001 | refusals.join("\n") | 9185 | refusals.join("\n") |