forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-hbdgates': 10-bit gates for filter/smooth/paeth intra, intra-edge-filter, rect+ab partitions; ten_bit_tool_gate driver; gate_coverage drops ignored gates (279/0/24 on branch); 10-bit LR gate un-ignored on the merged tree

Browse files at this commit

8c9548c0f209152d293492d18230848614846c3dAhmet Kaan GümüşParent: e6343c5208067a
NEVER_EXERCISED_10BIT keeps the union of both removals: main's three
(restoration, dist-wtd-comp, global-motion, closed by lane-hbdinter and
lane-cwarp) and hbdgates' six (filter/smooth/paeth intra, intra-edge-filter,
rect and ab partitions). gate_bodies()/is_ten_bit() take hbdgates' versions
(ignored gates excluded, helper-built recipes recognised).

a_real_aomenc_10bit_restoration_stream_decodes_pixel_exact was #[ignore]d on
the branch because hbdgates' base lacked main's 10-bit LR fix (SGR box-sum
scaling, Wiener clamp). On the merged tree it passes 16/16 attempts
pixel-exact, lr_hits=28, so the #[ignore] is removed.
crates/ec-av1/src/gate_coverage.rsmodified+17 -28
@@ -147,9 +147,11 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[
147 const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[147 const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
148 // Only 4 of the 45 real-aomenc gates encode at 10 bits, and they pin the148 // Only 4 of the 45 real-aomenc gates encode at 10 bits, and they pin the
149 // pixel filters and the intra tool set off. Every entry the 8-bit list149 // pixel filters and the intra tool set off. Every entry the 8-bit list
150- // carries is a hole here too; the seven extra ones below are tools an150+ // carries is a hole here too. lane-hbdgates r1 closed six of the seven
151- // 8-bit gate DOES enable, whose high-bit-depth path no stream has ever151+ // 8-bit-only entries with real 10-bit gates (filter-intra, smooth-intra,
152- // touched -- exactly the shape that hid the two lane-hbdinter defects.152+ // paeth-intra, intra-edge-filter, rect-partitions, ab-partitions); its
153+ // seventh, the 10-bit LR gate, was `#[ignore]`d on that branch and passes
154+ // un-ignored on main, which carries the fix.
153 // `enable-restoration` LEFT this list on 2026-09-01: lane-hbdinter's155 // `enable-restoration` LEFT this list on 2026-09-01: lane-hbdinter's
154 // 10-bit inter gate passes `--enable-restoration=1` and asserts a real156 // 10-bit inter gate passes `--enable-restoration=1` and asserts a real
155 // Wiener/SGR unit fired, which is what caught the two defects (SGR box157 // Wiener/SGR unit fired, which is what caught the two defects (SGR box
@@ -161,10 +163,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
161 "enable-1to4-partitions",163 "enable-1to4-partitions",
162 "hole at both depths, see the 8-bit list",164 "hole at both depths, see the 8-bit list",
163 ),165 ),
164- (
165- "enable-ab-partitions",
166- "8-bit only: no 10-bit gate enables AB partitions",
167- ),
168 (166 (
169 "enable-angle-delta",167 "enable-angle-delta",
170 "hole at both depths, see the 8-bit list",168 "hole at both depths, see the 8-bit list",
@@ -177,36 +175,16 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
177 "enable-dual-filter",175 "enable-dual-filter",
178 "hole at both depths, see the 8-bit list",176 "hole at both depths, see the 8-bit list",
179 ),177 ),
180- (
181- "enable-filter-intra",
182- "8-bit only: no 10-bit gate enables filter intra",
183- ),
184 (178 (
185 "enable-flip-idtx",179 "enable-flip-idtx",
186 "hole at both depths, see the 8-bit list",180 "hole at both depths, see the 8-bit list",
187 ),181 ),
188- (
189- "enable-intra-edge-filter",
190- "8-bit only: the 10-bit intra path never runs the edge filter",
191- ),
192 ("enable-intrabc", "hole at both depths, see the 8-bit list"),182 ("enable-intrabc", "hole at both depths, see the 8-bit list"),
193- (
194- "enable-paeth-intra",
195- "8-bit only: no 10-bit gate enables Paeth",
196- ),
197- (
198- "enable-rect-partitions",
199- "8-bit only: no 10-bit gate enables rect partitions",
200- ),
201 ("enable-rect-tx", "hole at both depths, see the 8-bit list"),183 ("enable-rect-tx", "hole at both depths, see the 8-bit list"),
202 (184 (
203 "enable-ref-frame-mvs",185 "enable-ref-frame-mvs",
204 "hole at both depths, see the 8-bit list",186 "hole at both depths, see the 8-bit list",
205 ),187 ),
206- (
207- "enable-smooth-intra",
208- "8-bit only: no 10-bit gate enables smooth intra",
209- ),
210 (188 (
211 "enable-superres",189 "enable-superres",
212 "the 10-bit superres gate drives `--superres-mode=1`, not this flag; see the 8-bit entry",190 "the 10-bit superres gate drives `--superres-mode=1`, not this flag; see the 8-bit entry",
@@ -226,7 +204,17 @@ mod tests {
226 let src = include_str!("stream.rs");204 let src = include_str!("stream.rs");
227 let gates: Vec<&str> = src205 let gates: Vec<&str> = src
228 .split("\n #[")206 .split("\n #[")
229- .filter(|body| body.contains("\"--passes=1\""))207+ // lane-hbdgates r1: an `#[ignore]`d gate exercises nothing, so it
208+ // must not close a hole. Its body is the segment that opens with
209+ // the ignore attribute.
210+ .filter(|body| !body.starts_with("ignore"))
211+ // lane-hbdgates r1: gates that build their stream through the
212+ // shared 10-bit helpers spell `--passes=1` there, not inline.
213+ .filter(|body| {
214+ body.contains("\"--passes=1\"")
215+ || body.contains("ten_bit_tool_gate(")
216+ || body.contains("encode_10bit_gradients")
217+ })
230 .collect();218 .collect();
231 assert!(219 assert!(
232 gates.len() >= 20,220 gates.len() >= 20,
@@ -341,6 +329,7 @@ mod tests {
341 /// 8-bit default.329 /// 8-bit default.
342 fn is_ten_bit(body: &str) -> bool {330 fn is_ten_bit(body: &str) -> bool {
343 body.contains("encode_10bit_gradients")331 body.contains("encode_10bit_gradients")
332+ || body.contains("ten_bit_tool_gate(")
344 || body.contains("--bit-depth=10")333 || body.contains("--bit-depth=10")
345 || body.contains("--input-bit-depth=10")334 || body.contains("--input-bit-depth=10")
346 || body.contains("yuv420p10le")335 || body.contains("yuv420p10le")
crates/ec-av1/src/intra.rsmodified+34 -0
@@ -235,6 +235,32 @@ impl Edges {
235 /// # Panics235 /// # Panics
236 /// Panics on a mode this module does not predict, or when `dst` is not236 /// Panics on a mode this module does not predict, or when `dst` is not
237 /// `bw * bh` long.237 /// `bw * bh` long.
238+// lane-hbdgates r1: per-tool firing counters for the 10-bit gates. Each tool
239+// the coverage table tracks needs its OWN counter -- `smooth_uv_hits` lumps
240+// SMOOTH..=PAETH together, so a paeth-only stream would have "proved" smooth
241+// intra ([[gate-blind-to-feature]]).
242+thread_local! {
243+ static SMOOTH_PRED_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
244+ static PAETH_PRED_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
245+ static EDGE_FILTER_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
246+}
247+
248+/// How many blocks were predicted with SMOOTH/SMOOTH_V/SMOOTH_H on this thread.
249+pub(crate) fn smooth_pred_hits() -> usize {
250+ SMOOTH_PRED_HITS.with(|c| c.get())
251+}
252+
253+/// How many blocks were predicted with PAETH_PRED on this thread.
254+pub(crate) fn paeth_pred_hits() -> usize {
255+ PAETH_PRED_HITS.with(|c| c.get())
256+}
257+
258+/// How many directional edges [`filter_intra_edge`] actually smoothed
259+/// (strength != 0) on this thread -- the `--enable-intra-edge-filter` proof.
260+pub(crate) fn intra_edge_filter_hits() -> usize {
261+ EDGE_FILTER_HITS.with(|c| c.get())
262+}
263+
238 #[allow(clippy::too_many_arguments)]264 #[allow(clippy::too_many_arguments)]
239 pub fn predict(265 pub fn predict(
240 mode: u8,266 mode: u8,
@@ -249,6 +275,13 @@ pub fn predict(
249 dst: &mut [u16],275 dst: &mut [u16],
250 ) {276 ) {
251 assert_eq!(dst.len(), bw * bh, "the destination is the block");277 assert_eq!(dst.len(), bw * bh, "the destination is the block");
278+ match mode {
279+ SMOOTH_PRED | SMOOTH_V_PRED | SMOOTH_H_PRED => {
280+ SMOOTH_PRED_HITS.with(|c| c.set(c.get() + 1));
281+ }
282+ PAETH_PRED => PAETH_PRED_HITS.with(|c| c.set(c.get() + 1)),
283+ _ => {}
284+ }
252 let edges = Edges::build(above, left, corner, bw, bh);285 let edges = Edges::build(above, left, corner, bw, bh);
253 let is_directional = matches!(286 let is_directional = matches!(
254 mode,287 mode,
@@ -410,6 +443,7 @@ fn filter_intra_edge(buf: &mut [i32], strength: i32) {
410 if strength == 0 {443 if strength == 0 {
411 return;444 return;
412 }445 }
446+ EDGE_FILTER_HITS.with(|c| c.set(c.get() + 1));
413 const KERNEL: [[i32; 5]; 3] = [[0, 4, 8, 4, 0], [0, 5, 6, 5, 0], [2, 4, 4, 4, 2]];447 const KERNEL: [[i32; 5]; 3] = [[0, 4, 8, 4, 0], [0, 5, 6, 5, 0], [2, 4, 4, 4, 2]];
414 let filt = usize::try_from(strength - 1).expect("a filter strength is never negative");448 let filt = usize::try_from(strength - 1).expect("a filter strength is never negative");
415 let sz = buf.len() as i32;449 let sz = buf.len() as i32;
crates/ec-av1/src/stream.rsmodified+318 -7
@@ -2631,6 +2631,300 @@ mod tests {
2631 );2631 );
2632 }2632 }
2633 2633
2634+ /// lane-hbdgates r1: drive one 10-bit aomenc recipe over `seeds`, decode
2635+ /// every attempt and pixel-compare every SHOWN frame against ffmpeg's own
2636+ /// 10-bit decode of the identical bytes. Per-tool firing counters are
2637+ /// sampled PER ATTEMPT and summed only over attempts that decoded *and*
2638+ /// compared -- a stream that hit a named refusal contributes nothing
2639+ /// (class `counter-from-refused-stream`). Named refusals are tolerated
2640+ /// and reported; a pixel mismatch is a hard failure, never a SKIP.
2641+ fn ten_bit_tool_gate(
2642+ name: &str,
2643+ width: usize,
2644+ height: usize,
2645+ frames: usize,
2646+ extra: &[&str],
2647+ seeds: &[u32],
2648+ counters: &[(&str, fn() -> usize)],
2649+ ) {
2650+ fn first_diff(ours: &[u16], theirs: &[u16], width: usize) -> Option<String> {
2651+ ours.iter()
2652+ .zip(theirs.iter())
2653+ .position(|(a, b)| a != b)
2654+ .map(|i| {
2655+ format!(
2656+ "first diff at index {i} (row {}, col {}): ours {} vs ffmpeg {}",
2657+ i / width,
2658+ i % width,
2659+ ours[i],
2660+ theirs[i]
2661+ )
2662+ })
2663+ }
2664+ let mut totals = vec![0usize; counters.len()];
2665+ let mut refusals: Vec<String> = Vec::new();
2666+ let mut compared = 0usize;
2667+ for &seed in seeds {
2668+ let stream = encode_10bit_gradients_seed(name, seed, width, height, frames, extra);
2669+ assert_eq!(
2670+ parsed_bit_depth(&stream),
2671+ 10,
2672+ "{name}: aomenc did not write a 10-bit sequence header (seed {seed})"
2673+ );
2674+ let before: Vec<usize> = counters.iter().map(|(_, f)| f()).collect();
2675+ let decoded = match decode_stream(&stream) {
2676+ Ok(frames) => frames,
2677+ Err(e) => {
2678+ refusals.push(format!("seed {seed}: {e}"));
2679+ continue;
2680+ }
2681+ };
2682+ // Deltas are read BEFORE the pixel compare so a mismatch report
2683+ // says whether the tool under test actually fired on the failing
2684+ // stream (a mismatch with a zero delta is some other defect).
2685+ let deltas: Vec<usize> = counters
2686+ .iter()
2687+ .zip(before.iter())
2688+ .map(|((_, f), b)| f() - b)
2689+ .collect();
2690+ let fired: Vec<String> = counters
2691+ .iter()
2692+ .zip(deltas.iter())
2693+ .map(|((label, _), d)| format!("{label}={d}"))
2694+ .collect();
2695+ let fired = fired.join(" ");
2696+ let reference = ffmpeg_decode_sequence_10bit(&stream, width, height, decoded.len());
2697+ assert_eq!(
2698+ decoded.len(),
2699+ reference.len(),
2700+ "{name}: seed {seed}: shown-frame count vs ffmpeg"
2701+ );
2702+ for (i, (ours, theirs)) in decoded.iter().zip(reference.iter()).enumerate() {
2703+ for (plane, (a, b), w) in [
2704+ ("Y", (&ours.y, &theirs.y), width),
2705+ ("U", (&ours.u, &theirs.u), width / 2),
2706+ ("V", (&ours.v, &theirs.v), width / 2),
2707+ ] {
2708+ if let Some(d) = first_diff(a, b, w) {
2709+ panic!("{name}: seed {seed} frame {i} plane {plane}: {d} [{fired}]");
2710+ }
2711+ }
2712+ }
2713+ compared += 1;
2714+ for (i, d) in deltas.iter().enumerate() {
2715+ totals[i] += d;
2716+ }
2717+ }
2718+ assert!(
2719+ compared > 0,
2720+ "{name}: every attempt hit a named refusal:\n{}",
2721+ refusals.join("\n")
2722+ );
2723+ for (i, (label, _)) in counters.iter().enumerate() {
2724+ assert!(
2725+ totals[i] > 0,
2726+ "{name}: {compared} attempt(s) decoded pixel-exact but {label} never fired -- \
2727+ the gate would prove nothing about that tool. refusals:\n{}",
2728+ refusals.join("\n")
2729+ );
2730+ }
2731+ let summary: Vec<String> = counters
2732+ .iter()
2733+ .zip(totals.iter())
2734+ .map(|((label, _), t)| format!("{label}={t}"))
2735+ .collect();
2736+ eprintln!(
2737+ "{name}: {compared}/{} attempts pixel-exact, {}",
2738+ seeds.len(),
2739+ summary.join(" ")
2740+ );
2741+ }
2742+
2743+ /// lane-hbdgates r1: the four intra tools that had an 8-bit gate and no
2744+ /// 10-bit one (`filter-intra`, `smooth-intra`, `paeth-intra`,
2745+ /// `intra-edge-filter`) on ONE real 10-bit `aomenc` key frame, each with
2746+ /// its own hard-asserted counter. His two films are yuv420p10le, so an
2747+ /// 8-bit-only gate for these tools proves nothing about the streams that
2748+ /// matter (lane-covbd r1).
2749+ #[test]
2750+ fn a_real_aomenc_10bit_intra_tools_stream_decodes_pixel_exact() {
2751+ const NAME: &str = "a_real_aomenc_10bit_intra_tools_stream_decodes_pixel_exact";
2752+ if !have_ffmpeg() {
2753+ eprintln!("SKIP {NAME}: no ffmpeg");
2754+ return;
2755+ }
2756+ if !have_aomenc() {
2757+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
2758+ return;
2759+ }
2760+ ten_bit_tool_gate(
2761+ NAME,
2762+ 64,
2763+ 64,
2764+ 1,
2765+ &[
2766+ "--limit=1",
2767+ "--kf-max-dist=0",
2768+ "--enable-filter-intra=1",
2769+ "--enable-smooth-intra=1",
2770+ "--enable-paeth-intra=1",
2771+ "--enable-intra-edge-filter=1",
2772+ "--enable-directional-intra=1",
2773+ "--enable-angle-delta=0",
2774+ "--enable-rect-partitions=0",
2775+ "--enable-ab-partitions=0",
2776+ "--enable-1to4-partitions=0",
2777+ "--enable-tx-size-search=0",
2778+ "--enable-cdef=0",
2779+ "--enable-restoration=0",
2780+ "--max-partition-size=32",
2781+ "--min-partition-size=16",
2782+ "--enable-palette=0",
2783+ "--enable-intrabc=0",
2784+ "--enable-cfl-intra=0",
2785+ "--enable-ref-frame-mvs=0",
2786+ ],
2787+ &[42, 7, 11, 23, 31, 57],
2788+ &[
2789+ ("filter_intra_hits", decode::filter_intra_hits),
2790+ ("smooth_pred_hits", crate::intra::smooth_pred_hits),
2791+ ("paeth_pred_hits", crate::intra::paeth_pred_hits),
2792+ ("intra_edge_filter_hits", crate::intra::intra_edge_filter_hits),
2793+ ],
2794+ );
2795+ }
2796+
2797+ /// lane-hbdgates r1: `--enable-restoration=1` at 10 bits. Every earlier
2798+ /// bit-depth gate ran `--enable-restoration=0`, which is exactly why two
2799+ /// high-bit-depth loop-restoration defects survived to 2026-09-01
2800+ /// (SGR box sums unscaled, Wiener clamp at the 8-bit bound). Same recipe
2801+ /// as the 8-bit LR gate, at 10 bits.
2802+ // Written `#[ignore]`d on lane-hbdgates (the branch lacked lane-hbdinter's
2803+ // 10-bit LR fix and failed at seed 42, frame 0, Y index 122: ours 351 vs
2804+ // ffmpeg 350). Un-ignored on the merge into main 2026-09-01, where the
2805+ // SGR box-sum scaling and the Wiener clamp are fixed: 16/16 attempts
2806+ // pixel-exact, lr_hits=28.
2807+ #[test]
2808+ fn a_real_aomenc_10bit_restoration_stream_decodes_pixel_exact() {
2809+ const NAME: &str = "a_real_aomenc_10bit_restoration_stream_decodes_pixel_exact";
2810+ if !have_ffmpeg() {
2811+ eprintln!("SKIP {NAME}: no ffmpeg");
2812+ return;
2813+ }
2814+ if !have_aomenc() {
2815+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
2816+ return;
2817+ }
2818+ // 192x128 = 3x2 superblocks, so `read_lr` is re-entered per SB
2819+ // (the 8-bit LR gate's own trap warning); cq-level=15 because
2820+ // aomenc's RD only picks a non-RESTORE_NONE frame type at low cq.
2821+ ten_bit_tool_gate(
2822+ NAME,
2823+ 192,
2824+ 128,
2825+ 1,
2826+ &[
2827+ "--limit=1",
2828+ "--kf-max-dist=0",
2829+ "--cq-level=15",
2830+ "--enable-restoration=1",
2831+ "--enable-cdef=0",
2832+ "--enable-rect-partitions=0",
2833+ "--enable-ab-partitions=0",
2834+ "--enable-1to4-partitions=0",
2835+ "--enable-filter-intra=0",
2836+ "--enable-smooth-intra=0",
2837+ "--enable-paeth-intra=0",
2838+ "--enable-tx-size-search=0",
2839+ "--max-partition-size=32",
2840+ "--min-partition-size=16",
2841+ "--enable-palette=0",
2842+ "--enable-intrabc=0",
2843+ "--enable-cfl-intra=0",
2844+ "--enable-ref-frame-mvs=0",
2845+ ],
2846+ &LR_SEEDS,
2847+ &[("lr_hits", ten_bit_lr_hits)],
2848+ );
2849+ }
2850+
2851+ /// Seeds swept by the 10-bit LR gate (the 8-bit gate needs ~40 attempts
2852+ /// to land a non-RESTORE_NONE frame; every attempt here still has to
2853+ /// decode pixel-exact).
2854+ const LR_SEEDS: [u32; 16] = [42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57];
2855+
2856+ /// Wiener + SGR + switchable loop-restoration firings, summed.
2857+ fn ten_bit_lr_hits() -> usize {
2858+ crate::restoration::wiener_hits()
2859+ + crate::restoration::sgrproj_hits()
2860+ + crate::restoration::switchable_hits()
2861+ }
2862+
2863+ /// lane-hbdgates r1: `--enable-rect-partitions=1 --enable-ab-partitions=1`
2864+ /// at 10 bits, one intra stream, one counter per tool
2865+ /// (`rect_partition_hits`, `partab_hits`) so a stream that only fired the
2866+ /// rect arms cannot stand in for AB.
2867+ #[test]
2868+ fn a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact() {
2869+ const NAME: &str = "a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact";
2870+ if !have_ffmpeg() {
2871+ eprintln!("SKIP {NAME}: no ffmpeg");
2872+ return;
2873+ }
2874+ if !have_aomenc() {
2875+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
2876+ return;
2877+ }
2878+ // The 8-bit free-partition/AB recipe, verbatim, at 10 bits: AB
2879+ // splits are an INTER dispatch here (intra-frame AB is still a named
2880+ // refusal), so the stream needs alt-refs and 24 frames, not one key
2881+ // frame.
2882+ ten_bit_tool_gate(
2883+ NAME,
2884+ 64,
2885+ 64,
2886+ 24,
2887+ &[
2888+ "--cq-level=45",
2889+ "--kf-max-dist=1000",
2890+ "--auto-alt-ref=1",
2891+ "--lag-in-frames=16",
2892+ "--enable-fwd-kf=0",
2893+ "--enable-order-hint=1",
2894+ "--enable-warped-motion=1",
2895+ "--enable-obmc=1",
2896+ "--tune-content=default",
2897+ "--enable-masked-comp=0",
2898+ "--enable-interintra-comp=0",
2899+ "--enable-onesided-comp=0",
2900+ "--enable-interintra-wedge=0",
2901+ "--enable-smooth-interintra=0",
2902+ "--enable-rect-partitions=1",
2903+ "--enable-ab-partitions=1",
2904+ "--enable-1to4-partitions=0",
2905+ "--enable-filter-intra=0",
2906+ "--enable-smooth-intra=0",
2907+ "--enable-paeth-intra=0",
2908+ "--enable-directional-intra=0",
2909+ "--enable-angle-delta=0",
2910+ "--enable-tx-size-search=0",
2911+ "--enable-cdef=0",
2912+ "--enable-restoration=0",
2913+ "--max-partition-size=32",
2914+ "--min-partition-size=16",
2915+ "--enable-palette=0",
2916+ "--enable-intrabc=0",
2917+ "--enable-cfl-intra=0",
2918+ "--enable-ref-frame-mvs=0",
2919+ ],
2920+ &LR_SEEDS,
2921+ &[
2922+ ("rect_partition_hits", decode::rect_partition_hits),
2923+ ("partab_hits", decode::partab_hits),
2924+ ],
2925+ );
2926+ }
2927+
2634 /// `bit_depth` of the first sequence header in `stream`.2928 /// `bit_depth` of the first sequence header in `stream`.
2635 fn parsed_bit_depth(stream: &[u8]) -> u8 {2929 fn parsed_bit_depth(stream: &[u8]) -> u8 {
2636 let mut probe = Av1Parser::new();2930 let mut probe = Av1Parser::new();
@@ -2655,6 +2949,20 @@ mod tests {
2655 height: usize,2949 height: usize,
2656 frames: usize,2950 frames: usize,
2657 extra: &[&str],2951 extra: &[&str],
2952+ ) -> Vec<u8> {
2953+ encode_10bit_gradients_seed(name, 42, width, height, frames, extra)
2954+ }
2955+
2956+ /// As [`encode_10bit_gradients`], but with the fixture seed exposed --
2957+ /// lane-hbdgates r1 sweeps seeds so a tool that aomenc's RD declines on
2958+ /// one fixture still gets a firing stream.
2959+ fn encode_10bit_gradients_seed(
2960+ name: &str,
2961+ seed: u32,
2962+ width: usize,
2963+ height: usize,
2964+ frames: usize,
2965+ extra: &[&str],
2658 ) -> Vec<u8> {2966 ) -> Vec<u8> {
2659 let duration = frames as f64 / 25.0;2967 let duration = frames as f64 / 25.0;
2660 let y4m = Command::new("ffmpeg")2968 let y4m = Command::new("ffmpeg")
@@ -2664,7 +2972,7 @@ mod tests {
2664 "-f",2972 "-f",
2665 "lavfi",2973 "lavfi",
2666 "-i",2974 "-i",
2667- &gradients_source(42, width, height, &format!("duration={duration}:rate=25")),2975+ &gradients_source(seed, width, height, &format!("duration={duration}:rate=25")),
2668 "-pix_fmt",2976 "-pix_fmt",
2669 "yuv420p10le",2977 "yuv420p10le",
2670 "-strict",2978 "-strict",
@@ -2685,18 +2993,21 @@ mod tests {
2685 "{name}: ffmpeg failed to render the 10-bit fixture: {}",2993 "{name}: ffmpeg failed to render the 10-bit fixture: {}",
2686 String::from_utf8_lossy(&y4m.stderr)2994 String::from_utf8_lossy(&y4m.stderr)
2687 );2995 );
2688- let mut args: Vec<&str> = vec![2996+ let mut args: Vec<&str> = vec!["--codec=av1", "--passes=1", "--end-usage=q"];
2689- "--codec=av1",2997+ // lane-hbdgates r1: a caller-supplied `--cq-level` REPLACES the
2690- "--passes=1",2998+ // default rather than being appended after it -- two `--cq-level`
2691- "--end-usage=q",2999+ // flags on one aomenc line is a coin flip on which one lands.
2692- "--cq-level=30",3000+ if !extra.iter().any(|a| a.starts_with("--cq-level=")) {
3001+ args.push("--cq-level=30");
3002+ }
3003+ args.extend_from_slice(&[
2693 "--cpu-used=0",3004 "--cpu-used=0",
2694 "--threads=1",3005 "--threads=1",
2695 "--row-mt=0",3006 "--row-mt=0",
2696 "--sb-size=64",3007 "--sb-size=64",
2697 "--input-bit-depth=10",3008 "--input-bit-depth=10",
2698 "--bit-depth=10",3009 "--bit-depth=10",
2699- ];3010+ ]);
2700 args.extend_from_slice(extra);3011 args.extend_from_slice(extra);
2701 args.extend_from_slice(&["--obu", "-o", "-", "-"]);3012 args.extend_from_slice(&["--obu", "-o", "-", "-"]);
2702 let mut child = Command::new(aomenc_path())3013 let mut child = Command::new(aomenc_path())
lanes/hbdgates-r1.report.mdadded+82 -0
@@ -0,0 +1,82 @@
1+# lane-hbdgates r1 — 10-bit gates for the seven 8-bit-only tools
2+
3+His two films are yuv420p10le, so an 8-bit-only gate proves nothing about the streams that
4+matter. lane-covbd r1 named seven tools positively enabled by an 8-bit gate and by no 10-bit
5+gate. Six are now closed with real-aomenc 10-bit gates; the seventh (restoration) has its
6+gate written and it FAILS on a real 10-bit defect.
7+
8+## Result table
9+
10+| tool | gate | result | first diff |
11+|---|---|---|---|
12+| filter-intra | `a_real_aomenc_10bit_intra_tools_stream_decodes_pixel_exact` | PASS, 6/6 attempts pixel-exact, `filter_intra_hits=2` | — |
13+| smooth-intra | same gate | PASS, `smooth_pred_hits=16` | — |
14+| paeth-intra | same gate | PASS, `paeth_pred_hits=3` | — |
15+| intra-edge-filter | same gate | PASS, `intra_edge_filter_hits=22` | — |
16+| rect-partitions | `a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact` | PASS, 12/16 attempts pixel-exact (4 named refusals), `rect_partition_hits=32` | — |
17+| ab-partitions | same gate | PASS, `partab_hits=4` | — |
18+| restoration | `a_real_aomenc_10bit_restoration_stream_decodes_pixel_exact` | **FAIL — `#[ignore]`d, real 10-bit LR defect** | seed 42, frame 0, plane Y, index 122 (row 0, col 122): ours **351** vs ffmpeg **350**, on a stream where `lr_hits=2` |
19+
20+## What changed
21+- `crates/ec-av1/src/intra.rs`
22+ - `smooth_pred_hits()` / `paeth_pred_hits()` (counted at the top of `predict`) and
23+ `intra_edge_filter_hits()` (counted inside `filter_intra_edge`, strength != 0).
24+ Separate counters per tool on purpose: the pre-existing `smooth_uv_hits` lumps
25+ SMOOTH..=PAETH together, so a paeth-only stream would have "proved" smooth intra
26+ ([[gate-blind-to-feature]]).
27+- `crates/ec-av1/src/stream.rs`
28+ - `ten_bit_tool_gate(name, w, h, frames, extra, seeds, counters)`: drives one 10-bit
29+ aomenc recipe over a seed sweep, decodes each attempt, pixel-compares EVERY shown
30+ frame against ffmpeg's own 10-bit decode, and sums each tool counter **per attempt,
31+ only over attempts that decoded and compared** (class `counter-from-refused-stream`).
32+ Named decode refusals are tolerated and reported; a pixel mismatch panics with
33+ plane + first-diff index + both values + the per-attempt firing deltas; no SKIP path.
34+ - `encode_10bit_gradients_seed(...)`: the existing helper with the fixture seed exposed;
35+ `encode_10bit_gradients` now delegates with seed 42 (all three prior call sites
36+ unchanged). A caller-supplied `--cq-level` now REPLACES the built-in `--cq-level=30`
37+ instead of being appended after it (two `--cq-level` on one aomenc line is a coin flip).
38+ - the three gates above.
39+- `crates/ec-av1/src/gate_coverage.rs`
40+ - `gate_bodies()` now (a) drops `#[ignore]`d gates — an ignored gate exercises nothing and
41+ must not close a hole — and (b) recognises gates that spell `--passes=1` inside the
42+ shared 10-bit helpers (`ten_bit_tool_gate` / `encode_10bit_gradients`); `is_ten_bit`
43+ likewise. 45 -> 49 gates parsed, 4 -> 7 of them 10-bit.
44+ - six entries deleted from `NEVER_EXERCISED_10BIT` (filter-intra, smooth-intra,
45+ paeth-intra, intra-edge-filter, rect-partitions, ab-partitions); `enable-restoration`
46+ kept with the failing-gate reason inline. 19 -> 13 holes.
47+
48+## Gate commands + results
49+- `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --nocapture --test-threads=1 10bit_intra_tools`
50+ -> `6/6 attempts pixel-exact, filter_intra_hits=2 smooth_pred_hits=16 paeth_pred_hits=3 intra_edge_filter_hits=22`
51+- `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --nocapture --test-threads=1 rect_and_ab`
52+ -> `12/16 attempts pixel-exact, rect_partition_hits=32 partab_hits=4`
53+- `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --nocapture --test-threads=1 10bit_restoration`
54+ (run with the `#[ignore]` overridden) -> FAIL, message above.
55+- `cargo test -p ec-av1 --lib gate_coverage -- --nocapture` -> 5 passed, 0 failed;
56+ `gate_coverage: 49 real-aomenc gates, 7 of them 10-bit`, `NEVER_EXERCISED_10BIT (13 of 26)`.
57+
58+EVIDENCE: crates/ec-av1/src/stream.rs (3 new gates) | EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib | intra-tools 6/6 pixel-exact (4 counters non-zero), rect+ab 12/16 pixel-exact (rect=32 partab=4), 10-bit LR gate fails Y[122] 351 vs 350 with lr_hits=2
59+
60+## Refusals lifted
61+None — this lane authors gates only; no decode behaviour changed. The rect/ab gate's 4
62+non-matching attempts are named refusals reported by the gate, not silenced.
63+
64+## Residue
65+- **fix-now (follow-on lane): the 10-bit loop-restoration defect.** Pinned recipe:
66+ `encode_10bit_gradients_seed(name, 42, 192, 128, 1, ...)` with `--cq-level=15
67+ --enable-restoration=1 --enable-cdef=0` (full list in the gate). `lr_hits=2` on the
68+ failing stream, so the LR filters ran; the mismatch is one LSB at 10 bits on the very
69+ first row, the shape of an unscaled box sum / an 8-bit clamp bound. Un-ignore the gate
70+ with the fix; do NOT weaken it. lane-hbdinter reports fixes of that shape on its own
71+ branch — if that merges first, re-run this gate before assuming the defect is still open.
72+- accepted: `enable-angle-delta`, `enable-cfl-intra`, `enable-1to4-partitions`,
73+ `enable-rect-tx`, `enable-tx64`, `enable-flip-idtx`, `enable-global-motion`,
74+ `enable-intrabc`, `enable-dist-wtd-comp`, `enable-dual-filter`, `enable-ref-frame-mvs`,
75+ `enable-superres` remain 10-bit holes — they are holes at 8 bits too (or flag-spelling
76+ aliases), so they belong to the lanes that gate them at all, not to this one.
77+
78+## Suite totals
79+`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib` (lane worktree, commit 6adca66 state)
80+-> **279 passed; 0 failed; 24 ignored**, 1640s. The 24 ignored include this lane's
81+`a_real_aomenc_10bit_restoration_stream_decodes_pixel_exact` (the failing 10-bit LR gate)
82+and 23 pre-existing ignores.