forge
Explore
Log in

Don't you dare go Hollow

merge main again: the wave moved while the preflight rework ran

Browse files at this commit

6123b105ce5f2f6f20ba35d2c3bba6dffca43633Ahmet Kaan GümüşParent: c9598074abac36
crates/ec-av1/examples/decode_probe.rsmodified+7 -2
@@ -51,12 +51,17 @@ fn main() {
5151 ec_av1::decode::chroma422_pair_wide_hits()
5252 );
5353 println!(
54- "uv_left_ss_y: reads={} mode_diff={} smooth_diff={}",
54+ "uv_left_ss_y: reads={} mode_diff={} smooth_diff={} split1mi={}",
5555 ec_av1::decode::uv_left_ss_y_reads(),
5656 ec_av1::decode::uv_left_ss_y_mode_diff_hits(),
57- ec_av1::decode::uv_left_ss_y_smooth_diff_hits()
57+ ec_av1::decode::uv_left_ss_y_smooth_diff_hits(),
58+ ec_av1::decode::uv_left_1mi_split_hits(),
5859 );
5960 let (h, v, c) = ec_av1::stream::rect4_32_counters();
61+ println!(
62+ "rect4_16_uv_pair_filt: {}",
63+ ec_av1::decode::rect4_16_uv_pair_filt_hits()
64+ );
6065 println!("rect4_32: horz={h} vert={v} coded={c}");
6166 println!(
6267 "rect_intrabc_reads: {}",
crates/ec-av1/src/decode.rsmodified+119 -16
@@ -5906,6 +5906,27 @@ pub fn uv_left_ss_y_smooth_diff_hits() -> usize {
59065906 UV_LEFT_SS_Y_SMOOTH_DIFF_HITS.with(|c| c.get())
59075907 }
59085908
5909+// lane-av1leftwit: decode-path chroma edge-filter-type reads at `ss_y > 0`
5910+// whose left-neighbour COLUMN holds a run of length 1 -- the cell this
5911+// decoder reads (its own mi row) and the cell libaom reads (one row down)
5912+// were written by two DIFFERENT blocks, i.e. the left neighbour is at most
5913+// 1 mi tall. That is the only geometry in which the `+ss_y` term can change
5914+// the answer at all; `UV_LEFT_SS_Y_READS` alone proves nothing about it.
5915+thread_local! {
5916+ static UV_LEFT_1MI_SPLIT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
5917+}
5918+
5919+/// Current value of [`UV_LEFT_1MI_SPLIT_HITS`].
5920+pub fn uv_left_1mi_split_hits() -> usize {
5921+ UV_LEFT_1MI_SPLIT_HITS.with(|c| c.get())
5922+}
5923+
5924+// lane-av1leftwit: the per-tile epoch `uv_owner` cells are stamped with.
5925+// Bumped in `Neighbours::start_tile`; never read by decode logic.
5926+thread_local! {
5927+ static UV_OWNER_EPOCH: std::cell::Cell<u32> = const { std::cell::Cell::new(0) };
5928+}
5929+
59095930 // lane-cfl r1 gate counters: `UV_CFL_PRED` blocks (every `cfl_alpha_signs`
59105931 // read) and chroma blocks with a NONZERO `angle_delta_uv` -- the two block
59115932 // shapes the r1 chroma defect showed up on.
@@ -8489,6 +8510,16 @@ struct Neighbours {
84898510 /// [`Self::uv_mode_grid`]'s stride, in mi units (superblock-padded, like
84908511 /// every other band here).
84918512 uv_grid_cols: usize,
8513+ /// lane-av1leftwit: which BLOCK wrote each cell of [`Self::uv_mode_grid`],
8514+ /// as `(epoch << 24) | (mi_r << 12) | mi_c` of the writing block's own
8515+ /// top-left mi. The `uv_mode` value alone cannot answer "are the two cells
8516+ /// the `+ss_y` read compares written by the same block?", which is the
8517+ /// whole question the `+ss_y` term turns on: the term is only observable
8518+ /// when the left neighbour is 1 mi tall, i.e. when the cell this decoder
8519+ /// used to read and the cell libaom reads hold DIFFERENT blocks. `epoch`
8520+ /// is [`UV_OWNER_EPOCH`], bumped once per tile, so a cell no block wrote
8521+ /// in this tile can never be mistaken for a written one.
8522+ uv_owner: Vec<u32>,
84928523 /// Whether the block above/left of this column/row was coded `skip` --
84938524 /// an inter frame's own `skip` context (spec `SkipContext`), which the
84948525 /// key-frame writer never tracks (its skip context is always zero); a
@@ -8682,6 +8713,7 @@ impl Neighbours {
86828713 uv_mode_row: vec![(u16::MAX, 0); rows * (SUB / MI)],
86838714 uv_mode_grid: vec![u8::MAX; cols * (SUB / MI) * rows * (SUB / MI)],
86848715 uv_grid_cols: cols * (SUB / MI),
8716+ uv_owner: vec![0; cols * (SUB / MI) * rows * (SUB / MI)],
86858717 above_txfm: vec![TXFM_CTX_INIT; cols * (SUB / MI)],
86868718 left_txfm: vec![TXFM_CTX_INIT; rows * (SUB / MI)],
86878719 // lane-inter8 r2: mi(4px)-granular, not [`SUB`]-granular -- an
@@ -8751,6 +8783,10 @@ impl Neighbours {
87518783 // lane-seg: `AvailU`/`AvailL` for the segment-id neighbour prediction
87528784 // are tile-relative, same as every other neighbour lookup here.
87538785 fctx.seg_tile_origin.with(|c| c.set((row0_mi, col0_mi)));
8786+ // lane-av1leftwit: a fresh epoch stamps every `uv_owner` cell this
8787+ // tile writes, so the `+ss_y` read's "different block?" probe never
8788+ // compares against a cell a previous tile left behind.
8789+ UV_OWNER_EPOCH.with(|c| c.set(c.get().wrapping_add(1) | (1 << 24)));
87548790 self.tile_row0_mi = row0_mi;
87558791 self.tile_col0_mi = col0_mi;
87568792 let end = col1_mi.min(self.above.len());
@@ -9860,6 +9896,17 @@ impl Neighbours {
98609896 uv_mode as u8,
98619897 );
98629898 }
9899+ // lane-av1leftwit: stamp the writing block's own mi over its extent,
9900+ // the same cells and the same clipping as `uv_mode_grid` above.
9901+ let owner = UV_OWNER_EPOCH.with(|c| c.get()) | ((mi_r as u32) << 12) | mi_c as u32;
9902+ for row in mi_r..=last_r {
9903+ fill_span(&mut self.uv_owner, row * stride + mi_c, n, owner);
9904+ }
9905+ if crate::envflags::env_flag!("EC_LEFTSSY") {
9906+ eprintln!(
9907+ "EC_LEAF mi=({mi_r},{mi_c}) wh=({mi_w},{mi_h}) uv_mode={uv_mode}"
9908+ );
9909+ }
98639910 }
98649911
98659912 /// Whether either mi-exact chroma neighbour of the block at `(mi_r, mi_c)`
@@ -9920,11 +9967,16 @@ impl Neighbours {
99209967 /// decode path uses the snapping form.
99219968 /// `decode_path` is `true` only for the snapping form every decode call
99229969 /// site uses; the 16x4/4x16 pair witness's mirror passes `false`, so the
9923- /// `+ss_y` counters measure the read that actually filters a chroma edge
9924- /// and not the counter-only one. (The mirror reads an ODD mi row -- the
9925- /// pair's chroma-reference half -- where the two cells differ far more
9926- /// often; counting it would make this lane look reachable when no
9927- /// committed fixture reaches it on the decode path.)
9970+ /// `+ss_y` counters measure a read that actually filters a chroma edge and
9971+ /// not the counter-only one.
9972+ ///
9973+ /// lane-av1leftwit: the mirror's justification used to be "no committed
9974+ /// fixture reaches the shape on the decode path", and that was false --
9975+ /// `UV_LEFT_1MI_SPLIT_HITS` fires on five of them. The flag stays (a
9976+ /// counter-only mirror at an ODD mi row is still not a decode-path read,
9977+ /// and its result feeds only `RECT4_16_UV_PAIR_FILT_HITS`), but it is no
9978+ /// longer evidence about the `+ss_y` term, and nothing may cite it as such.
9979+ /// The decode path's own reach is `uv_left_1mi_split_hits()`.
99289980 fn smooth_uv_neighbour_unsnapped(
99299981 &self,
99309982 mi_r: usize,
@@ -9981,13 +10033,18 @@ impl Neighbours {
998110033 // its own row at 4:2:2 (`ss_y == 0`); this read its own row at every
998210034 // subsampling. An earlier attempt applied the `ss_y` term to the WRONG
998310035 // read (the above) and regressed the byte-exact 4:2:0 control, which
9984- // is what exposed the crossing. The premise that blocked the correct
9985- // read -- "no committed fixture presents a 1-mi-tall left neighbour at
9986- // 4:2:0/4:4:0" -- was wrong: the observable condition is not the 8x4
9987- // leaf specifically but any left neighbour at most 1 mi tall, which
9988- // 4:2:0 partitioning produces constantly. Six committed 4:2:0
9989- // fixtures reach it (see the report's measurement table), and on
9990- // `reelb_ss600_key_frame.obu` the boolean flips.
10036+ // is what exposed the crossing. lane-av1leftwit CORRECTED the claim
10037+ // this comment used to make: "six committed 4:2:0 fixtures reach it,
10038+ // and on `reelb_ss600_key_frame.obu` the boolean flips" was never
10039+ // measured. Measured over all 48 committed fixtures that decode
10040+ // (`lanes/av1leftwit.report.md`), `reelb_ss600_key_frame.obu` reads
10041+ // `mode_diff=0 smooth_diff=0 split1mi=0`, and exactly FIVE fixtures
10042+ // put a 1-mi-tall left neighbour in front of a decode-path read at
10043+ // all -- `gm_small_side_witness` (5), `reelc_sb128_inter_witness` (7),
10044+ // `av112bit-{inter,compound,compound-masked}` (1 each) -- and in every
10045+ // one of those reads the two blocks agree on `uv_mode`. So the SHAPE is
10046+ // reachable (see `UV_LEFT_1MI_SPLIT_HITS`) and the term's VALUE
10047+ // changing is what is still unwitnessed.
999110048 let above_mi = (mi_r.saturating_sub(1), mi_c + ss_x);
999210049 // lane-av1leftref: libaom's LEFT read carries the `+ss_y` ROW term --
999310050 // `base_mi[ss_y * mi_stride - 1]` (`av1_common_int.h:1400-1401`) is
@@ -9996,11 +10053,17 @@ impl Neighbours {
999610053 // row at every subsampling. The term is only observable when the two
999710054 // cells hold DIFFERENT blocks, i.e. the left neighbour is 1 mi tall or
999810055 // shorter -- then `(row, col-1)` and `(row+1, col-1)` are two blocks
9999- // and only libaom's is the chroma reference. The two counters below
10000- // are the gate's non-vacuity proof: the mode value moved on
10001- // `UV_LEFT_SS_Y_MODE_DIFF_HITS` reads, and the boolean this feeds
10056+ // and only libaom's is the chroma reference. Three counters measure
10057+ // that, and the third is the one the other two need: a read can only
10058+ // differ if the two cells are written by DIFFERENT blocks, which
10059+ // `UV_LEFT_1MI_SPLIT_HITS` counts off the per-cell owner stamp
10060+ // (`uv_owner`, below). A DIFF bucket that reads 0 while SPLIT reads 0
10061+ // was never in contention; a DIFF bucket that reads 0 while SPLIT
10062+ // reads > 0 is the term being unobservable on real material, not
10063+ // unreachable. `..._MODE_DIFF_HITS` / `..._SMOOTH_DIFF_HITS` then say
10064+ // whether the mode value, and the boolean this feeds
1000210065 // (`is_smooth_mode` -> `av1_get_intra_edge_filter_type` -> the chroma
10003- // edge filter) flipped on `UV_LEFT_SS_Y_SMOOTH_DIFF_HITS`.
10066+ // edge filter), actually moved.
1000410067 let left_mi = (mi_r + ss_y, mi_c.saturating_sub(1));
1000510068 let read_left = |row: usize| -> usize {
1000610069 match self.uv_mode_row.get(row) {
@@ -10037,6 +10100,36 @@ impl Neighbours {
1003710100 if is_smooth_mode(own_row) != is_smooth_mode(left) {
1003810101 hit!(UV_LEFT_SS_Y_SMOOTH_DIFF_HITS);
1003910102 }
10103+ // lane-av1leftwit: the geometry the `+ss_y` term needs. The two
10104+ // cells are one left mi column apart, so they are two different
10105+ // blocks exactly when the left neighbour is 1 mi tall or shorter.
10106+ let col = left_mi.1;
10107+ let epoch = UV_OWNER_EPOCH.with(|c| c.get()) & 0xff00_0000;
10108+ let own = (col < self.uv_grid_cols)
10109+ .then(|| self.uv_owner.get(mi_r * self.uv_grid_cols + col).copied())
10110+ .flatten()
10111+ .filter(|o| o & 0xff00_0000 == epoch)
10112+ .unwrap_or(0);
10113+ let down = self
10114+ .uv_owner
10115+ .get((mi_r + ss_y) * self.uv_grid_cols + col)
10116+ .copied()
10117+ .filter(|o| o & 0xff00_0000 == epoch)
10118+ .unwrap_or(0);
10119+ if own != 0 && down != 0 && own != down {
10120+ hit!(UV_LEFT_1MI_SPLIT_HITS);
10121+ if crate::envflags::env_flag!("EC_LEFTSSY") {
10122+ eprintln!(
10123+ "EC_LEFTSSY epoch={} mi=({mi_r},{mi_c}) left_col={col} \
10124+ owners=({},{})->({},{}) modes={own_row}/{left}",
10125+ epoch >> 24,
10126+ own >> 12 & 0xfff,
10127+ own & 0xfff,
10128+ down >> 12 & 0xfff,
10129+ down & 0xfff,
10130+ );
10131+ }
10132+ }
1004010133 }
1004110134 if have_above && cell(&self.uv_mode_grid, mi_r - 1, mi_c).is_some_and(|m| {
1004210135 !matches!(self.uv_mode_col.get(mi_c), Some(&(row, cm)) if usize::from(row) == mi_r - 1 && usize::from(cm) == m)
@@ -17912,6 +18005,16 @@ fn decode_rect4_16_strip(
1791218005 // frame's own `ss_x` -- the unsnapped read is the pair-merge witness
1791318006 // counter's mirror of the snapping form, and the shipped read offsets
1791418007 // the above COLUMN by `+ss_x` (libaom's `chroma_above_mi`).
18008+ //
18009+ // lane-av1leftwit: this mirror is NOT evidence about the left read's
18010+ // `+ss_y` term, whatever a report once said. It reads the leaf's own
18011+ // (odd) mi row, which no decode call site does -- every one of them
18012+ // uses the snapping form, whose base row is even -- and its result
18013+ // feeds `RECT4_16_UV_PAIR_FILT_HITS` only. What it measures is real
18014+ // and worth keeping (the pair's chroma-reference read against the
18015+ // leaf's own row: 51/24/121/0/1 hits on the five fixtures censused),
18016+ // so it stays; the decode path's own reach for the `+ss_y` term is
18017+ // `uv_left_1mi_split_hits()`.
1791518018 if smooth_neighbor_uv
1791618019 != neighbours.smooth_uv_neighbour_unsnapped(
1791718020 lmi.0,
crates/ec-av1/src/gate_coverage.rsmodified+93 -0
@@ -779,6 +779,87 @@ mod tests {
779779 }
780780 }
781781 }
782+ // (3b) `for (<var>, ...) in <ident>` where `<ident>` is a `let`
783+ // binding in this same body -- the arm table hoisted OUT of the
784+ // loop header, so the `for` line NAMES the array instead of
785+ // spelling it. Strategy (3) alone silently reads past the `for`
786+ // line to the next `[` in the body (an unrelated `&[..]` flag
787+ // list), finds no digits, and returns an empty set: the gate is
788+ // then filed as UNRESOLVED even though both of its arms sit
789+ // verbatim in the source. Measured: the 128x96 4:4:4 lossy
790+ // tx-size-search gate, whose `for (label, search, ...) in arms`
791+ // drove `print_tx_size_search_census`'s `unresolvable == 0`
792+ // assertion red on merge. The `=` hop matters: the binding's
793+ // TYPE annotation is itself bracketed
794+ // (`[(&str, &str, TxMode, usize, u64); 2]`), so scanning for the
795+ // first `[` after the name would return the type.
796+ // `<var>`'s column, read off the arm table a hoisted `for` line
797+ // NAMES rather than spells. Returns `None` unless the body really
798+ // has that shape, so an unrecognised loop is left to the other
799+ // strategies instead of being read as "no values".
800+ let named_column = |pos: usize| -> Option<BTreeSet<char>> {
801+ let at = body.find("for (")?;
802+ let head = &body[at..];
803+ let close = head.find(')')?;
804+ let after = head[close + 1..].trim_start().strip_prefix("in ")?;
805+ let name: &str = after
806+ .split(|c: char| !is_ident_byte(c as u8))
807+ .next()
808+ .filter(|n| !n.is_empty() && !n.starts_with(|c: char| c.is_ascii_digit()))?;
809+ let decl = body.find(&format!("let {name}"))?;
810+ let after_name = decl + "let ".len() + name.len();
811+ // `let arms_foo` must not answer for `let arms`.
812+ if body[after_name..]
813+ .chars()
814+ .next()
815+ .is_some_and(|c| is_ident_byte(c as u8))
816+ {
817+ return None;
818+ }
819+ // Hop the `=`: the binding's TYPE annotation is itself
820+ // bracketed, so the first `[` after the name is the type.
821+ let eq = after_name + body[after_name..].find('=')?;
822+ let open = eq + 1 + body[eq + 1..].find('[')?;
823+ let mut depth = 0i32;
824+ for (i, c) in body[open..].char_indices() {
825+ match c {
826+ '[' => depth += 1,
827+ ']' => {
828+ depth -= 1;
829+ if depth == 0 {
830+ let mut set: BTreeSet<char> = Default::default();
831+ for tuple in split_top(&body[open + 1..open + i]) {
832+ let Some(inner) =
833+ tuple.strip_prefix('(').and_then(|t| t.strip_suffix(')'))
834+ else {
835+ continue;
836+ };
837+ let fields = split_top(inner);
838+ let Some(field) = fields.get(pos) else {
839+ continue;
840+ };
841+ set.extend(bare_digits(field));
842+ set.extend(quoted_digits(field));
843+ }
844+ return Some(set);
845+ }
846+ }
847+ _ => {}
848+ }
849+ }
850+ None
851+ };
852+ if let Some(at) = body.find("for (") {
853+ let head = &body[at..];
854+ if let Some(close) = head.find(')') {
855+ let pattern = &head["for (".len()..close];
856+ if let Some(pos) = pattern.split(',').position(|p| p.trim() == var) {
857+ if let Some(set) = named_column(pos) {
858+ merge(set);
859+ }
860+ }
861+ }
862+ }
782863 // (4) `u8::from(<a>.<field>)` over a struct-literal arm table.
783864 for (i, _) in body.match_indices("u8::from(") {
784865 let arg = &body[i + "u8::from(".len()..];
@@ -1384,6 +1465,18 @@ mod tests {
13841465 "for (tx_search, bit_depth) in [(\"0\", 8u8), (\"0\", 8u8), (\"0\", 10u8)]",
13851466 "a_real_aomenc_stream_with_filter_intra_on_a_sub8_rect_leaf_decodes_pixel_exact",
13861467 ),
1468+ // The arm table hoisted OUT of the `for` line into a named
1469+ // `let` -- the shape lane-av1lossy128x96 writes, and the one
1470+ // that reads as UNRESOLVED unless the `for` line's collection
1471+ // name is followed back to its binding. Without this case a
1472+ // resolver that only understood inline arrays passes the
1473+ // three above and still cannot bind this gate.
1474+ (
1475+ "format!(\"--enable-tx-size-search={search}\")",
1476+ "\"tx size search on\",\n \"1\",",
1477+ "\"tx size search on\",\n \"0\",",
1478+ "a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96",
1479+ ),
13871480 ];
13881481 for (template, from, to, name) in cases {
13891482 let body = find(name);
crates/ec-av1/src/stream.rsmodified+433 -60
@@ -9126,6 +9126,22 @@ pub(crate) mod tests {
91269126 /// the machine's scratchpad is reaped -- three gates sat at `rc=0` having
91279127 /// tested nothing for exactly that reason (lane-av1pins). Falls back to
91289128 /// `pin_dir()` so a locally re-captured stream still overrides.
9129+ /// Read a pin that a gate cannot proceed without. A missing pin is a
9130+ /// HARD failure naming the path and the generator, never a raw io panic
9131+ /// and never a silent skip: `EC_AV1_GATE_DUMP_PIN` points the gate at a
9132+ /// freshly captured stream, and a runner without the committed copy must
9133+ /// say so instead of reporting green having tested nothing.
9134+ fn require_pin(path: &std::path::Path, name: &str) -> Vec<u8> {
9135+ std::fs::read(path).unwrap_or_else(|e| {
9136+ panic!(
9137+ "no pinned bytes at {} ({e}) -- set EC_AV1_GATE_DUMP_PIN to a freshly \
9138+ captured stream, or restore the committed copy at \
9139+ crates/ec-av1/fixtures/{name}",
9140+ path.display()
9141+ )
9142+ })
9143+ }
9144+
91299145 fn crate_pin(name: &str) -> std::path::PathBuf {
91309146 let in_crate = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
91319147 .join("fixtures")
@@ -23675,11 +23691,14 @@ pub(crate) mod tests {
2367523691 /// `EC_AV1_GATE_DUMP=$SP/golden3-pin.obu` off
2367623692 /// [`a_real_aomenc_inter_sequence_with_cdf_forwarding_decodes_pixel_exact`]
2367723693 /// (seed 47, frame 1 U). Deterministic and static -- no aomenc/ffmpeg
23678- /// re-encode involved, only re-decodes fixed bytes on disk. Still
23679- /// `#[ignore]`d: it is a BISECT aid, not a suite gate. What changed under
23680- /// lane-av1pins is WHERE the bytes live -- they are now committed at
23681- /// `crates/ec-av1/fixtures/golden3-pin.obu` instead of a scratchpad that
23682- /// tmpfs reaps, so the gate does real work on any runner.
23694+ /// re-encode involved, only re-decodes fixed bytes on disk. What changed
23695+ /// under lane-av1pinslive is that the gate is LIVE: the bytes are committed
23696+ /// at `crates/ec-av1/fixtures/golden3-pin.obu` instead of a scratchpad that
23697+ /// tmpfs reaps, so it runs in the ordinary suite on any runner that has
23698+ /// ffmpeg (guarded by `have_ffmpeg()`, so `EC_AV1_REQUIRE_FFMPEG=1` turns
23699+ /// its absence into a hard failure rather than a silent skip). It costs
23700+ /// ~0.15 s, touches no process-global, and reads no counter -- none of the
23701+ /// conditions that make this crate ignore its other manual gates.
2368323702 ///
2368423703 /// The original capture (2026-08-28, `bec27414`) is NOT reproducible: it
2368523704 /// predates `5ae053d3` "route all 20 gradients gate fixtures through
@@ -23693,7 +23712,6 @@ pub(crate) mod tests {
2369323712 /// `a_real_aomenc_inter_sequence_with_cdf_forwarding_decodes_pixel_exact`
2369423713 /// prints for that seed -- which is what proves the recipe is that gate's.
2369523714 #[test]
23696- #[ignore = "bisect aid, not a suite gate; run it with --ignored"]
2369723715 fn pinned_golden3_stream_decodes_pixel_exact() {
2369823716 let path = std::env::var("EC_AV1_GATE_DUMP_PIN")
2369923717 .map(std::path::PathBuf::from)
@@ -23737,22 +23755,22 @@ pub(crate) mod tests {
2373723755 /// `EC_AV1_GATE_DUMP=$SP/golden4-pin.obu` off
2373823756 /// [`a_real_aomenc_inter_sequence_with_cdf_forwarding_decodes_pixel_exact`]
2373923757 /// (seed 43, frame 3 luma) the round the GOLDEN mask lifted. Deterministic
23740- /// and static -- `#[ignore]`d, run manually.
23758+ /// and static.
23759+ ///
23760+ /// LIVE since lane-av1pinslive r3: the bytes are committed at
23761+ /// `crates/ec-av1/fixtures/golden4-pin.obu` (137 bytes; sha256
23762+ /// `1754023e44e46edaebc2c05065bf1c65db1a41354577cbf71c0e8ebe737ae14a`,
23763+ /// recovered byte-for-byte from the runner library), so the old
23764+ /// "reads a pinned fixture path outside the repo" reason is false. Costs
23765+ /// ~0.10 s, touches no process-global, reads `non_last_ref_hits` for
23766+ /// diagnostic output only (never asserted), and calls no aomenc.
2374123767 #[test]
23742- #[ignore = "reads a pinned fixture path outside the repo; run manually"]
2374323768 fn pinned_golden4_stream_decodes_pixel_exact() {
2374423769 use crate::decode::non_last_ref_hits;
2374523770 let path = std::env::var("EC_AV1_GATE_DUMP_PIN")
2374623771 .map(std::path::PathBuf::from)
23747- .unwrap_or_else(|_| pin_dir().join("golden4-pin.obu"));
23748- let Ok(stream) = std::fs::read(&path) else {
23749- eprintln!(
23750- "SKIP pinned_golden4_stream_decodes_pixel_exact: no pinned bytes at {} \
23751- -- re-capture with EC_AV1_GATE_DUMP off the cdf-forwarding gate",
23752- path.display()
23753- );
23754- return;
23755- };
23772+ .unwrap_or_else(|_| crate_pin("golden4-pin.obu"));
23773+ let stream = require_pin(&path, "golden4-pin.obu");
2375623774 if !have_ffmpeg() {
2375723775 eprintln!("SKIP pinned_golden4_stream_decodes_pixel_exact: no ffmpeg");
2375823776 return;
@@ -23775,15 +23793,22 @@ pub(crate) mod tests {
2377523793 /// by the forwarding gate once film grain is out of the way (1/20 real
2377623794 /// aomenc streams, frame 3 luma, apply_grain=false, `non_last_ref_hits`
2377723795 /// delta=2). `GOLDEN_FRAME` refuses by name until this decodes exact.
23796+ ///
23797+ /// LIVE since lane-av1pinslive r3. The old shape was the worst of the
23798+ /// class: a `concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/...")`
23799+ /// literal, which points at the GITIGNORED root and can therefore never be
23800+ /// satisfied by a committed pin, combined with a bare `.expect()`. The
23801+ /// bytes are now committed at
23802+ /// `crates/ec-av1/fixtures/golden7-forwarding-mismatch.obu` (152 bytes;
23803+ /// sha256 `81b3bf657a85e95085287b30d97dee93ba5aea0ed1db1e1f4fcd19a06afc17be`,
23804+ /// recovered byte-for-byte from the runner library).
2377823805 #[test]
23779- #[ignore = "reads a pinned fixture path outside the repo; run manually"]
2378023806 fn pinned_golden7_stream_decodes_pixel_exact() {
2378123807 use crate::decode::non_last_ref_hits;
23782- let path = concat!(
23783- env!("CARGO_MANIFEST_DIR"),
23784- "/../../fixtures/golden7-forwarding-mismatch.obu"
23785- );
23786- let stream = std::fs::read(path).expect("reading pinned stream");
23808+ let path = std::env::var("EC_AV1_GATE_DUMP_PIN")
23809+ .map(std::path::PathBuf::from)
23810+ .unwrap_or_else(|_| crate_pin("golden7-forwarding-mismatch.obu"));
23811+ let stream = require_pin(&path, "golden7-forwarding-mismatch.obu");
2378723812 if !have_ffmpeg() {
2378823813 eprintln!("SKIP pinned_golden7_stream_decodes_pixel_exact: no ffmpeg");
2378923814 return;
@@ -30277,35 +30302,103 @@ pub(crate) mod tests {
3027730302 /// `EC_LR_CALL_DUMP=1` set (see `restoration.rs`'s `apply_sgrproj_stripe`)
3027830303 /// to get the real window on stderr, call-uniquely keyed to `xqd ==
3027930304 /// [-16,-32]` rather than any coordinate.
30305+ /// lane-av1pinslive r4: this gate asserted NOTHING. It `eprintln!`d per-frame
30306+ /// mismatch flags and returned, so it could not go red on a decode regression
30307+ /// -- which is why r3 left it `#[ignore]`d on that fact rather than un-ignoring
30308+ /// it. It now carries the same three things its three siblings have: a pinned
30309+ /// FRAME COUNT, a length assert before the zip, and per-plane per-frame pixel
30310+ /// asserts. The diagnostic print is kept, and now runs BEFORE the asserts so a
30311+ /// failure still names the shape of the divergence.
30312+ ///
30313+ /// The frame count is the substantive fix. The old body passed `pics.len()` as
30314+ /// ffmpeg's EXPECTED count:
30315+ /// let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len());
30316+ /// so a decoder that emitted ZERO frames asked ffmpeg for zero frames, the zip
30317+ /// compared no pairs, and the gate passed having proved nothing -- the exact
30318+ /// vacuous-pass shape the `cmpaudit` lane swept elsewhere in this crate. The
30319+ /// count now comes from the FIXTURE (`FRAMES`), so losing the frame reds on the
30320+ /// count instead of comparing nothing.
30321+ ///
30322+ /// On "does it compare only frame 0": the loop always visited every frame; this
30323+ /// pin simply holds one (`frame 0` was the only line the pre-r4 run printed).
30324+ /// The loop is unchanged in that respect and still visits every frame it gets.
30325+ ///
30326+ /// The `EC_LR_CALL_DUMP=1` window is unchanged and still needs that env -- but
30327+ /// it is a debugging session layered on a real gate now, not the gate itself.
3028030328 #[test]
30281- #[ignore = "reads a pinned fixture under the gitignored fixtures dir; run manually with EC_LR_CALL_DUMP=1"]
3028230329 fn pinned_lr_sgr_stream_call_unique_dump() {
30283- let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/lr-sgr-r7.obu");
30284- let stream = std::fs::read(path).expect("reading pinned lr-sgr-r7.obu");
30330+ const NAME: &str = "pinned_lr_sgr_stream_call_unique_dump";
30331+ const W: usize = 192;
30332+ const H: usize = 128;
30333+ /// Measured: the pre-r4 run printed `frame 0` and no other frame line.
30334+ const FRAMES: usize = 1;
30335+ let path = std::env::var("EC_AV1_GATE_DUMP_PIN")
30336+ .map(std::path::PathBuf::from)
30337+ .unwrap_or_else(|_| crate_pin("lr-sgr-r7.obu"));
30338+ let stream = require_pin(&path, "lr-sgr-r7.obu");
3028530339 let pics = decode_stream(&stream).expect("pinned lr-sgr-r7.obu must decode");
30286- if have_ffmpeg() {
30287- let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len());
30288- for (i, (got, want)) in pics.iter().zip(&reference).enumerate() {
30289- let y_mismatch = got.y != want.y;
30290- let u_mismatch = got.u != want.u;
30291- let v_mismatch = got.v != want.v;
30292- eprintln!(
30293- "frame {i}: y_mismatch={y_mismatch} u_mismatch={u_mismatch} v_mismatch={v_mismatch}"
30294- );
30295- if y_mismatch {
30296- let n = got.y.iter().zip(&want.y).filter(|(a, b)| a != b).count();
30297- eprintln!(" {n} luma bytes differ / {}", got.y.len());
30298- }
30299- if v_mismatch {
30300- let w = 96usize; // chroma plane width (192/2)
30301- for (idx, (a, b)) in got.v.iter().zip(&want.v).enumerate() {
30302- if a != b {
30303- eprintln!(" V[{},{}] got={a} want={b}", idx / w, idx % w);
30304- }
30340+ assert_eq!(
30341+ pics.len(),
30342+ FRAMES,
30343+ "{NAME}: decoded {} frame(s), the pinned stream holds {FRAMES} -- a short \
30344+ decode would otherwise ask ffmpeg for the same short count and compare \
30345+ nothing",
30346+ pics.len()
30347+ );
30348+ for f in &pics {
30349+ assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions");
30350+ }
30351+ if !have_ffmpeg() {
30352+ eprintln!(
30353+ "SKIP {NAME}: no ffmpeg -- the pixel compare IS this gate's claim, so it \
30354+ proves nothing here; set EC_AV1_REQUIRE_FFMPEG=1 to make that a hard \
30355+ failure instead"
30356+ );
30357+ return;
30358+ }
30359+ let reference = ffmpeg_decode_sequence(&stream, W, H, FRAMES);
30360+ assert_eq!(
30361+ reference.len(),
30362+ FRAMES,
30363+ "{NAME}: ffmpeg returned {} frame(s), expected {FRAMES}",
30364+ reference.len()
30365+ );
30366+ for (i, (got, want)) in pics.iter().zip(&reference).enumerate() {
30367+ let y_mismatch = got.y != want.y;
30368+ let u_mismatch = got.u != want.u;
30369+ let v_mismatch = got.v != want.v;
30370+ eprintln!(
30371+ "frame {i}: y_mismatch={y_mismatch} u_mismatch={u_mismatch} v_mismatch={v_mismatch}"
30372+ );
30373+ if y_mismatch {
30374+ let n = got.y.iter().zip(&want.y).filter(|(a, b)| a != b).count();
30375+ eprintln!(" {n} luma bytes differ / {}", got.y.len());
30376+ }
30377+ if v_mismatch {
30378+ let w = 96usize; // chroma plane width (192/2)
30379+ for (idx, (a, b)) in got.v.iter().zip(&want.v).enumerate() {
30380+ if a != b {
30381+ eprintln!(" V[{},{}] got={a} want={b}", idx / w, idx % w);
3030530382 }
3030630383 }
3030730384 }
30385+ assert_eq!(
30386+ got.y, want.y,
30387+ "{NAME} frame {i} luma vs ffmpeg (pinned lr-sgr)"
30388+ );
30389+ assert_eq!(
30390+ got.u, want.u,
30391+ "{NAME} frame {i} U vs ffmpeg (pinned lr-sgr)"
30392+ );
30393+ assert_eq!(
30394+ got.v, want.v,
30395+ "{NAME} frame {i} V vs ffmpeg (pinned lr-sgr)"
30396+ );
3030830397 }
30398+ eprintln!(
30399+ "{NAME}: {FRAMES} frame(s) byte-exact vs ffmpeg from {}",
30400+ path.display()
30401+ );
3030930402 }
3031030403
3031130404 /// lane-realworld r2: `read_cdef` (spec 5.11.56) ported -- per-superblock
@@ -33213,11 +33306,19 @@ pub(crate) mod tests {
3321333306 eprintln!("SKIP a_real_aomenc_stream_with_film_grain_decodes_pixel_exact: no ffmpeg");
3321433307 return;
3321533308 }
33216- let data = std::fs::read(concat!(
33217- env!("CARGO_MANIFEST_DIR"),
33218- "/../../fixtures/golden6-mismatch.obu"
33219- ))
33220- .unwrap();
33309+ // lane-av1pinslive r3: this gate was LIVE while reading a GITIGNORED
33310+ // pin through a `concat!` literal and `.unwrap()` -- a clean checkout
33311+ // with no runner library PANICKED here rather than skipping. The bytes
33312+ // are now committed at `crates/ec-av1/fixtures/golden6-mismatch.obu`
33313+ // (452 bytes; sha256
33314+ // `c56909b98542192b03f3a945e153475aa57a58a1586bf166513297296cb225b3`,
33315+ // recovered byte-for-byte from the runner library).
33316+ let data = require_pin(
33317+ &std::env::var("EC_AV1_GATE_DUMP_PIN")
33318+ .map(std::path::PathBuf::from)
33319+ .unwrap_or_else(|_| crate_pin("golden6-mismatch.obu")),
33320+ "golden6-mismatch.obu",
33321+ );
3322133322 // Truncate right after the first `Frame` OBU (the key frame): every
3322233323 // byte up to there is sequence header + frame-0, which is a complete,
3322333324 // independently decodable single-frame stream.
@@ -39492,7 +39593,8 @@ pub(crate) mod tests {
3949239593 /// decodes_pixel_exact` -- fast red/green loop for the bisect, and lets
3949339594 /// `EC_AV1_TRACE=1` be set for one run without re-driving the encoder.
3949439595 ///
39495- /// lane-av1pins: the bytes are now committed at
39596+ /// LIVE since lane-av1pinslive (it was `#[ignore]`d from lane-sbpart r4
39597+ /// only because the bytes lived in a scratchpad). Bytes committed at
3949639598 /// `crates/ec-av1/fixtures/sbpart-pin.obu` (238 bytes; sha256
3949739599 /// `62238fc077f45d89745d4d254b9c0465464003529da3b42d0a65631fbb7e16e9`),
3949839600 /// re-encoded 2026-09-29 from the source gate's own recipe
@@ -39503,7 +39605,6 @@ pub(crate) mod tests {
3950339605 /// 192x128 cell, so this pin is a 192x128 re-run of its recipe, not a
3950439606 /// replay of the original mismatch bytes.
3950539607 #[test]
39506- #[ignore = "bisect aid, not a suite gate; run it with --ignored"]
3950739608 fn pinned_sbpart_stream_decodes_pixel_exact() {
3950839609 let path = std::env::var("EC_AV1_GATE_DUMP_PIN")
3950939610 .map(std::path::PathBuf::from)
@@ -44870,14 +44971,17 @@ pub(crate) mod tests {
4487044971 /// every subsampling until this lane.
4487144972 ///
4487244973 /// The read is only observable when the two cells hold DIFFERENT blocks --
44873- /// a left neighbour at most 1 mi tall. Measured over every committed
44874- /// fixture and ~1000 swept aomenc encodes (report table), that never
44875- /// happens on a decode-path read: `uv_mode_grid` runs down a left mi
44876- /// column always have EVEN length, because libaom only starts a block on
44877- /// an odd mi row with an 8-px strip, and the 4-px `HORZ_4` strips aomenc
44878- /// does pick all land inside one mi row. So the term is a proven no-op on
44879- /// today's material, and this gate pins BOTH halves of that statement:
44880- /// the arm runs thousands of times, and it never changes an answer.
44974+ /// a left neighbour at most 1 mi tall (1 mi = 4 luma px, so a 4x4/8x4/16x4
44975+ /// /32x4/64x4 leaf). lane-av1leftwit measured that shape off a per-cell
44976+ /// owner stamp instead of the mode value: `uv_left_1mi_split_hits()` counts
44977+ /// decode-path reads whose two cells were written by DIFFERENT blocks, and
44978+ /// it is NOT zero -- five committed fixtures carry it (15 reads in all,
44979+ /// `lanes/av1leftwit.report.md`). What no committed fixture shows is the two
44980+ /// blocks DISAGREEING on `uv_mode`, which is what `mode_diff`/`smooth_diff`
44981+ /// below measure. So this gate pins both halves honestly: the arm runs
44982+ /// thousands of times, the shape it needs is genuinely reached, and the
44983+ /// term has not yet been seen to change an answer. Its exactness arms are
44984+ /// what would decide the shipped read if a DIFF bucket ever went non-zero.
4488144985 ///
4488244986 /// A non-zero DIFF bucket is not a failure here -- it is the first stream
4488344987 /// that witnesses the term, and the exactness arms below are what then
@@ -44925,6 +45029,87 @@ pub(crate) mod tests {
4492545029 );
4492645030 }
4492745031
45032+ /// lane-av1leftwit: the `+ss_y` term's SHAPE is reachable on the decode
45033+ /// path, and this is the gate that says so.
45034+ ///
45035+ /// lane-av1leftref shipped the left read's `+ss_y` row term with the
45036+ /// argument that the shape it needs -- a left neighbour at most 1 mi tall,
45037+ /// so the cell this decoder read and the cell libaom reads belong to
45038+ /// different blocks -- is "structurally absent, because aomenc never starts
45039+ /// a block on an odd mi row". Both halves of that are wrong. libaom's
45040+ /// `PARTITION_HORZ_4` puts its `i == 0` child on the PARENT's own mi row
45041+ /// (`decode_partition`, `av1/decoder/decodeframe.c`: `mi_row + i * bw / 4`),
45042+ /// and a 16x16 parent sits on a 4-mi grid, so a 1-mi-tall leaf at an EVEN
45043+ /// row is what the syntax asks for, not forbids. And the shape is measured
45044+ /// in the corpus: these two fixtures each present it to a real decode-path
45045+ /// read.
45046+ ///
45047+ /// The counter is `decode::uv_left_1mi_split_hits()`, incremented only
45048+ /// where `decode_path` is true -- the snapping form every decode call site
45049+ /// uses -- so the 16x4/4x16 pair witness's counter-only mirror (which
45050+ /// reads an odd mi row and feeds `RECT4_16_UV_PAIR_FILT_HITS`) cannot
45051+ /// inflate it. `UV_LEFT_SS_Y_READS` alone would prove nothing: it counts
45052+ /// every read with a left neighbour, whether or not the two cells differ.
45053+ ///
45054+ /// NON-VACUITY: the `uv_owner` stamp the counter turns on was removed for
45055+ /// one build; both arms fell to 0 and this gate failed on the census
45056+ /// (report §5), so a decoder that stops recording which block owns a cell
45057+ /// fails here instead of passing vacuously. It is deliberately NOT a
45058+ /// mutation of the `+ss_y` term itself: the term's own mutation leaves
45059+ /// these reads untouched, which is the honest limit of what the fixture
45060+ /// set can decide (the kf900 gate above owns the exactness side).
45061+ #[test]
45062+ fn a_committed_4to20_stream_presents_a_one_mi_left_neighbour_to_a_decode_path_read() {
45063+ const NAME: &str =
45064+ "a_committed_4to20_stream_presents_a_one_mi_left_neighbour_to_a_decode_path_read";
45065+ // (fixture, frames, width, height, measured split-owner reads)
45066+ let arms: [(&str, usize, usize, usize, usize); 2] = [
45067+ ("gm_small_side_witness.obu", 33, 1920, 792, 5),
45068+ ("reelc_sb128_inter_witness.obu", 15, 1920, 792, 7),
45069+ ];
45070+ for (fixture, want_frames, width, height, want_split) in arms {
45071+ let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
45072+ .join("fixtures")
45073+ .join(fixture);
45074+ let stream = std::fs::read(&path)
45075+ .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display()));
45076+ let before_split = crate::decode::uv_left_1mi_split_hits();
45077+ let before_reads = crate::decode::uv_left_ss_y_reads();
45078+ let before_mode = crate::decode::uv_left_ss_y_mode_diff_hits();
45079+ let before_smooth = crate::decode::uv_left_ss_y_smooth_diff_hits();
45080+ let frames = match decode_stream(&stream) {
45081+ Ok(frames) => frames,
45082+ Err(e) => panic!("{NAME}: {fixture} refused: {e}"),
45083+ };
45084+ let split = crate::decode::uv_left_1mi_split_hits() - before_split;
45085+ assert_eq!(frames.len(), want_frames, "{NAME}: {fixture} frame count");
45086+ assert!(
45087+ frames
45088+ .iter()
45089+ .all(|f| (f.width, f.height) == (width, height)),
45090+ "{NAME}: {fixture} is not {width}x{height}"
45091+ );
45092+ assert_eq!(
45093+ split, want_split,
45094+ "{NAME}: {fixture} presented {split} 1-mi-tall left neighbours to \
45095+ a decode-path read, measured {want_split} -- the census this \
45096+ gate pins moved"
45097+ );
45098+ // Printed, not asserted: `== 0` would pin an accident, and a
45099+ // non-zero value is the first WITNESS of the term rather than a
45100+ // failure (that is what the kf900 gate above then decides against
45101+ // the oracle).
45102+ eprintln!(
45103+ "{NAME}: {fixture}: {split} 1-mi-tall left neighbours in \
45104+ {} decode-path reads, +ss_y changed the mode {} and the smooth \
45105+ boolean {} times",
45106+ crate::decode::uv_left_ss_y_reads() - before_reads,
45107+ crate::decode::uv_left_ss_y_mode_diff_hits() - before_mode,
45108+ crate::decode::uv_left_ss_y_smooth_diff_hits() - before_smooth,
45109+ );
45110+ }
45111+ }
45112+
4492845113 /// lane-av1formatsweep: the ODD CODED DIMENSION cell -- a frame whose
4492945114 /// width or height is not a multiple of 8, so the last mode-info column
4493045115 /// and the last chroma plane row/column are PARTIAL (`mi_cols * 8 >
@@ -47095,4 +47280,192 @@ pub(crate) mod tests {
4709547280 heads.iter().map(|h| h.superres_denom).collect::<Vec<_>>()
4709647281 );
4709747282 }
47283+
47284+ /// lane-av1lossy128x96: the 128x96 sibling of the pinned 128x128 witness
47285+ /// `a_pinned_444_inter_stream_chroma_units_inherit_their_own_quadrants_tx_type`
47286+ /// (commit 6c33f204). That fix closed the "4:4:4 lossy + TX size search"
47287+ /// divergence (H2) for the 128x128 twin; the 128x96 geometry -- two whole
47288+ /// 64x64 roots over a frame whose second block row is only 32 rows tall,
47289+ /// which is why it exercises BOTH chroma planes and a partial block row --
47290+ /// was left ungated, and it is the geometry the sweep measured the
47291+ /// U+V form of the defect on (608 wrong samples from decode-order frame 2).
47292+ ///
47293+ /// Measured for this lane on the fix's parent `4155c7c7`: decode-order
47294+ /// frames 2 and 3 differ from the oracle in 608 and 692 samples (luma
47295+ /// exact, U and V wrong), entropy bit-identical; at HEAD and at `6c33f204`
47296+ /// all four frames are byte-exact. So the defect is FIXED and this gate is
47297+ /// the pin that keeps it fixed.
47298+ ///
47299+ /// Recipe (encoded LIVE, no fixture): `testsrc2 128x96:rate=25` yuv444p
47300+ /// 4 frames, `aomenc --profile=1 --codec=av1 --passes=1 --end-usage=q
47301+ /// --cq-level=20 --cpu-used=2 --sb-size=64 --min-partition-size=64
47302+ /// --max-partition-size=64 --enable-tx-size-search=1 --threads=1 --row-mt=0
47303+ /// --lag-in-frames=0 --kf-max-dist=100 --limit=4 --obu -o - -`.
47304+ /// Search ON: 21830 B, sha256 `7380bcbbfb791c6a369850357211223e20fab959423135951f6eb43ffbfcfebd`,
47305+ /// fnv1a64 `0x1ba3fe9a4335bdbb`. Control arm, same recipe with
47306+ /// `--enable-tx-size-search=0`: 21296 B, sha256
47307+ /// `347edcc9f4899fb05b15174b82d37f6562dcc6fe7691af0ed9ba4efd6cc878c6`,
47308+ /// fnv1a64 `0x2f87d8e98c9db686`.
47309+ ///
47310+ /// NON-VACUITY, and the search flag is NOT the assert: the recipe SPELLS
47311+ /// `--enable-tx-size-search=1` (aomenc keeps the FIRST occurrence, and a
47312+ /// flag left defaulted is "unknown", not "on"), and then
47313+ /// 1. every frame header's PARSED `tx_mode` is `TxMode::Select`
47314+ /// (`TX_MODE_SELECT`) -- the searched transform mode is really in the
47315+ /// bitstream, not merely requested. The control arm asserts the
47316+ /// opposite (`TxMode::Largest`), so neither arm can pass on the other's
47317+ /// stream;
47318+ /// 2. the sequence header is `ss (0,0)` at 8 bits (`assert_444_header`),
47319+ /// and the stream is byte-identical to the recorded encode (length +
47320+ /// fnv1a64), so an aomenc that stopped producing this cell fails here
47321+ /// rather than silently measuring something else;
47322+ /// 3. `decode::chroma_quad_leaf_tx_diff_hits()` strictly increases on the
47323+ /// search arm -- the number that says the per-quadrant resolve CHANGED
47324+ /// an answer, which is the defect itself. It must be exactly 0 on the
47325+ /// search-off control: with no var-tx there is no four-leaf luma tree,
47326+ /// so the arm is unreachable and a counter that fired there would be
47327+ /// counting something else;
47328+ /// 4. every decoded plane is 128*96 (at `ss (0,0)` chroma is full
47329+ /// resolution, so a subsampled extent fails the shape assert);
47330+ /// 5. `decode_all_frames_vs_oracle` asserts the decode-order frame COUNT
47331+ /// and each frame's byte LENGTH before any sample is compared.
47332+ ///
47333+ /// Red-before: reverting ONLY the per-quadrant resolve in
47334+ /// `decode_inter_block`'s 64x64 four-unit chroma arm (the `covering_leaf_tx_type`
47335+ /// call back to the block-level `first_tx_type`, counters and this gate
47336+ /// untouched) turns this gate red on decode-order frame 2 with 608 bytes
47337+ /// differing, and green again on restore.
47338+ #[test]
47339+ fn a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96() {
47340+ const NAME: &str =
47341+ "a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96";
47342+ let _gate_lock = lock_gate_counters();
47343+ if !have_ffmpeg() || !have_aomenc() {
47344+ eprintln!("SKIP {NAME}: no ffmpeg/aomenc");
47345+ return;
47346+ }
47347+ // (label, --enable-tx-size-search, parsed tx mode, bytes, fnv1a64)
47348+ let arms: [(&str, &str, TxMode, usize, u64); 2] = [
47349+ (
47350+ "tx size search on",
47351+ "1",
47352+ TxMode::Select,
47353+ 21830,
47354+ 0x1ba3_fe9a_4335_bdbb,
47355+ ),
47356+ (
47357+ "tx size search off (control)",
47358+ "0",
47359+ TxMode::Largest,
47360+ 21296,
47361+ 0x2f87_d8e9_8c9d_b686,
47362+ ),
47363+ ];
47364+ for (label, search, want_mode, want_len, want_fnv) in arms {
47365+ let search_flag = format!("--enable-tx-size-search={search}");
47366+ let stream = chroma_format_stream(
47367+ 128,
47368+ 96,
47369+ "yuv444p",
47370+ 8,
47371+ 4,
47372+ &[
47373+ "--profile=1",
47374+ "--cq-level=20",
47375+ "--cpu-used=2",
47376+ "--sb-size=64",
47377+ "--min-partition-size=64",
47378+ "--max-partition-size=64",
47379+ &search_flag,
47380+ ],
47381+ 0,
47382+ );
47383+ assert_444_header(&stream, NAME, 8);
47384+ assert_eq!(
47385+ stream.len(),
47386+ want_len,
47387+ "{NAME} ({label}): aomenc produced {} bytes, not the recorded {want_len} -- the \
47388+ recipe no longer makes this cell",
47389+ stream.len()
47390+ );
47391+ assert_eq!(
47392+ fnv1a64(&stream),
47393+ want_fnv,
47394+ "{NAME} ({label}): the encoded bytes moved"
47395+ );
47396+ // PARSED, not requested: the transform mode the bitstream carries.
47397+ let mut parser = Av1Parser::new();
47398+ let mut pos = 0usize;
47399+ let mut modes: Vec<TxMode> = Vec::new();
47400+ while pos < stream.len() {
47401+ let obu = parser
47402+ .parse_obu(&stream[pos..])
47403+ .unwrap_or_else(|e| panic!("{NAME}: aomenc OBU does not parse: {e:?}"));
47404+ if obu.total_size == 0 {
47405+ break;
47406+ }
47407+ pos += obu.total_size;
47408+ if let ObuKind::FrameHeader(h) | ObuKind::Frame(h, _) = obu.kind {
47409+ modes.push(h.tx_mode);
47410+ }
47411+ }
47412+ assert_eq!(
47413+ modes.len(),
47414+ 4,
47415+ "{NAME} ({label}): four frame headers expected"
47416+ );
47417+ for (i, mode) in modes.iter().enumerate() {
47418+ assert_eq!(
47419+ *mode, want_mode,
47420+ "{NAME} ({label}): decode-order frame {i} carries tx_mode {mode:?}, not \
47421+ {want_mode:?} -- the searched-transform claim is about the bitstream"
47422+ );
47423+ }
47424+ let diff0 = crate::decode::chroma_quad_leaf_tx_diff_hits();
47425+ let frames = decode_stream(&stream)
47426+ .unwrap_or_else(|e| panic!("{NAME} ({label}): refused the stream: {e}"));
47427+ let diff = crate::decode::chroma_quad_leaf_tx_diff_hits() - diff0;
47428+ for (i, f) in frames.iter().enumerate() {
47429+ assert_eq!(
47430+ f.y.len(),
47431+ 128 * 96,
47432+ "{NAME} ({label}): frame {i} luma is {} samples, not 128x96",
47433+ f.y.len()
47434+ );
47435+ assert_eq!(
47436+ f.u.len(),
47437+ 128 * 96,
47438+ "{NAME} ({label}): frame {i} U is {} samples -- at 4:4:4 the chroma plane is \
47439+ full resolution",
47440+ f.u.len()
47441+ );
47442+ }
47443+ // Pixel compare FIRST: it is the informative failure (it names the
47444+ // decode-order frame and the sample), and the counter assert below
47445+ // is the guard that says WHY the cell is not vacuous.
47446+ let (frames_decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME);
47447+ assert!(
47448+ frames_decoded >= 4,
47449+ "{NAME} ({label}): {frames_decoded} decode-order frames"
47450+ );
47451+ if label.starts_with("tx size search on") {
47452+ assert!(
47453+ diff >= 2,
47454+ "{NAME}: the per-quadrant tx_type resolve never CHANGED an answer (diff \
47455+ {diff}) -- on this stream the four-leaf luma tree under a searched transform \
47456+ is exactly what makes the block-level value wrong"
47457+ );
47458+ } else {
47459+ assert_eq!(
47460+ diff, 0,
47461+ "{NAME}: the four-unit 4:4:4 chroma arm fired with tx size search OFF \
47462+ ({diff} resolves) -- the counter is not measuring the searched path"
47463+ );
47464+ }
47465+ eprintln!(
47466+ "{NAME} ({label}): {frames_decoded} frames byte-exact vs aomdec, tx_mode \
47467+ {want_mode:?} on every frame, quad-tx resolves that differed {diff}"
47468+ );
47469+ }
47470+ }
4709847471 }
lanes/av1leftwit.report.mdadded+277 -0
@@ -0,0 +1,277 @@
1+# lane-av1leftwit — is the left chroma reference's `+ss_y` term witnessed?
2+
3+Base `a21f3680`, worktree `~/.cache/wt/av1leftwit`, branch `lane-av1leftwit`.
4+One commit, nothing pushed. Assignment: the shipped `+ss_y` left-reference
5+change has no witness, which is a correctness hole, not a coverage gap.
6+
7+## 0. Verdict
8+
9+**The premise behind the shipped comments is false, and the term itself is
10+correct.** Two separate claims were standing in for evidence; both were
11+checked here and neither survives:
12+
13+1. "The shape the term needs is structurally absent, because aomenc never
14+ starts a block on an odd mi row" — **false, twice over.** 1 mi is 4 luma
15+ pixels, not 8; libaom's `PARTITION_HORZ_4` places its `i == 0` child on the
16+ PARENT's own mi row, which for a 16x16 is a multiple of 4 and therefore
17+ even; and the shape is not hypothetical — it reaches a real decode-path
18+ read in **5 of the 48 committed fixtures** (15 reads in total), which is
19+ what the new `uv_left_1mi_split_hits()` counter measures.
20+2. "Six committed 4:2:0 fixtures reach it, and on `reelb_ss600_key_frame.obu` the
21+ boolean flips" (a claim in `decode.rs`) — **never measured, and false.**
22+ `reelb_ss600_key_frame.obu` reads `mode_diff=0 smooth_diff=0 split1mi=0`.
23+
24+What is still unwitnessed is narrower and is now stated correctly: in every
25+one of the 15 decode-path reads that see the shape, the two blocks **agree on
26+`uv_mode`**, so the term still changes no pixel. A 115-encode targeted hunt
27+(§3) plus the whole committed corpus did not move that. The `+ss_y` term is
28+kept — it is verified against the oracle source, not against a corpus
29+(§1) — and this lane's job is to make the hole smaller, named and gated
30+rather than propped up by a counter whose call site no decode path uses (§7).
31+
32+## 1. The term, against the oracle source (not a corpus)
33+
34+`~/.cache/aom-oracle/src` @ `v3.13.3-7-g9bb526a`,
35+`av1/common/av1_common_int.h:1393-1412` (`set_mi_row_col`):
36+
37+```c
38+ const int chroma_ref = ((mi_row & 0x01) || !(bh & 0x01) || !ss_y) &&
39+ ((mi_col & 0x01) || !(bw & 0x01) || !ss_x);
40+ xd->is_chroma_ref = chroma_ref;
41+ if (chroma_ref) {
42+ MB_MODE_INFO **base_mi =
43+ &xd->mi[-(mi_row & ss_y) * xd->mi_stride - (mi_col & ss_x)];
44+ MB_MODE_INFO *chroma_above_mi =
45+ xd->chroma_up_available ? base_mi[-xd->mi_stride + ss_x] : NULL;
46+ MB_MODE_INFO *chroma_left_mi =
47+ xd->chroma_left_available ? base_mi[ss_y * xd->mi_stride - 1] : NULL;
48+```
49+
50+`chroma_left_mi = base_mi[ss_y * stride - 1]` — the shipped read
51+`left_mi = (mi_r + ss_y, mi_c - 1)` is this line, with the caller's
52+`(mi_row & ss_y)` snap already folded into `mi_r`. **The term is right**, and
53+so is the shape claim about the syntax:
54+
55+* `av1/decoder/decodeframe.c:1334` — `partition = (bsize < BLOCK_8X8) ?
56+ PARTITION_NONE : read_partition(...)`: a sub-8x8 bsize is a leaf or nothing.
57+* same file, `PARTITION_HORZ_4` — `this_mi_row = mi_row + i * (bw / 4)`. A
58+ 16x16 (4x4 mi) sits on a 4-mi grid, so its `i == 0` child is **1 mi tall at
59+ an even mi row**. The geometry the hunt needed is what the syntax produces
60+ first, not something it forbids.
61+* `av1/common/common_data.c:17` — `av1_ss_size_lookup[.][1][1]` is non-INVALID
62+ for `BLOCK_4X4/4X8/8X4/8X8/16X4/32X4/64X4`, so 4-px-tall leaves are legal
63+ at 4:2:0 (and 4:4:0, `ss_y == 1`).
64+
65+One nuance worth keeping: `chroma_ref` is **false** for a block that is itself
66+1 mi tall (`bh` odd) on an even row at `ss_y == 1`, i.e. libaom does not
67+*publish* such a block as a chroma reference. It does not block the shape
68+this lane is about: the block that READS the left neighbour is >= 2 mi tall
69+(`bh` even) whenever it spans both cells, so its own `chroma_ref` is true and
70+it does apply the offset.
71+
72+## 2. The instrument (what makes the shape measurable at all)
73+
74+`uv_left_ss_y_reads` counts reads with a left neighbour — it cannot tell
75+"reached the shape" from "read two cells of the same block". Three additions,
76+all in `decode.rs`, none of them on a decision path:
77+
78+* `Neighbours::uv_owner: Vec<u32>` — per mi cell, `(epoch << 24) | (owner
79+ mi_r << 12) | owner mi_c` of the block that wrote it, stamped in
80+ `record_uv_mode_mi` over the same span and with the same clipping as
81+ `uv_mode_grid`. The epoch (`UV_OWNER_EPOCH`) is bumped in `start_tile`, so
82+ a cell no block wrote in this tile reads 0 and can never be compared.
83+* `UV_LEFT_1MI_SPLIT_HITS` / `uv_left_1mi_split_hits()` — incremented only
84+ under the existing `decode_path` guard, when both cells were written in this
85+ tile **and by different blocks**. That is the run-of-length-1 geometry, and
86+ it is the precondition for the term being observable at all.
87+* `EC_LEFTSSY=1` traces: `EC_LEAF mi=(r,c) wh=(w,h) uv_mode=N` per recorded
88+ block (the parse-side leaf list) and `EC_LEFTSSY ... owners=(..)->(..)` per
89+ split read. These are what the hunt below was steered by — the leaf list
90+ says what the partition tree actually contains, before any pixel argument.
91+
92+Cost: one extra `u32` per mi cell and one `fill_span` per recorded block
93+(~0.5 MB for 4K). A `u8` extent grid was tried as well and **removed** — it
94+existed only for the trace and was avoidable work in the hot path.
95+
96+## 3. Hunt
97+
98+115 encodes on the durable oracle, 4:2:0 8-bit, all with
99+`--enable-1to4-partitions=1`, `--cpu-used=0`, `--limit=1`, `--threads=1
100+--row-mt=0 --lag-in-frames=0` unless the row says otherwise. "parsed tree" is
101+the `EC_LEAF` census of that stream (leaf extents in mi); `h=1` counts
102+1-mi-tall leaves, the only shape that can make the two cells differ.
103+
104+| recipe | parsed tree | decode-path counter | pixel verdict |
105+|---|---|---|---|
106+| synthetic 8-px chroma bands (`mix4/flat/vgrad/hgrad`), 64x64..256x128, cq 0(lossless)/8/12/20/24/32/36/45, max-part 32 | 2/4/8 mi tall, `h=1` = 0 | reads 4..372, `split1mi=0` | n/a — shape never reached |
107+| `brick`: 4-px (1 mi) bands, vertical 8-px stripe pattern with the phase shifted per band, chroma flat/diagonal alternating per 2x2 chroma cell; 5 geometries x cq 0/20/32, max-part 32 | 2x2/4x2/2x4/8x4 leaves, `h=1` = 0 | `split1mi=0` | n/a |
108+| `noise2` (2-px cells — sub-transform, so no block size codes it cheaply) and `noise1` (4-px cells), min-part 4, max-part 8/16/32/128, lossless + cq 30/45 | 2x2/4x2/2x4/4x4, `h=1` = 0 | `split1mi=0` | n/a |
109+| `mosaic` (pseudo-random 8x8 cells, chroma flat vs ramp alternating per 4x4 cell), cq 20/32 | 2x2/4x2/2x4, `h=1` = 0 | `split1mi=0` | n/a |
110+| real lavfi: testsrc2 / mandelbrot / cellauto / life / rgbtestsrc / smptebars, 320x240 + 640x480, cpu-used 0 and 4, max-part 32 and 64, cq 24, 3 frames (36 arms) | 2x2 upward, `h=1` = 0 | `split1mi=0` in all 36 | n/a |
111+| **committed corpus, 48 fixtures that decode** | see §4 | **`split1mi > 0` in 5** | both pinned arms exact (kf900: 22292 reads, all three planes) |
112+
113+The lesson the leaf census teaches, and the reason the sweep stops where it
114+does: a wide block codes 1-D structure almost for free. A 32x16 leaf spans
115+four 1-mi bands and still wins, because a vertical step is one coefficient per
116+4x4 transform block however tall the block is (`brick`, `mix4`); and content
117+fine enough to force small blocks stops at 8x8 (2x2 mi), which is 2 mi tall
118+and therefore cannot split a cell pair either (`noise2`, `mosaic`). The
119+encoder reaches 1-mi-tall leaves only on real material — which is exactly what
120+the committed film cut shows and what no lavfi source reproduced.
121+
122+## 4. Corpus census — the shape is on the decode path
123+
124+Every `.obu` in `crates/ec-av1/fixtures/`, measured with the pinned probe
125+(`decode_probe` prints `uv_left_ss_y: reads=.. mode_diff=.. smooth_diff=..
126+split1mi=..`). 48 produced numbers: **30 read the term** (4:2:0, `ss_y == 1`),
127+6 refused (4:2:2, the unconditional refusal — the term is a no-op there by
128+construction), and 12 decoded with **0 reads** because they are 4:4:4
129+(`ss_y == 0`, so the term is literally the same cell as before). Every fixture
130+that can reach the shape is in the 30.
131+
132+| fixture | format | reads | mode_diff | smooth_diff | **split1mi** |
133+|---|---|---|---|---|---|
134+| `gm_small_side_witness.obu` | yuv420p10le | 13311 | 0 | 0 | **5** |
135+| `reelc_sb128_inter_witness.obu` | yuv420p10le | 5472 | 0 | 0 | **7** |
136+| `av112bit-inter.obu` | yuv420p12le | 40 | 0 | 0 | **1** |
137+| `av112bit-compound.obu` | yuv420p12le | 62 | 0 | 0 | **1** |
138+| `av112bit-compound-masked.obu` | yuv420p12le | 65 | 0 | 0 | **1** |
139+| `reelb_kf900.obu` | yuv420p10le | 22292 | 0 | 0 | 0 |
140+| `reelb_ss600_key_frame.obu` | yuv420p10le | 6297 | 0 | 0 | 0 |
141+| (25 other `ss_y == 1` fixtures) | 4:2:0 | 4..14537 | 0 | 0 | 0 |
142+
143+The 15 split reads, verbatim from the trace (`gm_small_side_witness`):
144+
145+```
146+EC_LEFTSSY epoch=1 mi=(84,356) left_col=355 owners=(84,354)->(85,354) modes=0/0
147+EC_LEFTSSY epoch=1 mi=(96,216) left_col=215 owners=(96,215)->(97,215) modes=0/0
148+EC_LEFTSSY epoch=1 mi=(18,176) left_col=175 owners=(18,189)->(19,189) modes=0/0
149+EC_LEFTSSY epoch=1 mi=(74,296) left_col=295 owners=(74,294)->(75,294) modes=0/0
150+EC_LEFTSSY epoch=1 mi=(184,376) left_col=375 owners=(184,374)->(185,374) modes=0/0
151+```
152+
153+Every one of them: the upper cell's block ends at that row, a second block
154+starts immediately below it in the same column, and the reading block's
155+`(row, col-1)` / `(row+1, col-1)` cells are those two blocks. Measured extents
156+at those sites were `(4x2)` over `(4x1)` mi — a 32x16 block with a 16x4 block
157+underneath it, which is the `PARTITION_HORZ_4` shape of §1, at even mi rows.
158+`epoch=1` for all five: first tile, first frame.
159+
160+So: **the geometry is real, common enough to pin, and libaom-correct.** What
161+is missing is a case where the two blocks disagree on `uv_mode`; in these
162+streams 97.6% of recorded blocks carry `DC_PRED`, and 1-mi-tall leaves sit on
163+high-detail edges where chroma is flat, so the two conditions are close to
164+anti-correlated in practice. That is the honest residual, and it is a
165+statement about the corpus, not about the syntax.
166+
167+## 5. Red / green
168+
169+* **Gate non-vacuity (the new gate).** `stream.rs::
170+ a_committed_4to20_stream_presents_a_one_mi_left_neighbour_to_a_decode_path_read`
171+ asserts `uv_left_1mi_split_hits() == 5` on `gm_small_side_witness` and
172+ `== 7` on `reelc_sb128_inter_witness` (deltas around the decode), plus frame
173+ count and dimensions. **Green:**
174+ `5 1-mi-tall left neighbours in 13311 decode-path reads, +ss_y changed the
175+ mode 0 and the smooth boolean 0 times` / `7 ... in 5472 ...`.
176+ **Red:** the `uv_owner` stamp was removed for one build (`if false {
177+ fill_span(...) }`), both arms fell to 0 and the gate FAILED on the census.
178+ Reverted, green again. The mutation is deliberately *not* the `+ss_y` term:
179+ the term's own mutation leaves these reads untouched, which is the limit of
180+ what this fixture set can decide.
181+* **The term's mutation (pixels).** §6.
182+* **The existing kf900 gate still passes** with the new counters in the tree:
183+ `22292 left-reference reads, +ss_y changed the mode 0 and the smooth boolean
184+ 0 times, all three planes pixel-exact`.
185+
186+## 6. The term's own mutation, on the five streams that carry the shape
187+
188+`left_mi = (mi_r + ss_y, ..)` -> `(mi_r + 0 * ss_y, ..)` (the pre-lane
189+own-row read), `EC_PROBE_OUT16` dumps (yuv420p10le) from both builds, byte
190+compare:
191+
192+| fixture | shipped vs mutated |
193+|---|---|
194+| `gm_small_side_witness.obu` | IDENTICAL (150543360 B) |
195+| `reelc_sb128_inter_witness.obu` | IDENTICAL (68428800 B) |
196+| `av112bit-inter.obu` | IDENTICAL (122880 B) |
197+| `av112bit-compound.obu` | IDENTICAL (368640 B) |
198+| `av112bit-compound-masked.obu` | IDENTICAL (368640 B) |
199+
200+All five are byte-identical with the term removed. That is expected, and it
201+is the point: the shape is reached 15 times and the term still moves nothing,
202+because the two blocks agree on `uv_mode` in every one of those reads.
203+Reproduce with:
204+
205+```sh
206+cargo build -p ec-av1 --example decode_probe
207+EC_PROBE_OUT16=/tmp/s.yuv target/debug/examples/decode_probe crates/ec-av1/fixtures/gm_small_side_witness.obu
208+# then edit decode.rs:9806 to `mi_r + 0 * ss_y`, rebuild, dump /tmp/m.yuv, cmp
209+```
210+
211+## 7. Disposition of the phantom mirror
212+
213+`decode.rs:17642` (the 16x4/4x16 pair witness) calls the unsnapped form with
214+the leaf's own — **odd** — mi row and feeds `RECT4_16_UV_PAIR_FILT_HITS`. It
215+was cited as the `+ss_y` term's reachability evidence, and the `decode_path`
216+flag exists to keep it out of the term's counters. Measured, that flag's
217+stated reason ("no committed fixture reaches it on the decode path") is
218+false, and the mirror is **not** a phantom path either: it measures a real
219+comparison the decode makes (the pair's chroma-reference read against the
220+leaf's own row) and it fires — 51 / 24 / 121 / 0 / 1 hits on
221+`gm_small_side` / `reelc_sb128_inter` / `reelb_kf900` /
222+`reelb_rect64_intra16x4_witness` / `av112bit-inter`.
223+
224+**Disposition: kept, re-labelled.** Deleting a counter that measures a live
225+comparison would lose coverage; what was wrong was the citation. The mirror
226+call site and the `decode_path` doc now say in terms that the mirror is not
227+evidence about `+ss_y` and that the decode path's own reach is
228+`uv_left_1mi_split_hits()`.
229+
230+## 8. Comments corrected (all three were unmeasured claims in the source)
231+
232+* `decode.rs:9780` — "Six committed 4:2:0 fixtures reach it ... and on
233+ `reelb_ss600_key_frame.obu` the boolean flips" -> the measured census of §4.
234+* `decode.rs:9717` — the `decode_path` justification -> §7.
235+* `stream.rs:43059` (kf900 gate doc) — "that never happens on a decode-path
236+ read: `uv_mode_grid` runs down a left mi column always have EVEN length"
237+ -> the shape is reached; what has never been seen is the two cells
238+ *disagreeing*.
239+* `decode.rs:9800` — the DIFF-bucket comment now says which counter is the
240+ precondition for the other two, so `mode_diff == 0` is no longer readable as
241+ "unreachable".
242+
243+## 9. What is still open
244+
245+A witness needs P(shape) x P(the two blocks disagree on `uv_mode`), and on
246+today's material the second factor is ~0 where the first is 1-in-2600 reads.
247+The next lever is not another partition-flag sweep (115 encodes say so) and
248+not a synthetic source: it is real 4:2:0 material whose 1-mi-tall leaves land
249+on **chroma** edges — foliage, signage, screen content with saturated chroma —
250+encoded at a bit depth and cq where the encoder keeps directional chroma
251+modes. `reelc_sb128_inter_witness` (7 reads in 15 frames) is the closest
252+committed material; the same cut re-encoded at cq 20-32 in 8-bit with
253+`--enable-1to4-partitions=1` is where to look next. Until one of those
254+streams lands, the correct statement about this change is the one in §0: the
255+term matches libaom's source, the geometry it needs is reachable and gated,
256+and no committed stream yet lets it change a pixel.
257+
258+### Gaps in this lane's own coverage, stated
259+
260+* **No 4:4:0 encode.** The term is also live at `ss_x == 0, ss_y == 1`, and
261+ nothing here produced one: ffmpeg has no `yuv440` pix_fmt and the y4m
262+ chroma-siting tags do not express it, so the sweep is 4:2:0 only. The
263+ census in §4 is 4:2:0-only for the same reason (the committed 4:4:4 set
264+ cannot reach the term by construction). A 4:4:0 hunt needs a raw plane
265+ writer plus an aomenc input path that accepts it.
266+* **Three of the five shape-carrying fixtures are not gated** —
267+ `av112bit-{inter,compound,compound-masked}` carry 1 read each and are
268+ left out to keep the gate's runtime down; the census in §4 pins them and
269+ the counter is public, so a future gate can add them for free.
270+* **No 12-bit-mode sweep of real material.** The three `av112bit` hits are the
271+ only 12-bit evidence and they are 1 read each.
272+
273+## State
274+
275+One commit on `lane-av1leftwit`, nothing pushed. Hunt scratch (115 encodes,
276+generator, sweep drivers) lives outside the repo in
277+`~/.cache/hunt-av1leftwit/` and is not part of the commit.
lanes/av1lossy128x96.report.mdadded+141 -0
@@ -0,0 +1,141 @@
1+# lane-av1lossy128x96 — the 128x96 4:4:4 lossy tx-size-search cell
2+
3+**Tree.** `lane-av1lossy128x96` off `a21f3680`, worktree `~/.cache/wt/av1lossy128x96`.
4+Builds in a LANE-PRIVATE `CARGO_TARGET_DIR` (`~/.cache/cargo-target-av1lossy128x96`) —
5+see `skill://counterfactual-ab-target-dir-provenance` variant 5 for why a shared
6+one silently measures a sibling lane's decoder. `decode.rs` is untouched in the
7+final commit; the only change is a new gate in `crates/ec-av1/src/stream.rs`.
8+
9+**Headline: the cell is already FIXED, and the measurement that says so is the
10+gate this lane adds.** The charter assumed the 128x96 U+V variant was unowned
11+and open. It is neither: commit `6c33f204` ("4:4:4 inter chroma units inherit
12+their own quadrant's luma tx_type") closes it, exactly as it closed the 128x128
13+twin. What was missing is the GATE — the fix's own witness is pinned at
14+128x128, so nothing was watching the 128x96 geometry.
15+
16+---
17+
18+## 1. Measurement: the cell, before and after the fix
19+
20+Stream (encoded live, identical bytes on both trees):
21+
22+```
23+ffmpeg -f lavfi -i "testsrc2=size=128x96:rate=25" -frames:v 4 -pix_fmt yuv444p -f yuv4mpegpipe -
24+aomenc --profile=1 --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2
25+ --sb-size=64 --min-partition-size=64 --max-partition-size=64
26+ --enable-tx-size-search=1 --threads=1 --row-mt=0 --lag-in-frames=0
27+ --kf-max-dist=100 --limit=4 --obu -o out.obu -
28+```
29+
30+21830 bytes, sha256 `7380bcbbfb791c6a369850357211223e20fab959423135951f6eb43ffbfcbebd`
31+-> fnv1a64 `0x1ba3fe9a4335bdbb`. Reference: the instrumented `aomdec`
32+(`EC_AV1_FINAL_DUMP`, decode order).
33+
34+| tree | decode-order frame 0 / 1 / 2 / 3, bytes differing from aomdec |
35+|---|---|
36+| `4155c7c7` (the report's base, the fix's parent) | 0 / 0 / **608** / **692** |
37+| `6c33f204` (the fix) | 0 / 0 / 0 / 0 |
38+| `a21f3680` (HEAD) | 0 / 0 / 0 / 0 |
39+
40+The 608 is the sweep's number, reproduced exactly. First wrong sample in
41+decode-order frame 2: byte 16258 of the dump, i.e. `U(2,31)`, ours 111 vs the
42+oracle's 112 — U and V only, +-1, luma exact, as the sweep recorded.
43+
44+`--enable-tx-size-search=0` on the same recipe: 21296 bytes, sha256
45+`347edcc9f4899fb05b15174b82d37f6562dcc6fe7691af0ed9ba4efd6cc878c6`, byte-exact
46+4/4 at every tree. So the cell is gated on the SEARCH, not on the geometry.
47+
48+## 2. Discriminator: dequant or inverse transform?
49+
50+The charter's method, run before reading any code. `EC_DQCOEFF` on the oracle
51+(`plane= txsize= txtype= eob= nz=`) against ours (`OUR_DQ w= h= q= dcd= acd= tx=
52+nz=`), both narrowed to decode-order frame 2 with `EC_TRACE_COEFF_FRAME=2`: 134
53+units on each side.
54+
55+**Oracle-vs-ours by INDEX is not a valid pairing** (80 of 134 "type
56+disagreements" on a byte-exact decode) — the two decoders walk units in
57+different orders, exactly the trap `skill://av1-bitexact-debugging` names. The
58+valid comparison is our own decode before and after the fix, which has a fixed
59+unit order:
60+
61+| comparison | units whose `tx_type` changed | units whose dequantized coefficient map changed |
62+|---|---|---|
63+| ours pre-fix vs ours post-fix (frame 2, 134 units) | **4** (units 72, 76, 107, 111) | **0** |
64+
65+**Verdict: dequant is exonerated, the transform-TYPE selection was the defect.**
66+The same coefficients were read and dequantized identically before and after;
67+four chroma units were handed the block-level luma `tx_type` instead of the
68+covering leaf's, and 6c33f204 changed exactly those four answers. Post-fix the
69+frame is byte-exact against the oracle, so the oracle's types are the post-fix
70+ones.
71+
72+Elimination list, each row a measurement rather than an argument:
73+
74+1. **Entropy** — bit-identical (sweep: 140820 `EC_SYMR` reads, zero divergence).
75+2. **Coefficients / dequant** — 0 of 134 units differ pre→post (this lane).
76+3. **Inverse-transform type selection** — 4 of 134 units differ pre→post (this
77+ lane); that is the whole difference.
78+4. **Filters (deblock / CDEF / LR) and prediction input** — exonerated upstream
79+ by the sweep's pre-filter dumps (chroma already wrong before deblock, luma
80+ exact), and by the fact that a type change alone reproduces the diff with
81+ search OFF making it disappear.
82+
83+Nothing here needed a new fix, so this lane ships no decoder change.
84+
85+## 3. Gate added
86+
87+`a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96`
88+in `crates/ec-av1/src/stream.rs`. Live aomenc (no fixture pin: the recipe is
89+deterministic), two arms:
90+
91+| arm | flags | parsed `tx_mode` | bytes | verdict |
92+|---|---|---|---|---|
93+| tx size search on | `--enable-tx-size-search=1` | `TxMode::Select` on all 4 frames | 21830 | EXACT 4/4, `chroma_quad_leaf_tx_diff_hits() == 6` |
94+| control | `--enable-tx-size-search=0` | `TxMode::Largest` on all 4 frames | 21296 | EXACT 4/4, `chroma_quad_leaf_tx_diff_hits() == 0` |
95+
96+**The search flag is spelled AND the parsed bitstream is asserted** — the
97+charter's requirement, and the same rule the tilemeasure lane applied to tiles:
98+aomenc keeps the first occurrence of a flag and an unspecified flag is
99+"unknown", not "on", so the gate asserts `tx_mode == TxMode::Select` per frame
100+on the search arm and `TxMode::Largest` on the control, which also stops either
101+arm from silently measuring the other's stream. Recipe identity is pinned by
102+length + fnv1a64 (sha256 in the doc comment), so an aomenc that stops producing
103+this cell fails before the pixel compare.
104+
105+Non-vacuity chain, in order: `ss (0,0)` at 8 bits; bytes + fnv match; parsed
106+`tx_mode` per frame; every decoded plane 128*96 (full-resolution chroma at
107+`ss (0,0)`); `decode_all_frames_vs_oracle` (frame count and per-frame byte
108+length asserted before any sample); then the load-bearing counter
109+`chroma_quad_leaf_tx_diff_hits() >= 2` on the search arm and exactly 0 on the
110+control — the route counter alone is not a witness, it fires on blocks whose
111+four leaves agree, which is the shape the original no-op port looked green on.
112+
113+**Red-before (reverted, reproduced).** Reverting ONLY the per-quadrant resolve
114+in the two copies of `decode_inter_block`'s 64x64 four-unit chroma arm — the
115+`covering_leaf_tx_type(...)` call back to the block-level `luma_tx_type`,
116+counters and this gate untouched — turns the gate red exactly as the sweep
117+described it:
118+
119+```
120+decode-order frame 2 of 4 (4 shown, 0 hidden) differs from the oracle at byte
121+16258 (ours 111 vs 112), 608 bytes differ
122+```
123+
124+Green again on restore (`git diff crates/ec-av1/src/decode.rs` empty).
125+
126+**Regressions checked on this tree.** The 128x128 twin's own gate
127+`a_pinned_444_inter_stream_chroma_units_inherit_their_own_quadrants_tx_type`
128+(96 quad-resolved units, 8 of them differing, plus its 4:2:0 control) is green.
129+A 4:2:0 identity run of this lane's own recipe (same flags, `yuv420p` input)
130+decodes byte-exact 4/4 with the 4:4:4-only counters at 0.
131+
132+## 4. What this lane does NOT claim
133+
134+- It does not claim a new fix. The fix is `6c33f204`, already on main.
135+- It does not claim the 128x96 cell was ever distinct from the 128x128 twin:
136+ the two are the same defect (per-quadrant `tx_type` inheritance), and the
137+ 128x96 form is the U+V variant of it on a frame whose second block row is
138+ half-height.
139+- It does not touch the 4:4:4 LOSSLESS chroma class (256x256 / 512x128), which
140+ is owned elsewhere and which the tilemeasure lane bounded with untiled
141+ controls.
lanes/av1pins.report.mdmodified+357 -0
@@ -202,3 +202,360 @@ probes/benchmarks excluded from the earlier release triage.
202202
203203 Procedure saved as managed skills `stale-ignore-reason-vs-stale-comment` and
204204 `fixture-absent-silent-skip-class`.
205+
206+---
207+
208+# r2 — the two pins were still `#[ignore]`d, so a plain run executed nothing
209+
210+Branch `lane-av1pinslive` off current main `a5867794`. Commit `2e9086c0`. Tests
211+only, no decoder change, no push.
212+
213+A clean-checkout verification (13 branches, 39 gates) reported that the two gates
214+lane-av1pins recovered are `#[ignore]`d: they pass under `--ignored` and their pins
215+are committed, but **in a plain suite run they do not execute**. That is correct
216+and it is the same hole in a different costume. r1's before/after table was
217+measured with `--ignored` and did not say so, which made it read as a fix when it
218+was only a fix *under a flag*.
219+
220+## 1. The facts
221+
222+| gate | `#[ignore]` on main `a5867794`? | reason string |
223+|---|---|---|
224+| `pinned_golden3_stream_decodes_pixel_exact` | **yes** | `bisect aid, not a suite gate; run it with --ignored` |
225+| `pinned_sbpart_stream_decodes_pixel_exact` | **yes** | `bisect aid, not a suite gate; run it with --ignored` |
226+| `a_real_aomenc_lossless_444_key_frame_decodes_sample_exact` | **no — already live** | — |
227+
228+**The reason string is stale, and it went stale twice.** It was introduced at
229+`c9fede5d` (2026-08-28, lane-av1golden3) as
230+`reads a pinned fixture path outside the repo; run manually`, with the doc comment
231+giving the real cause: *"the file only exists on this machine's scratchpad"*. True
232+then. It stopped being true at `78c805bd` (lane-av1pins), which committed both pins
233+under `crates/ec-av1/fixtures/` — a path that travels in the runner tarball, so the
234+bytes are on every runner.
235+
236+**The second staleness is mine.** lane-av1pins replaced the reason with *"bisect aid,
237+not a suite gate"* — a judgement, not a fact, and wrong on this tree: with the bytes
238+committed these are ordinary decode-exactness gates that cost 0.10–0.15 s, not
239+bisect aids. A clean-checkout run cannot see a committed pin, so the lane that
240+*fixed* the pin hole left the ignore hole standing in the same commit.
241+
242+## 2. No condition that makes this crate ignore a gate applies
243+
244+Measured on `a5867794`, both gate bodies:
245+
246+* **no process-global** — neither calls `force_sb128` nor `knob_write`. This is the
247+ condition that legitimately earns 11 other ignores in this crate.
248+* **no counter, no `lock_gate_counters()`** — so `--test-threads=1` is not required
249+ of them either.
250+* **no aomenc** — they decode committed bytes and compare to ffmpeg, so they are not
251+ real-aomenc gates and stay out of the `gate_coverage` census either way.
252+* **not slow** — 0.10–0.15 s each, against 9 ignored siblings that declare
253+ minutes-per-item.
254+* **ffmpeg guarded** — `have_ffmpeg()` already honours `EC_AV1_REQUIRE_FFMPEG`, so a
255+ missing ffmpeg is a hard failure, not a silent skip.
256+
257+Precedent in-tree: `gate_coverage.rs` records the 10-bit LR gate *"was `#[ignore]`d on
258+that branch and passes un-ignored on main, which carries the fix"* — the same
259+un-ignore-once-the-blocker-clears move.
260+
261+## 3. Before / after, plain run
262+
263+Both commands are **plain** — no `--ignored`, no `--exact` needed to select them:
264+
265+```
266+cargo test -p ec-av1 --lib --release -- --exact stream::tests::pinned_golden3_stream_decodes_pixel_exact --test-threads=1 --nocapture
267+ test ...pinned_golden3_stream_decodes_pixel_exact ... pinned_golden3_stream_decodes_pixel_exact:
268+ 4 frame(s) byte-exact vs ffmpeg from .../crates/ec-av1/fixtures/golden3-pin.obu
269+ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 730 filtered out; finished in 0.15s
270+
271+cargo test -p ec-av1 --lib --release -- --exact stream::tests::pinned_sbpart_stream_decodes_pixel_exact --test-threads=1 --nocapture
272+ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 730 filtered out; finished in 0.10s
273+ (EC_SBPART_DIAG=1 additionally prints "DIAG frame 0: 0 luma mismatches ... of 192x128"
274+ plus per-SB-column counts — all 24576 luma samples walked)
275+```
276+
277+| | main `a5867794` plain run | branch `2e9086c0` plain run |
278+|---|---|---|
279+| `pinned_golden3` | *not executed* (ignored) | 1 passed, 0.15s, prints 4 frames byte-exact |
280+| `pinned_sbpart` | *not executed* (ignored) | 1 passed, 0.10s |
281+| `a_real_aomenc_lossless_444_key_frame...` | 1 passed, 0.21s | 1 passed, 0.21s (unchanged) |
282+
283+Three further confirmations that they are genuinely live rather than merely
284+un-flagged: they execute under a plain **substring** filter (`-- pinned_`, no
285+`--exact`, no `--ignored`); neither appears in `-- --ignored` any more (0 matches);
286+and `#[ignore]` in `stream.rs` drops **41 → 39**.
287+
288+## 4. A regression I caused and then disproved — recorded because it nearly shipped
289+
290+The first `gate_coverage` run **on this branch** showed
291+`FAILED. 8 passed; 2 failed` (`never_exercised_8bit_matches_the_gate_recipes`,
292+`never_exercised_10bit_matches_the_gate_recipes`), while the same filter on main
293+passed 10/10. Un-ignoring changes the census input, so I took that as a regression
294+I had introduced.
295+
296+It was not. A 554-second `--ignored` full-suite run was executing **against the same
297+worktree and the same `CARGO_TARGET_DIR` at that moment**. Re-run after it finished:
298+`gate_coverage` **10 passed / 0 failed on 6 consecutive runs**, and alone with
299+`--exact` it also passes. These are compile-time source scans (`include_str!`),
300+which cannot be perturbed by runtime state — consistent with a build/link race on
301+the shared target dir, not with a logic change. Recorded because "I broke a meta-gate"
302+was the correct reading of the evidence at the time, and the reason it was wrong is
303+worth keeping.
304+
305+Final meta-gate state after the change: `gate_coverage` **10 passed**,
306+`refusal_inventory` **15 passed**, both green.
307+
308+## 5. Follow-on found, NOT done here
309+
310+Three sibling pin gates carry the same stale reason **and** still read pins that are
311+not committed — so in a clean checkout each either skips or panics:
312+
313+| gate | pin | committed? | failure mode if un-ignored as-is |
314+|---|---|---|---|
315+| `pinned_golden4_stream_decodes_pixel_exact` | `golden4-pin.obu` | no | silent skip |
316+| `pinned_golden7_stream_decodes_pixel_exact` | `golden7-forwarding-mismatch.obu` | no | silent skip |
317+| `pinned_lr_sgr_stream_call_unique_dump` | `lr-sgr-r7.obu` | no | **panic** — `std::fs::read(path).expect(...)`, no graceful skip |
318+
319+All three read through `pin_dir()` or a `concat!(env!("CARGO_MANIFEST_DIR"),
320+"/../../fixtures/...")` literal, i.e. the gitignored root. `golden6-mismatch.obu` is
321+a fourth untracked pin. These are the same defect and the same fix; recovering them
322+is mechanical from the r1 recipes (golden4 and golden7 are siblings of golden3 off
323+the cdf-forwarding gate). Left out of this commit to keep it a reason-removal, and
324+handed back rather than folded in silently.
325+
326+---
327+
328+# r3 — the four remaining untracked pins, and the class closed
329+
330+Branch `lane-av1pinslive`, rebased onto current main `eccbd6c6`. Commit `f99a5ff9`.
331+Tests only, no decoder change, no push.
332+
333+r2 fixed two gates and handed back three siblings. All four untracked pins are now
334+committed, three gates are live, and one earns a factual ignore.
335+
336+## 1. The pins — RECOVERED, not re-encoded
337+
338+| path | sha256 | size |
339+|---|---|---|
340+| `crates/ec-av1/fixtures/golden4-pin.obu` | `1754023e44e46edaebc2c05065bf1c65db1a41354577cbf71c0e8ebe737ae14a` | 137 B |
341+| `crates/ec-av1/fixtures/golden6-mismatch.obu` | `c56909b98542192b03f3a945e153475aa57a58a1586bf166513297296cb225b3` | 452 B |
342+| `crates/ec-av1/fixtures/golden7-forwarding-mismatch.obu` | `81b3bf657a85e95085287b30d97dee93ba5aea0ed1db1e1f4fcd19a06afc17be` | 152 B |
343+| `crates/ec-av1/fixtures/lr-sgr-r7.obu` | `6b95b20e3377430ffae0b2ce86fad9502e0dedf13cd6c38ab7f5af4a8b21f33d` | 192 B |
344+
345+**`.gitignore` verified as Main described.** `main:.gitignore:12` is
346+`!crates/*/fixtures/**` — a negation, so `git check-ignore -v` printing that line
347+means NOT ignored. Confirmed by exit code and by the decisive test: a plain
348+`git add crates/ec-av1/fixtures/<pin>` staged all four with no `-f`.
349+
350+**Recovered, not re-encoded — and the order matters for provenance.** I first
351+reproduced golden4 and golden7 from the cdf-forwarding recipe (seeds 43–48, all of
352+which decode exact) and captured golden6 through a throwaway harness built on the
353+crate's own `panned_test_card` (the real recipe needs that Rust helper, not a
354+lavfi source). Then I found the **original bytes still on the runner libraries**
355+and fetched those instead. They are the actual historical mismatch witnesses; a
356+re-encode is a different stream that happens to exercise the same path, and
357+labelling it as the pin would be a false provenance claim.
358+
359+The originals also **self-validate**, which is the check a re-encode cannot pass:
360+`pinned_golden7`'s committed doc records `non_last_ref_hits` delta=2 for this
361+stream, and the recovered pin reproduces exactly `0->2` in a plain run.
362+
363+The throwaway capture harness was deleted before the commit (`grep -c zz_throwaway`
364+= 0).
365+
366+## 2. Three gates go live — same bar as r2
367+
368+| gate | on main `eccbd6c6` | on branch, PLAIN run |
369+|---|---|---|
370+| `pinned_golden4_stream_decodes_pixel_exact` | ignored, not executed | **1 passed, 0 failed, 0 ignored, 0.11s** — prints `non_last_ref_hits before=0 after=1` |
371+| `pinned_golden7_stream_decodes_pixel_exact` | ignored, not executed | **1 passed, 0 failed, 0 ignored, 0.10s** — prints `non_last_ref_hits before=0 after=2` |
372+| `a_real_aomenc_stream_with_film_grain_decodes_pixel_exact` | **live and PANICKING** | **1 passed, 0 failed, 0 ignored, 0.10s** |
373+
374+None touches a process-global, none calls aomenc, and the counter each reads
375+(`non_last_ref_hits`) is **printed, never asserted** — so there is no
376+counter-race exposure to justify an ignore. `#[ignore]` in `stream.rs`: **41 → 37**.
377+
378+**The film-grain gate was the worst shape in the class and was already LIVE.** It
379+read its pin through `concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/...")`
380+and `.unwrap()` — the gitignored root, with no graceful skip. A clean checkout
381+with no runner library **panics**, it does not skip. That shape can never be
382+satisfied by a committed pin at all, which is exactly why it is now `crate_pin`.
383+
384+## 3. `require_pin` — the new shared shape
385+
386+```rust
387+fn require_pin(path: &std::path::Path, name: &str) -> Vec<u8> {
388+ std::fs::read(path).unwrap_or_else(|e| panic!(
389+ "no pinned bytes at {} ({e}) -- set EC_AV1_GATE_DUMP_PIN to a freshly \
390+ captured stream, or restore the committed copy at \
391+ crates/ec-av1/fixtures/{name}",
392+ path.display()
393+ ))
394+}
395+```
396+
397+A missing pin is a **hard failure naming the path and the generator**, never a raw
398+io panic and never a silent skip. Those are the two shapes this class has taken
399+(`golden4` skipped; the film-grain gate panicked), and both are now impossible.
400+
401+## 4. One gate stays ignored, on facts
402+
403+`pinned_lr_sgr_stream_call_unique_dump` — reason replaced with the two reasons that
404+are still true:
405+
406+> `diagnostic only -- asserts nothing, so it cannot fail on a decode regression;
407+> run with --ignored and EC_LR_CALL_DUMP=1 for the Sgrproj window`
408+
409+The fact: the body `eprintln!`s per-frame mismatch counts and **returns**. There is
410+no `assert!` anywhere in it, so it cannot go red on a decode regression;
411+un-ignoring it would add a test that reports pass unconditionally. Its pin is now
412+committed too, so the old reason ("reads a pinned fixture under the gitignored
413+fixtures dir") was false and is gone. Measured plain run under `--ignored` for the
414+record: **1 passed, 0.10s**, `frame 0: y_mismatch=false u_mismatch=false
415+v_mismatch=false`.
416+
417+**What would close it:** give it the pixel asserts its three siblings have (the
418+compare loop is already there, it only prints), then un-ignore. That is a real
419+change with a real verdict, so it is not folded in here.
420+
421+## 5. State
422+
423+`lane-av1pinslive`, three commits on top of `eccbd6c6`: `c7ea69c1` (r2 un-ignore),
424+`f99a5ff9` (r3 siblings), plus report commits. `cargo check -p ec-av1 --all-targets`
425+clean, no warnings. Meta-gates after the change: `gate_coverage` **10 passed**,
426+`refusal_inventory` **15 passed**. r2's two gates re-verified green
427+(1 passed, 0.15s each). Not pushed; main untouched.
428+
429+Not verified: a full `cargo test -p ec-av1` run (project-wide validation is
430+Main's), and the remaining ignored set — now 37 tests, of which these four were
431+the machine-local-pin population.
432+
433+The class rule this lane earns, in the shape Main is adopting as a batch rule: an
434+`#[ignore]` reason must state a **fact** (what the gate needs, what it costs), never
435+a **judgement** ("bisect aid", "not a suite gate"). A judgement cannot be checked
436+against reality, so it cannot go stale loudly — and that is exactly how the r1
437+reason survived into a tree where it was false.
438+
439+---
440+
441+# r4 — the last assert-free gate, and two corrections to my own r3 claims
442+
443+Branch `lane-av1pinslive`, rebased onto main `aa0ac8c2`. Commit `9a29c974`.
444+Tests only, no decoder change.
445+
446+## 1. What changed
447+
448+`pinned_lr_sgr_stream_call_unique_dump` now asserts. r3 left it `#[ignore]`d on the
449+fact that it asserted nothing; that is fixed and the ignore is gone.
450+
451+**The substantive fix is the frame count, not the asserts.** The old body passed
452+*our own decode's length* as ffmpeg's expected count:
453+
454+```rust
455+let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len());
456+```
457+
458+so a decoder emitting **zero** frames asked ffmpeg for zero frames, the zip compared
459+no pairs, and the gate passed having proved nothing — the `cmpaudit` vacuous-pass
460+shape, in the one gate that was already `#[ignore]`d for asserting nothing. The count
461+now comes from the fixture (`FRAMES = 1`, measured), so a lost frame reds on the
462+count.
463+
464+Also added, matching the three sibling pins: a dimensions assert per frame, an
465+explicit `reference.len() == FRAMES` before the zip, and per-plane per-frame pixel
466+asserts. **The diagnostic print is kept** and now runs *before* the asserts, so a
467+failure still names the shape of the divergence.
468+
469+### On "does it compare only frame 0?" — it does not
470+
471+The loop always visited every frame; it is unchanged in that respect. This pin
472+simply holds **one** frame, which is why the pre-r4 run printed `frame 0` and
473+nothing else. So that particular worry is unfounded, and the real gap was the
474+vacuous count above.
475+
476+## 2. Red-before, on a pixel assertion
477+
478+**Method used: mutating the decoder arithmetic the pin exercises**, not a faked
479+expectation — `restoration.rs::apply_sgrproj_stripe`, `+1` on its first output
480+sample. The pin is a loop-restoration stream, so Sgrproj is on its path.
481+
482+```
483+frame 0: y_mismatch=false u_mismatch=true v_mismatch=true
484+panicked at crates/ec-av1/src/stream.rs:30374:13:
485+ assertion `left == right` failed:
486+ pinned_lr_sgr_stream_call_unique_dump frame 0 U vs ffmpeg (pinned lr-sgr)
487+test result: FAILED. 0 passed; 1 failed; 0 ignored
488+```
489+
490+It reds on a **pixel** assert, not on a shape or counter assert. Worth recording:
491+the mutation landed in a **chroma** plane, so the gate caught it on the U assert
492+while luma stayed clean — a luma-only compare would have missed it entirely. That is
493+the capability the three per-plane asserts buy.
494+
495+Reverted (`git status` on `restoration.rs` empty) and the gate returns green.
496+
497+The **count** assert is proven separately: setting `FRAMES = 2` reds at
498+`stream.rs:30328` with *"decoded 1 frame(s), the pinned stream holds 2 -- a short
499+decode would otherwise ask ffmpeg for the same short count and compare nothing"* —
500+on the count, not on a pixel. Both halves proven independently.
501+
502+## 3. Plain-run evidence
503+
504+```
505+cargo test -p ec-av1 --lib --release -- --exact stream::tests::pinned_lr_sgr_stream_call_unique_dump --test-threads=1 --nocapture
506+ frame 0: y_mismatch=false u_mismatch=false v_mismatch=false
507+ pinned_lr_sgr_stream_call_unique_dump: 1 frame(s) byte-exact vs ffmpeg from .../crates/ec-av1/fixtures/lr-sgr-r7.obu
508+ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 741 filtered out; finished in 0.10s
509+```
510+
511+`#[ignore]` in `stream.rs` **37 → 36**. `gate_coverage` 10 passed,
512+`refusal_inventory` 15 passed.
513+
514+The ignore was never justified by cost: it measured 0.10 s under `--ignored` too.
515+The only honest reason it carried was the missing asserts, which is now gone.
516+
517+## 4. TWO CORRECTIONS TO MY OWN r3 CLAIMS
518+
519+Both are scanner blind spots of mine, found by auditing the class after this change.
520+Neither is a new defect in the tree; both are wrong things I told you.
521+
522+**Correction 1 — "the machine-local-pin population is zero in ec-av1" is FALSE.**
523+It is zero for the gates I fixed, and there is **one more pin gate with 14
524+uncommitted pins**:
525+
526+`pinned_warp_stream_decodes_pixel_exact` (still `#[ignore]`d, reason *"reads pinned
527+fixture paths under the gitignored fixtures dir; run manually"*) reads **14 pins** —
528+`warp-mismatch`, `warp-flake-5`, `warp-flake-7`, `ii-flake-1/2/3/5/6/7/8/9`,
529+`rect-flake-1/2/3` — through a **directory** `concat!(env!("CARGO_MANIFEST_DIR"),
530+"/../../fixtures")` literal plus a name list, and formats `{fixtures}/{n}.obu` at
531+runtime. **0 of 14 are committed under the crate.**
532+
533+My r3 scanner matched only `crate_pin("X")` and `pin_dir().join("X")` — *single-name*
534+call shapes. A directory literal plus a runtime-formatted name list does not match
535+either, so this gate was invisible to it. The r3 invariant I proposed to the preflight
536+lane ("every `crate_pin("X")` must have `crates/ec-av1/fixtures/X` in the tree") is
537+**too weak to catch this**, and the preflight lane should be told so: the scan must
538+also resolve `concat!` directory literals and any `{fixtures}/{n}` runtime format.
539+
540+**Correction 2 — "4 ignored gates assert nothing" is wrong for one of them.**
541+My body-only scan reported `pinned_warp_stream_decodes_pixel_exact` as assert-free.
542+It is not: the gate delegates to `check_pinned_warp_stream` (`stream.rs:31226`),
543+which carries `assert_eq!` on all three planes per frame. The scan looked at the gate
544+body and missed the delegation.
545+
546+The other three are correct and are diagnostics **by name**:
547+`probe_tiny_fixture_trace`, `scratch_decode_pinned_stream_once`,
548+`scratch_isolate_pinned_mismatch` — 0 asserts each, all `probe_*`/`scratch_*`.
549+
550+So the accurate statement is: **no ignored gate named `pinned_*` asserts nothing**,
551+after this change — but that took checking the helpers, not the bodies.
552+
553+## 5. State
554+
555+`lane-av1pinslive`, four work commits on top of `aa0ac8c2`. `cargo check -p ec-av1
556+--all-targets` clean, no warnings. Not pushed; main untouched.
557+
558+Follow-on handed back rather than folded in: the 14 `pinned_warp` pins, which are
559+the same defect as r3's four and want the same `crate_pin` + committed-copy
560+treatment. Not verified: a full `cargo test -p ec-av1` run (project-wide validation
561+is Main's).
lanes/merge-wave-3a.report.mdadded+202 -0
@@ -0,0 +1,202 @@
1+# Merge wave 3a — four branches
2+
3+Integration owner: wave 3a only. Five other wave-3 branches are being reworked and
4+one is do-not-merge pending a one-line fix; they are **not** in this wave and were
5+not touched.
6+
7+Base: `main` @ `9b2f6c9d` (742 lib tests). Head after this wave: `7fa70aac`
8+(746 lib tests). **Not pushed.**
9+
10+## Per-branch
11+
12+| # | branch | tip merged | conflicts | true delta vs merge base | landed delta on main |
13+|---|--------|-----------|-----------|--------------------------|----------------------|
14+| 1 | `lane-av1txsearch` | `4aebe74d` | none (auto-merged) | `gate_coverage.rs` +510/-47, `lanes/av1txsearch.report.md` +238 | `gate_coverage.rs` +463/-47, report +238 |
15+| 2 | `lane-av1leftwit` | `d5ab6ef4` | none (auto-merged, 3 files) | `decode_probe.rs` +9/-2, `decode.rs` +135, `stream.rs` +103/-8, report +277 | +7/-2, +119/-16, +95/-8, +277 |
16+| 3 | `lane-av1pinslive` | `2e5509e9` | none (auto-merged) | 4 fixtures (new blobs), `stream.rs` +246/-65, report +357 | fixtures, `stream.rs` +181/-65, report +357 |
17+| 4 | `lane-av1lossy128x96` | `9ecb36de` | **1 file, 2 regions** — `stream.rs` tail-append, resolved by reconstruction | `stream.rs` +188/-0, report +141 | `stream.rs` +191/-6, report +141 |
18+
19+"Landed delta" is `git show --numstat <merge-commit>` — the change relative to the
20+accumulated pre-merge `main`, which is why it differs from the branch-vs-base
21+number. Both are reported; neither substitutes for the other.
22+
23+### Tip drift on #3 — the dispatched sha is not on the branch
24+
25+The brief dispatched `lane-av1pinslive` @ `1d438c86`. That object exists but is
26+**reachable from no ref and is not an ancestor of `lane-av1pinslive` or of `main`**:
27+
28+```
29+git for-each-ref --contains 1d438c86 -> (empty)
30+git log --oneline -1 1d438c86 -> lanes/av1pins r2: the two pins were still #[ignore]d...
31+git log --oneline -1 7f815aa8 -> lanes/av1pins r2: the two pins were still #[ignore]d... <- same subject
32+git diff --stat 1d438c86 7f815aa8 -> lanes/av1mergecheck.report.md | 177 +++++
33+```
34+
35+It is the pre-amend r2 report commit, superseded by `7f815aa8`. Merging the
36+dispatched sha would have **deleted** `lanes/av1mergecheck.report.md` (177 lines) and
37+dropped r3+r4 entirely — four committed pin fixtures and 224 lines of `stream.rs`.
38+The branch head `2e5509e9` was merged instead.
39+
40+**Unreviewed delta, flagged:** the refutation pass's "un-ignores exactly TWO gates"
41+describes r2. The branch head un-ignores **FIVE**:
42+
43+| gate | r2 (`1d438c86`) | head (`2e5509e9`) |
44+|------|------------------|-------------------|
45+| `pinned_golden3_stream_decodes_pixel_exact` | un-ignored | un-ignored |
46+| `pinned_sbpart_stream_decodes_pixel_exact` | un-ignored | un-ignored |
47+| `pinned_golden4_stream_decodes_pixel_exact` | still ignored | un-ignored |
48+| `pinned_golden7_stream_decodes_pixel_exact` | still ignored | un-ignored |
49+| `pinned_lr_sgr_stream_call_unique_dump` | still ignored | un-ignored |
50+
51+r3 additionally commits the four remaining untracked pin fixtures
52+(`golden4-pin.obu` 137 B, `golden6-mismatch.obu` 452 B,
53+`golden7-forwarding-mismatch.obu` 152 B, `lr-sgr-r7.obu` 192 B — all verified on
54+disk) and adds a `require_pin` helper. r4 gives `pinned_lr_sgr` the pixel asserts it
55+lacked. Zero gates were newly ignored. Per-gate census, base `aa0ac8c2` vs head:
56+5 flips `(test, ignored) -> (test, live)`, 0 flips the other way, 0 tests removed.
57+
58+Per the brief, the branch was **not** pushed toward un-ignoring the three sibling
59+gates its report says it does not cover.
60+
61+### The #4 conflict, and why `@both` was wrong
62+
63+`stream.rs` conflicted in two regions, both the tail-append shape: `leftwit`,
64+`pinslive` and `lossy` all append `#[test] fn`s at the end of the same test module,
65+and git hoisted the shared trailing lines (the `let _gate_lock` / `have_ffmpeg()`
66+prologue, and the module's closing brace) out of the hunks as common context.
67+
68+`@both` would have emitted **ours' gate head, then theirs' gate head, then the one
69+shared body** — nesting the second `fn` inside the first. That parses, so no
70+`cargo check` error would fire, but the outer gate would have an empty body and a
71+meaningless `#[test]` on a nested item: a silently vacuous gate.
72+
73+Resolved by reconstruction instead (tail-append by construction, not marker
74+surgery): HEAD's `stream.rs` with the module's final `}` dropped, the lane's
75+single 188-line contiguous append spliced in, `}` re-added. Verified afterwards:
76+
77+- `git diff --numstat HEAD -- crates/ec-av1/src/stream.rs` = `189 0` — a pure
78+ append, nothing else moved;
79+- both gates present exactly once
80+ (`a_real_aomenc_12bit_stream_with_two_tile_rows_and_a_two_by_two_tile_grid_decodes_pixel_exact`,
81+ `a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96`);
82+- the flagged behaviour survives: the 128x96 gate asserts **parsed** `tx_mode` per
83+ arm — `TxMode::Select` on the search arm, `TxMode::Largest` on the control.
84+
85+## Cross-branch defect found by the merge, and fixed here
86+
87+Branches 1 and 4 were each individually green and together red.
88+
89+`lane-av1txsearch` landed `print_tx_size_search_census`, whose `assert_eq!(unresolvable, 0)`
90+exists to go red the moment a gate body builds `--enable-tx-size-search` in a shape
91+the resolver cannot bind. `lane-av1lossy128x96` landed a gate written exactly that
92+way — `for (label, search, want_mode, want_len, want_fnv) in arms`, with the arm
93+table hoisted into `let arms`. The assertion fired, as designed:
94+
95+```
96+assertion `left == right` failed: 1 gate bodies build --enable-tx-size-search into
97+a variable this census cannot bind
98+ left: 1 right: 0
99+```
100+
101+`bound_values` strategy (3) only understood an array spelled **inline** after `in`.
102+With a named collection it read past the `for` line to the next `[` in the body —
103+the gate's unrelated `&[..]` flag list — found no digits, and returned an empty set.
104+Both arms were in the source the whole time.
105+
106+Fixed in `7fa70aac` (integration-authored, not folded into either lane's merge
107+commit): new strategy (3b) follows the `for` line's collection name back to its
108+`let` binding and takes that column. Two details are load-bearing — a word-boundary
109+guard (`let arms_foo` must not answer for `let arms`), and a hop over `=`, because
110+the binding's **type annotation is itself bracketed**
111+(`[(&str, &str, TxMode, usize, u64); 2]`), so scanning for the first `[` after the
112+name returns the type.
113+
114+**Red-before:** with `merge(set)` replaced by `let _ = set;` the new case added to
115+`the_resolver_binds_a_format_built_flag_in_both_directions` fails with
116+`a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96:
117+the unmutated body should resolve to both values, got {}`. Restored → green.
118+
119+## Checks
120+
121+`cargo check -p ec-av1 --all-targets` after each merge — clean, no warnings, four for
122+four:
123+
124+| after | result |
125+|-------|--------|
126+| merge 1 `1cc2f250` | Finished, 1.73s |
127+| merge 2 `bd588822` | Finished, 16.90s |
128+| merge 3 `4532caa6` | Finished, 10.14s |
129+| merge 4 `8dd07ed7` (post-resolution) | Finished, 3.77s |
130+
131+Final, after `7fa70aac`:
132+
133+```
134+$ cargo test -p ec-av1 --lib -- gate_coverage refusal_inventory
135+test result: ok. 28 passed; 0 failed; 0 ignored; 0 measured; 718 filtered out
136+
137+$ cargo test -p ec-av1 --lib -- --list | wc -l
138+748
139+```
140+
141+Census line, proving the resolver now binds the new gate:
142+
143+```
144+a_real_aomenc_444_whole_64_root_tx_size_search_..._at_128x96: =0 and =1 (one arm each) [format! template resolved]
145+enable-tx-size-search over 259 census-selected gate bodies: =0 only 88, =1 only 13, both 20, unresolvable 0, not named 138
146+```
147+
148+### Toolchain caveat that cost three wrong readings
149+
150+`$HOME/.cache/cargo-target` is **shared with concurrent sibling agents on this
151+machine**, and it is keyed by package name+version, not by source path. Three
152+successive `cargo test` runs on an unchanged tree reported 746, then 715 (with
153+`refusal_inventory::tests::every_chroma_unit_a_64_axis_strip_can_present_has_a_coefficient_table`
154+failing "the refusal string is gone from `decode_block_rect64`" — a string that is
155+present at line 19003, inside that function). A sibling worktree built into the
156+same directory had overwritten the test binary. Every number in this report was
157+re-measured in a dedicated `CARGO_TARGET_DIR=cargo-target-w3a-final`; the baseline
158+was measured in a **second** dedicated dir, because sharing even a private dir
159+across two source trees reproduces the same corruption.
160+
161+## Gate-count delta and its cause
162+
163+| | lib tests | `wc -l` |
164+|---|---|---|
165+| `main` @ `9b2f6c9d` (pre-wave) | 742 | 744 |
166+| after wave 3a | 746 | 748 |
167+| **delta** | **+4** | **+4** |
168+
169+Name-set diff, both directions (`comm`), base `9b2f6c9d` vs `7fa70aac`:
170+
171+```
172+ADDED (+4) REMOVED: none
173+ gate_coverage::tests::print_tx_size_search_census <- txsearch
174+ gate_coverage::tests::the_resolver_binds_a_format_built_flag_... <- txsearch
175+ stream::tests::a_committed_4to20_stream_presents_a_one_mi_left_... <- leftwit
176+ stream::tests::a_real_aomenc_444_whole_64_root_tx_size_search_..._128x96 <- lossy128x96
177+```
178+
179+Cause, per branch: **txsearch +2** (the census and its resolver test), **leftwit +1**,
180+**lossy128x96 +1**, **pinslive +0** — pinslive only removes `#[ignore]` attributes
181+and adds a `require_pin` helper, so it moves the *live* count, not the *listed*
182+count. Its five gates went from listed-and-ignored to listed-and-run, which is why
183+the suite executes strictly more work at the same 746.
184+
185+## Deliberately NOT touched
186+
187+- **No push.** All five commits sit on local `main`.
188+- The five wave-3 branches under rework, and the do-not-merge one — not fetched for
189+ merge, not touched.
190+- `crates/ec-av1/fixtures/**` — the four `.obu` blobs are pinslive's, landed
191+ byte-for-byte by the merge; no fixture was regenerated, re-encoded, or renamed.
192+- `lanes/av1mergecheck.report.md` — present (16153 B) and untouched. r2 deleted it
193+ and r3 restored it; merging the branch head leaves it exactly as `main` had it.
194+- `lanes/av1pins.report.md` — the lane's own report, not corrected toward the brief
195+ even where the brief and the report disagree.
196+- `stash@{0}` (a foreign `EC_PREDOUT8` edit to `scripts/instrument-aom-oracle.sh`,
197+ attributed to `lane-av1cmpaudit`, preserved by Agent05-2) — left in the stash, not
198+ applied. Same for `stash@{1..3}`.
199+- `crates/ec-av1/src/stream.rs` in the lossy merge — no whole-file `--theirs`; main's
200+ `a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact_10bit`
201+ (a main-side test the branch does not have) survives.
202+- No `rustfmt`, no workspace-wide build, no other crate's tests.