forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-intrasplit' (a37a4bc): split transforms on intra HORZ/VERT strips in inter frames

Browse files at this commit

ebaad18f3d7eb56d0ab9c4238b72e9bd77801eeaAhmet Kaan GümüşParent: d969cdcdb2b19a
crates/ec-av1/examples/decode_probe.rsmodified+5 -0
@@ -79,6 +79,11 @@ fn main() {
7979 "inter_ab64: horz_a={} horz_b={} vert_a={} vert_b={}",
8080 sbab[0], sbab[1], sbab[2], sbab[3]
8181 );
82+ let i4 = ec_av1::stream::intra_rect4_in_inter_counters();
83+ println!(
84+ "intra_rect4_in_inter: 64x16={} 16x64={} 32x8={} 8x32={}",
85+ i4.0, i4.1, i4.2, i4.3
86+ );
8287 let ir = ec_av1::stream::inter_rect_counters();
8388 println!(
8489 "inter_rect: 32x8={} 8x32={} 64x32={} 32x64={} 64x16={} 16x64={}",
crates/ec-av1/src/decode.rsmodified+204 -14
@@ -2273,6 +2273,46 @@ pub(crate) fn intra_rect_strip_in_inter_hits(class: usize) -> usize {
22732273 INTRA_RECT_IN_INTER_HITS.with(|c| c.get()[class])
22742274 }
22752275
2276+// lane-intrasplit r1: intra HORZ/VERT strips inside an INTER frame whose luma
2277+// transform is SPLIT, bucketed by the read `tx_depth` (index 1 and 2; index 0
2278+// is never incremented) -- the gate's proof that the lifted path ran per depth.
2279+thread_local! {
2280+ static INTRA_RECT_IN_INTER_SPLIT_TX_HITS: std::cell::Cell<[usize; 3]> =
2281+ const { std::cell::Cell::new([0; 3]) };
2282+}
2283+
2284+/// Current value of [`INTRA_RECT_IN_INTER_SPLIT_TX_HITS`], indexed by tx depth.
2285+pub(crate) fn intra_rect_in_inter_split_tx_hits() -> [usize; 3] {
2286+ INTRA_RECT_IN_INTER_SPLIT_TX_HITS.with(std::cell::Cell::get)
2287+}
2288+
2289+// lane-intra14 r1: how many intra-coded 1:4 strips decoded on the INTER
2290+// block path, per shape -- [0] 64x16, [1] 16x64, [2] 32x8, [3] 8x32. Every
2291+// one of them was the named refusal "an intra-coded 1:4 (or other non-2:1)
2292+// rect strip on the inter block path" before this round.
2293+thread_local! {
2294+ static INTRA_RECT4_IN_INTER_HITS: std::cell::Cell<[usize; 4]> =
2295+ const { std::cell::Cell::new([0; 4]) };
2296+}
2297+
2298+/// Current value of [`INTRA_RECT4_IN_INTER_HITS`] for one shape
2299+/// (0 = 64x16, 1 = 16x64, 2 = 32x8, 3 = 8x32).
2300+pub(crate) fn intra_rect4_strip_in_inter_hits(shape: usize) -> usize {
2301+ INTRA_RECT4_IN_INTER_HITS.with(|c| c.get()[shape])
2302+}
2303+
2304+// lane-intra14 r1: set while an INTRA block of an INTER frame is decoded
2305+// through one of the key-frame rect readers ([`decode_block_rect4`],
2306+// [`decode_block_rect64`]). `Some((size_group, skip))` tells
2307+// [`read_intra_mode_rect`] that (a) `skip`/segment id/cdef/delta-q were
2308+// already read by [`decode_inter_block`] and (b) the luma mode comes off
2309+// `y_mode_cdf[size_group_lookup[bsize]]` (libaom `read_intra_block_mode_info`,
2310+// decodemv.c:1189), never the key frame's above/left `kf_y_mode` pair.
2311+thread_local! {
2312+ static INTRA_IN_INTER_MODE: std::cell::Cell<Option<(usize, bool)>> =
2313+ const { std::cell::Cell::new(None) };
2314+}
2315+
22762316 // lane-rectx r5: how many times a NON-strip `kf_y_mode` reader
22772317 // ([`decode_block`], [`decode_block_rect`], [`decode_block_rect64`]) took an
22782318 // above/left mode from the mi-exact map that DIFFERS from its coarse 16x16
@@ -6186,6 +6226,13 @@ fn read_intra_mode_rect(
61866226 } else {
61876227 cfl
61886228 };
6229+ // lane-intra14 r1: on the INTER block path everything up to and including
6230+ // `is_inter` was already read by [`decode_inter_block`], so this reader
6231+ // starts at the mode syntax with the `skip` that caller read.
6232+ let inter = INTRA_IN_INTER_MODE.with(std::cell::Cell::get);
6233+ let skip = if let Some((_, skip)) = inter {
6234+ skip
6235+ } else {
61896236 // Same `intra_segment_id` placement as the square reader above.
61906237 let (seg_w_mi, seg_h_mi) = (bw / 4, bh / 4);
61916238 if seg_id_pre_skip() {
@@ -6225,9 +6272,18 @@ fn read_intra_mode_rect(
62256272 ));
62266273 }
62276274 }
6228- let above_ctx = INTRA_MODE_CTX[above_mode];
6229- let left_ctx = INTRA_MODE_CTX[left_mode];
6230- let mode = dec.symbol(&mut cdfs.kf_y_mode[above_ctx][left_ctx]);
6275+ skip
6276+ };
6277+ // libaom `read_intra_block_mode_info` (decodemv.c:1189) vs the key
6278+ // frame's `read_intra_frame_mode_info` (decodemv.c:1065 `read_intra_mode`
6279+ // off `kf_y_mode_cdf[above][left]`).
6280+ let mode = if let Some((size_group, _)) = inter {
6281+ dec.symbol(&mut cdfs.y_mode[size_group])
6282+ } else {
6283+ let above_ctx = INTRA_MODE_CTX[above_mode];
6284+ let left_ctx = INTRA_MODE_CTX[left_mode];
6285+ dec.symbol(&mut cdfs.kf_y_mode[above_ctx][left_ctx])
6286+ };
62316287 istep!("mode", mode as i32);
62326288 let angle_delta_y = if (V_PRED..=D67_PRED).contains(&mode) {
62336289 read_angle_delta(dec, &mut cdfs.angle_delta[mode - V_PRED])
@@ -6952,9 +7008,18 @@ fn decode_intra_rect_in_inter(
69527008 (8, 16) => (1usize, 1usize),
69537009 (16, 32) => (2, 2),
69547010 (32, 64) => (3, 3),
7011+ // lane-intra14 r1: the 1:4 strips, read off libaom's own tables --
7012+ // `size_group_lookup` (common_data.h:61) gives BLOCK_8X32/32X8 group
7013+ // 1 and BLOCK_16X64/64X16 group 2, while
7014+ // `bsize_to_tx_size_depth_table` (blockd.h:1347) gives them depth
7015+ // 3 and 4, i.e. tx categories 2 and 3 -- the diagonal a 2:1 strip
7016+ // keeps is genuinely broken here, which is why the shape was refused
7017+ // rather than read from the 2:1 row.
7018+ (8, 32) => (1, 2),
7019+ (16, 64) => (2, 3),
69557020 _ => {
69567021 return Err(unsupported(
6957- "an intra-coded 1:4 (or other non-2:1) rect strip on the inter block path",
7022+ "an intra-coded 16x4/4x16 strip on the inter block path (the 16x16-level 1:4 inter partition is refused before this point)",
69587023 ))
69597024 }
69607025 };
@@ -6967,6 +7032,70 @@ fn decode_intra_rect_in_inter(
69677032 is consumed for square blocks only)",
69687033 ));
69697034 }
7035+ // lane-intra14 r1: a 1:4 strip decodes through the very readers the KEY
7036+ // FRAME path already proves for this shape ([`decode_block_rect4`] at the
7037+ // 32 level, [`decode_block_rect64`] at 64 -- both already handle the 1:4
7038+ // luma/chroma transform tables, the per-unit split walk and the strip's
7039+ // own neighbour records). The ONLY difference on an inter frame is the
7040+ // mode-info read, which [`INTRA_IN_INTER_MODE`] switches to
7041+ // `read_intra_block_mode_info`'s `y_mode[size_group]` plus the `skip`
7042+ // this caller already read. `tx_cat` above is the same category those
7043+ // readers hardcode (cat 2 in `decode_block_rect4`, cat 3 in
7044+ // `decode_block_rect64`), asserted here so a future shape cannot drift.
7045+ if bw.max(bh) == 4 * bw.min(bh) {
7046+ debug_assert_eq!(tx_cat, if bw.max(bh) == 64 { 3 } else { 2 });
7047+ INTRA_IN_INTER_MODE.with(|c| c.set(Some((size_group, skip))));
7048+ let res = if bw.max(bh) == 64 {
7049+ decode_block_rect64(
7050+ dec,
7051+ cdfs,
7052+ neighbours,
7053+ (mi_r / (SUB / MI), mi_c / (SUB / MI)),
7054+ bw,
7055+ bh,
7056+ y,
7057+ u,
7058+ v,
7059+ ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get),
7060+ allow_screen_content_tools,
7061+ base_q_idx,
7062+ TX_SELECT_INTER.with(std::cell::Cell::get),
7063+ REDUCED_TX_SET_INTER.with(std::cell::Cell::get),
7064+ )
7065+ } else {
7066+ decode_block_rect4(
7067+ dec,
7068+ cdfs,
7069+ neighbours,
7070+ (mi_r, mi_c),
7071+ bw,
7072+ bh,
7073+ None,
7074+ y,
7075+ u,
7076+ v,
7077+ ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get),
7078+ allow_screen_content_tools,
7079+ base_q_idx,
7080+ TX_SELECT_INTER.with(std::cell::Cell::get),
7081+ )
7082+ .map(|_| ())
7083+ };
7084+ INTRA_IN_INTER_MODE.with(|c| c.set(None));
7085+ res?;
7086+ let shape = match (bw, bh) {
7087+ (64, 16) => 0,
7088+ (16, 64) => 1,
7089+ (32, 8) => 2,
7090+ _ => 3,
7091+ };
7092+ INTRA_RECT4_IN_INTER_HITS.with(|h| {
7093+ let mut v = h.get();
7094+ v[shape] += 1;
7095+ h.set(v);
7096+ });
7097+ return Ok(());
7098+ }
69707099 let mode = dec.symbol(&mut cdfs.y_mode[size_group]);
69717100 if mode >= 13 {
69727101 return Err(unsupported(
@@ -7042,7 +7171,9 @@ fn decode_intra_rect_in_inter(
70427171 }
70437172 let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(mi_r, mi_c, r, c);
70447173 let depth = if TX_SELECT_INTER.with(std::cell::Cell::get) {
7045- let ctx = tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh);
7174+ // The INTER frame's own `TXFM_CONTEXT` bands, not the key frame's
7175+ // deblock-grid approximation -- [`tx_size_context_txfm_rect`].
7176+ let ctx = tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw.min(64), bh.min(64));
70467177 match tx_cat {
70477178 1 => dec.symbol(&mut cdfs.tx_size_cat1[ctx]),
70487179 2 => dec.symbol(&mut cdfs.tx_size_cat2[ctx]),
@@ -7053,15 +7184,20 @@ fn decode_intra_rect_in_inter(
70537184 };
70547185 if depth != 0 {
70557186 TX_DEPTH_HITS.with(|h| h.set(h.get() + 1));
7056- // merge b51719f+lane-intrarect (class merge-cross-product-defect):
7057- // main's 10-bit `split_transform_intra_block` gate reaches this arm
7058- // with a nonzero tx depth, and the split rect-TU walk mis-decodes it
7059- // (2340 luma samples off at seed 51; refusing here restores that gate
7060- // while the depth-0 strip the lane proved keeps decoding). The lane's
7061- // own gate never exercised a split strip.
7062- return Err(unsupported(
7063- "a split (nonzero tx_depth) transform on an intra HORZ/VERT strip in an inter frame",
7064- ));
7187+ // lane-intrasplit r1: a split intra strip in an inter frame walks the
7188+ // key frame's own per-TU path ([`decode_rect_split`] below); what was
7189+ // wrong when this refusal was written was the depth SYMBOL, not the walk.
7190+ INTRA_RECT_IN_INTER_SPLIT_TX_HITS.with(|h| {
7191+ let mut v = h.get();
7192+ v[depth.min(2)] += 1;
7193+ h.set(v);
7194+ });
7195+ }
7196+ // lane-intrasplit r3: print EVERY intra strip with its depth, not only the
7197+ // split ones -- a `depth=0`-only stream is a witness gap in the SOURCE, and
7198+ // the two are indistinguishable when the diagnostic fires on splits alone.
7199+ if std::env::var_os("EC_SPLITSTRIP").is_some() {
7200+ eprintln!("EC_SPLITSTRIP mi_row={mi_r} mi_col={mi_c} bw={bw} bh={bh} depth={depth}");
70657201 }
70667202 let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth);
70677203 let modes = RectStripModes {
@@ -7095,6 +7231,22 @@ fn decode_intra_rect_in_inter(
70957231 base_q_idx,
70967232 REDUCED_TX_SET_INTER.with(std::cell::Cell::get),
70977233 )?;
7234+ // `set_txfm_ctxs` (libaom `decodeframe.c:1078`, at the end of
7235+ // `decode_token_recon_block`): an INTRA block records its TRANSFORM size in
7236+ // both `TXFM_CONTEXT` bands -- the above row over the block's width, the
7237+ // left column over its height. This arm wrote neither before lane-intrasplit
7238+ // r1, so every later block in the frame read a stale `tx_size`/`txfm_split`
7239+ // context across the strip's footprint.
7240+ for i in 0..bw / MI {
7241+ if let Some(cell) = neighbours.above_txfm.get_mut(mi_c + i) {
7242+ *cell = tx_w as u8;
7243+ }
7244+ }
7245+ for i in 0..bh / MI {
7246+ if let Some(cell) = neighbours.left_txfm.get_mut(mi_r + i) {
7247+ *cell = tx_h as u8;
7248+ }
7249+ }
70987250 let class = match bw.max(bh) {
70997251 64 => 0,
71007252 32 => 1,
@@ -12650,6 +12802,44 @@ fn tx_size_context(n: &Neighbours, (mi_r, mi_c): (usize, usize), own_side: usize
1265012802 /// a neighbour's var-tx tree splits. [`tx_size_context`]'s deblock-grid
1265112803 /// approximation coincides with this only while every neighbour codes one
1265212804 /// whole-block transform, which is exactly what `TxMode::Select` ends.
12805+/// [`tx_size_context_txfm`] with the block's own width and height (lane-intrasplit
12806+/// r1): `get_tx_size_context` compares the neighbour ABOVE against
12807+/// `tx_size_wide[max_txsize_rect_lookup[bsize]]` and the neighbour to the LEFT
12808+/// against `tx_size_high[...]` (libaom `pred_common.h:342`), which for a 2:1
12809+/// strip are two different numbers. The intra strip inside an inter frame read
12810+/// this through [`tx_size_context_rect`] -- the key frame's deblock-grid
12811+/// approximation -- so once `TxMode::Select` made the depth symbol exist, it was
12812+/// read off the wrong CDF row whenever a neighbour's var-tx tree had split.
12813+fn tx_size_context_txfm_rect(
12814+ n: &Neighbours,
12815+ (mi_r, mi_c): (usize, usize),
12816+ own_w: usize,
12817+ own_h: usize,
12818+) -> usize {
12819+ let has_above = mi_r > n.tile_row0_mi;
12820+ let has_left = mi_c > n.tile_col0_mi;
12821+ let mut above = usize::from(n.above_txfm[mi_c]) >= own_w;
12822+ let mut left = usize::from(n.left_txfm[mi_r]) >= own_h;
12823+ if has_above && n.above_inter[mi_c] {
12824+ above = n.above_side_mi[mi_c] >= own_w;
12825+ }
12826+ if has_left && n.left_inter[mi_r] {
12827+ left = n.left_side_mi[mi_r] >= own_h;
12828+ }
12829+ match (has_above, has_left) {
12830+ (true, true) => usize::from(above) + usize::from(left),
12831+ (true, false) => usize::from(above),
12832+ (false, true) => usize::from(left),
12833+ (false, false) => 0,
12834+ }
12835+}
12836+
12837+/// lane-intrasplit r3: `above_inter`/`left_inter` are mi-granular bands (they
12838+/// are written and read everywhere else with a raw mi index); the SUB-cell
12839+/// division this pair used read a cell four blocks away, so the inter-neighbour
12840+/// override above fired on the wrong neighbour -- the first divergence of the
12841+/// 10-bit gate's stream was exactly this (`tx_depth` ctx 0 where libaom has 1,
12842+/// at the intra block right of an inter one).
1265312843 fn tx_size_context_txfm(n: &Neighbours, (mi_r, mi_c): (usize, usize), side: usize) -> usize {
1265412844 let has_above = mi_r > n.tile_row0_mi;
1265512845 let has_left = mi_c > n.tile_col0_mi;
crates/ec-av1/src/refusal_inventory.rsmodified+1 -2
@@ -88,8 +88,7 @@ const REFUSALS: &[&str] = &[
8888 // inter path's intra arm now routes 2:1 strips through `decode_rect_split`);
8989 // what is left is the 1:4 shape, whose `bsize_to_tx_size_cat` breaks the
9090 // size-group/category diagonal the 2:1 shapes share.
91- "an intra-coded 1:4 (or other non-2:1) rect strip on the inter block path",
92- "a split (nonzero tx_depth) transform on an intra HORZ/VERT strip in an inter frame",
91+ "an intra-coded 16x4/4x16 strip on the inter block path (the 16x16-level 1:4 inter partition is refused before this point)",
9392 // The same arm's screen-content gate: palette/intrabc syntax is consumed
9493 // for square blocks only, so a strip in such a frame would skip symbols.
9594 "a HORZ/VERT intra strip in a screen-content frame (palette syntax is consumed for square blocks only)",
crates/ec-av1/src/stream.rsmodified+591 -0
@@ -934,6 +934,19 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
934934 Ok(pictures)
935935 }
936936
937+
938+/// lane-intra14 r1: INTRA-coded 1:4 strips decoded on the INTER block path
939+/// (64x16, 16x64, 32x8, 8x32) -- the counters a recipe sweep needs from
940+/// outside the crate.
941+pub fn intra_rect4_in_inter_counters() -> (usize, usize, usize, usize) {
942+ (
943+ crate::decode::intra_rect4_strip_in_inter_hits(0),
944+ crate::decode::intra_rect4_strip_in_inter_hits(1),
945+ crate::decode::intra_rect4_strip_in_inter_hits(2),
946+ crate::decode::intra_rect4_strip_in_inter_hits(3),
947+ )
948+}
949+
937950 #[cfg(test)]
938951 mod tests {
939952 use super::*;
@@ -27754,4 +27767,582 @@ mod tests {
2775427767 narrow_by_shape[0], narrow_by_shape[1]
2775527768 );
2775627769 }
27770+
27771+
27772+ /// lane-intra14 r1's decisive gate: a real aomenc INTER sequence with
27773+ /// `--enable-1to4-partitions=1`, whose fast-zooming content makes aomenc
27774+ /// code INTRA blocks inside inter frames on 1:4 strip shapes (32x8/8x32 at
27775+ /// the 32 level, 64x16/16x64 at the superblock level). Every such block
27776+ /// was the named refusal "an intra-coded 1:4 (or other non-2:1) rect strip
27777+ /// on the inter block path" until this round; they now decode through the
27778+ /// same `decode_block_rect4` / `decode_block_rect64` readers the KEY FRAME
27779+ /// 1:4 paths already prove, with only the mode-info read switched to
27780+ /// `read_intra_block_mode_info` (libaom decodemv.c:1189).
27781+ ///
27782+ /// Hard-asserts `intra_rect4_strip_in_inter_hits` (0 = 64x16, 1 = 16x64,
27783+ /// 2 = 32x8, 3 = 8x32) summed over the attempts that were actually
27784+ /// pixel-compared, and every decode-order frame is compared. A decode that
27785+ /// succeeds is ALWAYS pixel-compared (class
27786+ /// [[gate-skips-on-its-own-failure]]); exhausting every attempt without a
27787+ /// counted strip is a FAILURE, never a SKIP.
27788+ #[test]
27789+ // r1 `#[ignore]`d this gate on "every stream with an intra 1:4 strip also
27790+ // hits the inter rect-strip refusal". r2 merged main 18bf7dc (lane-r14
27791+ // a2e2e29 lifts exactly that refusal) and re-ran it: 3 of 40 attempts now
27792+ // decode whole and reach the pixel compare (0 before), one of them firing
27793+ // 64x16=4 16x64=3. But the compare fails on a defect this lane does not
27794+ // own -- MEASURED (r2, $HOME/.cache/intra14-r2-*.log):
27795+ // * seeds 46 and 54 fire ZERO 1:4 strips (`intra_rect4_strip_in_inter_hits`
27796+ // delta 0/0/0/0) and mismatch ffmpeg the same way as the firing seed 52:
27797+ // decode-order frame 3/4 luma ~3.7-4.5k samples, max |d| 6..17, then
27798+ // frames 5-7 drift to ~24k samples, max |d| ~220 as the references
27799+ // carry the error forward.
27800+ // * with `--enable-1to4-partitions=0` aomenc emits a BYTE-IDENTICAL
27801+ // stream at this recipe (same hits, same per-frame diff counts), so
27802+ // the 1:4 shape is not the discriminator either.
27803+ // i.e. this mandelbrot 192x128 source has a pre-existing INTER-frame
27804+ // pixel defect on this tree (r1 already recorded it as "open, NOT mine"
27805+ // with rect partitions off; it is now this gate's blocker). testsrc2 at
27806+ // 192x128 decodes pixel-exact on the same recipe but fires no 1:4 strip
27807+ // in 4 of 12 attempts that decode whole. So the gate stays `#[ignore]`d
27808+ // rather than weakened: a source whose baseline is exact AND that fires
27809+ // an intra 1:4 strip has not been found yet.
27810+ #[ignore = "blocked: the mandelbrot gate source has a pre-existing inter-frame pixel defect on this tree (zero-hit streams mismatch identically) -- see the MEASURED note above"]
27811+ fn a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact() {
27812+ intra_rect4_in_inter_gate(8);
27813+ }
27814+
27815+ /// The 10-bit arm (both of the user's films are `yuv420p10le`).
27816+ #[test]
27817+ // r1 `#[ignore]`d this gate on "every stream with an intra 1:4 strip also
27818+ // hits the inter rect-strip refusal". r2 merged main 18bf7dc (lane-r14
27819+ // a2e2e29 lifts exactly that refusal) and re-ran it: 3 of 40 attempts now
27820+ // decode whole and reach the pixel compare (0 before), one of them firing
27821+ // 64x16=4 16x64=3. But the compare fails on a defect this lane does not
27822+ // own -- MEASURED (r2, $HOME/.cache/intra14-r2-*.log):
27823+ // * seeds 46 and 54 fire ZERO 1:4 strips (`intra_rect4_strip_in_inter_hits`
27824+ // delta 0/0/0/0) and mismatch ffmpeg the same way as the firing seed 52:
27825+ // decode-order frame 3/4 luma ~3.7-4.5k samples, max |d| 6..17, then
27826+ // frames 5-7 drift to ~24k samples, max |d| ~220 as the references
27827+ // carry the error forward.
27828+ // * with `--enable-1to4-partitions=0` aomenc emits a BYTE-IDENTICAL
27829+ // stream at this recipe (same hits, same per-frame diff counts), so
27830+ // the 1:4 shape is not the discriminator either.
27831+ // i.e. this mandelbrot 192x128 source has a pre-existing INTER-frame
27832+ // pixel defect on this tree (r1 already recorded it as "open, NOT mine"
27833+ // with rect partitions off; it is now this gate's blocker). testsrc2 at
27834+ // 192x128 decodes pixel-exact on the same recipe but fires no 1:4 strip
27835+ // in 4 of 12 attempts that decode whole. So the gate stays `#[ignore]`d
27836+ // rather than weakened: a source whose baseline is exact AND that fires
27837+ // an intra 1:4 strip has not been found yet.
27838+ #[ignore = "blocked: the mandelbrot gate source has a pre-existing inter-frame pixel defect on this tree (zero-hit streams mismatch identically) -- see the MEASURED note above"]
27839+ fn a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact_10bit() {
27840+ intra_rect4_in_inter_gate(10);
27841+ }
27842+
27843+ fn intra_rect4_in_inter_gate(bit_depth: u32) {
27844+ const NAME: &str =
27845+ "a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact";
27846+ if !have_ffmpeg() {
27847+ eprintln!("SKIP {NAME}: no ffmpeg");
27848+ return;
27849+ }
27850+ if !have_aomenc() {
27851+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
27852+ return;
27853+ }
27854+ let (width, height, frame_count) = (192usize, 128usize, 8usize);
27855+ let mut refusals: Vec<String> = Vec::new();
27856+ let mut uncounted_exact = 0u32;
27857+ let mut compared = 0u32;
27858+ let mut shapes = [0usize; 4];
27859+ for attempt in 0..40u32 {
27860+ let seed = 42 + attempt;
27861+ // Same source class as the 2:1 sibling gate: a FAST mandelbrot
27862+ // zoom (`end_scale`/`end_pts`) so consecutive frames share almost
27863+ // no content and aomenc's RD codes blocks INTRA inside INTER
27864+ // frames, with `--kf-min-dist=1000` forbidding a new key frame.
27865+ let source = format!(
27866+ "mandelbrot=size={width}x{height}:start_scale={}:end_scale=0.004:end_pts=8:rate=25",
27867+ 5.0 - f64::from(attempt) * 0.06
27868+ );
27869+ let y4m = Command::new("ffmpeg")
27870+ .args([
27871+ "-v", "error", "-f", "lavfi", "-i", &source, "-vf", "hue=s=0", "-pix_fmt",
27872+ if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" },
27873+ "-strict", "-1", "-t", "0.32", "-f", "yuv4mpegpipe", "-strict", "-1", "-",
27874+ ])
27875+ .stdin(Stdio::null())
27876+ .stdout(Stdio::piped())
27877+ .stderr(Stdio::piped())
27878+ .output()
27879+ .expect("ffmpeg failed to run");
27880+ assert!(
27881+ y4m.status.success(),
27882+ "ffmpeg fixture: {}",
27883+ String::from_utf8_lossy(&y4m.stderr)
27884+ );
27885+ let depth_args: &[&str] = if bit_depth == 10 {
27886+ &["-b", "10", "--input-bit-depth=10"]
27887+ } else {
27888+ &[]
27889+ };
27890+ // MEASURED (r1, 40 attempts): `--cpu-used=0` makes aomenc pick
27891+ // 128x128 superblocks on this frame size, which decode_stream
27892+ // refuses by name, so the preset sweep starts at 1.
27893+ let cpu = format!("--cpu-used={}", 1 + attempt % 4);
27894+ // The higher the quantiser the more 1:4 intra strips inside inter
27895+ // frames, so the sweep walks cq 63 first.
27896+ let cq = format!("--cq-level={}", [63u32, 55, 45, 35][(attempt / 4) as usize % 4]);
27897+ let mut child = Command::new(aomenc_path())
27898+ .args(depth_args)
27899+ .arg(&cpu)
27900+ .arg(&cq)
27901+ .args([
27902+ // Every flag spelled exactly once (class
27903+ // [[aomenc-last-flag-wins]]). These are what the gate is
27904+ // about: 1:4 partitions ON, min size 16 so the 16x16-level
27905+ // 1:4 (refused elsewhere) is out of reach.
27906+ "--enable-rect-partitions=1",
27907+ "--enable-1to4-partitions=1",
27908+ // MEASURED (r1): at `--min-partition-size=16` aomenc codes
27909+ // 16x16-level 1:4 partitions (16x4/4x16 strips), which the
27910+ // inter partition path refuses by name (another lane's
27911+ // surface) in 12/40 attempts. 32 keeps this gate's two
27912+ // reachable levels -- the 32-level 32x8/8x32 and the
27913+ // superblock-level 64x16/16x64 -- and nothing else.
27914+ "--min-partition-size=32",
27915+ "--max-partition-size=64",
27916+ // MEASURED (r1): with tx-size search ON, 8/40 attempts stop
27917+ // at the 2:1 strip's own split-tx refusal (merge-cross-product,
27918+ // another lane's surface) before a 1:4 strip is reached.
27919+ "--enable-tx-size-search=0",
27920+ "--enable-filter-intra=1",
27921+ "--enable-intra-edge-filter=1",
27922+ "--codec=av1",
27923+ "--passes=1",
27924+ "--end-usage=q",
27925+ "--lag-in-frames=0",
27926+ "--auto-alt-ref=0",
27927+ "--kf-min-dist=1000",
27928+ "--kf-max-dist=1000",
27929+ "--threads=1",
27930+ "--row-mt=0",
27931+ "--enable-order-hint=0",
27932+ "--enable-warped-motion=0",
27933+ "--enable-obmc=0",
27934+ "--enable-masked-comp=0",
27935+ "--enable-interintra-comp=0",
27936+ "--enable-dist-wtd-comp=0",
27937+ "--enable-diff-wtd-comp=0",
27938+ "--enable-onesided-comp=0",
27939+ "--enable-interintra-wedge=0",
27940+ "--enable-smooth-interintra=0",
27941+ "--enable-ab-partitions=0",
27942+ "--enable-smooth-intra=0",
27943+ "--enable-paeth-intra=0",
27944+ "--enable-directional-intra=0",
27945+ "--enable-angle-delta=0",
27946+ "--enable-cdef=0",
27947+ "--enable-restoration=0",
27948+ // Ledger dead-end (lane-r14): a NEW gate spelling
27949+ // `--enable-cfl-intra=1` retires that tool from
27950+ // `NEVER_EXERCISED_8BIT` on the flag alone while no CfL
27951+ // hit counter exists to assert -- so it stays 0 here.
27952+ // Palette stays 0 for the same class of reason: this arm
27953+ // refuses a screen-content frame whole, so a palette flag
27954+ // would buy no coverage.
27955+ "--enable-palette=0",
27956+ "--enable-intrabc=0",
27957+ "--enable-cfl-intra=0",
27958+ "--enable-ref-frame-mvs=0",
27959+ "--obu",
27960+ "-o",
27961+ "-",
27962+ "-",
27963+ ])
27964+ .stdin(Stdio::piped())
27965+ .stdout(Stdio::piped())
27966+ .stderr(Stdio::piped())
27967+ .spawn()
27968+ .expect("aomenc failed to start");
27969+ child
27970+ .stdin
27971+ .take()
27972+ .expect("aomenc stdin")
27973+ .write_all(&y4m.stdout)
27974+ .expect("writing y4m to aomenc");
27975+ let out = child.wait_with_output().expect("aomenc failed to run");
27976+ assert!(
27977+ out.status.success(),
27978+ "aomenc refused the fixture: {}",
27979+ String::from_utf8_lossy(&out.stderr)
27980+ );
27981+ let stream = out.stdout;
27982+ let before: Vec<usize> =
27983+ (0..4).map(decode::intra_rect4_strip_in_inter_hits).collect();
27984+ let frames = match decode_stream(&stream) {
27985+ Ok(frames) => frames,
27986+ Err(e) => {
27987+ let msg = e.to_string();
27988+ assert!(
27989+ msg.contains("unsupported"),
27990+ "intra-1:4-in-inter decode failed outright (seed {seed}): {msg}"
27991+ );
27992+ refusals.push(format!("seed {seed} {cpu} {cq}: {msg}"));
27993+ continue;
27994+ }
27995+ };
27996+ let delta: Vec<usize> = (0..4)
27997+ .map(|k| decode::intra_rect4_strip_in_inter_hits(k) - before[k])
27998+ .collect();
27999+ let ffmpeg_frames = if bit_depth == 10 {
28000+ ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count)
28001+ } else {
28002+ ffmpeg_decode_sequence(&stream, width, height, frame_count)
28003+ };
28004+ assert_eq!(frames.len(), frame_count);
28005+ eprintln!(
28006+ "intra14 gate {bit_depth}-bit seed={seed} {cpu} {cq}: intra 1:4 strips in inter \
28007+ frames 64x16={} 16x64={} 32x8={} 8x32={}",
28008+ delta[0], delta[1], delta[2], delta[3]
28009+ );
28010+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
28011+ for (plane, (g, w)) in [
28012+ ("Y", (&got.y, &want.y)),
28013+ ("U", (&got.u, &want.u)),
28014+ ("V", (&got.v, &want.v)),
28015+ ] {
28016+ let stride = if plane == "Y" { width } else { width / 2 };
28017+ if let Some(at) = g.iter().zip(w.iter()).position(|(a, b)| a != b) {
28018+ let maxd = g
28019+ .iter()
28020+ .zip(w.iter())
28021+ .map(|(a, b)| i32::from(*a).abs_diff(i32::from(*b)))
28022+ .max()
28023+ .unwrap_or(0);
28024+ eprintln!(
28025+ "intra14 gate {bit_depth}-bit seed={seed}: frame {i} {plane} first \
28026+ diff at ({}, {}) got {} want {} ({} samples differ, max |d|={maxd})",
28027+ at % stride,
28028+ at / stride,
28029+ g[at],
28030+ w[at],
28031+ g.iter().zip(w.iter()).filter(|(a, b)| a != b).count(),
28032+ );
28033+ }
28034+ assert_eq!(g, w, "{plane} vs ffmpeg (seed {seed}, frame {i})");
28035+ }
28036+ }
28037+ compared += 1;
28038+ if delta.iter().all(|d| *d == 0) {
28039+ uncounted_exact += 1;
28040+ refusals.push(format!(
28041+ "seed {seed} {cpu} {cq}: decoded and pixel-compared, but no intra 1:4 strip on \
28042+ the inter path"
28043+ ));
28044+ }
28045+ for k in 0..4 {
28046+ shapes[k] += delta[k];
28047+ }
28048+ // Both LEVELS (32 and 64) is the bar; orientation is whichever the
28049+ // encoder picks.
28050+ if shapes[0] + shapes[1] > 0 && shapes[2] + shapes[3] > 0 {
28051+ break;
28052+ }
28053+ }
28054+ gate_buckets(
28055+ NAME,
28056+ compared - uncounted_exact,
28057+ uncounted_exact,
28058+ refusals.len() - uncounted_exact as usize,
28059+ );
28060+ eprintln!(
28061+ "{NAME} ({bit_depth}-bit): compared {compared} streams, intra 1:4 strips in inter \
28062+ frames: 64x16={} 16x64={} 32x8={} 8x32={}; refusals:\n{}",
28063+ shapes[0],
28064+ shapes[1],
28065+ shapes[2],
28066+ shapes[3],
28067+ refusals.join("\n")
28068+ );
28069+ assert!(
28070+ compared > 0,
28071+ "{NAME} ({bit_depth}-bit): every attempt hit a named refusal -- nothing was \
28072+ pixel-compared:\n{}",
28073+ refusals.join("\n")
28074+ );
28075+ assert!(
28076+ shapes[2] + shapes[3] > 0,
28077+ "{NAME} ({bit_depth}-bit): no 32-level intra 1:4 strip (32x8/8x32) fired over \
28078+ {compared} compared streams (64x16={} 16x64={} 32x8={} 8x32={})",
28079+ shapes[0],
28080+ shapes[1],
28081+ shapes[2],
28082+ shapes[3]
28083+ );
28084+ }
28085+
28086+ /// lane-intrasplit r1's decisive gate: a real aomenc INTER sequence in
28087+ /// which aomenc's RD picks an intra-coded HORZ/VERT *strip* (a 2:1
28088+ /// rectangular partition) inside an inter frame AND splits its luma
28089+ /// transform (`tx_depth >= 1`). Until this round that block was the named
28090+ /// refusal "a split (nonzero tx_depth) transform on an intra HORZ/VERT
28091+ /// strip in an inter frame"; it now walks the key frame's own per-TU path
28092+ /// ([`decode::decode_rect_split`]). Hard-asserts
28093+ /// [`decode::intra_rect_in_inter_split_tx_hits`] per depth: an attempt
28094+ /// that never produced such a block proves nothing, and exhausting every
28095+ /// attempt is a FAILURE, not a SKIP.
28096+ #[test]
28097+ fn a_real_aomenc_inter_sequence_with_a_split_transform_intra_strip_decodes_pixel_exact() {
28098+ intra_rect_in_inter_split_tx_gate(8);
28099+ }
28100+
28101+ /// The 10-bit arm (both of the user's films are `yuv420p10le`).
28102+ #[test]
28103+ fn a_real_aomenc_10bit_inter_sequence_with_a_split_transform_intra_strip_decodes_pixel_exact() {
28104+ intra_rect_in_inter_split_tx_gate(10);
28105+ }
28106+
28107+ fn intra_rect_in_inter_split_tx_gate(bit_depth: u32) {
28108+ let name = format!("intra_rect_in_inter_split_tx_gate({bit_depth})");
28109+ if !have_ffmpeg() {
28110+ eprintln!("SKIP {name}: no ffmpeg");
28111+ return;
28112+ }
28113+ if !have_aomenc() {
28114+ eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display());
28115+ return;
28116+ }
28117+ // lane-intrasplit r3, MEASURED (probe3, 20 attempts x 2 depths): at
28118+ // 192x128 with `--min/--max-partition-size=32` a correctly decoded
28119+ // stream contains ZERO intra HORZ/VERT strips in an inter frame -- the
28120+ // r1/r2 "firing" counters were read off our own desynced decode (class
28121+ // counter-from-refused-stream). The merged unsplit-strip gate's own
28122+ // geometry (96x96, min 16 / max 64) is the one that makes aomenc's RD
28123+ // pick intra strips here, and at `--enable-tx-size-search=1` it splits
28124+ // their transforms: 10-bit attempt 0 = 8 strips, 3 split; 8-bit
28125+ // attempt 0 = 5 strips, 1 split.
28126+ let (width, height, frame_count) = (96usize, 96usize, 8usize);
28127+ let mut refusals = Vec::new();
28128+ let mut uncounted_exact = 0u32;
28129+ let mut counted_exact = 0u32;
28130+ let mut seen = [0usize; 3];
28131+ for attempt in 0..40u32 {
28132+ let seed = 42 + attempt;
28133+ // MEASURED (r1, 40 attempts): the same sweep the merged
28134+ // `intra_rect_in_inter_gate` had to make -- at `--cpu-used=0`
28135+ // aomenc emits AB partitions regardless of
28136+ // `--enable-ab-partitions=0` (ledger), so the preset is swept
28137+ // 1..4, and the quantiser with it (a hard-cut overlay source at
28138+ // cpu-used=0 stopped 38/40 attempts on other lanes' refusals).
28139+ let cpu = attempt % 5;
28140+ let cq = [30u32, 20, 12, 4][((attempt / 5) % 4) as usize];
28141+ // A FAST ZOOM: consecutive frames share almost no content, so
28142+ // aomenc's RD codes blocks INTRA inside INTER frames
28143+ // (`--kf-min-dist` forbids a new key frame) -- the only way a
28144+ // real encoder reaches this decoder's intra-in-inter arm -- and
28145+ // the fractal's fine detail is what then splits their transforms.
28146+ let source = format!(
28147+ "mandelbrot=size={width}x{height}:start_scale={}:end_scale=0.004:end_pts=8:rate=25",
28148+ 5.0 - f64::from(attempt) * 0.06
28149+ );
28150+ let y4m = Command::new("ffmpeg")
28151+ .args([
28152+ "-v",
28153+ "error",
28154+ "-f",
28155+ "lavfi",
28156+ "-i",
28157+ &source,
28158+ // Desaturated chroma keeps `uv_mode` on DC_PRED, so the
28159+ // still-refused directional-chroma gaps never fire and
28160+ // luma detail alone drives the transform split.
28161+ "-vf",
28162+ "hue=s=0",
28163+ "-pix_fmt",
28164+ if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" },
28165+ "-strict",
28166+ "-1",
28167+ "-t",
28168+ "0.32",
28169+ "-f",
28170+ "yuv4mpegpipe",
28171+ "-strict",
28172+ "-1",
28173+ "-",
28174+ ])
28175+ .stdin(Stdio::null())
28176+ .stdout(Stdio::piped())
28177+ .stderr(Stdio::piped())
28178+ .output()
28179+ .expect("ffmpeg failed to run");
28180+ assert!(
28181+ y4m.status.success(),
28182+ "ffmpeg fixture: {}",
28183+ String::from_utf8_lossy(&y4m.stderr)
28184+ );
28185+ let depth_args: &[&str] = if bit_depth == 10 {
28186+ &["-b", "10", "--input-bit-depth=10"]
28187+ } else {
28188+ &[]
28189+ };
28190+ let cq_arg = format!("--cq-level={cq}");
28191+ let cpu_arg = format!("--cpu-used={cpu}");
28192+ let mut child = Command::new(aomenc_path())
28193+ .args(depth_args)
28194+ .args([
28195+ "--codec=av1",
28196+ "--passes=1",
28197+ "--end-usage=q",
28198+ &cq_arg,
28199+ &cpu_arg,
28200+ "--lag-in-frames=0",
28201+ "--auto-alt-ref=0",
28202+ "--kf-max-dist=9999",
28203+ "--kf-min-dist=9999",
28204+ "--threads=1",
28205+ "--row-mt=0",
28206+ "--enable-order-hint=0",
28207+ "--enable-warped-motion=0",
28208+ "--enable-obmc=0",
28209+ "--enable-masked-comp=0",
28210+ "--enable-interintra-comp=0",
28211+ "--enable-dist-wtd-comp=0",
28212+ "--enable-diff-wtd-comp=0",
28213+ "--enable-onesided-comp=0",
28214+ "--enable-interintra-wedge=0",
28215+ "--enable-smooth-interintra=0",
28216+ "--enable-ab-partitions=0",
28217+ "--enable-1to4-partitions=0",
28218+ "--enable-filter-intra=0",
28219+ "--enable-smooth-intra=0",
28220+ "--enable-paeth-intra=0",
28221+ "--enable-directional-intra=0",
28222+ "--enable-angle-delta=0",
28223+ "--enable-cdef=0",
28224+ "--enable-restoration=0",
28225+ "--enable-palette=0",
28226+ "--enable-intrabc=0",
28227+ "--enable-cfl-intra=0",
28228+ "--enable-ref-frame-mvs=0",
28229+ "--min-partition-size=16",
28230+ "--max-partition-size=64",
28231+ // Per-arm overrides go LAST (aomenc keeps the last
28232+ // occurrence of a repeated --enable-* flag): this gate
28233+ // needs the rect partitions the strip lives in and the
28234+ // tx_depth symbol, which exists only under TX_MODE_SELECT.
28235+ "--enable-rect-partitions=1",
28236+ "--enable-tx-size-search=1",
28237+ "--obu",
28238+ "-o",
28239+ "-",
28240+ "-",
28241+ ])
28242+ .stdin(Stdio::piped())
28243+ .stdout(Stdio::piped())
28244+ .stderr(Stdio::piped())
28245+ .spawn()
28246+ .expect("aomenc failed to start");
28247+ child
28248+ .stdin
28249+ .take()
28250+ .expect("aomenc stdin")
28251+ .write_all(&y4m.stdout)
28252+ .expect("writing y4m to aomenc");
28253+ let out = child.wait_with_output().expect("aomenc failed to run");
28254+ assert!(
28255+ out.status.success(),
28256+ "aomenc refused the fixture: {}",
28257+ String::from_utf8_lossy(&out.stderr)
28258+ );
28259+ let stream = out.stdout;
28260+ let before = decode::intra_rect_in_inter_split_tx_hits();
28261+ let frames = match decode_stream(&stream) {
28262+ Ok(frames) => frames,
28263+ Err(e) => {
28264+ let msg = e.to_string();
28265+ assert!(
28266+ msg.contains("unsupported"),
28267+ "{name} decode failed outright (seed {seed} cq {cq}): {msg}"
28268+ );
28269+ refusals.push(format!("seed {seed} cq {cq} cpu {cpu}: {msg}"));
28270+ continue;
28271+ }
28272+ };
28273+ let after = decode::intra_rect_in_inter_split_tx_hits();
28274+ let mut per_depth = [0usize; 3];
28275+ for i in 0..3 {
28276+ per_depth[i] = after[i] - before[i];
28277+ }
28278+ // class [[gate-skips-on-its-own-failure]]: a decode that
28279+ // succeeded is ALWAYS pixel-compared below; the counter only
28280+ // decides whether the attempt counts as firing.
28281+ let counted = per_depth[1] + per_depth[2] != 0;
28282+ if !counted {
28283+ uncounted_exact += 1;
28284+ refusals.push(format!(
28285+ "seed {seed} cq {cq} cpu {cpu}: decoded and pixel-compared, but no intra rect strip \
28286+ in an inter frame split its transform"
28287+ ));
28288+ }
28289+ let ffmpeg_frames = if bit_depth == 10 {
28290+ ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count)
28291+ } else {
28292+ ffmpeg_decode_sequence(&stream, width, height, frame_count)
28293+ };
28294+ assert_eq!(frames.len(), frame_count);
28295+ eprintln!(
28296+ "{name} seed={seed} cq={cq} cpu={cpu}: split intra strips depth1={} depth2={}",
28297+ per_depth[1], per_depth[2]
28298+ );
28299+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
28300+ for (plane, (g, w)) in [
28301+ ("Y", (&got.y, &want.y)),
28302+ ("U", (&got.u, &want.u)),
28303+ ("V", (&got.v, &want.v)),
28304+ ] {
28305+ let stride = if plane == "Y" { width } else { width / 2 };
28306+ if let Some(at) = g.iter().zip(w.iter()).position(|(a, b)| a != b) {
28307+ eprintln!(
28308+ "{name} seed={seed}: frame {i} {plane} first diff at ({}, {}) got {} \
28309+ want {} ({} samples differ)",
28310+ at % stride,
28311+ at / stride,
28312+ g[at],
28313+ w[at],
28314+ g.iter().zip(w.iter()).filter(|(a, b)| a != b).count(),
28315+ );
28316+ }
28317+ }
28318+ }
28319+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
28320+ assert_eq!(got.y, want.y, "frame {i} luma vs ffmpeg (seed {seed} cq {cq})");
28321+ assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed} cq {cq})");
28322+ assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed} cq {cq})");
28323+ }
28324+ if counted {
28325+ counted_exact += 1;
28326+ seen[1] += per_depth[1];
28327+ seen[2] += per_depth[2];
28328+ // Keep sweeping until BOTH reachable depths have been seen in
28329+ // a pixel-exact attempt; one firing attempt is the floor.
28330+ if seen[1] != 0 && seen[2] != 0 {
28331+ break;
28332+ }
28333+ }
28334+ }
28335+ gate_buckets(
28336+ &name,
28337+ counted_exact,
28338+ uncounted_exact,
28339+ refusals.len() - uncounted_exact as usize,
28340+ );
28341+ eprintln!("{name}: split strips seen depth1={} depth2={}", seen[1], seen[2]);
28342+ assert!(
28343+ seen[1] + seen[2] != 0,
28344+ "{name} never observed a split-transform intra strip in an inter frame:\n{}",
28345+ refusals.join("\n")
28346+ );
28347+ }
2775728348 }
lanes/intra14-r1.report.mdadded+105 -0
@@ -0,0 +1,105 @@
1+# lane-intra14 r1 -- intra-coded 1:4 rect strips on the INTER block path
2+
3+Branch `lane-intra14` off main `7a47fc1`. **RED**: the decoder work is done and
4+demonstrably fires, but NO real-aomenc attempt on this tree can be
5+pixel-compared, so the lifted refusal is **ungated** and this branch MUST NOT
6+merge as-is.
7+
8+## What changed
9+
10+* `crates/ec-av1/src/decode.rs:5987` (`decode_intra_rect_in_inter`) -- the
11+ `(size_group, tx_cat)` table gains the 1:4 rows `(8,32) -> (1,2)` and
12+ `(16,64) -> (2,3)`, read off libaom `size_group_lookup`
13+ (common_data.h:61) and `bsize_to_tx_size_depth_table` (blockd.h:1347). A 1:4
14+ strip then decodes through the KEY-FRAME readers that already prove the
15+ shape: `decode_block_rect4` (32-level 32x8/8x32) and `decode_block_rect64`
16+ (SB-level 64x16/16x64) -- transform tables, per-unit split walk, chroma,
17+ Reach, neighbour records, palette/filter-intra refusals all reused unchanged.
18+* `crates/ec-av1/src/decode.rs` `INTRA_IN_INTER_MODE` (thread-local) -- the one
19+ genuine difference on an inter frame is the mode-info read.
20+ `read_intra_mode_rect` now, when it is set, (a) takes the `skip` the inter
21+ path already read instead of re-reading skip/segment id/cdef/delta-q and
22+ (b) reads the luma mode off `y_mode[size_group]`
23+ (libaom `read_intra_block_mode_info`, decodemv.c:1189) instead of
24+ `kf_y_mode[above][left]` (decodemv.c's key-frame reader). Everything after
25+ that -- angle deltas (decodemv.c:1191/1203), uv_mode + CfL (1196-1201),
26+ palette (1215), filter intra (the `read_filter_intra_mode_info` tail) -- is
27+ bit-identical between the two libaom readers, which is why no other symbol
28+ needed a branch.
29+* Counters `INTRA_RECT4_IN_INTER_HITS` (0=64x16, 1=16x64, 2=32x8, 3=8x32),
30+ exported as `stream::intra_rect4_in_inter_counters()` and printed by
31+ `examples/decode_probe`.
32+* `refusal_inventory.rs:76` -- "an intra-coded 1:4 (or other non-2:1) rect
33+ strip on the inter block path" replaced by the narrower
34+ "an intra-coded 16x4/4x16 strip on the inter block path (the 16x16-level 1:4
35+ inter partition is refused before this point)": 16x4/4x16 is unreachable
36+ because `decode.rs:20332` refuses the 16x16-level 1:4 inter partition first,
37+ and `decode_block_rect4`'s tables are 32x8-specific.
38+* `stream.rs` -- gate `a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact`
39+ (+ `_10bit`), currently `#[ignore]`d with the blocker named (see below).
40+
41+## Why the gate cannot pass on this tree (MEASURED)
42+
43+40 gate attempts per depth + ~150 recipe-sweep attempts (frame sizes 64x64,
44+96x96, 128x128, 192x128, 256x192; mandelbrot fast-zoom, static-background +
45+moving overlay, 64x16/16x64/32x8/8x32 moving bars, testsrc2; cq 35..63;
46+cpu-used 1..4; min/max-partition-size 32/32, 32/64, 64/64):
47+
48+* Every stream in which an intra 1:4 strip actually fires (counters 1..4 per
49+ stream, e.g. `32x8=4`, `64x16=2`, `16x64=3`, `8x32=4`) ALSO carries a
50+ non-skip INTER 2:1 rect strip ("a non-skip rectangular (HORZ/VERT/HORZ_B)
51+ strip needs rectangular residual coding"), an SB-level AB partition, or a
52+ sub-8 inter partition -- each another lane's named refusal, hit before the
53+ frame completes, so the attempt is never pixel-compared.
54+* Every recipe under which all attempts decode whole (`--max-partition-size=32`,
55+ or a static background with a moving overlay) fires ZERO 1:4 intra strips:
56+ aomenc only reaches for 1:4 partitions in the same neighbourhoods where it
57+ also picks the SB-level rect/AB shapes this decoder still refuses.
58+* Class [[counter-from-refused-stream]] applies: the counters above come from
59+ REFUSED streams and prove only that the new code path is entered, never that
60+ its pixels are right. The gate counts deltas on decoded+compared attempts
61+ only, which is why it currently fails/ignores rather than reading green.
62+
63+So: **un-ignore and re-run this gate once the inter rect-leaf lane (lane-r14 r3,
64+`decode.rs` var-tx leaves) lands** -- that is the refusal that aborts every
65+candidate stream.
66+
67+## Film check (his ReelB extract)
68+
69+`decode_probe scratchpad/census3/kf/seg_4500.obu` (3840x1608 yuv420p10le,
70+213 frame headers):
71+
72+* BEFORE (charter premise): stops at "an intra-coded 1:4 (or other non-2:1)
73+ rect strip on the inter block path".
74+* AFTER: `intra_rect4_in_inter: 64x16=0 16x64=4 32x8=0 8x32=0` -- four intra
75+ 16x64 strips decode -- and the stop string is now
76+ "a split intra strip whose transform unit is 64x32 (no luma coefficient
77+ tables for that shape here)" (`decode_rect_split`'s luma-shape guard: the
78+ SB-level 2:1 strip at tx depth 0, i.e. a TX_64X32 luma transform, which no
79+ path here codes). Frames decoded (EC_AV1_FINAL_DUMP file count): 1 (the head
80+ key frame) -- the new stop is still inside decode-order frame 1.
81+
82+EVIDENCE: /tmp/claude-1000/.../scratchpad/census3/kf/seg_4500.obu | decode_probe before/after the change, EC_AV1_FINAL_DUMP file count | 4 intra 16x64 strips decoded; stop string moved from the 1:4 refusal to "transform unit is 64x32"; 1 frame dumped
83+EVIDENCE: $HOME/.cache/intra14-suite-r1.log | `cargo test -p ec-av1 --lib` under a systemd unit (MemoryMax=10G) | test result: ok. 367 passed; 0 failed; 33 ignored (2 of them this lane's gate arms); 616.84s
84+
85+## Residue
86+
87+* fix-now (next round / successor lane): the gate is `#[ignore]`d. deferred --
88+ what unblocks it: the inter rect-strip refusal ("a non-skip rectangular
89+ (HORZ/VERT/HORZ_B) strip needs rectangular residual coding"), lane-r14 r3.
90+* deferred: pixel-byte compare of the film's pre-stop frames through
91+ EC_PROBE_OUT16 -- only ONE frame decodes before the stop, and it is the key
92+ frame already proven bit-exact by lane-hgkf; what unblocks a meaningful
93+ compare is the 64x32 luma transform above.
94+* accepted: `--enable-cfl-intra=0` and `--enable-palette=0` in the new gate
95+ (ledger dead-end: a new gate spelling `--enable-cfl-intra=1` retires the tool
96+ from `NEVER_EXERCISED_8BIT` on the flag alone with no CfL counter to assert;
97+ the screen-content frame is refused whole on this path, so a palette flag
98+ would buy no coverage). Deviation from the charter's flag list, stated here.
99+* accepted: `--enable-tx-size-search=0` and `--min-partition-size=32` in the
100+ gate recipe -- measured, both named in the source comments.
101+* open (NOT mine, found here): at 192x128 mandelbrot start_scale 4.76, cq 55,
102+ cpu-used 1, WITHOUT any rect/1:4 partition (`--enable-rect-partitions=0`),
103+ decode-order frame 4 mismatches ffmpeg by 3729 luma samples (max |d| = 6) and
104+ frames 5-7 drift (24k samples, max |d| ~220). Pre-existing square-path defect
105+ on this tree, unrelated to this lane.
lanes/intra14-r2.report.mdadded+101 -0
@@ -0,0 +1,101 @@
1+# lane-intra14 r2 -- merge main, un-ignore the gate, re-measure
2+
3+Branch `lane-intra14`, base main `18bf7dc`. **RED**: the r1 blocker refusal is
4+gone and the gate now reaches the pixel compare, but every compared attempt
5+mismatches on a defect this lane does not own, so the lifted refusal is still
6+**ungated** and this branch MUST NOT merge as-is.
7+
8+## 1. Merge (commit 4672212)
9+
10+`git merge --no-commit main` -- one conflict (stream.rs counter accessors,
11+resolved keeping BOTH lanes' functions: `intra_rect4_in_inter_counters` and
12+lane-r14's `rect64_inter_tu_hits`). md5 of the merged files vs main:
13+
14+| file | main | merged |
15+|---|---|---|
16+| cdf.rs (incl. NZ_MAP / FILTER_INTRA regions) | a3fb168e | a3fb168e |
17+| cdf_state.rs | 6faaa22c | 6faaa22c |
18+| encode.rs | 6c9f9f66 | 6c9f9f66 |
19+| mvstack.rs | 3ff196a2 | 3ff196a2 |
20+
21+i.e. every file this lane does not own came through byte-identical to main;
22+`decode.rs` / `refusal_inventory.rs` / `decode_probe.rs` carry only this lane's
23+additions on top of main's text (`git diff main -- <file>` reviewed hunk by hunk).
24+
25+## 2. The gate, un-ignored and re-run (8-bit, 40 attempts)
26+
27+`--exact stream::tests::a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact --nocapture`
28+
29+Before (r1 tree): 40/40 attempts refused, 0 pixel-compared.
30+After the merge: **3 attempts decode whole**, one of them firing the feature:
31+
32+* seed 52 (`--cpu-used=3 --cq-level=45`): `64x16=4 16x64=3 32x8=0 8x32=0`
33+* seed 46 (`--cpu-used=1 --cq-level=55`): `0 0 0 0`
34+* seed 54 (`--cpu-used=1 --cq-level=35`): `0 0 0 0`
35+
36+All three MISMATCH ffmpeg, and **the two zero-hit attempts mismatch exactly like
37+the firing one**: decode-order frame 3/4 luma ~3.7-4.5k samples at max |d| 6..17
38+(first diff around x=128..141, y=58..59), then frames 5-7 drift to ~24k samples
39+at max |d| ~220 as the references carry the error. So the failure is NOT the 1:4
40+strip path: it is a pre-existing INTER-frame defect of this mandelbrot 192x128
41+source on this tree -- the same one r1 already recorded as "open, NOT mine"
42+(3729 samples, max |d| = 6, with rect partitions off). Control: re-encoding the
43+seed-52 recipe with `--enable-1to4-partitions=0` yields a byte-identical stream
44+(same hits, same per-frame diff counts), so aomenc ignores that flag here and
45+the shape is not the discriminator either.
46+
47+Remaining refusals over the 40 attempts (37 of them, all other lanes' surfaces):
48+inter SB-level AB (12), inter 16x16-level AB or 1:4 (6), non-skip rect strip
49+needs rect residual coding (5), split intra strip whose TU is 32x64 / 64x32 (5),
50+inter partition below 8x8 (4), sub-8 angle delta / other (5).
51+
52+The two gate arms are therefore **`#[ignore]`d again, with the new blocker
53+measured and named in the source** (stream.rs, above both arms) instead of the
54+stale r1 reason. The gate itself is unchanged and unweakened: counters are
55+per-attempt deltas on decoded+compared attempts only, every decode-order frame
56+compared, a decode error is never a SKIP.
57+
58+### Recipe hunt for a clean-baseline source (240-recipe matrix + a 4-source probe)
59+* matrix 192x128/256x192/128x128 x min-part 16/32 x tx-size-search 0/1 x
60+ cq 63/55/45/35/25 x cpu 1..4 (98 recipes ran before the 10-min bound): exactly
61+ ONE fired 1:4 strips (192x128, min=32, txs=1, cq35, cpu2 -> `64x16=2 16x64=4`)
62+ and it mismatches (118035 samples); 7 more decoded with zero hits.
63+* `testsrc2=192x128` on the same recipe: 4 of 12 attempts decode **pixel-exact**
64+ (clean baseline) but fire zero 1:4 strips; the other 8 hit named refusals.
65+* `--enable-cfl-intra=1` was NOT re-measured -- the run budget went to the
66+ mismatch triage. deferred.
67+
68+## 3. Film check (his ReelB extract, unchanged by the merge)
69+
70+`decode_probe scratchpad/census3/kf/seg_4500.obu` (3840x1608 yuv420p10le, 213
71+frame headers): still stops at "a split intra strip whose transform unit is
72+64x32 (no luma coefficient tables for that shape here)", still decodes
73+`intra_rect4_in_inter: 64x16=0 16x64=4 32x8=0 8x32=0`. `EC_AV1_FINAL_DUMP` file
74+count is 0 (r1 measured 1 on the pre-merge tree) -- the stop is inside
75+decode-order frame 1 either way.
76+
77+EVIDENCE: $HOME/.cache/intra14-r2-fi0.log, $HOME/.cache/intra14-r2-sweep.log, $HOME/.cache/intra14-r2-src.log | un-ignored gate + 240-recipe matrix + 4-source probe under systemd-run scopes | 3/40 attempts pixel-compared (0 before the merge), seed 52 fires 64x16=4 16x64=3, and the two zero-hit attempts mismatch identically
78+EVIDENCE: scratchpad/census3/kf/seg_4500.obu | decode_probe under a 6G scope, EC_AV1_FINAL_DUMP file count | stop string unchanged ("transform unit is 64x32"), 4 intra 16x64 strips decoded, 0 frames completed
79+
80+## 4. Suite
81+
82+`cargo test -p ec-av1 --lib` under a user systemd unit (MemoryMax=10G):
83+**370 passed; 0 failed; 34 ignored** (2 of the ignored are this lane's gate
84+arms); 889.13s.
85+
86+EVIDENCE: $HOME/.cache/intra14-suite-r2.log | systemd-run --user --unit ... MemoryMax=10G, EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1, nice -n 10 -j3 | test result: ok. 370 passed; 0 failed; 34 ignored; 889.13s
87+
88+## Residue
89+
90+* fix-now (successor / another lane): the pre-existing inter-frame pixel defect
91+ on 192x128 mandelbrot at cq 35..55, cpu 1..3 -- reproducible with ZERO 1:4
92+ strips and zero rect partitions, first divergence decode-order frame 3/4 luma
93+ around (130,58) with max |d| < 20. It is unrefused (silent), so every gate on
94+ mandelbrot inter content is measuring it. deferred -- what unblocks this lane:
95+ either that fix, or a source whose inter baseline is exact AND that fires an
96+ intra 1:4 strip.
97+* deferred: `--enable-cfl-intra=1` arm -- what unblocks it: a green gate to add
98+ it to.
99+* accepted: `--enable-filter-intra=1` stays in the recipe. An earlier r2 run with
100+ it at 0 showed zero mismatches, but only ONE stream was compared in that run,
101+ so it proves nothing; the claim is withdrawn.
lanes/intrasplit-r1.report.mdadded+75 -0
@@ -0,0 +1,75 @@
1+# lane-intrasplit r1 — RED (refusal lifted, two root causes fixed, gate never fired)
2+
3+Base: 18bf7dc. Branch: lane-intrasplit.
4+
5+## What changed
6+- `crates/ec-av1/src/decode.rs:6225` — the refusal "a split (nonzero tx_depth) transform on
7+ an intra HORZ/VERT strip in an inter frame" is gone; a nonzero depth now walks the key
8+ frame's own per-TU path (`depth_to_tx_wh` + `decode_rect_split`, already wired) and bumps
9+ the new per-depth counter.
10+- `crates/ec-av1/src/decode.rs` (`tx_size_context_txfm_rect`, new, above
11+ `tx_size_context_txfm`) — ROOT CAUSE 1: the arm read its `tx_depth` symbol through
12+ `tx_size_context_rect`, the KEY FRAME's deblock-grid approximation. libaom
13+ `get_tx_size_context` (pred_common.h:342, called from `read_selected_tx_size`,
14+ decodemv.c) reads the two `TXFM_CONTEXT` bands and, for an INTER neighbour, that
15+ neighbour's BLOCK width/height instead. Class [[cdf-row-held-constant]]: wrong CDF row,
16+ same value most of the time, different range.
17+- `crates/ec-av1/src/decode.rs` (tail of `decode_intra_rect_in_inter`) — ROOT CAUSE 2:
18+ the strip never wrote its own `TXFM_CONTEXT` bands (`set_txfm_ctxs`,
19+ decodeframe.c end of `decode_token_recon_block`), because the call site
20+ (decode.rs:18210) returns early. Every later block in the frame read a stale
21+ `tx_size`/`txfm_split` context across the strip's footprint.
22+- `crates/ec-av1/src/refusal_inventory.rs` — inventory line dropped.
23+- `crates/ec-av1/src/stream.rs` — new gate
24+ `a_real_aomenc_{,10bit_}inter_sequence_with_a_split_transform_intra_strip_decodes_pixel_exact`
25+ (192x128, 8 frames, real aomenc, `--enable-rect-partitions=1 --enable-tx-size-search=1`,
26+ `--kf-max-dist/-min-dist=9999 --lag-in-frames=0`, cpu-used and cq (incl. 63) swept,
27+ each flag spelled once with the rect/tx overrides LAST) hard-asserting
28+ `decode::intra_rect_in_inter_split_tx_hits()` per depth.
29+
30+## Gate result: RED (never fired)
31+`cargo test -p ec-av1 --lib a_real_aomenc_inter_sequence_with_a_split_transform_intra_strip`
32+40/40 attempts stop at OTHER lanes' named refusals; 0 attempts decoded whole, so the lift is
33+UNGATED and this branch MUST NOT merge as-is.
34+
35+EVIDENCE: $HOME/.cache/intrasplit-suite-r1.log | 40-attempt sweep, min/max-partition 32/32,
36+cpu 0..4, cq 30/20/12/63, zoom-mandelbrot source | refusal histogram:
37+intra 1:4 strip 9, non-skip inter rect strip 7, inter 16x16 AB/1:4 7, inter SB AB 4,
38+1:4 inter strip split w/ 64 axis 3, inter sub-8 3, split intra strip w/ 64x32 unit 2,
39+32x64 unit 2, Golomb tail 2, 8x8 non-DC chroma 1.
40+Six recipe families were swept (192x128 and 96x96; min/max partition 16/32, 16/64, 32/64,
41+32/32; hard-cut overlay and fast-zoom sources; sb-size 64): every stream that makes aomenc
42+pick an intra 2:1 strip with a split transform also carries one of the refusals above.
43+Same shape as the recorded lane-intra14 r1 and lane-r14 r3 gate hunts.
44+
45+## Film probes (charter)
46+EVIDENCE: scratchpad/intrasplit/{reelb1200,reelc1800}.obu | `ffmpeg -ss 1200/-ss 1800 -t 2 -c:v copy -f obu`
47+then `cargo run -p ec-av1 --example decode_probe` | new stops:
48+- ReelB -ss 1200: `a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular
49+ residual coding` (was the split-intra-strip refusal per census4) — 0 frames in
50+ EC_AV1_FINAL_DUMP.
51+- ReelC -ss 1800: `an intra-coded 1:4 (or other non-2:1) rect strip on the inter block path`
52+ (lane-intra14's surface) — 0 frames in EC_AV1_FINAL_DUMP. No 128-superblock refusal was
53+ reached on this segment.
54+
55+## Suite
56+`cargo test -p ec-av1 --lib` (systemd unit, MemoryMax=10G, log
57+`$HOME/.cache/intrasplit-suite-r1.log`): **370 passed, 2 failed, 32 ignored** in 1183 s.
58+The 2 failures are exactly the two new gate arms (never fired, see above); every merged
59+gate — including the two `split_transform_intra_block` arms the refusal was originally
60+protecting, and every rect/strip/txselect gate — stays green with both fixes in.
61+
62+A first suite run also showed `a_real_aomenc_stream_with_film_grain_decodes_pixel_exact`
63+FAILED; that was MY setup error (the worktree had no top-level `fixtures` symlink, so
64+`fs::read(../../fixtures/golden6-mismatch.obu).unwrap()` panicked), not a regression —
65+`$HOME/.cache/intrasplit-base-filmgrain.log` shows the same test green at base 18bf7dc, and
66+it is green in the rerun above after `ln -s`.
67+
68+## Residue
69+- fix-now (next round): make the gate fire. The only untried levers are a content family
70+ that yields 32x16/16x32 intra strips with NO 1:4 or AB partition anywhere in the frame,
71+ or waiting on lane-intra14 (1:4 intra strips) and lane-r14 (inter rect leaves) — both
72+ would remove the two dominant blockers.
73+- deferred(lane-r14/lane-intra14): the two 64-axis strip refusals ("split intra strip whose
74+ transform unit is 64x32/32x64") are this arm's neighbours but need rectangular 64-axis
75+ luma coefficient tables.
lanes/intrasplit-r2.handoff.mdadded+58 -0
@@ -0,0 +1,58 @@
1+# lane-intrasplit r2 HANDOFF (tip 6e883c9, branch lane-intrasplit)
2+
3+## Merge state (all committed on this branch)
4+main 48b35ab -> lane-sqdrift 7d498c0 -> lane-r14 b86eb38 -> lane-inter16ab 4811488 (tip
5+moved from the charter's af7de9f) -> lane-intra14 f4b5419 (was 8313c4a). cdf.rs byte-equal
6+to main. Conflict resolutions: stream.rs (three gates interleaved in ONE hunk — all three
7+kept), decode.rs (both thread-locals; sbrect10 is_cfl_allowed narrowing BEFORE intra14's
8+INTRA_IN_INTER_MODE skip/mode split in read_intra_mode_rect), refusal_inventory.rs (kept
9+only intra14's narrowed "an intra-coded 16x4/4x16 strip ..."), decode_probe.rs (both).
10+
11+## Fix applied this round
12+decode.rs `rect_inter_luma_set` + cdf_state.rs `TxbSet::LumaRect8x4Inter{,1}`: a SPLIT
13+16x4/4x16 inter strip resolves to an 8x4 leaf (`sub_tx_size_map[TX_16X4] == TX_8X4`,
14+oracle av1/common/common_data.h:180) and used to hit `unreachable!()`. Set = LumaRect4x8's
15+coefficient tables (Luma8 + 32-position eob_pt) with inter tx_type row TX_4X4
16+(`inter_tx_type_4` / `_set1`). `rect_inter_residual_supported` untouched — no refusal moved.
17+New diagnostic: `EC_SPLITSTRIP=1` prints mi_row/mi_col/bw/bh/depth at the counter bump.
18+
19+## Gate: RED, but FIRING for the first time
20+- 8-bit arm: 40/40 refusals (histogram in the r2 report), never fires.
21+- 10-bit arm: seed 74 / cq 12 / cpu-used 2 decodes all 8 frames, fires depth1=1, and
22+ MISMATCHES ffmpeg: frame 1 Y first diff (163, 58), 5203 samples; frames 2-7 ~24.5k.
23+- Stream pinned: `<scratchpad>/intrasplit/s74.obu`, md5 50ea2b42423f1c8b4eed9fa48c4775a6
24+ (192x128 yuv420p10le mandelbrot start_scale=3.08; full aomenc recipe = the gate's).
25+- The ONLY split strip in the stream is decode-order frame 1, mi(8,0), 32x16, depth 1
26+ (pixels x0..31 y32..47) and ITS OWN footprint is pixel-clean: raster first diff is the
27+ LAST block of the same 32-px block row. So the divergence is downstream of the strip.
28+- NOT yet done: the msac RANGE ladder. Our tags: EC_MODE / EC_MODE_VAL / EC_STACK
29+ (EC_TRACE_MODE=1, 338 lines). aomdec: EC_IMODE* (key frame) + EC_MODE* / EC_MODE_MV /
30+ EC_STACK (219 lines) — emitters do not line up 1:1; ledger says our EC_MODE_VAL rng is
31+ printed at libaom's EC_MODE_MV point, so compare VALUES on the mode ladder and use
32+ EC_TRACE_COEFF ranges for the coefficient ladder.
33+- Do NOT use `decode_probe -o` for 10-bit triage: it writes 8-bit samples.
34+
35+## Suite
36+385 passed / 3 failed / 35 ignored, 1082 s ($HOME/.cache/intrasplit-suite-r2.log).
37+2 = this lane's own arms. 1 = MERGE CROSS-PRODUCT, not this lane's code:
38+`a_real_aomenc_inter_sequence_with_16x16_level_1to4_partitions_decodes_pixel_exact`
39+(stream.rs:9167, frame 4 luma, attempt 1, 8-bit, arms [0,4,2,2]) — green on inter16ab's own
40+tip, red once r14 b86eb38 is in the same tree.
41+
42+## Film probes (merged tree, EC_AV1_FINAL_DUMP=1, 0 frames dumped both)
43+- 2160p10 HDR segment -ss 1200: now stops at "a split intra strip whose transform unit is
44+ 32x64" (was the non-skip rect-strip residual refusal at r1).
45+- 1080p10 segment -ss 1800: now stops at "a COMPOUND_WEDGE mask on a rectangular inter
46+ block" (was the intra 1:4 rect-strip refusal, lifted by lane-intra14).
47+
48+## Exact next step (r3)
49+1. Ladder s74.obu frame 1 from the strip at mi(8,0) forward: ours
50+ `EC_TRACE_COEFF=1 EC_SPLITSTRIP=1 decode_probe s74.obu` vs
51+ `EC_TRACE_COEFF=1 ~/.cache/aom-oracle/build/aomdec --rawvideo -o /dev/null s74.obu`;
52+ find the first element whose RANGE step differs, in the blocks AFTER the strip in that
53+ block row (target block x160..191, y32..63).
54+2. Prime suspects, in order: the strip's TXFM_CONTEXT bands written by r1's `set_txfm_ctxs`
55+ tail (wrong span/value would desync the NEXT block's tx_depth), the depth-1 sub-unit
56+ walk in `decode_rect_split` for a 32x16 strip at 10 bit, and the skip/txfm side maps the
57+ strip leaves behind (class new-map-ignores-tile-edge / early-return-skips-tail).
58+3. Then re-run BOTH gate arms + the inter16ab 1:4 gate above (sibling-gate rule).
lanes/intrasplit-r2.report.mdadded+104 -0
@@ -0,0 +1,104 @@
1+# lane-intrasplit r2 — RED (gate now FIRES at 10-bit and MISMATCHES; 8-bit arm still never fires)
2+
3+Base: 45bdc87 (r1) + main 48b35ab + lane-sqdrift 7d498c0 + lane-r14 b86eb38 +
4+lane-inter16ab 4811488 + lane-intra14 f4b5419 (live tips read with `git log`, NOT the
5+charter's stale `af7de9f`/`8313c4a`).
6+
7+## Merges (step 1)
8+- `git merge main` (48b35ab) — clean.
9+- `lane-sqdrift 7d498c0` — clean.
10+- `lane-r14 b86eb38` — conflict in `stream.rs`: git interleaved THREE different gates
11+ (the two no-CFL `uv_mode` gates from sqdrift/sbrect10 and r14's 64-axis 1:4 gate).
12+ Resolved by reconstructing each side's full test and keeping all three
13+ (`a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet`,
14+ `a_real_aomenc_square_only_inter_sequence_with_a_64x64_intra_superblock_decodes_pixel_exact`,
15+ `real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal`).
16+- `lane-inter16ab 4811488` — clean.
17+- `lane-intra14 f4b5419` — conflicts in `decode_probe.rs` (kept both counter blocks),
18+ `refusal_inventory.rs` (kept intra14's NARROWED "an intra-coded 16x4/4x16 strip on the
19+ inter block path"; dropped both main's broad 1:4 line and intra14's copy of THIS lane's
20+ lifted split-tx refusal) and `decode.rs` (kept both thread-locals; kept both the
21+ sbrect10 `is_cfl_allowed` narrowing and intra14's `INTRA_IN_INTER_MODE` skip/mode split
22+ in `read_intra_mode_rect`, in that order).
23+- `crates/ec-av1/src/cdf.rs` is byte-identical to main (`git diff main -- cdf.rs` = 0 lines).
24+
25+## Fix this round (the merge cross-product the ledger predicted)
26+`crates/ec-av1/src/decode.rs` `rect_inter_luma_set` + `crates/ec-av1/src/cdf_state.rs`
27+`TxbSet::LumaRect8x4Inter{,Inter1}` — with lane-r14's general `read_var_tx_size` in, a
28+SPLIT 16x4/4x16 inter strip resolves to an 8x4 leaf (`sub_tx_size_map[TX_16X4] == TX_8X4`,
29+oracle `av1/common/common_data.h:180`) and hit `unreachable!("rect_inter_residual_supported
30+gates every shape that reaches here")`. The new set is `LumaRect4x8`'s coefficient tables
31+(`get_txsize_entropy_ctx(TX_8X4)` = TX_8X8, 32-position `eob_pt`) with the INTER `tx_type`
32+row `txsize_sqr_map[TX_8X4]` = TX_4X4 (`inter_tx_type_4` / `_set1`). No refusal was lifted
33+by this: `rect_inter_residual_supported` (the BLOCK-footprint gate) is untouched.
34+
35+EVIDENCE: $HOME/.cache/intrasplit-gate-r2b.log | temporary `(w={w} h={h})` in the
36+unreachable, gate arm re-run | panic message `... (w=8 h=4)`.
37+
38+## Gate result: RED
39+`cargo test -p ec-av1 --lib -- --test-threads=1 split_transform_intra_strip`
40+- 8-bit arm: 40/40 attempts still stop at OTHER lanes' named refusals — histogram
41+ non-skip rect strip residual 14, inter SB-level AB 8, split intra strip w/ 64x32 unit 4,
42+ non-DC chroma on 8x8 inter leaf 4, inter partition below 8x8 4, 32x64 unit 2, Golomb
43+ tail 2, angle delta on 8x8 intra leaf 1, intra 16x4 inside a 16-level 1:4 partition 1.
44+- 10-bit arm: **one attempt (seed 74, cq 12, cpu 2) now decodes all 8 frames and FIRES**
45+ (`depth1=1`) — and MISMATCHES ffmpeg: frame 1 Y first diff at (163, 58), 5203 samples;
46+ frames 2-7 ~24.5k each (drift). This is the first time this lane's lifted path was ever
47+ pixel-compared on a real stream.
48+
49+EVIDENCE: $HOME/.cache/intrasplit-gate-r2.log | 2 arms x 40 attempts, merged tree | 8-bit
50+0 firing / 40 refusals; 10-bit 1 firing attempt, frame 1 Y 5203 samples wrong.
51+
52+### What is known about the 10-bit mismatch (r3 starts here)
53+Stream pinned: `<scratchpad>/intrasplit/s74.obu`, md5 `50ea2b42423f1c8b4eed9fa48c4775a6`
54+(192x128 yuv420p10le, mandelbrot start_scale 3.08, cq 12 cpu-used 2, recipe = the gate's).
55+- The ONLY split-transform intra strip in the whole 8-frame stream is in decode-order
56+ frame 1 at `mi_row=8 mi_col=0 bw=32 bh=16 depth=1` (pixels x 0..31, y 32..47) — new
57+ env-gated print `EC_SPLITSTRIP=1` (decode.rs, next to the counter bump).
58+- Its own footprint is pixel-CLEAN in frame 1 (raster first diff is at (163, 58), i.e. the
59+ LAST block of the same 32-px block row), so the strip's coefficients and prediction are
60+ right and the divergence is downstream of it — either a symbol this arm reads/does not
61+ read after the strip, or another shape's defect in that block row.
62+- Not yet done: the msac RANGE ladder vs the instrumented aomdec. Our tags for frame 1
63+ are `EC_MODE`/`EC_MODE_VAL`/`EC_STACK` (`EC_TRACE_MODE=1`, 338 lines for the stream);
64+ aomdec's are `EC_IMODE*` for the key frame and `EC_MODE*`/`EC_MODE_MV`/`EC_STACK`
65+ (219 lines) — the two emitters do NOT line up 1:1 and need reconciling before diffing
66+ (compare RANGE, never tell()).
67+- Do NOT triage this with the probe's `-o` dump: `decode_probe` writes 8-bit samples for a
68+ 10-bit stream, so a byte compare against aomdec's `--rawvideo` output is meaningless
69+ (frame 0 reads as 22667 "diffs" although the gate proves it exact).
70+
71+## Film probes
72+EVIDENCE: <scratchpad>/intrasplit/{reelb1200,reelc1800}.obu | `decode_probe` with
73+EC_AV1_FINAL_DUMP=1 on the merged tree | new stop strings:
74+- 2160p10 HDR AV1 film, -ss 1200: `a split intra strip whose transform unit is 32x64`
75+ (was "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual
76+ coding" at r1) — 0 frames dumped.
77+- 1080p10 AV1 film, -ss 1800: `a COMPOUND_WEDGE mask on a rectangular inter block (the
78+ wedge codebook is square-only)` (was "an intra-coded 1:4 (or other non-2:1) rect strip
79+ on the inter block path" at r1, lifted by lane-intra14) — 0 frames dumped.
80+
81+## Suite
82+See `$HOME/.cache/intrasplit-suite-r2.log` (unit `intrasplit-suite-r2-*`, MemoryMax=10G).
83+
84+## Residue
85+- fix-now (r3): the 10-bit seed-74 mismatch above — the lane's own gate finally fires and
86+ is red; the refusal must NOT be considered lifted until it is green.
87+- deferred(lane owning 64-axis luma tables): the "split intra strip whose transform unit is
88+ 64x32 / 32x64" refusals — now the FIRST blocker on the 2160p film segment.
89+- deferred(other lanes): the 8-bit arm cannot fire until the non-skip rect-strip residual,
90+ inter SB-level AB and sub-8x8 inter refusals are lifted (14+8+4 of 40 attempts).
91+
92+## Suite result (measured)
93+`cargo test -p ec-av1 --lib` under unit `intrasplit-suite-r2-1788330642`, MemoryMax=10G:
94+**385 passed, 3 failed, 35 ignored** in 1082 s (log `$HOME/.cache/intrasplit-suite-r2.log`).
95+- 2 failures are this lane's own gate arms (see above) — the lift is still UNGATED, so this
96+ branch MUST NOT merge as-is.
97+- 1 failure is a MERGE CROSS-PRODUCT (class `merge-cross-product-defect`), not this lane's
98+ code: `a_real_aomenc_inter_sequence_with_16x16_level_1to4_partitions_decodes_pixel_exact`
99+ (lane-inter16ab's gate) fails at `stream.rs:9167` — `frame 4 luma vs ffmpeg (attempt 1,
100+ 8-bit, arms [0, 4, 2, 2])`. It is green on lane-inter16ab's own tip 4811488 per that
101+ lane's report; it goes red once lane-r14 b86eb38 (general `read_var_tx_size`) and/or
102+ lane-intra14 f4b5419 are merged with it. `deferred(whoever merges r14+inter16ab into
103+ main)`: the same pair must be re-run there — the 8x4 luma set added this round is the
104+ first half of that interaction, the pixel mismatch on frame 4 is the second.
lanes/intrasplit-r3.report.mdadded+66 -0
@@ -0,0 +1,66 @@
1+# lane-intrasplit r3 report (branch lane-intrasplit, tip 50c43cd + this doc)
2+
3+## Verdict: GREEN — both gate arms pass, zero named refusals, both tx depths seen.
4+
5+## What changed (r3, commit 50c43cd)
6+- `crates/ec-av1/src/decode.rs:11587,11602` (`tx_size_context_txfm_rect`, `tx_size_context_txfm`) --
7+ ROOT CAUSE. These implement libaom `get_tx_size_context`
8+ (`~/.cache/aom-oracle/src/av1/common/pred_common.h:342-361`): when the above/left neighbour is an
9+ INTER block its BLOCK size, not its transform-context band, decides the `tx_depth` CDF row
10+ (`if (has_above) if (is_inter_block(above_mbmi)) above = block_size_wide[above_mbmi->bsize] >= max_tx_wide;`,
11+ pred_common.h:355-357, and the `left`/`block_size_high` twin at :359-361). Both of our copies
12+ indexed the `above_inter` / `left_inter` predicate bands as `mi_c / (SUB / MI)` / `mi_r / (SUB / MI)`,
13+ but those bands are mi-granular everywhere else they are written (`record_inter_rect_mi`) and read
14+ (`intra_inter_ctx`). The override therefore consulted a neighbour four mi columns/rows away, and at
15+ the first intra block to the right of an inter one it read `tx_depth` off ctx 0 where libaom has
16+ ctx 1 -- same decoded VALUE, different interval narrowing, so the tile desynced from there
17+ (class [[wrong-alphabet-same-value]] shape, via a mis-scaled index).
18+- `crates/ec-av1/src/decode.rs:6558` -- `EC_SPLITSTRIP` now prints EVERY intra strip with its depth,
19+ not only split ones: a source that codes no strip at all and one that codes only unsplit strips were
20+ indistinguishable through the old print.
21+- `crates/ec-av1/src/stream.rs:5536,5559,5648` -- gate geometry moved from 192x128 / min=max=32 to
22+ 96x96 / min 16 / max 64, cq floor 63 -> 4. With a CORRECT decode the old geometry contains ZERO intra
23+ strips in an inter frame; r1/r2's "firing" counters had been read off our own desynced decode
24+ (class [[counter-from-refused-stream]]).
25+
26+## Gates (this tree, EC_AV1_REQUIRE_AOMENC=1)
27+`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-intrasplit cargo test -p ec-av1 --lib -- --nocapture --test-threads=1 split_transform_intra_strip`
28+-> `test result: ok. 2 passed; 0 failed; 0 ignored`.
29+
30+EVIDENCE: $HOME/.cache/intrasplit-r3-gates.log:884-885 | 10-bit arm, 3 aomenc attempts (seeds 42-44, cq 30, cpu 0-2), each decoded and pixel-compared vs ffmpeg | buckets counted-exact=2 uncounted-exact=1 named-refusals=0; split strips seen depth1=1 depth2=3; 0 pixel diffs in any plane of any of 8 frames per attempt
31+EVIDENCE: $HOME/.cache/intrasplit-r3-gates.log:908-909 | 8-bit arm, 21 attempts (seeds 42-62, cq 30/20/12/4, cpu 0-4) | buckets counted-exact=6 uncounted-exact=15 named-refusals=0; split strips seen depth1=9 depth2=1; 0 pixel diffs
32+EVIDENCE: commit 50c43cd message | aomdec `EC_ISTEP name=tx_depth` ladder on the r2 pinned stream (10-bit 192x128, md5 50ea2b42423f1c8b4eed9fa48c4775a6) before vs after | 85/147 elements identical (first divergence mi(24,24) ctx 0 vs libaom 1) -> 147/147 identical, stream decodes pixel-exact
33+
34+The 15 "uncounted-exact" 8-bit attempts are decoded-and-pixel-compared attempts in which aomenc's RD
35+simply coded no split strip; they are never SKIPs and never mask a mismatch (the pixel asserts run on
36+every successful decode, class [[gate-skips-on-its-own-failure]]). Named refusals: 0 in both arms.
37+
38+## Sibling gate: inter16ab 16x16-level 1:4 -- RED, inherited, NOT this lane's
39+`a_real_aomenc_inter_sequence_with_16x16_level_1to4_partitions_decodes_pixel_exact` (stream.rs:8986)
40+fails on this tree exactly as r2 reported: attempt 1, 8-bit, arms [0,4,2,2], frame 4 = 25 luma pixels
41+differ first at (6,49) max |delta| 1; frame 5 = 14 pixels first at (3,48) max |delta| 1.
42+
43+EVIDENCE: $HOME/.cache/intrasplit-r3-gates.log:1795-1799 (tip 50c43cd) vs $HOME/.cache/intrasplit-r3-r2chk.log (detached worktree at r2 tip 5691e9a, own CARGO_TARGET_DIR) | ran the same gate on both commits | BIT-IDENTICAL failure: same frames, same 25/14 pixel counts, same (6,49)/(3,48) first-diff coordinates, same max |delta| 1 -- r3's fix neither caused nor moved it
44+EVIDENCE: $HOME/.cache/intrasplit-r3-mainchk.log (detached worktree at main cc323d0) | same filter | `0 passed; 0 failed; 418 filtered out` -- the gate does not exist on main: main merged lane-inter16ab at af7de9f, this gate arrived with that lane's LATER tip 4811488, which only this branch carries
45+
46+No msac RANGE ladder was run on it, deliberately: the entropy stream is provably in sync (frames 0-3
47+are bit-exact in all three planes and the decode completes) and a max |delta| of 1 over 39 pixels is a
48+RECONSTRUCTION-stage difference, not a desync -- a range ladder is the wrong instrument. The rows
49+(48, 49) sit on a 16-row boundary at low columns, so the first hypothesis for whoever owns it is the
50+lf-grid fill for a 16x16-level 1:4 partition's internal horizontal edge (r14's `fill_lf_grid_rect` /
51+(row,col,tw,th) var-tx leaves crossed with inter16ab's 1:4 arms) -- hypothesis, not a measurement.
52+
53+Disposition: deferred(the merge that lands lane-inter16ab tip 4811488 alongside lane-r14 b86eb38 --
54+class [[merge-cross-product-defect]]; neither parent alone is red, and neither the gate nor its
55+failure exists on main today).
56+
57+## Suite
58+`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-intrasplit cargo test -p ec-av1 --lib -j3`
59+-> **387 passed / 1 failed / 35 ignored**, 1460 s ($HOME/.cache/intrasplit-suite-r3.log). r2 was 385/3/35;
60+the two that flipped green are this lane's own gate arms. The single remaining failure is the inherited
61+1:4 cross-product above -- no other regression.
62+
63+## Residue
64+- The 1:4 cross-product above: deferred, owner = the merge, as stated.
65+- accepted: the 8-bit arm needs 21 attempts to see both depths; depth2 is rare at 96x96. Both depths
66+ ARE seen in pixel-exact attempts, which is what the gate asserts.