forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-kf900' (fc7fca2): an 8x8 intra leaf ignored the use_intrabc it had just read

Browse files at this commit

c1efa28f86ccb0f1832d2fa02a69e5f2d7653a62Ahmet Kaan GümüşParent: a2877a368ca7c5
crates/ec-av1/examples/decode_probe.rsmodified+1 -0
@@ -34,6 +34,7 @@ fn main() {
34 let (h, v, c) = ec_av1::stream::rect4_32_counters();34 let (h, v, c) = ec_av1::stream::rect4_32_counters();
35 println!("rect4_32: horz={h} vert={v} coded={c}");35 println!("rect4_32: horz={h} vert={v} coded={c}");
36 println!("rect_intrabc_reads: {}", ec_av1::stream::rect_intrabc_reads());36 println!("rect_intrabc_reads: {}", ec_av1::stream::rect_intrabc_reads());
37+ println!("leaf8_intrabc_hits: {}", ec_av1::stream::leaf8_intrabc_hits());
37 let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters();38 let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters();
38 println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}");39 println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}");
39 println!("sub8_inter_split: groups={}", ec_av1::decode::sub8_inter_split_hits());40 println!("sub8_inter_split: groups={}", ec_av1::decode::sub8_inter_split_hits());
crates/ec-av1/src/decode.rsmodified+102 -3
@@ -1715,6 +1715,22 @@ pub(crate) fn reset_rect_intrabc_reads() {
1715 RECT_INTRABC_READS.with(|c| c.set(0));1715 RECT_INTRABC_READS.with(|c| c.set(0));
1716 }1716 }
1717 1717
1718+thread_local! {
1719+ /// Blocks that USED intrabc at an 8x8 LEAF (`decode_leaf8`) specifically
1720+ /// -- the shape lane-kf900 r7 fixed; [`INTRABC_HITS`] counts every shape.
1721+ static LEAF8_INTRABC_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
1722+}
1723+
1724+/// Current value of [`LEAF8_INTRABC_HITS`].
1725+pub(crate) fn leaf8_intrabc_hits() -> usize {
1726+ LEAF8_INTRABC_HITS.with(|c| c.get())
1727+}
1728+
1729+/// Zeroes [`LEAF8_INTRABC_HITS`] (gate tests call this before a decode).
1730+pub(crate) fn reset_leaf8_intrabc_hits() {
1731+ LEAF8_INTRABC_HITS.with(|c| c.set(0));
1732+}
1733+
1718 /// Current value of [`INTRABC_HITS`].1734 /// Current value of [`INTRABC_HITS`].
1719 pub(crate) fn intrabc_hits() -> usize {1735 pub(crate) fn intrabc_hits() -> usize {
1720 INTRABC_HITS.with(|c| c.get())1736 INTRABC_HITS.with(|c| c.get())
@@ -3822,7 +3838,7 @@ fn read_coeffs(
3822 let t = dec.symbol(tx_type_cdf);3838 let t = dec.symbol(tx_type_cdf);
3823 if std::env::var_os("EC_TRACE_COEFF").is_some() {3839 if std::env::var_os("EC_TRACE_COEFF").is_some() {
3824 let (rng, _) = dec.debug_state();3840 let (rng, _) = dec.debug_state();
3825- eprintln!("EC_COEFF_STEP tag=tx_type rng={rng}");3841+ eprintln!("EC_COEFF_STEP tag=tx_type len={len} rng={rng}");
3826 }3842 }
3827 if std::env::var_os("EC_AV1_EOBPT_CDF").is_some() {3843 if std::env::var_os("EC_AV1_EOBPT_CDF").is_some() {
3828 let (range, value) = dec.debug_state();3844 let (range, value) = dec.debug_state();
@@ -10951,6 +10967,24 @@ fn decode_leaf8(
10951 leaf_mi.0,10967 leaf_mi.0,
10952 leaf_mi.1,10968 leaf_mi.1,
10953 )?;10969 )?;
10970+ // lane-kf900 r7: an 8x8 leaf consumed `use_intrabc` (and its DV) through
10971+ // `read_intra_mode` and then decoded the block as if it were ordinary
10972+ // intra. libaom's `is_inter_block` counts an intrabc block
10973+ // (`blockd.h:373`), so its luma `tx_type` comes off the INTER ext-tx set
10974+ // (`av1_get_ext_tx_set_type(TX_8X8, is_inter=1, 0)` = `EXT_TX_SET_ALL16`,
10975+ // a 16-symbol CDF) while we read the 7-symbol `TX_SET_INTRA_1` row: the
10976+ // same value with a different interval, so the tile desynced at the very
10977+ // next symbol (class `wrong-alphabet-same-value`). Everything below
10978+ // mirrors `decode_block`'s own intrabc handling at 16x16 and up.
10979+ let intrabc_dv = INTRABC_DV.with(|c| c.take());
10980+ if intrabc_dv.is_some() {
10981+ LEAF8_INTRABC_HITS.with(|c| c.set(c.get() + 1));
10982+ }
10983+ if intrabc_dv.is_some() && tx_select && !skip {
10984+ return Err(unsupported(
10985+ "an intrabc block under TxMode::Select (its transform size is coded by the inter var-tx partition tree, which this decoder never reads)",
10986+ ));
10987+ }
10954 let uv_predict_mode = if uv_mode == UV_CFL_PRED {10988 let uv_predict_mode = if uv_mode == UV_CFL_PRED {
10955 DC_PRED10989 DC_PRED
10956 } else {10990 } else {
@@ -10964,7 +10998,11 @@ fn decode_leaf8(
10964 // which splits the leaf's own 8x8 prediction into a 2x2 grid of 4x410998 // which splits the leaf's own 8x8 prediction into a 2x2 grid of 4x4
10965 // transform units, same raster-order per-TU pattern `decode_block`'s10999 // transform units, same raster-order per-TU pattern `decode_block`'s
10966 // multi-TU branch runs).11000 // multi-TU branch runs).
10967- let resolved = if tx_select {11001+ // ... and an intrabc leaf reads no intra `tx_depth` symbol at all: under
11002+ // `TX_MODE_SELECT` a skipped inter block takes the largest transform
11003+ // (`read_tx_size(.., is_inter=1, ..)`), and the unskipped case is refused
11004+ // above.
11005+ let resolved = if tx_select && intrabc_dv.is_none() {
10968 read_tx_size(dec, cdfs, neighbours, leaf_mi, 8, None)11006 read_tx_size(dec, cdfs, neighbours, leaf_mi, 8, None)
10969 } else {11007 } else {
10970 811008 8
@@ -10972,6 +11010,37 @@ fn decode_leaf8(
10972 let (px, py) = (leaf_mi.1 * MI, leaf_mi.0 * MI);11010 let (px, py) = (leaf_mi.1 * MI, leaf_mi.0 * MI);
10973 let reach = Reach::of(8, px, py, y.width, y.height);11011 let reach = Reach::of(8, px, py, y.width, y.height);
10974 let (cpx, cpy) = (px / 2, py / 2);11012 let (cpx, cpy) = (px / 2, py / 2);
11013+ // spec 7.11.3.4 with `use_intrabc`, same as `decode_block`: predict from
11014+ // the CURRENT frame's own pre-loop-filter reconstruction (every loop
11015+ // filter is off whenever `allow_intrabc`, frame.rs:194/210/252/272) at
11016+ // the full-pel block vector, with the BILINEAR kernel libaom forces.
11017+ let intrabc_bufs = intrabc_dv.map(|(dv_row, dv_col)| {
11018+ let mut yb = vec![0u16; 8 * 8];
11019+ mc::predict_with_filter(
11020+ &y.data, y.width, y.true_width, y.true_height,
11021+ mv_to_q4(px, dv_col, true), mv_to_q4(py, dv_row, true),
11022+ 8, 8, mc::InterpFilterKind::Bilinear, &mut yb,
11023+ );
11024+ let mut ub = vec![0u16; 4 * 4];
11025+ mc::predict_with_filter(
11026+ &u.data, u.width, u.true_width, u.true_height,
11027+ mv_to_q4(cpx, dv_col, false), mv_to_q4(cpy, dv_row, false),
11028+ 4, 4, mc::InterpFilterKind::Bilinear, &mut ub,
11029+ );
11030+ let mut vb = vec![0u16; 4 * 4];
11031+ mc::predict_with_filter(
11032+ &v.data, v.width, v.true_width, v.true_height,
11033+ mv_to_q4(cpx, dv_col, false), mv_to_q4(cpy, dv_row, false),
11034+ 4, 4, mc::InterpFilterKind::Bilinear, &mut vb,
11035+ );
11036+ (yb, ub, vb)
11037+ });
11038+ // The per-plane prediction override rides the same [`PALETTE_PRED`] slot
11039+ // `decode_block` uses: set fresh right before each plane's own
11040+ // `reconstruct`/`read_plane` call (the slot is taken, not copied).
11041+ if let Some((yb, _, _)) = &intrabc_bufs {
11042+ set_palette_pred(yb.clone());
11043+ }
10975 let (luma_grid, u_grid, v_grid);11044 let (luma_grid, u_grid, v_grid);
10976 if skip {11045 if skip {
10977 // lane-hgkf r2 (same shape as `decode_block`'s own skip branch): an11046 // lane-hgkf r2 (same shape as `decode_block`'s own skip branch): an
@@ -11028,6 +11097,9 @@ fn decode_leaf8(
11028 );11097 );
11029 }11098 }
11030 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, 8));11099 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, 8));
11100+ if let Some((_, ub, _)) = &intrabc_bufs {
11101+ set_palette_pred(ub.clone());
11102+ }
11031 u.reconstruct(11103 u.reconstruct(
11032 cpx,11104 cpx,
11033 cpy,11105 cpy,
@@ -11040,6 +11112,9 @@ fn decode_leaf8(
11040 None,11112 None,
11041 smooth_neighbor_uv,11113 smooth_neighbor_uv,
11042 );11114 );
11115+ if let Some((_, _, vb)) = &intrabc_bufs {
11116+ set_palette_pred(vb.clone());
11117+ }
11043 v.reconstruct(11118 v.reconstruct(
11044 cpx,11119 cpx,
11045 cpy,11120 cpy,
@@ -11060,7 +11135,9 @@ fn decode_leaf8(
11060 luma_grid = read_plane(11135 luma_grid = read_plane(
11061 dec,11136 dec,
11062 cdfs,11137 cdfs,
11063- if reduced_tx_set {11138+ if intrabc_dv.is_some() {
11139+ txbset_for_inter(8, reduced_tx_set)
11140+ } else if reduced_tx_set {
11064 TxbSet::Luma811141 TxbSet::Luma8
11065 } else {11142 } else {
11066 TxbSet::Luma8Set111143 TxbSet::Luma8Set1
@@ -11083,7 +11160,16 @@ fn decode_leaf8(
11083 None,11160 None,
11084 smooth_neighbor,11161 smooth_neighbor,
11085 )?;11162 )?;
11163+ // `av1_get_tx_type` branches `PLANE_TYPE_UV` on `is_inter_block`, so
11164+ // an intrabc block's chroma tx_type is the colocated LUMA transform's
11165+ // coded type (lane-kf900 r6's own fix, `decode_block`'s line).
11166+ if intrabc_dv.is_some() {
11167+ INTRABC_CHROMA_TX.with(|c| c.set(Some(LUMA_TX_TYPE.with(std::cell::Cell::get))));
11168+ }
11086 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, 8));11169 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, 8));
11170+ if let Some((_, ub, _)) = &intrabc_bufs {
11171+ set_palette_pred(ub.clone());
11172+ }
11087 u_grid = read_plane(11173 u_grid = read_plane(
11088 dec,11174 dec,
11089 cdfs,11175 cdfs,
@@ -11106,6 +11192,9 @@ fn decode_leaf8(
11106 None,11192 None,
11107 smooth_neighbor_uv,11193 smooth_neighbor_uv,
11108 )?;11194 )?;
11195+ if let Some((_, _, vb)) = &intrabc_bufs {
11196+ set_palette_pred(vb.clone());
11197+ }
11109 v_grid = read_plane(11198 v_grid = read_plane(
11110 dec,11199 dec,
11111 cdfs,11200 cdfs,
@@ -11128,6 +11217,11 @@ fn decode_leaf8(
11128 None,11217 None,
11129 smooth_neighbor_uv,11218 smooth_neighbor_uv,
11130 )?;11219 )?;
11220+ // Disarm: `INTRABC_CHROMA_TX` is `Some` across exactly this block's
11221+ // two chroma reads (`decode_block`'s own tail does the same) -- left
11222+ // set, every later chroma block would inherit this luma tx_type,
11223+ // which picks the scan and the inverse transform.
11224+ INTRABC_CHROMA_TX.with(|c| c.set(None));
11131 } else {11225 } else {
11132 // `tx_depth` resolved this leaf's luma to `TX4`: a 2x2 raster-order11226 // `tx_depth` resolved this leaf's luma to `TX4`: a 2x2 raster-order
11133 // grid of 4x4 transform units, each predicted from the leaf's own11227 // grid of 4x4 transform units, each predicted from the leaf's own
@@ -11278,6 +11372,7 @@ fn decode_leaf8(
11278 neighbours.fill_skip_grid(leaf_mi, 2, skip);11372 neighbours.fill_skip_grid(leaf_mi, 2, skip);
11279 neighbours.fill_lf_grid(leaf_mi, 2, 4, 0);11373 neighbours.fill_lf_grid(leaf_mi, 2, 4, 0);
11280 neighbours.record_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, mode);11374 neighbours.record_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, mode);
11375+ record_intrabc_mi(leaf_mi.0, leaf_mi.1, 2, intrabc_dv);
11281 return Ok(mode);11376 return Ok(mode);
11282 }11377 }
11283 neighbours.record_mi(leaf_mi, 8, &[luma_grid, u_grid, v_grid]);11378 neighbours.record_mi(leaf_mi, 8, &[luma_grid, u_grid, v_grid]);
@@ -11302,6 +11397,10 @@ fn decode_leaf8(
11302 // -ss 900, first bad luma sample row 186 col 1803).11397 // -ss 900, first bad luma sample row 186 col 1803).
11303 neighbours.fill_lf_grid(leaf_mi, 2, resolved as u8, 0);11398 neighbours.fill_lf_grid(leaf_mi, 2, resolved as u8, 0);
11304 neighbours.record_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, mode);11399 neighbours.record_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, mode);
11400+ // The DV predictor of a LATER intrabc block is the ordinary `INTRA_FRAME`
11401+ // MV stack over this grid (`av1_find_mv_refs`), so an 8x8 leaf has to
11402+ // publish its own cells exactly like `decode_block` does.
11403+ record_intrabc_mi(leaf_mi.0, leaf_mi.1, 2, intrabc_dv);
11305 Ok(mode)11404 Ok(mode)
11306 }11405 }
11307 11406
crates/ec-av1/src/stream.rsmodified+32 -1
@@ -116,6 +116,12 @@ pub fn sb128_rect_counters() -> (usize, usize, usize, usize) {
116 )116 )
117 }117 }
118 118
119+/// Blocks reconstructed with intra block copy at an 8x8 LEAF specifically
120+/// (lane-kf900 r7's shape); [`crate::decode::intrabc_hits`] counts every shape.
121+pub fn leaf8_intrabc_hits() -> usize {
122+ crate::decode::leaf8_intrabc_hits()
123+}
124+
119 pub fn rect4_32_counters() -> (usize, usize, usize) {125 pub fn rect4_32_counters() -> (usize, usize, usize) {
120 (126 (
121 crate::decode::rect4_32_horz_hits(),127 crate::decode::rect4_32_horz_hits(),
@@ -2875,7 +2881,7 @@ mod tests {
2875 const SB: &str = "smptebars=size=256x192:rate=25";2881 const SB: &str = "smptebars=size=256x192:rate=25";
2876 // (arm, source, per-arm overrides AFTER the base recipe, expect_refusal,2882 // (arm, source, per-arm overrides AFTER the base recipe, expect_refusal,
2877 // must_read_use_intrabc_on_a_rect_strip)2883 // must_read_use_intrabc_on_a_rect_strip)
2878- let arms: [(&str, &str, &[&str], bool, bool); 7] = [2884+ let arms: [(&str, &str, &[&str], bool, bool); 8] = [
2879 ("testsrc2-cq50-txs0", TS, &["--cq-level=50", "--enable-palette=0", "--enable-tx-size-search=0"], true, true),2885 ("testsrc2-cq50-txs0", TS, &["--cq-level=50", "--enable-palette=0", "--enable-tx-size-search=0"], true, true),
2880 ("smptebars-cq40-txs0", SB, &["--cq-level=40", "--enable-palette=0", "--enable-tx-size-search=0"], false, false),2886 ("smptebars-cq40-txs0", SB, &["--cq-level=40", "--enable-palette=0", "--enable-tx-size-search=0"], false, false),
2881 ("smptebars-cq45-txs0", SB, &["--cq-level=45", "--enable-palette=0", "--enable-tx-size-search=0"], false, true),2887 ("smptebars-cq45-txs0", SB, &["--cq-level=45", "--enable-palette=0", "--enable-tx-size-search=0"], false, true),
@@ -2883,10 +2889,17 @@ mod tests {
2883 ("smptebars-cq50-txs1", SB, &["--cq-level=50", "--enable-palette=0", "--enable-tx-size-search=1"], false, false),2889 ("smptebars-cq50-txs1", SB, &["--cq-level=50", "--enable-palette=0", "--enable-tx-size-search=1"], false, false),
2884 ("smptebars-cq55-txs0", SB, &["--cq-level=55", "--enable-palette=0", "--enable-tx-size-search=0"], false, false),2890 ("smptebars-cq55-txs0", SB, &["--cq-level=55", "--enable-palette=0", "--enable-tx-size-search=0"], false, false),
2885 ("testsrc2-cq63-txs1", TS, &["--cq-level=63", "--enable-palette=0", "--enable-tx-size-search=1"], false, false),2891 ("testsrc2-cq63-txs1", TS, &["--cq-level=63", "--enable-palette=0", "--enable-tx-size-search=1"], false, false),
2892+ // lane-kf900 r7: the 8x8-LEAF intrabc arm. Rect and 1:4
2893+ // partitions off (so no rect strip refuses first), palette on,
2894+ // `TxMode::Largest`: aomenc puts exactly one `use_intrabc` block
2895+ // on a `BLOCK_8X8` leaf here, the shape `decode_leaf8` decoded as
2896+ // ordinary intra before this round.
2897+ ("testsrc2-cq55-leaf8", TS, &["--cq-level=55", "--enable-palette=1", "--enable-tx-size-search=0", "--enable-rect-partitions=0", "--enable-1to4-partitions=0"], false, false),
2886 ];2898 ];
2887 let (mut reads_total, mut refused, mut frames_compared) = (0usize, 0u32, 0usize);2899 let (mut reads_total, mut refused, mut frames_compared) = (0usize, 0u32, 0usize);
2888 let (mut blocks_total, mut fired_arms, mut out_of_scope, mut out_of_scope_mismatch) =2900 let (mut blocks_total, mut fired_arms, mut out_of_scope, mut out_of_scope_mismatch) =
2889 (0usize, 0u32, 0u32, 0u32);2901 (0usize, 0u32, 0u32, 0u32);
2902+ let mut leaf8_total = 0usize;
2890 for (arm, src, extra, expect_refusal, must_read) in &arms {2903 for (arm, src, extra, expect_refusal, must_read) in &arms {
2891 let render = || {2904 let render = || {
2892 let out = Command::new("ffmpeg")2905 let out = Command::new("ffmpeg")
@@ -2958,6 +2971,7 @@ mod tests {
2958 let stream = out.stdout;2971 let stream = out.stdout;
2959 decode::reset_rect_intrabc_reads();2972 decode::reset_rect_intrabc_reads();
2960 crate::decode::reset_intrabc_hits();2973 crate::decode::reset_intrabc_hits();
2974+ crate::decode::reset_leaf8_intrabc_hits();
2961 let decoded = decode_stream(&stream);2975 let decoded = decode_stream(&stream);
2962 let reads = decode::rect_intrabc_reads();2976 let reads = decode::rect_intrabc_reads();
2963 // Blocks that decoded `use_intrabc == 1` (square path), i.e. that2977 // Blocks that decoded `use_intrabc == 1` (square path), i.e. that
@@ -2966,6 +2980,18 @@ mod tests {
2966 let blocks = crate::decode::intrabc_hits();2980 let blocks = crate::decode::intrabc_hits();
2967 reads_total += reads;2981 reads_total += reads;
2968 blocks_total += blocks;2982 blocks_total += blocks;
2983+ // The 8x8-leaf shape has its own counter: without it this gate's
2984+ // other arms (all rect/32x32 intrabc) would stay green while the
2985+ // leaf path decoded an intrabc block as ordinary intra (class
2986+ // `gate-blind-to-feature`).
2987+ let leaf8 = crate::decode::leaf8_intrabc_hits();
2988+ leaf8_total += leaf8;
2989+ if *arm == "testsrc2-cq55-leaf8" {
2990+ assert!(
2991+ leaf8 > 0,
2992+ "{NAME}: {arm} decoded no intrabc block at an 8x8 leaf -- the arm no longer exercises `decode_leaf8`'s intrabc path"
2993+ );
2994+ }
2969 if *must_read {2995 if *must_read {
2970 assert!(2996 assert!(
2971 reads > 0,2997 reads > 0,
@@ -3036,7 +3062,12 @@ mod tests {
3036 {refused} refused by name, {frames_compared} frames compared, \3062 {refused} refused by name, {frames_compared} frames compared, \
3037 {out_of_scope} out of scope ({out_of_scope_mismatch} mismatched)"3063 {out_of_scope} out of scope ({out_of_scope_mismatch} mismatched)"
3038 );3064 );
3065+ eprintln!("{NAME}: {leaf8_total} intrabc block(s) at an 8x8 leaf");
3039 assert!(reads_total > 0, "{NAME}: gate is vacuous -- no arm read the symbol");3066 assert!(reads_total > 0, "{NAME}: gate is vacuous -- no arm read the symbol");
3067+ assert!(
3068+ leaf8_total > 0,
3069+ "{NAME}: no arm decoded an intrabc block at an 8x8 leaf -- lane-kf900 r7's fix is untested"
3070+ );
3040 assert!(3071 assert!(
3041 blocks_total > 0 && fired_arms > 0,3072 blocks_total > 0 && fired_arms > 0,
3042 "{NAME}: gate is vacuous -- no compared arm actually decoded an intrabc block"3073 "{NAME}: gate is vacuous -- no compared arm actually decoded an intrabc block"
lanes/kf900-r7.handoff.mdadded+67 -0
@@ -0,0 +1,67 @@
1+# lane-kf900 r7 HANDOFF -- 8x8-leaf intrabc decoded as ordinary intra
2+
3+## Merge state
4+`git merge --no-commit main` (main `3566501`) auto-merged clean (decode.rs, stream.rs,
5+gate_coverage.rs), committed as `6c22a5f`. The r6 palette-at-mi-granularity hunks and the
6+intrabc chroma tx_type fix survive untouched (Neighbours palette fns re-read after the merge).
7+
8+## Root cause of the r6 "last superblock" residue (found, fixed)
9+Stream `$HOME/.cache/kf900-r6/DIFF_55_0_1_test.obu` (testsrc2 256x192 cq55 txs=0 palette=1
10+screen 8-bit). The r6 report's "entropy stays in sync, reconstruction defect, deltas ~4" was
11+WRONG on both counts: deltas run to +-171 and it is an ENTROPY desync -- invisible because the
12+bad block sits in the LAST superblock, so nothing after it could disagree.
13+
14+* Stage: mode info -> first coefficient TU. Cross-decoder `EC_TRACE_MODE_STEP` ladder diverges
15+ at mi(34,52) (luma 136,208): both decoders read skip/cdef/dq at rng=42705, then the next
16+ block starts at oracle rng=52073 vs ours 33144.
17+* Block: an 8x8 **leaf** (`decode_leaf8`) that decoded `use_intrabc=1`, DV `(-512,-1360)`
18+ (identical on both sides -- `EC_TRACE_IBC`, so the DV read is exonerated for the 3rd time).
19+* Element: the luma `tx_type`. `EC_TRACE_COEFF` (our trace now prints the CDF width, `len=`):
20+ ours read an 8-slot row (`TX_SET_INTRA_1`, 7 symbols), libaom reads
21+ `av1_get_ext_tx_set_type(TX_8X8, is_inter=1, 0)` = `EXT_TX_SET_ALL16` (16 symbols), because
22+ `is_inter_block(mbmi)` counts `is_intrabc_block` (`av1/common/blockd.h:373`, set chooser
23+ `av1/common/blockd.h` `av1_get_tx_type`). Same value, different interval -- class
24+ `wrong-alphabet-same-value`.
25+* Why only there: `decode_leaf8` consumed `use_intrabc` + the DV through `read_intra_mode` and
26+ then ignored the result entirely -- no inter ext-tx set, no chroma tx_type inheritance, no
27+ prediction from the current frame, no `record_intrabc_mi`. `decode_block` (16x16 and up) had
28+ all four since r6.
29+
30+## Fix (crates/ec-av1/src/decode.rs, `decode_leaf8`)
31+1. take `INTRABC_DV`; refuse under `TxMode::Select && !skip` with `decode_block`'s EXISTING
32+ refusal string (no new inventory entry); a skipped intrabc leaf reads no intra `tx_depth`.
33+2. luma set `txbset_for_inter(8, reduced_tx_set)`.
34+3. BILINEAR prediction from the current frame at the DV (8x8 luma, 4x4 chroma) through the
35+ `PALETTE_PRED` override slot, in both the skip and non-skip branches.
36+4. `INTRABC_CHROMA_TX` armed after the luma read and **disarmed** after the V read (leaving it
37+ armed leaked the luma tx_type into every later chroma block: 320 chroma samples wrong,
38+ luma exact -- second bug, found by re-measuring).
39+5. `record_intrabc_mi(leaf_mi, 2, intrabc_dv)` on both exits (a later DV's MV stack).
40+Plus counter `LEAF8_INTRABC_HITS` + `stream::leaf8_intrabc_hits()` + a `decode_probe` line.
41+
42+Measured, 8-bit `$HOME/.cache/kf900-r7/S_DIFF_test_55_r0_d8.obu` (same source/cq, rect+1:4 off
43+so no rect-strip refusal fires first): before 320 chroma samples wrong / entropy desync at the
44+leaf; after **0 bytes differ vs ffmpeg** (`cmp -l` = 0), `leaf8_intrabc_hits=1`, and the
45+`all_zero`/`eob` range ladder is identical for all 499 steps.
46+The ORIGINAL r6 stream now stops earlier at the pre-existing named refusal
47+"intra block copy on a HORZ/VERT/1:4 rect intra strip" instead of decoding wrong pixels.
48+
49+## Gate state
50+`a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` gained arm 8
51+`testsrc2-cq55-leaf8` (`--cq-level=55 --enable-palette=1 --enable-tx-size-search=0
52+--enable-rect-partitions=0 --enable-1to4-partitions=0` after the base recipe), a hard per-arm
53+`leaf8 > 0` assert and a gate-wide `leaf8_total > 0` vacuity assert.
54+`cargo test -p ec-av1 --lib -j3 -- intrabc palette --nocapture` = **8 passed, 0 failed** (45s).
55+
56+## Exact next steps
57+1. FULL SUITE NOT RUN this round (turn cap). Run:
58+ `systemd-run --user --unit=kf900-suite-r7-$(date +%s) -p MemoryMax=10G --same-dir bash -lc
59+ 'EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-kf900
60+ nice -n 10 cargo test -p ec-av1 --lib -j3 > $HOME/.cache/kf900-suite-r7.log 2>&1'`
61+ then `grep -E "^test result|FAILED" $HOME/.cache/kf900-suite-r7.log`. r6 baseline 385/0/33.
62+2. 10-bit leaf8 arm: the r7 sweep (`$HOME/.cache/kf900-r7/sweep.sh`, 3 sources x 5 cq x rect
63+ on/off x 8/10 bit) produced NO decoding 10-bit stream at all (every 10-bit arm refuses on
64+ another lane's gap), so the 8x8-leaf intrabc fix is 8-bit-proven only. Widen the sweep
65+ (other sources / `--max-partition-size=16`) or wait for the sibling lanes.
66+3. Still open (unchanged from r6): rect-strip intrabc reconstruction refusal -- now the FIRST
67+ thing `DIFF_55_0_1_test.obu` hits; porting BILINEAR prediction at rect shapes closes it.