Merge branch 'lane-gatesweep': 13 real-aomenc gates pixel-compare every successful decode (counter only decides counting); gate_buckets summary; 43 previously uncompared decodes all exact; merged with lane-hidden's decode-order compares
Browse files at this commit1 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 | } |
| @@ -3339,6 +3351,7 @@ mod tests { | |||
| 3339 | } | 3351 | } |
| 3340 | let (width, height) = (64usize, 64usize); | 3352 | let (width, height) = (64usize, 64usize); |
| 3341 | let mut refusals = Vec::new(); | 3353 | let mut refusals = Vec::new(); |
| 3354 | + let mut uncounted_exact = 0u32; | ||
| 3342 | for attempt in 0..40u32 { | 3355 | for attempt in 0..40u32 { |
| 3343 | let seed = 42 + attempt; | 3356 | let seed = 42 + attempt; |
| 3344 | // A flat gradient never has enough local detail for the RD | 3357 | // A flat gradient never has enough local detail for the RD |
| @@ -3453,11 +3466,16 @@ mod tests { | |||
| 3453 | continue; | 3466 | continue; |
| 3454 | } | 3467 | } |
| 3455 | }; | 3468 | }; |
| 3456 | - if decode::tx_depth_hits() == before { | 3469 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 3470 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 3471 | + // the attempt counts toward the firing total. | ||
| 3472 | + let counted = decode::tx_depth_hits() != before; | ||
| 3473 | + if !counted { | ||
| 3474 | + uncounted_exact += 1; | ||
| 3457 | refusals.push(format!( | 3475 | refusals.push(format!( |
| 3458 | - "seed {seed}: decoded, but no block resolved a split tx_depth" | 3476 | + "seed {seed}: decoded and pixel-compared, but no block resolved a split \ |
| 3477 | + tx_depth" | ||
| 3459 | )); | 3478 | )); |
| 3460 | - continue; | ||
| 3461 | } | 3479 | } |
| 3462 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); | 3480 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); |
| 3463 | assert_eq!( | 3481 | assert_eq!( |
| @@ -3466,8 +3484,22 @@ mod tests { | |||
| 3466 | ); | 3484 | ); |
| 3467 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); | 3485 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); |
| 3468 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); | 3486 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); |
| 3469 | - return; | 3487 | + if counted { |
| 3488 | + gate_buckets( | ||
| 3489 | + "a_real_aomenc_intra_stream_with_tx_select_decodes_pixel_exact", | ||
| 3490 | + 1, | ||
| 3491 | + uncounted_exact, | ||
| 3492 | + refusals.len() - uncounted_exact as usize, | ||
| 3493 | + ); | ||
| 3494 | + return; | ||
| 3495 | + } | ||
| 3470 | } | 3496 | } |
| 3497 | + gate_buckets( | ||
| 3498 | + "a_real_aomenc_intra_stream_with_tx_select_decodes_pixel_exact", | ||
| 3499 | + 0, | ||
| 3500 | + uncounted_exact, | ||
| 3501 | + refusals.len() - uncounted_exact as usize, | ||
| 3502 | + ); | ||
| 3471 | eprintln!( | 3503 | eprintln!( |
| 3472 | "SKIP a_real_aomenc_intra_stream_with_tx_select_decodes_pixel_exact: every attempt \ | 3504 | "SKIP a_real_aomenc_intra_stream_with_tx_select_decodes_pixel_exact: every attempt \ |
| 3473 | hit a named refusal or never split a transform:\n{}", | 3505 | hit a named refusal or never split a transform:\n{}", |
| @@ -3517,6 +3549,7 @@ mod tests { | |||
| 3517 | } | 3549 | } |
| 3518 | let (width, height, frame_count) = (64usize, 64usize, 4usize); | 3550 | let (width, height, frame_count) = (64usize, 64usize, 4usize); |
| 3519 | let mut refusals = Vec::new(); | 3551 | let mut refusals = Vec::new(); |
| 3552 | + let mut uncounted_exact = 0u32; | ||
| 3520 | for attempt in 0..40u32 { | 3553 | for attempt in 0..40u32 { |
| 3521 | let seed = 42 + attempt; | 3554 | let seed = 42 + attempt; |
| 3522 | // Detail is what makes aomenc's RD prefer a split transform; a | 3555 | // Detail is what makes aomenc's RD prefer a split transform; a |
| @@ -3654,11 +3687,16 @@ mod tests { | |||
| 3654 | decode::txfm_split_reads() - reads_before, | 3687 | decode::txfm_split_reads() - reads_before, |
| 3655 | decode::txfm_split_hits() - hits_before, | 3688 | decode::txfm_split_hits() - hits_before, |
| 3656 | ); | 3689 | ); |
| 3657 | - if hits == 0 { | 3690 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 3691 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 3692 | + // the attempt counts toward the firing total. | ||
| 3693 | + let counted = hits != 0; | ||
| 3694 | + if !counted { | ||
| 3695 | + uncounted_exact += 1; | ||
| 3658 | refusals.push(format!( | 3696 | refusals.push(format!( |
| 3659 | - "seed {seed}: decoded, but no block took a txfm_split ({reads} symbols read)" | 3697 | + "seed {seed}: decoded and pixel-compared, but no block took a txfm_split \ |
| 3698 | + ({reads} symbols read)" | ||
| 3660 | )); | 3699 | )); |
| 3661 | - continue; | ||
| 3662 | } | 3700 | } |
| 3663 | let ffmpeg_frames = if bit_depth == 10 { | 3701 | let ffmpeg_frames = if bit_depth == 10 { |
| 3664 | ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) | 3702 | ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) |
| @@ -3706,8 +3744,22 @@ mod tests { | |||
| 3706 | assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})"); | 3744 | assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})"); |
| 3707 | assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); | 3745 | assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); |
| 3708 | } | 3746 | } |
| 3709 | - return; | 3747 | + if counted { |
| 3748 | + gate_buckets( | ||
| 3749 | + &format!("tx_select_inter_gate({bit_depth})"), | ||
| 3750 | + 1, | ||
| 3751 | + uncounted_exact, | ||
| 3752 | + refusals.len() - uncounted_exact as usize, | ||
| 3753 | + ); | ||
| 3754 | + return; | ||
| 3755 | + } | ||
| 3710 | } | 3756 | } |
| 3757 | + gate_buckets( | ||
| 3758 | + &format!("tx_select_inter_gate({bit_depth})"), | ||
| 3759 | + 0, | ||
| 3760 | + uncounted_exact, | ||
| 3761 | + refusals.len() - uncounted_exact as usize, | ||
| 3762 | + ); | ||
| 3711 | panic!( | 3763 | panic!( |
| 3712 | "tx_select_inter_gate({bit_depth}) never observed a taken txfm_split:\n{}", | 3764 | "tx_select_inter_gate({bit_depth}) never observed a taken txfm_split:\n{}", |
| 3713 | refusals.join("\n") | 3765 | refusals.join("\n") |
| @@ -3740,6 +3792,7 @@ mod tests { | |||
| 3740 | let (width, height) = (64usize, 64usize); | 3792 | let (width, height) = (64usize, 64usize); |
| 3741 | let mut refusals = Vec::new(); | 3793 | let mut refusals = Vec::new(); |
| 3742 | let mut fired_runs = 0u32; | 3794 | let mut fired_runs = 0u32; |
| 3795 | + let mut uncounted_exact = 0u32; | ||
| 3743 | for attempt in 0..40u32 { | 3796 | for attempt in 0..40u32 { |
| 3744 | let seed = 42 + attempt; | 3797 | let seed = 42 + attempt; |
| 3745 | let source = format!( | 3798 | let source = format!( |
| @@ -3829,13 +3882,19 @@ mod tests { | |||
| 3829 | continue; | 3882 | continue; |
| 3830 | } | 3883 | } |
| 3831 | }; | 3884 | }; |
| 3832 | - if decode::smooth_luma_hits() == smooth_before { | 3885 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 3886 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 3887 | + // the attempt counts toward the firing total. | ||
| 3888 | + let counted = decode::smooth_luma_hits() != smooth_before; | ||
| 3889 | + if counted { | ||
| 3890 | + fired_runs += 1; | ||
| 3891 | + } else { | ||
| 3892 | + uncounted_exact += 1; | ||
| 3833 | refusals.push(format!( | 3893 | refusals.push(format!( |
| 3834 | - "seed {seed}: decoded, but no smooth-luma-neighbour block fired" | 3894 | + "seed {seed}: decoded and pixel-compared, but no smooth-luma-neighbour block \ |
| 3895 | + fired" | ||
| 3835 | )); | 3896 | )); |
| 3836 | - continue; | ||
| 3837 | } | 3897 | } |
| 3838 | - fired_runs += 1; | ||
| 3839 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); | 3898 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); |
| 3840 | assert_eq!( | 3899 | assert_eq!( |
| 3841 | frames[0].y, ffmpeg_frames[0].y, | 3900 | frames[0].y, ffmpeg_frames[0].y, |
| @@ -3844,9 +3903,21 @@ mod tests { | |||
| 3844 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); | 3903 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); |
| 3845 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); | 3904 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); |
| 3846 | if fired_runs >= 4 { | 3905 | if fired_runs >= 4 { |
| 3906 | + gate_buckets( | ||
| 3907 | + "a_real_aomenc_stream_with_smooth_luma_neighbour_decodes_pixel_exact", | ||
| 3908 | + fired_runs, | ||
| 3909 | + uncounted_exact, | ||
| 3910 | + refusals.len() - uncounted_exact as usize, | ||
| 3911 | + ); | ||
| 3847 | return; | 3912 | return; |
| 3848 | } | 3913 | } |
| 3849 | } | 3914 | } |
| 3915 | + gate_buckets( | ||
| 3916 | + "a_real_aomenc_stream_with_smooth_luma_neighbour_decodes_pixel_exact", | ||
| 3917 | + fired_runs, | ||
| 3918 | + uncounted_exact, | ||
| 3919 | + refusals.len() - uncounted_exact as usize, | ||
| 3920 | + ); | ||
| 3850 | assert!( | 3921 | assert!( |
| 3851 | fired_runs > 0, | 3922 | fired_runs > 0, |
| 3852 | "every attempt hit a named refusal or never exercised a smooth luma neighbour:\n{}", | 3923 | "every attempt hit a named refusal or never exercised a smooth luma neighbour:\n{}", |
| @@ -3879,6 +3950,7 @@ mod tests { | |||
| 3879 | let (width, height) = (64usize, 64usize); | 3950 | let (width, height) = (64usize, 64usize); |
| 3880 | let mut refusals = Vec::new(); | 3951 | let mut refusals = Vec::new(); |
| 3881 | let mut fired_runs = 0u32; | 3952 | let mut fired_runs = 0u32; |
| 3953 | + let mut uncounted_exact = 0u32; | ||
| 3882 | for attempt in 0..40u32 { | 3954 | for attempt in 0..40u32 { |
| 3883 | let seed = 42 + attempt; | 3955 | let seed = 42 + attempt; |
| 3884 | let source = format!( | 3956 | let source = format!( |
| @@ -3955,13 +4027,18 @@ mod tests { | |||
| 3955 | continue; | 4027 | continue; |
| 3956 | } | 4028 | } |
| 3957 | }; | 4029 | }; |
| 3958 | - if decode::smooth_uv_hits() == smooth_before { | 4030 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 4031 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 4032 | + // the attempt counts toward the firing total. | ||
| 4033 | + let counted = decode::smooth_uv_hits() != smooth_before; | ||
| 4034 | + if counted { | ||
| 4035 | + fired_runs += 1; | ||
| 4036 | + } else { | ||
| 4037 | + uncounted_exact += 1; | ||
| 3959 | refusals.push(format!( | 4038 | refusals.push(format!( |
| 3960 | - "seed {seed}: decoded, but no smooth/paeth uv_mode fired" | 4039 | + "seed {seed}: decoded and pixel-compared, but no smooth/paeth uv_mode fired" |
| 3961 | )); | 4040 | )); |
| 3962 | - continue; | ||
| 3963 | } | 4041 | } |
| 3964 | - fired_runs += 1; | ||
| 3965 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); | 4042 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); |
| 3966 | assert_eq!( | 4043 | assert_eq!( |
| 3967 | frames[0].y, ffmpeg_frames[0].y, | 4044 | frames[0].y, ffmpeg_frames[0].y, |
| @@ -3970,9 +4047,21 @@ mod tests { | |||
| 3970 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); | 4047 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); |
| 3971 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); | 4048 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); |
| 3972 | if fired_runs >= 4 { | 4049 | if fired_runs >= 4 { |
| 4050 | + gate_buckets( | ||
| 4051 | + "a_real_aomenc_stream_with_smooth_paeth_chroma_decodes_pixel_exact", | ||
| 4052 | + fired_runs, | ||
| 4053 | + uncounted_exact, | ||
| 4054 | + refusals.len() - uncounted_exact as usize, | ||
| 4055 | + ); | ||
| 3973 | return; | 4056 | return; |
| 3974 | } | 4057 | } |
| 3975 | } | 4058 | } |
| 4059 | + gate_buckets( | ||
| 4060 | + "a_real_aomenc_stream_with_smooth_paeth_chroma_decodes_pixel_exact", | ||
| 4061 | + fired_runs, | ||
| 4062 | + uncounted_exact, | ||
| 4063 | + refusals.len() - uncounted_exact as usize, | ||
| 4064 | + ); | ||
| 3976 | assert!( | 4065 | assert!( |
| 3977 | fired_runs > 0, | 4066 | fired_runs > 0, |
| 3978 | "every attempt hit a named refusal or never exercised smooth/paeth chroma:\n{}", | 4067 | "every attempt hit a named refusal or never exercised smooth/paeth chroma:\n{}", |
| @@ -4007,6 +4096,7 @@ mod tests { | |||
| 4007 | let (width, height) = (64usize, 64usize); | 4096 | let (width, height) = (64usize, 64usize); |
| 4008 | let mut refusals = Vec::new(); | 4097 | let mut refusals = Vec::new(); |
| 4009 | let mut fired_runs = 0u32; | 4098 | let mut fired_runs = 0u32; |
| 4099 | + let mut uncounted_exact = 0u32; | ||
| 4010 | for attempt in 0..40u32 { | 4100 | for attempt in 0..40u32 { |
| 4011 | let seed = 42 + attempt; | 4101 | let seed = 42 + attempt; |
| 4012 | let source = format!( | 4102 | let source = format!( |
| @@ -4107,16 +4197,20 @@ mod tests { | |||
| 4107 | continue; | 4197 | continue; |
| 4108 | } | 4198 | } |
| 4109 | }; | 4199 | }; |
| 4110 | - if decode::directional_uv_hits() == uv_before | 4200 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 4111 | - && decode::angle_delta_hits() == angle_before | 4201 | + // is ALWAYS pixel-compared below; the hit counter only decides whether |
| 4112 | - { | 4202 | + // the attempt counts toward the firing total. |
| 4203 | + let counted = decode::directional_uv_hits() != uv_before | ||
| 4204 | + || decode::angle_delta_hits() != angle_before; | ||
| 4205 | + if counted { | ||
| 4206 | + fired_runs += 1; | ||
| 4207 | + } else { | ||
| 4208 | + uncounted_exact += 1; | ||
| 4113 | refusals.push(format!( | 4209 | refusals.push(format!( |
| 4114 | - "seed {seed}: decoded, but neither a directional uv_mode nor a \ | 4210 | + "seed {seed}: decoded and pixel-compared, but neither a directional uv_mode \ |
| 4115 | - nonzero angle delta fired" | 4211 | + nor a nonzero angle delta fired" |
| 4116 | )); | 4212 | )); |
| 4117 | - continue; | ||
| 4118 | } | 4213 | } |
| 4119 | - fired_runs += 1; | ||
| 4120 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); | 4214 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); |
| 4121 | assert_eq!( | 4215 | assert_eq!( |
| 4122 | frames[0].y, ffmpeg_frames[0].y, | 4216 | frames[0].y, ffmpeg_frames[0].y, |
| @@ -4125,9 +4219,21 @@ mod tests { | |||
| 4125 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); | 4219 | assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})"); |
| 4126 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); | 4220 | assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})"); |
| 4127 | if fired_runs >= 4 { | 4221 | if fired_runs >= 4 { |
| 4222 | + gate_buckets( | ||
| 4223 | + "a_real_aomenc_stream_with_directional_chroma_decodes_pixel_exact", | ||
| 4224 | + fired_runs, | ||
| 4225 | + uncounted_exact, | ||
| 4226 | + refusals.len() - uncounted_exact as usize, | ||
| 4227 | + ); | ||
| 4128 | return; | 4228 | return; |
| 4129 | } | 4229 | } |
| 4130 | } | 4230 | } |
| 4231 | + gate_buckets( | ||
| 4232 | + "a_real_aomenc_stream_with_directional_chroma_decodes_pixel_exact", | ||
| 4233 | + fired_runs, | ||
| 4234 | + uncounted_exact, | ||
| 4235 | + refusals.len() - uncounted_exact as usize, | ||
| 4236 | + ); | ||
| 4131 | assert!( | 4237 | assert!( |
| 4132 | fired_runs > 0, | 4238 | fired_runs > 0, |
| 4133 | "every attempt hit a named refusal or never exercised directional chroma:\n{}", | 4239 | "every attempt hit a named refusal or never exercised directional chroma:\n{}", |
| @@ -5079,12 +5185,14 @@ mod tests { | |||
| 5079 | } | 5185 | } |
| 5080 | Ok(frames) => frames, | 5186 | Ok(frames) => frames, |
| 5081 | }; | 5187 | }; |
| 5082 | - if decode::non_last_ref_hits() == before { | 5188 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 5083 | - // This seed's RD search never actually picked GOLDEN_FRAME -- | 5189 | + // is ALWAYS pixel-compared below; the hit counter only decides whether |
| 5084 | - // a genuine miss, not a refusal. Try the next seed rather | 5190 | + // the attempt counts toward the firing total. |
| 5085 | - // than claiming coverage this attempt did not exercise. | 5191 | + // This seed's RD search may never have picked GOLDEN_FRAME -- a |
| 5192 | + // genuine miss, not a refusal, and not a reason to skip the pixels. | ||
| 5193 | + let counted = decode::non_last_ref_hits() != before; | ||
| 5194 | + if !counted { | ||
| 5086 | never_fired += 1; | 5195 | never_fired += 1; |
| 5087 | - continue; | ||
| 5088 | } | 5196 | } |
| 5089 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 5197 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 5090 | assert_eq!(frames.len(), frame_count); | 5198 | assert_eq!(frames.len(), frame_count); |
| @@ -5105,12 +5213,26 @@ mod tests { | |||
| 5105 | assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})"); | 5213 | assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})"); |
| 5106 | assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); | 5214 | assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); |
| 5107 | } | 5215 | } |
| 5108 | - eprintln!( | 5216 | + if counted { |
| 5109 | - "FIRING seed {seed}: non_last_ref_hits advanced by {}", | 5217 | + eprintln!( |
| 5110 | - decode::non_last_ref_hits() - before | 5218 | + "FIRING seed {seed}: non_last_ref_hits advanced by {}", |
| 5111 | - ); | 5219 | + decode::non_last_ref_hits() - before |
| 5112 | - return; | 5220 | + ); |
| 5221 | + gate_buckets( | ||
| 5222 | + "a_real_aomenc_inter_sequence_with_a_golden_reference_decodes_pixel_exact", | ||
| 5223 | + 1, | ||
| 5224 | + never_fired, | ||
| 5225 | + refusals.len(), | ||
| 5226 | + ); | ||
| 5227 | + return; | ||
| 5228 | + } | ||
| 5113 | } | 5229 | } |
| 5230 | + gate_buckets( | ||
| 5231 | + "a_real_aomenc_inter_sequence_with_a_golden_reference_decodes_pixel_exact", | ||
| 5232 | + 0, | ||
| 5233 | + never_fired, | ||
| 5234 | + refusals.len(), | ||
| 5235 | + ); | ||
| 5114 | eprintln!( | 5236 | eprintln!( |
| 5115 | "SKIP a_real_aomenc_inter_sequence_with_a_golden_reference_decodes_pixel_exact: \ | 5237 | "SKIP a_real_aomenc_inter_sequence_with_a_golden_reference_decodes_pixel_exact: \ |
| 5116 | {never_fired} attempts decoded but never fired GOLDEN_FRAME, and every other \ | 5238 | {never_fired} attempts decoded but never fired GOLDEN_FRAME, and every other \ |
| @@ -5260,9 +5382,12 @@ mod tests { | |||
| 5260 | } | 5382 | } |
| 5261 | Ok(frames) => frames, | 5383 | Ok(frames) => frames, |
| 5262 | }; | 5384 | }; |
| 5263 | - if decode::ref_hits(target_ref) == before { | 5385 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 5386 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 5387 | + // the attempt counts toward the firing total. | ||
| 5388 | + let counted = decode::ref_hits(target_ref) != before; | ||
| 5389 | + if !counted { | ||
| 5264 | never_fired += 1; | 5390 | never_fired += 1; |
| 5265 | - continue; | ||
| 5266 | } | 5391 | } |
| 5267 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 5392 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 5268 | assert_eq!(frames.len(), frame_count); | 5393 | assert_eq!(frames.len(), frame_count); |
| @@ -5309,12 +5434,16 @@ mod tests { | |||
| 5309 | decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | 5434 | decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" |
| 5310 | ); | 5435 | ); |
| 5311 | } | 5436 | } |
| 5312 | - eprintln!( | 5437 | + if counted { |
| 5313 | - "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}", | 5438 | + eprintln!( |
| 5314 | - decode::ref_hits(target_ref) - before | 5439 | + "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}", |
| 5315 | - ); | 5440 | + decode::ref_hits(target_ref) - before |
| 5316 | - return; | 5441 | + ); |
| 5442 | + gate_buckets(gate_name, 1, never_fired, refusals.len()); | ||
| 5443 | + return; | ||
| 5444 | + } | ||
| 5317 | } | 5445 | } |
| 5446 | + gate_buckets(gate_name, 0, never_fired, refusals.len()); | ||
| 5318 | eprintln!( | 5447 | eprintln!( |
| 5319 | "SKIP {gate_name}: {never_fired} attempts decoded but never fired {target_ref_name}, \ | 5448 | "SKIP {gate_name}: {never_fired} attempts decoded but never fired {target_ref_name}, \ |
| 5320 | and every other attempt hit a named refusal:\n{}", | 5449 | and every other attempt hit a named refusal:\n{}", |
| @@ -5484,9 +5613,12 @@ mod tests { | |||
| 5484 | continue; | 5613 | continue; |
| 5485 | } | 5614 | } |
| 5486 | Ok(frames) => { | 5615 | Ok(frames) => { |
| 5487 | - if decode::comp_mode_hits() == before { | 5616 | + // class [[gate-skips-on-its-own-failure]]: a decode that |
| 5617 | + // succeeded is ALWAYS pixel-compared below; the hit counter | ||
| 5618 | + // only decides whether the attempt counts as firing. | ||
| 5619 | + let counted = decode::comp_mode_hits() != before; | ||
| 5620 | + if !counted { | ||
| 5488 | never_fired += 1; | 5621 | never_fired += 1; |
| 5489 | - continue; | ||
| 5490 | } | 5622 | } |
| 5491 | // Outcome (c): plain COMPOUND_AVERAGE decoded fully -- | 5623 | // Outcome (c): plain COMPOUND_AVERAGE decoded fully -- |
| 5492 | // non-negotiable pixel exactness, no tolerance. | 5624 | // non-negotiable pixel exactness, no tolerance. |
| @@ -5546,15 +5678,19 @@ mod tests { | |||
| 5546 | decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | 5678 | decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" |
| 5547 | ); | 5679 | ); |
| 5548 | } | 5680 | } |
| 5549 | - eprintln!( | 5681 | + if counted { |
| 5550 | - "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \ | 5682 | + eprintln!( |
| 5551 | - fully and pixel-exact", | 5683 | + "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \ |
| 5552 | - decode::comp_mode_hits() - before | 5684 | + fully and pixel-exact", |
| 5553 | - ); | 5685 | + decode::comp_mode_hits() - before |
| 5554 | - return; | 5686 | + ); |
| 5687 | + gate_buckets(NAME, 1, never_fired, refusals.len()); | ||
| 5688 | + return; | ||
| 5689 | + } | ||
| 5555 | } | 5690 | } |
| 5556 | } | 5691 | } |
| 5557 | } | 5692 | } |
| 5693 | + gate_buckets(NAME, 0, never_fired, refusals.len()); | ||
| 5558 | eprintln!( | 5694 | eprintln!( |
| 5559 | "SKIP {NAME}: {never_fired} attempts decoded fully (reference_select never drove a \ | 5695 | "SKIP {NAME}: {never_fired} attempts decoded fully (reference_select never drove a \ |
| 5560 | block to COMPOUND_REFERENCE) and every other attempt hit a named refusal that never \ | 5696 | block to COMPOUND_REFERENCE) and every other attempt hit a named refusal that never \ |
| @@ -5693,9 +5829,12 @@ mod tests { | |||
| 5693 | } | 5829 | } |
| 5694 | Ok(frames) => frames, | 5830 | Ok(frames) => frames, |
| 5695 | }; | 5831 | }; |
| 5696 | - if decode::skip_mode_hits() == before { | 5832 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 5833 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 5834 | + // the attempt counts toward the firing total. | ||
| 5835 | + let counted = decode::skip_mode_hits() != before; | ||
| 5836 | + if !counted { | ||
| 5697 | never_fired += 1; | 5837 | never_fired += 1; |
| 5698 | - continue; | ||
| 5699 | } | 5838 | } |
| 5700 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 5839 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 5701 | assert_eq!(frames.len(), frame_count); | 5840 | assert_eq!(frames.len(), frame_count); |
| @@ -5747,12 +5886,16 @@ mod tests { | |||
| 5747 | decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | 5886 | decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" |
| 5748 | ); | 5887 | ); |
| 5749 | } | 5888 | } |
| 5750 | - eprintln!( | 5889 | + if counted { |
| 5751 | - "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}", | 5890 | + eprintln!( |
| 5752 | - decode::skip_mode_hits() - before | 5891 | + "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}", |
| 5753 | - ); | 5892 | + decode::skip_mode_hits() - before |
| 5754 | - return; | 5893 | + ); |
| 5894 | + gate_buckets(NAME, 1, never_fired, refusals.len()); | ||
| 5895 | + return; | ||
| 5896 | + } | ||
| 5755 | } | 5897 | } |
| 5898 | + gate_buckets(NAME, 0, never_fired, refusals.len()); | ||
| 5756 | eprintln!( | 5899 | eprintln!( |
| 5757 | "SKIP {NAME}: {never_fired} attempts decoded but never fired skip_mode, and every \ | 5900 | "SKIP {NAME}: {never_fired} attempts decoded but never fired skip_mode, and every \ |
| 5758 | other attempt hit a named refusal:\n{}", | 5901 | other attempt hit a named refusal:\n{}", |
| @@ -5888,9 +6031,12 @@ mod tests { | |||
| 5888 | } | 6031 | } |
| 5889 | Ok(frames) => frames, | 6032 | Ok(frames) => frames, |
| 5890 | }; | 6033 | }; |
| 5891 | - if decode::obmc_hits() == before { | 6034 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 6035 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 6036 | + // the attempt counts toward the firing total. | ||
| 6037 | + let counted = decode::obmc_hits() != before; | ||
| 6038 | + if !counted { | ||
| 5892 | never_fired += 1; | 6039 | never_fired += 1; |
| 5893 | - continue; | ||
| 5894 | } | 6040 | } |
| 5895 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 6041 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 5896 | assert_eq!(frames.len(), frame_count); | 6042 | assert_eq!(frames.len(), frame_count); |
| @@ -5928,12 +6074,16 @@ mod tests { | |||
| 5928 | decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | 6074 | decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" |
| 5929 | ); | 6075 | ); |
| 5930 | } | 6076 | } |
| 5931 | - eprintln!( | 6077 | + if counted { |
| 5932 | - "{NAME} FIRING seed {seed}: obmc hits advanced by {}", | 6078 | + eprintln!( |
| 5933 | - decode::obmc_hits() - before | 6079 | + "{NAME} FIRING seed {seed}: obmc hits advanced by {}", |
| 5934 | - ); | 6080 | + decode::obmc_hits() - before |
| 5935 | - return; | 6081 | + ); |
| 6082 | + gate_buckets(NAME, 1, never_fired, refusals.len()); | ||
| 6083 | + return; | ||
| 6084 | + } | ||
| 5936 | } | 6085 | } |
| 6086 | + gate_buckets(NAME, 0, never_fired, refusals.len()); | ||
| 5937 | eprintln!( | 6087 | eprintln!( |
| 5938 | "SKIP {NAME}: {never_fired} attempts decoded but never fired obmc, and every \ | 6088 | "SKIP {NAME}: {never_fired} attempts decoded but never fired obmc, and every \ |
| 5939 | other attempt hit a named refusal:\n{}", | 6089 | other attempt hit a named refusal:\n{}", |
| @@ -6098,9 +6248,12 @@ mod tests { | |||
| 6098 | }; | 6248 | }; |
| 6099 | let fired8 = decode::obmc_hits_8() - before8; | 6249 | let fired8 = decode::obmc_hits_8() - before8; |
| 6100 | total_obmc8 += fired8; | 6250 | total_obmc8 += fired8; |
| 6101 | - if fired8 == 0 { | 6251 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 6252 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 6253 | + // the attempt counts toward the firing total. | ||
| 6254 | + let counted = fired8 != 0; | ||
| 6255 | + if !counted { | ||
| 6102 | never_fired += 1; | 6256 | never_fired += 1; |
| 6103 | - continue; | ||
| 6104 | } | 6257 | } |
| 6105 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 6258 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 6106 | assert_eq!(frames.len(), frame_count); | 6259 | assert_eq!(frames.len(), frame_count); |
| @@ -6138,11 +6291,15 @@ mod tests { | |||
| 6138 | decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" | 6291 | decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle" |
| 6139 | ); | 6292 | ); |
| 6140 | } | 6293 | } |
| 6141 | - eprintln!( | 6294 | + if counted { |
| 6142 | - "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})" | 6295 | + eprintln!( |
| 6143 | - ); | 6296 | + "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})" |
| 6144 | - return; | 6297 | + ); |
| 6298 | + gate_buckets(NAME, 1, never_fired, refusals.len()); | ||
| 6299 | + return; | ||
| 6300 | + } | ||
| 6145 | } | 6301 | } |
| 6302 | + gate_buckets(NAME, 0, never_fired, refusals.len()); | ||
| 6146 | eprintln!( | 6303 | eprintln!( |
| 6147 | "SKIP {NAME}: {never_fired} attempts decoded but never fired an 8x8 obmc block \ | 6304 | "SKIP {NAME}: {never_fired} attempts decoded but never fired an 8x8 obmc block \ |
| 6148 | ({total_obmc8} total 8x8 obmc hits across all attempts), and every other attempt \ | 6305 | ({total_obmc8} total 8x8 obmc hits across all attempts), and every other attempt \ |
| @@ -9227,9 +9384,12 @@ mod tests { | |||
| 9227 | } | 9384 | } |
| 9228 | Ok(frames) => frames, | 9385 | Ok(frames) => frames, |
| 9229 | }; | 9386 | }; |
| 9230 | - if decode::tmv_hits() == before { | 9387 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 9388 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 9389 | + // the attempt counts toward the firing total. | ||
| 9390 | + let counted = decode::tmv_hits() != before; | ||
| 9391 | + if !counted { | ||
| 9231 | never_fired += 1; | 9392 | never_fired += 1; |
| 9232 | - continue; | ||
| 9233 | } | 9393 | } |
| 9234 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); | 9394 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count); |
| 9235 | assert_eq!(frames.len(), frame_count); | 9395 | assert_eq!(frames.len(), frame_count); |
| @@ -9257,12 +9417,16 @@ mod tests { | |||
| 9257 | "{gate_name} frame {i} V vs ffmpeg (seed {seed})" | 9417 | "{gate_name} frame {i} V vs ffmpeg (seed {seed})" |
| 9258 | ); | 9418 | ); |
| 9259 | } | 9419 | } |
| 9260 | - eprintln!( | 9420 | + if counted { |
| 9261 | - "{gate_name} FIRING seed {seed}: tmv_hits advanced by {}", | 9421 | + eprintln!( |
| 9262 | - decode::tmv_hits() - before | 9422 | + "{gate_name} FIRING seed {seed}: tmv_hits advanced by {}", |
| 9263 | - ); | 9423 | + decode::tmv_hits() - before |
| 9264 | - return; | 9424 | + ); |
| 9425 | + gate_buckets(gate_name, 1, never_fired, refusals.len()); | ||
| 9426 | + return; | ||
| 9427 | + } | ||
| 9265 | } | 9428 | } |
| 9429 | + gate_buckets(gate_name, 0, never_fired, refusals.len()); | ||
| 9266 | eprintln!( | 9430 | eprintln!( |
| 9267 | "SKIP {gate_name}: {never_fired} attempts decoded but never fired a temporal MV \ | 9431 | "SKIP {gate_name}: {never_fired} attempts decoded but never fired a temporal MV \ |
| 9268 | candidate, and every other attempt hit a named refusal:\n{}", | 9432 | candidate, and every other attempt hit a named refusal:\n{}", |
| @@ -9405,6 +9569,7 @@ mod tests { | |||
| 9405 | let (width, height) = (64usize, 64usize); | 9569 | let (width, height) = (64usize, 64usize); |
| 9406 | let mut refusals = Vec::new(); | 9570 | let mut refusals = Vec::new(); |
| 9407 | let mut fired_runs = 0u32; | 9571 | let mut fired_runs = 0u32; |
| 9572 | + let mut uncounted_exact = 0u32; | ||
| 9408 | for attempt in 0..60u32 { | 9573 | for attempt in 0..60u32 { |
| 9409 | let cq = 20 + (attempt % 5) * 10; | 9574 | let cq = 20 + (attempt % 5) * 10; |
| 9410 | let period = [4u32, 6, 8, 12, 16][(attempt as usize / 5) % 5]; | 9575 | let period = [4u32, 6, 8, 12, 16][(attempt as usize / 5) % 5]; |
| @@ -9498,11 +9663,16 @@ mod tests { | |||
| 9498 | continue; | 9663 | continue; |
| 9499 | } | 9664 | } |
| 9500 | }; | 9665 | }; |
| 9501 | - if decode::tx_class1_hits() == before { | 9666 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 9667 | + // is ALWAYS pixel-compared below; the hit counter only decides whether | ||
| 9668 | + // the attempt counts toward the firing total. | ||
| 9669 | + let counted = decode::tx_class1_hits() != before; | ||
| 9670 | + if !counted { | ||
| 9671 | + uncounted_exact += 1; | ||
| 9502 | refusals.push(format!( | 9672 | refusals.push(format!( |
| 9503 | - "cq={cq} period={period}: decoded, but no block read a V_DCT/H_DCT tx_type" | 9673 | + "cq={cq} period={period}: decoded and pixel-compared, but no block read a \ |
| 9674 | + V_DCT/H_DCT tx_type" | ||
| 9504 | )); | 9675 | )); |
| 9505 | - continue; | ||
| 9506 | } | 9676 | } |
| 9507 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); | 9677 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); |
| 9508 | assert_eq!( | 9678 | assert_eq!( |
| @@ -9517,11 +9687,25 @@ mod tests { | |||
| 9517 | frames[0].v, ffmpeg_frames[0].v, | 9687 | frames[0].v, ffmpeg_frames[0].v, |
| 9518 | "V vs ffmpeg (cq={cq} period={period})" | 9688 | "V vs ffmpeg (cq={cq} period={period})" |
| 9519 | ); | 9689 | ); |
| 9520 | - fired_runs += 1; | 9690 | + if counted { |
| 9521 | - if fired_runs >= 4 { | 9691 | + fired_runs += 1; |
| 9522 | - return; | 9692 | + if fired_runs >= 4 { |
| 9693 | + gate_buckets( | ||
| 9694 | + "a_real_aomenc_min8_stream_with_tx_class1_decodes_pixel_exact", | ||
| 9695 | + fired_runs, | ||
| 9696 | + uncounted_exact, | ||
| 9697 | + refusals.len() - uncounted_exact as usize, | ||
| 9698 | + ); | ||
| 9699 | + return; | ||
| 9700 | + } | ||
| 9523 | } | 9701 | } |
| 9524 | } | 9702 | } |
| 9703 | + gate_buckets( | ||
| 9704 | + "a_real_aomenc_min8_stream_with_tx_class1_decodes_pixel_exact", | ||
| 9705 | + fired_runs, | ||
| 9706 | + uncounted_exact, | ||
| 9707 | + refusals.len() - uncounted_exact as usize, | ||
| 9708 | + ); | ||
| 9525 | panic!( | 9709 | panic!( |
| 9526 | "fewer than 4 firing+pixel-exact runs out of 60 attempts:\n{}", | 9710 | "fewer than 4 firing+pixel-exact runs out of 60 attempts:\n{}", |
| 9527 | refusals.join("\n") | 9711 | refusals.join("\n") |