From e9e3a487a2c56fc3e99755016ebaaa406733c9bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 20 Sep 2026 12:04:18 +0300 Subject: [PATCH] ec-av1: rect intrabc r4 -- publish every block's footprint into the intrabc mv grid The DV predictor of a later intrabc block is libaom's INTRA_FRAME MV stack, built by scans that walk `xd->mi[]` -- an entry for EVERY coded block -- and step by `mi_size_wide/height[candidate->bsize]`. This decoder's grid held only the intrabc blocks, so a non-intrabc neighbour read as `None`, the scan advanced that cell by one instead of by its real width, and at mi(84,104) of the 512x384 testsrc2 cq45 arm the row scan's extended offset -3 over-reached from libaom's last probe (81,106) to (81,108). The extra -512 vote (weight 16) flipped the sorted stack, so `nearestmv` became -512 where libaom's is -520: one whole-pel-wrong skip=1 copy, 528 wrong luma samples. `MiGrid` gains a block-COVERAGE map (`cover_rect`) filled for every coded block from `Neighbours::fill_lf_grid_rect`, and `get` synthesizes a non-inter, zero-MV entry from it, which `single_ref_match` never matches but the scan still steps by. An unfilled cover reads as uncovered, so the tile writer's own grid and every synthetic test grid keep their old behaviour exactly. Stream B is byte-exact; stream A stays byte-exact. New gate `a_coded_rect_intrabc_block_reconstructs_in_both_orientations` (HORZ coded, VERT coded -- the regression stream -- and TX_MODE_SELECT), with a new coded-orientation instrument; it fails pre-fix at the VERT arm. --- crates/ec-av1/src/decode.rs | 42 +++++++++ crates/ec-av1/src/mvstack.rs | 74 +++++++++++++++- crates/ec-av1/src/stream.rs | 167 +++++++++++++++++++++++++++++++++++ lanes/av1intrabc.report.md | 133 +++++++++++++++++++++++++++- 4 files changed, 410 insertions(+), 6 deletions(-) diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index a431e076..8da96577 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -3725,6 +3725,22 @@ thread_local! { static INTRABC_RECT_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; /// Of those, how many read the INTER var-tx tree (unskipped, TX_MODE_SELECT). static INTRABC_RECT_VARTX_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; + /// lane-av1-intrabc r4: rect INTRABC blocks whose reconstruction + /// [`decode_intrabc_rect`] ran with `skip == 0` (a real residual read), + /// split by the strip's orientation -- `bw > bh` is a HORZ strip, + /// `bh > bw` a VERT one. The reviewer's unblock condition needs a CODED + /// witness in BOTH orientations, and the existing `INTRABC_RECT_HITS` + /// counts neither orientation nor the skip flag, so an arm that flipped + /// to an all-skip stream (no residual reader at all) would stay green. + static INTRABC_RECT_CODED_HITS: std::cell::Cell<[usize; 2]> = + const { std::cell::Cell::new([0, 0]) }; +} + +/// lane-av1-intrabc r4: coded (`skip == 0`) rect intrabc blocks reconstructed, +/// as `[horz, vert]` -- see [`INTRABC_RECT_CODED_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates +pub fn intrabc_rect_coded_hits() -> [usize; 2] { + INTRABC_RECT_CODED_HITS.with(std::cell::Cell::get) } /// Current value of [`INTRABC_RECT_HITS`]. @@ -3738,6 +3754,7 @@ pub fn intrabc_rect_hits() -> usize { pub(crate) fn reset_intrabc_rect_hits() { INTRABC_RECT_HITS.with(|c| c.set(0)); INTRABC_RECT_VARTX_HITS.with(|c| c.set(0)); + INTRABC_RECT_CODED_HITS.with(|c| c.set([0, 0])); } /// Current value of [`INTRABC_RECT_VARTX_HITS`]. @@ -7652,6 +7669,22 @@ impl Neighbours { fill_span(&mut self.ref_grid, start, w_mi, ref_frame); fill_span(&mut self.delta_lf_grid, start, w_mi, snapshot); } + // lane-av1-intrabc r4: publish this coded block's own mi footprint + // into the intrabc MV grid's block-COVERAGE map -- every coded block, + // not just the intrabc ones. A later intrabc block's DV predictor is + // built by libaom's own row/col scans over `xd->mi[]`, which holds an + // `MB_MODE_INFO` for EVERY block and steps by + // `mi_size_wide/height[candidate->bsize]`; without this footprint a + // non-intrabc neighbour reads as uncovered and the scan advances it + // by one cell instead of its real width (see `MiGrid::cover`'s own + // doc comment for the measured instance). A no-op outside an + // `allow_intrabc` frame -- [`crate::decode::FrameCtx::intrabc_mi_grid`] + // is `None` exactly then. + fctx.intrabc_mi_grid.with(|g| { + if let Some((grid, _, _)) = g.borrow_mut().as_mut() { + grid.cover_rect(mi_r, mi_c, w_mi, h_mi); + } + }); } /// One var-tx / split-tx LEAF's own LUMA transform dims over its mi span. @@ -10929,6 +10962,15 @@ fn decode_intrabc_rect( fctx: &crate::decode::FrameCtx, ) -> Result<()> { hit!(INTRABC_RECT_HITS); + if !skip { + // [horz, vert]: see `INTRABC_RECT_CODED_HITS`. + let idx = usize::from(bh > bw); + INTRABC_RECT_CODED_HITS.with(|c| { + let mut seen = c.get(); + seen[idx] += 1; + c.set(seen); + }); + } let (px, py) = (mi_c * MI, mi_r * MI); let (cpx, cpy) = (px / 2, py / 2); // `av1_get_max_uv_txsize(bw x bh)`: 4:2:0 halves the footprint and the diff --git a/crates/ec-av1/src/mvstack.rs b/crates/ec-av1/src/mvstack.rs index c3421099..0d1f672c 100644 --- a/crates/ec-av1/src/mvstack.rs +++ b/crates/ec-av1/src/mvstack.rs @@ -251,6 +251,30 @@ pub struct MiGrid { cols: usize, rows: usize, cells: Vec>, + /// lane-av1-intrabc r4: the CODED BLOCK's own `(width, height)` in mi + /// units for every cell of the frame, whatever the block is -- the + /// block-COVERAGE map a scan's run-length stepping needs. + /// + /// libaom's candidate scans walk `xd->mi[]`, which holds an + /// `MB_MODE_INFO` for EVERY coded block, and step by + /// `mi_size_wide/height[candidate->bsize]`. A decoder grid that only + /// holds the blocks with an MV (the intrabc blocks here) makes every + /// intra neighbour read as *uncovered*: the scan then advances that cell + /// by one instead of by the neighbour's real width, which walks it + /// straight into a cell libaom never probes -- and can even vote. + /// Measured on the 512x384 `testsrc2` cq45 `--enable-tx-size-search=0` + /// arm: at `mi(84,104)` the row scan's extended offset `-3` over-reached + /// from `(81,106)` (libaom's last probe, an 8x16 intrabc voting + /// `-520`) to `(81,108)` (a 16x16 intrabc voting `-512` with a 16-wide + /// weight), flipping the sorted stack so `nearestmv` became `-512` where + /// libaom's is `-520` -- one whole-pel-wrong DV predictor, identical + /// coded diff, 528 wrong luma samples. + /// + /// `[0, 0]` means "no block recorded here" and reads as uncovered, so + /// every grid that never fills this map (the tile writer's own, and + /// every synthetic test grid) keeps exactly its old `None`-per-cell + /// behaviour. + cover: Vec<[u8; 2]>, /// One `skip` flag per cell, beside `cells` rather than inside `MiInfo` /// -- the mv-stack scan walks `cells` for every inter block, so the CELL /// must stay 16 bytes (`mi_info_cell_stays_compact`), and nothing on the @@ -287,6 +311,7 @@ impl MiGrid { cols, rows, cells: vec![None; cols * rows], + cover: vec![[0, 0]; cols * rows], skips: vec![false; cols * rows], tile_row0: 0, tile_col0: 0, @@ -415,8 +440,33 @@ impl MiGrid { } } + /// Records the `w_mi` x `h_mi` footprint of the coded block at + /// `(row, col)` in this grid's block-coverage map (see `cover`) -- called + /// for EVERY coded block, not just the ones that carry an MV. Out-of-range + /// coordinates are a no-op, and an overhanging width is clipped to the + /// grid (the recorded width still names the block's real one, exactly as + /// `mi_size_wide[bsize]` does). + pub fn cover_rect(&mut self, row: usize, col: usize, w_mi: usize, h_mi: usize) { + if row >= self.rows || col >= self.cols || w_mi == 0 || h_mi == 0 { + return; + } + let w = w_mi.min(self.cols - col); + let cell = [w_mi as u8, h_mi as u8]; + for r in row..(row + h_mi).min(self.rows) { + let base = r * self.cols + col; + self.cover[base..base + w].fill(cell); + } + } + /// The unit at `(row, col)`, or `None` when it is outside the grid, hasn't /// been coded, or sits outside the current tile's own bounds ([`Self::set_tile_bounds`]). + /// + /// A cell that holds no MV but IS covered by a recorded block + /// ([`Self::cover_rect`]) reads as that block's own footprint with + /// `is_inter == false` -- libaom's `xd->mi[]` always holds an + /// `MB_MODE_INFO`, and a candidate that casts no vote still advances the + /// scan by its own width. Such an entry can never match + /// (`single_ref_match` rejects a non-inter unit) and carries a zero MV. pub fn get(&self, row: usize, col: usize) -> Option { if row < self.rows && col < self.cols @@ -425,10 +475,28 @@ impl MiGrid { && col >= self.tile_col0 && col < self.tile_col1 { - self.cells[row * self.cols + col] - } else { - None + let idx = row * self.cols + col; + if let Some(info) = self.cells[idx] { + return Some(info); + } + let [w, h] = self.cover[idx]; + if w == 0 { + return None; + } + return Some(MiInfo { + is_inter: false, + ref_frame: 0, + ref_frame1: NO_REF1, + mv: (0, 0), + mv1: (0, 0), + is_new_mv: false, + is_global_mv0: false, + is_global_mv1: false, + size: w, + size_h: h, + }); } + None } /// The unit at `(row, col)` ignoring the tile window -- the frame-level diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index f9d78e22..b0adfba2 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -6469,6 +6469,173 @@ pub(crate) mod tests { ); } + /// lane-av1-intrabc r4: the reviewer's unblock witness for the rect-strip + /// reconstruction -- a CODED `use_intrabc` block (so its residual reader + /// runs, not just the prediction copy) on a 2:1 strip in BOTH + /// orientations, plus the `TX_MODE_SELECT` (var-tx) shape, every arm + /// byte-exact against ffmpeg. + /// + /// The orientation counters (`intrabc_rect_coded_hits`) are the + /// non-vacuity instrument: [`intrabc_rect_hits`] counts neither the skip + /// flag nor the orientation, so an arm that silently became an all-skip + /// stream (or a stream with only one orientation) would keep the old gate + /// green while the coded residual path went untested + /// (class `gate-blind-to-feature`). + /// + /// # The VERT arm is also the DV-PREDICTOR regression witness + /// + /// The 512x384 arm is the stream that exposed r4's defect: 528 of 294912 + /// luma samples were wrong, all inside one `skip == 1` intrabc copy at + /// `mi(84,104)`. Its coded diff was identical to aomdec's and the post-read + /// range matched exactly (`rng=33207` both), so nothing was misread -- the + /// DV PREDICTOR differed. libaom picks `nearestmv` (`-520`) from the + /// `INTRA_FRAME` MV stack; this decoder picked `-512`, one stack entry + /// lower, because the scan that builds that stack walked further than + /// libaom's. The scans step by the candidate BLOCK's own width + /// (`mi_size_wide[bsize]`) over `xd->mi[]`, which holds an entry for every + /// coded block; this decoder's MV grid held only the intrabc blocks, so a + /// non-intrabc neighbour read as uncovered and the scan advanced that cell + /// by one instead of by its real width. See `MiGrid::cover` for the + /// measured walk. A stream that decodes the DV predictor from the wrong + /// stack entry cannot pass this arm's pixel comparison. + #[test] + fn a_coded_rect_intrabc_block_reconstructs_in_both_orientations() { + const NAME: &str = "a_coded_rect_intrabc_block_reconstructs_in_both_orientations"; + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + const TS256: &str = "testsrc2=s=256x192:r=25"; + const TS512: &str = "testsrc2=s=512x384:r=25"; + // (arm, source, width, height, per-arm overrides, the coded orientation + // this arm must exercise, and whether the frame must code + // `TX_MODE_SELECT` with `allow_intrabc` still set) + let arms: [(&str, &str, usize, usize, &[&str], u8, bool); 3] = [ + // HORZ (16x8) coded strip -- the shape the in-gate witness above + // already reconstructs, pinned here with its own orientation counter. + ("horz-coded-256-cq45-pal0-txs0", TS256, 256, 192, &["--cq-level=45", "--enable-palette=0", "--enable-tx-size-search=0"], 0, false), + // VERT (8x16) coded strip AND the DV-predictor regression stream. + ("vert-coded-512-cq45-pal1-txs0", TS512, 512, 384, &["--cq-level=45", "--enable-palette=1", "--enable-tx-size-search=0"], 1, false), + // The `TX_MODE_SELECT` (stream A) shape: `--enable-tx-size-search=1` + // makes the frame code `tx_mode == Select`, so the intrabc block's + // transform size comes off the INTER var-tx tree. + ("txmode-select-256-cq45-pal0-txs1", TS256, 256, 192, &["--cq-level=45", "--enable-palette=0", "--enable-tx-size-search=1"], 0, true), + ]; + let mut coded_total = [0usize; 2]; + let mut frames_compared = 0usize; + for (arm, src, width, height, extra, want_orient, want_select) in &arms { + let render = || { + let out = Command::new("ffmpeg") + .args([ + "-v", "error", "-f", "lavfi", "-i", *src, "-t", "0.2", "-pix_fmt", + "yuv420p", "-strict", "-1", "-f", "yuv4mpegpipe", "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!(out.status.success(), "{NAME}: ffmpeg failed for {arm}"); + out.stdout + }; + let y4m = render(); + let mut child = Command::new(aomenc_path()) + .args([ + "--codec=av1", + "--bit-depth=8", + "--input-bit-depth=8", + "--passes=1", + "--end-usage=q", + "--cpu-used=0", + "--lag-in-frames=0", + "--kf-max-dist=1", + "--limit=1", + "--threads=1", + "--tile-columns=0", + "--enable-rect-partitions=1", + "--enable-1to4-partitions=1", + "--min-partition-size=8", + "--max-partition-size=32", + "--sb-size=64", + "--tune-content=screen", + "--enable-intrabc=1", + ]) + // aomenc keeps the LAST occurrence of a repeated flag. + .args(*extra) + .args(["--obu", "-o", "-", "-"]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m) + .or_else(|e| match e.kind() { + std::io::ErrorKind::BrokenPipe => Ok(()), + _ => Err(e), + }) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "{NAME}: aomenc refused {arm}: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + if *want_select { + let (select, premise) = tx_select_and_intrabc_frames(&stream); + assert!( + select > 0 && premise > 0, + "{NAME}: {arm} no longer codes a frame with both tx_mode == Select and \ + allow_intrabc (select={select} premise={premise}), so the TX_MODE_SELECT \ + shape is untested here" + ); + } + crate::decode::reset_intrabc_rect_hits(); + let frames = decode_stream(&stream) + .unwrap_or_else(|e| panic!("{NAME}: {arm} refused: {e}")); + assert!(!frames.is_empty(), "{NAME}: {arm} decoded no frame"); + let coded = crate::decode::intrabc_rect_coded_hits(); + coded_total[0] += coded[0]; + coded_total[1] += coded[1]; + assert!( + coded[*want_orient as usize] > 0, + "{NAME}: {arm} reconstructed no CODED ({}) rect intrabc block -- the residual \ + reader for this orientation is untested (coded horz/vert = {coded:?})", + if *want_orient == 0 { "HORZ" } else { "VERT" } + ); + let theirs = ffmpeg_decode_sequence(&stream, *width, *height, frames.len()); + assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count"); + for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() { + assert!( + ours.y == ref_frame.y && ours.u == ref_frame.u && ours.v == ref_frame.v, + "{NAME}: {arm} frame {i} does not match ffmpeg" + ); + frames_compared += 1; + } + eprintln!( + "{NAME}: {arm} {} frame(s) exact, coded rect intrabc horz={} vert={}", + frames.len(), + coded[0], + coded[1] + ); + } + assert!( + coded_total[0] > 0 && coded_total[1] > 0, + "{NAME}: gate is vacuous -- coded rect intrabc blocks seen: horz={} vert={}", + coded_total[0], + coded_total[1] + ); + assert!(frames_compared > 0, "{NAME}: no frame was compared pixel-exact"); + } + /// lane-t900 r31: builds one `--tune-content=screen --enable-intrabc=1` /// key frame, 256x192 8-bit, from a deterministic lavfi source. `tiled` /// renders a 2x2 tiling of a 128x96 pattern -- exact spatial repetition, diff --git a/lanes/av1intrabc.report.md b/lanes/av1intrabc.report.md index 6e2acaf2..a0980903 100644 --- a/lanes/av1intrabc.report.md +++ b/lanes/av1intrabc.report.md @@ -31,9 +31,12 @@ In-gate (flipped pin -> witness): `stream::tests:: a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips`. Its `testsrc2-cq50-txs0` arm used to stop at the rect-strip refusal; it now decodes 1 frame, **1 intrabc block on a HORZ/VERT rect strip**, pixel-exact vs ffmpeg. -Gate totals (re-measured, reviewer-corrected): **2** intrabc blocks over **2** -arms -- 4 arms decode ZERO intrabc blocks (out of scope), 187 rect -`use_intrabc` reads, 8 frames compared, 0 mismatches, 0 named refusals. +Gate totals (re-measured at r4, on the committed tree): **5** intrabc blocks +over **5** arms -- 3 arms decode ZERO intrabc blocks (out of scope), 187 rect +`use_intrabc` reads, 8 frames compared, 0 mismatches, 0 named refusals, 1 +intrabc block on a HORZ/VERT rect strip. The r4 gate +`a_coded_rect_intrabc_block_reconstructs_in_both_orientations` adds 3 more +byte-exact frames (HORZ coded, VERT coded, TX_MODE_SELECT). Standalone recipes (aomenc oracle at `~/.cache/aom-oracle/build/aomenc`, probe `cargo run --release -p ec-av1 --example decode_probe -- `): @@ -240,3 +243,127 @@ ORDER/WEIGHT, not the DV syntax. TX_MODE_SELECT gate is still red); the batch-level suite run stays deferred. `deferred(DV-predictor candidate ordering at mi(84,104))` + +## 4d. Round 4 (2026-09-20) -- the DV predictor's root cause is BLOCK COVERAGE, not candidate weighting; stream B is byte-exact + +The remaining defect was localized to a single wrong DV at `mi(84,104)` on the +512x384 stream, with identical coded diff and identical post-read range. The +task named candidate ORDER/WEIGHT; the order was indeed wrong, but the cause is +one level down: **our intrabc MV grid only contained the intrabc blocks.** + +### Mechanism (measured, not inferred) + +libaom's `setup_ref_mv_list` row/col scans walk `xd->mi[]`, which holds an +`MB_MODE_INFO` for EVERY coded block, and step by +`mi_size_wide/height[candidate->bsize]`. Our `MiGrid` was filled only by +`record_intrabc_mi_rect`, so every intra non-intrabc neighbour read as +`None` and the scan advanced that cell by ONE instead of by the neighbour's +real width. At `mi(84,104)` (16x16, `bsize=6`) the row scan's extended offset +`-3` therefore over-reached from libaom's last probe `(81,106)` (the 8x16 +intrabc voting `-520`) to `(81,108)` -- a 16x16 intrabc voting `-512` with a +16-wide (`len 4 * weight 4`) contribution libaom never makes. + +Instrumented oracle (`~/.cache/aom-oracle`, new `EC_TRACE_STACK` / +`EC_TRACE_STACK2` prints in `setup_ref_mv_list` + `scan_row_mbmi` / +`scan_col_mbmi` / `scan_blk_mbmi`): + +``` +O EC_STACK mi_row=84 mi_col=104 ref=0 w=4 h=4 cnt=2 near_match=1 ref_match=1 \ + [0 w=656 mv=(-520,0)] [1 w=648 mv=(-512,0)] +U EC_STACK_OURS mi_row=84 mi_col=104 ... n=2 near_match=1 ref_match=1 prows=6 pcols=0 + [0 w=648 mv=(-520,0)] [1 w=664 mv=(-512,0)] +``` + +libaom's `-520` votes: `4` (row `-1`) + `4` (row `-3`) + `8` (row `-5`) = `16` +(`640 + 16 = 656`); `-512`'s: `4` (top-right `(83,108)`) + `4` (corner +`(83,103)`) = `8` (`648`). Ours lost `-520`'s `8` (the row `-5` contribution) +and gained `-512` `+16` from the over-reach, so the weight sort flipped: +`nearestmv` became `-512` where libaom's is `-520`, and +`dv = ref + diff = -512 + 8 = -504` instead of `-520 + 8 = -512`. One whole-pel +wrong `skip == 1` copy; the 528 wrong luma samples are that copy plus the +region that inherits its 1-px shift. + +### Fix + +`MiGrid` gained a block-COVERAGE map (`cover: Vec<[u8; 2]>`, the covering +coded block's own `(width, height)` in mi units) with `MiGrid::cover_rect`; +`MiGrid::get` returns the stored `MiInfo` when there is one and otherwise +synthesizes a non-inter entry (`is_inter == false`, zero MV) from the cover, so +a candidate that casts no vote still advances the scan by its real width -- +exactly libaom's `xd->mi[]` semantics. `single_ref_match` rejects a non-inter +unit, so a synthetic entry can never vote. + +The map is published for EVERY coded block from `Neighbours::fill_lf_grid_rect` +(the one place every block's mi span already passes through, paired 1:1 with +`fill_skip_grid_rect`), and only when the frame has an MV grid at all +(`intrabc_mi_grid` is `Some` exactly when `allow_intrabc`), so an inter frame +and the tile writer's own grid are untouched: an unfilled cover reads as +uncovered and reproduces the old `None`-per-cell behaviour exactly. + +### Byte-exactness after the fix + +| stream | before | now | +|---|---|---| +| B 512x384 testsrc2 cq45 `--enable-palette=1 --enable-tx-size-search=0` | 528/294912 luma | **BYTE-EXACT** (`cmp` vs ffmpeg `-pix_fmt yuv420p`) | +| A 256x192 testsrc2 cq45 var-tx (`--enable-tx-size-search=1`) | BYTE-EXACT | **BYTE-EXACT** | + +Standalone arms re-run (all `cmp`-exact against ffmpeg): `cq50p0-txs0`, +`cq45p0-txs0`, `cq45p1-txs0`, `cq50p0-txs0`, `cq50p0-1to4-off`, `minp4` +(`--min-partition-size=4 --max-partition-size=16`), `cq50-txs1-1to4-off`. The +`(84,104)` DV trace now reads `dv_row=-512 rng=33207`, the oracle's own value. + +### New reviewer-unblock gate + +`stream::tests::a_coded_rect_intrabc_block_reconstructs_in_both_orientations` +-- three arms, ALL frames byte-exact against ffmpeg, each asserting the arm +reconstructed a CODED (`skip == 0`) rect intrabc block in the orientation it +names: + +- `horz-coded-256-cq45-pal0-txs0` -- 16x8 coded strip, HORZ. +- `vert-coded-512-cq45-pal1-txs0` -- 8x16 coded strip, VERT, **and the + DV-predictor regression stream** (this is stream B). +- `txmode-select-256-cq45-pal0-txs1` -- stream A's shape; the arm re-derives + `tx_mode == Select && allow_intrabc` out of the frame header rather than + trusting the encoder flags. + +New instrument `decode::intrabc_rect_coded_hits() -> [horz, vert]` (bumped in +`decode_intrabc_rect` when `!skip`, indexed by `bh > bw`): the old +`intrabc_rect_hits` counts neither the skip flag nor the orientation, so an arm +that quietly became all-skip or single-orientation would keep it green +(`gate-blind-to-feature`). + +**Non-vacuity (fail-pre-fix, measured):** with only the `MiGrid::get` cover +fallback neutralized (the fix's load-bearing line) and nothing else touched, +the gate fails exactly where it must -- + +``` +horz-coded-256-cq45-pal0-txs0 ... exact, coded rect intrabc horz=1 vert=0 +vert-coded-512-cq45-pal1-txs0 frame 0 does not match ffmpeg +test ... FAILED +``` + +and passes again with the line restored. + +### Gates run this round + +- `cargo check -p ec-av1 --all-targets` -> 0 warnings. +- New gate (3 arms, 3 frames, byte-exact; fail-pre-fix proven above). +- `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` -> ok + (187 rect reads, 5 intrabc blocks over 5 arms, 8 frames compared, 0 + refused, 0 mismatched, 1 rect-strip block). +- `an_intrabc_block_under_tx_mode_select_decodes_pixel_exact` -> ok + (cq30 16 blocks / 1 var-tx, cq45 12 blocks / 3 var-tx). +- Refusal suite `-- refusal` -> **21 passed**. `reelb` -> 3 passed. + `monochrome` -> 1 passed. `cdf` -> 13 passed. `non_420` -> 1 passed. +- Full `--lib` suite: FILLED IN BELOW by the round-4 batch run on the committed tree. + +### Deferred / open + +- 1:4 pair-strip intrabc -- unchanged, named in ยง3. +- The cover records the mi span its `fill_lf_grid_rect` caller passes; a + sub-8x8 leaf publishes a 4x4 (1x1 mi) or an 8x8-square span exactly as its + own `fill_skip_grid`/`fill_lf_grid` call already does, so the coverage map + inherits that convention. No gate or arm reaches a sub-8x8 neighbour of an + intrabc block today; if one ever does, the leaf's true `bsize` dims are what + libaom's `mi_size_wide/height[candidate->bsize]` would report. +