forge
Explore
Log in

Don't you dare go Hollow

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 commit

01c42f6288f6d37a5ee8e315dcdd5c457351f5a4Ahmet Kaan GümüşParent: 97075e664df83b
crates/ec-av1/src/stream.rsmodified+265 -81
@@ -973,6 +973,18 @@ mod tests {
973973 /// mutex makes firing detection honest again (matches the existing
974974 /// cdf-forwarding-gate flake shape, ledger `omp-liveness-pgrep-self-match`).
975975 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+
976988 fn lock_gate_counters() -> std::sync::MutexGuard<'static, ()> {
977989 GATE_COUNTER_LOCK.lock().unwrap_or_else(|e| e.into_inner())
978990 }
@@ -3339,6 +3351,7 @@ mod tests {
33393351 }
33403352 let (width, height) = (64usize, 64usize);
33413353 let mut refusals = Vec::new();
3354+ let mut uncounted_exact = 0u32;
33423355 for attempt in 0..40u32 {
33433356 let seed = 42 + attempt;
33443357 // A flat gradient never has enough local detail for the RD
@@ -3453,11 +3466,16 @@ mod tests {
34533466 continue;
34543467 }
34553468 };
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;
34573475 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"
34593478 ));
3460- continue;
34613479 }
34623480 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1);
34633481 assert_eq!(
@@ -3466,8 +3484,22 @@ mod tests {
34663484 );
34673485 assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})");
34683486 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+ }
34703496 }
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+ );
34713503 eprintln!(
34723504 "SKIP a_real_aomenc_intra_stream_with_tx_select_decodes_pixel_exact: every attempt \
34733505 hit a named refusal or never split a transform:\n{}",
@@ -3517,6 +3549,7 @@ mod tests {
35173549 }
35183550 let (width, height, frame_count) = (64usize, 64usize, 4usize);
35193551 let mut refusals = Vec::new();
3552+ let mut uncounted_exact = 0u32;
35203553 for attempt in 0..40u32 {
35213554 let seed = 42 + attempt;
35223555 // Detail is what makes aomenc's RD prefer a split transform; a
@@ -3654,11 +3687,16 @@ mod tests {
36543687 decode::txfm_split_reads() - reads_before,
36553688 decode::txfm_split_hits() - hits_before,
36563689 );
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;
36583696 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)"
36603699 ));
3661- continue;
36623700 }
36633701 let ffmpeg_frames = if bit_depth == 10 {
36643702 ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count)
@@ -3706,8 +3744,22 @@ mod tests {
37063744 assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})");
37073745 assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})");
37083746 }
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+ }
37103756 }
3757+ gate_buckets(
3758+ &format!("tx_select_inter_gate({bit_depth})"),
3759+ 0,
3760+ uncounted_exact,
3761+ refusals.len() - uncounted_exact as usize,
3762+ );
37113763 panic!(
37123764 "tx_select_inter_gate({bit_depth}) never observed a taken txfm_split:\n{}",
37133765 refusals.join("\n")
@@ -3740,6 +3792,7 @@ mod tests {
37403792 let (width, height) = (64usize, 64usize);
37413793 let mut refusals = Vec::new();
37423794 let mut fired_runs = 0u32;
3795+ let mut uncounted_exact = 0u32;
37433796 for attempt in 0..40u32 {
37443797 let seed = 42 + attempt;
37453798 let source = format!(
@@ -3829,13 +3882,19 @@ mod tests {
38293882 continue;
38303883 }
38313884 };
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;
38333893 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"
38353896 ));
3836- continue;
38373897 }
3838- fired_runs += 1;
38393898 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1);
38403899 assert_eq!(
38413900 frames[0].y, ffmpeg_frames[0].y,
@@ -3844,9 +3903,21 @@ mod tests {
38443903 assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})");
38453904 assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})");
38463905 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+ );
38473912 return;
38483913 }
38493914 }
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+ );
38503921 assert!(
38513922 fired_runs > 0,
38523923 "every attempt hit a named refusal or never exercised a smooth luma neighbour:\n{}",
@@ -3879,6 +3950,7 @@ mod tests {
38793950 let (width, height) = (64usize, 64usize);
38803951 let mut refusals = Vec::new();
38813952 let mut fired_runs = 0u32;
3953+ let mut uncounted_exact = 0u32;
38823954 for attempt in 0..40u32 {
38833955 let seed = 42 + attempt;
38843956 let source = format!(
@@ -3955,13 +4027,18 @@ mod tests {
39554027 continue;
39564028 }
39574029 };
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;
39594038 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"
39614040 ));
3962- continue;
39634041 }
3964- fired_runs += 1;
39654042 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1);
39664043 assert_eq!(
39674044 frames[0].y, ffmpeg_frames[0].y,
@@ -3970,9 +4047,21 @@ mod tests {
39704047 assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})");
39714048 assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})");
39724049 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+ );
39734056 return;
39744057 }
39754058 }
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+ );
39764065 assert!(
39774066 fired_runs > 0,
39784067 "every attempt hit a named refusal or never exercised smooth/paeth chroma:\n{}",
@@ -4007,6 +4096,7 @@ mod tests {
40074096 let (width, height) = (64usize, 64usize);
40084097 let mut refusals = Vec::new();
40094098 let mut fired_runs = 0u32;
4099+ let mut uncounted_exact = 0u32;
40104100 for attempt in 0..40u32 {
40114101 let seed = 42 + attempt;
40124102 let source = format!(
@@ -4107,16 +4197,20 @@ mod tests {
41074197 continue;
41084198 }
41094199 };
4110- if decode::directional_uv_hits() == uv_before
4111- && decode::angle_delta_hits() == angle_before
4112- {
4200+ // class [[gate-skips-on-its-own-failure]]: a decode that succeeded
4201+ // is ALWAYS pixel-compared below; the hit counter only decides whether
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;
41134209 refusals.push(format!(
4114- "seed {seed}: decoded, but neither a directional uv_mode nor a \
4115- nonzero angle delta fired"
4210+ "seed {seed}: decoded and pixel-compared, but neither a directional uv_mode \
4211+ nor a nonzero angle delta fired"
41164212 ));
4117- continue;
41184213 }
4119- fired_runs += 1;
41204214 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1);
41214215 assert_eq!(
41224216 frames[0].y, ffmpeg_frames[0].y,
@@ -4125,9 +4219,21 @@ mod tests {
41254219 assert_eq!(frames[0].u, ffmpeg_frames[0].u, "U vs ffmpeg (seed {seed})");
41264220 assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (seed {seed})");
41274221 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+ );
41284228 return;
41294229 }
41304230 }
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+ );
41314237 assert!(
41324238 fired_runs > 0,
41334239 "every attempt hit a named refusal or never exercised directional chroma:\n{}",
@@ -5079,12 +5185,14 @@ mod tests {
50795185 }
50805186 Ok(frames) => frames,
50815187 };
5082- if decode::non_last_ref_hits() == before {
5083- // This seed's RD search never actually picked GOLDEN_FRAME --
5084- // a genuine miss, not a refusal. Try the next seed rather
5085- // than claiming coverage this attempt did not exercise.
5188+ // class [[gate-skips-on-its-own-failure]]: a decode that succeeded
5189+ // is ALWAYS pixel-compared below; the hit counter only decides whether
5190+ // the attempt counts toward the firing total.
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 {
50865195 never_fired += 1;
5087- continue;
50885196 }
50895197 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count);
50905198 assert_eq!(frames.len(), frame_count);
@@ -5105,12 +5213,26 @@ mod tests {
51055213 assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})");
51065214 assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})");
51075215 }
5108- eprintln!(
5109- "FIRING seed {seed}: non_last_ref_hits advanced by {}",
5110- decode::non_last_ref_hits() - before
5111- );
5112- return;
5216+ if counted {
5217+ eprintln!(
5218+ "FIRING seed {seed}: non_last_ref_hits advanced by {}",
5219+ decode::non_last_ref_hits() - before
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+ }
51135229 }
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+ );
51145236 eprintln!(
51155237 "SKIP a_real_aomenc_inter_sequence_with_a_golden_reference_decodes_pixel_exact: \
51165238 {never_fired} attempts decoded but never fired GOLDEN_FRAME, and every other \
@@ -5260,9 +5382,12 @@ mod tests {
52605382 }
52615383 Ok(frames) => frames,
52625384 };
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 {
52645390 never_fired += 1;
5265- continue;
52665391 }
52675392 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count);
52685393 assert_eq!(frames.len(), frame_count);
@@ -5309,12 +5434,16 @@ mod tests {
53095434 decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
53105435 );
53115436 }
5312- eprintln!(
5313- "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}",
5314- decode::ref_hits(target_ref) - before
5315- );
5316- return;
5437+ if counted {
5438+ eprintln!(
5439+ "{gate_name} FIRING seed {seed}: {target_ref_name} hits advanced by {}",
5440+ decode::ref_hits(target_ref) - before
5441+ );
5442+ gate_buckets(gate_name, 1, never_fired, refusals.len());
5443+ return;
5444+ }
53175445 }
5446+ gate_buckets(gate_name, 0, never_fired, refusals.len());
53185447 eprintln!(
53195448 "SKIP {gate_name}: {never_fired} attempts decoded but never fired {target_ref_name}, \
53205449 and every other attempt hit a named refusal:\n{}",
@@ -5484,9 +5613,12 @@ mod tests {
54845613 continue;
54855614 }
54865615 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 {
54885621 never_fired += 1;
5489- continue;
54905622 }
54915623 // Outcome (c): plain COMPOUND_AVERAGE decoded fully --
54925624 // non-negotiable pixel exactness, no tolerance.
@@ -5546,15 +5678,19 @@ mod tests {
55465678 decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
55475679 );
55485680 }
5549- eprintln!(
5550- "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \
5551- fully and pixel-exact",
5552- decode::comp_mode_hits() - before
5553- );
5554- return;
5681+ if counted {
5682+ eprintln!(
5683+ "{NAME} FIRING seed {seed}: comp_mode hits advanced by {}, decoded \
5684+ fully and pixel-exact",
5685+ decode::comp_mode_hits() - before
5686+ );
5687+ gate_buckets(NAME, 1, never_fired, refusals.len());
5688+ return;
5689+ }
55555690 }
55565691 }
55575692 }
5693+ gate_buckets(NAME, 0, never_fired, refusals.len());
55585694 eprintln!(
55595695 "SKIP {NAME}: {never_fired} attempts decoded fully (reference_select never drove a \
55605696 block to COMPOUND_REFERENCE) and every other attempt hit a named refusal that never \
@@ -5693,9 +5829,12 @@ mod tests {
56935829 }
56945830 Ok(frames) => frames,
56955831 };
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 {
56975837 never_fired += 1;
5698- continue;
56995838 }
57005839 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count);
57015840 assert_eq!(frames.len(), frame_count);
@@ -5747,12 +5886,16 @@ mod tests {
57475886 decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
57485887 );
57495888 }
5750- eprintln!(
5751- "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}",
5752- decode::skip_mode_hits() - before
5753- );
5754- return;
5889+ if counted {
5890+ eprintln!(
5891+ "{NAME} FIRING seed {seed}: skip_mode hits advanced by {}",
5892+ decode::skip_mode_hits() - before
5893+ );
5894+ gate_buckets(NAME, 1, never_fired, refusals.len());
5895+ return;
5896+ }
57555897 }
5898+ gate_buckets(NAME, 0, never_fired, refusals.len());
57565899 eprintln!(
57575900 "SKIP {NAME}: {never_fired} attempts decoded but never fired skip_mode, and every \
57585901 other attempt hit a named refusal:\n{}",
@@ -5888,9 +6031,12 @@ mod tests {
58886031 }
58896032 Ok(frames) => frames,
58906033 };
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 {
58926039 never_fired += 1;
5893- continue;
58946040 }
58956041 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count);
58966042 assert_eq!(frames.len(), frame_count);
@@ -5928,12 +6074,16 @@ mod tests {
59286074 decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
59296075 );
59306076 }
5931- eprintln!(
5932- "{NAME} FIRING seed {seed}: obmc hits advanced by {}",
5933- decode::obmc_hits() - before
5934- );
5935- return;
6077+ if counted {
6078+ eprintln!(
6079+ "{NAME} FIRING seed {seed}: obmc hits advanced by {}",
6080+ decode::obmc_hits() - before
6081+ );
6082+ gate_buckets(NAME, 1, never_fired, refusals.len());
6083+ return;
6084+ }
59366085 }
6086+ gate_buckets(NAME, 0, never_fired, refusals.len());
59376087 eprintln!(
59386088 "SKIP {NAME}: {never_fired} attempts decoded but never fired obmc, and every \
59396089 other attempt hit a named refusal:\n{}",
@@ -6098,9 +6248,12 @@ mod tests {
60986248 };
60996249 let fired8 = decode::obmc_hits_8() - before8;
61006250 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 {
61026256 never_fired += 1;
6103- continue;
61046257 }
61056258 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count);
61066259 assert_eq!(frames.len(), frame_count);
@@ -6138,11 +6291,15 @@ mod tests {
61386291 decode-order frames, {arm_hidden} hidden, all pixel-exact vs the oracle"
61396292 );
61406293 }
6141- eprintln!(
6142- "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})"
6143- );
6144- return;
6294+ if counted {
6295+ eprintln!(
6296+ "{NAME} FIRING seed {seed}: 8x8 obmc hits {fired8} (total across attempts so far {total_obmc8})"
6297+ );
6298+ gate_buckets(NAME, 1, never_fired, refusals.len());
6299+ return;
6300+ }
61456301 }
6302+ gate_buckets(NAME, 0, never_fired, refusals.len());
61466303 eprintln!(
61476304 "SKIP {NAME}: {never_fired} attempts decoded but never fired an 8x8 obmc block \
61486305 ({total_obmc8} total 8x8 obmc hits across all attempts), and every other attempt \
@@ -9227,9 +9384,12 @@ mod tests {
92279384 }
92289385 Ok(frames) => frames,
92299386 };
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 {
92319392 never_fired += 1;
9232- continue;
92339393 }
92349394 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count);
92359395 assert_eq!(frames.len(), frame_count);
@@ -9257,12 +9417,16 @@ mod tests {
92579417 "{gate_name} frame {i} V vs ffmpeg (seed {seed})"
92589418 );
92599419 }
9260- eprintln!(
9261- "{gate_name} FIRING seed {seed}: tmv_hits advanced by {}",
9262- decode::tmv_hits() - before
9263- );
9264- return;
9420+ if counted {
9421+ eprintln!(
9422+ "{gate_name} FIRING seed {seed}: tmv_hits advanced by {}",
9423+ decode::tmv_hits() - before
9424+ );
9425+ gate_buckets(gate_name, 1, never_fired, refusals.len());
9426+ return;
9427+ }
92659428 }
9429+ gate_buckets(gate_name, 0, never_fired, refusals.len());
92669430 eprintln!(
92679431 "SKIP {gate_name}: {never_fired} attempts decoded but never fired a temporal MV \
92689432 candidate, and every other attempt hit a named refusal:\n{}",
@@ -9405,6 +9569,7 @@ mod tests {
94059569 let (width, height) = (64usize, 64usize);
94069570 let mut refusals = Vec::new();
94079571 let mut fired_runs = 0u32;
9572+ let mut uncounted_exact = 0u32;
94089573 for attempt in 0..60u32 {
94099574 let cq = 20 + (attempt % 5) * 10;
94109575 let period = [4u32, 6, 8, 12, 16][(attempt as usize / 5) % 5];
@@ -9498,11 +9663,16 @@ mod tests {
94989663 continue;
94999664 }
95009665 };
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;
95029672 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"
95049675 ));
9505- continue;
95069676 }
95079677 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1);
95089678 assert_eq!(
@@ -9517,11 +9687,25 @@ mod tests {
95179687 frames[0].v, ffmpeg_frames[0].v,
95189688 "V vs ffmpeg (cq={cq} period={period})"
95199689 );
9520- fired_runs += 1;
9521- if fired_runs >= 4 {
9522- return;
9690+ if counted {
9691+ fired_runs += 1;
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+ }
95239701 }
95249702 }
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+ );
95259709 panic!(
95269710 "fewer than 4 firing+pixel-exact runs out of 60 attempts:\n{}",
95279711 refusals.join("\n")