forge
Explore
Log in

Don't you dare go Hollow

10-bit gates for the seven tools only an 8-bit gate ever enabled

Browse files at this commit

576f72dcd75652f07cda040fafccd3edf3201ccfAhmet Kaan GümüşParent: 0810a85
  • test
    • 10-bit gates for the seven tools only an 8-bit gate ever enabled
Show full message
test(av1): 10-bit gates for the seven tools only an 8-bit gate ever enabled

His two films are yuv420p10le, so a tool gated only at 8 bits is ungated where
it matters (lane-covbd r1). Six of the seven holes close with real-aomenc
10-bit streams, pixel-exact vs ffmpeg on every shown frame:

- a_real_aomenc_10bit_intra_tools_stream_decodes_pixel_exact -- filter-intra,
  smooth-intra, paeth-intra, intra-edge-filter on one key frame, a separate
  hard-asserted counter each (6/6 attempts exact; filter_intra_hits=2
  smooth_pred_hits=16 paeth_pred_hits=3 intra_edge_filter_hits=22).
- a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact -- the 8-bit
  free-partition/AB inter recipe at 10 bits (12/16 attempts exact, 4 named
  refusals; rect_partition_hits=32 partab_hits=4).
- a_real_aomenc_10bit_restoration_stream_decodes_pixel_exact -- WRITTEN AND
  FAILING, so #[ignore]d with the pin in the attribute: seed 42, frame 0,
  plane Y index 122, ours 351 vs ffmpeg 350, on a stream where lr_hits=2.
  That is a real 10-bit loop-restoration defect for a follow-on lane; the gate
  is not weakened and enable-restoration stays a listed 10-bit hole.

intra.rs gains per-tool counters (smooth_pred_hits / paeth_pred_hits /
intra_edge_filter_hits) because smooth_uv_hits lumps SMOOTH..=PAETH together
and would have let a paeth-only stream "prove" smooth intra.

ten_bit_tool_gate() samples every counter PER ATTEMPT and sums only over
attempts that decoded AND compared, so a refused stream can never contribute a
firing; a pixel mismatch panics with plane + first-diff index + both values +
the firing deltas, never SKIPs.

gate_coverage: gate_bodies() now drops #[ignore]d gates (an ignored gate
exercises nothing) and recognises gates whose --passes=1 lives in the shared
10-bit helper; 45 -> 49 gates, 4 -> 7 ten-bit, NEVER_EXERCISED_10BIT 19 -> 13.
crates/ec-av1/src/gate_coverage.rsmodified+18 -29
@@ -147,17 +147,15 @@ 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); the
153+ // seventh, `enable-restoration`, has a 10-bit gate that FAILS and is
154+ // therefore `#[ignore]`d, so its hole stays open.
153 (155 (
154 "enable-1to4-partitions",156 "enable-1to4-partitions",
155 "hole at both depths, see the 8-bit list",157 "hole at both depths, see the 8-bit list",
156 ),158 ),
157- (
158- "enable-ab-partitions",
159- "8-bit only: no 10-bit gate enables AB partitions",
160- ),
161 (159 (
162 "enable-angle-delta",160 "enable-angle-delta",
163 "hole at both depths, see the 8-bit list",161 "hole at both depths, see the 8-bit list",
@@ -174,10 +172,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
174 "enable-dual-filter",172 "enable-dual-filter",
175 "hole at both depths, see the 8-bit list",173 "hole at both depths, see the 8-bit list",
176 ),174 ),
177- (
178- "enable-filter-intra",
179- "8-bit only: no 10-bit gate enables filter intra",
180- ),
181 (175 (
182 "enable-flip-idtx",176 "enable-flip-idtx",
183 "hole at both depths, see the 8-bit list",177 "hole at both depths, see the 8-bit list",
@@ -186,19 +180,7 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
186 "enable-global-motion",180 "enable-global-motion",
187 "hole at both depths, see the 8-bit list",181 "hole at both depths, see the 8-bit list",
188 ),182 ),
189- (
190- "enable-intra-edge-filter",
191- "8-bit only: the 10-bit intra path never runs the edge filter",
192- ),
193 ("enable-intrabc", "hole at both depths, see the 8-bit list"),183 ("enable-intrabc", "hole at both depths, see the 8-bit list"),
194- (
195- "enable-paeth-intra",
196- "8-bit only: no 10-bit gate enables Paeth",
197- ),
198- (
199- "enable-rect-partitions",
200- "8-bit only: no 10-bit gate enables rect partitions",
201- ),
202 ("enable-rect-tx", "hole at both depths, see the 8-bit list"),184 ("enable-rect-tx", "hole at both depths, see the 8-bit list"),
203 (185 (
204 "enable-ref-frame-mvs",186 "enable-ref-frame-mvs",
@@ -206,11 +188,7 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
206 ),188 ),
207 (189 (
208 "enable-restoration",190 "enable-restoration",
209- "8-bit only -- THE instance this split was built for: every 10-bit gate passed `--enable-restoration=0`, so the SGR box sums and the Wiener clamp were never run at 10 bits and both were wrong (lane-hbdinter, 2026-09-01)",191+ "8-bit only -- THE instance this split was built for: every 10-bit gate passed `--enable-restoration=0`, so the SGR box sums and the Wiener clamp were never run at 10 bits and both were wrong (lane-hbdinter, 2026-09-01). lane-hbdgates r1 WROTE the 10-bit LR gate (`a_real_aomenc_10bit_restoration_stream_decodes_pixel_exact`) and it FAILS pixel-exact on a stream where the LR filters demonstrably ran (lr_hits=2, seed 42, frame 0, Y index 122: ours 351 vs ffmpeg 350), so it is `#[ignore]`d and the hole stays open until that defect is fixed",
210- ),
211- (
212- "enable-smooth-intra",
213- "8-bit only: no 10-bit gate enables smooth intra",
214 ),192 ),
215 (193 (
216 "enable-superres",194 "enable-superres",
@@ -231,7 +209,17 @@ mod tests {
231 let src = include_str!("stream.rs");209 let src = include_str!("stream.rs");
232 let gates: Vec<&str> = src210 let gates: Vec<&str> = src
233 .split("\n #[")211 .split("\n #[")
234- .filter(|body| body.contains("\"--passes=1\""))212+ // lane-hbdgates r1: an `#[ignore]`d gate exercises nothing, so it
213+ // must not close a hole. Its body is the segment that opens with
214+ // the ignore attribute.
215+ .filter(|body| !body.starts_with("ignore"))
216+ // lane-hbdgates r1: gates that build their stream through the
217+ // shared 10-bit helpers spell `--passes=1` there, not inline.
218+ .filter(|body| {
219+ body.contains("\"--passes=1\"")
220+ || body.contains("ten_bit_tool_gate(")
221+ || body.contains("encode_10bit_gradients")
222+ })
235 .collect();223 .collect();
236 assert!(224 assert!(
237 gates.len() >= 20,225 gates.len() >= 20,
@@ -346,6 +334,7 @@ mod tests {
346 /// 8-bit default.334 /// 8-bit default.
347 fn is_ten_bit(body: &str) -> bool {335 fn is_ten_bit(body: &str) -> bool {
348 body.contains("encode_10bit_gradients")336 body.contains("encode_10bit_gradients")
337+ || body.contains("ten_bit_tool_gate(")
349 || body.contains("--bit-depth=10")338 || body.contains("--bit-depth=10")
350 || body.contains("--input-bit-depth=10")339 || body.contains("--input-bit-depth=10")
351 || body.contains("yuv420p10le")340 || 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
@@ -2123,6 +2123,300 @@ mod tests {
2123 );2123 );
2124 }2124 }
2125 2125
2126+ /// lane-hbdgates r1: drive one 10-bit aomenc recipe over `seeds`, decode
2127+ /// every attempt and pixel-compare every SHOWN frame against ffmpeg's own
2128+ /// 10-bit decode of the identical bytes. Per-tool firing counters are
2129+ /// sampled PER ATTEMPT and summed only over attempts that decoded *and*
2130+ /// compared -- a stream that hit a named refusal contributes nothing
2131+ /// (class `counter-from-refused-stream`). Named refusals are tolerated
2132+ /// and reported; a pixel mismatch is a hard failure, never a SKIP.
2133+ fn ten_bit_tool_gate(
2134+ name: &str,
2135+ width: usize,
2136+ height: usize,
2137+ frames: usize,
2138+ extra: &[&str],
2139+ seeds: &[u32],
2140+ counters: &[(&str, fn() -> usize)],
2141+ ) {
2142+ fn first_diff(ours: &[u16], theirs: &[u16], width: usize) -> Option<String> {
2143+ ours.iter()
2144+ .zip(theirs.iter())
2145+ .position(|(a, b)| a != b)
2146+ .map(|i| {
2147+ format!(
2148+ "first diff at index {i} (row {}, col {}): ours {} vs ffmpeg {}",
2149+ i / width,
2150+ i % width,
2151+ ours[i],
2152+ theirs[i]
2153+ )
2154+ })
2155+ }
2156+ let mut totals = vec![0usize; counters.len()];
2157+ let mut refusals: Vec<String> = Vec::new();
2158+ let mut compared = 0usize;
2159+ for &seed in seeds {
2160+ let stream = encode_10bit_gradients_seed(name, seed, width, height, frames, extra);
2161+ assert_eq!(
2162+ parsed_bit_depth(&stream),
2163+ 10,
2164+ "{name}: aomenc did not write a 10-bit sequence header (seed {seed})"
2165+ );
2166+ let before: Vec<usize> = counters.iter().map(|(_, f)| f()).collect();
2167+ let decoded = match decode_stream(&stream) {
2168+ Ok(frames) => frames,
2169+ Err(e) => {
2170+ refusals.push(format!("seed {seed}: {e}"));
2171+ continue;
2172+ }
2173+ };
2174+ // Deltas are read BEFORE the pixel compare so a mismatch report
2175+ // says whether the tool under test actually fired on the failing
2176+ // stream (a mismatch with a zero delta is some other defect).
2177+ let deltas: Vec<usize> = counters
2178+ .iter()
2179+ .zip(before.iter())
2180+ .map(|((_, f), b)| f() - b)
2181+ .collect();
2182+ let fired: Vec<String> = counters
2183+ .iter()
2184+ .zip(deltas.iter())
2185+ .map(|((label, _), d)| format!("{label}={d}"))
2186+ .collect();
2187+ let fired = fired.join(" ");
2188+ let reference = ffmpeg_decode_sequence_10bit(&stream, width, height, decoded.len());
2189+ assert_eq!(
2190+ decoded.len(),
2191+ reference.len(),
2192+ "{name}: seed {seed}: shown-frame count vs ffmpeg"
2193+ );
2194+ for (i, (ours, theirs)) in decoded.iter().zip(reference.iter()).enumerate() {
2195+ for (plane, (a, b), w) in [
2196+ ("Y", (&ours.y, &theirs.y), width),
2197+ ("U", (&ours.u, &theirs.u), width / 2),
2198+ ("V", (&ours.v, &theirs.v), width / 2),
2199+ ] {
2200+ if let Some(d) = first_diff(a, b, w) {
2201+ panic!("{name}: seed {seed} frame {i} plane {plane}: {d} [{fired}]");
2202+ }
2203+ }
2204+ }
2205+ compared += 1;
2206+ for (i, d) in deltas.iter().enumerate() {
2207+ totals[i] += d;
2208+ }
2209+ }
2210+ assert!(
2211+ compared > 0,
2212+ "{name}: every attempt hit a named refusal:\n{}",
2213+ refusals.join("\n")
2214+ );
2215+ for (i, (label, _)) in counters.iter().enumerate() {
2216+ assert!(
2217+ totals[i] > 0,
2218+ "{name}: {compared} attempt(s) decoded pixel-exact but {label} never fired -- \
2219+ the gate would prove nothing about that tool. refusals:\n{}",
2220+ refusals.join("\n")
2221+ );
2222+ }
2223+ let summary: Vec<String> = counters
2224+ .iter()
2225+ .zip(totals.iter())
2226+ .map(|((label, _), t)| format!("{label}={t}"))
2227+ .collect();
2228+ eprintln!(
2229+ "{name}: {compared}/{} attempts pixel-exact, {}",
2230+ seeds.len(),
2231+ summary.join(" ")
2232+ );
2233+ }
2234+
2235+ /// lane-hbdgates r1: the four intra tools that had an 8-bit gate and no
2236+ /// 10-bit one (`filter-intra`, `smooth-intra`, `paeth-intra`,
2237+ /// `intra-edge-filter`) on ONE real 10-bit `aomenc` key frame, each with
2238+ /// its own hard-asserted counter. His two films are yuv420p10le, so an
2239+ /// 8-bit-only gate for these tools proves nothing about the streams that
2240+ /// matter (lane-covbd r1).
2241+ #[test]
2242+ fn a_real_aomenc_10bit_intra_tools_stream_decodes_pixel_exact() {
2243+ const NAME: &str = "a_real_aomenc_10bit_intra_tools_stream_decodes_pixel_exact";
2244+ if !have_ffmpeg() {
2245+ eprintln!("SKIP {NAME}: no ffmpeg");
2246+ return;
2247+ }
2248+ if !have_aomenc() {
2249+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
2250+ return;
2251+ }
2252+ ten_bit_tool_gate(
2253+ NAME,
2254+ 64,
2255+ 64,
2256+ 1,
2257+ &[
2258+ "--limit=1",
2259+ "--kf-max-dist=0",
2260+ "--enable-filter-intra=1",
2261+ "--enable-smooth-intra=1",
2262+ "--enable-paeth-intra=1",
2263+ "--enable-intra-edge-filter=1",
2264+ "--enable-directional-intra=1",
2265+ "--enable-angle-delta=0",
2266+ "--enable-rect-partitions=0",
2267+ "--enable-ab-partitions=0",
2268+ "--enable-1to4-partitions=0",
2269+ "--enable-tx-size-search=0",
2270+ "--enable-cdef=0",
2271+ "--enable-restoration=0",
2272+ "--max-partition-size=32",
2273+ "--min-partition-size=16",
2274+ "--enable-palette=0",
2275+ "--enable-intrabc=0",
2276+ "--enable-cfl-intra=0",
2277+ "--enable-ref-frame-mvs=0",
2278+ ],
2279+ &[42, 7, 11, 23, 31, 57],
2280+ &[
2281+ ("filter_intra_hits", decode::filter_intra_hits),
2282+ ("smooth_pred_hits", crate::intra::smooth_pred_hits),
2283+ ("paeth_pred_hits", crate::intra::paeth_pred_hits),
2284+ ("intra_edge_filter_hits", crate::intra::intra_edge_filter_hits),
2285+ ],
2286+ );
2287+ }
2288+
2289+ /// lane-hbdgates r1: `--enable-restoration=1` at 10 bits. Every earlier
2290+ /// bit-depth gate ran `--enable-restoration=0`, which is exactly why two
2291+ /// high-bit-depth loop-restoration defects survived to 2026-09-01
2292+ /// (SGR box sums unscaled, Wiener clamp at the 8-bit bound). Same recipe
2293+ /// as the 8-bit LR gate, at 10 bits.
2294+ #[test]
2295+ #[ignore = "lane-hbdgates r1: REAL 10-bit loop-restoration defect. seed 42, frame 0, \
2296+ plane Y, first diff at index 122 (row 0, col 122): ours 351 vs ffmpeg 350, \
2297+ on a stream where lr_hits=2 (the LR filters did run). 8-bit LR is exact and \
2298+ every earlier 10-bit gate ran --enable-restoration=0, which is why this \
2299+ survived. Un-ignore with the fix; do NOT weaken the gate."]
2300+ fn a_real_aomenc_10bit_restoration_stream_decodes_pixel_exact() {
2301+ const NAME: &str = "a_real_aomenc_10bit_restoration_stream_decodes_pixel_exact";
2302+ if !have_ffmpeg() {
2303+ eprintln!("SKIP {NAME}: no ffmpeg");
2304+ return;
2305+ }
2306+ if !have_aomenc() {
2307+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
2308+ return;
2309+ }
2310+ // 192x128 = 3x2 superblocks, so `read_lr` is re-entered per SB
2311+ // (the 8-bit LR gate's own trap warning); cq-level=15 because
2312+ // aomenc's RD only picks a non-RESTORE_NONE frame type at low cq.
2313+ ten_bit_tool_gate(
2314+ NAME,
2315+ 192,
2316+ 128,
2317+ 1,
2318+ &[
2319+ "--limit=1",
2320+ "--kf-max-dist=0",
2321+ "--cq-level=15",
2322+ "--enable-restoration=1",
2323+ "--enable-cdef=0",
2324+ "--enable-rect-partitions=0",
2325+ "--enable-ab-partitions=0",
2326+ "--enable-1to4-partitions=0",
2327+ "--enable-filter-intra=0",
2328+ "--enable-smooth-intra=0",
2329+ "--enable-paeth-intra=0",
2330+ "--enable-tx-size-search=0",
2331+ "--max-partition-size=32",
2332+ "--min-partition-size=16",
2333+ "--enable-palette=0",
2334+ "--enable-intrabc=0",
2335+ "--enable-cfl-intra=0",
2336+ "--enable-ref-frame-mvs=0",
2337+ ],
2338+ &LR_SEEDS,
2339+ &[("lr_hits", ten_bit_lr_hits)],
2340+ );
2341+ }
2342+
2343+ /// Seeds swept by the 10-bit LR gate (the 8-bit gate needs ~40 attempts
2344+ /// to land a non-RESTORE_NONE frame; every attempt here still has to
2345+ /// decode pixel-exact).
2346+ const LR_SEEDS: [u32; 16] = [42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57];
2347+
2348+ /// Wiener + SGR + switchable loop-restoration firings, summed.
2349+ fn ten_bit_lr_hits() -> usize {
2350+ crate::restoration::wiener_hits()
2351+ + crate::restoration::sgrproj_hits()
2352+ + crate::restoration::switchable_hits()
2353+ }
2354+
2355+ /// lane-hbdgates r1: `--enable-rect-partitions=1 --enable-ab-partitions=1`
2356+ /// at 10 bits, one intra stream, one counter per tool
2357+ /// (`rect_partition_hits`, `partab_hits`) so a stream that only fired the
2358+ /// rect arms cannot stand in for AB.
2359+ #[test]
2360+ fn a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact() {
2361+ const NAME: &str = "a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact";
2362+ if !have_ffmpeg() {
2363+ eprintln!("SKIP {NAME}: no ffmpeg");
2364+ return;
2365+ }
2366+ if !have_aomenc() {
2367+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
2368+ return;
2369+ }
2370+ // The 8-bit free-partition/AB recipe, verbatim, at 10 bits: AB
2371+ // splits are an INTER dispatch here (intra-frame AB is still a named
2372+ // refusal), so the stream needs alt-refs and 24 frames, not one key
2373+ // frame.
2374+ ten_bit_tool_gate(
2375+ NAME,
2376+ 64,
2377+ 64,
2378+ 24,
2379+ &[
2380+ "--cq-level=45",
2381+ "--kf-max-dist=1000",
2382+ "--auto-alt-ref=1",
2383+ "--lag-in-frames=16",
2384+ "--enable-fwd-kf=0",
2385+ "--enable-order-hint=1",
2386+ "--enable-warped-motion=1",
2387+ "--enable-obmc=1",
2388+ "--tune-content=default",
2389+ "--enable-masked-comp=0",
2390+ "--enable-interintra-comp=0",
2391+ "--enable-onesided-comp=0",
2392+ "--enable-interintra-wedge=0",
2393+ "--enable-smooth-interintra=0",
2394+ "--enable-rect-partitions=1",
2395+ "--enable-ab-partitions=1",
2396+ "--enable-1to4-partitions=0",
2397+ "--enable-filter-intra=0",
2398+ "--enable-smooth-intra=0",
2399+ "--enable-paeth-intra=0",
2400+ "--enable-directional-intra=0",
2401+ "--enable-angle-delta=0",
2402+ "--enable-tx-size-search=0",
2403+ "--enable-cdef=0",
2404+ "--enable-restoration=0",
2405+ "--max-partition-size=32",
2406+ "--min-partition-size=16",
2407+ "--enable-palette=0",
2408+ "--enable-intrabc=0",
2409+ "--enable-cfl-intra=0",
2410+ "--enable-ref-frame-mvs=0",
2411+ ],
2412+ &LR_SEEDS,
2413+ &[
2414+ ("rect_partition_hits", decode::rect_partition_hits),
2415+ ("partab_hits", decode::partab_hits),
2416+ ],
2417+ );
2418+ }
2419+
2126 /// `bit_depth` of the first sequence header in `stream`.2420 /// `bit_depth` of the first sequence header in `stream`.
2127 fn parsed_bit_depth(stream: &[u8]) -> u8 {2421 fn parsed_bit_depth(stream: &[u8]) -> u8 {
2128 let mut probe = Av1Parser::new();2422 let mut probe = Av1Parser::new();
@@ -2147,6 +2441,20 @@ mod tests {
2147 height: usize,2441 height: usize,
2148 frames: usize,2442 frames: usize,
2149 extra: &[&str],2443 extra: &[&str],
2444+ ) -> Vec<u8> {
2445+ encode_10bit_gradients_seed(name, 42, width, height, frames, extra)
2446+ }
2447+
2448+ /// As [`encode_10bit_gradients`], but with the fixture seed exposed --
2449+ /// lane-hbdgates r1 sweeps seeds so a tool that aomenc's RD declines on
2450+ /// one fixture still gets a firing stream.
2451+ fn encode_10bit_gradients_seed(
2452+ name: &str,
2453+ seed: u32,
2454+ width: usize,
2455+ height: usize,
2456+ frames: usize,
2457+ extra: &[&str],
2150 ) -> Vec<u8> {2458 ) -> Vec<u8> {
2151 let duration = frames as f64 / 25.0;2459 let duration = frames as f64 / 25.0;
2152 let y4m = Command::new("ffmpeg")2460 let y4m = Command::new("ffmpeg")
@@ -2156,7 +2464,7 @@ mod tests {
2156 "-f",2464 "-f",
2157 "lavfi",2465 "lavfi",
2158 "-i",2466 "-i",
2159- &gradients_source(42, width, height, &format!("duration={duration}:rate=25")),2467+ &gradients_source(seed, width, height, &format!("duration={duration}:rate=25")),
2160 "-pix_fmt",2468 "-pix_fmt",
2161 "yuv420p10le",2469 "yuv420p10le",
2162 "-strict",2470 "-strict",
@@ -2177,18 +2485,21 @@ mod tests {
2177 "{name}: ffmpeg failed to render the 10-bit fixture: {}",2485 "{name}: ffmpeg failed to render the 10-bit fixture: {}",
2178 String::from_utf8_lossy(&y4m.stderr)2486 String::from_utf8_lossy(&y4m.stderr)
2179 );2487 );
2180- let mut args: Vec<&str> = vec![2488+ let mut args: Vec<&str> = vec!["--codec=av1", "--passes=1", "--end-usage=q"];
2181- "--codec=av1",2489+ // lane-hbdgates r1: a caller-supplied `--cq-level` REPLACES the
2182- "--passes=1",2490+ // default rather than being appended after it -- two `--cq-level`
2183- "--end-usage=q",2491+ // flags on one aomenc line is a coin flip on which one lands.
2184- "--cq-level=30",2492+ if !extra.iter().any(|a| a.starts_with("--cq-level=")) {
2493+ args.push("--cq-level=30");
2494+ }
2495+ args.extend_from_slice(&[
2185 "--cpu-used=0",2496 "--cpu-used=0",
2186 "--threads=1",2497 "--threads=1",
2187 "--row-mt=0",2498 "--row-mt=0",
2188 "--sb-size=64",2499 "--sb-size=64",
2189 "--input-bit-depth=10",2500 "--input-bit-depth=10",
2190 "--bit-depth=10",2501 "--bit-depth=10",
2191- ];2502+ ]);
2192 args.extend_from_slice(extra);2503 args.extend_from_slice(extra);
2193 args.extend_from_slice(&["--obu", "-o", "-", "-"]);2504 args.extend_from_slice(&["--obu", "-o", "-", "-"]);
2194 let mut child = Command::new(aomenc_path())2505 let mut child = Command::new(aomenc_path())
lanes/hbdgates-r1.report.mdadded+76 -0
@@ -0,0 +1,76 @@
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.