forge
Explore
Log in

Don't you dare go Hollow

Merge 0f453dfa (gwarp12) — suite green: gwarp12 624/0

Browse files at this commit

5f6a10ad0affbb3c555defbe4549c8aad9022d84Ahmet Kaan GümüşParent: a6aa4444753516
crates/ec-av1/src/decode.rsmodified+23 -0
@@ -4515,6 +4515,23 @@ pub(crate) fn affine_gm_hits() -> usize {
45154515 AFFINE_GM_HITS.with(|c| c.get())
45164516 }
45174517
4518+// lane-av1gwarp12: how many 16x16+ blocks built their SINGLE-reference
4519+// prediction through `crate::warp::global_warp_params` with a FOUR-parameter
4520+// (`ROTZOOM`) model. Vanilla aomenc pins its global-motion search to ROTZOOM
4521+// (`global_motion_facade.c:24`), so this is the only >TRANSLATION single-ref
4522+// global-warp arm a real aomenc stream can reach (AFFINE needs the widened
4523+// side build and its own counter, [`AFFINE_GM_HITS`]).
4524+thread_local! {
4525+ static ROTZOOM_GM_WARP_HITS: std::cell::Cell<usize> =
4526+ const { std::cell::Cell::new(0) };
4527+}
4528+
4529+/// Current value of [`ROTZOOM_GM_WARP_HITS`].
4530+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
4531+pub(crate) fn rotzoom_gm_warp_hits() -> usize {
4532+ ROTZOOM_GM_WARP_HITS.with(|c| c.get())
4533+}
4534+
45184535 // lane-t900 r9: rect blocks whose warp-sample top-right probe answers
45194536 // differently at the block's WIDTH than at libaom's
45204537 // `AOMMAX(xd->width, xd->height)` -- each one is a `num_proj_ref` that could
@@ -34731,6 +34748,12 @@ fn decode_inter_block(
3473134748 if warp_params.is_some() && gm_ref.model == ec_av1_syntax::WarpModel::Affine {
3473234749 hit!(AFFINE_GM_HITS);
3473334750 }
34751+ // lane-av1gwarp12: the ROTZOOM sibling -- the only
34752+ // >TRANSLATION model vanilla aomenc can emit for a single-ref
34753+ // global-motion block (encoder search pinned to ROTZOOM).
34754+ if warp_params.is_some() && gm_ref.model == ec_av1_syntax::WarpModel::Rotzoom {
34755+ hit!(ROTZOOM_GM_WARP_HITS);
34756+ }
3473434757 }
3473534758 // lane-av112bitw: a local `WARPED_CAUSAL` projection (set above)
3473634759 // or a global warp model both land here with `warp_params` set --
crates/ec-av1/src/gate_coverage.rsmodified+65 -15
@@ -119,15 +119,50 @@ enum On {
119119 /// only a gate that spells an on-value at that bit depth retires an entry.
120120 #[cfg(test)]
121121 const DEFAULT_ON_TOOLS: &[(&str, &[&str], &str, On)] = &[
122- ("enable-tx-size-search", &["enable-tx-size-search"], "1", On::NonZero),
123- ("enable-directional-intra", &["enable-directional-intra"], "1", On::NonZero),
124- ("enable-smooth-interintra", &["enable-smooth-interintra"], "1", On::NonZero),
125- ("enable-interintra-wedge", &["enable-interintra-wedge"], "1", On::NonZero),
126- ("enable-diff-wtd-comp", &["enable-diff-wtd-comp"], "1", On::NonZero),
127- ("enable-onesided-comp", &["enable-onesided-comp"], "1", On::NonZero),
122+ (
123+ "enable-tx-size-search",
124+ &["enable-tx-size-search"],
125+ "1",
126+ On::NonZero,
127+ ),
128+ (
129+ "enable-directional-intra",
130+ &["enable-directional-intra"],
131+ "1",
132+ On::NonZero,
133+ ),
134+ (
135+ "enable-smooth-interintra",
136+ &["enable-smooth-interintra"],
137+ "1",
138+ On::NonZero,
139+ ),
140+ (
141+ "enable-interintra-wedge",
142+ &["enable-interintra-wedge"],
143+ "1",
144+ On::NonZero,
145+ ),
146+ (
147+ "enable-diff-wtd-comp",
148+ &["enable-diff-wtd-comp"],
149+ "1",
150+ On::NonZero,
151+ ),
152+ (
153+ "enable-onesided-comp",
154+ &["enable-onesided-comp"],
155+ "1",
156+ On::NonZero,
157+ ),
128158 ("enable-fwd-kf", &["enable-fwd-kf"], "0", On::NonZero),
129159 ("deblocking", &["loopfilter-control"], "1", On::NonZero),
130- ("multi-tile", &["tile-columns", "tile-rows"], "0", On::NonZero),
160+ (
161+ "multi-tile",
162+ &["tile-columns", "tile-rows"],
163+ "0",
164+ On::NonZero,
165+ ),
131166 ("intrabc-search", &["cpu-used"], "0", On::AtMost(2)),
132167 ];
133168
@@ -167,10 +202,14 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[
167202 "enable-flip-idtx",
168203 "never spelled; the flip/identity transform types are unproven by a real stream",
169204 ),
170- (
171- "enable-global-motion",
172- "off in 5 gates, on in none at 8 bits; lane-gm owns the global-warp prediction that is still missing",
173- ),
205+ // `enable-global-motion` LEFT this list on 2026-09-25 (lane-av1gwarp12 r2):
206+ // `a_real_affine_global_motion_stream_decodes_pixel_exact` loops
207+ // `for depth in [8u32, 10u32]` passing `--enable-global-motion=1` and
208+ // pixel-compares both depths, so the 8-bit hole has been closed since
209+ // lane-gmaffine r1 -- the entry survived because no suite ran a tree
210+ // containing both the gate and this test until the ROTZOOM suite.
211+ // The 12-bit ROTZOOM gate rides the high-depth bucket via `encode_12bit(`
212+ // in `is_ten_bit`, so it plays no part in this retirement.
174213 (
175214 "enable-rect-tx",
176215 "never spelled; rect transforms reach the decoder only through partition shape, never through a gate that names the tool",
@@ -178,7 +217,8 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[
178217 ];
179218
180219 #[cfg(test)]
181-const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // lane-cwarp's 10-bit compound-global-warp gate closed `enable-global-motion`
220+const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
221+ // lane-cwarp's 10-bit compound-global-warp gate closed `enable-global-motion`
182222 // and `enable-dist-wtd-comp` at 10 bits without deleting their entries here,
183223 // so this list was already stale (and this test already red) at main 9c35ecc;
184224 // lane-tiles r11's multi-tile 10-bit gates then closed `enable-ab-partitions`,
@@ -240,8 +280,8 @@ const NEVER_ON_10BIT: &[(&str, &str)] = &[];
240280 #[cfg(test)]
241281 mod tests {
242282 use super::{
243- ALIASES, DEFAULT_ON_TOOLS, NEVER_EXERCISED, NEVER_EXERCISED_8BIT, NEVER_EXERCISED_10BIT,
244- NEVER_ON_10BIT, NEVER_ON_8BIT, On, TOOL_UNIVERSE,
283+ On, ALIASES, DEFAULT_ON_TOOLS, NEVER_EXERCISED, NEVER_EXERCISED_10BIT,
284+ NEVER_EXERCISED_8BIT, NEVER_ON_10BIT, NEVER_ON_8BIT, TOOL_UNIVERSE,
245285 };
246286 use std::collections::{BTreeMap, BTreeSet};
247287
@@ -438,11 +478,19 @@ mod tests {
438478 }
439479
440480 fn is_ten_bit(body: &str) -> bool {
481+ // The lists pin two buckets, 8-bit and high-bit-depth; 12-bit gates
482+ // count in the high-depth bucket (lane-av1gwarp12's ROTZOOM gate was
483+ // the first 12-bit gate to positively enable a listed tool, and the
484+ // 10-bit-only spellings mis-filed it as 8-bit).
441485 body.contains("encode_10bit_gradients")
442486 || body.contains("ten_bit_tool_gate(")
443487 || body.contains("--bit-depth=10")
444488 || body.contains("--input-bit-depth=10")
445489 || body.contains("yuv420p10le")
490+ || body.contains("encode_12bit(")
491+ || body.contains("--bit-depth=12")
492+ || body.contains("--input-bit-depth=12")
493+ || body.contains("yuv420p12le")
446494 }
447495
448496 /// Flags a gate positively enables (`=1`), at gates of the given depth.
@@ -534,7 +582,9 @@ mod tests {
534582 }
535583
536584 /// [`DEFAULT_ON_TOOLS`] per depth: `tool -> (off in N gates, on in N, defaulted in N)`.
537- fn default_on_settings(ten_bit: bool) -> (usize, BTreeMap<&'static str, (usize, usize, usize)>) {
585+ fn default_on_settings(
586+ ten_bit: bool,
587+ ) -> (usize, BTreeMap<&'static str, (usize, usize, usize)>) {
538588 let gates: Vec<&str> = gate_bodies()
539589 .into_iter()
540590 .filter(|b| covers_depth(b, ten_bit))
crates/ec-av1/src/stream.rsmodified+141 -0
@@ -9779,6 +9779,54 @@ pub(crate) mod tests {
97799779 y4m
97809780 }
97819781
9782+ /// lane-av1gwarp12 fixture: rotating + uniformly zooming mandelbrot as a
9783+ /// C420p12 y4m. Rotation composed with a UNIFORM scale is a similarity
9784+ /// transform -- exactly the family a 4-parameter ROTZOOM global model
9785+ /// expresses (the affine gate needs the anisotropic stretch to force
9786+ /// 6 parameters; this lane needs the model vanilla aomenc actually
9787+ /// searches, ROTZOOM).
9788+ fn y4m_12bit_rotzoom_gm_source(frames: usize) -> Vec<u8> {
9789+ const W: usize = 128;
9790+ const H: usize = 128;
9791+ let source = format!(
9792+ "mandelbrot=size=192x192:rate=25,rotate=a=0.12*t:c=black,\
9793+ scale=w='ceil(192*(1+0.04*n)/2)*2':h='ceil(192*(1+0.04*n)/2)*2':eval=frame,\
9794+ crop={W}:{H}"
9795+ );
9796+ let duration = (frames as f64 / 25.0).to_string();
9797+ let ff_args: Vec<&str> = vec![
9798+ "-v",
9799+ "error",
9800+ "-f",
9801+ "lavfi",
9802+ "-i",
9803+ &source,
9804+ "-pix_fmt",
9805+ "yuv420p12le",
9806+ // y4m has no official 12-bit tag, same as the 10-bit gate.
9807+ "-strict",
9808+ "-1",
9809+ "-t",
9810+ &duration,
9811+ "-f",
9812+ "yuv4mpegpipe",
9813+ "-",
9814+ ];
9815+ let out = Command::new("ffmpeg")
9816+ .args(&ff_args)
9817+ .stdin(Stdio::null())
9818+ .stdout(Stdio::piped())
9819+ .stderr(Stdio::piped())
9820+ .output()
9821+ .expect("ffmpeg failed to run");
9822+ assert!(
9823+ out.status.success(),
9824+ "ffmpeg fixture: {}",
9825+ String::from_utf8_lossy(&out.stderr)
9826+ );
9827+ out.stdout
9828+ }
9829+
97829830 /// The 12-bit coding recipe shared by the witness gates (cpu-used=0 so
97839831 /// every search runs; explicit CDEF/restoration ON). Warp/global-motion
97849832 /// are deliberately NOT spelled here: this aomenc honours the LAST
@@ -21426,6 +21474,99 @@ pub(crate) mod tests {
2142621474 }
2142721475 }
2142821476
21477+ /// lane-av1gwarp12: the SINGLE-reference GLOBAL-warp witness at 12 bits
21478+ /// -- the open half lane-av112bitw recorded (engagement 0 on every prior
21479+ /// 12-bit content). The decode path is the same `warp_affine` with
21480+ /// `warp_round_0(12)` the local-warp witness proved, fed by
21481+ /// `global_warp_params(gm_ref.params)` at `decode_inter_block`'s
21482+ /// single-ref arm -- but composition had no stream: the travelling-box
21483+ /// source fits only TRANSLATION global models (excluded by
21484+ /// `is_global_mv_block`), and the rotating mandelbrot reached the global
21485+ /// models only on compound blocks. This recipe closes it: rotation +
21486+ /// uniform zoom (a similarity transform, ROTZOOM's exact family), the
21487+ /// compound tools off so a global model can only ride a single-reference
21488+ /// GLOBALMV block, and partitions pinned to 32 so the 8x8 leaf arm is
21489+ /// structurally out of the stream. Vanilla aomenc pins its gm search to
21490+ /// ROTZOOM (`global_motion_facade.c:24`), so every >TRANSLATION model a
21491+ /// real aomenc emits is ROTZOOM; AFFINE needs the widened side build
21492+ /// (`a_real_affine_global_motion_stream_decodes_pixel_exact`).
21493+ ///
21494+ /// Non-vacuous by construction: `rotzoom_gm_warp_hits()` hard-asserts a
21495+ /// 16x16+ block was really predicted through the global warp with a
21496+ /// ROTZOOM model, the zero `compound_warp_hits` delta keeps the
21497+ /// single-reference premise honest, and every plane of every frame
21498+ /// compares against ffmpeg.
21499+ #[test]
21500+ fn a_real_rotzoom_global_warp_12bit_stream_decodes_pixel_exact() {
21501+ const NAME: &str = "a_real_rotzoom_global_warp_12bit_stream_decodes_pixel_exact";
21502+ let _gate_lock = lock_gate_counters();
21503+ if !have_ffmpeg() {
21504+ eprintln!("SKIP {NAME}: no ffmpeg");
21505+ return;
21506+ }
21507+ if !have_aomenc() {
21508+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
21509+ return;
21510+ }
21511+ const W: usize = 128;
21512+ const H: usize = 128;
21513+ const FRAMES: usize = 16;
21514+ let y4m = y4m_12bit_rotzoom_gm_source(FRAMES);
21515+ let stream = encode_12bit(
21516+ &y4m,
21517+ FRAMES,
21518+ &[
21519+ "--enable-global-motion=1",
21520+ "--enable-warped-motion=0",
21521+ "--enable-obmc=0",
21522+ "--enable-masked-comp=0",
21523+ "--enable-interintra-comp=0",
21524+ "--enable-onesided-comp=0",
21525+ "--enable-ref-frame-mvs=0",
21526+ "--min-partition-size=32",
21527+ "--max-partition-size=32",
21528+ ],
21529+ );
21530+ assert_12bit_sequence_header(&stream, NAME);
21531+ let (before_rotzoom, before_affine, before_selected, before_compound) = (
21532+ decode::rotzoom_gm_warp_hits(),
21533+ decode::affine_gm_hits(),
21534+ decode::warp_selected_hits(),
21535+ decode::compound_warp_hits(),
21536+ );
21537+ let frames = decode_stream(&stream).unwrap_or_else(|e| {
21538+ panic!("{NAME}: decode_stream refused a real 12-bit global-warp stream: {e}")
21539+ });
21540+ assert_eq!(frames.len(), FRAMES);
21541+ let (delta_rotzoom, delta_affine, delta_selected) = (
21542+ decode::rotzoom_gm_warp_hits() - before_rotzoom,
21543+ decode::affine_gm_hits() - before_affine,
21544+ decode::warp_selected_hits() - before_selected,
21545+ );
21546+ eprintln!(
21547+ "{NAME}: gm_warp_engagement rotzoom(single-ref global warp)={delta_rotzoom} \
21548+ affine={delta_affine} selected_local_warp={delta_selected}"
21549+ );
21550+ assert!(
21551+ delta_rotzoom > 0,
21552+ "{NAME}: decoded but no single-reference ROTZOOM global-warp block fired -- \
21553+ the 12-bit single-ref global-warp path is unexercised and the pixel \
21554+ compare would prove nothing"
21555+ );
21556+ assert_eq!(
21557+ decode::compound_warp_hits() - before_compound,
21558+ 0,
21559+ "{NAME}: a compound warp block ran -- the single-reference premise is gone"
21560+ );
21561+ let ffmpeg_frames = ffmpeg_decode_sequence_12bit(&stream, W, H, FRAMES);
21562+ for (i, (ours, reference)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
21563+ assert_eq!(ours.y, reference.y, "{NAME} frame {i} luma vs ffmpeg");
21564+ assert_eq!(ours.u, reference.u, "{NAME} frame {i} U vs ffmpeg");
21565+ assert_eq!(ours.v, reference.v, "{NAME} frame {i} V vs ffmpeg");
21566+ }
21567+ eprintln!("{NAME}: {FRAMES} frames pixel-exact vs ffmpeg, rotzoom_gm_warp_hits={delta_rotzoom}");
21568+ }
21569+
2142921570 /// lane-gmaffine r1: the two 8x8-LEAF motion gates. `decode_inter_block8`
2143021571 /// is a separate function from [`decode_inter_block`], and until this
2143121572 /// round it refused both `GLOBALMV` ("GLOBALMV (round 3)") and
lanes/av1gwarp12.report.mdadded+94 -0
@@ -0,0 +1,94 @@
1+# lane-av1-gwarp12 — the single-ref GLOBAL-warp witness at 12 bits
2+
3+Base fe3e8418, worktree `edith_codecs-av1gwarp12`, branch `lane-av1-gwarp12`.
4+The charter: close lane-av112bitw's open half — "single-ref GLOBAL-warp at 12
5+bits has no stream of its own" — with a real `aomenc --bit-depth=12` stream
6+whose single-reference inter blocks are predicted through
7+`warp::global_warp_params` under a ROTZOOM model, decoded against BOTH pixel
8+oracles, or an honest miss table.
9+
10+## Result: FOUND, first recipe, pixel-exact against both oracles
11+
12+Encode attempts aimed at the target: **2** (budget 8). Attempt 1 (the gate
13+itself) fired and was already byte-exact vs ffmpeg; attempt 2 re-encoded the
14+same recipe standalone for the aomdec oracle.
15+
16+1. `aomdec == ffmpeg` on the probe stream
17+ (`/tmp/gwarp12probe/probe.obu`, sha256
18+ `3c6102cd0dd9bbccb5d15b2f3605a7dcea9e3189c1efc7d0317b16fc481af5fe`,
19+ 37194 bytes; 16x 128x128 frames, 786432 raw bytes each decoder,
20+ `cmp`-equal payloads). Since the gate proves our decode == ffmpeg on the
21+ live re-encode, all three decoders agree on the firing stream.
22+2. Engagement: `rotzoom_gm_warp_hits = 152` (16x16+ single-ref blocks
23+ predicted through `global_warp_params` with a ROTZOOM model), affine 0
24+ (vanilla aomenc cannot emit it, see below), local-warp symbol 0
25+ (`--enable-warped-motion=0` isolates the global arm),
26+ `compound_warp_hits` delta 0 (hard-asserted; single-ref premise held).
27+
28+## Why the recipe works when the prior ones didn't
29+
30+Every prior 12-bit content fit TRANSLATION global models (excluded by
31+`is_global_mv_block`) or reached >TRANSLATION models only on compound blocks.
32+The lever is composition, not the encoder:
33+
34+- **Content**: rotation + UNIFORM zoom — a similarity transform, exactly the
35+ family the 4-parameter ROTZOOM model expresses (`mandelbrot` +
36+ `rotate=a=0.12*t` + symmetric `scale` over `n`, cropped 128x128).
37+- **Compound tools OFF** (`--enable-masked-comp=0 --enable-interintra-comp=0
38+ --enable-onesided-comp=0`, plus lag 0 / alt-ref 0 so all refs are
39+ forward): a global model can then only ride a single-reference GLOBALMV
40+ block.
41+- **`--enable-warped-motion=0`**: no local WARPED_CAUSAL can take
42+ `warp_params` first; the `warp_params.is_none()` guard at the single-ref
43+ arm makes every hit unambiguously a global-warp hit.
44+- **`--min/--max-partition-size=32`**: every inter leaf is 16x16+, so the
45+ 8x8-leaf arm (`decode_inter_block8`, leaf8 lane's file region) is
46+ structurally out of the stream and my counter proves MY site, not a twin.
47+- **Model bound is encoder-side**: `global_motion_facade.c:24` pins the gm
48+ search to ROTZOOM, so every >TRANSLATION single-ref model a real aomenc
49+ can emit IS ROTZOOM. (AFFINE needs the widened side build and has its own
50+ gate + `affine_gm_hits` at 8/10 bits.)
51+
52+Exact flags: the `encode_12bit` witness base (cq 20, cpu-used 0, sb 64,
53+profile 2, cdef/restoration ON) plus the extras above and
54+`--enable-global-motion=1 --enable-obmc=0 --enable-ref-frame-mvs=0`.
55+Fixture: `y4m_12bit_rotzoom_gm_source` (ffmpeg lavfi, C420p12 y4m, 16
56+frames). The gate re-encodes live; engagement reproduced identically across
57+three runs (152/152/152).
58+
59+## What changed
60+
61+- **decode.rs** — one new counter pair at the single-ref global-warp arm
62+ (`decode_inter_block`, the lane's own site): `ROTZOOM_GM_WARP_HITS` +
63+ `rotzoom_gm_warp_hits()`, bumped when `global_warp_params` resolves AND
64+ `gm_ref.model == Rotzoom`, mirroring the `AFFINE_GM_HITS` twin. The 8x8
65+ leaf arm's copy was deliberately NOT touched (leaf8 lane).
66+- **stream.rs** — `y4m_12bit_rotzoom_gm_source` fixture helper + the gate
67+ `a_real_rotzoom_global_warp_12bit_stream_decodes_pixel_exact`:
68+ `assert_12bit_sequence_header` preflight, hard `delta_rotzoom > 0` (a
69+ warpless stream cannot pass), hard `compound_warp_hits` delta == 0, and
70+ every plane of every frame byte-equal vs ffmpeg
71+ (`ffmpeg_decode_sequence_12bit`).
72+
73+No decoder arithmetic changed: the single-ref path was lifted by
74+lane-av112bitw (parameterised `warp_round_0`) and the composition argument
75+held — the stream proves it instead of arguing it. Non-vacuity is by
76+construction (counter assert), and the gate FAILED-category risk (silent
77+skip) is closed: encode/ffmpeg presence is hard-asserted inside the gate.
78+
79+## Verification
80+
81+- New gate green (encode attempt 1): 16 frames pixel-exact vs ffmpeg,
82+ 152 rotzoom hits.
83+- aomdec oracle probe (encode attempt 2): aomdec == ffmpeg, sha256 above.
84+- Scoped sweep of the 12-bit family the counter addition touches: 9/9 green
85+ (`12bit` filter) including `a_12bit_warped_motion_stream_decodes_pixel_exact`
86+ (engagement still 7/1/0), both compound global-warp 12-bit gates (16x16+
87+ and 8x8 leaf), grain refusal, screen refusal.
88+- `cargo check -p ec-av1 --all-targets`: clean, no warnings.
89+
90+## Create-list audit
91+
92+One new file: this report. Touched: `decode.rs` (counter), `stream.rs`
93+(helper + gate). No fixture committed (gate encodes live), no junk files;
94+probe artifacts under /tmp are throwaway.