forge
Explore
Log in

Don't you dare go Hollow

Merge lane-av1dualfilter10 @ c2b969c8 — the 10-bit dual-filter witness

Browse files at this commit

4c293da17a85b736ce791333b951a3c1dd78e026Ahmet Kaan GümüşParent: deb9682e83a66d
Sits on top of lane-av1distwtd (c2b969c8 contains 1aaf7e0b), so only its own
delta lands here:
- crates/ec-av1/src/stream.rs:
  a_real_aomenc_10bit_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact,
  the 10-bit arm of the dual-filter witness. It is the evidence that retires
  the `enable-dual-filter` entry from NEVER_EXERCISED_10BIT — that entry was
  deliberately KEPT open by lane-av1distwtd r3 (8-bit exercised, 10-bit not),
  and this gate is the 10-bit arm distwtd's own note said would retire it.
  With it, both never-exercised lists are reconciled in the same wave:
  enable-dist-wtd-comp, enable-dual-filter (8- and 10-bit) and enable-flip-idtx
  (8-bit) are all retired; `enable-rect-tx` remains the one open entry and is
  reconciled in the lane-av1toolgates / merge step that follows.
- lanes/av1dualfilter10.report.md.

No conflict: stream.rs auto-merged (the gate appends at a different anchor
than the tile/superres sweep gates).
crates/ec-av1/src/stream.rsmodified+89 -3
@@ -18591,14 +18591,17 @@ pub(crate) mod tests {
18591 // lane-interp3 r1: sequence length -- a compound block needs several18591 // lane-interp3 r1: sequence length -- a compound block needs several
18592 // already-coded references, which a 4-frame sequence never has.18592 // already-coded references, which a 4-frame sequence never has.
18593 frame_count: usize,18593 frame_count: usize,
18594- ) {18594+ // lane-av1dualfilter10: the encoded stream, so a caller can assert on
18595+ // the PARSED sequence header (bit depth, `enable_dual_filter`) rather
18596+ // than on the flag it asked for. Empty on the SKIP paths below.
18597+ ) -> Vec<u8> {
18595 if !have_ffmpeg() {18598 if !have_ffmpeg() {
18596 eprintln!("SKIP {name}: no ffmpeg");18599 eprintln!("SKIP {name}: no ffmpeg");
18597- return;18600+ return Vec::new();
18598 }18601 }
18599 if !have_aomenc() {18602 if !have_aomenc() {
18600 eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display());18603 eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display());
18601- return;18604+ return Vec::new();
18602 }18605 }
18603 let height = 64usize;18606 let height = 64usize;
18604 let duration = format!("{:.2}", frame_count as f64 / 25.0);18607 let duration = format!("{:.2}", frame_count as f64 / 25.0);
@@ -18721,6 +18724,7 @@ pub(crate) mod tests {
18721 );18724 );
18722 }18725 }
18723 }18726 }
18727+ stream
18724 }18728 }
18725 18729
18726 #[test]18730 #[test]
@@ -18870,6 +18874,88 @@ pub(crate) mod tests {
18870 );18874 );
18871 }18875 }
18872 18876
18877+ /// lane-av1dualfilter10: the 10-bit arm of the dual-filter witness.
18878+ ///
18879+ /// `NEVER_EXERCISED_10BIT` kept `enable-dual-filter` listed after the
18880+ /// 8-bit entry was retired (lane-av1distwtd r3, gate_coverage.rs), and
18881+ /// the reason was structural, not incidental: the only `=1` witness,
18882+ /// `a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact`,
18883+ /// calls `inter_sb_none_gate(NAME, false, ...)` -- and that `false` IS the
18884+ /// `ten_bit` parameter, so it built an 8-bit stream. Its `ten_bit = true`
18885+ /// siblings build 10-bit streams but spell no dual-filter flag. This is
18886+ /// that missing arm.
18887+ ///
18888+ /// What makes it a witness and not a spelling: the header is read back
18889+ /// from the ENCODED stream (`enable_dual_filter` and `bit_depth` both come
18890+ /// from `Av1Parser`, never from the flag or the fixture name), and the
18891+ /// arrival assert is a DELTA on `decode::dual_filter_diff_hits()` taken
18892+ /// around this arm alone. A stream that merely parsed would not move the
18893+ /// counter; the counter moves only when `resolve_interp_filter` reads two
18894+ /// DIFFERENT directions for one block, which is the property the entry
18895+ /// was claiming no real stream carried.
18896+ #[test]
18897+ fn a_real_aomenc_10bit_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact() {
18898+ const NAME: &str =
18899+ "a_real_aomenc_10bit_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact";
18900+ if !have_ffmpeg() || !have_aomenc() {
18901+ eprintln!("SKIP {NAME}: no ffmpeg/aomenc");
18902+ return;
18903+ }
18904+ let before_dual = decode::dual_filter_diff_hits();
18905+ let stream = inter_sb_none_gate(
18906+ NAME,
18907+ // `ten_bit`: this is the whole difference from the 8-bit witness.
18908+ true,
18909+ "8",
18910+ "16",
18911+ decode::compound8_filter_hits,
18912+ "a compound 8x8 leaf reading its own switchable interp_filter",
18913+ &[
18914+ "--enable-dual-filter=1",
18915+ "--enable-obmc=1",
18916+ "--enable-warped-motion=1",
18917+ "--enable-onesided-comp=1",
18918+ ],
18919+ 64,
18920+ std::env::var("EC_INTERP3_FRAMES")
18921+ .ok()
18922+ .and_then(|v| v.parse().ok())
18923+ .unwrap_or(16),
18924+ );
18925+ // The ARRIVAL assert comes first on purpose. `dual_filter_diff_hits()`
18926+ // moves only inside `resolve_interp_filter` when the header bit is set
18927+ // AND the block's two directions differ, so pinning it =0 reds HERE,
18928+ // on the tool failing to arrive -- not on some shape or pixel assert
18929+ // downstream of it. The two header asserts below corroborate it from
18930+ // the encoded bytes; they are not what carries the proof.
18931+ assert!(
18932+ decode::dual_filter_diff_hits() > before_dual,
18933+ "{NAME}: no block read two DIFFERENT dual-filter directions in the 10-bit stream \
18934+ -- --enable-dual-filter=1 did not arrive or aomenc declined it"
18935+ );
18936+ // Both facts from the PARSED header, not from what we asked for: a
18937+ // gate that trusted `--bit-depth=10` would pass on a stream aomenc
18938+ // silently coded at 8, which is the vacuity this asserts against.
18939+ let mut probe = Av1Parser::new();
18940+ let mut pos = 0usize;
18941+ while pos < stream.len() && probe.sequence_header().is_none() {
18942+ let obu = probe.parse_obu(&stream[pos..]).unwrap();
18943+ pos += obu.total_size;
18944+ }
18945+ let seq = probe
18946+ .sequence_header()
18947+ .expect("stream has a sequence header OBU");
18948+ assert_eq!(
18949+ seq.color_config.bit_depth, 10,
18950+ "{NAME}: aomenc did not write a 10-bit sequence header"
18951+ );
18952+ assert!(
18953+ seq.enable_dual_filter,
18954+ "{NAME}: the parsed sequence header says enable_dual_filter = false, so this \
18955+ stream cannot carry per-direction interp filters however the pixels compare"
18956+ );
18957+ }
18958+
18873 #[test]18959 #[test]
18874 fn a_real_aomenc_inter_sequence_with_an_8x8_leaf_split_decodes_pixel_exact() {18960 fn a_real_aomenc_inter_sequence_with_an_8x8_leaf_split_decodes_pixel_exact() {
18875 inter_sb_none_gate(18961 inter_sb_none_gate(
lanes/av1dualfilter10.report.mdadded+116 -0
@@ -0,0 +1,116 @@
1+# lane-av1dualfilter10 — 10-bit `enable-dual-filter` witness
2+
3+Base: `1aaf7e0b` (lane-av1distwtd, the census detector fix). Branch: `lane-av1dualfilter10`.
4+Touches `crates/ec-av1/src/stream.rs` (tests only). `gate_coverage.rs` is NOT edited.
5+
6+## What the census left open
7+
8+`NEVER_EXERCISED_10BIT` still carried `enable-dual-filter`, and the reason it carried was
9+structural, not incidental:
10+
11+- the only `=1` witness is `a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact`
12+- that gate calls `inter_sb_none_gate(NAME, false, ...)` and that `false` IS the `ten_bit`
13+ parameter of the helper, so it builds an **8-bit** stream
14+- the helper's `ten_bit = true` siblings build 10-bit streams but spell no dual-filter flag
15+
16+So the tool was proven at 8 bits and unproven at 10. This lane adds the missing arm.
17+
18+## The change (stream.rs only)
19+
20+1. `inter_sb_none_gate` now returns `Vec<u8>` — the encoded stream — so a caller can assert on
21+ the **parsed** sequence header rather than on the flag it asked for. SKIP paths return an
22+ empty vec. All six existing callers ignore the value; none needed edits.
23+2. New gate `a_real_aomenc_10bit_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact`
24+ (`stream.rs:17719`), the 10-bit twin of the 8-bit witness: same recipe, same four
25+ `--enable-*` flags including `--enable-dual-filter=1`, `ten_bit = true`, same compound-8x8
26+ arrival counter, same 16-frame sequence, same 64-wide frame.
27+
28+### What makes it a witness rather than a spelling
29+
30+Three independent facts, in this assert order:
31+
32+1. **arrival, first** — `decode::dual_filter_diff_hits() > before_dual`, a DELTA taken around
33+ this arm alone. The counter increments only inside `resolve_interp_filter`
34+ (`decode.rs:35136`) and only when the header bit is set *and* the block's two directions
35+ differ. Deliberately asserted before the header checks so the mutation below reds on the
36+ arrival, not on a shape/pixel assert downstream.
37+2. **10-bit from the parsed header** — `seq.color_config.bit_depth == 10` read through
38+ `Av1Parser` on the encoded bytes. Not the filename, not the flag, not the fixture name.
39+3. **the tool is in the header** — `seq.enable_dual_filter` true, same parse.
40+
41+`inter_sb_none_gate` also pixel-compares every frame against ffmpeg's own 10-bit decode
42+(`ffmpeg_decode_sequence_10bit`), so the arm is pixel-exact end to end, not merely parseable.
43+
44+## Red-before (in the right direction)
45+
46+Mutation: `--enable-dual-filter=1` -> `=0` in the 10-bit arm only.
47+
48+```
49+panicked at crates/ec-av1/src/stream.rs:17753:
50+a_real_aomenc_10bit_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact:
51+no block read two DIFFERENT dual-filter directions in the 10-bit stream --
52+--enable-dual-filter=1 did not arrive or aomenc declined it
53+```
54+
55+The **arrival** assert, as required. First attempt had the header asserts first and reds on
56+`the parsed sequence header says enable_dual_filter = false` — correct but the wrong assert,
57+so the block was reordered and the red re-proven. Reverted after; both arms green:
58+
59+```
60+test stream::tests::a_real_aomenc_10bit_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact ... ok
61+test stream::tests::a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact ... ok
62+2 passed; 0 failed
63+```
64+
65+Sibling `inter_sb_none_gate` callers re-run green (whole-superblock 8/10-bit, 8x8-leaf-split
66+8/10-bit, across-tile-columns: 3 passed, 0 failed).
67+
68+## Census effect (measured, not claimed)
69+
70+`cargo test -p ec-av1 --lib gate_coverage`, run on this branch:
71+
72+```
73+the 10-bit list still names ["enable-dual-filter"], but a 10-bit gate now passes `=1` for
74+them -- delete those entries, the coverage hole is closed <- FAILS, correctly
75+
76+gate_coverage: 231 real-aomenc gates, 108 of them 10-bit
77+NEVER_EXERCISED_8BIT (1 of 26): --enable-rect-tx
78+NEVER_EXERCISED_10BIT (1 of 26): --enable-rect-tx
79+NEVER_ON_8BIT (0 of 10, over 192 8BIT gates)
80+NEVER_ON_10BIT (0 of 10, over 110 10BIT gates)
81+```
82+
83+That single red is the deliverable's receipt, and it is why this lane stops here:
84+
85+**`gate_coverage.rs:374-377`, `NEVER_EXERCISED_10BIT` — `enable-dual-filter`** is now
86+retirable. Its reason string ("no 10-bit gate spells `=1` -- that gate calls
87+`inter_sb_none_gate` with `ten_bit=false`") is exactly what this lane closed. Deletion is the
88+census owner's call; the merge owner sequences it. `enable-rect-tx` stays in both lists
89+(its premise is PROVEN: aom has no sequence-header bit for it, `enable_rect_tx` is read only
90+in `tx_search.c`).
91+
92+Gate counts moved 230 -> 231 and 107 -> 108 10-bit (the new arm), from lane-av1distwtd's
93+before-numbers of 146 -> 230 gates / 83 -> 107 at the detector fix.
94+
95+## Third detector limit, cited for report agreement (NOT fixed here)
96+
97+`--enable-tx-size-search` is built into a `format!`/`String` variable in a number of gates, so
98+`flags_in` — which matches the literal `"--enable-` — cannot see it. Any count of "gates
99+naming it" is therefore a FLOOR. lane-av1distwtd measured 113 of 230 naming it (88 `=0`,
100+15 `=1`, 9 invisible via `format!`); my independent recount on this branch (now 231 gates,
101+so not directly comparable) gives 116 segments spelling the literal (94 `=0`, 21 `=1`) plus
102+15 more that name the tool only inside a `format!`. Same class, same direction, magnitudes
103+differ only with the extra gate. Method: the method is the `format!` construction itself —
104+`args.push(format!("--enable-tx-size-search={}", ...))` leaves no `"--enable-` literal for
105+`match_indices` to find, so a census that wants a measurement rather than a floor has to
106+resolve the helper's `String` before counting, or match on the flag name without the leading
107+`"` and then classify the value from the format argument. Open question, not a fix.
108+
109+## Verification actually run
110+
111+- `cargo build -p ec-av1 --tests` clean.
112+- new gate green, both arms green, mutation red on the arrival assert, mutation reverted
113+ (grep confirms 4 `--enable-dual-filter=1` sites: 3926, 17668, 17736 — plus the two `=0`
114+ sites 18414/18680 untouched).
115+- sibling `inter_sb_none_gate` gates green.
116+- `gate_coverage` 10-bit test red for the intended reason; all other 9 green.