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m^y@BSq82!ioWXKOx0--?aY^;>VC7HBL%B{
zoTQji%bTr5XQeyhsx39W|C>-zzljxm%Jw^acRBg=?B<;&Z-cP%?-`{rC{Z3oX0%FG
zl%Zw6-S>osHo6nd!pSaoCL()N%O6)m;*I4i4Qn#Oc=s~bNkM}%`}V)`Pz#F)Ug?UU
zW%$+|V!&1G+?)$Eq(H@4b-5;rr0u6uUXHY7GUZs0c{CZ^7bahyID|%URjKT!@6gN3
z+pUR9`o%^{q`%L&qXeW`;8}K5>%;BDtSBLt^uqIEA4EQO@*8otmaTdqj)}C%dZS>_
z#_*4R-72s~Ny^H{u<@Mch}aG}Lkgxn12IeEA^aL{RKuY(YyMc)Lk}sOHrZP1v4KQ{
z-V@!VW`AbW@0WATLJ!j-9r}YzFqv|of}r>L-I8*YDHdc_fo8+pk;xy_eQe7)6Uz8@
zotw_fR#FxhA0aJ-uWhTDQY%LDapX&I=PrplK0l>8FeWHRwIDL8uxN%Nx*~jgkDggd
zt=~{Jw*q8xkNh6-xfr$l%~N{_lL91cDbk&)s9am4%`3)=?sjaLT4Q3XCDaxsqYCU|
z46mIJ#1zyfz&H;yO76Rrw$ACtwan5{#LjA?GB5GPtw*?RJQp9*Gg%E`1I2wtB}z#L
KLhb{2>JRXQ49MvK
literal 0
HcmV?d00001
diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs
index 28088ec5..e02568de 100644
--- a/crates/ec-av1/src/decode.rs
+++ b/crates/ec-av1/src/decode.rs
@@ -2691,6 +2691,21 @@ thread_local! {
static INTER16_SUB8_PIECE_HITS: std::cell::Cell = const { std::cell::Cell::new(0) };
}
+// lane-intra16x4: INTRA-coded strips of an inter 16x16-level 1:4 partition --
+// [0] 16x4, [1] 4x16, [2] the odd (chroma-reference) ones, which carry the
+// pair's single 8x4 (4x8) chroma unit for BOTH strips.
+thread_local! {
+ static INTRA16X4_IN_INTER_HITS: std::cell::Cell<[usize; 3]> =
+ const { std::cell::Cell::new([0; 3]) };
+}
+
+/// `(intra 16x4 strips, intra 4x16 strips, of which chroma-reference)` decoded
+/// inside an INTER 16x16-level 1:4 partition (lane-intra16x4).
+pub fn intra16x4_in_inter_hits() -> (usize, usize, usize) {
+ let v = INTRA16X4_IN_INTER_HITS.with(std::cell::Cell::get);
+ (v[0], v[1], v[2])
+}
+
/// Current values of the inter 16x16-level 1:4 counters: `(16x4 strips, 4x16
/// strips, chroma pairs closed, chroma pairs built from two different
/// strips' motion vectors)`.
@@ -3108,6 +3123,24 @@ thread_local! {
/// inter leaves (lane-intersub8 r3), indexed `[0] = HORZ` (two BLOCK_8X4),
/// `[1] = VERT` (two BLOCK_4X8).
static SUB8_INTER_RECT_HITS: std::cell::Cell<[usize; 2]> = const { std::cell::Cell::new([0; 2]) };
+ /// lane-sub8intra: INTRA leaves decoded inside an inter frame's sub-8x8
+ /// HORZ/VERT partition -- `[0]` 8x4, `[1]` 4x8, `[2]` of those that were
+ /// the chroma reference (so coded the group's 4x4 chroma intra), `[3]`
+ /// MIXED groups whose chroma reference is INTER while its sibling is
+ /// intra (the `is_sub8x8_inter` false path), `[4]` INTRA `BLOCK_4X4`
+ /// leaves of an inter frame's sub-8x8 `PARTITION_SPLIT` (lane-sub8x4 r2 --
+ /// the second lifted refusal's own witness; `[0]`/`[1]` count those too,
+ /// so only this cell separates the split arm from the HORZ/VERT one).
+ static SUB8_INTRA_RECT_HITS: std::cell::Cell<[usize; 5]> = const { std::cell::Cell::new([0; 5]) };
+}
+
+/// Current value of [`SUB8_INTRA_RECT_HITS`]: `(8x4, 4x8, chroma-reference,
+/// mixed groups, split 4x4 leaves)`.
+pub fn sub8_intra_rect_hits() -> (usize, usize, usize, usize, usize) {
+ SUB8_INTRA_RECT_HITS.with(|c| {
+ let h = c.get();
+ (h[0], h[1], h[2], h[3], h[4])
+ })
}
/// Current value of [`SUB8_INTER_RECT_HITS`]: `(8x4 groups, 4x8 groups)`.
@@ -4986,6 +5019,9 @@ impl Neighbours {
tx_h_px: u8,
) {
let (mi_r, mi_c) = at_mi;
+ if std::env::var_os("EC_TXGRID_TRACE").is_some() {
+ eprintln!("EC_LFLEAF mi_row={mi_r} mi_col={mi_c} w_mi={w_mi} h_mi={h_mi} tx_px={tx_px} tx_h_px={tx_h_px}");
+ }
for rr in 0..h_mi {
for cc in 0..w_mi {
let idx = (mi_r + rr) * self.skip_grid_cols_mi + (mi_c + cc);
@@ -5381,7 +5417,8 @@ impl Neighbours {
let ctx = SKIP_CONTEXTS[(top as usize).min(4)][(left as usize).min(4)];
if std::env::var_os("EC_AV1_TRACE").is_some() {
eprintln!(
- "TRACE luma_skip_ctx mi=({mi_r},{mi_c}) side_mi={side_mi} top={top} left={left} ctx={ctx}"
+ "TRACE luma_skip_ctx mi=({mi_r},{mi_c}) side_mi={side_mi} top={top} left={left} ctx={ctx} band={:?}",
+ self.left.iter().map(|e| e[0].level).collect::>()
);
}
ctx
@@ -6866,14 +6903,14 @@ fn decode_rect_split(
// the coded unit is the 32x32 corner [`decode_block_rect64`]'s own
// depth-0 arm already reads on the key-frame path.
//
- // NO WITNESS YET (r1, measured): on both 10-bit 3840x1608 film cuts
- // this arm fires (16x 64x32 + 2x 32x64 / 2x 32x64) but the SAME frame
- // then stops at "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs
- // rectangular residual coding", so no frame containing it ever
- // finishes and no pixel comparison is possible. A refusal is lifted
- // only with a gate (COMMON charter), so the arm stays behind
- // `EC_RECT64_SPLIT=1` and the refusal below is still the default.
- (64, 32) | (32, 64) if std::env::var_os("EC_RECT64_SPLIT").is_some() => None,
+ // lane-sub8x4 r3: WITNESS FOUND, so this is no longer behind
+ // `EC_RECT64_SPLIT`. r1's "no witness" was true only while the
+ // sub-8x8 intra leaves still refused: with those lifted (r2) the
+ // first 50 frame OBUs of the 10-bit 3840x1608 stream's head decode
+ // all 33 frames pixel-exact against ffmpeg while this arm fires 90x
+ // 64x32 + 5x 32x64 -- pinned as `fixtures/reelb_rect64_intra16x4_witness.obu`
+ // and gated by `a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus_decode_pixel_exact`.
+ (64, 32) | (32, 64) => None,
_ => {
return Err(unsupported(format!(
"a split intra strip whose transform unit is {tx_w}x{tx_h} (no luma \
@@ -7237,6 +7274,9 @@ fn decode_intra_rect_in_inter(
bh: usize,
skip: bool,
allow_screen_content_tools: bool,
+ // `(PARTITION_HORZ_4, is_chroma_reference)` when this strip is one of the
+ // four 16x4 / 4x16 strips of a 16x16-level 1:4 partition (lane-intra16x4).
+ strip16: Option<(bool, bool)>,
y: &mut PlaneBuf,
u: &mut PlaneBuf,
v: &mut PlaneBuf,
@@ -7253,6 +7293,94 @@ fn decode_intra_rect_in_inter(
// finding -- the category is NOT the same for every strip size).
// A 1:4 strip breaks that diagonal (BLOCK_32X8 is group 1 but cat 2), so
// it is refused by name rather than read from the wrong CDF row.
+ // lane-intra16x4: the 16x16-level 1:4 strip. `size_group_lookup`
+ // (common_data.h:61) puts BLOCK_16X4/BLOCK_4X16 in group 0 and its
+ // tx-depth category is 1 -- but nothing here has to know either, because
+ // the strip decodes through the very body the KEY FRAME path proves for
+ // this shape ([`decode_rect4_16_strip`]), including the 4:2:0 chroma
+ // pairing (`is_chroma_reference`: strips 0 and 2 read no chroma at all,
+ // strips 1 and 3 code one 8x4 (4x8) unit at the PAIR's origin). The only
+ // inter-frame difference is the mode-info read, which
+ // [`INTRA_IN_INTER_MODE`] switches to `read_intra_block_mode_info`'s
+ // `y_mode[0]` plus the `skip` this caller already read.
+ if let Some((horz, has_chroma)) = strip16 {
+ if allow_screen_content_tools {
+ return Err(unsupported(
+ "a HORZ/VERT intra strip in a screen-content frame (palette syntax \
+ is consumed for square blocks only)",
+ ));
+ }
+ debug_assert_eq!((bw, bh), if horz { (16, 4) } else { (4, 16) });
+ INTRA_IN_INTER_MODE.with(|c| c.set(Some((0, skip))));
+ let res = decode_rect4_16_strip(
+ dec,
+ cdfs,
+ neighbours,
+ (mi_r, mi_c),
+ horz,
+ has_chroma,
+ // The inter strips of the same partition publish their own
+ // mi-exact mode, so the key-frame caller's coarse-cell stand-in
+ // has nothing to add here.
+ None,
+ y,
+ u,
+ v,
+ ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get),
+ allow_screen_content_tools,
+ base_q_idx,
+ TX_SELECT_INTER.with(std::cell::Cell::get),
+ REDUCED_TX_SET_INTER.with(std::cell::Cell::get),
+ );
+ INTRA_IN_INTER_MODE.with(|c| c.set(None));
+ let (mode, uv, (tx_w, tx_h)) = res?;
+ // lane-intra16x4, the same publication the 2:1 intra-in-inter strip
+ // makes ([`decode_intra_rect_in_inter`]'s own tail): libaom runs
+ // `set_txfm_ctxs(tx_size, n4_w, n4_h, skip && is_inter, xd)` for EVERY
+ // block of an inter frame, intra ones included, and
+ // `txfm_partition_update` for the var-tx context. The key-frame body
+ // writes neither (a key frame has no var-tx tree and its own readers
+ // use the deblock grid), so the block AFTER this strip read a stale
+ // band -- measured: a 128x128 8-bit stream decoded the two intra 16x4
+ // strips at mi(23,16)/(23,20) exactly and then broke on the very next
+ // 16x16 row.
+ txfm_partition_update_rect(neighbours, (mi_r, mi_c), (tx_w, tx_h), (bw, bh));
+ for i in 0..bw / MI {
+ if let Some(cell) = neighbours.above_txfm.get_mut(mi_c + i) {
+ *cell = tx_w as u8;
+ }
+ }
+ for i in 0..bh / MI {
+ if let Some(cell) = neighbours.left_txfm.get_mut(mi_r + i) {
+ *cell = tx_h as u8;
+ }
+ }
+ // [`decode_rect4_16`]'s own post-loop publication, per strip (the
+ // coarse 16-px cell holds one entry for the whole 16x16 and the last
+ // block to write it wins).
+ neighbours.above_mode[c] = mode;
+ neighbours.left_mode[r] = mode;
+ if let Some(uvm) = uv {
+ neighbours.above_uv_mode[c] = uvm;
+ neighbours.left_uv_mode[r] = uvm;
+ }
+ neighbours.above_side[c] = bw;
+ neighbours.left_side[r] = bh;
+ if std::env::var_os("EC_INTRA16X4").is_some() {
+ eprintln!(
+ "EC_INTRA16X4 decoded mi={mi_r},{mi_c} px={},{} horz={horz} has_chroma={has_chroma} skip={skip} mode={mode} uv={uv:?}",
+ mi_c * MI,
+ mi_r * MI
+ );
+ }
+ INTRA16X4_IN_INTER_HITS.with(|h| {
+ let mut v = h.get();
+ v[usize::from(!horz)] += 1;
+ v[2] += usize::from(has_chroma);
+ h.set(v);
+ });
+ return Ok(());
+ }
let (size_group, tx_cat) = match (bw.min(bh), bw.max(bh)) {
(8, 16) => (1usize, 1usize),
(16, 32) => (2, 2),
@@ -8756,6 +8884,72 @@ fn decode_rect4_16(
(mi_row0, mi_col0 + i)
};
let has_chroma = i % 2 == 1;
+ let (mode, uv, _tx) = decode_rect4_16_strip(
+ dec,
+ cdfs,
+ neighbours,
+ lmi,
+ horz,
+ has_chroma,
+ prev,
+ y,
+ u,
+ v,
+ enable_filter_intra,
+ allow_screen_content_tools,
+ base_q_idx,
+ tx_select,
+ reduced_tx_set,
+ )?;
+ if let Some(m) = uv {
+ last_uv_mode = m;
+ }
+ last_mode = mode;
+ prev = Some((lmi, mode));
+ }
+ // The coarse 16-px cell holds one entry for the whole 16x16: the last
+ // strip is what a block below (right) sees through it, the mi-exact maps
+ // above answering everything finer.
+ neighbours.above_mode[c] = last_mode;
+ neighbours.left_mode[r] = last_mode;
+ neighbours.above_uv_mode[c] = last_uv_mode;
+ neighbours.left_uv_mode[r] = last_uv_mode;
+ neighbours.above_side[c] = bw;
+ neighbours.left_side[r] = bh;
+ Ok(())
+}
+
+/// One 16x4 / 4x16 strip of a 16x16-level 1:4 partition, intra-coded --
+/// [`decode_rect4_16`]'s per-strip body, lifted (lane-intra16x4) so the INTER
+/// block path can decode a SINGLE intra strip of a partition whose other
+/// strips are inter. `prev` is the previous strip's `(mi, mode)` (the
+/// key-frame caller's coarse-cell stand-in; `None` on the inter path, where
+/// every strip publishes its own mi-exact mode). Returns
+/// `(y_mode, uv_predict_mode when this strip closes the 4:2:0 chroma pair)`.
+#[allow(clippy::too_many_arguments)]
+fn decode_rect4_16_strip(
+ dec: &mut SymbolDecoder,
+ cdfs: &mut Cdfs,
+ neighbours: &mut Neighbours,
+ lmi: (usize, usize),
+ horz: bool,
+ has_chroma: bool,
+ prev: Option<((usize, usize), usize)>,
+ y: &mut PlaneBuf,
+ u: &mut PlaneBuf,
+ v: &mut PlaneBuf,
+ enable_filter_intra: bool,
+ allow_screen_content_tools: bool,
+ base_q_idx: u8,
+ tx_select: bool,
+ reduced_tx_set: bool,
+) -> Result<(usize, Option, (usize, usize))> {
+ let (r, c) = (lmi.0 / (SUB / MI), lmi.1 / (SUB / MI));
+ let (bw, bh) = if horz { (16usize, 4usize) } else { (4, 16) };
+ let (mi_w, mi_h) = (bw / MI, bh / MI);
+ let scan: &[u16] = if horz { &SCAN_16X4 } else { &SCAN_4X16 };
+ let chroma_scan: &[u16] = if horz { &SCAN_8X4 } else { &SCAN_4X8 };
+ let mut last_uv_mode: Option = None;
// `decode_block_rect4`'s own neighbour rule: the coarse 16-px cell
// aliases all four strips onto one entry, so the mi-exact map wins and
// the previous strip stands in on the split axis.
@@ -8829,7 +9023,16 @@ fn decode_rect4_16(
// depth symbol is the 3-symbol `tx_size_cat1` -- not the 2-symbol
// `cat0` a 4x8 leaf reads nor the `cat2` a 32x8 strip does.
let depth = if tx_select {
- let ctx = tx_size_context_rect(neighbours, lmi, bw, bh);
+ // lane-intra16x4: on an INTER frame `get_tx_size_context` reads the
+ // real `TXFM_CONTEXT` bands ([`tx_size_context_txfm_rect`], what
+ // the 2:1 intra-in-inter strip already does); the key frame's
+ // deblock-grid approximation is only right where those bands were
+ // never written.
+ let ctx = if INTRA_IN_INTER_MODE.with(std::cell::Cell::get).is_some() {
+ tx_size_context_txfm_rect(neighbours, lmi, bw, bh)
+ } else {
+ tx_size_context_rect(neighbours, lmi, bw, bh)
+ };
dec.symbol(&mut cdfs.tx_size_cat1[ctx])
} else {
0
@@ -9171,7 +9374,7 @@ fn decode_rect4_16(
slot[2] = v_state;
}
}
- last_uv_mode = uv_predict_mode;
+ last_uv_mode = Some(uv_predict_mode);
}
if horz {
RECT4_16_HORZ_HITS.with(|h| h.set(h.get() + 1));
@@ -9185,21 +9388,10 @@ fn decode_rect4_16(
record_strip_palette(
neighbours, lmi, bw, bh, pal_y_size, pal_y_colors, pal_uv_size, pal_uv_colors,
);
- last_mode = mode;
- prev = Some((lmi, mode));
- }
- // The coarse 16-px cell holds one entry for the whole 16x16: the last
- // strip is what a block below (right) sees through it, the mi-exact maps
- // above answering everything finer.
- neighbours.above_mode[c] = last_mode;
- neighbours.left_mode[r] = last_mode;
- neighbours.above_uv_mode[c] = last_uv_mode;
- neighbours.left_uv_mode[r] = last_uv_mode;
- neighbours.above_side[c] = bw;
- neighbours.left_side[r] = bh;
- Ok(())
+ Ok((mode, last_uv_mode, (tx_w, tx_h)))
}
+
/// Decodes one true `bw`x`bh` superblock-level `PARTITION_HORZ`/
/// `PARTITION_VERT` strip (lane-sbpart r2, `bw, bh` one of `(64, 32)` /
/// `(32, 64)` -- [`decode_block_rect`]'s own sibling one level up). Unlike
@@ -13158,6 +13350,19 @@ fn tx_size_context_txfm_rect(
if has_left && n.left_inter[mi_r] {
left = n.left_side_mi[mi_r] >= own_h;
}
+ if std::env::var_os("EC_TXCTX").is_some() {
+ eprintln!(
+ "EC_TXCTX mi={mi_r},{mi_c} own={own_w}x{own_h} ha={has_above} hl={has_left} \
+ above_txfm={} left_txfm={} above_inter={} left_inter={} above_side={} left_side={} \
+ above={above} left={left}",
+ n.above_txfm[mi_c],
+ n.left_txfm[mi_r],
+ n.above_inter[mi_c],
+ n.left_inter[mi_r],
+ n.above_side_mi[mi_c],
+ n.left_side_mi[mi_r],
+ );
+ }
match (has_above, has_left) {
(true, true) => usize::from(above) + usize::from(left),
(true, false) => usize::from(above),
@@ -17929,10 +18134,17 @@ fn ref_planes<'a>(
/// unit at a time, and does not itself count as a step). `max_neighbors`
/// caller-bounds the scan: `1` for the eligibility check (any hit at all),
/// `av1_build_obmc_inter_prediction`'s own `max_neighbor_obmc` table for the
-/// real blend pass. Round 1 corner-cut: libaom's own "4-wide block, treat as
-/// half of a chroma pair" merge (`obmc.h`'s `mi_step == 1` special case) is
-/// not ported -- no block this decoder codes is narrower than 8px, so it
-/// never fires here regardless of what a neighbour's own decoder was.
+/// real blend pass. lane-intra16x4 r2: libaom's own "4-wide block, treat as
+/// half of a chroma pair" merge (`obmc.h`'s `mi_step == 1` special case) IS
+/// ported below -- the round-1 note that no block is narrower than 8px stopped
+/// being true when the 1:4 partitions landed. A 16x4 / 4x16 strip has
+/// `mi_size_high`/`mi_size_wide` 1, so libaom snaps the walk back to the pair's
+/// even index, reads the ODD (chroma-carrying) half as the neighbour and steps
+/// by 2. Measured: the 16x16 block right of a 16x16-level HORZ_4 partition
+/// whose strip 0 is inter and strips 1..3 intra counted that inter strip as
+/// overlappable here, while libaom's pair merge reads the INTRA strip 1 and
+/// counts none -- so we read a `motion_mode` symbol libaom never wrote (class
+/// `symbol-consumption-gap`), desyncing the tile at the next coefficient.
fn overlappable_above(
grid: &MiGrid,
mi_row: usize,
@@ -17949,8 +18161,17 @@ fn overlappable_above(
let mut col = mi_col;
while col < end_col && out.len() < max_neighbors {
let cell = grid.get(mi_row - 1, col);
- let step = cell.map_or(1, |c| c.size).max(1);
- if let Some(info) = cell {
+ let mut step = cell.map_or(1, |c| c.size).max(1).min(SB_MI as usize);
+ let mut nb = cell;
+ if step == 1 {
+ // The pair merge: the walk snaps back to the pair's even column
+ // and the ODD half (the chroma-carrying one) is the neighbour for
+ // both -- a 4-wide 1:4 strip is never an OBMC source on its own.
+ col &= !1;
+ nb = grid.get(mi_row - 1, col + 1);
+ step = 2;
+ }
+ if let Some(info) = nb {
if info.is_inter {
out.push((col - mi_col, step.min(end_col - col), *info));
}
@@ -17980,8 +18201,17 @@ fn overlappable_left(
let cell = grid.get(row, mi_col - 1);
// Vertical walk steps by the neighbour's HEIGHT -- a 32x16 strip's
// width (8) would swallow the strip below it.
- let step = cell.map_or(1, |c| c.size_h).max(1);
- if let Some(info) = cell {
+ let mut step = cell.map_or(1, |c| c.size_h).max(1).min(SB_MI as usize);
+ let mut nb = cell;
+ if step == 1 {
+ // The pair merge, left-column mirror: a 4-TALL neighbour (a 16x4
+ // strip) is half of a chroma pair and the pair's SECOND row is the
+ // neighbour for both.
+ row &= !1;
+ nb = grid.get(row + 1, mi_col - 1);
+ step = 2;
+ }
+ if let Some(info) = nb {
if info.is_inter {
out.push((row - mi_row, step.min(end_row - row), *info));
}
@@ -21672,7 +21902,38 @@ fn decode_inter_block(
// footprint), so an INTRA 16x4 / 4x16 strip inside a 1:4 partition is
// refused by name rather than decoded with a 8x2 chroma transform
// libaom never coded.
- if write_w.min(write_h) < 8 {
+ // lane-intra16x4 r1: the strip DECODES through the key frame's own
+ // per-strip body, [`decode_rect4_16_strip`].
+ // lane-sub8x4 r3: pixel-proven, so `EC_INTRA16X4_DECODE` is gone. r1
+ // and r2 found no witness because every firing film frame ALSO carried
+ // a sub-8x8 intra block, which refused until r2 lifted it; on this tip
+ // the first 50 frame OBUs of the 10-bit 3840x1608 stream's head decode
+ // all 33 frames pixel-exact while this arm fires 31x 16x4 + 17x 4x16
+ // (23 of them chroma-paired). Pinned as
+ // `fixtures/reelb_rect64_intra16x4_witness.obu`, gated by
+ // `a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus_decode_pixel_exact`.
+ // The refusal below is NARROWED, not deleted: it still stands for a
+ // 16x4/4x16 strip with no chroma-pair record and for every other
+ // sub-8 shape.
+ let strip16 = strip_chroma
+ .filter(|_| write_w.min(write_h) == 4 && write_w.max(write_h) == 16)
+ .map(|s| (s.horz, s.has_chroma));
+ if write_w.min(write_h) < 8 && strip16.is_none() {
+ if std::env::var_os("EC_INTRA16X4").is_some() {
+ let (idx, hc, prev_inter) = match strip_chroma {
+ Some(s) => (
+ if s.horz { rmi - s.pair_mi.0 } else { cmi - s.pair_mi.1 },
+ s.has_chroma,
+ s.prev.is_some(),
+ ),
+ None => (9, true, false),
+ };
+ eprintln!(
+ "EC_INTRA16X4 w={write_w} h={write_h} pair_parity={idx} has_chroma={hc} prev_single_inter={prev_inter} skip={skip} mi={rmi},{cmi} tx_select={} scr={}",
+ TX_SELECT_INTER.with(std::cell::Cell::get),
+ allow_screen_content_tools,
+ );
+ }
return Err(unsupported(
"an intra 16x4/4x16 strip inside an inter 16x16-level 1:4 partition (its 4:2:0 chroma pair is coded once for two strips; only the inter path implements that pairing)",
));
@@ -21695,6 +21956,7 @@ fn decode_inter_block(
write_h,
skip,
allow_screen_content_tools,
+ strip16,
y,
u,
v,
@@ -22439,6 +22701,9 @@ fn decode_inter_sub8_split4(
[None; 4];
let mut first_tx_type = TxType::DctDct;
let mut last_skip = true;
+ // Set when the chroma-reference (last) sub-block is INTRA: it coded the
+ // group's one chroma unit itself.
+ let mut intra_chroma = false;
for i in 0..4usize {
let (dr, dc) = (i / 2, i % 2);
let lmi = (gr + dr, gc + dc);
@@ -22467,10 +22732,48 @@ fn decode_inter_sub8_split4(
);
let is_inter = dec.symbol(&mut cdfs.intra_inter[ii_ctx]) == 1;
if !is_inter {
- return Err(unsupported(
- "an intra 4x4 block inside an inter frame's sub-8x8 split (this decoder codes \
- only inter 4x4 sub-blocks there)",
- ));
+ if std::env::var_os("EC_SUB8INTRA").is_some() {
+ eprintln!(
+ "EC_SUB8INTRA shape=4x4 sub={i} has_chroma={} skip={skip} mi={rmi},{cmi} tx_select={}",
+ i == 3,
+ TX_SELECT_INTER.with(std::cell::Cell::get),
+ );
+ }
+ // lane-sub8x4 r2: the refusal and its `EC_SUB8INTRA_DECODE` bypass
+ // are gone -- `a_real_aomenc_inter_sequence_with_intra_sub8x8_
+ // leaves_decodes_pixel_exact` (stream.rs) decodes 12 real aomenc
+ // streams carrying this arm pixel-exact vs ffmpeg.
+ SUB8_INTRA_RECT_HITS.with(|h| {
+ let mut st = h.get();
+ st[4] += 1;
+ h.set(st);
+ });
+ // lane-sub8intra: the `BLOCK_4X4` twin of the HORZ/VERT arm --
+ // same [`decode_intra_sub8_leaf`], no tx-depth symbol, chroma on
+ // the LAST sub-block (`is_chroma_reference` under 4:2:0).
+ decode_intra_sub8_leaf(
+ dec,
+ cdfs,
+ neighbours,
+ grid,
+ group_mi,
+ lmi,
+ (B4, B4),
+ i == 3,
+ skip,
+ scan4,
+ y,
+ u,
+ v,
+ base_q_idx,
+ ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get),
+ TX_SELECT_INTER.with(std::cell::Cell::get),
+ reduced_tx_set,
+ )?;
+ if i == 3 {
+ intra_chroma = true;
+ }
+ continue;
}
// Same print point as the oracle's `EC_MODE` (entry of
// `read_inter_block_mode_info`, i.e. after skip / is_inter), so the
@@ -22691,11 +22994,14 @@ fn decode_inter_sub8_split4(
None,
None,
)?;
- if i == 0 {
+ if i == 0 || piece[0].is_none() {
// `av1_get_tx_type`: an inter block's chroma inherits the
// tx_type of the CO-LOCATED luma position, which for the
// group's one chroma unit is luma (0, 0) -- the FIRST
- // sub-block, not the last.
+ // sub-block, not the last. lane-sub8intra: an INTRA first
+ // sub-block writes no inter tx_type there at all, so the
+ // later inter sub-blocks' own is what `xd->tx_type_map`
+ // holds.
first_tx_type = tx_type;
}
neighbours.record_mi_luma_rect(lmi, B4, B4, &luma_grid);
@@ -22712,59 +23018,98 @@ fn decode_inter_sub8_split4(
neighbours.fill_lf_grid_rect(lmi, 1, 1, B4 as u8, B4 as u8, ref_frame.max(LAST_FRAME));
last_skip = skip;
}
- // Chroma, once for the whole group, on the last sub-block's own `skip`
- // flag -- prediction from all four sub-blocks (2x2 pieces), residual as
- // one TX_4X4 unit per plane.
- let mut pred_u = vec![0u16; B4 * B4];
- let mut pred_v = vec![0u16; B4 * B4];
- for i in 0..4usize {
- let (dr, dc) = (i / 2, i % 2);
- let Some((ref_frame, mv, h_filter, v_filter)) = piece[i] else {
- continue;
- };
- let (_, sref_u, sref_v) = ref_planes(ref_frame, ref_y, ref_u, ref_v, other_refs)?;
- let (ox, oy) = (cpx + dc * 2, cpy + dr * 2);
- for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] {
- let mut buf = vec![0u16; 4];
- mc::predict_with_filters(
- &plane.data,
- plane.width,
- plane.true_width,
- plane.true_height,
- mv_to_q4(ox, mv.1, false),
- mv_to_q4(oy, mv.0, false),
- 2,
- 2,
- h_filter,
- v_filter,
- &mut buf,
- );
- for row in 0..2 {
- for col in 0..2 {
- dst[(dr * 2 + row) * B4 + dc * 2 + col] = buf[row * 2 + col];
+ // lane-sub8intra: when the chroma-reference sub-block was INTRA it coded
+ // and reconstructed the group's one chroma unit itself.
+ if !intra_chroma {
+ // Chroma, once for the whole group, on the last sub-block's own `skip`
+ // flag -- prediction from all four sub-blocks (2x2 pieces), residual as
+ // one TX_4X4 unit per plane.
+ let mut pred_u = vec![0u16; B4 * B4];
+ let mut pred_v = vec![0u16; B4 * B4];
+ // `is_sub8x8_inter` (reconinter_template.inc:54) is false as soon as ANY
+ // mi of the group is intra: the group's 4x4 chroma is then predicted WHOLE
+ // from the chroma-reference (last) sub-block's own mv, not in 2x2 pieces.
+ let mixed = piece.iter().any(Option::is_none);
+ if mixed {
+ SUB8_INTRA_RECT_HITS.with(|h| {
+ let mut st = h.get();
+ st[3] += 1;
+ h.set(st);
+ });
+ }
+ for i in 0..4usize {
+ let (dr, dc) = (i / 2, i % 2);
+ if mixed && i != 3 {
+ continue;
+ }
+ let Some((ref_frame, mv, h_filter, v_filter)) = piece[i] else {
+ continue;
+ };
+ let (_, sref_u, sref_v) = ref_planes(ref_frame, ref_y, ref_u, ref_v, other_refs)?;
+ let (ox, oy) = if mixed {
+ (cpx, cpy)
+ } else {
+ (cpx + dc * 2, cpy + dr * 2)
+ };
+ let (pw, ph) = if mixed { (B4, B4) } else { (2, 2) };
+ let (row0, col0) = if mixed { (0, 0) } else { (dr * 2, dc * 2) };
+ for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] {
+ let mut buf = vec![0u16; pw * ph];
+ mc::predict_with_filters(
+ &plane.data,
+ plane.width,
+ plane.true_width,
+ plane.true_height,
+ mv_to_q4(ox, mv.1, false),
+ mv_to_q4(oy, mv.0, false),
+ pw,
+ ph,
+ h_filter,
+ v_filter,
+ &mut buf,
+ );
+ for row in 0..ph {
+ for col in 0..pw {
+ dst[(row0 + row) * B4 + col0 + col] = buf[row * pw + col];
+ }
}
}
}
+ let (u_grid, v_grid) = if last_skip {
+ u.reconstruct_mc(cpx, cpy, B4, &pred_u, &vec![0i32; B4 * B4]);
+ v.reconstruct_mc(cpx, cpy, B4, &pred_v, &vec![0i32; B4 * B4]);
+ (vec![0i32; B4 * B4], vec![0i32; B4 * B4])
+ } else {
+ let around = neighbours.around_mi(group_mi, 8);
+ let ug = read_inter_plane(
+ dec, cdfs, TxbSet::Chroma4, scan4, 1, around[1], 0, u, cpx, cpy, B4, base_q_idx,
+ &pred_u, Some(first_tx_type), None,
+ )?
+ .0;
+ let vg = read_inter_plane(
+ dec, cdfs, TxbSet::Chroma4, scan4, 2, around[2], 0, v, cpx, cpy, B4, base_q_idx,
+ &pred_v, Some(first_tx_type), None,
+ )?
+ .0;
+ (ug, vg)
+ };
+ neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED);
+ let round_up_even = |n: usize| n.div_ceil(2) * 2;
+ let bound_h = round_up_even(neighbours.mi_rows);
+ let bound_w = round_up_even(neighbours.mi_cols);
+ let u_state = neighbour_state(&u_grid);
+ let v_state = neighbour_state(&v_grid);
+ for cell in 0..2usize {
+ if cell < 2usize.min(bound_h.saturating_sub(gr)) {
+ neighbours.left[gr + cell][1] = u_state;
+ neighbours.left[gr + cell][2] = v_state;
+ }
+ if cell < 2usize.min(bound_w.saturating_sub(gc)) {
+ neighbours.above[gc + cell][1] = u_state;
+ neighbours.above[gc + cell][2] = v_state;
+ }
+ }
}
- let (u_grid, v_grid) = if last_skip {
- u.reconstruct_mc(cpx, cpy, B4, &pred_u, &vec![0i32; B4 * B4]);
- v.reconstruct_mc(cpx, cpy, B4, &pred_v, &vec![0i32; B4 * B4]);
- (vec![0i32; B4 * B4], vec![0i32; B4 * B4])
- } else {
- let around = neighbours.around_mi(group_mi, 8);
- let ug = read_inter_plane(
- dec, cdfs, TxbSet::Chroma4, scan4, 1, around[1], 0, u, cpx, cpy, B4, base_q_idx,
- &pred_u, Some(first_tx_type), None,
- )?
- .0;
- let vg = read_inter_plane(
- dec, cdfs, TxbSet::Chroma4, scan4, 2, around[2], 0, v, cpx, cpy, B4, base_q_idx,
- &pred_v, Some(first_tx_type), None,
- )?
- .0;
- (ug, vg)
- };
- neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED);
// Same two neighbour tails [`decode_leaf_split4`] runs: the partition
// context of a `BLOCK_4X4` subsize (`partition_context_lookup` bit 0 = 1,
// reached by `side_mi = 4` here) and the group's chroma coefficient state.
@@ -22772,95 +23117,496 @@ fn decode_inter_sub8_split4(
neighbours.left_side_mi[gr + cell] = 4;
neighbours.above_side_mi[gc + cell] = 4;
}
- let round_up_even = |n: usize| n.div_ceil(2) * 2;
- let bound_h = round_up_even(neighbours.mi_rows);
- let bound_w = round_up_even(neighbours.mi_cols);
- let u_state = neighbour_state(&u_grid);
- let v_state = neighbour_state(&v_grid);
- for cell in 0..2usize {
- if cell < 2usize.min(bound_h.saturating_sub(gr)) {
- neighbours.left[gr + cell][1] = u_state;
- neighbours.left[gr + cell][2] = v_state;
- }
- if cell < 2usize.min(bound_w.saturating_sub(gc)) {
- neighbours.above[gc + cell][1] = u_state;
- neighbours.above[gc + cell][2] = v_state;
- }
- }
Ok(())
}
-/// Decodes a `PARTITION_HORZ`/`PARTITION_VERT` of one 8x8 INTER block into two
-/// `BLOCK_8X4`/`BLOCK_4X8` inter leaves (lane-intersub8 r3) -- the inter twin of
-/// [`decode_leaf_rect8`] and the rectangular sibling of
-/// [`decode_inter_sub8_split4`], whose element order it follows exactly.
-/// Per sub-block, in libaom `decodemv.c` `read_inter_frame_mode_info` order:
-///
-/// * `segment_id`, `skip`, `cdef`/`delta_q`/`delta_lf`, `intra_inter`;
-/// * NO `skip_mode` symbol: `is_comp_ref_allowed(BLOCK_8X4)` is false
-/// (`av1_is_comp_ref_allowed` needs both sides >= 8), so
-/// `read_skip_mode` returns 0 without reading and `comp_mode` is never read
-/// either (`read_ref_frames`' `is_comp_ref_allowed` guard) -- single
-/// reference only;
-/// * NO `interintra` and NO `motion_mode`/OBMC/warp symbol: every one of those
-/// gates needs `block_size_wide >= 8 && block_size_high >= 8`
-/// (`is_interintra_allowed_bsize`, `motion_mode_allowed`), and one side is 4;
-/// * `read_mb_interp_filter` DOES run for both sub-blocks.
-///
-/// The shape's own differences from the four-way split:
-///
-/// * `block_signals_txsize(BLOCK_8X4)` is true (`bsize > BLOCK_4X4`,
-/// blockd.h:1027), so a non-skipped sub-block reads ONE `txfm_partition`
-/// symbol under `TX_MODE_SELECT` at `max_txsize_rect_lookup[BLOCK_8X4] ==
-/// TX_8X4` ([`read_var_tx_size`]); split resolves to two `TX_4X4` units
-/// (`sub_tx_size_map[TX_8X4] == TX_4X4`, libaom's early return), no split to
-/// the whole-leaf `TX_8X4`;
-/// * the luma coefficient set is [`TxbSet::LumaRect8x4Inter`] (the 8x8
-/// coefficient class with a 32-position `eob_pt` and the INTER `TX_4X4`
-/// `tx_type` row) for the whole-leaf unit, and the square
-/// [`TxbSet::Luma4Inter`] for a split `TX_4X4` unit;
-/// * chroma is coded ONCE, on the sub-block that is the chroma reference:
-/// `is_chroma_reference` (`av1_common_int.h`) is
-/// `((mi_row & 1) || !(bh4 & 1) || !ss_y) && ((mi_col & 1) || !(bw4 & 1) ||
-/// !ss_x)`, i.e. under 4:2:0 the BOTTOM 8x4 (`bh4 == 1`, odd) and the RIGHT
-/// 4x8 (`bw4 == 1`) -- always the second sub-block here;
-/// * that chroma unit's prediction is the sub8x8 one (`reconinter.c`
-/// `build_inter_predictors_sub8x8`: `row_start = -(block_size_high == 4 &&
-/// ss_y)`, `col_start = -(block_size_wide == 4 && ss_x)`), two 4x2 (HORZ) or
-/// 2x4 (VERT) chroma pieces, each from its OWN sub-block's reference, mv and
-/// interpolation filters.
+/// One INTRA 8x4/4x8 leaf inside an INTER frame's sub-8x8 HORZ/VERT partition
+/// (lane-sub8intra) -- the shape [`decode_inter_sub8_rect2`] refused by name.
+/// Mode syntax is `read_intra_block_mode_info`'s (decodemv.c:1065), not the key
+/// frame's above/left pair: `y_mode[size_group_lookup[BLOCK_8X4] == 0]`, NO
+/// angle delta (`av1_use_angle_delta` needs `bsize >= BLOCK_8X8`), `uv_mode` +
+/// CfL alphas only on the chroma-reference sub-block (`is_chroma_reference`:
+/// the SECOND one under 4:2:0), then `filter_intra` off BLOCK_8X4/BLOCK_4X8's
+/// own class row (`av1_filter_intra_allowed_bsize` is `wide <= 32 && high <=
+/// 32`, so this shape is allowed). Everything below the mode read -- the tx
+/// depth symbol, the whole-leaf `TX_8X4`/`TX_4X8` or split `TX_4X4` walk, the
+/// 4x4 chroma unit at the group's origin -- is [`decode_leaf_rect8`]'s body for
+/// the same shape; the INTER-frame differences are the tx-depth context
+/// (`above_txfm`/`left_txfm`, not the key frame's deblock-grid approximation),
+/// `set_txfm_ctxs` publication, and the inter-side bands + mi map the caller's
+/// inter leaves also write (`is_inter = 0`, ref `INTRA_FRAME`, no interp
+/// filter).
#[allow(clippy::too_many_arguments)]
-fn decode_inter_sub8_rect2(
+fn decode_intra_sub8_leaf(
dec: &mut SymbolDecoder,
cdfs: &mut Cdfs,
neighbours: &mut Neighbours,
grid: &mut MiGrid,
group_mi: (usize, usize),
- vert: bool,
- mi_cols: u32,
- mi_rows: u32,
+ lmi: (usize, usize),
+ // `(bw, bh)`: 8x4 / 4x8 under HORZ/VERT, 4x4 under SPLIT.
+ (bw, bh): (usize, usize),
+ has_chroma: bool,
+ skip: bool,
+ scan4: &[u16],
y: &mut PlaneBuf,
u: &mut PlaneBuf,
v: &mut PlaneBuf,
- ref_y: &PlaneBuf,
- ref_u: &PlaneBuf,
- ref_v: &PlaneBuf,
- other_refs: &RefSlots,
- sign_bias_table: &SignBiasTable,
- global_motion: &[ec_av1_syntax::WarpParams; 7],
base_q_idx: u8,
- scan4: &[u16],
- allow_high_precision_mv: bool,
- force_integer_mv: bool,
- interp_fixed: Option,
- enable_dual_filter: bool,
- tpl_frame: Option<&TplFrameArgs>,
+ enable_filter_intra: bool,
+ tx_select: bool,
reduced_tx_set: bool,
- frame_width: usize,
-) -> Result<()> {
- const LAST_FRAME: i8 = 1;
- // The 8x8 group's own square stride: both leaves' prediction buffers are
- // laid out at it, as every other rect inter unit here is.
+) -> Result {
+ let vert = bw < bh;
+ let (w_mi, h_mi) = (bw / MI, bh / MI);
+ let (gr, gc) = group_mi;
+ let (r, c) = (gr / (SUB / MI), gc / (SUB / MI));
+ let (above_mode, left_mode) = neighbours.modes_above_left(r, c);
+ let leaf_above = neighbours
+ .mode_above_mi(lmi.0, lmi.1)
+ .unwrap_or(above_mode);
+ let leaf_left = neighbours.mode_left_mi(lmi.0, lmi.1).unwrap_or(left_mode);
+ let step = std::env::var_os("EC_TRACE_MODE_STEP").is_some();
+ // `size_group_lookup[BLOCK_8X4] == size_group_lookup[BLOCK_4X8] == 0`
+ // (libaom common_data.h:61).
+ let mode = dec.symbol(&mut cdfs.y_mode[0]);
+ if step {
+ eprintln!(
+ "EC_ISTEP mi_row={} mi_col={} name=mode val={mode} rng={}",
+ lmi.0,
+ lmi.1,
+ dec.debug_state().0
+ );
+ }
+ // No angle delta below 8x8 (`av1_use_angle_delta`), for luma or chroma.
+ let angle_delta_y = 0;
+ let (uv_mode, alpha) = if has_chroma {
+ // `is_cfl_allowed` is `wide <= 32 && high <= 32` -- true for this
+ // shape, so the 14-symbol CFL alphabet is the right one.
+ let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]);
+ if (9..=12).contains(&uv_mode) {
+ SMOOTH_UV_HITS.with(|c| c.set(c.get() + 1));
+ }
+ let alpha = if uv_mode == UV_CFL_PRED {
+ Some(read_cfl_alphas(dec, cdfs))
+ } else {
+ None
+ };
+ if (V_PRED..=D67_PRED).contains(&uv_mode) {
+ DIRECTIONAL_UV_HITS.with(|c| c.set(c.get() + 1));
+ }
+ (uv_mode, alpha)
+ } else {
+ (DC_PRED, None)
+ };
+ let mut filter_intra = None;
+ if mode == DC_PRED && enable_filter_intra {
+ let fi_class = if bw == bh {
+ filter_intra_size_class(bw).expect("BLOCK_4X4 has its own filter_intra row")
+ } else {
+ filter_intra_size_class_rect(bw, bh)
+ .expect("BLOCK_4X8/BLOCK_8X4 are inside av1_filter_intra_allowed_bsize")
+ };
+ let use_fi = dec.symbol(&mut cdfs.filter_intra[fi_class]);
+ if step {
+ eprintln!(
+ "EC_ISTEP mi_row={} mi_col={} name=use_filter_intra val={use_fi} rng={}",
+ lmi.0,
+ lmi.1,
+ dec.debug_state().0
+ );
+ }
+ if use_fi != 0 {
+ FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1));
+ FILTER_INTRA_RECT_HITS.with(|c| c.set(c.get() + 1));
+ FILTER_INTRA_RECT_SUB8_HITS.with(|c| c.set(c.get() + 1));
+ let fi = dec.symbol(&mut cdfs.filter_intra_mode);
+ if step {
+ eprintln!(
+ "EC_ISTEP mi_row={} mi_col={} name=filter_intra_mode val={fi} rng={}",
+ lmi.0,
+ lmi.1,
+ dec.debug_state().0
+ );
+ }
+ filter_intra = Some(fi);
+ }
+ }
+ // `read_block_tx_size`' non-var-tx arm: an INTRA block of an inter frame
+ // reads `read_tx_size(allow_select = 1)` -- `bsize_to_tx_size_cat
+ // (BLOCK_4X8) == 0` (blockd.h:1344, depth table entry 1), the same
+ // 2-symbol category [`decode_leaf_rect8`] reads -- with the var-tx
+ // context bands, which on an inter frame are live.
+ // `block_signals_txsize(BLOCK_4X4)` is false (blockd.h:1027): the 4x4 leaf
+ // codes no depth symbol at all, its transform is its own size.
+ let depth = if tx_select && bw != bh {
+ let ctx = tx_size_context_txfm_rect(neighbours, lmi, bw, bh);
+ let d = dec.symbol(&mut cdfs.tx_size_cat0[ctx]);
+ if step {
+ eprintln!(
+ "EC_ISTEP mi_row={} mi_col={} name=tx_depth val={d} ctx={ctx} cat=0 rng={}",
+ lmi.0,
+ lmi.1,
+ dec.debug_state().0
+ );
+ }
+ d
+ } else {
+ 0
+ };
+ if depth != 0 {
+ TX_DEPTH_HITS.with(|c| c.set(c.get() + 1));
+ RECT8_SPLIT_TX_HITS.with(|c| c.set(c.get() + 1));
+ }
+ let split = depth != 0;
+ let (px, py) = (lmi.1 * MI, lmi.0 * MI);
+ let reach = if bw == bh {
+ Reach::of(bw, px, py, y.width, y.height)
+ } else {
+ Reach::of_rect(bw, bh, px, py, y.width, y.height)
+ };
+ let smooth_neighbor = is_smooth_mode(leaf_above) || is_smooth_mode(leaf_left);
+ if smooth_neighbor {
+ SMOOTH_LUMA_HITS.with(|c| c.set(c.get() + 1));
+ }
+ neighbours.record_mode_mi(lmi.0, lmi.1, w_mi, h_mi, mode);
+ let scan: &[u16] = if vert { &SCAN_4X8 } else { &SCAN_8X4 };
+ if split {
+ // `sub_tx_size_map[TX_4X8] == TX_4X4`: two 4x4 units along the long
+ // axis, each predicted off the previous one's reconstruction.
+ for tu in 0..2usize {
+ let tu_mi = if vert {
+ (lmi.0 + tu, lmi.1)
+ } else {
+ (lmi.0, lmi.1 + tu)
+ };
+ let (tu_px, tu_py) = (tu_mi.1 * MI, tu_mi.0 * MI);
+ let tu_reach = tu_reach(
+ bw,
+ bh,
+ tu_px - px,
+ tu_py - py,
+ 4,
+ reach,
+ px,
+ py,
+ y.width,
+ y.height,
+ );
+ if skip {
+ let zeros = vec![0i32; 16];
+ y.reconstruct(
+ tu_px, tu_py, 4, mode, angle_delta_y, tu_reach, &zeros, None, filter_intra,
+ smooth_neighbor,
+ );
+ neighbours.record_mi_luma(tu_mi, 4, &zeros);
+ continue;
+ }
+ let tu_around = neighbours.around_mi(tu_mi, 4)[0];
+ let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, 1);
+ let tu_grid = read_plane(
+ dec,
+ cdfs,
+ if reduced_tx_set {
+ TxbSet::Luma4
+ } else {
+ TxbSet::Luma4Set1
+ },
+ scan4,
+ 0,
+ tu_around,
+ mode,
+ mode,
+ angle_delta_y,
+ tu_reach,
+ y,
+ tu_px,
+ tu_py,
+ 4,
+ TX4,
+ base_q_idx,
+ None,
+ filter_intra,
+ Some(tu_skip_ctx),
+ smooth_neighbor,
+ )?;
+ neighbours.record_mi_luma(tu_mi, 4, &tu_grid);
+ }
+ } else if bw == bh {
+ // A `BLOCK_4X4` leaf's luma TU *is* the whole block, so `get_txb_ctx`
+ // fixes `txb_skip_ctx` at 0 (`luma_skip_ctx: None`) -- the same square
+ // reader [`decode_leaf_split4`] uses.
+ if skip {
+ y.reconstruct(
+ px, py, 4, mode, angle_delta_y, reach, &vec![0i32; 16], None, filter_intra,
+ smooth_neighbor,
+ );
+ neighbours.record_mi_luma(lmi, 4, &vec![0i32; 16]);
+ } else {
+ let tu_around = neighbours.around_mi(lmi, 4)[0];
+ let tu_grid = read_plane(
+ dec,
+ cdfs,
+ if reduced_tx_set {
+ TxbSet::Luma4
+ } else {
+ TxbSet::Luma4Set1
+ },
+ scan4,
+ 0,
+ tu_around,
+ mode,
+ mode,
+ angle_delta_y,
+ reach,
+ y,
+ px,
+ py,
+ 4,
+ TX4,
+ base_q_idx,
+ None,
+ filter_intra,
+ None,
+ smooth_neighbor,
+ )?;
+ neighbours.record_mi_luma(lmi, 4, &tu_grid);
+ }
+ } else {
+ let grid_levels = if skip {
+ let zeros = vec![0i32; bw * bh];
+ y.reconstruct_rect(
+ px, py, bw, bh, mode, angle_delta_y, reach, &zeros, None, filter_intra,
+ smooth_neighbor,
+ );
+ zeros
+ } else {
+ // The leaf's luma TU *is* the leaf, so `get_txb_ctx` fixes
+ // `txb_skip_ctx` at 0.
+ let around = neighbours.around_mi_rect(lmi, bw, bh)[0];
+ let set = if reduced_tx_set {
+ TxbSet::LumaRect4x8
+ } else {
+ TxbSet::LumaRect4x8Set1
+ };
+ let mut coding = cdfs.txb(set, fi_tx_row(mode, filter_intra));
+ let (levels, tx_type) = read_coeffs_rect(
+ dec,
+ &mut coding,
+ scan,
+ bw,
+ bh,
+ 0,
+ dc_sign_ctx(around.2),
+ TxType::DctDct,
+ )?;
+ let residual = dequant_and_inverse_typed_wh(
+ &levels,
+ bw,
+ bh,
+ crate::decode::bit_depth(),
+ CURRENT_Q_IDX.with(|q| q.get()),
+ plane_q_delta(0).0,
+ plane_q_delta(0).1,
+ tx_type,
+ );
+ y.reconstruct_rect(
+ px, py, bw, bh, mode, angle_delta_y, reach, &residual, None, filter_intra,
+ smooth_neighbor,
+ );
+ levels
+ };
+ let state = neighbour_state(&grid_levels);
+ for cell in 0..h_mi {
+ if lmi.0 + cell < neighbours.mi_rows {
+ neighbours.left[lmi.0 + cell][0] = state;
+ }
+ }
+ for cell in 0..w_mi {
+ if lmi.1 + cell < neighbours.mi_cols {
+ neighbours.above[lmi.1 + cell][0] = state;
+ }
+ }
+ }
+ let (tx_w, tx_h) = if split { (4, 4) } else { (bw, bh) };
+ neighbours.fill_skip_grid_rect(lmi, w_mi, h_mi, skip);
+ neighbours.fill_lf_grid_rect(lmi, w_mi, h_mi, tx_w as u8, tx_h as u8, 0);
+ // `set_txfm_ctxs(tx_size, n4_w, n4_h, skip && is_inter == 0, xd)`: an
+ // intra block of an inter frame publishes its TRANSFORM dims, never its
+ // block dims (blockd.h). Missing this left the next block reading the
+ // previous block's band (the lane-intra16x4 finding for the 16x4 strip).
+ for i in 0..w_mi {
+ if let Some(cell) = neighbours.above_txfm.get_mut(lmi.1 + i) {
+ *cell = tx_w as u8;
+ }
+ }
+ for i in 0..h_mi {
+ if let Some(cell) = neighbours.left_txfm.get_mut(lmi.0 + i) {
+ *cell = tx_h as u8;
+ }
+ }
+ neighbours.above_mode[c] = mode;
+ neighbours.left_mode[r] = mode;
+ // The inter-side bands and the mi map, exactly as the square
+ // intra-in-inter block writes them: `is_inter = 0`, `INTRA_FRAME` ref, no
+ // interpolation filter, no skip mode.
+ neighbours.record_inter_rect_mi(lmi, w_mi, h_mi, skip, false, 0, [3, 3], false);
+ for dr in 0..h_mi {
+ for dc in 0..w_mi {
+ grid.set(
+ lmi.0 + dr,
+ lmi.1 + dc,
+ MiInfo {
+ is_inter: false,
+ ref_frame: -1,
+ ref_frame1: None,
+ mv1: None,
+ mv: (0, 0),
+ is_new_mv: false,
+ size: w_mi,
+ size_h: h_mi,
+ is_global_mv0: false,
+ is_global_mv1: false,
+ },
+ );
+ }
+ }
+ SUB8_INTRA_RECT_HITS.with(|h| {
+ let mut s = h.get();
+ s[usize::from(vert)] += 1;
+ s[2] += usize::from(has_chroma);
+ h.set(s);
+ });
+ if !has_chroma {
+ return Ok(mode);
+ }
+ // The group's single 4x4 chroma unit, intra-predicted from THIS
+ // (chroma-reference) sub-block's own `uv_mode` -- `is_sub8x8_inter`
+ // (reconinter_template.inc:54) returns false as soon as any mi of the
+ // group is intra, and the decoder reconstructs chroma with the
+ // chroma-reference block's own type. Same body as [`decode_leaf_rect8`]'s
+ // post-loop chroma.
+ let (gpx, gpy) = (gc * MI, gr * MI);
+ let (cpx, cpy) = (gpx / 2, gpy / 2);
+ let group_reach = Reach::of(8, gpx, gpy, y.width, y.height);
+ let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(gr, gc, r, c);
+ let uv_predict_mode = if uv_mode == UV_CFL_PRED { DC_PRED } else { uv_mode };
+ let angle_delta_uv = 0;
+ neighbours.above_uv_mode[c] = uv_predict_mode;
+ neighbours.left_uv_mode[r] = uv_predict_mode;
+ neighbours.record_uv_mode_mi(gr, gc, 2, 2, uv_predict_mode);
+ let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8));
+ let (u_grid, v_grid): (Vec, Vec) = if skip {
+ if alpha.is_some() {
+ CHROMA_SKIP_CFL_HITS.with(|h| h.set(h.get() + 1));
+ SKIP_CFL_HITS.with(|c| c.set(c.get() + 1));
+ }
+ u.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), None, smooth_neighbor_uv);
+ v.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), None, smooth_neighbor_uv);
+ (vec![0i32; 16], vec![0i32; 16])
+ } else {
+ let chroma_around = neighbours.around_mi(group_mi, 8);
+ let ug = read_plane(
+ dec, cdfs, TxbSet::Chroma4, scan4, 1, chroma_around[1], uv_mode, uv_predict_mode,
+ angle_delta_uv, group_reach, u, cpx, cpy, 4, TX4, base_q_idx,
+ alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), None, None, smooth_neighbor_uv,
+ )?;
+ let vg = read_plane(
+ dec, cdfs, TxbSet::Chroma4, scan4, 2, chroma_around[2], uv_mode, uv_predict_mode,
+ angle_delta_uv, group_reach, v, cpx, cpy, 4, TX4, base_q_idx,
+ alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), None, None, smooth_neighbor_uv,
+ )?;
+ (ug, vg)
+ };
+ let round_up_even = |n: usize| n.div_ceil(2) * 2;
+ let bound_h = round_up_even(neighbours.mi_rows);
+ let bound_w = round_up_even(neighbours.mi_cols);
+ let u_state = neighbour_state(&u_grid);
+ let v_state = neighbour_state(&v_grid);
+ for cell in 0..2usize {
+ if cell < 2usize.min(bound_h.saturating_sub(gr)) {
+ neighbours.left[gr + cell][1] = u_state;
+ neighbours.left[gr + cell][2] = v_state;
+ }
+ if cell < 2usize.min(bound_w.saturating_sub(gc)) {
+ neighbours.above[gc + cell][1] = u_state;
+ neighbours.above[gc + cell][2] = v_state;
+ }
+ }
+ Ok(mode)
+}
+
+/// Decodes a `PARTITION_HORZ`/`PARTITION_VERT` of one 8x8 INTER block into two
+/// `BLOCK_8X4`/`BLOCK_4X8` inter leaves (lane-intersub8 r3) -- the inter twin of
+/// [`decode_leaf_rect8`] and the rectangular sibling of
+/// [`decode_inter_sub8_split4`], whose element order it follows exactly.
+/// Per sub-block, in libaom `decodemv.c` `read_inter_frame_mode_info` order:
+///
+/// * `segment_id`, `skip`, `cdef`/`delta_q`/`delta_lf`, `intra_inter`;
+/// * NO `skip_mode` symbol: `is_comp_ref_allowed(BLOCK_8X4)` is false
+/// (`av1_is_comp_ref_allowed` needs both sides >= 8), so
+/// `read_skip_mode` returns 0 without reading and `comp_mode` is never read
+/// either (`read_ref_frames`' `is_comp_ref_allowed` guard) -- single
+/// reference only;
+/// * NO `interintra` and NO `motion_mode`/OBMC/warp symbol: every one of those
+/// gates needs `block_size_wide >= 8 && block_size_high >= 8`
+/// (`is_interintra_allowed_bsize`, `motion_mode_allowed`), and one side is 4;
+/// * `read_mb_interp_filter` DOES run for both sub-blocks.
+///
+/// The shape's own differences from the four-way split:
+///
+/// * `block_signals_txsize(BLOCK_8X4)` is true (`bsize > BLOCK_4X4`,
+/// blockd.h:1027), so a non-skipped sub-block reads ONE `txfm_partition`
+/// symbol under `TX_MODE_SELECT` at `max_txsize_rect_lookup[BLOCK_8X4] ==
+/// TX_8X4` ([`read_var_tx_size`]); split resolves to two `TX_4X4` units
+/// (`sub_tx_size_map[TX_8X4] == TX_4X4`, libaom's early return), no split to
+/// the whole-leaf `TX_8X4`;
+/// * the luma coefficient set is [`TxbSet::LumaRect8x4Inter`] (the 8x8
+/// coefficient class with a 32-position `eob_pt` and the INTER `TX_4X4`
+/// `tx_type` row) for the whole-leaf unit, and the square
+/// [`TxbSet::Luma4Inter`] for a split `TX_4X4` unit;
+/// * chroma is coded ONCE, on the sub-block that is the chroma reference:
+/// `is_chroma_reference` (`av1_common_int.h`) is
+/// `((mi_row & 1) || !(bh4 & 1) || !ss_y) && ((mi_col & 1) || !(bw4 & 1) ||
+/// !ss_x)`, i.e. under 4:2:0 the BOTTOM 8x4 (`bh4 == 1`, odd) and the RIGHT
+/// 4x8 (`bw4 == 1`) -- always the second sub-block here;
+/// * that chroma unit's prediction is the sub8x8 one (`reconinter.c`
+/// `build_inter_predictors_sub8x8`: `row_start = -(block_size_high == 4 &&
+/// ss_y)`, `col_start = -(block_size_wide == 4 && ss_x)`), two 4x2 (HORZ) or
+/// 2x4 (VERT) chroma pieces, each from its OWN sub-block's reference, mv and
+/// interpolation filters.
+#[allow(clippy::too_many_arguments)]
+fn decode_inter_sub8_rect2(
+ dec: &mut SymbolDecoder,
+ cdfs: &mut Cdfs,
+ neighbours: &mut Neighbours,
+ grid: &mut MiGrid,
+ group_mi: (usize, usize),
+ vert: bool,
+ mi_cols: u32,
+ mi_rows: u32,
+ y: &mut PlaneBuf,
+ u: &mut PlaneBuf,
+ v: &mut PlaneBuf,
+ ref_y: &PlaneBuf,
+ ref_u: &PlaneBuf,
+ ref_v: &PlaneBuf,
+ other_refs: &RefSlots,
+ sign_bias_table: &SignBiasTable,
+ global_motion: &[ec_av1_syntax::WarpParams; 7],
+ base_q_idx: u8,
+ scan4: &[u16],
+ allow_high_precision_mv: bool,
+ force_integer_mv: bool,
+ interp_fixed: Option,
+ enable_dual_filter: bool,
+ tpl_frame: Option<&TplFrameArgs>,
+ reduced_tx_set: bool,
+ frame_width: usize,
+) -> Result<()> {
+ const LAST_FRAME: i8 = 1;
+ // The 8x8 group's own square stride: both leaves' prediction buffers are
+ // laid out at it, as every other rect inter unit here is.
const SIDE: usize = 8;
let (bw, bh) = if vert { (4usize, 8usize) } else { (8usize, 4usize) };
let (w_mi, h_mi) = (bw / MI, bh / MI);
@@ -22877,11 +23623,34 @@ fn decode_inter_sub8_rect2(
[None; 2];
let mut first_tx_type = TxType::DctDct;
let mut last_skip = true;
+ // Set when the chroma-reference sub-block is INTRA: it coded the group's
+ // one chroma unit itself.
+ let mut intra_chroma = false;
for i in 0..2usize {
let lmi = if vert { (gr, gc + i) } else { (gr + i, gc) };
if lmi.0 >= mi_rows as usize || lmi.1 >= mi_cols as usize {
continue;
}
+ // libaom's `xd->above_mbmi`/`xd->left_mbmi` are the neighbour block as
+ // DECODED, so leaf 1 sees leaf 0's own `bsize` -- the group tail below
+ // publishes the side bands only once both leaves are done, which left
+ // leaf 1 reading whatever block preceded the GROUP. `get_tx_size_context`
+ // (pred_common.h:342) takes `block_size_wide[above_mbmi->bsize]` from it,
+ // so an intra 8x4 leaf 1 read `tx_size_cat0` row 1 where aomdec reads
+ // row 2 (class tx-grid-published-block-side).
+ if i == 1 {
+ if vert {
+ for cell in 0..h_mi {
+ neighbours.left_side_mi[gr + cell] = bh;
+ }
+ neighbours.above_side_mi[gc] = bw;
+ } else {
+ for cell in 0..w_mi {
+ neighbours.above_side_mi[gc + cell] = bw;
+ }
+ neighbours.left_side_mi[gr] = bh;
+ }
+ }
let (rmi, cmi) = lmi;
let (px, py) = (cmi * MI, rmi * MI);
inter_segment_id(dec, cdfs, rmi, cmi, w_mi, h_mi, false, true);
@@ -22904,10 +23673,44 @@ fn decode_inter_sub8_rect2(
);
let is_inter = dec.symbol(&mut cdfs.intra_inter[ii_ctx]) == 1;
if !is_inter {
- return Err(unsupported(
- "an intra 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition \
- (this decoder codes only inter sub-blocks there)",
- ));
+ if std::env::var_os("EC_SUB8INTRA").is_some() {
+ eprintln!(
+ "EC_SUB8INTRA shape={}x{} sub={i} has_chroma={} skip={skip} mi={rmi},{cmi} tx_select={}",
+ bw,
+ bh,
+ i == 1,
+ TX_SELECT_INTER.with(std::cell::Cell::get),
+ );
+ }
+ // lane-sub8x4 r2: refusal and bypass lifted -- see the split arm's
+ // note above for the gate that proves this leaf.
+ // Its chroma rule is `is_sub8x8_inter`'s: when the
+ // chroma-reference (second) sub-block is the intra one, the
+ // group's 4x4 chroma is coded and predicted INTRA there and the
+ // inter chroma tail below is skipped entirely.
+ decode_intra_sub8_leaf(
+ dec,
+ cdfs,
+ neighbours,
+ grid,
+ group_mi,
+ lmi,
+ (bw, bh),
+ i == 1,
+ skip,
+ scan4,
+ y,
+ u,
+ v,
+ base_q_idx,
+ ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get),
+ TX_SELECT_INTER.with(std::cell::Cell::get),
+ reduced_tx_set,
+ )?;
+ if i == 1 {
+ intra_chroma = true;
+ }
+ continue;
}
if std::env::var_os("EC_TRACE_MODE").is_some() {
eprintln!(
@@ -23167,10 +23970,13 @@ fn decode_inter_sub8_rect2(
None,
)?
};
- if idx == 0 {
+ if idx == 0 && (i == 0 || piece[0].is_none()) {
// `av1_get_tx_type`: the group's one chroma unit scales
// back to luma (0, 0), i.e. the FIRST sub-block's first
- // transform unit.
+ // transform unit -- unless that sub-block is INTRA
+ // (lane-sub8intra), in which case it wrote no inter
+ // tx_type at all and `xd->tx_type_map[0]` of the
+ // chroma-reference block is this one's.
first_tx_type = tu_tx_type;
}
neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid);
@@ -23190,64 +23996,109 @@ fn decode_inter_sub8_rect2(
neighbours.fill_skip_grid_rect(lmi, w_mi, h_mi, skip);
last_skip = skip;
}
- // The group's single 4x4 chroma unit per plane, on the chroma-reference
- // (second) sub-block's own skip flag.
- const B4: usize = 4;
- let mut pred_u = vec![0u16; B4 * B4];
- let mut pred_v = vec![0u16; B4 * B4];
- let (piece_w, piece_h) = if vert { (2usize, 4usize) } else { (4usize, 2usize) };
- for i in 0..2usize {
- let Some((ref_frame, mv, h_filter, v_filter)) = piece[i] else {
- continue;
+ // lane-sub8intra: when the chroma-reference sub-block was INTRA it coded
+ // and reconstructed the group's one chroma unit itself.
+ if !intra_chroma {
+ // The group's single 4x4 chroma unit per plane, on the chroma-reference
+ // (second) sub-block's own skip flag.
+ const B4: usize = 4;
+ let mut pred_u = vec![0u16; B4 * B4];
+ let mut pred_v = vec![0u16; B4 * B4];
+ // `is_sub8x8_inter` (reconinter_template.inc:54) is false as soon as ANY
+ // mi of the group is intra, so a group whose chroma reference is inter but
+ // whose sibling is INTRA does NOT get the two-piece sub8x8 prediction: the
+ // ordinary 8x8-and-bigger path predicts the WHOLE 4x4 chroma unit from the
+ // chroma-reference block's own mv, at the group's chroma origin
+ // (`row_start`/`col_start` shift `pre_x`/`pre_y` there either way).
+ let mixed = piece[0].is_none();
+ if mixed {
+ SUB8_INTRA_RECT_HITS.with(|h| {
+ let mut s = h.get();
+ s[3] += 1;
+ h.set(s);
+ });
+ }
+ let (piece_w, piece_h) = match (mixed, vert) {
+ (true, _) => (B4, B4),
+ (false, true) => (2usize, 4usize),
+ (false, false) => (4usize, 2usize),
};
- let (_, sref_u, sref_v) = ref_planes(ref_frame, ref_y, ref_u, ref_v, other_refs)?;
- let (ox, oy) = if vert {
- (cpx + i * piece_w, cpy)
+ for i in 0..2usize {
+ let Some((ref_frame, mv, h_filter, v_filter)) = piece[i] else {
+ continue;
+ };
+ let (_, sref_u, sref_v) = ref_planes(ref_frame, ref_y, ref_u, ref_v, other_refs)?;
+ let (ox, oy) = if mixed {
+ (cpx, cpy)
+ } else if vert {
+ (cpx + i * piece_w, cpy)
+ } else {
+ (cpx, cpy + i * piece_h)
+ };
+ let (dc, dr) = if mixed {
+ (0, 0)
+ } else if vert {
+ (i * piece_w, 0)
+ } else {
+ (0, i * piece_h)
+ };
+ for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] {
+ let mut buf = vec![0u16; piece_w * piece_h];
+ mc::predict_with_filters(
+ &plane.data,
+ plane.width,
+ plane.true_width,
+ plane.true_height,
+ mv_to_q4(ox, mv.1, false),
+ mv_to_q4(oy, mv.0, false),
+ piece_w,
+ piece_h,
+ h_filter,
+ v_filter,
+ &mut buf,
+ );
+ for row in 0..piece_h {
+ for col in 0..piece_w {
+ dst[(dr + row) * B4 + dc + col] = buf[row * piece_w + col];
+ }
+ }
+ }
+ }
+ let (u_grid, v_grid) = if last_skip {
+ u.reconstruct_mc(cpx, cpy, B4, &pred_u, &vec![0i32; B4 * B4]);
+ v.reconstruct_mc(cpx, cpy, B4, &pred_v, &vec![0i32; B4 * B4]);
+ (vec![0i32; B4 * B4], vec![0i32; B4 * B4])
} else {
- (cpx, cpy + i * piece_h)
+ let around = neighbours.around_mi(group_mi, 8);
+ let ug = read_inter_plane(
+ dec, cdfs, TxbSet::Chroma4, scan4, 1, around[1], 0, u, cpx, cpy, B4, base_q_idx,
+ &pred_u, Some(first_tx_type), None,
+ )?
+ .0;
+ let vg = read_inter_plane(
+ dec, cdfs, TxbSet::Chroma4, scan4, 2, around[2], 0, v, cpx, cpy, B4, base_q_idx,
+ &pred_v, Some(first_tx_type), None,
+ )?
+ .0;
+ (ug, vg)
};
- let (dc, dr) = if vert { (i * piece_w, 0) } else { (0, i * piece_h) };
- for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] {
- let mut buf = vec![0u16; piece_w * piece_h];
- mc::predict_with_filters(
- &plane.data,
- plane.width,
- plane.true_width,
- plane.true_height,
- mv_to_q4(ox, mv.1, false),
- mv_to_q4(oy, mv.0, false),
- piece_w,
- piece_h,
- h_filter,
- v_filter,
- &mut buf,
- );
- for row in 0..piece_h {
- for col in 0..piece_w {
- dst[(dr + row) * B4 + dc + col] = buf[row * piece_w + col];
- }
+ neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED);
+ let round_up_even = |n: usize| n.div_ceil(2) * 2;
+ let bound_h = round_up_even(neighbours.mi_rows);
+ let bound_w = round_up_even(neighbours.mi_cols);
+ let u_state = neighbour_state(&u_grid);
+ let v_state = neighbour_state(&v_grid);
+ for cell in 0..2usize {
+ if cell < 2usize.min(bound_h.saturating_sub(gr)) {
+ neighbours.left[gr + cell][1] = u_state;
+ neighbours.left[gr + cell][2] = v_state;
+ }
+ if cell < 2usize.min(bound_w.saturating_sub(gc)) {
+ neighbours.above[gc + cell][1] = u_state;
+ neighbours.above[gc + cell][2] = v_state;
}
}
}
- let (u_grid, v_grid) = if last_skip {
- u.reconstruct_mc(cpx, cpy, B4, &pred_u, &vec![0i32; B4 * B4]);
- v.reconstruct_mc(cpx, cpy, B4, &pred_v, &vec![0i32; B4 * B4]);
- (vec![0i32; B4 * B4], vec![0i32; B4 * B4])
- } else {
- let around = neighbours.around_mi(group_mi, 8);
- let ug = read_inter_plane(
- dec, cdfs, TxbSet::Chroma4, scan4, 1, around[1], 0, u, cpx, cpy, B4, base_q_idx,
- &pred_u, Some(first_tx_type), None,
- )?
- .0;
- let vg = read_inter_plane(
- dec, cdfs, TxbSet::Chroma4, scan4, 2, around[2], 0, v, cpx, cpy, B4, base_q_idx,
- &pred_v, Some(first_tx_type), None,
- )?
- .0;
- (ug, vg)
- };
- neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED);
// `update_partition_context` writes `partition_context_lookup[subsize]`
// over the whole 8x8 span -- BLOCK_4X8's width above and height left, the
// same values [`decode_leaf_rect8`] writes for the intra shape.
@@ -23255,21 +24106,6 @@ fn decode_inter_sub8_rect2(
neighbours.above_side_mi[gc + cell] = bw;
neighbours.left_side_mi[gr + cell] = bh;
}
- let round_up_even = |n: usize| n.div_ceil(2) * 2;
- let bound_h = round_up_even(neighbours.mi_rows);
- let bound_w = round_up_even(neighbours.mi_cols);
- let u_state = neighbour_state(&u_grid);
- let v_state = neighbour_state(&v_grid);
- for cell in 0..2usize {
- if cell < 2usize.min(bound_h.saturating_sub(gr)) {
- neighbours.left[gr + cell][1] = u_state;
- neighbours.left[gr + cell][2] = v_state;
- }
- if cell < 2usize.min(bound_w.saturating_sub(gc)) {
- neighbours.above[gc + cell][1] = u_state;
- neighbours.above[gc + cell][2] = v_state;
- }
- }
Ok(())
}
@@ -24123,18 +24959,25 @@ fn decode_inter_block8(
// there before. Every leaf of the gate's stream is compound,
// so the 16x16 below a split block read partition ctx 0
// instead of 1 and mis-read PARTITION_SPLIT as NONE.
- // lane-vartxsplit r1: the COMPOUND twin of `decode_leaf8`'s
- // `saved_luma_ctx` (class: twin functions drift). When the
- // leaf's transform split, `read_inter_luma8` returns an
- // all-zero placeholder grid and each 4x4 TU has already
- // written its own plane-0 coefficient state through
- // `record_mi_luma`; recording the placeholder over all three
- // planes erased those four cul_level/DC-sign cells, so the
- // NEXT block read `dc_sign_ctx` 1 where libaom reads 0.
+ // lane-sub8x4 r1: the same plane-0 save/restore the fall-through
+ // (single-ref) path runs below -- a `split8` leaf's plane-0
+ // neighbour context is per 4x4 transform unit (written by
+ // `record_mi_luma` inside `read_inter_luma8`), and `record_mi`
+ // rewrites all three planes from the whole-block grid, which is
+ // all-zero in the split case. Missing here, a compound var-tx 8x8
+ // leaf published level 0 to its right/below neighbours: the next
+ // block's first TU read `skip_contexts[4][0] = 3` where aomdec
+ // reads `[4][4] = 6` (class early-return-skips-tail).
let saved_luma_ctx = split8.then(|| {
(
- [neighbours.left[leaf_mi.0][0], neighbours.left[leaf_mi.0 + 1][0]],
- [neighbours.above[leaf_mi.1][0], neighbours.above[leaf_mi.1 + 1][0]],
+ [
+ neighbours.left[leaf_mi.0][0],
+ neighbours.left[leaf_mi.0 + 1][0],
+ ],
+ [
+ neighbours.above[leaf_mi.1][0],
+ neighbours.above[leaf_mi.1 + 1][0],
+ ],
)
});
neighbours.record_mi(leaf_mi, 8, &[luma_grid, u_grid, v_grid]);
@@ -24154,10 +24997,18 @@ fn decode_inter_block8(
// dlist excludes it (3 luma samples on a 192x128 inter frame).
INTER8_SKIP_BAND_HITS.with(|c| c.set(c.get() + 1));
neighbours.fill_skip_grid(leaf_mi, 2, skip);
+ // lane-sub8x4 r2: `split8` is this leaf's OWN var-tx split, so
+ // the deblock grid must publish the TX_4X4 leaves' width the
+ // same way the fall-through arm below does (libaom
+ // `get_transform_size`, av1_loopfilter.c:207, reads the per-TU
+ // `inter_tx_size` for a non-skip inter luma block). Hardcoding
+ // 8 here left a compound var-tx 8x8 leaf's interior vertical
+ // edge at x % 8 == 4 unfiltered -- class early-return-skips-tail,
+ // third instance in this same arm.
neighbours.fill_lf_grid(
leaf_mi,
2,
- 8,
+ if split8 { 4 } else { 8 },
if is_inter { leaf_refs.0.max(LAST_FRAME) } else { 0 },
);
return Ok((
diff --git a/crates/ec-av1/src/mvstack.rs b/crates/ec-av1/src/mvstack.rs
index ad6ccc21..c13b0e3d 100644
--- a/crates/ec-av1/src/mvstack.rs
+++ b/crates/ec-av1/src/mvstack.rs
@@ -532,7 +532,10 @@ fn scan_row(
let Some(row) = mi_row.checked_add_signed(row_offset) else {
return false;
};
- let col_shift: usize = if row_offset.unsigned_abs() > 1 { 1 } else { 0 };
+ // libaom `scan_row_mbmi` (mvref_common.c:157): the shift steps BACK on an odd
+ // mi_col when the block is narrower than 8px (a 4-wide 1:4 strip / sub-8x8 leaf).
+ let col_shift: usize =
+ if row_offset.unsigned_abs() > 1 && !(mi_col & 1 != 0 && bw4 < 2) { 1 } else { 0 };
let use_step_16 = bw4 >= 16;
let end_mi = bw4.min(16);
let mut found = false;
@@ -550,7 +553,10 @@ fn scan_row(
len = len.max(2);
}
let mut weight = ROW_COL_WEIGHT_FLOOR;
- if bw4 <= n4 {
+ // libaom `scan_row_mbmi` (mvref_common.c:172) gates this on
+ // `xd->width >= mi_size_wide[BLOCK_8X8]` as well: a 4-wide block (a 1:4
+ // strip, a sub-8x8 leaf) keeps weight 2 and leaves `processed_rows` alone.
+ if bw4 >= 2 && bw4 <= n4 {
let inc = ((-max_row_offset + row_offset + 1) as usize).min(info.size_h);
weight = weight.max(inc as u32);
*processed_rows = (inc as isize - row_offset - 1).max(0) as usize;
@@ -614,7 +620,10 @@ fn scan_col(
let Some(col) = mi_col.checked_add_signed(col_offset) else {
return false;
};
- let row_shift: usize = if col_offset.unsigned_abs() > 1 { 1 } else { 0 };
+ // libaom `scan_col_mbmi` (mvref_common.c:206): same step-back on an odd mi_row
+ // under a 4-high block.
+ let row_shift: usize =
+ if col_offset.unsigned_abs() > 1 && !(mi_row & 1 != 0 && bh4 < 2) { 1 } else { 0 };
let use_step_16 = bh4 >= 16;
let end_mi = bh4.min(16);
let mut found = false;
@@ -632,7 +641,10 @@ fn scan_col(
len = len.max(2);
}
let mut weight = ROW_COL_WEIGHT_FLOOR;
- if bh4 <= n4 {
+ // libaom `scan_col_mbmi` (mvref_common.c:222): `xd->height >=
+ // mi_size_high[BLOCK_8X8]` gates this branch, so a 4-high block keeps
+ // weight 2 and leaves `processed_cols` alone.
+ if bh4 >= 2 && bh4 <= n4 {
let inc = ((-max_col_offset + col_offset + 1) as usize).min(info.size);
weight = weight.max(inc as u32);
*processed_cols = (inc as isize - col_offset - 1).max(0) as usize;
@@ -1362,7 +1374,10 @@ fn scan_row_compound(
let Some(row) = mi_row.checked_add_signed(row_offset) else {
return false;
};
- let col_shift: usize = if row_offset.unsigned_abs() > 1 { 1 } else { 0 };
+ // libaom `scan_row_mbmi` (mvref_common.c:157): the shift steps BACK on an odd
+ // mi_col when the block is narrower than 8px (a 4-wide 1:4 strip / sub-8x8 leaf).
+ let col_shift: usize =
+ if row_offset.unsigned_abs() > 1 && !(mi_col & 1 != 0 && bw4 < 2) { 1 } else { 0 };
let use_step_16 = bw4 >= 16;
let end_mi = bw4.min(16);
let mut found = false;
@@ -1380,7 +1395,10 @@ fn scan_row_compound(
len = len.max(2);
}
let mut weight = ROW_COL_WEIGHT_FLOOR;
- if bw4 <= n4 {
+ // libaom `scan_row_mbmi` (mvref_common.c:172) gates this on
+ // `xd->width >= mi_size_wide[BLOCK_8X8]` as well: a 4-wide block (a 1:4
+ // strip, a sub-8x8 leaf) keeps weight 2 and leaves `processed_rows` alone.
+ if bw4 >= 2 && bw4 <= n4 {
let inc = ((-max_row_offset + row_offset + 1) as usize).min(info.size_h);
weight = weight.max(inc as u32);
*processed_rows = (inc as isize - row_offset - 1).max(0) as usize;
@@ -1419,7 +1437,10 @@ fn scan_col_compound(
let Some(col) = mi_col.checked_add_signed(col_offset) else {
return false;
};
- let row_shift: usize = if col_offset.unsigned_abs() > 1 { 1 } else { 0 };
+ // libaom `scan_col_mbmi` (mvref_common.c:206): same step-back on an odd mi_row
+ // under a 4-high block.
+ let row_shift: usize =
+ if col_offset.unsigned_abs() > 1 && !(mi_row & 1 != 0 && bh4 < 2) { 1 } else { 0 };
let use_step_16 = bh4 >= 16;
let end_mi = bh4.min(16);
let mut found = false;
@@ -1437,7 +1458,10 @@ fn scan_col_compound(
len = len.max(2);
}
let mut weight = ROW_COL_WEIGHT_FLOOR;
- if bh4 <= n4 {
+ // libaom `scan_col_mbmi` (mvref_common.c:222): `xd->height >=
+ // mi_size_high[BLOCK_8X8]` gates this branch, so a 4-high block keeps
+ // weight 2 and leaves `processed_cols` alone.
+ if bh4 >= 2 && bh4 <= n4 {
let inc = ((-max_col_offset + col_offset + 1) as usize).min(info.size);
weight = weight.max(inc as u32);
*processed_cols = (inc as isize - col_offset - 1).max(0) as usize;
diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs
index 00aa0a27..cf39edbf 100644
--- a/crates/ec-av1/src/refusal_inventory.rs
+++ b/crates/ec-av1/src/refusal_inventory.rs
@@ -32,8 +32,6 @@ const REFUSALS: &[&str] = &[
"a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here",
"a split intra strip whose transform unit is {tx_w}x{tx_h} (no luma coefficient tables for that shape here)",
"an OBMC neighbour whose switchable interp filter was never recorded",
- "an intra 4x4 block inside an inter frame's sub-8x8 split (this decoder codes only inter 4x4 sub-blocks there)",
- "an intra 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition (this decoder codes only inter sub-blocks there)",
"a sub-8x8 inter block under a scaled reference (superres, unimplemented)",
"a rectangular inter luma transform unit whose shape has no coefficient table set here",
"a rectangular inter chroma transform unit whose shape has no coefficient table set here",
diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs
index 9e19dac0..ca57ca7a 100644
--- a/crates/ec-av1/src/stream.rs
+++ b/crates/ec-av1/src/stream.rs
@@ -80,6 +80,19 @@ pub fn rect32x8_inter_tu_hits() -> [usize; 2] {
crate::decode::rect32x8_inter_tu_hits()
}
+/// lane-intra16x4: `(16x4, 4x16, chroma-reference)` INTRA strips decoded inside
+/// an inter 16x16-level 1:4 partition.
+pub fn intra16x4_in_inter_hits() -> (usize, usize, usize) {
+ crate::decode::intra16x4_in_inter_hits()
+}
+
+/// lane-sub8intra: INTRA 8x4/4x8 leaves inside an inter frame's sub-8x8
+/// HORZ/VERT partition, `(8x4, 4x8, chroma-reference, mixed groups, split
+/// 4x4 leaves)`.
+pub fn sub8_intra_rect_hits() -> (usize, usize, usize, usize, usize) {
+ crate::decode::sub8_intra_rect_hits()
+}
+
/// lane-r14 r3: RECTANGULAR var-tx leaf transform units, `[32x16, 16x32]` --
/// the leaves `sub_tx_size_map` produces when a 1:4 strip with a 64-px axis
/// splits its transform (`[TX_64X16] == TX_32X16`, `[TX_16X64] == TX_16X32`).
@@ -11047,6 +11060,321 @@ mod tests {
}
+ #[test]
+ #[ignore = "RED at lane-intra16x4 r2, but NOT on this lane's shape: the r2 OBMC \
+ pair-merge fix makes the decode entropy-exact through the intra 16x4 strips \
+ (620/620 all_zero symbols match aomdec, value and range), and the new arm 4 \
+ (bar_h, cq63, --min-partition-size=8, 192x128, 5 strips) decodes 6 frames \
+ bit-exact vs ffmpeg outside the harness. Attempt 0 (noise, cq60, 128x128) \
+ still mismatches from (122, 13) -- 99 rows ABOVE its first strip, measured in \
+ r1 as another shape's defect -- and panics before arm 4 runs. Un-ignore once \
+ attempt 0's defect is owned -- lanes/intra16x4-r2.handoff.md"]
+ // lane-intra16x4 r1: an INTRA-coded 16x4 / 4x16 strip inside an INTER
+ // frame's 16x16-level 1:4 partition -- the wall all six of his film cuts
+ // stopped at once lane-rectres landed. The shape's chroma is the pair's:
+ // `is_chroma_reference` (av1_common_int.h:1454) is false on the even
+ // strips (which read no `uv_mode` and code no chroma at all) and the odd
+ // one codes ONE 8x4 (4x8) chroma unit at the pair's origin -- and when the
+ // pair mixes an intra and an inter strip, the chroma is predicted per the
+ // strip that CARRIES it, which is exactly what routing the intra strip
+ // through the key frame's own proven per-strip body
+ // (`decode_rect4_16_strip`) gives.
+ //
+ // Recipes found by a 24 + 24 run sweep (three sources x cq 16..63 x two
+ // sizes, `~/.cache/intra16x4-tmp/sweep*.sh`): aomenc only picks an INTRA
+ // 1:4 strip on an inter frame at HIGH cq over content its MC cannot
+ // predict -- a per-frame-random bright bar sweeping the frame (HORZ_4
+ // strips) and a `X*Y` product sinusoid under temporal noise (VERT_4).
+ // Both sources hash identically twice (report).
+ fn a_real_aomenc_inter_sequence_with_intra_16x4_strips_in_1to4_partitions_decodes_pixel_exact() {
+ const NAME: &str =
+ "a_real_aomenc_inter_sequence_with_intra_16x4_strips_in_1to4_partitions_decodes_pixel_exact";
+ let _gate_lock = lock_gate_counters();
+ if !have_ffmpeg() {
+ eprintln!("SKIP {NAME}: no ffmpeg");
+ return;
+ }
+ if !have_aomenc() {
+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
+ return;
+ }
+ let frame_count = 6usize;
+ // (source kind, cq, width, height) -- the four recipes of the 48-run
+ // sweep (`~/.cache/intra16x4-tmp/sweep*.sh`, table in the report) that
+ // reach an INTRA 1:4 strip on an inter frame. `bar` is a per-frame
+ // random bright bar sweeping the frame (its MC failure is what makes
+ // aomenc's RD pick intra at 16x4), `prod` an `X*Y` product sinusoid
+ // under temporal noise; `_v` transposes the structure so the RD picks
+ // PARTITION_VERT_4.
+ // lane-intra16x4 r2: the last field is `--min-partition-size` -- the
+ // `bar_h` recipe (a horizontal bar sweeping DOWN the frame) at
+ // `--min-partition-size=8` is the one recipe of the r2 96-run sweep
+ // (`~/.cache/intra16x4-tmp/sweep_r2.sh`) that fires intra 16x4 strips
+ // WITHOUT also carrying the sub-8x8 intra block another lane refuses,
+ // so it is the arm that can be pixel-compared at all.
+ const RECIPES: [(&str, u32, usize, usize, u32); 5] = [
+ ("noise", 60, 128, 128, 4),
+ ("bar", 60, 192, 128, 4),
+ ("prod_v", 56, 128, 128, 4),
+ ("prod", 56, 160, 128, 4),
+ ("bar_h", 63, 192, 128, 8),
+ ];
+ // [16x4 intra strips, 4x16 intra strips, of which chroma-reference]:
+ // how many pixel-exact attempts fired each, over both bit depths.
+ let mut arms_total = [0u32; 3];
+ // Attempts that refused on the sub-8x8 intra block inside an inter
+ // frame -- a DIFFERENT lane's shape, and the measured blocker of every
+ // VERT_4-carrying recipe in the sweep.
+ let mut sub8_intra_refusals = 0u32;
+ // Every failure the sweep sees, asserted ONCE at the end.
+ let mut failures: Vec = Vec::new();
+ // Per bit depth: attempts that decoded at all, and attempts that fired an
+ // intra 1:4 strip AND compared pixel-exact.
+ let mut decoded_per_depth = [0u32; 2];
+ let mut fired_exact_per_depth = [0u32; 2];
+ for (depth_idx, bit_depth) in [8u32, 10u32].into_iter().enumerate() {
+ let (mut named_refusals, mut matched, mut out_of_scope, mut oos_mismatch) =
+ (0u32, 0u32, 0u32, 0u32);
+ let mut arms_proved = [0u32; 3];
+ for attempt in 0..RECIPES.len() as u32 {
+ let (kind, cq, width, height, min_part) = RECIPES[attempt as usize];
+ let duration = frame_count as f64 / 25.0;
+ // Both sources are deterministic (two identical y4m hashes,
+ // report): `random()` here is geq's own indexed PRNG and the
+ // noise filter carries an explicit `all_seed`.
+ let (lum, noise) = match kind {
+ "noise" => (
+ format!("128+58*sin((X+N*3)/6)+40*sin(Y/11)"),
+ ",noise=alls=40:allf=t+u:all_seed=7",
+ ),
+ "bar" => (
+ format!(
+ "if(lt(mod(X+N*37,{width}),24),random(N*100+X+Y)*255,128+50*sin(Y/7))"
+ ),
+ "",
+ ),
+ "bar_h" => (
+ format!(
+ "if(lt(mod(Y+N*37,{height}),24),random(N*100+X+Y)*255,128+50*sin(X/7))"
+ ),
+ "",
+ ),
+ "prod_v" => (
+ "128+60*sin((X*Y+N*97)/13)+50*sin((Y+N*11)/5)".to_string(),
+ ",noise=alls=25:allf=t:all_seed=11",
+ ),
+ _ => (
+ "128+60*sin((X*Y+N*97)/13)+50*sin((X+N*11)/5)".to_string(),
+ ",noise=alls=25:allf=t:all_seed=11",
+ ),
+ };
+ let source = format!(
+ "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\
+ geq=lum='{lum}',format=yuv420p{noise}"
+ );
+ let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" };
+ let y4m = Command::new("ffmpeg")
+ .args([
+ "-v", "error", "-f", "lavfi", "-i", &source, "-t", &duration.to_string(),
+ "-pix_fmt", pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-",
+ ])
+ .stdin(Stdio::null())
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped())
+ .output()
+ .expect("ffmpeg failed to run");
+ assert!(
+ y4m.status.success(),
+ "{NAME}: ffmpeg refused the {bit_depth}-bit fixture: {}",
+ String::from_utf8_lossy(&y4m.stderr)
+ );
+ let cq_arg = format!("--cq-level={cq}");
+ let min_part_arg = format!("--min-partition-size={min_part}");
+ let depth_arg = format!("--bit-depth={bit_depth}");
+ let input_depth_arg = format!("--input-bit-depth={bit_depth}");
+ let args: Vec<&str> = vec![
+ "--codec=av1", "--passes=1", "--end-usage=q", &cq_arg, "--cpu-used=0",
+ "--threads=1", "--row-mt=0", "--sb-size=64", &depth_arg, &input_depth_arg,
+ "--enable-restoration=0", "--enable-palette=0", "--deltaq-mode=0",
+ "--enable-filter-intra=0", "--enable-cfl-intra=0", "--enable-intrabc=0",
+ "--lag-in-frames=0", "--kf-max-dist=9999", "--tile-columns=0",
+ // Per-arm overrides go LAST (aomenc keeps the last
+ // occurrence of a repeated --enable-* flag).
+ "--enable-tx-size-search=1", "--enable-rect-partitions=1",
+ "--enable-ab-partitions=1", "--enable-1to4-partitions=1",
+ "--enable-intra-edge-filter=1",
+ &min_part_arg, "--max-partition-size=16",
+ "--obu", "-o", "-", "-",
+ ];
+ let mut child = Command::new(aomenc_path())
+ .args(&args)
+ .stdin(Stdio::piped())
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped())
+ .spawn()
+ .expect("aomenc failed to start");
+ child
+ .stdin
+ .take()
+ .expect("aomenc stdin")
+ .write_all(&y4m.stdout)
+ .expect("writing y4m to aomenc");
+ let out = child.wait_with_output().expect("aomenc failed to run");
+ assert!(
+ out.status.success(),
+ "aomenc refused the fixture: {}",
+ String::from_utf8_lossy(&out.stderr)
+ );
+ let stream = out.stdout;
+ let before = crate::stream::intra16x4_in_inter_hits();
+ let frames = match decode_stream(&stream) {
+ Err(e) => {
+ let msg = e.to_string();
+ // lane-intra16x4 r3: the ONLY refusals the 120-run sweep
+ // (`~/.cache/intra16x4-tmp/sweep_r3.sh`, table in the
+ // report) reaches over these recipes -- each another
+ // lane's shape. A refusal outside this list is a new wall
+ // and fails the gate rather than being counted.
+ const MEASURED_REFUSALS: [&str; 3] = [
+ "an intra 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition",
+ "an intra 4x4 block inside an inter frame's sub-8x8 split",
+ "an OBMC neighbour whose switchable interp filter was never recorded",
+ ];
+ if !MEASURED_REFUSALS.iter().any(|r| msg.contains(r)) {
+ failures.push(format!(
+ "{bit_depth}-bit attempt {attempt}: refusal outside the measured \
+ list: {msg}"
+ ));
+ continue;
+ }
+ if msg.contains("sub-8x8") {
+ sub8_intra_refusals += 1;
+ }
+ named_refusals += 1;
+ eprintln!("{bit_depth}-bit attempt {attempt} refusal: {msg}");
+ continue;
+ }
+ Ok(frames) => frames,
+ };
+ decoded_per_depth[depth_idx] += 1;
+ let after = crate::stream::intra16x4_in_inter_hits();
+ let fired = [
+ (after.0 - before.0) as u32,
+ (after.1 - before.1) as u32,
+ (after.2 - before.2) as u32,
+ ];
+ let ffmpeg_frames = if bit_depth == 10 {
+ ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count)
+ } else {
+ ffmpeg_decode_sequence(&stream, width, height, frame_count)
+ };
+ assert_eq!(frames.len(), frame_count);
+ let mismatched = frames
+ .iter()
+ .zip(&ffmpeg_frames)
+ .any(|(got, want)| got.y != want.y || got.u != want.u || got.v != want.v);
+ if fired[0] + fired[1] == 0 {
+ out_of_scope += 1;
+ if mismatched {
+ oos_mismatch += 1;
+ eprintln!(
+ "{NAME}: {bit_depth}-bit attempt {attempt} MISMATCHES with zero \
+ intra 1:4 strip -- another shape's defect"
+ );
+ }
+ continue;
+ }
+ if mismatched {
+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
+ let bad: Vec =
+ (0..got.y.len()).filter(|&k| got.y[k] != want.y[k]).collect();
+ if !bad.is_empty() {
+ eprintln!(
+ "{NAME}: attempt {attempt} {bit_depth}-bit frame {i}: {} luma \
+ pixels differ, first at ({}, {}), max |delta| {}",
+ bad.len(),
+ bad[0] % width,
+ bad[0] / width,
+ bad.iter()
+ .map(|&k| (got.y[k] as i32 - want.y[k] as i32).abs())
+ .max()
+ .unwrap_or(0)
+ );
+ }
+ }
+ }
+ // lane-intra16x4 r3: continue-and-sweep -- a mismatching attempt is
+ // RECORDED and the sweep goes on, so one arm's defect can no longer
+ // hide every later arm (r2's attempt 0 panicked before arm 4 ran).
+ // The end-of-sweep assert below fails on any recorded mismatch.
+ if mismatched {
+ failures.push(format!(
+ "{bit_depth}-bit attempt {attempt} (arms {fired:?}) mismatched ffmpeg"
+ ));
+ continue;
+ }
+ for a in 0..3 {
+ if fired[a] > 0 {
+ arms_proved[a] += 1;
+ arms_total[a] += 1;
+ }
+ }
+ matched += 1;
+ fired_exact_per_depth[depth_idx] += 1;
+ }
+ eprintln!(
+ "{NAME} ({bit_depth}-bit): {named_refusals} named refusals, {matched} pixel-exact \
+ attempts carrying an intra 1:4 strip, per-arm attempts \
+ 16x4/4x16/chroma-reference={arms_proved:?}, {out_of_scope} attempts carried none \
+ ({oos_mismatch} of them mismatched)"
+ );
+ if oos_mismatch > 0 {
+ failures.push(format!(
+ "{bit_depth}-bit: {oos_mismatch} attempt(s) with no intra 1:4 strip decoded \
+ but mismatched ffmpeg -- another shape's defect, not a pass"
+ ));
+ }
+ }
+ assert!(
+ failures.is_empty(),
+ "{NAME}: {} sweep failure(s): {failures:#?}",
+ failures.len()
+ );
+ // The counter must have fired on a pixel-exact attempt at every bit depth
+ // the sweep actually decoded at.
+ for (depth_idx, bit_depth) in [8u32, 10u32].into_iter().enumerate() {
+ assert!(
+ decoded_per_depth[depth_idx] == 0 || fired_exact_per_depth[depth_idx] > 0,
+ "{NAME}: {bit_depth}-bit decoded {} attempt(s) but none of them fired an intra \
+ 1:4 strip on a pixel-exact compare",
+ decoded_per_depth[depth_idx]
+ );
+ }
+ // MEASURED (48-run sweep, report table): every recipe that makes
+ // aomenc pick an intra PARTITION_VERT_4 strip ALSO contains an intra
+ // 8x4/4x8 or 4x4 block inside a sub-8x8 partition, a refusal this lane
+ // does not own -- so the 4x16 orientation is blocked on THAT and the
+ // gate asserts exactly that. If the sub-8x8 lane lands and this arm
+ // still reads 0, or the blocker changes, this fails.
+ assert!(
+ arms_total[1] > 0 || sub8_intra_refusals > 0,
+ "{NAME}: the 4x16 (PARTITION_VERT_4) arm read 0 \
+ (16x4/4x16/chroma-reference={arms_total:?}) and NO attempt refused on the sub-8x8 \
+ intra block -- its documented blocker is gone, so a zero arm is now unexplained"
+ );
+ for (a, what) in [
+ (0usize, "intra 16x4 strips (PARTITION_HORZ_4)"),
+ (2, "chroma-reference (odd) intra strips carrying the pair's 8x4/4x8 chroma"),
+ ] {
+ assert!(
+ arms_total[a] > 0,
+ "{NAME}: arm {a} ({what}) never fired on a pixel-exact attempt \
+ (16x4/4x16/chroma-reference={arms_total:?}) -- unproven"
+ );
+ }
+ }
+
+
#[test]
// lane-sbab r1: the SUPERBLOCK-level (64x64) AB partitions on an INTER
// frame -- PARTITION_HORZ_A/_HORZ_B/_VERT_A/_VERT_B at 64x64, i.e. two
@@ -29587,8 +29915,11 @@ mod tests {
/// here)". The moment TX_64X32/TX_32X64 luma coefficient tables land, drop
/// the `#[ignore]` -- everything else this gate needs (the reader, the
/// counter, the two-frame pixel compare) is in place and runs.
+ ///
+ /// lane-sub8x4 r3: un-`#[ignore]`d. The sibling refusal it waited on (the
+ /// un-split TX_64X32/TX_32X64 corner unit) is lifted in this round, so the
+ /// frame this gate exists for now finishes.
#[test]
- #[ignore = "blocked on a SIBLING refusal, not on this lane: the film frame that carries the intra 1:4 strips (16x64=3) stops at \"a split intra strip whose transform unit is 64x32 (no luma coefficient tables for that shape here)\" -- un-ignore when the 64x32/32x64 luma coefficient tables land"]
fn a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact() {
const NAME: &str = "a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact";
if !have_ffmpeg() {
@@ -29616,15 +29947,345 @@ mod tests {
now.2 - before.2,
now.3 - before.3
);
- assert_eq!(frames.len(), 2, "{NAME}: key frame + one inter frame");
+ // lane-sub8x4 r3, MEASURED when this gate first RAN: the fixture has
+ // TWO frame OBUs but only ONE SHOWN frame -- a raw
+ // `ffmpeg -i -pix_fmt yuv420p10le -f rawvideo` writes exactly
+ // 18524160 bytes, one 3840x1608 10-bit frame, so the second is a
+ // no-show frame and `frames.len() == 2` was never true. The compare is
+ // not vacuous: ffmpeg's own frame count is asserted equal to ours.
+ assert_eq!(frames.len(), 1, "{NAME}: one shown frame (the second frame OBU is a no-show)");
assert_eq!((frames[0].width, frames[0].height), (width, height));
let ffmpeg_frames = ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len());
+ assert_eq!(
+ ffmpeg_frames.len(),
+ frames.len(),
+ "{NAME}: ffmpeg returned {} frames, we decoded {}",
+ ffmpeg_frames.len(),
+ frames.len()
+ );
+ for (i, (ours, theirs)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
+ assert_eq!(ours.y, theirs.y, "{NAME}: frame {i} luma vs ffmpeg");
+ assert_eq!(ours.u, theirs.u, "{NAME}: frame {i} U vs ffmpeg");
+ assert_eq!(ours.v, theirs.v, "{NAME}: frame {i} V vs ffmpeg");
+ }
+ eprintln!("{NAME}: {fired} intra 1:4 strips in an inter frame, the shown frame pixel-exact");
+ }
+
+ /// lane-sub8x4 r3: the FILM witness that lifts BOTH the intra 16x4/4x16
+ /// strip inside an inter 16x16-level 1:4 partition and the un-split
+ /// TX_64X32/TX_32X64 corner unit of a split intra strip.
+ ///
+ /// `crates/ec-av1/fixtures/reelb_rect64_intra16x4_witness.obu`, 23472 bytes,
+ /// sha256 `c9e721088766163b9dbeb9fa8dd8b257ff0ec7f9157fc350de4d3c33cd9ec4e4`:
+ /// the first 50 frame-carrying OBUs of `ffmpeg -ss 0 -t 2 -i <3840x1608
+ /// 10-bit AV1 HDR10 mkv> -c:v copy -f obu`, cut twice from independent
+ /// ffmpeg runs that hashed identically. 33 decode-order frames.
+ ///
+ /// MEASURED, and why no earlier round had this: r1/r2 of two lanes
+ /// reported "no firing witness exists" because every film frame that fires
+ /// these two arms ALSO carries a sub-8x8 intra leaf, which refused until
+ /// this lane's r2 lifted it. On that tip the whole 33-frame prefix decodes
+ /// with no refusal and matches ffmpeg on every plane of every frame, while
+ /// both arms fire: `intra16x4_in_inter` 16x4=31 4x16=17 chroma_ref=23 and
+ /// `rect64_corner_tu` 64x32=90 32x64=5. (The full 48-frame 2 s segment
+ /// diverges at decode-order frame 36, which is a separate wall; the
+ /// fixture is the exact prefix, not a truncation chosen to hide it.)
+ ///
+ /// Both refusal strings stay in `refusal_inventory` because both are
+ /// NARROWED, not deleted: "a split intra strip whose transform unit is
+ /// {tx_w}x{tx_h}" still stands for every shape other than 64x32/32x64, and
+ /// "an intra 16x4/4x16 strip inside an inter 16x16-level 1:4 partition"
+ /// still stands for a strip with no chroma-pair record.
+ #[test]
+ fn a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus_decode_pixel_exact() {
+ const NAME: &str =
+ "a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus_decode_pixel_exact";
+ if !have_ffmpeg() {
+ eprintln!("SKIP {NAME}: no ffmpeg");
+ return;
+ }
+ let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
+ .join("fixtures/reelb_rect64_intra16x4_witness.obu");
+ let stream = std::fs::read(&path)
+ .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display()));
+ let (width, height) = (3840usize, 1608usize);
+ let before16 = crate::decode::intra16x4_in_inter_hits();
+ let before64 = (
+ crate::decode::rect64_corner_tu_hits(0),
+ crate::decode::rect64_corner_tu_hits(1),
+ );
+ let frames = match decode_stream(&stream) {
+ Ok(frames) => frames,
+ Err(e) => panic!("{NAME}: decode_stream refused: {e}"),
+ };
+ let now16 = crate::decode::intra16x4_in_inter_hits();
+ let fired16 = (
+ now16.0 - before16.0,
+ now16.1 - before16.1,
+ now16.2 - before16.2,
+ );
+ let fired64 = (
+ crate::decode::rect64_corner_tu_hits(0) - before64.0,
+ crate::decode::rect64_corner_tu_hits(1) - before64.1,
+ );
+ // Hard counter asserts: neither lift may rest on a stream that stopped
+ // carrying its shape (class `tool-disabled-in-every-gate`).
+ assert!(
+ fired16.0 > 0 && fired16.1 > 0 && fired16.2 > 0,
+ "{NAME}: the intra 16x4/4x16 strip arm did not fire (16x4={} 4x16={} chroma_ref={})",
+ fired16.0,
+ fired16.1,
+ fired16.2
+ );
+ assert!(
+ fired64.0 > 0 && fired64.1 > 0,
+ "{NAME}: the un-split TX_64X32/TX_32X64 corner arm did not fire (64x32={} 32x64={})",
+ fired64.0,
+ fired64.1
+ );
+ assert_eq!(frames.len(), 33, "{NAME}: 33 decode-order frames");
+ assert_eq!((frames[0].width, frames[0].height), (width, height));
+ let ffmpeg_frames = ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len());
+ assert_eq!(
+ ffmpeg_frames.len(),
+ frames.len(),
+ "{NAME}: ffmpeg returned {} frames, we decoded {}",
+ ffmpeg_frames.len(),
+ frames.len()
+ );
for (i, (ours, theirs)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
assert_eq!(ours.y, theirs.y, "{NAME}: frame {i} luma vs ffmpeg");
assert_eq!(ours.u, theirs.u, "{NAME}: frame {i} U vs ffmpeg");
assert_eq!(ours.v, theirs.v, "{NAME}: frame {i} V vs ffmpeg");
}
- eprintln!("{NAME}: {fired} intra 1:4 strips in an inter frame, both frames pixel-exact");
+ eprintln!(
+ "{NAME}: 33 frames pixel-exact, intra16x4_in_inter 16x4={} 4x16={} chroma_ref={}, \
+ rect64_corner_tu 64x32={} 32x64={}",
+ fired16.0, fired16.1, fired16.2, fired64.0, fired64.1
+ );
+ }
+
+
+ /// lane-sub8x4 r2, the gate that lifts BOTH sub-8x8 intra refusals ("an
+ /// intra 4x4 block inside an inter frame's sub-8x8 split" and "an intra
+ /// 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition").
+ ///
+ /// Recipe (measured, `~/.cache/sub8intra-tmp/sweep3.sh`): a 24-row band of
+ /// per-frame-moving noise over a smooth sinusoid, `--min-partition-size=4
+ /// --max-partition-size=8 --enable-1to4-partitions=0` -- at that maximum a
+ /// 16x4 shape cannot exist, so nothing here can be confused with the
+ /// still-refused intra 1:4 strip, and the noise band is what makes aomenc's
+ /// RD pick INTRA leaves inside an inter frame's 8x8 groups. 12 arms
+ /// (8/10-bit x cq 48/55/63 x 128x128/192x128) plus one `--tile-columns=1`
+ /// arm (COMMON's neighbour-map rule: these leaves publish per-mi side
+ /// bands), 6 frames each, every decode-order frame and all three planes
+ /// compared against ffmpeg. Continue-and-sweep: a NAMED refusal is
+ /// recorded and the arm skipped, any other decode error or any pixel
+ /// mismatch fails the gate on the spot.
+ ///
+ /// The end-of-sweep assert reads all five
+ /// [`decode::sub8_intra_rect_hits`] cells -- 8x4 leaves, 4x8 leaves, the
+ /// chroma-reference ones (which code the group's 4x4 chroma intra),
+ /// `is_sub8x8_inter`-false MIXED groups, and the `PARTITION_SPLIT` 4x4
+ /// leaves (the second refusal's own arm) -- so neither lifted refusal
+ /// rests on a stream that never carried its shape.
+ #[test]
+ fn a_real_aomenc_inter_sequence_with_intra_sub8x8_leaves_decodes_pixel_exact() {
+ const NAME: &str = "a_real_aomenc_inter_sequence_with_intra_sub8x8_leaves_decodes_pixel_exact";
+ if !have_ffmpeg() {
+ eprintln!("SKIP {NAME}: no ffmpeg");
+ return;
+ }
+ if !have_aomenc() {
+ let msg = format!("no aomenc at {}", aomenc_path().display());
+ assert!(
+ std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_none(),
+ "EC_AV1_REQUIRE_AOMENC is set but {msg}"
+ );
+ eprintln!("SKIP {NAME}: {msg}");
+ return;
+ }
+ const FRAMES: usize = 6;
+ // One arm's stream, byte for byte: the lavfi source (a moving 24-row
+ // random band over `128+50*sin(x/7)`) feeds aomenc through a pipe.
+ let encode = |depth: u32, cq: u32, width: usize, height: usize, tiles: bool| -> Vec {
+ let pix = if depth == 10 { "yuv420p10le" } else { "yuv420p" };
+ let source = format!(
+ "color=c=gray:s={width}x{height}:d=0.24:r=25,format=gray,\
+ geq=lum='if(lt(mod(Y+N*37\\,{height})\\,24)\\,random(N*100+X+Y)*255\\,128+50*sin(X/7))',\
+ format={pix}"
+ );
+ let y4m = Command::new("ffmpeg")
+ .args([
+ "-v", "error", "-f", "lavfi", "-i", &source, "-t", "0.24", "-pix_fmt", pix,
+ "-strict", "-1", "-f", "yuv4mpegpipe", "-",
+ ])
+ .stdin(Stdio::null())
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped())
+ .output()
+ .expect("ffmpeg failed to run");
+ assert!(
+ y4m.status.success(),
+ "{NAME}: ffmpeg fixture (depth={depth} cq={cq} {width}x{height}): {}",
+ String::from_utf8_lossy(&y4m.stderr)
+ );
+ let cq_arg = format!("--cq-level={cq}");
+ let mut args: Vec<&str> = vec![
+ "--codec=av1",
+ "--passes=1",
+ "--end-usage=q",
+ &cq_arg,
+ "--cpu-used=0",
+ "--threads=1",
+ "--row-mt=0",
+ "--sb-size=64",
+ "--enable-restoration=0",
+ "--enable-palette=0",
+ "--deltaq-mode=0",
+ "--enable-intrabc=0",
+ "--lag-in-frames=0",
+ "--kf-max-dist=9999",
+ "--enable-tx-size-search=1",
+ "--enable-rect-partitions=1",
+ // The 16x4/4x16 intra strip is a DIFFERENT (still refused)
+ // shape; keeping 1:4 off is what makes a refusal here mean
+ // this gate's own arm.
+ "--enable-1to4-partitions=0",
+ "--min-partition-size=4",
+ "--max-partition-size=8",
+ ];
+ if depth == 10 {
+ args.push("--bit-depth=10");
+ args.push("--input-bit-depth=10");
+ }
+ // AOMENC FLAG PRECEDENCE (COMMON): the per-arm override goes last.
+ args.push(if tiles { "--tile-columns=1" } else { "--tile-columns=0" });
+ args.extend(["--obu", "-o", "-", "-"]);
+ let mut child = Command::new(aomenc_path())
+ .args(&args)
+ .stdin(Stdio::piped())
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped())
+ .spawn()
+ .expect("aomenc failed to start");
+ child
+ .stdin
+ .take()
+ .expect("aomenc stdin")
+ .write_all(&y4m.stdout)
+ .expect("writing y4m to aomenc");
+ let out = child.wait_with_output().expect("aomenc failed to run");
+ assert!(
+ out.status.success(),
+ "{NAME}: aomenc refused the fixture (depth={depth} cq={cq} {width}x{height}): {}",
+ String::from_utf8_lossy(&out.stderr)
+ );
+ out.stdout
+ };
+
+ let mut refusals: Vec = Vec::new();
+ let mut exact_arms = 0u32;
+ let mut fired = [0usize; 5];
+ let mut checked_reproducible = false;
+ let mut arms: Vec<(u32, u32, usize, usize, bool)> = Vec::new();
+ for depth in [8u32, 10] {
+ for cq in [48u32, 55, 63] {
+ for (w, h) in [(128usize, 128usize), (192usize, 128usize)] {
+ arms.push((depth, cq, w, h, false));
+ }
+ }
+ }
+ // lane-sub8x4 r3: the `--tile-columns=1` arm COMMON's neighbour-map
+ // rule asks for. It was excluded in r2 because it desynced at
+ // decode-order frame 4 -- identically with `--min-partition-size=16
+ // --max-partition-size=16`, i.e. with no sub-8x8 block at all. That was
+ // main's `1d2259c` (the saved motion field kept only the LAST tile's
+ // columns), merged into this lane in r3; the arm is restored here.
+ arms.push((8, 63, 192, 128, true));
+ for (depth, cq, width, height, tiles) in arms {
+ let arm = format!("depth={depth} cq={cq} {width}x{height} tiles={tiles}");
+ let stream = encode(depth, cq, width, height, tiles);
+ if !checked_reproducible {
+ // seeded-fixture-not-reproducible: prove the recipe names ONE
+ // stream before any measurement rests on it.
+ let again = encode(depth, cq, width, height, tiles);
+ assert_eq!(
+ stream, again,
+ "{NAME}: the fixture recipe is not reproducible ({arm}, {} vs {} bytes)",
+ stream.len(),
+ again.len()
+ );
+ checked_reproducible = true;
+ }
+ let before = decode::sub8_intra_rect_hits();
+ let tiles_before = decode::tile_hits();
+ let frames = match decode_stream(&stream) {
+ Ok(frames) => frames,
+ Err(e) => {
+ let msg = e.to_string();
+ assert!(
+ msg.starts_with("unsupported: "),
+ "{NAME}: decode error that is not a named refusal ({arm}): {msg}"
+ );
+ refusals.push(format!("{arm}: {msg}"));
+ continue;
+ }
+ };
+ assert_eq!(frames.len(), FRAMES, "{NAME}: {arm} decoded {} frames", frames.len());
+ assert!(
+ !tiles || decode::tile_hits() - tiles_before >= 2,
+ "{NAME}: {arm} decoded only {} tile(s)",
+ decode::tile_hits() - tiles_before
+ );
+ let theirs = if depth == 10 {
+ ffmpeg_decode_sequence_10bit(&stream, width, height, FRAMES)
+ } else {
+ ffmpeg_decode_sequence(&stream, width, height, FRAMES)
+ };
+ for (i, (ours, theirs)) in frames.iter().zip(&theirs).enumerate() {
+ assert_eq!(ours.y, theirs.y, "{NAME}: {arm} frame {i} luma vs ffmpeg");
+ assert_eq!(ours.u, theirs.u, "{NAME}: {arm} frame {i} U vs ffmpeg");
+ assert_eq!(ours.v, theirs.v, "{NAME}: {arm} frame {i} V vs ffmpeg");
+ }
+ let now = decode::sub8_intra_rect_hits();
+ let delta = [
+ now.0 - before.0,
+ now.1 - before.1,
+ now.2 - before.2,
+ now.3 - before.3,
+ now.4 - before.4,
+ ];
+ exact_arms += 1;
+ for (slot, d) in fired.iter_mut().zip(delta) {
+ *slot += d;
+ }
+ eprintln!(
+ "{NAME}: {arm} EXACT 8x4={} 4x8={} chroma_ref={} mixed={} split4x4={}",
+ delta[0], delta[1], delta[2], delta[3], delta[4]
+ );
+ }
+ assert!(
+ exact_arms >= 12,
+ "{NAME}: only {exact_arms} arm(s) decoded and compared exact; refusals:\n{}",
+ refusals.join("\n")
+ );
+ for (cell, what) in fired.iter().zip([
+ "intra 8x4 leaves",
+ "intra 4x8 leaves",
+ "chroma-reference intra leaves",
+ "is_sub8x8_inter-false MIXED groups",
+ "intra 4x4 leaves of a sub-8x8 PARTITION_SPLIT",
+ ]) {
+ assert!(
+ *cell > 0,
+ "{NAME}: zero {what} over {exact_arms} pixel-exact arms -- the lifted refusal \
+ rests on nothing (counters {fired:?})"
+ );
+ }
+ eprintln!(
+ "{NAME}: {exact_arms} arms pixel-exact over {FRAMES} frames each, counters {fired:?}"
+ );
}
}
diff --git a/lanes/intra16x4-r1.handoff.md b/lanes/intra16x4-r1.handoff.md
new file mode 100644
index 00000000..c8497b24
--- /dev/null
+++ b/lanes/intra16x4-r1.handoff.md
@@ -0,0 +1,72 @@
+# lane-intra16x4 r1 HANDOFF (tip 17462bc + this file)
+
+Env bypass name is **`EC_INTRA16X4_DECODE=1`** (decode path) and `EC_INTRA16X4=1` (traces
+only) — the coordinator's message says `EC_INTRA16X4`; the decode switch is the `_DECODE`
+one. Default behaviour without it: the original refusal, unchanged.
+
+## Step 1 measurement (env print at the refusal site, `EC_INTRA16X4=1`, `EC_RECT64_SPLIT=1`)
+
+| probe | shape | pair parity | has_chroma | prev strip single-ref inter | skip | tx_select |
+|---|---|---|---|---|---|---|
+| 10-bit 3840x1608 cut 0 | 16x4 | 0 (even) | false | – | 0 | 1 |
+| 10-bit 3840x1608 cut 300 | 4x16 | 0 | false | – | 0 | 1 |
+| 10-bit 1920x792 @900 | 4x16 | 0 | false | – | 0 | 1 |
+| 10-bit 1920x792 @5400 | 16x4 | 0 | false | – | 0 | 1 |
+| 10-bit 1920x792 @6300 | 16x4 | 0 | false | – | 0 | 1 |
+| 10-bit 1920x792 @8100 | 4x16 | 0 | false | – | 0 | 1 |
+
+6/6 fire first on an EVEN strip (`is_chroma_reference` false: no `uv_mode`, no chroma
+residual), non-skip, `--enable-tx-size-search` on, no screen-content tools.
+
+## What the path implements (all in crates/ec-av1/src/decode.rs)
+
+* `decode_rect4_16_strip` — the per-strip body of the key frame's `decode_rect4_16`,
+ lifted verbatim (mode info, luma whole-TU or split walk, the pair's single 8x4/4x8
+ chroma on the ODD strip at the pair's origin, palette/skip/lf/partition bands).
+ `decode_rect4_16` now calls it 4x — key-frame behaviour unchanged.
+* `decode_intra_rect_in_inter(.., strip16: Option<(horz, has_chroma)>, ..)` — new 16x4/
+ 4x16 arm running that body with `INTRA_IN_INTER_MODE = Some((0, skip))`
+ (`size_group_lookup[BLOCK_16X4] == 0`, oracle `common_data.h:61`). Mixed intra/inter
+ pairs need no new chroma code: the odd strip carries the pair's chroma predicted per
+ its own type, and the inter side's `InterStripChroma::prev == None` arm already covers
+ intra-then-inter.
+* The inter arm ALSO publishes `set_txfm_ctxs` (`above_txfm`/`left_txfm` = tx_w/tx_h) and
+ `txfm_partition_update_rect`, and reads tx-depth from `tx_size_context_txfm_rect`.
+ The key-frame body publishes none of that; without it the block AFTER the strip broke
+ while the strip's own pixels were exact (128x128 8-bit: strips at mi(23,16)/(23,20)
+ exact, damage from row 96, chroma exact).
+* Counter `intra16x4_in_inter_hits()` `[16x4, 4x16, chroma-reference]`, printed by
+ `decode_probe`.
+
+## Pixel state under the bypass
+
+* 10-bit 3840x1608 cut 0: no longer stops here — 14 intra 16x4 strips decoded, then
+ `an intra 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition`
+ (another lane). Same new refusal on cuts 300 / @900 / @5400 / @6300; @8100 stops on
+ `an intra-coded 16x4/4x16 strip on the inter block path` — that is the `_` arm of
+ `decode_intra_rect_in_inter` reached by a CLIPPED (frame-edge) shape, not a 1:4 strip.
+ No pixel comparison is possible on any cut: every firing frame also carries the
+ sub-8x8 intra block, so no OBU prefix decodes clean (hg-0 prefixes 50 and 52 both
+ refuse inside the same frame).
+* aomenc witness, 8-bit 192x128 cq60 "bar" recipe (`~/.cache/intra16x4-tmp/s5.obu`,
+ ref `ref5.yuv`, ours `ours5.yuv`): 6 frames decoded, frame 0 exact, **frame 1 LUMA
+ mismatches from (175, 0), 8400 px**; the two intra strips themselves (mi(1,40) and
+ mi(3,40) = px x160..175, y4..15) are exact and all chroma is exact. The first bad
+ pixel is in the EVEN (inter) strip ABOVE them.
+* The gate `a_real_aomenc_inter_sequence_with_intra_16x4_strips_in_1to4_partitions_
+ decodes_pixel_exact` (stream.rs) is written, red, and `#[ignore]`d with that
+ measurement in its reason string. No refusal lifted; refusal_inventory/gate_coverage
+ untouched.
+
+## Exact next step
+
+1. Reproduce with `~/.cache/intra16x4-tmp/s5.obu` (recipe in the report). Ladder the msac
+ RANGE (ours `EC_TRACE_COEFF` vs instrumented aomdec) across frame 1's superblock at
+ mi_col 40, mi_row 0..3 — decide first whether the (175,0) damage is entropy or
+ reconstruction; chroma being exact while luma is wrong argues reconstruction/deblock.
+2. Prime suspects, in order: (a) the deblock grid the intra strip writes over the PAIR
+ (its `fill_lf_grid_rect` runs at strip granularity while the caller's tail also
+ records the block), (b) the mv/mi field the tail stamps (`is_inter: false, ref -1`)
+ over rows the EVEN inter strip owns, (c) `above_side_mi`/`left_side_mi` partition
+ context published twice (strip body + caller tail).
+3. Only then re-run the gate; the 4x16 arm stays blocked on the sub-8x8 intra lane.
diff --git a/lanes/intra16x4-r1.report.md b/lanes/intra16x4-r1.report.md
new file mode 100644
index 00000000..05ca66e4
--- /dev/null
+++ b/lanes/intra16x4-r1.report.md
@@ -0,0 +1,110 @@
+# lane-intra16x4 r1 — an INTRA 16x4/4x16 strip inside an inter 16x16-level 1:4 partition
+
+## Step 1 MEASURE — what the six film probes actually stop on
+
+Env-gated print at the refusal site (`crates/ec-av1/src/decode.rs`, `EC_INTRA16X4=1`),
+each probe under `systemd-run --scope -p MemoryMax=6G`, `EC_RECT64_SPLIT=1`:
+
+| probe | shape | pair parity | has_chroma | prev strip single-ref inter | skip | tx_select | screen tools |
+|---|---|---|---|---|---|---|---|
+| 10-bit 3840x1608 cut 0 | 16x4 | 0 (EVEN) | false | – | 0 | 1 | 0 |
+| 10-bit 3840x1608 cut 300 | 4x16 | 0 | false | – | 0 | 1 | 0 |
+| 10-bit 1920x792 @900 | 4x16 | 0 | false | – | 0 | 1 | 0 |
+| 10-bit 1920x792 @5400 | 16x4 | 0 | false | – | 0 | 1 | 0 |
+| 10-bit 1920x792 @6300 | 16x4 | 0 | false | – | 0 | 1 | 0 |
+| 10-bit 1920x792 @8100 | 4x16 | 0 | false | – | 0 | 1 | 0 |
+
+6 of 6 first fire on an EVEN strip: `is_chroma_reference` false, so that strip reads no
+`uv_mode` and codes no chroma at all. All non-skip, all with `--enable-tx-size-search`
+on, none in a screen-content frame.
+
+EVIDENCE: shell probe, 6 streams | `EC_RECT64_SPLIT=1 EC_INTRA16X4=1 decode_probe ` | 3x 16x4 + 3x 4x16, all pair-parity 0 / has_chroma=false / skip=0
+
+## Step 2 IMPLEMENT
+
+* `decode.rs` `decode_rect4_16_strip` (new) — the per-strip body of the KEY FRAME's
+ `decode_rect4_16`, lifted verbatim into its own function (mode info, luma TU or split
+ walk, the pair's 8x4/4x8 chroma when `has_chroma`, palette bands, skip/lf/partition
+ bands). `decode_rect4_16` now calls it four times; no behaviour change on the key-frame
+ path (the whole suite is the check).
+* `decode.rs` `decode_intra_rect_in_inter` — new `strip16: Option<(horz, has_chroma)>`
+ parameter and a 16x4/4x16 arm that runs that body with `INTRA_IN_INTER_MODE = Some((0,
+ skip))`: `size_group_lookup[BLOCK_16X4] == size_group_lookup[BLOCK_4X16] == 0`
+ (oracle `common_data.h:61`, indices 16/17), so the mode is `y_mode[0]` and `skip` is
+ the one `decode_inter_block` already read. Chroma needs NO new code: the lifted body
+ already codes one 8x4 (4x8) unit at the PAIR's origin on the odd strip only, which is
+ exactly "predicted per the carrying strip's own type" for a mixed intra/inter pair;
+ the inter side's `InterStripChroma::prev == None` arm already covers intra-then-inter.
+* Same arm publishes what the key-frame body does not and an INTER frame needs
+ (`set_txfm_ctxs` + `txfm_partition_update`, libaom `decodeframe.c:1078`): the strip's
+ tx size into `above_txfm`/`left_txfm` and the var-tx partition context — the 2:1
+ intra-in-inter strip already does this. On the inter path the tx-depth symbol also
+ reads `tx_size_context_txfm_rect` (the real TXFM_CONTEXT bands) instead of the key
+ frame's deblock-grid approximation.
+* Counter `INTRA16X4_IN_INTER_HITS` `[16x4, 4x16, chroma-reference]`,
+ `stream::intra16x4_in_inter_hits()`, printed by `decode_probe` as `intra16x4_in_inter:`.
+
+**The path is behind `EC_INTRA16X4_DECODE=1`; the refusal is still the default.** It is
+not pixel-proven (below), and a refusal is lifted only with a green gate.
+
+## Step 3 GATE — RED, and what it measured
+
+`a_real_aomenc_inter_sequence_with_intra_16x4_strips_in_1to4_partitions_decodes_pixel_exact`
+(`stream.rs`, `#[ignore]`d with its own measurement in the reason string): real aomenc,
+`--enable-1to4-partitions=1 --enable-intra-edge-filter=1 --min-partition-size=4
+--max-partition-size=16` (per-arm overrides last), 4 recipes x {8, 10} bit, every
+decode-order frame Y/U/V vs ffmpeg, refusals counted never SKIPped, `oos_mismatch == 0`.
+
+Recipe search: 48 + 48 runs (`~/.cache/intra16x4-tmp/sweep.sh`, `sweep2.sh`, logs
+`sweep.log`/`sweep2.log`/`sweep3.log`). aomenc picks an INTRA 1:4 strip on an inter frame
+only at HIGH cq (>= 56) over content its MC cannot predict. Both gate sources hash
+identically twice.
+
+RED, with the strips themselves exact:
+
+* 192x128 cq60 "bar" source, 8-bit, 4 intra 16x4 strips (2 chroma-reference): frame 0
+ exact, frame 1 luma differs from (175, 0), 8400 px. The strips are at mi(1,40)/(3,40)
+ = px x 160..175, y 4..15 — the first differing pixel is at y=0, i.e. in the EVEN
+ (inter) strip ABOVE them, and chroma of the pair is exact.
+* 128x128 cq60 "noise" source, 8-bit, 2 skipped intra 16x4 strips at px(80,112)/(80,120):
+ frame 1 differs from (122, 13) — 99 rows ABOVE the first strip, so that arm's mismatch
+ is not this shape at all (an unrelated defect this recipe exposes; the gate's
+ `oos_mismatch` cannot separate it because the stream does carry strips).
+* The txfm-context publication above was found the same way and DID fix a first
+ measurement: before it, a 128x128 stream decoded its two intra strips at mi(23,16)/
+ (23,20) exactly and broke on the very next 16x16 row (rows 96+, x>=62), chroma exact.
+
+EVIDENCE: /home/user/.cache/intra16x4-gate2.log + ~/.cache/intra16x4-tmp/{s4,s5}.obu | aomenc -> our decode -> ffmpeg raw compare, per frame | frame 1 first luma diff (175, 0) 8400 px with both intra strips' own pixels exact
+
+## Film frontier — before / after (with `EC_INTRA16X4_DECODE=1`)
+
+All six probes leave the 16x4/4x16 wall. Before: every one stopped on
+`an intra 16x4/4x16 strip inside an inter 16x16-level 1:4 partition ...`.
+After (counters are strips decoded):
+
+| probe | new refusal | intra16x4_in_inter |
+|---|---|---|
+| hg cut 0 | an intra 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition | 16x4=14 |
+| hg cut 300 | same | 4x16=8 |
+| 1920x792 @900 | same | 4x16=4 |
+| 1920x792 @5400 | same | 16x4=1 4x16=2 |
+| 1920x792 @6300 | same | 16x4=1 4x16=1 |
+| 1920x792 @8100 | an intra-coded 16x4/4x16 strip on the inter block path (its `_` arm: a CLIPPED shape, not a 1:4 strip) | 4x16=4 |
+
+Since the walls are unproven pixel-wise, this is a REACH measurement, not a decode claim.
+
+EVIDENCE: 6 probes | `EC_RECT64_SPLIT=1 EC_INTRA16X4_DECODE=1 decode_probe ` | refusal string moves to the sub-8x8 intra wall on 5 of 6, counters 1..14 strips each
+
+## Residue
+
+* fix-now (next round): the r1 gate is RED. The defect is NOT in the strip's own pixels
+ (they match) but in what the strip leaves behind for its neighbours — after the
+ txfm-context fix, the surviving mismatch starts in the pair's EVEN (inter) strip above
+ the intra one, which points at the pair's chroma/mv bookkeeping or the deblock grid
+ the intra strip publishes over the pair, not at its luma.
+* deferred: `EC_RECT64_SPLIT` bypass removal — no witness; the rect64 hits still live
+ inside frames that refuse (confirms lane-rect64port r1 and lane-rectres r1).
+* deferred: the 4x16 (VERT_4) orientation is unprovable by aomenc today — every
+ VERT_4-carrying recipe in the 96-run sweep also contains an intra 8x4/4x8 or 4x4
+ sub-8x8 block, another lane's refusal. The gate asserts exactly that blocker.
+* accepted: `refusal_inventory.rs` / `gate_coverage.rs` unchanged — no refusal was lifted.
diff --git a/lanes/intra16x4-r2.handoff.md b/lanes/intra16x4-r2.handoff.md
new file mode 100644
index 00000000..c5630c11
--- /dev/null
+++ b/lanes/intra16x4-r2.handoff.md
@@ -0,0 +1,67 @@
+# lane-intra16x4 r2 HANDOFF
+
+## Root cause (found, fixed, minimal)
+
+`overlappable_above` / `overlappable_left` (`crates/ec-av1/src/decode.rs` ~18092 / ~18130)
+never ported libaom's `mi_step == 1` chroma-pair merge from
+`av1/common/obmc.h` (`foreach_overlappable_nb_above` / `foreach_overlappable_nb_left`).
+Round 1's doc comment declared it unreachable ("no block this decoder codes is narrower
+than 8px") -- the 1:4 partitions made it reachable: a 16x4 / 4x16 strip has
+`mi_size_high` / `mi_size_wide` == 1, so libaom snaps the walk back to the pair's EVEN
+index, reads the ODD (chroma-carrying) half as the neighbour and steps by 2.
+
+Witness `~/.cache/intra16x4-tmp/s5.obu`, frame 1, block mi(0,44) (16x16, right of a
+16x16-level HORZ_4 whose strip 0 is inter and strips 1..3 intra):
+
+* our walk read mi(0,43) = the INTER strip 0 -> 1 overlappable neighbour ->
+ `motion_mode_allowed` true -> we READ a `motion_mode` symbol;
+* libaom's pair merge reads mi(1,43) = the INTRA strip 1 -> 0 overlappable neighbours ->
+ `read_motion_mode` returns SIMPLE_TRANSLATION WITHOUT reading a symbol.
+
+Class `symbol-consumption-gap`: rng 39440 -> ours 34918, aomdec 38204 (its
+`EC_ISTEP2 name=motion_mode` print is unconditional, so an equal rng there means the
+symbol was NOT read). The tile desynced at the very next coefficient: the first TU of
+mi(0,44) read `all_zero=1` where libaom reads `all_zero=0, eob=59`, which is the
+"prediction only, no residual" smooth block at px(176..178, 0..15) the r1 pixel
+measurement saw as "first luma diff (175,0), 8400 px".
+
+The fix is inside the two walk functions only -- every caller (eligibility at ~20908 and
+~24493, the OBMC blend pass at ~18716/18746) routes through them.
+
+## Proof
+
+* Entropy ladder AFTER the fix, `s5.obu`, ours `EC_TRACE_COEFF` vs instrumented aomdec
+ `EC_TRACE_COEFF`: 620/620 `tag=all_zero` symbols identical in value AND range, up to the
+ point our decoder stops on another lane's refusal ("an intra 8x4/4x8 block inside an
+ inter frame's sub-8x8 HORZ/VERT partition"). Before the fix the first divergence was the
+ 4th block of frame 1's 3rd superblock row.
+* New green witness (r2 96-run sweep `~/.cache/intra16x4-tmp/sweep_r2.sh`):
+ `bar_h` source (a horizontal bar sweeping DOWN), cq 63, `--min-partition-size=8`,
+ 192x128, 8-bit -> 5 intra 16x4 strips (2 chroma-reference), 6 frames decoded and
+ `cmp` EXACT against `ffmpeg -i ... -f rawvideo` (`~/.cache/intra16x4-tmp/g_8.obu`,
+ md5 `2eaafd9eb56fbf9d597820ad74c9c4e3`). The 10-bit build of the same recipe decodes
+ 6 frames but fires 0 strips (out of scope).
+
+## Gate + refusal state
+
+`a_real_aomenc_inter_sequence_with_intra_16x4_strips_in_1to4_partitions_decodes_pixel_exact`
+gained that recipe as attempt 4 (`RECIPES` is now 5-wide with a per-arm
+`--min-partition-size`). Run once with `--include-ignored --nocapture`: **RED, and not on
+this lane's shape** -- attempt 0 (`noise`, cq60, 128x128) mismatches from (122, 13),
+5466 px on frame 1, which r1 already measured as 99 rows ABOVE that stream's first strip
+(strips at px(80,112)/(80,120)); it panics before attempt 4 runs. The test is therefore
+still `#[ignore]`d, with that measurement in its reason string.
+
+**The refusal is NOT lifted**: `EC_INTRA16X4_DECODE=1` is still the bypass,
+`refusal_inventory.rs` / `gate_coverage.rs` untouched.
+
+## Next step
+
+1. Own attempt 0's defect (128x128 cq60 `noise`, first diff (122,13) frame 1, arms
+ [2,0,0]) -- ladder it the same way; it is a DIFFERENT shape and it is the only thing
+ between this lane and a green gate.
+2. Then reorder/prune `RECIPES` (or make the mismatch of an out-of-scope-for-this-shape
+ arm non-fatal only with a named owner), un-ignore, lift the refusal, update
+ `refusal_inventory.rs` + `gate_coverage.rs`.
+3. Not run this round (turn cap): the full `cargo test -p ec-av1 --lib` suite and the film
+ probes.
diff --git a/lanes/intra16x4-r3.handoff.md b/lanes/intra16x4-r3.handoff.md
new file mode 100644
index 00000000..d92b3ec3
--- /dev/null
+++ b/lanes/intra16x4-r3.handoff.md
@@ -0,0 +1,97 @@
+# lane-intra16x4 r3 HANDOFF
+
+## 1. Attempt 0 verdict: OURS, root cause found and fixed (mv stack, 4-wide / 4-high blocks)
+
+Stream reproduced exactly as gate attempt 0 (`~/.cache/intra16x4-tmp/gen_a0.sh 8` ->
+`a0_8.obu`, md5 `0c9c588bb3d19f2feb2cecd31aa829fe`; 128x128 cq60 `noise`, 8-bit).
+Before the fix: 6 frames decoded, `cmp` vs ffmpeg differs at byte 26363 = frame 1 (122,13).
+
+Ladder (ours `EC_TRACE_MODE`/`EC_TRACE_MODE_STEP`/`EC_TRACE_COEFF` vs instrumented aomdec,
+same rungs) -- first diverging element is NOT a coefficient: the `tag=all_zero` ladder
+diverges at #515, but the mode ladder diverges earlier, at frame 1 block **mi(24,15)**, the
+last 4x16 strip of a 16x16-level `PARTITION_VERT_4`:
+
+| | stack |
+|---|---|
+| ours | (12,28) w648, (-4,26) w648, (-4,18) w8 -> mv0 (-4,18) |
+| aomdec | (12,28) w**650**, (-4,18) w648, (-4,26) w8, (6,332) w4 -> mv0 (-4,26) |
+
+`crates/ec-av1/src/mvstack.rs` `scan_row` / `scan_col` (and their `_compound` twins) were
+missing two clauses of libaom `scan_row_mbmi` / `scan_col_mbmi`
+(`~/.cache/aom-oracle/src/av1/common/mvref_common.c:143-236`):
+
+1. the weight / `processed_rows` branch is `if (xd->width >= mi_size_wide[BLOCK_8X8] &&
+ xd->width <= n4_w)` -- we had only `bw4 <= n4`, so a **4-wide / 4-high** block (exactly a
+ 1:4 strip or a sub-8x8 leaf) got a raised weight AND set `processed_rows`, which also
+ moves the later outer scans (that is the missing 4th candidate);
+2. `if (abs(row_offset) > 1) { col_offset = 1; if ((mi_col & 0x01) && xd->width < 2)
+ --col_offset; }` -- the step-back on an odd mi_col under a sub-8px block was absent.
+
+Both clauses ported at all four sites (row, col, row-compound, col-compound).
+AFTER: `a0_8.obu` is entropy-exact -- all **125** aomdec `EC_MODE` entries match ours as an
+ordered subsequence (ours prints 5 extra `EC_MODE` lines for intra strips aomdec does not
+print) -- and the decode now stops on ANOTHER lane's named refusal,
+`an intra 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition`, instead of
+producing wrong pixels. Aligner: `~/.cache/intra16x4-tmp/align.py o_m2.log r_m.log`.
+
+## 2. r2's `g_8.obu` "6 frames bit-exact" claim is FALSE (measured, class stale-measurement)
+
+`~/.cache/intra16x4-tmp/g_8.obu` (md5 `2eaafd9eb56fbf9d597820ad74c9c4e3`, the r2 witness)
+does NOT decode pixel-exact, and did not before this round's fix either: a build of the
+**unmodified HEAD f403337** mvstack.rs mismatches at the same byte 53825 = frame 2, luma
+(64,88). aomdec and ffmpeg agree with each other, so the reference is not in doubt.
+
+Its first diverging element (`EC_TRACE_COEFF`, all_zero #913) is a DIFFERENT shape, not this
+lane's: frame 2 block **mi(14,12)**, an 8x8 compound leaf (`ref0=1 ref1=4`, mode 17).
+Mode info is exact through the interp read (both at rng 34722); then aomdec reads var-tx
+`txfm_split` symbols (rng 34722 -> 62656) and its first luma TU has `txb_skip ctx=6`, while
+we read NO tx-split symbol at all and use `ctx=3`. Owner: the sub-8x8 / var-tx inter lane,
+not intra16x4.
+
+## 3. Gate state
+
+`a_real_aomenc_inter_sequence_with_intra_16x4_strips_in_1to4_partitions_decodes_pixel_exact`
+(`crates/ec-av1/src/stream.rs:11023`) rewritten to **continue-and-sweep**:
+* named refusals accepted ONLY from a measured 3-string list (sub-8x8 HORZ/VERT intra,
+ sub-8x8 split intra 4x4, OBMC-neighbour interp) -- anything else is a failure;
+* a mismatching attempt is RECORDED and the sweep continues (r2's attempt 0 panicked before
+ arm 4 ran); every decoding attempt compares every decode-order frame Y/U/V;
+* ONE end-of-sweep assert over all recorded failures (mismatches + out-of-scope mismatches +
+ unmeasured refusals), then a per-bit-depth assert that the counter fired on >= 1
+ pixel-exact attempt at every depth that decoded anything.
+Still `#[ignore]`d and the refusal is **NOT lifted**: `EC_INTRA16X4_DECODE=1` remains the
+bypass, `refusal_inventory.rs` / `gate_coverage.rs` untouched -- because no recipe found so
+far gives a pixel-exact attempt with the counter > 0 (see 4).
+
+Sibling gates run (`cargo test -p ec-av1 --lib -- 1to4 obmc mv_stack refusal_inventory
+gate_coverage vartx_rect`): **26 passed, 2 failed, 5 ignored**. The two failures are the two
+gates the ledger already records as known-red firing-assert/recipe defects on main
+(`..._16x16_level_1to4_partitions...`: "VERT_4/split-tx-8x4 arms read 0";
+`real_aomenc_1to4_streams_..._rect_vartx_leaves_fire`: "rect var-tx leaf arm never fired").
+Neither is a pixel mismatch, and both fail on a 0-count arm, i.e. recipe, not decode.
+
+## 4. Sweep (PARTIAL -- stopped at the turn cap, 49 of 120 rows)
+
+`~/.cache/intra16x4-tmp/sweep_r3.sh` -> `sweep_r3_partial.txt`: 5 sources x cq 55/60/63 x
+192x128|176x144 x --min-partition-size 8|4 x 8/10-bit. 49 rows done, ALL 8-bit.
+**0 EXACT.** Every row is either a named refusal (sub-8x8 intra, overwhelmingly) or a
+MISMATCH; the mismatching rows all have `16x4=0 4x16=0`, i.e. out-of-scope shapes.
+`--min-partition-size=4` is what makes strips fire (up to `16x4=3 4x16=10 chroma_ref=7`) and
+is also what brings the sub-8x8 intra refusal. 10-bit rows were not reached -- rerun the
+script (it is idempotent; it appends) to finish rows 50..120.
+
+## 5. Films (with the fix, `EC_RECT64_SPLIT=1 EC_INTRA16X4_DECODE=1`)
+
+`hg-0` 16x4=14, `hg-300` 4x16=8, `t900` 4x16=4, `t5400` 0/0, `t8100` 0/0 -> all stop at
+`an intra 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition`; `t6300`
+(16x4=1 4x16=1) stops at `an OBMC neighbour whose switchable interp filter was never
+recorded`. Same wall as r1 reported; no before/after frame counts measured this round.
+
+## Next step
+
+1. Finish the sweep (rows 50..120, the 10-bit half) looking for one EXACT row with a
+ counter > 0. If none exists, this lane cannot lift its refusal until the sub-8x8 intra
+ lane lands -- every strip-firing recipe found so far also carries that block.
+2. The gate's arm list still contains the r2 `bar_h` arm 4 whose stream (`g_8.obu`) carries
+ the frame-2 8x8-compound var-tx defect of section 2; it will be recorded as a mismatch
+ until that lane's defect is fixed.
diff --git a/lanes/sub8intra-r1.handoff.md b/lanes/sub8intra-r1.handoff.md
new file mode 100644
index 00000000..6e89b1d4
--- /dev/null
+++ b/lanes/sub8intra-r1.handoff.md
@@ -0,0 +1,108 @@
+# lane-sub8intra r1 HANDOFF (tip = this commit)
+
+Env switch: **`EC_SUB8INTRA_DECODE=1`** enables the decode path; `EC_SUB8INTRA=1` prints the
+measurement line at the refusal sites. WITHOUT the switch both refusals are unchanged
+(verified: hg-0 and the 1920x792 @900 cut both still stop at
+"an intra 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition").
+No refusal lifted, `refusal_inventory.rs` / `gate_coverage.rs` untouched, no gate added.
+
+## Step 1 measurement (`EC_SUB8INTRA=1 EC_RECT64_SPLIT=1 EC_INTRA16X4_DECODE=1`, decode_probe)
+
+| probe | shape | sub-block | is chroma ref | skip | tx_select |
+|---|---|---|---|---|---|
+| 10-bit 3840x1608 cut 0 | 4x8 | 0 | false | 0 | 1 |
+| 10-bit 3840x1608 cut 300 | 8x4 | 0 | false | 0 | 1 |
+| 10-bit 1920x792 @900 | 4x8 | 0 | false | 0 | 1 |
+| 10-bit 1920x792 @5400 | 4x8 | 0 | false | 0 | 1 |
+| 10-bit 1920x792 @6300 | 4x8 | 0 | false | 0 | 1 |
+| 10-bit 1920x792 @8100 | -- (stops earlier on the clipped-16x4 arm) |
+
+5/6 fire first on sub-block 0 (NOT the chroma reference), non-skip, `--enable-tx-size-search` on.
+The 4x4 SPLIT refusal is never the first wall, but becomes the wall on 3/6 probes once the
+HORZ/VERT arm decodes, so both arms are implemented.
+
+## What is implemented (crates/ec-av1/src/decode.rs)
+
+* `decode_intra_sub8_leaf(.., (bw,bh), has_chroma, skip, ..)` -- one INTRA 8x4/4x8 **or 4x4**
+ leaf on the inter path. Reads `y_mode[0]` (`size_group_lookup[BLOCK_8X4]==0`), NO angle delta
+ (`av1_use_angle_delta` needs >= 8x8), `uv_mode` off `uv_mode_cfl[mode]` + CfL alphas only on
+ the chroma reference, `filter_intra` off the shape's own class row
+ (`filter_intra_size_class_rect` / `_class(4)`), then the tx-depth symbol
+ (`tx_size_cat0`, ctx from `tx_size_context_txfm_rect` -- the INTER frame's live
+ `above_txfm`/`left_txfm`, not the key frame's deblock approximation; `BLOCK_4X4` reads none,
+ `block_signals_txsize` is false). Luma = `decode_leaf_rect8`'s body (whole `TX_8X4`/`TX_4X8`
+ via `read_coeffs_rect` + `LumaRect4x8[Set1]` + `SCAN_8X4`/`SCAN_4X8`, or two `TX_4X4` units at
+ depth 1; square `read_plane` for 4x4). Chroma, when this leaf IS the chroma reference: the
+ group's one 4x4 unit intra-predicted at the 8x8 group origin with `group_reach = Reach::of(8,..)`,
+ CfL AC from the group's 8x8 luma -- `decode_leaf_rect8`'s post-loop chroma verbatim.
+ Publishes: mode into `record_mode_mi` + the coarse `above_mode`/`left_mode`, skip grid,
+ lf grid at tx dims, `set_txfm_ctxs` equivalent (`above_txfm = tx_w`, `left_txfm = tx_h`),
+ `record_inter_rect_mi(.., is_inter=false, ref 0, filter [3,3])`, and `MiInfo { is_inter:false,
+ ref_frame:-1 }` over every mi cell.
+* `decode_inter_sub8_rect2` / `decode_inter_sub8_split4`: the `!is_inter` arm calls it (behind
+ the env switch), sets `intra_chroma` when the leaf was the chroma reference, and the whole
+ chroma tail (prediction, residual, `record_uv_mode_mi`, the u/v neighbour-state loop) is
+ guarded by `if !intra_chroma`.
+* MIXED groups (chroma reference INTER, a sibling INTRA): `is_sub8x8_inter`
+ (reconinter_template.inc:54) returns false as soon as any mi of the group is intra, so the
+ chroma is predicted WHOLE 4x4 from the chroma-reference block's own mv at the group's chroma
+ origin instead of in 2x2/4x2 pieces -- implemented in both functions (`mixed` flag).
+* tx_type rule for that chroma: `first_tx_type` now comes from the chroma-reference block's own
+ first TU when sub-block 0 is intra (`xd->tx_type_map[0]` of the current mi). NOTE the
+ pre-existing all-inter rule ("FIRST sub-block") is untouched but looks wrong against
+ blockd.h:1288 -- `xd->tx_type_map` is rebased to the CURRENT (chroma-reference) mi, so the
+ co-located luma (0,0) is the LAST sub-block's, not the first's. Flagged, not changed.
+* Counter `sub8_intra_rect_hits() -> (8x4, 4x8, chroma_ref, mixed)`, printed by decode_probe
+ (`sub8_intra_rect: ...`), exported through `stream.rs`.
+* `EC_TRACE_MODE_STEP` prints `name=mode` and `name=tx_depth val/ctx` for the leaf, in the
+ oracle's EC_ISTEP format.
+
+## Pixel state under the bypass -- the gate is RED
+
+* Film: all six probes move past this wall (hg-0 7 leaves, hg-300 10, @900 21 (+2 mixed),
+ @5400 28 (+2 mixed), @6300 2) and stop at the NEXT wall (4x4 split intra on 3 of them,
+ the 16x4 strip arms on the others). No film pixel comparison is possible: every firing frame
+ also carries the unproven intra-16x4 strip.
+* aomenc witness sweep `~/.cache/sub8intra-tmp/sweep.sh` and `sweep2.sh` (recipe: 128x128 /
+ 192x128 gray lavfi sources, cq 48..63, `--min-partition-size=4 --enable-1to4-partitions=0
+ --max-partition-size=8|16 --enable-filter-intra=0 --sb-size=64 --enable-tx-size-search=1`),
+ logs `sweep1.log` / `sweep2.log`: the counters fire on every arm (up to 293 8x4 leaves) but
+ **only 1 of 24 arms decodes all 6 frames, and that one MISMATCHES at byte 24735**. Eleven
+ arms encoded with `--max-partition-size=8` -- where a 16x4 block CANNOT exist -- still report
+ "an intra 16x4/4x16 strip inside an inter 16x16-level 1:4 partition", i.e. the refusal is
+ hallucinated by our own desync (class `refusal-from-own-desync`).
+
+## Where the desync is (bisected, do not redo this)
+
+Witness `~/.cache/sub8intra-tmp/x_1t_48_8_128x128.obu` (8-bit 128x128, cq48, max-partition 8;
+1 intra 8x4 leaf then the bogus refusal).
+
+* EC_MODE ladder (ours vs instrumented aomdec, `r.l`/`o.l` in that dir): identical for 168
+ entries; first divergence at `mi_row=24 mi_col=0` (ref rng=39238, ours rng=44268 and ours
+ reads a 16-wide block where the reference reads four 4x4s).
+* The intra leaf itself is EXACT: it is at mi(23,12) (HORZ pair with the inter leaf at
+ mi(22,12), so the INTRA one is the chroma reference). Ours prints
+ `EC_ISTEP mi_row=23 mi_col=12 name=mode val=0 rng=38508` and
+ `name=tx_depth val=0 ctx=2 cat=0 rng=49194`; the oracle prints the identical tx_depth line
+ (ref_step.log:2463). So `y_mode[0]`, the missing angle delta, the uv/CfL reads and the
+ tx-depth ctx are all right.
+* `tag=all_zero` ladder (`rz.l`/`oz.l`): the first 1405 luma/chroma transform units match
+ exactly; unit 1406 diverges (ref `all_zero=0 rng=40294`, ours `all_zero=0 rng=52548`). Both
+ decoders are still reading plane 0 there, so the divergence is in symbols read BETWEEN two
+ luma TUs -- i.e. inside the block following the intra leaf (the group at mi(22..23,14), the
+ 8x8 immediately to its right) or in that group's chroma.
+
+## Exact next step
+
+1. On that witness, ladder the group at mi(22,14)/(23,14) element by element (aomdec
+ `EC_ISTEP2 name=interp` / `EC_MODE`, ours `EC_MODE_MV`/`EC_MODE_VALR`) -- the intra leaf at
+ mi(23,12) is its LEFT neighbour, so the prime suspects are the left-side bands the intra
+ leaf publishes: `left_txfm` (tx dims vs block dims), `left_ref`/`left_inter` from
+ `record_inter_rect_mi(ref 0)` (INTRA_FRAME is 0 vs the `-1` the mi grid gets), the
+ coefficient state `left[..][0..2]`, and `left_side_mi` (the caller writes the group's
+ partition ctx AFTER the leaf, check the order).
+2. Then re-check the chroma of the MIXED group at mi(22,12): its chroma is coded by the intra
+ leaf, so the inter sibling's own `piece` is dropped -- confirm against
+ `build_inter_predictors_sub8x8`'s `is_sub8x8_inter == false` path.
+3. Only then re-run the sweep; a green arm needs `--max-partition-size=8` (no 16x4 shape can
+ exist there, so any 1:4 refusal is proof of a remaining desync).
diff --git a/lanes/sub8intra-r2.handoff.md b/lanes/sub8intra-r2.handoff.md
new file mode 100644
index 00000000..a0f7e209
--- /dev/null
+++ b/lanes/sub8intra-r2.handoff.md
@@ -0,0 +1,73 @@
+# lane-sub8intra r2 HANDOFF (tip = this commit)
+
+## The band: NOT a band -- the mv-stack's second-outer COLUMN scan (`mvstack.rs`)
+
+r1's suspects (above/left txfm, inter, ref, skip, y_mode, coeff, side-mi bands published by
+the intra leaf) were ALL innocent. The first diverging symbol on the r1 witness
+`~/.cache/sub8intra-tmp/x_1t_48_8_128x128.obu` is the `refmv` symbol of the INTER 8x4 leaf at
+mi(23,14) -- the block whose LEFT neighbour is the intra leaf at mi(23,12..13). Same decoded
+value (NEARESTMV), different CDF ROW (class `wrong-alphabet-same-value` / `cdf-row-held-constant`):
+
+* instrumented aomdec (private build, see below): `mode_ctx=75` -> newmv 3, globalmv 1, **refmv 4**
+* ours before the fix: newmv 3, globalmv 1, **refmv 3** -> rng 62378 where the reference has 47820
+
+`refmv 4` vs `3` is `ref_match_count == 2` vs `1` in `setup_ref_mv_list`'s `case 1:` switch
+(mvref_common.c:638): libaom's second-outer column scan (`col_offset = -3`) found an inter
+match at mi(23,11), ours found none.
+
+## Two defects fixed (crates/ec-av1/src/mvstack.rs, all FOUR scan functions)
+
+Both are pure sub-8x8 (a side < 2 mi) defects; every block main decodes today has both sides
+>= 8px in at least one of the two axes checked, which is why they survived until this lane.
+
+1. **`scan_col_mbmi`'s odd-row snap was missing** (`scan_col` L~600, `scan_col_compound` L~1406):
+ libaom does `row_offset = 1; if ((mi_row & 0x01) && xd->height < n8_h_8) --row_offset;`.
+ For an 8x4 leaf on an ODD mi row our walk probed the row BELOW (undecoded), losing the
+ match. Fixed as `col_offset.unsigned_abs() > 1 && !(mi_row % 2 == 1 && bh4 < 2)`.
+ Transposed twin fixed in `scan_row`/`scan_row_compound`
+ (`(mi_col & 1) && xd->width < n8_w_8`).
+2. **the weight / `processed_rows|cols` guard dropped libaom's `>= n8_*_8` half**:
+ libaom `if (xd->height >= n8_h_8 && xd->height <= n4_h)`; ours was `if (bh4 <= n4)`, so a
+ 1-mi-tall query block set `processed_cols` and a boosted weight libaom never sets (which can
+ also suppress the second-outer scan entirely). Now `bh4 >= 2 && bh4 <= n4` (and `bw4` twin).
+
+`cargo check -p ec-av1`: clean.
+
+## Ladder result on x_1t_48_8_128x128.obu (EC_SUB8INTRA_DECODE=1)
+
+* mi(24,0) EC_MODE: ref 39238, ours **39238** (was 44268) -- matches.
+* `tag=all_zero` ladder: **2106/2106 units identical in value AND range, all 6 frames**
+ (`diff rz2.l oz2.l` empty). r1's ladder stopped matching at 1405.
+* `OK: 6 frames decoded, 128x128`, `sub8_intra_rect: horz8x4=19 vert4x8=2 chroma_ref=10 mixed=3`.
+* Pixels: 3 residual clusters (frame 3 two 4x4 luma, frames 4/5 one +-1 pixel triple) --
+ root-caused to the OBMC `mi_step == 1` chroma-pair merge, which is **already fixed on
+ lane-intra16x4 as f403337** (`overlappable_above`/`overlappable_left`). NOT duplicated here
+ (charter: those functions belong to that lane). With f403337's decode.rs hunk applied on top of
+ this commit the witness is **cmp-EXACT vs `ffmpeg -pix_fmt yuv420p` on all 6 frames**
+ (verified, then reverted out of this tree).
+
+## Oracle instrumentation added (additive, env-gated `EC_SUB8CTX`)
+
+`av1/decoder/decodemv.c` in `~/.cache/aom-oracle/src`: one print after `read_ref_frames`
+(single-ref p1 ctx + rng) and one after `read_inter_mode` (mode_ctx split into
+newmv/globalmv/refmv + ref_mv_count). Built into the PRIVATE dir
+`~/.cache/sub8intra-tmp/aom-build` (`ninja aomdec`); `~/.cache/aom-oracle/build` untouched.
+This print is what named the band in one step -- keep it.
+
+## Next step (r3)
+
+1. Sweep `~/.cache/sub8intra-tmp/sweep3.sh` (max-partition-size=8, 1:4 off, 8- and 10-bit,
+ cq 48/55/63, 128x128 + 192x128) -- 5 of 12 arms already decode all 6 frames pixel-EXACT
+ (`10 cq48 128x128`, `10 cq48 192x128`, `10 cq55 128x128`, `10 cq63 128x128`,
+ `8 cq55 192x128`). Those are the gate arms.
+2. The other arms still stop at a refusal naming a shape the encoder cannot have coded
+ (`--max-partition-size=8` + `--enable-1to4-partitions=0`) -- class `refusal-from-own-desync`,
+ one desync left. Bisected on `g_8_48_128x128.obu`: first divergence at all_zero unit 1581,
+ block mi(25,2) -- the reference reads `use_filter_intra=1`, `filter_intra_mode=3`,
+ `tx_depth=1` for an INTRA sub-8x8 leaf there (ra2.l:4370-4372) which OUR path never reads;
+ ours continues the previous block's 4x4 units instead. So: filter_intra IS read on a
+ sub-8x8 intra leaf in that stream, and the `tx_depth=1` split (two TX_4X4) path is the
+ one to check first.
+3. Then: gate + refusal lift (both sub-8x8 intra refusals), refusal_inventory.rs +
+ gate_coverage.rs, suite, films. Also still open: the flagged all-inter `first_tx_type`
+ rule (blockd.h:1288, LAST sub-block vs first) -- unmeasured this round.
diff --git a/lanes/sub8x4-r1.handoff.md b/lanes/sub8x4-r1.handoff.md
new file mode 100644
index 00000000..99d0ebe5
--- /dev/null
+++ b/lanes/sub8x4-r1.handoff.md
@@ -0,0 +1,138 @@
+# lane-sub8x4 r1 HANDOFF (tip = `bb79462`, branch lane-sub8x4)
+
+Two commits on top of c1df2f2 (= lane-intra16x4 r3):
+
+* `1845281` merge of `367d873` (lane-sub8intra r2) + the sub-8x8 sibling-size fix
+* `bb79462` compound 8x8 leaf early-return fix
+
+## 1. STEP 0 -- how the merge was resolved
+
+`git merge 367d873` conflicted in ONE file, `crates/ec-av1/src/mvstack.rs`, at 8 hunks
+(4 functions x 2 hunks: `scan_row`, `scan_col`, `scan_row_compound`, `scan_col_compound`).
+Every hunk was the SAME libaom clause ported twice, once per lane, with different comment
+wording and `if/else` vs `usize::from` spelling -- **semantically identical on both sides**:
+
+1. the outer-scan step-back, `mvref_common.c:155-158` (`scan_row_mbmi`) and `:203-206`
+ (`scan_col_mbmi`): `if (abs(row_offset) > 1) { col_offset = 1; if ((mi_col & 0x01) &&
+ xd->width < width_8x8) --col_offset; }` and its transpose;
+2. the weight / `processed_rows|cols` guard, `mvref_common.c:172` and `:222`:
+ `if (xd->width >= width_8x8 && xd->width <= n4_w)` / `if (xd->height >= n8_h_8 &&
+ xd->height <= n4_h)` -- the `>= mi_size_*[BLOCK_8X8]` half is what both lanes added.
+
+Resolution: kept the HEAD (intra16x4 r3) spelling of all 8 hunks, which cites the libaom
+line numbers; the sub8intra rationale is preserved in this file. Both sides' `bw4 >= 2 &&
+bw4 <= n4` / `bh4 >= 2 && bh4 <= n4` guard lines were already identical and auto-merged.
+All four functions were then re-read whole against `mvref_common.c:143-236`: `end_mi`,
+`use_step_16`, `len` floors (`width_16x16` / `width_8x8`), the weight `inc`, the
+`processed_*` update and the `i += len` step all match.
+
+`decode.rs`, `stream.rs`, `examples/decode_probe.rs` auto-merged clean (both lanes' code
+kept: the intra 16x4 strip path + OBMC pair merge from intra16x4, `decode_intra_sub8_leaf`
++ the sub-8x8 chroma guards from sub8intra). Both env bypasses (`EC_SUB8INTRA_DECODE`,
+`EC_INTRA16X4_DECODE`) are still in place; no refusal lifted this round.
+
+`cargo check -p ec-av1`: clean. Named gates run after the merge
+(`cargo test -p ec-av1 --lib -- obmc mv_stack 1to4 sub8 refusal_inventory gate_coverage`):
+**32 passed, 2 failed, 5 ignored**. The two failures are the two gates the ledger already
+records as known-red RECIPE defects on main -- `a_real_aomenc_inter_sequence_with_16x16_
+level_1to4_partitions_decodes_pixel_exact` ("VERT_4 / split-tx-8x4 arms read 0") and
+`real_aomenc_1to4_streams_..._rect_vartx_leaves_fire` ("the rectangular var-tx leaf arm
+never fired"). Both fail on a zero counter, neither on a pixel mismatch.
+
+## 2. Two defects found and fixed (both post-merge, both root-caused by ladder)
+
+### (a) `decode_inter_sub8_rect2`: leaf 1 never saw leaf 0's block size (`1845281`)
+
+libaom's `xd->above_mbmi`/`left_mbmi` are the neighbour block AS DECODED, so leaf 1 of an
+8x8 HORZ/VERT group sees leaf 0's own bsize. We published `above_side_mi`/`left_side_mi`
+only in the GROUP tail (after both leaves), so leaf 1 read the block preceding the whole
+group. `get_tx_size_context` (`pred_common.h:342`) takes `block_size_wide[above_mbmi->bsize]`
+from there.
+
+Witness `~/.cache/sub8intra-tmp/g_8_48_128x128.obu`, mi(25,2) (intra 8x4 leaf 1):
+ours `tx_depth` **ctx=1** vs aomdec **ctx=2**, same decoded value 1, rng 35938 vs 55960.
+`EC_TXCTX=1` (new env print in `tx_size_context_txfm_rect`) showed `above_side=4` where the
+above neighbour is an inter 8x4 leaf of width 8. Class `tx-grid-published-block-side`.
+
+Fix: publish the leaf-0 side bands at the top of iteration `i == 1` of the leaf loop
+(`decode.rs`, `decode_inter_sub8_rect2`). The group tail rewrites the same values, so
+partition context is unchanged.
+
+### (b) `decode_leaf8` COMPOUND arm's early return clobbered its own per-TU luma ctx (`bb79462`)
+
+The compound arm `return`s before the fall-through tail, and that tail is where the
+`split8` plane-0 save/restore around `record_mi` lives. A compound var-tx 8x8 leaf therefore
+published the whole-block luma grid (all-zero when the transform is split into 4x4 units,
+since `read_inter_luma8`'s `record_mi_luma` already wrote the per-unit state) into
+`above[..][0]`/`left[..][0]`.
+
+Witness `~/.cache/intra16x4-tmp/g_8.obu` frame 2 mi(14,12), first luma TU: ours
+`txb_skip` ctx=3 rng=43376 vs reference ctx=6 rng=61310 -- `get_txb_ctx`
+(`txb_common.h:330`) `skip_contexts[4][0]=3` vs `[4][4]=6`; the block left of it, mi(14,10),
+is a compound 8x8 whose four TX_4X4 units all read ctx=6 correctly and then had their
+published levels zeroed. Class `early-return-skips-tail`.
+
+Fix: the same save/restore in the compound arm before/after its `record_mi`.
+
+## 3. Measured state (probe sweep, both bypasses on)
+
+`~/.cache/sub8x4-tmp/check.sh ...` (decode + `cmp` vs `ffmpeg -f rawvideo`),
+12 sub-8x8-intra streams `~/.cache/sub8intra-tmp/g_{8,10}_{48,55,63}_{128x128,192x128}.obu`:
+
+| state | before this round | after (a) | after (b) |
+|---|---|---|---|
+| pixel-EXACT (6/6 frames) | 5/12 | 10/12 | 10/12 |
+| stops at a refusal | 2/12 | 2/12 | **1/12** |
+
+Remaining non-EXACT: `g_8_63_128x128.obu` (mismatch) and `g_10_55_192x128.obu` (was
+"Golomb tail longer than this decoder reads", now decodes all 6 frames and mismatches).
+
+`~/.cache/intra16x4-tmp/g_8.obu` is now **entropy-exact end to end**: 2215/2215 `all_zero`
+units identical in value AND range vs instrumented aomdec, with equal counts -- yet its
+pixels still differ (frame 1 first at luma (64,88), 1185 px, max delta 20; frames 2..5
+150-235 px each). That is a **reconstruction-only** residue (prediction / OBMC blend /
+loop filter), not entropy. This supersedes the r3 handoff's section-2 diagnosis, whose
+named cause (the 8x8 compound var-tx read) is now fixed.
+
+## 4. STEP 1 list, unchanged / re-measured
+
+* (a) sub-8x8 INTRA leaf reads `use_filter_intra` (+ `filter_intra_mode`): **premise was
+ STALE -- already implemented** by sub8intra r2 in `decode_intra_sub8_leaf`
+ (`decode.rs:23101`). Proven: with the new `EC_TRACE_MODE_STEP` prints added there, ours
+ reads `use_filter_intra=1 rng=51020` then `filter_intra_mode=3 rng=45380` at mi(25,2),
+ **bit-identical to aomdec**. `av1_filter_intra_allowed_bsize` is `reconintra.h:68`
+ (`block_size_wide <= 32 && block_size_high <= 32`), so 8x4/4x8/4x4 are all allowed. No
+ angle delta below 8x8 is likewise already implemented. What was actually wrong at that
+ block was the tx_depth CDF ROW -- fix (a) above.
+* (b) 8x8 COMPOUND inter leaf var-tx `txfm_split`: **premise partly stale** -- we DO read
+ the symbol (ours `txfm_split val=1 ctx=19 rng=62656`, reference reaches the same 62656).
+ The real defect was the `txb_skip` ctx, fix (b) above. DONE.
+* (c) the flagged all-inter sub-8x8 chroma `first_tx_type` rule (`blockd.h:1288`,
+ tx_type_map rebased to the chroma-reference = LAST sub-block): **NOT MEASURED this
+ round.** Still open.
+
+## 5. Next step (r2)
+
+1. Root-cause the two remaining non-EXACT sub-8x8 streams and `g_8.obu`'s
+ reconstruction-only residue (entropy is exact, so start at prediction: OBMC blend,
+ sub-8x8 chroma MC, or the deblock grid a sub-8x8 group publishes).
+2. Then the gates: **no sub-8x8-intra gate test exists yet in `stream.rs`** (only the
+ `sub8_intra_rect_hits()` accessor at `stream.rs:91` and the 1:4 gate's refusal count).
+ It must be WRITTEN, continue-and-sweep, over the now 10 EXACT arms of
+ `~/.cache/sub8intra-tmp/sweep3.sh` (`--max-partition-size=8 --enable-1to4-partitions=0
+ --min-partition-size=4`, 8/10-bit x cq 48/55/63 x 128x128/192x128). Only then lift
+ `EC_SUB8INTRA_DECODE` + the two refusals at `refusal_inventory.rs:35-36`.
+3. intra 16x4: still no EXACT witness; re-run `~/.cache/intra16x4-tmp/sweep_r3.sh` (it is
+ idempotent and appends) now that both fixes landed -- r3 measured 0 EXACT of 49 rows
+ BEFORE them.
+4. Not run this round (turn cap): full `cargo test -p ec-av1 --lib` suite, film probes.
+
+## 6. New instrumentation on this branch (env-gated, keep)
+
+* `EC_TXCTX=1` -- `tx_size_context_txfm_rect` prints `above_txfm/left_txfm/above_inter/
+ left_inter/above_side/left_side/above/left`; named defect (a) in one run.
+* `EC_TRACE_MODE_STEP` now also prints `use_filter_intra` / `filter_intra_mode` from
+ `decode_intra_sub8_leaf` (it read them silently before, which is what made the r2
+ handoff conclude they were unread).
+* `EC_AV1_TRACE` `luma_skip_ctx` line now dumps the whole `left[..][0]` level band;
+ that dump is what localised defect (b).
diff --git a/lanes/sub8x4-r2.handoff.md b/lanes/sub8x4-r2.handoff.md
new file mode 100644
index 00000000..bf36e798
--- /dev/null
+++ b/lanes/sub8x4-r2.handoff.md
@@ -0,0 +1,118 @@
+# lane-sub8x4 r2 HANDOFF (tip = `2515eb1`, branch lane-sub8x4)
+
+Two commits on top of `94bda2f`:
+
+* `f0bd09d` fix: compound 8x8 leaf published transform width 8 to the deblock grid even
+ when its var-tx split it into 4x4 units
+* `2515eb1` feat: both sub-8x8 intra refusals lifted behind the new gate
+
+## STEP A -- DONE, gate GREEN, both refusals LIFTED
+
+### The last defect (root cause, class `early-return-skips-tail`, 3rd instance in that arm)
+
+`decode_inter_block8`'s COMPOUND early return called
+`neighbours.fill_lf_grid(leaf_mi, 2, 8, ..)` with a LITERAL 8 where the fall-through
+single-ref tail writes `if split8 { 4 } else { 8 }` (decode.rs, ~line 24990 vs ~25980).
+libaom `get_transform_size` (av1_loopfilter.c:207) reads the per-TU `inter_tx_size` for a
+non-skip inter LUMA block, so a var-tx-split 8x8's interior edges at `x % 8 == 4` are real
+filter edges; ours never filtered them and widened the neighbouring x=64 edge from filter4
+to filter8.
+
+Ladder that named it, on `~/.cache/sub8intra-tmp/g_8_63_128x128.obu`:
+* `EC_OBMC` trace ours vs instrumented aomdec: **404 = 404 lines, byte-identical** (OBMC
+ neighbour lists are exact -- do not re-audit them).
+* `EC_AV1_PREFILT_DUMP` (ours, no `EC_AV1_DEBUG_SKIP_CDEF`) vs aomdec's: decode frames
+ 0,1,2 **SAME**; only f3+ differ (propagation).
+* `EC_AV1_POSTDEBLOCK_DUMP` both sides: frame 2 differs, 12 luma px at rows 78..80 cols
+ 58..63, max delta 3 -> the deblocker is the stage.
+* `EC_AV1_DEBLOCK_TRACE_V`: no `VEDGE x0=60` in frame 2 where frames 0/1/3 have one;
+ `EC_TXGRID_TRACE` (new `EC_LFLEAF` line added this round in `fill_lf_grid_leaf_luma`)
+ showed the 8x8 at mi(20,14) publishing `tx_px=8` with no leaf fill.
+
+Probe sweep `~/.cache/sub8intra-tmp/sweep3.sh` (12 streams): **10/12 -> 12/12 pixel-EXACT**.
+
+### The gate
+
+`a_real_aomenc_inter_sequence_with_intra_sub8x8_leaves_decodes_pixel_exact`
+(`crates/ec-av1/src/stream.rs`, end of the test module).
+
+* 12 arms: 8/10-bit x cq 48/55/63 x 128x128/192x128, recipe copied from sweep3.sh
+ (`--min-partition-size=4 --max-partition-size=8 --enable-1to4-partitions=0
+ --enable-rect-partitions=1 --cpu-used=0 --sb-size=64 --lag-in-frames=0`), streams
+ re-encoded BY the gate, first arm encoded twice and compared byte for byte.
+* 6 decode-order frames per arm, all three planes, vs `ffmpeg_decode_sequence` /
+ `_10bit`. Continue-and-sweep: only `unsupported: ` is recorded and skipped; any other
+ error or ANY pixel mismatch fails.
+* End-of-sweep asserts `exact_arms >= 12` and all five `sub8_intra_rect_hits` cells > 0.
+* **Result: 12/12 arms EXACT, counters `[8x4=362, 4x8=80, chroma_ref=156, mixed=153,
+ split4x4=98]`, 7.42 s.**
+* `SUB8_INTRA_RECT_HITS` grew a 5th cell (split 4x4 leaves); `decode_probe` prints
+ `split4x4=`.
+
+Lifted: `EC_SUB8INTRA_DECODE` (both sites) and the two refusal strings, removed from
+`refusal_inventory.rs` in the same commit. `gate_coverage.rs` needed no edit (this gate
+spells no tool flag that was previously never-on); `refusal_inventory` + all 12
+`gate_coverage` tests pass.
+
+Siblings re-run (`-- sub8 obmc mv_stack 1to4 refusal_inventory gate_coverage`):
+**33 passed, 2 failed, 5 ignored**. The 2 failures are the pre-existing zero-COUNTER
+recipe defects this branch already carried (`..._16x16_level_1to4_partitions...`
+stream.rs:10994, `real_aomenc_1to4_streams_..._rect_vartx_leaves_fire` stream.rs:8876);
+neither is a pixel mismatch and neither moved this round.
+
+### NOT in the gate: the `--tile-columns=1` arm (measured, not assumed)
+
+The arm was written, run, and **failed** at decode-order frame 4 (12056 luma px). It then
+failed IDENTICALLY with `--min-partition-size=16 --max-partition-size=16` (frame 3, 13256
+luma px) -- a stream with no sub-8x8 block of any kind -- so this is a PRE-EXISTING
+multi-tile defect, not this lane's bands. Streams pinned:
+`~/.cache/sub8x4-tmp/tiles.obu` (sub-8x8) and `~/.cache/sub8x4-tmp/t16.obu` (none);
+`diff.py` in the same dir prints per-frame/plane deltas. The gate carries the repro in a
+comment with the one line to restore. This is the single most valuable open item.
+
+## STEP B -- NOT DONE, its premise is STALE
+
+`~/.cache/intra16x4-tmp/g_8.obu` is NOT an intra-16x4 witness: re-measured this round with
+`EC_INTRA16X4_DECODE=1`, it reports `intra16x4_in_inter: 16x4=0 4x16=0 chroma_ref=0` and
+still mismatches at byte 53825. Its mismatch is another shape's defect (the ledger already
+records the same stream as never-exact on unmodified HEAD). There is no firing witness at
+all: the r3 49-row sweep found 0 EXACT rows and every row had `16x4=0`. Next step for B is
+therefore NOT the prediction/OBMC/deblock comparison in the charter -- it is finding a
+stream where the counter fires AND the rest of the frame is clean (r1's dead-end: every
+firing film frame also carries a sub-8x8 intra block -- which is now DECODABLE, so re-run
+`~/.cache/intra16x4-tmp/films.sh` and the reelb0-5x prefixes on this tip: that dead-end may
+have expired with this commit).
+
+## STEP C -- suite armed, not read
+
+Unit `sub8x4-suite-r2-1788363069.service`, log **`$HOME/.cache/sub8x4-suite.log`**.
+Check with a single `grep -E "^test result|FAILED" $HOME/.cache/sub8x4-suite.log`.
+
+## STEP D -- NOT RUN (turn cap). No film probe, no `EC_RECT64_SPLIT` measurement, no
+fixture pinned. Inputs are in place: `~/.cache/hg-0.obu`, `~/.cache/hg-300.obu`,
+`~/.cache/intra16x4-tmp/reelb0-{50,52,55}.obu`.
+
+## Next step, in order
+
+1. Read the suite log; if a gate outside this lane's files is red, bisect against `94bda2f`.
+2. Re-run the film/reelb0 probes on this tip (STEP D) -- the sub-8x8 intra lift removes one of
+ the two walls the r1 film sweep hit, so the refusal STRING each cut stops at has moved.
+3. The multi-tile defect above (own lane; it is not sub-8x8 specific and it blocks the
+ neighbour-map arm COMMON asks every lane for).
+
+## ADDENDUM (measured after the handoff above, while the suite ran)
+
+The suite's first failure is `a_frame_edge_straddling_band_decodes_pixel_exact`, and it is
+NOT a regression: `git log --oneline main --not HEAD` shows this branch is missing main's
+`1d2259c` ("the saved motion field kept only the LAST tile's columns --
+`av1_copy_frame_mvs` read the mi grid through the per-tile reach clamp") and its merge
+`9cca16e`. That gate is green on main only because of that commit; the charter forbids
+rebasing this lane onto it.
+
+**Strong lead:** that same missing commit is the most likely cause of THIS lane's
+multi-tile desync too -- a 2-tile-column stream whose temporal MV candidates come from the
+saved motion field, going wrong only from decode-order frame 3/4 (i.e. the first frames
+that read a motion field saved by a MULTI-TILE frame), with tile 1's pixels exact. Before
+spending a round on it: merge main into the lane (or cherry-pick `1d2259c`), then re-run
+`~/.cache/sub8x4-tmp/tiles.obu` + `t16.obu` and, if clean, restore the one commented-out
+`arms.push((8, 63, 192, 128, true));` line in the gate.
diff --git a/lanes/sub8x4-r3.report.md b/lanes/sub8x4-r3.report.md
new file mode 100644
index 00000000..9814b8d7
--- /dev/null
+++ b/lanes/sub8x4-r3.report.md
@@ -0,0 +1,111 @@
+# lane-sub8x4 r3 report (branch `lane-sub8x4`, tip `f38f963`)
+
+Merged `main` @ `9cca16e` (clean auto-merge, **zero conflicts** -- no hand-resolved
+function to re-read), then two commits.
+
+## r2 suite line (the unit that was still running at the start of this round)
+
+`test result: FAILED. 419 passed; 3 failed; 38 ignored; 0 measured; 0 filtered out; finished in 674.52s`
+
+The 3: `a_frame_edge_straddling_band_decodes_pixel_exact` (main's `1d2259c` was missing
+from the lane -- fixed by the merge, see below) plus the two pre-existing zero-COUNTER
+recipe defects this branch already carried (`..._16x16_level_1to4_partitions...`
+stream.rs:11002, `real_aomenc_1to4_streams_..._rect_vartx_leaves_fire` stream.rs:8884).
+Neither of those two is a pixel mismatch and neither moved this round.
+
+## STEP 1 -- `13cd475`: the `--tile-columns=1` arm is back, and r2's premise was right
+
+r2 excluded the arm with a measurement (desync at decode-order frame 4, identical with
+`--min-partition-size=16 --max-partition-size=16`, i.e. a stream with no sub-8x8 block at
+all) and named the suspect: main's `1d2259c`, "the saved motion field kept only the LAST
+tile's columns -- `av1_copy_frame_mvs` read the mi grid through the per-tile reach clamp".
+Confirmed: with the merge the arm is pixel-exact and the gate now carries the neighbour-map
+tile arm COMMON asks every lane for (13 arms).
+
+EVIDENCE: crates/ec-av1/src/stream.rs:30038-30044 | `cargo test -p ec-av1 --lib -- sub8 straddling obmc mv_stack 1to4 refusal_inventory gate_coverage` | `34 passed; 2 failed; 5 ignored` in 141.28s -- the 2 are the same two recipe defects above; `a_real_aomenc_inter_sequence_with_intra_sub8x8_leaves_decodes_pixel_exact` and `a_frame_edge_straddling_band_decodes_pixel_exact` both green
+
+## STEP 2 -- film probes (release probe, each under `systemd-run --scope MemoryMax=6G`)
+
+**The r1/r2 "no witness exists" dead-end EXPIRED**, exactly as this lane's r2 predicted:
+every firing frame also carried a sub-8x8 intra leaf, which refused until r2 lifted it.
+
+| cut | frames / wall | `intra16x4_in_inter` 16x4/4x16/chroma | `rect64_corner_tu` 64x32/32x64 |
+|---|---|---|---|
+| head of the 10-bit 3840x1608 stream (2 s) | **OK: 48 frames, no refusal** | 31 / 17 / 23 | 130 / 22 |
+| same stream @ +300 s | REFUSED: a Golomb tail longer than this decoder reads | 175 / 1350 / 760 | 270 / 90 |
+| 1080p 10-bit 128-SB cut @ 900 | REFUSED: an OBMC neighbour whose switchable interp filter was never recorded | 1 / 4 / 2 | 0 / 0 |
+| same @ 5400 | REFUSED: same OBMC string | 15 / 49 / 35 | 0 / 0 |
+| same @ 6300 | REFUSED: same OBMC string | 1 / 1 / 0 | 0 / 0 |
+| same @ 8100 | REFUSED: an intra-coded 16x4/4x16 strip **on the inter block path** (decode.rs:7390 -- a DIFFERENT site from the one lifted here) | 0 / 0 / 0 | 1 / 0 |
+
+Pixel compare of the only cut that finishes (`EC_PROBE_OUT16` vs
+`ffmpeg -pix_fmt yuv420p10le -f rawvideo`, `diff16.py`, 889159680 B each side):
+**decode-order frames 0..35 are byte-identical**; frame 36 is the first differing one
+(1992768 of 18524160 bytes) and 36..47 all differ -- one wall, propagating.
+
+EVIDENCE: ~/.cache/sub8x4-tmp/{o,r}.raw | release decode_probe + ffmpeg on the 2 s head cut, diff16.py 3840x1608 | frames 0-35 differ in 0 bytes, frame 36 in 1992768
+
+## STEP 3 -- `f38f963`: both refusals narrowed, one film gate, one sibling fixed
+
+* `EC_RECT64_SPLIT` removed (decode.rs:6890-6903): the un-split TX_64X32/TX_32X64 corner
+ unit of a split intra strip is now the default path.
+* `EC_INTRA16X4_DECODE` removed (decode.rs:21886-21903): the intra 16x4/4x16 strip inside
+ an inter 16x16-level 1:4 partition decodes by default when it has a chroma-pair record.
+* Fixture `crates/ec-av1/fixtures/reelb_rect64_intra16x4_witness.obu` (`git add -f`, in
+ `git ls-files`), 23472 bytes, sha256
+ `c9e721088766163b9dbeb9fa8dd8b257ff0ec7f9157fc350de4d3c33cd9ec4e4` -- the first 50
+ frame-carrying OBUs of the 2 s head cut. Cut TWICE from independent
+ `ffmpeg -ss 0 -t 2 ... -c:v copy -f obu` runs: both segments hashed
+ `96940689a8c6...` and both truncations hashed `c9e7210887...`.
+* Gate `a_10bit_film_frames_with_intra_16x4_strips_and_rect64_corner_tus_decode_pixel_exact`
+ (stream.rs, after the intra14 gate): 33 decode-order frames, all three planes, hard
+ asserts on all five counters AND on ffmpeg's own frame count (no vacuous compare).
+* Why the fixture is 50 OBUs and not the whole 2 s segment is stated in its doc comment:
+ the full segment diverges at frame 36, and the prefix is the exact one, not a
+ truncation chosen to hide that.
+* **Neither refusal string leaves `refusal_inventory`** -- both are NARROWED. "a split
+ intra strip whose transform unit is {tx_w}x{tx_h}" still stands for every shape other
+ than 64x32/32x64; the 16x4/4x16 one still stands for a strip with no chroma-pair record
+ (and decode.rs:7390 is a separate string, untouched). `refusal_inventory` and all 12
+ `gate_coverage` tests green with no edit.
+
+EVIDENCE: crates/ec-av1/fixtures/reelb_rect64_intra16x4_witness.obu | `cargo test -p ec-av1 --lib -- a_10bit_film_frames_with_intra_16x4 refusal_inventory gate_coverage` | `13 passed; 0 failed` in 62.64s, gate printed `33 frames pixel-exact, intra16x4_in_inter 16x4=31 4x16=17 chroma_ref=23, rect64_corner_tu 64x32=90 32x64=5`
+
+### Sibling sweep (COMMON's SIBLING GATES rule) -- found and fixed one
+
+`a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact` was `#[ignore]`d
+with the note "un-ignore when the 64x32/32x64 luma coefficient tables land". They landed
+here, so it is un-ignored. Running it for the FIRST time (it had never executed) showed
+its `frames.len() == 2` assert was an untested assumption: a raw
+`ffmpeg -i -pix_fmt yuv420p10le -f rawvideo` writes exactly 18524160 bytes =
+ONE 3840x1608 10-bit frame, so the second frame OBU is a no-show. Corrected to 1, plus an
+ffmpeg-frame-count equality assert so the compare cannot silently go vacuous.
+
+EVIDENCE: ~/.cache/sub8x4-tmp/{o,r}.raw on the intra14 fixture | release decode_probe + raw ffmpeg decode, diff16.py | 1 frame each side, `0:0` (zero differing bytes); gate green, `480 intra 1:4 strips in an inter frame, the shown frame pixel-exact`
+
+## STEP 4 -- full suite
+
+Unit `sub8x4-suite-r3-1788364529.service`, log `$HOME/.cache/sub8x4-suite-r3.log`
+(private path per COMMON):
+
+`test result: FAILED. 422 passed; 2 failed; 37 ignored; 0 measured; 0 filtered out; finished in 676.59s`
+
+Against r2's `419 passed; 3 failed; 38 ignored`: +3 passed (the straddling gate the merge
+fixed, plus this round's two film gates net of the un-ignore), -1 failed, -1 ignored (the
+intra14 gate). The 2 remaining failures are the same two zero-COUNTER 1:4 recipe defects
+r2 already carried, with the same messages; no new failure, no gate regressed.
+
+## Open residue
+
+* `fix-now (next round)` -- the head cut's wall at decode-order **frame 36**: 33 frames
+ are pinned and exact, frames 36..47 differ. No refusal fires, so this is a silent
+ reconstruction/entropy defect and the fixture at N=52/N=56 (still exact, 33/35 frames)
+ brackets it: N=58 (37 frames) is the smallest truncation that includes it.
+* `deferred(a lane that owns the OBMC interp-filter record)` -- three of the four 1080p
+ 128-SB cuts now stop at "an OBMC neighbour whose switchable interp filter was never
+ recorded", which is not this lane's shape.
+* `deferred(the 16x16-level 1:4 INTER partition itself)` -- decode.rs:7390, the OTHER
+ intra-16x4 refusal, on the inter block path; it is what the 8100 cut stops at and it is
+ refused before the partition this round unblocked.
+* `accepted` -- the two zero-COUNTER 1:4 recipe defects (stream.rs:8884, :11002) are pure
+ gate-recipe defects carried in from before this lane and did not move this round.