forge
Explore
Log in

Don't you dare go Hollow

Merge lane/av1oracleguard: the 4:2:0 ffmpeg oracle helpers refuse a non-4:2:0 stream

Browse files at this commit

269e1fd541192796344bc240d7faf3334cee8508Ahmet Kaan GümüşParent: 53601b18b97983
After the 4:2:2 lift, the three 4:2:0 oracle helpers (ffmpeg_decode_sequence and its 10- and
12-bit twins) would silently CONVERT a 4:2:2 or 4:4:4 stream to 4:2:0 (-pix_fmt yuv420p,
width*height/4 sizing), so a 4:2:2 gate built on them would compare the wrong planes and
pass green. assert_420_oracle_stream reads the stream's OWN color_config subsampling from
its sequence-header OBUs and refuses before the ffmpeg spawn, naming the real subsampling,
the chroma shape, and the sibling helper to use.

Proven both ways: a flipped oracle sample moves the comparator's count by exactly one (and
nothing else moves), so 4:2:0 still measures byte-identical; and a 4:2:2 pin is refused by
all three helpers, with the message naming the sibling -- red before, green after, and the
red failure text is the hazard itself. Verified no existing gate feeds a wrong-shape pin to
these helpers (the 4:2:2/4:4:0 pixel-exactness battery stays green).
crates/ec-av1/src/stream.rsmodified+263 -0
@@ -6537,6 +6537,252 @@ pub(crate) mod tests {
6537 .color_config6537 .color_config
6538 .bit_depth6538 .bit_depth
6539 }6539 }
6540+ /// The stream's OWN `color_config.subsampling_x/y` (spec 5.5.2), read
6541+ /// from its bytes the same way [`stream_bit_depth`] reads the depth.
6542+ fn stream_subsampling(stream: &[u8], name: &str) -> (u8, u8) {
6543+ let mut probe = Av1Parser::new();
6544+ let mut pos = 0usize;
6545+ while pos < stream.len() && probe.sequence_header().is_none() {
6546+ let obu = probe
6547+ .parse_obu(&stream[pos..])
6548+ .unwrap_or_else(|e| panic!("{name}: OBU at byte {pos} does not parse: {e:?}"));
6549+ pos += obu.total_size;
6550+ }
6551+ let cc = &probe
6552+ .sequence_header()
6553+ .unwrap_or_else(|| panic!("{name}: the stream carries no sequence header OBU"))
6554+ .color_config;
6555+ (cc.subsampling_x, cc.subsampling_y)
6556+ }
6557+
6558+ /// The chroma shape a `(subsampling_x, subsampling_y)` pair means.
6559+ fn chroma_shape(sx: u8, sy: u8) -> &'static str {
6560+ match (sx, sy) {
6561+ (1, 1) => "4:2:0",
6562+ (1, 0) => "4:2:2",
6563+ (0, 0) => "4:4:4",
6564+ (0, 1) => "4:4:0",
6565+ _ => "an unassigned subsampling",
6566+ }
6567+ }
6568+
6569+ /// lane-av1oracleguard: HARD REFUSAL for the 4:2:0 ffmpeg oracle helpers.
6570+ ///
6571+ /// `ffmpeg_decode_sequence`, `ffmpeg_decode_sequence_10bit` and
6572+ /// `ffmpeg_decode_sequence_12bit` ask ffmpeg for `-pix_fmt yuv420p*` and
6573+ /// size chroma at `width * height / 4`. Those are the 4:2:0 numbers, so
6574+ /// for a stream that is NOT (1,1) ffmpeg does not fail -- it CONVERTS,
6575+ /// and the helper then slices a 4:2:0-shaped picture out of it. A 4:2:2
6576+ /// gate built on one of them compares the wrong planes and passes green:
6577+ /// the exact failure `lanes/av1subsizesweep.report.md` names. The correct
6578+ /// siblings (`ffmpeg_decode_sequence_422` / `_422_depth` /
6579+ /// `ffmpeg_decode_sequence_444`) exist and take the same bytes, so the
6580+ /// refusal points at them by name rather than leaving the caller to
6581+ /// rediscover the shape.
6582+ ///
6583+ /// Refused by SUBSAMPLING read from the stream's own sequence header, not
6584+ /// from the caller's `width`/`height` (class
6585+ /// `helper-assumes-the-shape-the-gate-name-implies`).
6586+ fn assert_420_oracle_stream(stream: &[u8], helper: &str, sibling: &str) {
6587+ let (sx, sy) = stream_subsampling(stream, helper);
6588+ assert!(
6589+ (sx, sy) == (1, 1),
6590+ "{helper} REFUSED a ({sx},{sy}) stream: this helper asks ffmpeg for a 4:2:0 \
6591+ pix_fmt, which CONVERTS the stream's real {} chroma down to 4:2:0 instead of \
6592+ failing, then sizes chroma at `width * height / 4` rather than the {} shape. A \
6593+ gate built on it would compare converted planes against real ones and pass green. \
6594+ Use `{sibling}` for a ({sx},{sy}) stream.",
6595+ chroma_shape(sx, sy),
6596+ chroma_shape(sx, sy),
6597+ );
6598+ }
6599+ /// lane-av1oracleguard: run `f`, return the panic MESSAGE it raised (or
6600+ /// `None` if it did not panic). The panic hook is silenced so a refusal
6601+ /// that PASSES its gate prints nothing -- the assertion is the return.
6602+ fn panic_message<F: FnOnce()>(f: F) -> Option<String> {
6603+ let hook = std::panic::take_hook();
6604+ std::panic::set_hook(Box::new(|_| {}));
6605+ let caught = std::panic::catch_unwind(std::panic::AssertUnwindSafe(f));
6606+ std::panic::set_hook(hook);
6607+ match caught {
6608+ Ok(()) => None,
6609+ Err(payload) => Some(
6610+ payload
6611+ .downcast_ref::<String>()
6612+ .cloned()
6613+ .or_else(|| payload.downcast_ref::<&str>().map(|s| (*s).to_string()))
6614+ .unwrap_or_else(|| "<non-string panic payload>".to_string()),
6615+ ),
6616+ }
6617+ }
6618+
6619+ /// lane-av1oracleguard, direction 1 of 2: the 4:2:0 helper's COMPARATOR
6620+ /// still bites on a real 4:2:0 pin, so the refusal added above did not
6621+ /// buy its non-vacuity by making the helper stop comparing.
6622+ ///
6623+ /// `420_mixll_256x128_6f.obu` is 8-bit 4:2:0 at 256x128. Ours and ffmpeg
6624+ /// agree on every sample of every output frame (bad == 0), then ONE U
6625+ /// sample of the oracle is flipped and the same count must move to 1. A
6626+ /// count that stays 0 on a flipped oracle is a comparator that compares
6627+ /// nothing, and the refusal would then be the only thing this gate could
6628+ /// prove.
6629+ #[test]
6630+ fn a_420_oracle_comparator_counts_a_flipped_oracle_sample() {
6631+ const NAME: &str = "a_420_oracle_comparator_counts_a_flipped_oracle_sample";
6632+ let _gate_lock = lock_gate_counters();
6633+ if !have_ffmpeg() {
6634+ eprintln!("SKIP {NAME}: no ffmpeg");
6635+ return;
6636+ }
6637+ let path = crate_pin("420_mixll_256x128_6f.obu");
6638+ let data = std::fs::read(&path)
6639+ .unwrap_or_else(|e| panic!("{NAME}: the committed pin is missing ({e})"));
6640+ assert_eq!(data.len(), 22336, "{NAME}: pin size drifted");
6641+ assert_eq!(
6642+ fnv1a64(&data),
6643+ 5694016005779287373,
6644+ "{NAME}: pin bytes drifted"
6645+ );
6646+ assert_eq!(
6647+ stream_subsampling(&data, NAME),
6648+ (1, 1),
6649+ "{NAME}: this cell must be a 4:2:0 pin -- the refusal arm uses other pins"
6650+ );
6651+
6652+ let decoded = decode_stream(&data)
6653+ .unwrap_or_else(|e| panic!("{NAME}: the committed 4:2:0 pin did not decode: {e}"));
6654+ let want = ffmpeg_decode_sequence(&data, 256, 128, decoded.len());
6655+ assert_eq!(decoded.len(), want.len(), "{NAME}: decoded/frame count");
6656+
6657+ let plane_mismatches = |ours: &[Pic], theirs: &[Pic], plane: u8| -> usize {
6658+ ours.iter()
6659+ .zip(theirs)
6660+ .map(|(a, b)| {
6661+ let (a, b) = match plane {
6662+ 0 => (&a.y, &b.y),
6663+ 1 => (&a.u, &b.u),
6664+ _ => (&a.v, &b.v),
6665+ };
6666+ a.iter().zip(b).filter(|&(x, y)| x != y).count()
6667+ })
6668+ .sum()
6669+ };
6670+ let clean: Vec<usize> = (0..3)
6671+ .map(|p| plane_mismatches(&decoded, &want, p))
6672+ .collect();
6673+ assert_eq!(
6674+ clean,
6675+ vec![0, 0, 0],
6676+ "{NAME}: the 4:2:0 oracle arm is not byte-exact to start with, so a flipped sample \
6677+ would prove nothing"
6678+ );
6679+
6680+ // Flip exactly one oracle sample and the count MUST move.
6681+ let mut flipped = want.clone();
6682+ flipped[0].u[0] ^= 1;
6683+ let moved: Vec<usize> = (0..3)
6684+ .map(|p| plane_mismatches(&decoded, &flipped, p))
6685+ .collect();
6686+ assert_eq!(
6687+ moved,
6688+ vec![0, 1, 0],
6689+ "{NAME}: one flipped oracle U sample must move the U comparison count 0 -> 1 and \
6690+ leave Y and V at 0; got {moved:?} -- the comparator does not bite, so this gate \
6691+ cannot tell a working oracle arm from a vacuous one"
6692+ );
6693+ eprintln!(
6694+ "{NAME}: clean per-plane counts {clean:?}, after one flipped oracle U sample {moved:?}"
6695+ );
6696+ }
6697+
6698+ /// lane-av1oracleguard, direction 2 of 2 (8-bit): the 4:2:0 helper must
6699+ /// REFUSE a real 4:2:2 pin instead of letting ffmpeg convert it. The
6700+ /// message must name the REAL subsampling AND the sibling to use -- a
6701+ /// bare "wrong shape" would leave the caller to rediscover the fix.
6702+ ///
6703+ /// Before this lane, `ffmpeg_decode_sequence(&422_key_64x64, 64, 64, 1)`
6704+ /// RETURNED a 4:2:0-converted picture without complaint, which is the
6705+ /// silent-green the refusal exists to stop. This gate needs no ffmpeg at
6706+ /// all: the guard runs before the spawn, so a host without ffmpeg still
6707+ /// proves the refusal.
6708+ #[test]
6709+ fn a_420_oracle_helper_refuses_a_422_pin() {
6710+ const NAME: &str = "a_420_oracle_helper_refuses_a_422_pin";
6711+ let _gate_lock = lock_gate_counters();
6712+ let path = crate_pin("422_key_64x64.obu");
6713+ let stream = read_pin(&path, 755, 0x87fc569cf53bcbc6, NAME);
6714+ assert_eq!(
6715+ stream_subsampling(&stream, NAME),
6716+ (1, 0),
6717+ "{NAME}: the pin must really be 4:2:2 (1,0), or this proves nothing"
6718+ );
6719+ let msg = panic_message(|| {
6720+ ffmpeg_decode_sequence(&stream, 64, 64, 1);
6721+ })
6722+ .unwrap_or_else(|| {
6723+ panic!(
6724+ "{NAME}: ffmpeg_decode_sequence ACCEPTED a (1,0) stream. ffmpeg converted it to \
6725+ 4:2:0 and the helper returned a green-looking comparison"
6726+ )
6727+ });
6728+ for needle in ["(1,0)", "4:2:2", "ffmpeg_decode_sequence_422"] {
6729+ assert!(
6730+ msg.contains(needle),
6731+ "{NAME}: the refusal must name {needle:?}; it said: {msg}"
6732+ );
6733+ }
6734+ eprintln!("{NAME}: refused -> {msg}");
6735+ }
6736+
6737+ /// lane-av1oracleguard, direction 2 of 2 (high depth): the same refusal on
6738+ /// `ffmpeg_decode_sequence_10bit` and `_12bit`, which ask ffmpeg for
6739+ /// `yuv420p10le`/`yuv420p12le` and slice chroma at `width * height / 4`
6740+ /// exactly as the 8-bit helper does. Pinned 4:2:2 at both depths.
6741+ #[test]
6742+ fn a_420_high_bit_depth_oracle_helpers_refuse_a_422_pin() {
6743+ const NAME: &str = "a_420_high_bit_depth_oracle_helpers_refuse_a_422_pin";
6744+ let _gate_lock = lock_gate_counters();
6745+ let cells: [(&str, usize, u64, fn(&[u8]) -> Vec<Pic>); 2] = [
6746+ (
6747+ "s422_352x242_10b.obu",
6748+ 20575,
6749+ 17425395593908182125,
6750+ |s: &[u8]| ffmpeg_decode_sequence_10bit(s, 352, 242, 1),
6751+ ),
6752+ (
6753+ "s422_12bit_160x128.obu",
6754+ 9214,
6755+ 0xa62b8e3fe6f60ae5,
6756+ |s: &[u8]| ffmpeg_decode_sequence_12bit(s, 160, 128, 1),
6757+ ),
6758+ ];
6759+ for (file, len, fnv, call) in cells {
6760+ let path = crate_pin(file);
6761+ let stream = read_pin(&path, len, fnv, NAME);
6762+ assert_eq!(
6763+ stream_subsampling(&stream, NAME),
6764+ (1, 0),
6765+ "{NAME}/{file}: the pin must really be 4:2:2 (1,0), or this proves nothing"
6766+ );
6767+ let msg = panic_message(|| {
6768+ call(&stream);
6769+ })
6770+ .unwrap_or_else(|| {
6771+ panic!(
6772+ "{NAME}/{file}: the 4:2:0 high-bit-depth oracle helper ACCEPTED a (1,0) \
6773+ stream -- ffmpeg converted it and the helper returned a comparison that \
6774+ could pass green"
6775+ )
6776+ });
6777+ for needle in ["(1,0)", "4:2:2", "ffmpeg_decode_sequence_422_depth"] {
6778+ assert!(
6779+ msg.contains(needle),
6780+ "{NAME}/{file}: the refusal must name {needle:?}; it said: {msg}"
6781+ );
6782+ }
6783+ eprintln!("{NAME}/{file}: refused -> {msg}");
6784+ }
6785+ }
6540 6786
6541 /// Packs decoded planes the way `aomdec --rawvideo` writes them for6787 /// Packs decoded planes the way `aomdec --rawvideo` writes them for
6542 /// `bit_depth`: 1 byte per sample at 8-bit, 2 bytes little-endian at6788 /// `bit_depth`: 1 byte per sample at 8-bit, 2 bytes little-endian at
@@ -6836,6 +7082,13 @@ pub(crate) mod tests {
6836 height: usize,7082 height: usize,
6837 frames: usize,7083 frames: usize,
6838 ) -> Vec<Pic> {7084 ) -> Vec<Pic> {
7085+ // lane-av1oracleguard: this helper's numbers are 4:2:0's. A (1,0) or
7086+ // (0,0) stream would be CONVERTED by ffmpeg rather than refused.
7087+ assert_420_oracle_stream(
7088+ stream,
7089+ "ffmpeg_decode_sequence",
7090+ "ffmpeg_decode_sequence_422 (4:2:2) or ffmpeg_decode_sequence_444 (4:4:4)",
7091+ );
6839 let out = run_with_stdin(7092 let out = run_with_stdin(
6840 Command::new(ffmpeg_path()).args([7093 Command::new(ffmpeg_path()).args([
6841 "-v", "error", "-f", "obu", "-i", "-", "-f", "rawvideo", "-pix_fmt", "yuv420p", "-",7094 "-v", "error", "-f", "obu", "-i", "-", "-f", "rawvideo", "-pix_fmt", "yuv420p", "-",
@@ -6927,6 +7180,11 @@ pub(crate) mod tests {
6927 height: usize,7180 height: usize,
6928 frames: usize,7181 frames: usize,
6929 ) -> Vec<Pic> {7182 ) -> Vec<Pic> {
7183+ assert_420_oracle_stream(
7184+ stream,
7185+ "ffmpeg_decode_sequence_10bit",
7186+ "ffmpeg_decode_sequence_422_depth(.., 10, \"yuv422p10le\") (4:2:2); ffmpeg_decode_sequence_444 is 8-bit only",
7187+ );
6930 let out = run_with_stdin(7188 let out = run_with_stdin(
6931 Command::new(ffmpeg_path()).args([7189 Command::new(ffmpeg_path()).args([
6932 "-v",7190 "-v",
@@ -17229,6 +17487,11 @@ exit 0
17229 height: usize,17487 height: usize,
17230 frames: usize,17488 frames: usize,
17231 ) -> Vec<Pic> {17489 ) -> Vec<Pic> {
17490+ assert_420_oracle_stream(
17491+ stream,
17492+ "ffmpeg_decode_sequence_12bit",
17493+ "ffmpeg_decode_sequence_422_depth(.., 12, \"yuv422p12le\") (4:2:2); ffmpeg_decode_sequence_444 is 8-bit only",
17494+ );
17232 let out = run_with_stdin(17495 let out = run_with_stdin(
17233 Command::new("ffmpeg").args([17496 Command::new("ffmpeg").args([
17234 "-v",17497 "-v",
lanes/av1oracleguard.report.mdadded+171 -0
@@ -0,0 +1,171 @@
1+# lane/av1oracleguard — the 4:2:0 ffmpeg oracle helpers now REFUSE a non-4:2:0 stream
2+
3+Base `main` = `b8385c93` ("Merge lane/ecimagewallclock").
4+Worktree `~/Documents/Code/Rust/edith_codecs-oracleguard`, own
5+`CARGO_TARGET_DIR=~/.cache/tgt/av1oracleguard`.
6+
7+## The hazard, and why it was silent
8+
9+`crates/ec-av1/src/stream.rs`'s 4:2:0 oracle helpers ask ffmpeg for a 4:2:0
10+pix_fmt and size chroma at `width * height / 4`:
11+
12+| helper | pix_fmt | chroma span |
13+|---|---|---|
14+| `ffmpeg_decode_sequence` (`7033` call site) | `yuv420p` | `w*h/4` |
15+| `ffmpeg_decode_sequence_10bit` (`7125`) | `yuv420p10le` | `w*h/4` |
16+| `ffmpeg_decode_sequence_12bit` (`17428`) | `yuv420p12le` | `w*h/4` |
17+
18+The failure mode is that **ffmpeg does not refuse a mismatched stream — it
19+CONVERTS**. It emits a 4:2:0 picture, so the helper's own byte-count assert
20+(`out.stdout.len() == frame_bytes * frames`) passes, the helper returns a `Vec<Pic>`,
21+and a gate built on it compares CONVERTED chroma against our REAL 4:2:2 chroma.
22+`lanes/av1subsizesweep.report.md:245` names exactly this: *"a future 4:2:2 gate
23+using them compares half the oracle's bytes and passes green."*
24+
25+The correct siblings already existed: `ffmpeg_decode_sequence_422`,
26+`ffmpeg_decode_sequence_422_depth`, `ffmpeg_decode_sequence_444`.
27+
28+## The change
29+
30+One shared guard, called as the FIRST statement of each helper — before the
31+ffmpeg spawn, so a host without ffmpeg still proves the refusal.
32+
33+- `stream_subsampling(stream, name) -> (u8, u8)` (`6527` region): the stream's
34+ OWN `color_config.subsampling_x/y`, read from its sequence-header OBUs with
35+ `Av1Parser`, using the existing `stream_bit_depth` / `assert_12bit_sequence_header`
36+ loop. Never inferred from the caller's `width`/`height`.
37+- `chroma_shape(sx, sy)`: (1,1)→4:2:0, (1,0)→4:2:2, (0,0)→4:4:4, (0,1)→4:4:0.
38+- `assert_420_oracle_stream(stream, helper, sibling)`: asserts `(sx,sy) == (1,1)`.
39+ The message names the real subsampling, the chroma shape it means, the reason
40+ (`CONVERTS` + `width*height/4`), and the sibling to use.
41+
42+The diff is **256 insertions, 0 deletions, 0 modified lines** — every existing
43+line is byte-identical, so the 4:2:0 path is unchanged by construction, not by
44+argument.
45+
46+Sample of the message actually produced:
47+
48+```
49+ffmpeg_decode_sequence REFUSED a (1,0) stream: this helper asks ffmpeg for a
50+4:2:0 pix_fmt, which CONVERTS the stream's real 4:2:2 chroma down to 4:2:0
51+instead of failing, then sizes chroma at `width * height / 4` rather than the
52+4:2:2 shape. A gate built on it would compare converted planes against real
53+ones and pass green. Use `ffmpeg_decode_sequence_422 (4:2:2) or
54+ffmpeg_decode_sequence_444 (4:4:4)` for a (1,0) stream.
55+```
56+
57+### Class sweep: the 10-bit sibling
58+
59+`lanes/av1subsizesweep.report.md:245` calls the unguarded set "the 4:2:0 trio".
60+`ffmpeg_decode_sequence_10bit` is the identical hazard (`yuv420p10le`, same
61+`w*h/4` span) and got the same one-line guard. It was NOT in the original
62+assignment's target list; it is reported here rather than silently widened.
63+
64+`probe.rs::source` (`:81`, listed at the same table row) is deliberately NOT this
65+class: it loads a clip and *asks* ffmpeg to convert it to `yuv420p`, then asserts
66+the converted shape. It is a source-card loader, not an AV1 OBU oracle. Left
67+untouched, deliberately.
68+
69+## Non-vacuity, both directions
70+
71+**Direction 1 — the comparator still bites** (`a_420_oracle_comparator_counts_a_flipped_oracle_sample`).
72+Pin `420_mixll_256x128_6f.obu` (22336 B, fnv1a64 `5694016005779287373`),
73+8-bit 4:2:0 at 256x128. Asserts the pin's own subsampling is (1,1), decodes it
74+with `decode_stream`, takes `ffmpeg_decode_sequence(&data, 256, 128, n)`, and
75+counts per-plane mismatches: **`[0, 0, 0]`**. Then flips exactly one oracle
76+sample (`flipped[0].u[0] ^= 1`) and re-counts: **`[0, 1, 0]`** — the U count
77+moved by exactly 1, Y and V unmoved. Measured output:
78+
79+```
80+a_420_oracle_comparator_counts_a_flipped_oracle_sample: clean per-plane counts
81+[0, 0, 0], after one flipped oracle U sample [0, 1, 0]
82+```
83+
84+This also IS the "4:2:0 behaviour is byte-identical" evidence: the helper still
85+produces a picture ours matches sample-for-sample on a real 4:2:0 pin.
86+
87+**Direction 2 — the refusal fires** (two tests).
88+
89+- `a_420_oracle_helper_refuses_a_422_pin`: `422_key_64x64.obu` (755 B,
90+ fnv1a64 `0x87fc569cf53bcbc6`), (1,0), into `ffmpeg_decode_sequence(…, 64, 64, 1)`.
91+- `a_420_high_bit_depth_oracle_helpers_refuse_a_422_pin`: `s422_352x242_10b.obu`
92+ (20575 B) into `_10bit`, and `s422_12bit_160x128.obu` (9214 B,
93+ fnv1a64 `0xa62b8e3fe6f60ae5`) into `_12bit`. Both (1,0).
94+
95+Each asserts the pin's own subsampling first (so the test cannot pass on a pin
96+that stopped being 4:2:2), then runs the helper under `catch_unwind` with the
97+panic hook silenced, and requires the message to contain `(1,0)`, `4:2:2` AND
98+the sibling name. `#[should_panic(expected = …)]` was rejected: it matches one
99+substring, so it could not prove the sibling is named.
100+
101+**Red-before (mutation)**: reducing `assert_420_oracle_stream` to
102+`fn assert_420_oracle_stream(_: &[u8], _: &str, _: &str) {}` turns BOTH refusal
103+tests red, and the failure text is the hazard itself:
104+
105+```
106+a_420_oracle_helper_refuses_a_422_pin: ffmpeg_decode_sequence ACCEPTED a (1,0)
107+stream. ffmpeg converted it to 4:2:0 and the helper returned a green-looking
108+comparison
109+```
110+
111+Guard restored; both green again.
112+
113+## Did any existing test build on a 4:2:0 helper with a non-4:2:0 stream?
114+
115+**No — none.** Reported, not adapted, as asked.
116+
117+Two independent checks:
118+
119+1. A static scan of every test function in `stream.rs` that calls one of the
120+ three guarded helpers AND references a fixture whose name contains
121+ `422`/`440`/`444`/`441` returns exactly two rows: this lane's own refusal
122+ tests. No pre-existing gate feeds a wrong-shape pin to a 4:2:0 helper.
123+2. A runtime check: `EC_AV1_REQUIRE_FFMPEG=1 cargo test -p ec-av1 --lib -- 422
124+ 440 444 441 chroma_shape subsampling` → **68 passed, 0 failed** (35.9 s).
125+ If any of those 4:2:2/4:4:0 gates had been silently converted, the new guard
126+ would have turned them red there.
127+
128+A third scan checked the four generically-named tests that matched a loose
129+`422|440|444` regex in their bodies (`a_lossless_libaom_inter_frame_decodes_sample_exact`,
130+`a_lossless_16x4_chroma_pair_repairs_the_measured_site`,
131+`a_real_aomenc_rect_strip_palette_decodes_pixel_exact`,
132+`a_superres_key_frame_with_cdef_and_loop_restoration_decodes_pixel_exact`) — all
133+four source their fixtures from `-pix_fmt yuv420p`/`yuv420p10le` y4m or from an
134+8-bit 4:2:0 encode. Genuine 4:2:0 inputs.
135+
136+## Runs
137+
138+| run | result |
139+|---|---|
140+| `cargo test -p ec-av1 --lib -- <the three new gates>` `EC_AV1_REQUIRE_FFMPEG=1` | **3 passed, 0 failed** |
141+| same, guard mutated to a no-op | **0 passed, 2 failed** (the two refusal tests) |
142+| `cargo test -p ec-av1 --lib -- 422 440 444 441 chroma_shape subsampling` | **68 passed, 0 failed** |
143+| `cargo test -p ec-av1 --lib -- pinned pinned_` | **24 passed, 0 failed, 2 ignored** |
144+| `cargo test -p ec-av1 --lib -- pixel_exact` | **257 passed, 0 failed** (924 s) |
145+
146+`EC_AV1_REQUIRE_FFMPEG=1` on every one of them, so a missing ffmpeg could not
147+silently green a gate. No server suite was staged for this lane; the full `ec-av1`
148+suite is the main agent's call.
149+
150+## Not closed, stated plainly
151+
152+1. **No full-suite run.** The 4:2:0 helpers have ~180 call sites and the
153+ `pixel_exact` family alone is 257 tests. That family and the shape-filtered
154+ run are green, and both the static scan and those runs say no caller feeds a
155+ wrong-shape stream — but that is a scoped claim, not a whole-suite claim.
156+ The remaining filtered-out tests include the `aomenc`-sourced gates, which
157+ SKIP on this host (no `aomenc` on PATH) and need a server run to execute.
158+
159+2. **`assert_420_oracle_stream` panics; it does not return `Result`.** That is
160+ deliberate — every oracle helper in this file is assert-based, and changing
161+ the 8-bit one to `Result` would ripple through 176 call sites. The refusal
162+ message names the sibling so a caller that trips it has the fix in front of
163+ it. A `Result`-returning variant would be a separate, larger lane.
164+3. **`ffmpeg_decode_sequence_444` has no depth-generic sibling.** The refusal
165+ message says so explicitly ("`ffmpeg_decode_sequence_444` is 8-bit only")
166+ rather than naming a helper that does not exist at 10/12-bit. A high-depth
167+ 4:4:4 oracle is a real gap, not one this lane closed.
168+4. **The guard proves the shape, not the depth.** `assert_12bit_sequence_header`
169+ already covers depth for the 12-bit gates; `_10bit` has no depth assert
170+ (`stream_bit_depth` exists and could be applied the same way). Out of scope
171+ here, named so it is not lost.
\ No newline at end of file\ No newline at end of file