diff --git a/crates/ec-av1/examples/decode_probe.rs b/crates/ec-av1/examples/decode_probe.rs index 6079a5cf..d2a79cb0 100644 --- a/crates/ec-av1/examples/decode_probe.rs +++ b/crates/ec-av1/examples/decode_probe.rs @@ -51,12 +51,17 @@ fn main() { ec_av1::decode::chroma422_pair_wide_hits() ); println!( - "uv_left_ss_y: reads={} mode_diff={} smooth_diff={}", + "uv_left_ss_y: reads={} mode_diff={} smooth_diff={} split1mi={}", ec_av1::decode::uv_left_ss_y_reads(), ec_av1::decode::uv_left_ss_y_mode_diff_hits(), - ec_av1::decode::uv_left_ss_y_smooth_diff_hits() + ec_av1::decode::uv_left_ss_y_smooth_diff_hits(), + ec_av1::decode::uv_left_1mi_split_hits(), ); let (h, v, c) = ec_av1::stream::rect4_32_counters(); + println!( + "rect4_16_uv_pair_filt: {}", + ec_av1::decode::rect4_16_uv_pair_filt_hits() + ); println!("rect4_32: horz={h} vert={v} coded={c}"); println!( "rect_intrabc_reads: {}", diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index a3e2246d..b3afca38 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -5906,6 +5906,27 @@ pub fn uv_left_ss_y_smooth_diff_hits() -> usize { UV_LEFT_SS_Y_SMOOTH_DIFF_HITS.with(|c| c.get()) } +// lane-av1leftwit: decode-path chroma edge-filter-type reads at `ss_y > 0` +// whose left-neighbour COLUMN holds a run of length 1 -- the cell this +// decoder reads (its own mi row) and the cell libaom reads (one row down) +// were written by two DIFFERENT blocks, i.e. the left neighbour is at most +// 1 mi tall. That is the only geometry in which the `+ss_y` term can change +// the answer at all; `UV_LEFT_SS_Y_READS` alone proves nothing about it. +thread_local! { + static UV_LEFT_1MI_SPLIT_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +/// Current value of [`UV_LEFT_1MI_SPLIT_HITS`]. +pub fn uv_left_1mi_split_hits() -> usize { + UV_LEFT_1MI_SPLIT_HITS.with(|c| c.get()) +} + +// lane-av1leftwit: the per-tile epoch `uv_owner` cells are stamped with. +// Bumped in `Neighbours::start_tile`; never read by decode logic. +thread_local! { + static UV_OWNER_EPOCH: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + // lane-cfl r1 gate counters: `UV_CFL_PRED` blocks (every `cfl_alpha_signs` // read) and chroma blocks with a NONZERO `angle_delta_uv` -- the two block // shapes the r1 chroma defect showed up on. @@ -8489,6 +8510,16 @@ struct Neighbours { /// [`Self::uv_mode_grid`]'s stride, in mi units (superblock-padded, like /// every other band here). uv_grid_cols: usize, + /// lane-av1leftwit: which BLOCK wrote each cell of [`Self::uv_mode_grid`], + /// as `(epoch << 24) | (mi_r << 12) | mi_c` of the writing block's own + /// top-left mi. The `uv_mode` value alone cannot answer "are the two cells + /// the `+ss_y` read compares written by the same block?", which is the + /// whole question the `+ss_y` term turns on: the term is only observable + /// when the left neighbour is 1 mi tall, i.e. when the cell this decoder + /// used to read and the cell libaom reads hold DIFFERENT blocks. `epoch` + /// is [`UV_OWNER_EPOCH`], bumped once per tile, so a cell no block wrote + /// in this tile can never be mistaken for a written one. + uv_owner: Vec, /// Whether the block above/left of this column/row was coded `skip` -- /// an inter frame's own `skip` context (spec `SkipContext`), which the /// key-frame writer never tracks (its skip context is always zero); a @@ -8682,6 +8713,7 @@ impl Neighbours { uv_mode_row: vec![(u16::MAX, 0); rows * (SUB / MI)], uv_mode_grid: vec![u8::MAX; cols * (SUB / MI) * rows * (SUB / MI)], uv_grid_cols: cols * (SUB / MI), + uv_owner: vec![0; cols * (SUB / MI) * rows * (SUB / MI)], above_txfm: vec![TXFM_CTX_INIT; cols * (SUB / MI)], left_txfm: vec![TXFM_CTX_INIT; rows * (SUB / MI)], // lane-inter8 r2: mi(4px)-granular, not [`SUB`]-granular -- an @@ -8751,6 +8783,10 @@ impl Neighbours { // lane-seg: `AvailU`/`AvailL` for the segment-id neighbour prediction // are tile-relative, same as every other neighbour lookup here. fctx.seg_tile_origin.with(|c| c.set((row0_mi, col0_mi))); + // lane-av1leftwit: a fresh epoch stamps every `uv_owner` cell this + // tile writes, so the `+ss_y` read's "different block?" probe never + // compares against a cell a previous tile left behind. + UV_OWNER_EPOCH.with(|c| c.set(c.get().wrapping_add(1) | (1 << 24))); self.tile_row0_mi = row0_mi; self.tile_col0_mi = col0_mi; let end = col1_mi.min(self.above.len()); @@ -9860,6 +9896,17 @@ impl Neighbours { uv_mode as u8, ); } + // lane-av1leftwit: stamp the writing block's own mi over its extent, + // the same cells and the same clipping as `uv_mode_grid` above. + let owner = UV_OWNER_EPOCH.with(|c| c.get()) | ((mi_r as u32) << 12) | mi_c as u32; + for row in mi_r..=last_r { + fill_span(&mut self.uv_owner, row * stride + mi_c, n, owner); + } + if crate::envflags::env_flag!("EC_LEFTSSY") { + eprintln!( + "EC_LEAF mi=({mi_r},{mi_c}) wh=({mi_w},{mi_h}) uv_mode={uv_mode}" + ); + } } /// Whether either mi-exact chroma neighbour of the block at `(mi_r, mi_c)` @@ -9920,11 +9967,16 @@ impl Neighbours { /// decode path uses the snapping form. /// `decode_path` is `true` only for the snapping form every decode call /// site uses; the 16x4/4x16 pair witness's mirror passes `false`, so the - /// `+ss_y` counters measure the read that actually filters a chroma edge - /// and not the counter-only one. (The mirror reads an ODD mi row -- the - /// pair's chroma-reference half -- where the two cells differ far more - /// often; counting it would make this lane look reachable when no - /// committed fixture reaches it on the decode path.) + /// `+ss_y` counters measure a read that actually filters a chroma edge and + /// not the counter-only one. + /// + /// lane-av1leftwit: the mirror's justification used to be "no committed + /// fixture reaches the shape on the decode path", and that was false -- + /// `UV_LEFT_1MI_SPLIT_HITS` fires on five of them. The flag stays (a + /// counter-only mirror at an ODD mi row is still not a decode-path read, + /// and its result feeds only `RECT4_16_UV_PAIR_FILT_HITS`), but it is no + /// longer evidence about the `+ss_y` term, and nothing may cite it as such. + /// The decode path's own reach is `uv_left_1mi_split_hits()`. fn smooth_uv_neighbour_unsnapped( &self, mi_r: usize, @@ -9981,13 +10033,18 @@ impl Neighbours { // its own row at 4:2:2 (`ss_y == 0`); this read its own row at every // subsampling. An earlier attempt applied the `ss_y` term to the WRONG // read (the above) and regressed the byte-exact 4:2:0 control, which - // is what exposed the crossing. The premise that blocked the correct - // read -- "no committed fixture presents a 1-mi-tall left neighbour at - // 4:2:0/4:4:0" -- was wrong: the observable condition is not the 8x4 - // leaf specifically but any left neighbour at most 1 mi tall, which - // 4:2:0 partitioning produces constantly. Six committed 4:2:0 - // fixtures reach it (see the report's measurement table), and on - // `reelb_ss600_key_frame.obu` the boolean flips. + // is what exposed the crossing. lane-av1leftwit CORRECTED the claim + // this comment used to make: "six committed 4:2:0 fixtures reach it, + // and on `reelb_ss600_key_frame.obu` the boolean flips" was never + // measured. Measured over all 48 committed fixtures that decode + // (`lanes/av1leftwit.report.md`), `reelb_ss600_key_frame.obu` reads + // `mode_diff=0 smooth_diff=0 split1mi=0`, and exactly FIVE fixtures + // put a 1-mi-tall left neighbour in front of a decode-path read at + // all -- `gm_small_side_witness` (5), `reelc_sb128_inter_witness` (7), + // `av112bit-{inter,compound,compound-masked}` (1 each) -- and in every + // one of those reads the two blocks agree on `uv_mode`. So the SHAPE is + // reachable (see `UV_LEFT_1MI_SPLIT_HITS`) and the term's VALUE + // changing is what is still unwitnessed. let above_mi = (mi_r.saturating_sub(1), mi_c + ss_x); // lane-av1leftref: libaom's LEFT read carries the `+ss_y` ROW term -- // `base_mi[ss_y * mi_stride - 1]` (`av1_common_int.h:1400-1401`) is @@ -9996,11 +10053,17 @@ impl Neighbours { // row at every subsampling. The term is only observable when the two // cells hold DIFFERENT blocks, i.e. the left neighbour is 1 mi tall or // shorter -- then `(row, col-1)` and `(row+1, col-1)` are two blocks - // and only libaom's is the chroma reference. The two counters below - // are the gate's non-vacuity proof: the mode value moved on - // `UV_LEFT_SS_Y_MODE_DIFF_HITS` reads, and the boolean this feeds + // and only libaom's is the chroma reference. Three counters measure + // that, and the third is the one the other two need: a read can only + // differ if the two cells are written by DIFFERENT blocks, which + // `UV_LEFT_1MI_SPLIT_HITS` counts off the per-cell owner stamp + // (`uv_owner`, below). A DIFF bucket that reads 0 while SPLIT reads 0 + // was never in contention; a DIFF bucket that reads 0 while SPLIT + // reads > 0 is the term being unobservable on real material, not + // unreachable. `..._MODE_DIFF_HITS` / `..._SMOOTH_DIFF_HITS` then say + // whether the mode value, and the boolean this feeds // (`is_smooth_mode` -> `av1_get_intra_edge_filter_type` -> the chroma - // edge filter) flipped on `UV_LEFT_SS_Y_SMOOTH_DIFF_HITS`. + // edge filter), actually moved. let left_mi = (mi_r + ss_y, mi_c.saturating_sub(1)); let read_left = |row: usize| -> usize { match self.uv_mode_row.get(row) { @@ -10037,6 +10100,36 @@ impl Neighbours { if is_smooth_mode(own_row) != is_smooth_mode(left) { hit!(UV_LEFT_SS_Y_SMOOTH_DIFF_HITS); } + // lane-av1leftwit: the geometry the `+ss_y` term needs. The two + // cells are one left mi column apart, so they are two different + // blocks exactly when the left neighbour is 1 mi tall or shorter. + let col = left_mi.1; + let epoch = UV_OWNER_EPOCH.with(|c| c.get()) & 0xff00_0000; + let own = (col < self.uv_grid_cols) + .then(|| self.uv_owner.get(mi_r * self.uv_grid_cols + col).copied()) + .flatten() + .filter(|o| o & 0xff00_0000 == epoch) + .unwrap_or(0); + let down = self + .uv_owner + .get((mi_r + ss_y) * self.uv_grid_cols + col) + .copied() + .filter(|o| o & 0xff00_0000 == epoch) + .unwrap_or(0); + if own != 0 && down != 0 && own != down { + hit!(UV_LEFT_1MI_SPLIT_HITS); + if crate::envflags::env_flag!("EC_LEFTSSY") { + eprintln!( + "EC_LEFTSSY epoch={} mi=({mi_r},{mi_c}) left_col={col} \ + owners=({},{})->({},{}) modes={own_row}/{left}", + epoch >> 24, + own >> 12 & 0xfff, + own & 0xfff, + down >> 12 & 0xfff, + down & 0xfff, + ); + } + } } if have_above && cell(&self.uv_mode_grid, mi_r - 1, mi_c).is_some_and(|m| { !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( // frame's own `ss_x` -- the unsnapped read is the pair-merge witness // counter's mirror of the snapping form, and the shipped read offsets // the above COLUMN by `+ss_x` (libaom's `chroma_above_mi`). + // + // lane-av1leftwit: this mirror is NOT evidence about the left read's + // `+ss_y` term, whatever a report once said. It reads the leaf's own + // (odd) mi row, which no decode call site does -- every one of them + // uses the snapping form, whose base row is even -- and its result + // feeds `RECT4_16_UV_PAIR_FILT_HITS` only. What it measures is real + // and worth keeping (the pair's chroma-reference read against the + // leaf's own row: 51/24/121/0/1 hits on the five fixtures censused), + // so it stays; the decode path's own reach for the `+ss_y` term is + // `uv_left_1mi_split_hits()`. if smooth_neighbor_uv != neighbours.smooth_uv_neighbour_unsnapped( lmi.0, diff --git a/crates/ec-av1/src/gate_coverage.rs b/crates/ec-av1/src/gate_coverage.rs index 7e14cd7c..3b7a2b8f 100644 --- a/crates/ec-av1/src/gate_coverage.rs +++ b/crates/ec-av1/src/gate_coverage.rs @@ -779,6 +779,87 @@ mod tests { } } } + // (3b) `for (, ...) in ` where `` is a `let` + // binding in this same body -- the arm table hoisted OUT of the + // loop header, so the `for` line NAMES the array instead of + // spelling it. Strategy (3) alone silently reads past the `for` + // line to the next `[` in the body (an unrelated `&[..]` flag + // list), finds no digits, and returns an empty set: the gate is + // then filed as UNRESOLVED even though both of its arms sit + // verbatim in the source. Measured: the 128x96 4:4:4 lossy + // tx-size-search gate, whose `for (label, search, ...) in arms` + // drove `print_tx_size_search_census`'s `unresolvable == 0` + // assertion red on merge. The `=` hop matters: the binding's + // TYPE annotation is itself bracketed + // (`[(&str, &str, TxMode, usize, u64); 2]`), so scanning for the + // first `[` after the name would return the type. + // ``'s column, read off the arm table a hoisted `for` line + // NAMES rather than spells. Returns `None` unless the body really + // has that shape, so an unrecognised loop is left to the other + // strategies instead of being read as "no values". + let named_column = |pos: usize| -> Option> { + let at = body.find("for (")?; + let head = &body[at..]; + let close = head.find(')')?; + let after = head[close + 1..].trim_start().strip_prefix("in ")?; + let name: &str = after + .split(|c: char| !is_ident_byte(c as u8)) + .next() + .filter(|n| !n.is_empty() && !n.starts_with(|c: char| c.is_ascii_digit()))?; + let decl = body.find(&format!("let {name}"))?; + let after_name = decl + "let ".len() + name.len(); + // `let arms_foo` must not answer for `let arms`. + if body[after_name..] + .chars() + .next() + .is_some_and(|c| is_ident_byte(c as u8)) + { + return None; + } + // Hop the `=`: the binding's TYPE annotation is itself + // bracketed, so the first `[` after the name is the type. + let eq = after_name + body[after_name..].find('=')?; + let open = eq + 1 + body[eq + 1..].find('[')?; + let mut depth = 0i32; + for (i, c) in body[open..].char_indices() { + match c { + '[' => depth += 1, + ']' => { + depth -= 1; + if depth == 0 { + let mut set: BTreeSet = Default::default(); + for tuple in split_top(&body[open + 1..open + i]) { + let Some(inner) = + tuple.strip_prefix('(').and_then(|t| t.strip_suffix(')')) + else { + continue; + }; + let fields = split_top(inner); + let Some(field) = fields.get(pos) else { + continue; + }; + set.extend(bare_digits(field)); + set.extend(quoted_digits(field)); + } + return Some(set); + } + } + _ => {} + } + } + None + }; + if let Some(at) = body.find("for (") { + let head = &body[at..]; + if let Some(close) = head.find(')') { + let pattern = &head["for (".len()..close]; + if let Some(pos) = pattern.split(',').position(|p| p.trim() == var) { + if let Some(set) = named_column(pos) { + merge(set); + } + } + } + } // (4) `u8::from(.)` over a struct-literal arm table. for (i, _) in body.match_indices("u8::from(") { let arg = &body[i + "u8::from(".len()..]; @@ -1384,6 +1465,18 @@ mod tests { "for (tx_search, bit_depth) in [(\"0\", 8u8), (\"0\", 8u8), (\"0\", 10u8)]", "a_real_aomenc_stream_with_filter_intra_on_a_sub8_rect_leaf_decodes_pixel_exact", ), + // The arm table hoisted OUT of the `for` line into a named + // `let` -- the shape lane-av1lossy128x96 writes, and the one + // that reads as UNRESOLVED unless the `for` line's collection + // name is followed back to its binding. Without this case a + // resolver that only understood inline arrays passes the + // three above and still cannot bind this gate. + ( + "format!(\"--enable-tx-size-search={search}\")", + "\"tx size search on\",\n \"1\",", + "\"tx size search on\",\n \"0\",", + "a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96", + ), ]; for (template, from, to, name) in cases { let body = find(name); diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 0152764b..fda89ad7 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -9126,6 +9126,22 @@ pub(crate) mod tests { /// the machine's scratchpad is reaped -- three gates sat at `rc=0` having /// tested nothing for exactly that reason (lane-av1pins). Falls back to /// `pin_dir()` so a locally re-captured stream still overrides. + /// Read a pin that a gate cannot proceed without. A missing pin is a + /// HARD failure naming the path and the generator, never a raw io panic + /// and never a silent skip: `EC_AV1_GATE_DUMP_PIN` points the gate at a + /// freshly captured stream, and a runner without the committed copy must + /// say so instead of reporting green having tested nothing. + fn require_pin(path: &std::path::Path, name: &str) -> Vec { + std::fs::read(path).unwrap_or_else(|e| { + panic!( + "no pinned bytes at {} ({e}) -- set EC_AV1_GATE_DUMP_PIN to a freshly \ + captured stream, or restore the committed copy at \ + crates/ec-av1/fixtures/{name}", + path.display() + ) + }) + } + fn crate_pin(name: &str) -> std::path::PathBuf { let in_crate = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) .join("fixtures") @@ -23675,11 +23691,14 @@ pub(crate) mod tests { /// `EC_AV1_GATE_DUMP=$SP/golden3-pin.obu` off /// [`a_real_aomenc_inter_sequence_with_cdf_forwarding_decodes_pixel_exact`] /// (seed 47, frame 1 U). Deterministic and static -- no aomenc/ffmpeg - /// re-encode involved, only re-decodes fixed bytes on disk. Still - /// `#[ignore]`d: it is a BISECT aid, not a suite gate. What changed under - /// lane-av1pins is WHERE the bytes live -- they are now committed at - /// `crates/ec-av1/fixtures/golden3-pin.obu` instead of a scratchpad that - /// tmpfs reaps, so the gate does real work on any runner. + /// re-encode involved, only re-decodes fixed bytes on disk. What changed + /// under lane-av1pinslive is that the gate is LIVE: the bytes are committed + /// at `crates/ec-av1/fixtures/golden3-pin.obu` instead of a scratchpad that + /// tmpfs reaps, so it runs in the ordinary suite on any runner that has + /// ffmpeg (guarded by `have_ffmpeg()`, so `EC_AV1_REQUIRE_FFMPEG=1` turns + /// its absence into a hard failure rather than a silent skip). It costs + /// ~0.15 s, touches no process-global, and reads no counter -- none of the + /// conditions that make this crate ignore its other manual gates. /// /// The original capture (2026-08-28, `bec27414`) is NOT reproducible: it /// predates `5ae053d3` "route all 20 gradients gate fixtures through @@ -23693,7 +23712,6 @@ pub(crate) mod tests { /// `a_real_aomenc_inter_sequence_with_cdf_forwarding_decodes_pixel_exact` /// prints for that seed -- which is what proves the recipe is that gate's. #[test] - #[ignore = "bisect aid, not a suite gate; run it with --ignored"] fn pinned_golden3_stream_decodes_pixel_exact() { let path = std::env::var("EC_AV1_GATE_DUMP_PIN") .map(std::path::PathBuf::from) @@ -23737,22 +23755,22 @@ pub(crate) mod tests { /// `EC_AV1_GATE_DUMP=$SP/golden4-pin.obu` off /// [`a_real_aomenc_inter_sequence_with_cdf_forwarding_decodes_pixel_exact`] /// (seed 43, frame 3 luma) the round the GOLDEN mask lifted. Deterministic - /// and static -- `#[ignore]`d, run manually. + /// and static. + /// + /// LIVE since lane-av1pinslive r3: the bytes are committed at + /// `crates/ec-av1/fixtures/golden4-pin.obu` (137 bytes; sha256 + /// `1754023e44e46edaebc2c05065bf1c65db1a41354577cbf71c0e8ebe737ae14a`, + /// recovered byte-for-byte from the runner library), so the old + /// "reads a pinned fixture path outside the repo" reason is false. Costs + /// ~0.10 s, touches no process-global, reads `non_last_ref_hits` for + /// diagnostic output only (never asserted), and calls no aomenc. #[test] - #[ignore = "reads a pinned fixture path outside the repo; run manually"] fn pinned_golden4_stream_decodes_pixel_exact() { use crate::decode::non_last_ref_hits; let path = std::env::var("EC_AV1_GATE_DUMP_PIN") .map(std::path::PathBuf::from) - .unwrap_or_else(|_| pin_dir().join("golden4-pin.obu")); - let Ok(stream) = std::fs::read(&path) else { - eprintln!( - "SKIP pinned_golden4_stream_decodes_pixel_exact: no pinned bytes at {} \ - -- re-capture with EC_AV1_GATE_DUMP off the cdf-forwarding gate", - path.display() - ); - return; - }; + .unwrap_or_else(|_| crate_pin("golden4-pin.obu")); + let stream = require_pin(&path, "golden4-pin.obu"); if !have_ffmpeg() { eprintln!("SKIP pinned_golden4_stream_decodes_pixel_exact: no ffmpeg"); return; @@ -23775,15 +23793,22 @@ pub(crate) mod tests { /// by the forwarding gate once film grain is out of the way (1/20 real /// aomenc streams, frame 3 luma, apply_grain=false, `non_last_ref_hits` /// delta=2). `GOLDEN_FRAME` refuses by name until this decodes exact. + /// + /// LIVE since lane-av1pinslive r3. The old shape was the worst of the + /// class: a `concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/...")` + /// literal, which points at the GITIGNORED root and can therefore never be + /// satisfied by a committed pin, combined with a bare `.expect()`. The + /// bytes are now committed at + /// `crates/ec-av1/fixtures/golden7-forwarding-mismatch.obu` (152 bytes; + /// sha256 `81b3bf657a85e95085287b30d97dee93ba5aea0ed1db1e1f4fcd19a06afc17be`, + /// recovered byte-for-byte from the runner library). #[test] - #[ignore = "reads a pinned fixture path outside the repo; run manually"] fn pinned_golden7_stream_decodes_pixel_exact() { use crate::decode::non_last_ref_hits; - let path = concat!( - env!("CARGO_MANIFEST_DIR"), - "/../../fixtures/golden7-forwarding-mismatch.obu" - ); - let stream = std::fs::read(path).expect("reading pinned stream"); + let path = std::env::var("EC_AV1_GATE_DUMP_PIN") + .map(std::path::PathBuf::from) + .unwrap_or_else(|_| crate_pin("golden7-forwarding-mismatch.obu")); + let stream = require_pin(&path, "golden7-forwarding-mismatch.obu"); if !have_ffmpeg() { eprintln!("SKIP pinned_golden7_stream_decodes_pixel_exact: no ffmpeg"); return; @@ -30277,35 +30302,103 @@ pub(crate) mod tests { /// `EC_LR_CALL_DUMP=1` set (see `restoration.rs`'s `apply_sgrproj_stripe`) /// to get the real window on stderr, call-uniquely keyed to `xqd == /// [-16,-32]` rather than any coordinate. + /// lane-av1pinslive r4: this gate asserted NOTHING. It `eprintln!`d per-frame + /// mismatch flags and returned, so it could not go red on a decode regression + /// -- which is why r3 left it `#[ignore]`d on that fact rather than un-ignoring + /// it. It now carries the same three things its three siblings have: a pinned + /// FRAME COUNT, a length assert before the zip, and per-plane per-frame pixel + /// asserts. The diagnostic print is kept, and now runs BEFORE the asserts so a + /// failure still names the shape of the divergence. + /// + /// The frame count is the substantive fix. The old body passed `pics.len()` as + /// ffmpeg's EXPECTED count: + /// let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len()); + /// so a decoder that emitted ZERO frames asked ffmpeg for zero frames, the zip + /// compared no pairs, and the gate passed having proved nothing -- the exact + /// vacuous-pass shape the `cmpaudit` lane swept elsewhere in this crate. The + /// count now comes from the FIXTURE (`FRAMES`), so losing the frame reds on the + /// count instead of comparing nothing. + /// + /// On "does it compare only frame 0": the loop always visited every frame; this + /// pin simply holds one (`frame 0` was the only line the pre-r4 run printed). + /// The loop is unchanged in that respect and still visits every frame it gets. + /// + /// The `EC_LR_CALL_DUMP=1` window is unchanged and still needs that env -- but + /// it is a debugging session layered on a real gate now, not the gate itself. #[test] - #[ignore = "reads a pinned fixture under the gitignored fixtures dir; run manually with EC_LR_CALL_DUMP=1"] fn pinned_lr_sgr_stream_call_unique_dump() { - let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/lr-sgr-r7.obu"); - let stream = std::fs::read(path).expect("reading pinned lr-sgr-r7.obu"); + const NAME: &str = "pinned_lr_sgr_stream_call_unique_dump"; + const W: usize = 192; + const H: usize = 128; + /// Measured: the pre-r4 run printed `frame 0` and no other frame line. + const FRAMES: usize = 1; + let path = std::env::var("EC_AV1_GATE_DUMP_PIN") + .map(std::path::PathBuf::from) + .unwrap_or_else(|_| crate_pin("lr-sgr-r7.obu")); + let stream = require_pin(&path, "lr-sgr-r7.obu"); let pics = decode_stream(&stream).expect("pinned lr-sgr-r7.obu must decode"); - if have_ffmpeg() { - let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len()); - for (i, (got, want)) in pics.iter().zip(&reference).enumerate() { - let y_mismatch = got.y != want.y; - let u_mismatch = got.u != want.u; - let v_mismatch = got.v != want.v; - eprintln!( - "frame {i}: y_mismatch={y_mismatch} u_mismatch={u_mismatch} v_mismatch={v_mismatch}" - ); - if y_mismatch { - let n = got.y.iter().zip(&want.y).filter(|(a, b)| a != b).count(); - eprintln!(" {n} luma bytes differ / {}", got.y.len()); - } - if v_mismatch { - let w = 96usize; // chroma plane width (192/2) - for (idx, (a, b)) in got.v.iter().zip(&want.v).enumerate() { - if a != b { - eprintln!(" V[{},{}] got={a} want={b}", idx / w, idx % w); - } + assert_eq!( + pics.len(), + FRAMES, + "{NAME}: decoded {} frame(s), the pinned stream holds {FRAMES} -- a short \ + decode would otherwise ask ffmpeg for the same short count and compare \ + nothing", + pics.len() + ); + for f in &pics { + assert_eq!((f.width, f.height), (W, H), "{NAME}: dimensions"); + } + if !have_ffmpeg() { + eprintln!( + "SKIP {NAME}: no ffmpeg -- the pixel compare IS this gate's claim, so it \ + proves nothing here; set EC_AV1_REQUIRE_FFMPEG=1 to make that a hard \ + failure instead" + ); + return; + } + let reference = ffmpeg_decode_sequence(&stream, W, H, FRAMES); + assert_eq!( + reference.len(), + FRAMES, + "{NAME}: ffmpeg returned {} frame(s), expected {FRAMES}", + reference.len() + ); + for (i, (got, want)) in pics.iter().zip(&reference).enumerate() { + let y_mismatch = got.y != want.y; + let u_mismatch = got.u != want.u; + let v_mismatch = got.v != want.v; + eprintln!( + "frame {i}: y_mismatch={y_mismatch} u_mismatch={u_mismatch} v_mismatch={v_mismatch}" + ); + if y_mismatch { + let n = got.y.iter().zip(&want.y).filter(|(a, b)| a != b).count(); + eprintln!(" {n} luma bytes differ / {}", got.y.len()); + } + if v_mismatch { + let w = 96usize; // chroma plane width (192/2) + for (idx, (a, b)) in got.v.iter().zip(&want.v).enumerate() { + if a != b { + eprintln!(" V[{},{}] got={a} want={b}", idx / w, idx % w); } } } + assert_eq!( + got.y, want.y, + "{NAME} frame {i} luma vs ffmpeg (pinned lr-sgr)" + ); + assert_eq!( + got.u, want.u, + "{NAME} frame {i} U vs ffmpeg (pinned lr-sgr)" + ); + assert_eq!( + got.v, want.v, + "{NAME} frame {i} V vs ffmpeg (pinned lr-sgr)" + ); } + eprintln!( + "{NAME}: {FRAMES} frame(s) byte-exact vs ffmpeg from {}", + path.display() + ); } /// lane-realworld r2: `read_cdef` (spec 5.11.56) ported -- per-superblock @@ -33213,11 +33306,19 @@ pub(crate) mod tests { eprintln!("SKIP a_real_aomenc_stream_with_film_grain_decodes_pixel_exact: no ffmpeg"); return; } - let data = std::fs::read(concat!( - env!("CARGO_MANIFEST_DIR"), - "/../../fixtures/golden6-mismatch.obu" - )) - .unwrap(); + // lane-av1pinslive r3: this gate was LIVE while reading a GITIGNORED + // pin through a `concat!` literal and `.unwrap()` -- a clean checkout + // with no runner library PANICKED here rather than skipping. The bytes + // are now committed at `crates/ec-av1/fixtures/golden6-mismatch.obu` + // (452 bytes; sha256 + // `c56909b98542192b03f3a945e153475aa57a58a1586bf166513297296cb225b3`, + // recovered byte-for-byte from the runner library). + let data = require_pin( + &std::env::var("EC_AV1_GATE_DUMP_PIN") + .map(std::path::PathBuf::from) + .unwrap_or_else(|_| crate_pin("golden6-mismatch.obu")), + "golden6-mismatch.obu", + ); // Truncate right after the first `Frame` OBU (the key frame): every // byte up to there is sequence header + frame-0, which is a complete, // independently decodable single-frame stream. @@ -39492,7 +39593,8 @@ pub(crate) mod tests { /// decodes_pixel_exact` -- fast red/green loop for the bisect, and lets /// `EC_AV1_TRACE=1` be set for one run without re-driving the encoder. /// - /// lane-av1pins: the bytes are now committed at + /// LIVE since lane-av1pinslive (it was `#[ignore]`d from lane-sbpart r4 + /// only because the bytes lived in a scratchpad). Bytes committed at /// `crates/ec-av1/fixtures/sbpart-pin.obu` (238 bytes; sha256 /// `62238fc077f45d89745d4d254b9c0465464003529da3b42d0a65631fbb7e16e9`), /// re-encoded 2026-09-29 from the source gate's own recipe @@ -39503,7 +39605,6 @@ pub(crate) mod tests { /// 192x128 cell, so this pin is a 192x128 re-run of its recipe, not a /// replay of the original mismatch bytes. #[test] - #[ignore = "bisect aid, not a suite gate; run it with --ignored"] fn pinned_sbpart_stream_decodes_pixel_exact() { let path = std::env::var("EC_AV1_GATE_DUMP_PIN") .map(std::path::PathBuf::from) @@ -44870,14 +44971,17 @@ pub(crate) mod tests { /// every subsampling until this lane. /// /// The read is only observable when the two cells hold DIFFERENT blocks -- - /// a left neighbour at most 1 mi tall. Measured over every committed - /// fixture and ~1000 swept aomenc encodes (report table), that never - /// happens on a decode-path read: `uv_mode_grid` runs down a left mi - /// column always have EVEN length, because libaom only starts a block on - /// an odd mi row with an 8-px strip, and the 4-px `HORZ_4` strips aomenc - /// does pick all land inside one mi row. So the term is a proven no-op on - /// today's material, and this gate pins BOTH halves of that statement: - /// the arm runs thousands of times, and it never changes an answer. + /// a left neighbour at most 1 mi tall (1 mi = 4 luma px, so a 4x4/8x4/16x4 + /// /32x4/64x4 leaf). lane-av1leftwit measured that shape off a per-cell + /// owner stamp instead of the mode value: `uv_left_1mi_split_hits()` counts + /// decode-path reads whose two cells were written by DIFFERENT blocks, and + /// it is NOT zero -- five committed fixtures carry it (15 reads in all, + /// `lanes/av1leftwit.report.md`). What no committed fixture shows is the two + /// blocks DISAGREEING on `uv_mode`, which is what `mode_diff`/`smooth_diff` + /// below measure. So this gate pins both halves honestly: the arm runs + /// thousands of times, the shape it needs is genuinely reached, and the + /// term has not yet been seen to change an answer. Its exactness arms are + /// what would decide the shipped read if a DIFF bucket ever went non-zero. /// /// A non-zero DIFF bucket is not a failure here -- it is the first stream /// that witnesses the term, and the exactness arms below are what then @@ -44925,6 +45029,87 @@ pub(crate) mod tests { ); } + /// lane-av1leftwit: the `+ss_y` term's SHAPE is reachable on the decode + /// path, and this is the gate that says so. + /// + /// lane-av1leftref shipped the left read's `+ss_y` row term with the + /// argument that the shape it needs -- a left neighbour at most 1 mi tall, + /// so the cell this decoder read and the cell libaom reads belong to + /// different blocks -- is "structurally absent, because aomenc never starts + /// a block on an odd mi row". Both halves of that are wrong. libaom's + /// `PARTITION_HORZ_4` puts its `i == 0` child on the PARENT's own mi row + /// (`decode_partition`, `av1/decoder/decodeframe.c`: `mi_row + i * bw / 4`), + /// and a 16x16 parent sits on a 4-mi grid, so a 1-mi-tall leaf at an EVEN + /// row is what the syntax asks for, not forbids. And the shape is measured + /// in the corpus: these two fixtures each present it to a real decode-path + /// read. + /// + /// The counter is `decode::uv_left_1mi_split_hits()`, incremented only + /// where `decode_path` is true -- the snapping form every decode call site + /// uses -- so the 16x4/4x16 pair witness's counter-only mirror (which + /// reads an odd mi row and feeds `RECT4_16_UV_PAIR_FILT_HITS`) cannot + /// inflate it. `UV_LEFT_SS_Y_READS` alone would prove nothing: it counts + /// every read with a left neighbour, whether or not the two cells differ. + /// + /// NON-VACUITY: the `uv_owner` stamp the counter turns on was removed for + /// one build; both arms fell to 0 and this gate failed on the census + /// (report §5), so a decoder that stops recording which block owns a cell + /// fails here instead of passing vacuously. It is deliberately NOT a + /// mutation of the `+ss_y` term itself: the term's own mutation leaves + /// these reads untouched, which is the honest limit of what the fixture + /// set can decide (the kf900 gate above owns the exactness side). + #[test] + fn a_committed_4to20_stream_presents_a_one_mi_left_neighbour_to_a_decode_path_read() { + const NAME: &str = + "a_committed_4to20_stream_presents_a_one_mi_left_neighbour_to_a_decode_path_read"; + // (fixture, frames, width, height, measured split-owner reads) + let arms: [(&str, usize, usize, usize, usize); 2] = [ + ("gm_small_side_witness.obu", 33, 1920, 792, 5), + ("reelc_sb128_inter_witness.obu", 15, 1920, 792, 7), + ]; + for (fixture, want_frames, width, height, want_split) in arms { + let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) + .join("fixtures") + .join(fixture); + let stream = std::fs::read(&path) + .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display())); + let before_split = crate::decode::uv_left_1mi_split_hits(); + let before_reads = crate::decode::uv_left_ss_y_reads(); + let before_mode = crate::decode::uv_left_ss_y_mode_diff_hits(); + let before_smooth = crate::decode::uv_left_ss_y_smooth_diff_hits(); + let frames = match decode_stream(&stream) { + Ok(frames) => frames, + Err(e) => panic!("{NAME}: {fixture} refused: {e}"), + }; + let split = crate::decode::uv_left_1mi_split_hits() - before_split; + assert_eq!(frames.len(), want_frames, "{NAME}: {fixture} frame count"); + assert!( + frames + .iter() + .all(|f| (f.width, f.height) == (width, height)), + "{NAME}: {fixture} is not {width}x{height}" + ); + assert_eq!( + split, want_split, + "{NAME}: {fixture} presented {split} 1-mi-tall left neighbours to \ + a decode-path read, measured {want_split} -- the census this \ + gate pins moved" + ); + // Printed, not asserted: `== 0` would pin an accident, and a + // non-zero value is the first WITNESS of the term rather than a + // failure (that is what the kf900 gate above then decides against + // the oracle). + eprintln!( + "{NAME}: {fixture}: {split} 1-mi-tall left neighbours in \ + {} decode-path reads, +ss_y changed the mode {} and the smooth \ + boolean {} times", + crate::decode::uv_left_ss_y_reads() - before_reads, + crate::decode::uv_left_ss_y_mode_diff_hits() - before_mode, + crate::decode::uv_left_ss_y_smooth_diff_hits() - before_smooth, + ); + } + } + /// lane-av1formatsweep: the ODD CODED DIMENSION cell -- a frame whose /// width or height is not a multiple of 8, so the last mode-info column /// and the last chroma plane row/column are PARTIAL (`mi_cols * 8 > @@ -47095,4 +47280,192 @@ pub(crate) mod tests { heads.iter().map(|h| h.superres_denom).collect::>() ); } + + /// lane-av1lossy128x96: the 128x96 sibling of the pinned 128x128 witness + /// `a_pinned_444_inter_stream_chroma_units_inherit_their_own_quadrants_tx_type` + /// (commit 6c33f204). That fix closed the "4:4:4 lossy + TX size search" + /// divergence (H2) for the 128x128 twin; the 128x96 geometry -- two whole + /// 64x64 roots over a frame whose second block row is only 32 rows tall, + /// which is why it exercises BOTH chroma planes and a partial block row -- + /// was left ungated, and it is the geometry the sweep measured the + /// U+V form of the defect on (608 wrong samples from decode-order frame 2). + /// + /// Measured for this lane on the fix's parent `4155c7c7`: decode-order + /// frames 2 and 3 differ from the oracle in 608 and 692 samples (luma + /// exact, U and V wrong), entropy bit-identical; at HEAD and at `6c33f204` + /// all four frames are byte-exact. So the defect is FIXED and this gate is + /// the pin that keeps it fixed. + /// + /// Recipe (encoded LIVE, no fixture): `testsrc2 128x96:rate=25` yuv444p + /// 4 frames, `aomenc --profile=1 --codec=av1 --passes=1 --end-usage=q + /// --cq-level=20 --cpu-used=2 --sb-size=64 --min-partition-size=64 + /// --max-partition-size=64 --enable-tx-size-search=1 --threads=1 --row-mt=0 + /// --lag-in-frames=0 --kf-max-dist=100 --limit=4 --obu -o - -`. + /// Search ON: 21830 B, sha256 `7380bcbbfb791c6a369850357211223e20fab959423135951f6eb43ffbfcfebd`, + /// fnv1a64 `0x1ba3fe9a4335bdbb`. Control arm, same recipe with + /// `--enable-tx-size-search=0`: 21296 B, sha256 + /// `347edcc9f4899fb05b15174b82d37f6562dcc6fe7691af0ed9ba4efd6cc878c6`, + /// fnv1a64 `0x2f87d8e98c9db686`. + /// + /// NON-VACUITY, and the search flag is NOT the assert: the recipe SPELLS + /// `--enable-tx-size-search=1` (aomenc keeps the FIRST occurrence, and a + /// flag left defaulted is "unknown", not "on"), and then + /// 1. every frame header's PARSED `tx_mode` is `TxMode::Select` + /// (`TX_MODE_SELECT`) -- the searched transform mode is really in the + /// bitstream, not merely requested. The control arm asserts the + /// opposite (`TxMode::Largest`), so neither arm can pass on the other's + /// stream; + /// 2. the sequence header is `ss (0,0)` at 8 bits (`assert_444_header`), + /// and the stream is byte-identical to the recorded encode (length + + /// fnv1a64), so an aomenc that stopped producing this cell fails here + /// rather than silently measuring something else; + /// 3. `decode::chroma_quad_leaf_tx_diff_hits()` strictly increases on the + /// search arm -- the number that says the per-quadrant resolve CHANGED + /// an answer, which is the defect itself. It must be exactly 0 on the + /// search-off control: with no var-tx there is no four-leaf luma tree, + /// so the arm is unreachable and a counter that fired there would be + /// counting something else; + /// 4. every decoded plane is 128*96 (at `ss (0,0)` chroma is full + /// resolution, so a subsampled extent fails the shape assert); + /// 5. `decode_all_frames_vs_oracle` asserts the decode-order frame COUNT + /// and each frame's byte LENGTH before any sample is compared. + /// + /// Red-before: reverting ONLY the per-quadrant resolve in + /// `decode_inter_block`'s 64x64 four-unit chroma arm (the `covering_leaf_tx_type` + /// call back to the block-level `first_tx_type`, counters and this gate + /// untouched) turns this gate red on decode-order frame 2 with 608 bytes + /// differing, and green again on restore. + #[test] + fn a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96() { + const NAME: &str = + "a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96"; + let _gate_lock = lock_gate_counters(); + if !have_ffmpeg() || !have_aomenc() { + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); + return; + } + // (label, --enable-tx-size-search, parsed tx mode, bytes, fnv1a64) + let arms: [(&str, &str, TxMode, usize, u64); 2] = [ + ( + "tx size search on", + "1", + TxMode::Select, + 21830, + 0x1ba3_fe9a_4335_bdbb, + ), + ( + "tx size search off (control)", + "0", + TxMode::Largest, + 21296, + 0x2f87_d8e9_8c9d_b686, + ), + ]; + for (label, search, want_mode, want_len, want_fnv) in arms { + let search_flag = format!("--enable-tx-size-search={search}"); + let stream = chroma_format_stream( + 128, + 96, + "yuv444p", + 8, + 4, + &[ + "--profile=1", + "--cq-level=20", + "--cpu-used=2", + "--sb-size=64", + "--min-partition-size=64", + "--max-partition-size=64", + &search_flag, + ], + 0, + ); + assert_444_header(&stream, NAME, 8); + assert_eq!( + stream.len(), + want_len, + "{NAME} ({label}): aomenc produced {} bytes, not the recorded {want_len} -- the \ + recipe no longer makes this cell", + stream.len() + ); + assert_eq!( + fnv1a64(&stream), + want_fnv, + "{NAME} ({label}): the encoded bytes moved" + ); + // PARSED, not requested: the transform mode the bitstream carries. + let mut parser = Av1Parser::new(); + let mut pos = 0usize; + let mut modes: Vec = Vec::new(); + while pos < stream.len() { + let obu = parser + .parse_obu(&stream[pos..]) + .unwrap_or_else(|e| panic!("{NAME}: aomenc OBU does not parse: {e:?}")); + if obu.total_size == 0 { + break; + } + pos += obu.total_size; + if let ObuKind::FrameHeader(h) | ObuKind::Frame(h, _) = obu.kind { + modes.push(h.tx_mode); + } + } + assert_eq!( + modes.len(), + 4, + "{NAME} ({label}): four frame headers expected" + ); + for (i, mode) in modes.iter().enumerate() { + assert_eq!( + *mode, want_mode, + "{NAME} ({label}): decode-order frame {i} carries tx_mode {mode:?}, not \ + {want_mode:?} -- the searched-transform claim is about the bitstream" + ); + } + let diff0 = crate::decode::chroma_quad_leaf_tx_diff_hits(); + let frames = decode_stream(&stream) + .unwrap_or_else(|e| panic!("{NAME} ({label}): refused the stream: {e}")); + let diff = crate::decode::chroma_quad_leaf_tx_diff_hits() - diff0; + for (i, f) in frames.iter().enumerate() { + assert_eq!( + f.y.len(), + 128 * 96, + "{NAME} ({label}): frame {i} luma is {} samples, not 128x96", + f.y.len() + ); + assert_eq!( + f.u.len(), + 128 * 96, + "{NAME} ({label}): frame {i} U is {} samples -- at 4:4:4 the chroma plane is \ + full resolution", + f.u.len() + ); + } + // Pixel compare FIRST: it is the informative failure (it names the + // decode-order frame and the sample), and the counter assert below + // is the guard that says WHY the cell is not vacuous. + let (frames_decoded, _hidden) = decode_all_frames_vs_oracle(&stream, NAME); + assert!( + frames_decoded >= 4, + "{NAME} ({label}): {frames_decoded} decode-order frames" + ); + if label.starts_with("tx size search on") { + assert!( + diff >= 2, + "{NAME}: the per-quadrant tx_type resolve never CHANGED an answer (diff \ + {diff}) -- on this stream the four-leaf luma tree under a searched transform \ + is exactly what makes the block-level value wrong" + ); + } else { + assert_eq!( + diff, 0, + "{NAME}: the four-unit 4:4:4 chroma arm fired with tx size search OFF \ + ({diff} resolves) -- the counter is not measuring the searched path" + ); + } + eprintln!( + "{NAME} ({label}): {frames_decoded} frames byte-exact vs aomdec, tx_mode \ + {want_mode:?} on every frame, quad-tx resolves that differed {diff}" + ); + } + } } diff --git a/lanes/av1leftwit.report.md b/lanes/av1leftwit.report.md new file mode 100644 index 00000000..616e1000 --- /dev/null +++ b/lanes/av1leftwit.report.md @@ -0,0 +1,277 @@ +# lane-av1leftwit — is the left chroma reference's `+ss_y` term witnessed? + +Base `a21f3680`, worktree `~/.cache/wt/av1leftwit`, branch `lane-av1leftwit`. +One commit, nothing pushed. Assignment: the shipped `+ss_y` left-reference +change has no witness, which is a correctness hole, not a coverage gap. + +## 0. Verdict + +**The premise behind the shipped comments is false, and the term itself is +correct.** Two separate claims were standing in for evidence; both were +checked here and neither survives: + +1. "The shape the term needs is structurally absent, because aomenc never + starts a block on an odd mi row" — **false, twice over.** 1 mi is 4 luma + pixels, not 8; libaom's `PARTITION_HORZ_4` places its `i == 0` child on the + PARENT's own mi row, which for a 16x16 is a multiple of 4 and therefore + even; and the shape is not hypothetical — it reaches a real decode-path + read in **5 of the 48 committed fixtures** (15 reads in total), which is + what the new `uv_left_1mi_split_hits()` counter measures. +2. "Six committed 4:2:0 fixtures reach it, and on `reelb_ss600_key_frame.obu` the + boolean flips" (a claim in `decode.rs`) — **never measured, and false.** + `reelb_ss600_key_frame.obu` reads `mode_diff=0 smooth_diff=0 split1mi=0`. + +What is still unwitnessed is narrower and is now stated correctly: in every +one of the 15 decode-path reads that see the shape, the two blocks **agree on +`uv_mode`**, so the term still changes no pixel. A 115-encode targeted hunt +(§3) plus the whole committed corpus did not move that. The `+ss_y` term is +kept — it is verified against the oracle source, not against a corpus +(§1) — and this lane's job is to make the hole smaller, named and gated +rather than propped up by a counter whose call site no decode path uses (§7). + +## 1. The term, against the oracle source (not a corpus) + +`~/.cache/aom-oracle/src` @ `v3.13.3-7-g9bb526a`, +`av1/common/av1_common_int.h:1393-1412` (`set_mi_row_col`): + +```c + const int chroma_ref = ((mi_row & 0x01) || !(bh & 0x01) || !ss_y) && + ((mi_col & 0x01) || !(bw & 0x01) || !ss_x); + xd->is_chroma_ref = chroma_ref; + if (chroma_ref) { + MB_MODE_INFO **base_mi = + &xd->mi[-(mi_row & ss_y) * xd->mi_stride - (mi_col & ss_x)]; + MB_MODE_INFO *chroma_above_mi = + xd->chroma_up_available ? base_mi[-xd->mi_stride + ss_x] : NULL; + MB_MODE_INFO *chroma_left_mi = + xd->chroma_left_available ? base_mi[ss_y * xd->mi_stride - 1] : NULL; +``` + +`chroma_left_mi = base_mi[ss_y * stride - 1]` — the shipped read +`left_mi = (mi_r + ss_y, mi_c - 1)` is this line, with the caller's +`(mi_row & ss_y)` snap already folded into `mi_r`. **The term is right**, and +so is the shape claim about the syntax: + +* `av1/decoder/decodeframe.c:1334` — `partition = (bsize < BLOCK_8X8) ? + PARTITION_NONE : read_partition(...)`: a sub-8x8 bsize is a leaf or nothing. +* same file, `PARTITION_HORZ_4` — `this_mi_row = mi_row + i * (bw / 4)`. A + 16x16 (4x4 mi) sits on a 4-mi grid, so its `i == 0` child is **1 mi tall at + an even mi row**. The geometry the hunt needed is what the syntax produces + first, not something it forbids. +* `av1/common/common_data.c:17` — `av1_ss_size_lookup[.][1][1]` is non-INVALID + for `BLOCK_4X4/4X8/8X4/8X8/16X4/32X4/64X4`, so 4-px-tall leaves are legal + at 4:2:0 (and 4:4:0, `ss_y == 1`). + +One nuance worth keeping: `chroma_ref` is **false** for a block that is itself +1 mi tall (`bh` odd) on an even row at `ss_y == 1`, i.e. libaom does not +*publish* such a block as a chroma reference. It does not block the shape +this lane is about: the block that READS the left neighbour is >= 2 mi tall +(`bh` even) whenever it spans both cells, so its own `chroma_ref` is true and +it does apply the offset. + +## 2. The instrument (what makes the shape measurable at all) + +`uv_left_ss_y_reads` counts reads with a left neighbour — it cannot tell +"reached the shape" from "read two cells of the same block". Three additions, +all in `decode.rs`, none of them on a decision path: + +* `Neighbours::uv_owner: Vec` — per mi cell, `(epoch << 24) | (owner + mi_r << 12) | owner mi_c` of the block that wrote it, stamped in + `record_uv_mode_mi` over the same span and with the same clipping as + `uv_mode_grid`. The epoch (`UV_OWNER_EPOCH`) is bumped in `start_tile`, so + a cell no block wrote in this tile reads 0 and can never be compared. +* `UV_LEFT_1MI_SPLIT_HITS` / `uv_left_1mi_split_hits()` — incremented only + under the existing `decode_path` guard, when both cells were written in this + tile **and by different blocks**. That is the run-of-length-1 geometry, and + it is the precondition for the term being observable at all. +* `EC_LEFTSSY=1` traces: `EC_LEAF mi=(r,c) wh=(w,h) uv_mode=N` per recorded + block (the parse-side leaf list) and `EC_LEFTSSY ... owners=(..)->(..)` per + split read. These are what the hunt below was steered by — the leaf list + says what the partition tree actually contains, before any pixel argument. + +Cost: one extra `u32` per mi cell and one `fill_span` per recorded block +(~0.5 MB for 4K). A `u8` extent grid was tried as well and **removed** — it +existed only for the trace and was avoidable work in the hot path. + +## 3. Hunt + +115 encodes on the durable oracle, 4:2:0 8-bit, all with +`--enable-1to4-partitions=1`, `--cpu-used=0`, `--limit=1`, `--threads=1 +--row-mt=0 --lag-in-frames=0` unless the row says otherwise. "parsed tree" is +the `EC_LEAF` census of that stream (leaf extents in mi); `h=1` counts +1-mi-tall leaves, the only shape that can make the two cells differ. + +| recipe | parsed tree | decode-path counter | pixel verdict | +|---|---|---|---| +| 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 | +| `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 | +| `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 | +| `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 | +| 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 | +| **committed corpus, 48 fixtures that decode** | see §4 | **`split1mi > 0` in 5** | both pinned arms exact (kf900: 22292 reads, all three planes) | + +The lesson the leaf census teaches, and the reason the sweep stops where it +does: a wide block codes 1-D structure almost for free. A 32x16 leaf spans +four 1-mi bands and still wins, because a vertical step is one coefficient per +4x4 transform block however tall the block is (`brick`, `mix4`); and content +fine enough to force small blocks stops at 8x8 (2x2 mi), which is 2 mi tall +and therefore cannot split a cell pair either (`noise2`, `mosaic`). The +encoder reaches 1-mi-tall leaves only on real material — which is exactly what +the committed film cut shows and what no lavfi source reproduced. + +## 4. Corpus census — the shape is on the decode path + +Every `.obu` in `crates/ec-av1/fixtures/`, measured with the pinned probe +(`decode_probe` prints `uv_left_ss_y: reads=.. mode_diff=.. smooth_diff=.. +split1mi=..`). 48 produced numbers: **30 read the term** (4:2:0, `ss_y == 1`), +6 refused (4:2:2, the unconditional refusal — the term is a no-op there by +construction), and 12 decoded with **0 reads** because they are 4:4:4 +(`ss_y == 0`, so the term is literally the same cell as before). Every fixture +that can reach the shape is in the 30. + +| fixture | format | reads | mode_diff | smooth_diff | **split1mi** | +|---|---|---|---|---|---| +| `gm_small_side_witness.obu` | yuv420p10le | 13311 | 0 | 0 | **5** | +| `reelc_sb128_inter_witness.obu` | yuv420p10le | 5472 | 0 | 0 | **7** | +| `av112bit-inter.obu` | yuv420p12le | 40 | 0 | 0 | **1** | +| `av112bit-compound.obu` | yuv420p12le | 62 | 0 | 0 | **1** | +| `av112bit-compound-masked.obu` | yuv420p12le | 65 | 0 | 0 | **1** | +| `reelb_kf900.obu` | yuv420p10le | 22292 | 0 | 0 | 0 | +| `reelb_ss600_key_frame.obu` | yuv420p10le | 6297 | 0 | 0 | 0 | +| (25 other `ss_y == 1` fixtures) | 4:2:0 | 4..14537 | 0 | 0 | 0 | + +The 15 split reads, verbatim from the trace (`gm_small_side_witness`): + +``` +EC_LEFTSSY epoch=1 mi=(84,356) left_col=355 owners=(84,354)->(85,354) modes=0/0 +EC_LEFTSSY epoch=1 mi=(96,216) left_col=215 owners=(96,215)->(97,215) modes=0/0 +EC_LEFTSSY epoch=1 mi=(18,176) left_col=175 owners=(18,189)->(19,189) modes=0/0 +EC_LEFTSSY epoch=1 mi=(74,296) left_col=295 owners=(74,294)->(75,294) modes=0/0 +EC_LEFTSSY epoch=1 mi=(184,376) left_col=375 owners=(184,374)->(185,374) modes=0/0 +``` + +Every one of them: the upper cell's block ends at that row, a second block +starts immediately below it in the same column, and the reading block's +`(row, col-1)` / `(row+1, col-1)` cells are those two blocks. Measured extents +at those sites were `(4x2)` over `(4x1)` mi — a 32x16 block with a 16x4 block +underneath it, which is the `PARTITION_HORZ_4` shape of §1, at even mi rows. +`epoch=1` for all five: first tile, first frame. + +So: **the geometry is real, common enough to pin, and libaom-correct.** What +is missing is a case where the two blocks disagree on `uv_mode`; in these +streams 97.6% of recorded blocks carry `DC_PRED`, and 1-mi-tall leaves sit on +high-detail edges where chroma is flat, so the two conditions are close to +anti-correlated in practice. That is the honest residual, and it is a +statement about the corpus, not about the syntax. + +## 5. Red / green + +* **Gate non-vacuity (the new gate).** `stream.rs:: + a_committed_4to20_stream_presents_a_one_mi_left_neighbour_to_a_decode_path_read` + asserts `uv_left_1mi_split_hits() == 5` on `gm_small_side_witness` and + `== 7` on `reelc_sb128_inter_witness` (deltas around the decode), plus frame + count and dimensions. **Green:** + `5 1-mi-tall left neighbours in 13311 decode-path reads, +ss_y changed the + mode 0 and the smooth boolean 0 times` / `7 ... in 5472 ...`. + **Red:** the `uv_owner` stamp was removed for one build (`if false { + fill_span(...) }`), both arms fell to 0 and the gate FAILED on the census. + Reverted, green again. The mutation is deliberately *not* the `+ss_y` term: + the term's own mutation leaves these reads untouched, which is the limit of + what this fixture set can decide. +* **The term's mutation (pixels).** §6. +* **The existing kf900 gate still passes** with the new counters in the tree: + `22292 left-reference reads, +ss_y changed the mode 0 and the smooth boolean + 0 times, all three planes pixel-exact`. + +## 6. The term's own mutation, on the five streams that carry the shape + +`left_mi = (mi_r + ss_y, ..)` -> `(mi_r + 0 * ss_y, ..)` (the pre-lane +own-row read), `EC_PROBE_OUT16` dumps (yuv420p10le) from both builds, byte +compare: + +| fixture | shipped vs mutated | +|---|---| +| `gm_small_side_witness.obu` | IDENTICAL (150543360 B) | +| `reelc_sb128_inter_witness.obu` | IDENTICAL (68428800 B) | +| `av112bit-inter.obu` | IDENTICAL (122880 B) | +| `av112bit-compound.obu` | IDENTICAL (368640 B) | +| `av112bit-compound-masked.obu` | IDENTICAL (368640 B) | + +All five are byte-identical with the term removed. That is expected, and it +is the point: the shape is reached 15 times and the term still moves nothing, +because the two blocks agree on `uv_mode` in every one of those reads. +Reproduce with: + +```sh +cargo build -p ec-av1 --example decode_probe +EC_PROBE_OUT16=/tmp/s.yuv target/debug/examples/decode_probe crates/ec-av1/fixtures/gm_small_side_witness.obu +# then edit decode.rs:9806 to `mi_r + 0 * ss_y`, rebuild, dump /tmp/m.yuv, cmp +``` + +## 7. Disposition of the phantom mirror + +`decode.rs:17642` (the 16x4/4x16 pair witness) calls the unsnapped form with +the leaf's own — **odd** — mi row and feeds `RECT4_16_UV_PAIR_FILT_HITS`. It +was cited as the `+ss_y` term's reachability evidence, and the `decode_path` +flag exists to keep it out of the term's counters. Measured, that flag's +stated reason ("no committed fixture reaches it on the decode path") is +false, and the mirror is **not** a phantom path either: it measures a real +comparison the decode makes (the pair's chroma-reference read against the +leaf's own row) and it fires — 51 / 24 / 121 / 0 / 1 hits on +`gm_small_side` / `reelc_sb128_inter` / `reelb_kf900` / +`reelb_rect64_intra16x4_witness` / `av112bit-inter`. + +**Disposition: kept, re-labelled.** Deleting a counter that measures a live +comparison would lose coverage; what was wrong was the citation. The mirror +call site and the `decode_path` doc now say in terms that the mirror is not +evidence about `+ss_y` and that the decode path's own reach is +`uv_left_1mi_split_hits()`. + +## 8. Comments corrected (all three were unmeasured claims in the source) + +* `decode.rs:9780` — "Six committed 4:2:0 fixtures reach it ... and on + `reelb_ss600_key_frame.obu` the boolean flips" -> the measured census of §4. +* `decode.rs:9717` — the `decode_path` justification -> §7. +* `stream.rs:43059` (kf900 gate doc) — "that never happens on a decode-path + read: `uv_mode_grid` runs down a left mi column always have EVEN length" + -> the shape is reached; what has never been seen is the two cells + *disagreeing*. +* `decode.rs:9800` — the DIFF-bucket comment now says which counter is the + precondition for the other two, so `mode_diff == 0` is no longer readable as + "unreachable". + +## 9. What is still open + +A witness needs P(shape) x P(the two blocks disagree on `uv_mode`), and on +today's material the second factor is ~0 where the first is 1-in-2600 reads. +The next lever is not another partition-flag sweep (115 encodes say so) and +not a synthetic source: it is real 4:2:0 material whose 1-mi-tall leaves land +on **chroma** edges — foliage, signage, screen content with saturated chroma — +encoded at a bit depth and cq where the encoder keeps directional chroma +modes. `reelc_sb128_inter_witness` (7 reads in 15 frames) is the closest +committed material; the same cut re-encoded at cq 20-32 in 8-bit with +`--enable-1to4-partitions=1` is where to look next. Until one of those +streams lands, the correct statement about this change is the one in §0: the +term matches libaom's source, the geometry it needs is reachable and gated, +and no committed stream yet lets it change a pixel. + +### Gaps in this lane's own coverage, stated + +* **No 4:4:0 encode.** The term is also live at `ss_x == 0, ss_y == 1`, and + nothing here produced one: ffmpeg has no `yuv440` pix_fmt and the y4m + chroma-siting tags do not express it, so the sweep is 4:2:0 only. The + census in §4 is 4:2:0-only for the same reason (the committed 4:4:4 set + cannot reach the term by construction). A 4:4:0 hunt needs a raw plane + writer plus an aomenc input path that accepts it. +* **Three of the five shape-carrying fixtures are not gated** — + `av112bit-{inter,compound,compound-masked}` carry 1 read each and are + left out to keep the gate's runtime down; the census in §4 pins them and + the counter is public, so a future gate can add them for free. +* **No 12-bit-mode sweep of real material.** The three `av112bit` hits are the + only 12-bit evidence and they are 1 read each. + +## State + +One commit on `lane-av1leftwit`, nothing pushed. Hunt scratch (115 encodes, +generator, sweep drivers) lives outside the repo in +`~/.cache/hunt-av1leftwit/` and is not part of the commit. diff --git a/lanes/av1lossy128x96.report.md b/lanes/av1lossy128x96.report.md new file mode 100644 index 00000000..9a9c482b --- /dev/null +++ b/lanes/av1lossy128x96.report.md @@ -0,0 +1,141 @@ +# lane-av1lossy128x96 — the 128x96 4:4:4 lossy tx-size-search cell + +**Tree.** `lane-av1lossy128x96` off `a21f3680`, worktree `~/.cache/wt/av1lossy128x96`. +Builds in a LANE-PRIVATE `CARGO_TARGET_DIR` (`~/.cache/cargo-target-av1lossy128x96`) — +see `skill://counterfactual-ab-target-dir-provenance` variant 5 for why a shared +one silently measures a sibling lane's decoder. `decode.rs` is untouched in the +final commit; the only change is a new gate in `crates/ec-av1/src/stream.rs`. + +**Headline: the cell is already FIXED, and the measurement that says so is the +gate this lane adds.** The charter assumed the 128x96 U+V variant was unowned +and open. It is neither: commit `6c33f204` ("4:4:4 inter chroma units inherit +their own quadrant's luma tx_type") closes it, exactly as it closed the 128x128 +twin. What was missing is the GATE — the fix's own witness is pinned at +128x128, so nothing was watching the 128x96 geometry. + +--- + +## 1. Measurement: the cell, before and after the fix + +Stream (encoded live, identical bytes on both trees): + +``` +ffmpeg -f lavfi -i "testsrc2=size=128x96:rate=25" -frames:v 4 -pix_fmt yuv444p -f yuv4mpegpipe - +aomenc --profile=1 --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 + --sb-size=64 --min-partition-size=64 --max-partition-size=64 + --enable-tx-size-search=1 --threads=1 --row-mt=0 --lag-in-frames=0 + --kf-max-dist=100 --limit=4 --obu -o out.obu - +``` + +21830 bytes, sha256 `7380bcbbfb791c6a369850357211223e20fab959423135951f6eb43ffbfcbebd` +-> fnv1a64 `0x1ba3fe9a4335bdbb`. Reference: the instrumented `aomdec` +(`EC_AV1_FINAL_DUMP`, decode order). + +| tree | decode-order frame 0 / 1 / 2 / 3, bytes differing from aomdec | +|---|---| +| `4155c7c7` (the report's base, the fix's parent) | 0 / 0 / **608** / **692** | +| `6c33f204` (the fix) | 0 / 0 / 0 / 0 | +| `a21f3680` (HEAD) | 0 / 0 / 0 / 0 | + +The 608 is the sweep's number, reproduced exactly. First wrong sample in +decode-order frame 2: byte 16258 of the dump, i.e. `U(2,31)`, ours 111 vs the +oracle's 112 — U and V only, +-1, luma exact, as the sweep recorded. + +`--enable-tx-size-search=0` on the same recipe: 21296 bytes, sha256 +`347edcc9f4899fb05b15174b82d37f6562dcc6fe7691af0ed9ba4efd6cc878c6`, byte-exact +4/4 at every tree. So the cell is gated on the SEARCH, not on the geometry. + +## 2. Discriminator: dequant or inverse transform? + +The charter's method, run before reading any code. `EC_DQCOEFF` on the oracle +(`plane= txsize= txtype= eob= nz=`) against ours (`OUR_DQ w= h= q= dcd= acd= tx= +nz=`), both narrowed to decode-order frame 2 with `EC_TRACE_COEFF_FRAME=2`: 134 +units on each side. + +**Oracle-vs-ours by INDEX is not a valid pairing** (80 of 134 "type +disagreements" on a byte-exact decode) — the two decoders walk units in +different orders, exactly the trap `skill://av1-bitexact-debugging` names. The +valid comparison is our own decode before and after the fix, which has a fixed +unit order: + +| comparison | units whose `tx_type` changed | units whose dequantized coefficient map changed | +|---|---|---| +| ours pre-fix vs ours post-fix (frame 2, 134 units) | **4** (units 72, 76, 107, 111) | **0** | + +**Verdict: dequant is exonerated, the transform-TYPE selection was the defect.** +The same coefficients were read and dequantized identically before and after; +four chroma units were handed the block-level luma `tx_type` instead of the +covering leaf's, and 6c33f204 changed exactly those four answers. Post-fix the +frame is byte-exact against the oracle, so the oracle's types are the post-fix +ones. + +Elimination list, each row a measurement rather than an argument: + +1. **Entropy** — bit-identical (sweep: 140820 `EC_SYMR` reads, zero divergence). +2. **Coefficients / dequant** — 0 of 134 units differ pre→post (this lane). +3. **Inverse-transform type selection** — 4 of 134 units differ pre→post (this + lane); that is the whole difference. +4. **Filters (deblock / CDEF / LR) and prediction input** — exonerated upstream + by the sweep's pre-filter dumps (chroma already wrong before deblock, luma + exact), and by the fact that a type change alone reproduces the diff with + search OFF making it disappear. + +Nothing here needed a new fix, so this lane ships no decoder change. + +## 3. Gate added + +`a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96` +in `crates/ec-av1/src/stream.rs`. Live aomenc (no fixture pin: the recipe is +deterministic), two arms: + +| arm | flags | parsed `tx_mode` | bytes | verdict | +|---|---|---|---|---| +| 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` | +| control | `--enable-tx-size-search=0` | `TxMode::Largest` on all 4 frames | 21296 | EXACT 4/4, `chroma_quad_leaf_tx_diff_hits() == 0` | + +**The search flag is spelled AND the parsed bitstream is asserted** — the +charter's requirement, and the same rule the tilemeasure lane applied to tiles: +aomenc keeps the first occurrence of a flag and an unspecified flag is +"unknown", not "on", so the gate asserts `tx_mode == TxMode::Select` per frame +on the search arm and `TxMode::Largest` on the control, which also stops either +arm from silently measuring the other's stream. Recipe identity is pinned by +length + fnv1a64 (sha256 in the doc comment), so an aomenc that stops producing +this cell fails before the pixel compare. + +Non-vacuity chain, in order: `ss (0,0)` at 8 bits; bytes + fnv match; parsed +`tx_mode` per frame; every decoded plane 128*96 (full-resolution chroma at +`ss (0,0)`); `decode_all_frames_vs_oracle` (frame count and per-frame byte +length asserted before any sample); then the load-bearing counter +`chroma_quad_leaf_tx_diff_hits() >= 2` on the search arm and exactly 0 on the +control — the route counter alone is not a witness, it fires on blocks whose +four leaves agree, which is the shape the original no-op port looked green on. + +**Red-before (reverted, reproduced).** Reverting ONLY the per-quadrant resolve +in the two copies of `decode_inter_block`'s 64x64 four-unit chroma arm — the +`covering_leaf_tx_type(...)` call back to the block-level `luma_tx_type`, +counters and this gate untouched — turns the gate red exactly as the sweep +described it: + +``` +decode-order frame 2 of 4 (4 shown, 0 hidden) differs from the oracle at byte +16258 (ours 111 vs 112), 608 bytes differ +``` + +Green again on restore (`git diff crates/ec-av1/src/decode.rs` empty). + +**Regressions checked on this tree.** The 128x128 twin's own gate +`a_pinned_444_inter_stream_chroma_units_inherit_their_own_quadrants_tx_type` +(96 quad-resolved units, 8 of them differing, plus its 4:2:0 control) is green. +A 4:2:0 identity run of this lane's own recipe (same flags, `yuv420p` input) +decodes byte-exact 4/4 with the 4:4:4-only counters at 0. + +## 4. What this lane does NOT claim + +- It does not claim a new fix. The fix is `6c33f204`, already on main. +- It does not claim the 128x96 cell was ever distinct from the 128x128 twin: + the two are the same defect (per-quadrant `tx_type` inheritance), and the + 128x96 form is the U+V variant of it on a frame whose second block row is + half-height. +- It does not touch the 4:4:4 LOSSLESS chroma class (256x256 / 512x128), which + is owned elsewhere and which the tilemeasure lane bounded with untiled + controls. diff --git a/lanes/av1pins.report.md b/lanes/av1pins.report.md index 453ec1d4..b7125208 100644 --- a/lanes/av1pins.report.md +++ b/lanes/av1pins.report.md @@ -202,3 +202,360 @@ probes/benchmarks excluded from the earlier release triage. Procedure saved as managed skills `stale-ignore-reason-vs-stale-comment` and `fixture-absent-silent-skip-class`. + +--- + +# r2 — the two pins were still `#[ignore]`d, so a plain run executed nothing + +Branch `lane-av1pinslive` off current main `a5867794`. Commit `2e9086c0`. Tests +only, no decoder change, no push. + +A clean-checkout verification (13 branches, 39 gates) reported that the two gates +lane-av1pins recovered are `#[ignore]`d: they pass under `--ignored` and their pins +are committed, but **in a plain suite run they do not execute**. That is correct +and it is the same hole in a different costume. r1's before/after table was +measured with `--ignored` and did not say so, which made it read as a fix when it +was only a fix *under a flag*. + +## 1. The facts + +| gate | `#[ignore]` on main `a5867794`? | reason string | +|---|---|---| +| `pinned_golden3_stream_decodes_pixel_exact` | **yes** | `bisect aid, not a suite gate; run it with --ignored` | +| `pinned_sbpart_stream_decodes_pixel_exact` | **yes** | `bisect aid, not a suite gate; run it with --ignored` | +| `a_real_aomenc_lossless_444_key_frame_decodes_sample_exact` | **no — already live** | — | + +**The reason string is stale, and it went stale twice.** It was introduced at +`c9fede5d` (2026-08-28, lane-av1golden3) as +`reads a pinned fixture path outside the repo; run manually`, with the doc comment +giving the real cause: *"the file only exists on this machine's scratchpad"*. True +then. It stopped being true at `78c805bd` (lane-av1pins), which committed both pins +under `crates/ec-av1/fixtures/` — a path that travels in the runner tarball, so the +bytes are on every runner. + +**The second staleness is mine.** lane-av1pins replaced the reason with *"bisect aid, +not a suite gate"* — a judgement, not a fact, and wrong on this tree: with the bytes +committed these are ordinary decode-exactness gates that cost 0.10–0.15 s, not +bisect aids. A clean-checkout run cannot see a committed pin, so the lane that +*fixed* the pin hole left the ignore hole standing in the same commit. + +## 2. No condition that makes this crate ignore a gate applies + +Measured on `a5867794`, both gate bodies: + +* **no process-global** — neither calls `force_sb128` nor `knob_write`. This is the + condition that legitimately earns 11 other ignores in this crate. +* **no counter, no `lock_gate_counters()`** — so `--test-threads=1` is not required + of them either. +* **no aomenc** — they decode committed bytes and compare to ffmpeg, so they are not + real-aomenc gates and stay out of the `gate_coverage` census either way. +* **not slow** — 0.10–0.15 s each, against 9 ignored siblings that declare + minutes-per-item. +* **ffmpeg guarded** — `have_ffmpeg()` already honours `EC_AV1_REQUIRE_FFMPEG`, so a + missing ffmpeg is a hard failure, not a silent skip. + +Precedent in-tree: `gate_coverage.rs` records the 10-bit LR gate *"was `#[ignore]`d on +that branch and passes un-ignored on main, which carries the fix"* — the same +un-ignore-once-the-blocker-clears move. + +## 3. Before / after, plain run + +Both commands are **plain** — no `--ignored`, no `--exact` needed to select them: + +``` +cargo test -p ec-av1 --lib --release -- --exact stream::tests::pinned_golden3_stream_decodes_pixel_exact --test-threads=1 --nocapture + test ...pinned_golden3_stream_decodes_pixel_exact ... pinned_golden3_stream_decodes_pixel_exact: + 4 frame(s) byte-exact vs ffmpeg from .../crates/ec-av1/fixtures/golden3-pin.obu + test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 730 filtered out; finished in 0.15s + +cargo test -p ec-av1 --lib --release -- --exact stream::tests::pinned_sbpart_stream_decodes_pixel_exact --test-threads=1 --nocapture + test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 730 filtered out; finished in 0.10s + (EC_SBPART_DIAG=1 additionally prints "DIAG frame 0: 0 luma mismatches ... of 192x128" + plus per-SB-column counts — all 24576 luma samples walked) +``` + +| | main `a5867794` plain run | branch `2e9086c0` plain run | +|---|---|---| +| `pinned_golden3` | *not executed* (ignored) | 1 passed, 0.15s, prints 4 frames byte-exact | +| `pinned_sbpart` | *not executed* (ignored) | 1 passed, 0.10s | +| `a_real_aomenc_lossless_444_key_frame...` | 1 passed, 0.21s | 1 passed, 0.21s (unchanged) | + +Three further confirmations that they are genuinely live rather than merely +un-flagged: they execute under a plain **substring** filter (`-- pinned_`, no +`--exact`, no `--ignored`); neither appears in `-- --ignored` any more (0 matches); +and `#[ignore]` in `stream.rs` drops **41 → 39**. + +## 4. A regression I caused and then disproved — recorded because it nearly shipped + +The first `gate_coverage` run **on this branch** showed +`FAILED. 8 passed; 2 failed` (`never_exercised_8bit_matches_the_gate_recipes`, +`never_exercised_10bit_matches_the_gate_recipes`), while the same filter on main +passed 10/10. Un-ignoring changes the census input, so I took that as a regression +I had introduced. + +It was not. A 554-second `--ignored` full-suite run was executing **against the same +worktree and the same `CARGO_TARGET_DIR` at that moment**. Re-run after it finished: +`gate_coverage` **10 passed / 0 failed on 6 consecutive runs**, and alone with +`--exact` it also passes. These are compile-time source scans (`include_str!`), +which cannot be perturbed by runtime state — consistent with a build/link race on +the shared target dir, not with a logic change. Recorded because "I broke a meta-gate" +was the correct reading of the evidence at the time, and the reason it was wrong is +worth keeping. + +Final meta-gate state after the change: `gate_coverage` **10 passed**, +`refusal_inventory` **15 passed**, both green. + +## 5. Follow-on found, NOT done here + +Three sibling pin gates carry the same stale reason **and** still read pins that are +not committed — so in a clean checkout each either skips or panics: + +| gate | pin | committed? | failure mode if un-ignored as-is | +|---|---|---|---| +| `pinned_golden4_stream_decodes_pixel_exact` | `golden4-pin.obu` | no | silent skip | +| `pinned_golden7_stream_decodes_pixel_exact` | `golden7-forwarding-mismatch.obu` | no | silent skip | +| `pinned_lr_sgr_stream_call_unique_dump` | `lr-sgr-r7.obu` | no | **panic** — `std::fs::read(path).expect(...)`, no graceful skip | + +All three read through `pin_dir()` or a `concat!(env!("CARGO_MANIFEST_DIR"), +"/../../fixtures/...")` literal, i.e. the gitignored root. `golden6-mismatch.obu` is +a fourth untracked pin. These are the same defect and the same fix; recovering them +is mechanical from the r1 recipes (golden4 and golden7 are siblings of golden3 off +the cdf-forwarding gate). Left out of this commit to keep it a reason-removal, and +handed back rather than folded in silently. + +--- + +# r3 — the four remaining untracked pins, and the class closed + +Branch `lane-av1pinslive`, rebased onto current main `eccbd6c6`. Commit `f99a5ff9`. +Tests only, no decoder change, no push. + +r2 fixed two gates and handed back three siblings. All four untracked pins are now +committed, three gates are live, and one earns a factual ignore. + +## 1. The pins — RECOVERED, not re-encoded + +| path | sha256 | size | +|---|---|---| +| `crates/ec-av1/fixtures/golden4-pin.obu` | `1754023e44e46edaebc2c05065bf1c65db1a41354577cbf71c0e8ebe737ae14a` | 137 B | +| `crates/ec-av1/fixtures/golden6-mismatch.obu` | `c56909b98542192b03f3a945e153475aa57a58a1586bf166513297296cb225b3` | 452 B | +| `crates/ec-av1/fixtures/golden7-forwarding-mismatch.obu` | `81b3bf657a85e95085287b30d97dee93ba5aea0ed1db1e1f4fcd19a06afc17be` | 152 B | +| `crates/ec-av1/fixtures/lr-sgr-r7.obu` | `6b95b20e3377430ffae0b2ce86fad9502e0dedf13cd6c38ab7f5af4a8b21f33d` | 192 B | + +**`.gitignore` verified as Main described.** `main:.gitignore:12` is +`!crates/*/fixtures/**` — a negation, so `git check-ignore -v` printing that line +means NOT ignored. Confirmed by exit code and by the decisive test: a plain +`git add crates/ec-av1/fixtures/` staged all four with no `-f`. + +**Recovered, not re-encoded — and the order matters for provenance.** I first +reproduced golden4 and golden7 from the cdf-forwarding recipe (seeds 43–48, all of +which decode exact) and captured golden6 through a throwaway harness built on the +crate's own `panned_test_card` (the real recipe needs that Rust helper, not a +lavfi source). Then I found the **original bytes still on the runner libraries** +and fetched those instead. They are the actual historical mismatch witnesses; a +re-encode is a different stream that happens to exercise the same path, and +labelling it as the pin would be a false provenance claim. + +The originals also **self-validate**, which is the check a re-encode cannot pass: +`pinned_golden7`'s committed doc records `non_last_ref_hits` delta=2 for this +stream, and the recovered pin reproduces exactly `0->2` in a plain run. + +The throwaway capture harness was deleted before the commit (`grep -c zz_throwaway` += 0). + +## 2. Three gates go live — same bar as r2 + +| gate | on main `eccbd6c6` | on branch, PLAIN run | +|---|---|---| +| `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` | +| `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` | +| `a_real_aomenc_stream_with_film_grain_decodes_pixel_exact` | **live and PANICKING** | **1 passed, 0 failed, 0 ignored, 0.10s** | + +None touches a process-global, none calls aomenc, and the counter each reads +(`non_last_ref_hits`) is **printed, never asserted** — so there is no +counter-race exposure to justify an ignore. `#[ignore]` in `stream.rs`: **41 → 37**. + +**The film-grain gate was the worst shape in the class and was already LIVE.** It +read its pin through `concat!(env!("CARGO_MANIFEST_DIR"), "/../../fixtures/...")` +and `.unwrap()` — the gitignored root, with no graceful skip. A clean checkout +with no runner library **panics**, it does not skip. That shape can never be +satisfied by a committed pin at all, which is exactly why it is now `crate_pin`. + +## 3. `require_pin` — the new shared shape + +```rust +fn require_pin(path: &std::path::Path, name: &str) -> Vec { + std::fs::read(path).unwrap_or_else(|e| panic!( + "no pinned bytes at {} ({e}) -- set EC_AV1_GATE_DUMP_PIN to a freshly \ + captured stream, or restore the committed copy at \ + crates/ec-av1/fixtures/{name}", + path.display() + )) +} +``` + +A missing pin is a **hard failure naming the path and the generator**, never a raw +io panic and never a silent skip. Those are the two shapes this class has taken +(`golden4` skipped; the film-grain gate panicked), and both are now impossible. + +## 4. One gate stays ignored, on facts + +`pinned_lr_sgr_stream_call_unique_dump` — reason replaced with the two reasons that +are still true: + +> `diagnostic only -- asserts nothing, so it cannot fail on a decode regression; +> run with --ignored and EC_LR_CALL_DUMP=1 for the Sgrproj window` + +The fact: the body `eprintln!`s per-frame mismatch counts and **returns**. There is +no `assert!` anywhere in it, so it cannot go red on a decode regression; +un-ignoring it would add a test that reports pass unconditionally. Its pin is now +committed too, so the old reason ("reads a pinned fixture under the gitignored +fixtures dir") was false and is gone. Measured plain run under `--ignored` for the +record: **1 passed, 0.10s**, `frame 0: y_mismatch=false u_mismatch=false +v_mismatch=false`. + +**What would close it:** give it the pixel asserts its three siblings have (the +compare loop is already there, it only prints), then un-ignore. That is a real +change with a real verdict, so it is not folded in here. + +## 5. State + +`lane-av1pinslive`, three commits on top of `eccbd6c6`: `c7ea69c1` (r2 un-ignore), +`f99a5ff9` (r3 siblings), plus report commits. `cargo check -p ec-av1 --all-targets` +clean, no warnings. Meta-gates after the change: `gate_coverage` **10 passed**, +`refusal_inventory` **15 passed**. r2's two gates re-verified green +(1 passed, 0.15s each). Not pushed; main untouched. + +Not verified: a full `cargo test -p ec-av1` run (project-wide validation is +Main's), and the remaining ignored set — now 37 tests, of which these four were +the machine-local-pin population. + +The class rule this lane earns, in the shape Main is adopting as a batch rule: an +`#[ignore]` reason must state a **fact** (what the gate needs, what it costs), never +a **judgement** ("bisect aid", "not a suite gate"). A judgement cannot be checked +against reality, so it cannot go stale loudly — and that is exactly how the r1 +reason survived into a tree where it was false. + +--- + +# r4 — the last assert-free gate, and two corrections to my own r3 claims + +Branch `lane-av1pinslive`, rebased onto main `aa0ac8c2`. Commit `9a29c974`. +Tests only, no decoder change. + +## 1. What changed + +`pinned_lr_sgr_stream_call_unique_dump` now asserts. r3 left it `#[ignore]`d on the +fact that it asserted nothing; that is fixed and the ignore is gone. + +**The substantive fix is the frame count, not the asserts.** The old body passed +*our own decode's length* as ffmpeg's expected count: + +```rust +let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len()); +``` + +so a decoder emitting **zero** frames asked ffmpeg for zero frames, the zip compared +no pairs, and the gate passed having proved nothing — the `cmpaudit` vacuous-pass +shape, in the one gate that was already `#[ignore]`d for asserting nothing. The count +now comes from the fixture (`FRAMES = 1`, measured), so a lost frame reds on the +count. + +Also added, matching the three sibling pins: a dimensions assert per frame, an +explicit `reference.len() == FRAMES` before the zip, and per-plane per-frame pixel +asserts. **The diagnostic print is kept** and now runs *before* the asserts, so a +failure still names the shape of the divergence. + +### On "does it compare only frame 0?" — it does not + +The loop always visited every frame; it is unchanged in that respect. This pin +simply holds **one** frame, which is why the pre-r4 run printed `frame 0` and +nothing else. So that particular worry is unfounded, and the real gap was the +vacuous count above. + +## 2. Red-before, on a pixel assertion + +**Method used: mutating the decoder arithmetic the pin exercises**, not a faked +expectation — `restoration.rs::apply_sgrproj_stripe`, `+1` on its first output +sample. The pin is a loop-restoration stream, so Sgrproj is on its path. + +``` +frame 0: y_mismatch=false u_mismatch=true v_mismatch=true +panicked at crates/ec-av1/src/stream.rs:30374:13: + assertion `left == right` failed: + pinned_lr_sgr_stream_call_unique_dump frame 0 U vs ffmpeg (pinned lr-sgr) +test result: FAILED. 0 passed; 1 failed; 0 ignored +``` + +It reds on a **pixel** assert, not on a shape or counter assert. Worth recording: +the mutation landed in a **chroma** plane, so the gate caught it on the U assert +while luma stayed clean — a luma-only compare would have missed it entirely. That is +the capability the three per-plane asserts buy. + +Reverted (`git status` on `restoration.rs` empty) and the gate returns green. + +The **count** assert is proven separately: setting `FRAMES = 2` reds at +`stream.rs:30328` with *"decoded 1 frame(s), the pinned stream holds 2 -- a short +decode would otherwise ask ffmpeg for the same short count and compare nothing"* — +on the count, not on a pixel. Both halves proven independently. + +## 3. Plain-run evidence + +``` +cargo test -p ec-av1 --lib --release -- --exact stream::tests::pinned_lr_sgr_stream_call_unique_dump --test-threads=1 --nocapture + frame 0: y_mismatch=false u_mismatch=false v_mismatch=false + pinned_lr_sgr_stream_call_unique_dump: 1 frame(s) byte-exact vs ffmpeg from .../crates/ec-av1/fixtures/lr-sgr-r7.obu + test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 741 filtered out; finished in 0.10s +``` + +`#[ignore]` in `stream.rs` **37 → 36**. `gate_coverage` 10 passed, +`refusal_inventory` 15 passed. + +The ignore was never justified by cost: it measured 0.10 s under `--ignored` too. +The only honest reason it carried was the missing asserts, which is now gone. + +## 4. TWO CORRECTIONS TO MY OWN r3 CLAIMS + +Both are scanner blind spots of mine, found by auditing the class after this change. +Neither is a new defect in the tree; both are wrong things I told you. + +**Correction 1 — "the machine-local-pin population is zero in ec-av1" is FALSE.** +It is zero for the gates I fixed, and there is **one more pin gate with 14 +uncommitted pins**: + +`pinned_warp_stream_decodes_pixel_exact` (still `#[ignore]`d, reason *"reads pinned +fixture paths under the gitignored fixtures dir; run manually"*) reads **14 pins** — +`warp-mismatch`, `warp-flake-5`, `warp-flake-7`, `ii-flake-1/2/3/5/6/7/8/9`, +`rect-flake-1/2/3` — through a **directory** `concat!(env!("CARGO_MANIFEST_DIR"), +"/../../fixtures")` literal plus a name list, and formats `{fixtures}/{n}.obu` at +runtime. **0 of 14 are committed under the crate.** + +My r3 scanner matched only `crate_pin("X")` and `pin_dir().join("X")` — *single-name* +call shapes. A directory literal plus a runtime-formatted name list does not match +either, so this gate was invisible to it. The r3 invariant I proposed to the preflight +lane ("every `crate_pin("X")` must have `crates/ec-av1/fixtures/X` in the tree") is +**too weak to catch this**, and the preflight lane should be told so: the scan must +also resolve `concat!` directory literals and any `{fixtures}/{n}` runtime format. + +**Correction 2 — "4 ignored gates assert nothing" is wrong for one of them.** +My body-only scan reported `pinned_warp_stream_decodes_pixel_exact` as assert-free. +It is not: the gate delegates to `check_pinned_warp_stream` (`stream.rs:31226`), +which carries `assert_eq!` on all three planes per frame. The scan looked at the gate +body and missed the delegation. + +The other three are correct and are diagnostics **by name**: +`probe_tiny_fixture_trace`, `scratch_decode_pinned_stream_once`, +`scratch_isolate_pinned_mismatch` — 0 asserts each, all `probe_*`/`scratch_*`. + +So the accurate statement is: **no ignored gate named `pinned_*` asserts nothing**, +after this change — but that took checking the helpers, not the bodies. + +## 5. State + +`lane-av1pinslive`, four work commits on top of `aa0ac8c2`. `cargo check -p ec-av1 +--all-targets` clean, no warnings. Not pushed; main untouched. + +Follow-on handed back rather than folded in: the 14 `pinned_warp` pins, which are +the same defect as r3's four and want the same `crate_pin` + committed-copy +treatment. Not verified: a full `cargo test -p ec-av1` run (project-wide validation +is Main's). diff --git a/lanes/merge-wave-3a.report.md b/lanes/merge-wave-3a.report.md new file mode 100644 index 00000000..7121262b --- /dev/null +++ b/lanes/merge-wave-3a.report.md @@ -0,0 +1,202 @@ +# Merge wave 3a — four branches + +Integration owner: wave 3a only. Five other wave-3 branches are being reworked and +one is do-not-merge pending a one-line fix; they are **not** in this wave and were +not touched. + +Base: `main` @ `9b2f6c9d` (742 lib tests). Head after this wave: `7fa70aac` +(746 lib tests). **Not pushed.** + +## Per-branch + +| # | branch | tip merged | conflicts | true delta vs merge base | landed delta on main | +|---|--------|-----------|-----------|--------------------------|----------------------| +| 1 | `lane-av1txsearch` | `4aebe74d` | none (auto-merged) | `gate_coverage.rs` +510/-47, `lanes/av1txsearch.report.md` +238 | `gate_coverage.rs` +463/-47, report +238 | +| 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 | +| 3 | `lane-av1pinslive` | `2e5509e9` | none (auto-merged) | 4 fixtures (new blobs), `stream.rs` +246/-65, report +357 | fixtures, `stream.rs` +181/-65, report +357 | +| 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 | + +"Landed delta" is `git show --numstat ` — the change relative to the +accumulated pre-merge `main`, which is why it differs from the branch-vs-base +number. Both are reported; neither substitutes for the other. + +### Tip drift on #3 — the dispatched sha is not on the branch + +The brief dispatched `lane-av1pinslive` @ `1d438c86`. That object exists but is +**reachable from no ref and is not an ancestor of `lane-av1pinslive` or of `main`**: + +``` +git for-each-ref --contains 1d438c86 -> (empty) +git log --oneline -1 1d438c86 -> lanes/av1pins r2: the two pins were still #[ignore]d... +git log --oneline -1 7f815aa8 -> lanes/av1pins r2: the two pins were still #[ignore]d... <- same subject +git diff --stat 1d438c86 7f815aa8 -> lanes/av1mergecheck.report.md | 177 +++++ +``` + +It is the pre-amend r2 report commit, superseded by `7f815aa8`. Merging the +dispatched sha would have **deleted** `lanes/av1mergecheck.report.md` (177 lines) and +dropped r3+r4 entirely — four committed pin fixtures and 224 lines of `stream.rs`. +The branch head `2e5509e9` was merged instead. + +**Unreviewed delta, flagged:** the refutation pass's "un-ignores exactly TWO gates" +describes r2. The branch head un-ignores **FIVE**: + +| gate | r2 (`1d438c86`) | head (`2e5509e9`) | +|------|------------------|-------------------| +| `pinned_golden3_stream_decodes_pixel_exact` | un-ignored | un-ignored | +| `pinned_sbpart_stream_decodes_pixel_exact` | un-ignored | un-ignored | +| `pinned_golden4_stream_decodes_pixel_exact` | still ignored | un-ignored | +| `pinned_golden7_stream_decodes_pixel_exact` | still ignored | un-ignored | +| `pinned_lr_sgr_stream_call_unique_dump` | still ignored | un-ignored | + +r3 additionally commits the four remaining untracked pin fixtures +(`golden4-pin.obu` 137 B, `golden6-mismatch.obu` 452 B, +`golden7-forwarding-mismatch.obu` 152 B, `lr-sgr-r7.obu` 192 B — all verified on +disk) and adds a `require_pin` helper. r4 gives `pinned_lr_sgr` the pixel asserts it +lacked. Zero gates were newly ignored. Per-gate census, base `aa0ac8c2` vs head: +5 flips `(test, ignored) -> (test, live)`, 0 flips the other way, 0 tests removed. + +Per the brief, the branch was **not** pushed toward un-ignoring the three sibling +gates its report says it does not cover. + +### The #4 conflict, and why `@both` was wrong + +`stream.rs` conflicted in two regions, both the tail-append shape: `leftwit`, +`pinslive` and `lossy` all append `#[test] fn`s at the end of the same test module, +and git hoisted the shared trailing lines (the `let _gate_lock` / `have_ffmpeg()` +prologue, and the module's closing brace) out of the hunks as common context. + +`@both` would have emitted **ours' gate head, then theirs' gate head, then the one +shared body** — nesting the second `fn` inside the first. That parses, so no +`cargo check` error would fire, but the outer gate would have an empty body and a +meaningless `#[test]` on a nested item: a silently vacuous gate. + +Resolved by reconstruction instead (tail-append by construction, not marker +surgery): HEAD's `stream.rs` with the module's final `}` dropped, the lane's +single 188-line contiguous append spliced in, `}` re-added. Verified afterwards: + +- `git diff --numstat HEAD -- crates/ec-av1/src/stream.rs` = `189 0` — a pure + append, nothing else moved; +- both gates present exactly once + (`a_real_aomenc_12bit_stream_with_two_tile_rows_and_a_two_by_two_tile_grid_decodes_pixel_exact`, + `a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96`); +- the flagged behaviour survives: the 128x96 gate asserts **parsed** `tx_mode` per + arm — `TxMode::Select` on the search arm, `TxMode::Largest` on the control. + +## Cross-branch defect found by the merge, and fixed here + +Branches 1 and 4 were each individually green and together red. + +`lane-av1txsearch` landed `print_tx_size_search_census`, whose `assert_eq!(unresolvable, 0)` +exists to go red the moment a gate body builds `--enable-tx-size-search` in a shape +the resolver cannot bind. `lane-av1lossy128x96` landed a gate written exactly that +way — `for (label, search, want_mode, want_len, want_fnv) in arms`, with the arm +table hoisted into `let arms`. The assertion fired, as designed: + +``` +assertion `left == right` failed: 1 gate bodies build --enable-tx-size-search into +a variable this census cannot bind + left: 1 right: 0 +``` + +`bound_values` strategy (3) only understood an array spelled **inline** after `in`. +With a named collection it read past the `for` line to the next `[` in the body — +the gate's unrelated `&[..]` flag list — found no digits, and returned an empty set. +Both arms were in the source the whole time. + +Fixed in `7fa70aac` (integration-authored, not folded into either lane's merge +commit): new strategy (3b) follows the `for` line's collection name back to its +`let` binding and takes that column. Two details are load-bearing — a word-boundary +guard (`let arms_foo` must not answer for `let arms`), and a hop over `=`, because +the binding's **type annotation is itself bracketed** +(`[(&str, &str, TxMode, usize, u64); 2]`), so scanning for the first `[` after the +name returns the type. + +**Red-before:** with `merge(set)` replaced by `let _ = set;` the new case added to +`the_resolver_binds_a_format_built_flag_in_both_directions` fails with +`a_real_aomenc_444_whole_64_root_tx_size_search_stream_decodes_pixel_exact_at_128x96: +the unmutated body should resolve to both values, got {}`. Restored → green. + +## Checks + +`cargo check -p ec-av1 --all-targets` after each merge — clean, no warnings, four for +four: + +| after | result | +|-------|--------| +| merge 1 `1cc2f250` | Finished, 1.73s | +| merge 2 `bd588822` | Finished, 16.90s | +| merge 3 `4532caa6` | Finished, 10.14s | +| merge 4 `8dd07ed7` (post-resolution) | Finished, 3.77s | + +Final, after `7fa70aac`: + +``` +$ cargo test -p ec-av1 --lib -- gate_coverage refusal_inventory +test result: ok. 28 passed; 0 failed; 0 ignored; 0 measured; 718 filtered out + +$ cargo test -p ec-av1 --lib -- --list | wc -l +748 +``` + +Census line, proving the resolver now binds the new gate: + +``` +a_real_aomenc_444_whole_64_root_tx_size_search_..._at_128x96: =0 and =1 (one arm each) [format! template resolved] +enable-tx-size-search over 259 census-selected gate bodies: =0 only 88, =1 only 13, both 20, unresolvable 0, not named 138 +``` + +### Toolchain caveat that cost three wrong readings + +`$HOME/.cache/cargo-target` is **shared with concurrent sibling agents on this +machine**, and it is keyed by package name+version, not by source path. Three +successive `cargo test` runs on an unchanged tree reported 746, then 715 (with +`refusal_inventory::tests::every_chroma_unit_a_64_axis_strip_can_present_has_a_coefficient_table` +failing "the refusal string is gone from `decode_block_rect64`" — a string that is +present at line 19003, inside that function). A sibling worktree built into the +same directory had overwritten the test binary. Every number in this report was +re-measured in a dedicated `CARGO_TARGET_DIR=cargo-target-w3a-final`; the baseline +was measured in a **second** dedicated dir, because sharing even a private dir +across two source trees reproduces the same corruption. + +## Gate-count delta and its cause + +| | lib tests | `wc -l` | +|---|---|---| +| `main` @ `9b2f6c9d` (pre-wave) | 742 | 744 | +| after wave 3a | 746 | 748 | +| **delta** | **+4** | **+4** | + +Name-set diff, both directions (`comm`), base `9b2f6c9d` vs `7fa70aac`: + +``` +ADDED (+4) REMOVED: none + gate_coverage::tests::print_tx_size_search_census <- txsearch + gate_coverage::tests::the_resolver_binds_a_format_built_flag_... <- txsearch + stream::tests::a_committed_4to20_stream_presents_a_one_mi_left_... <- leftwit + stream::tests::a_real_aomenc_444_whole_64_root_tx_size_search_..._128x96 <- lossy128x96 +``` + +Cause, per branch: **txsearch +2** (the census and its resolver test), **leftwit +1**, +**lossy128x96 +1**, **pinslive +0** — pinslive only removes `#[ignore]` attributes +and adds a `require_pin` helper, so it moves the *live* count, not the *listed* +count. Its five gates went from listed-and-ignored to listed-and-run, which is why +the suite executes strictly more work at the same 746. + +## Deliberately NOT touched + +- **No push.** All five commits sit on local `main`. +- The five wave-3 branches under rework, and the do-not-merge one — not fetched for + merge, not touched. +- `crates/ec-av1/fixtures/**` — the four `.obu` blobs are pinslive's, landed + byte-for-byte by the merge; no fixture was regenerated, re-encoded, or renamed. +- `lanes/av1mergecheck.report.md` — present (16153 B) and untouched. r2 deleted it + and r3 restored it; merging the branch head leaves it exactly as `main` had it. +- `lanes/av1pins.report.md` — the lane's own report, not corrected toward the brief + even where the brief and the report disagree. +- `stash@{0}` (a foreign `EC_PREDOUT8` edit to `scripts/instrument-aom-oracle.sh`, + attributed to `lane-av1cmpaudit`, preserved by Agent05-2) — left in the stash, not + applied. Same for `stash@{1..3}`. +- `crates/ec-av1/src/stream.rs` in the lossy merge — no whole-file `--theirs`; main's + `a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact_10bit` + (a main-side test the branch does not have) survives. +- No `rustfmt`, no workspace-wide build, no other crate's tests.