# lane-kf900 r7 HANDOFF -- 8x8-leaf intrabc decoded as ordinary intra ## Merge state `git merge --no-commit main` (main `3566501`) auto-merged clean (decode.rs, stream.rs, gate_coverage.rs), committed as `6c22a5f`. The r6 palette-at-mi-granularity hunks and the intrabc chroma tx_type fix survive untouched (Neighbours palette fns re-read after the merge). ## Root cause of the r6 "last superblock" residue (found, fixed) Stream `$HOME/.cache/kf900-r6/DIFF_55_0_1_test.obu` (testsrc2 256x192 cq55 txs=0 palette=1 screen 8-bit). The r6 report's "entropy stays in sync, reconstruction defect, deltas ~4" was WRONG on both counts: deltas run to +-171 and it is an ENTROPY desync -- invisible because the bad block sits in the LAST superblock, so nothing after it could disagree. * Stage: mode info -> first coefficient TU. Cross-decoder `EC_TRACE_MODE_STEP` ladder diverges at mi(34,52) (luma 136,208): both decoders read skip/cdef/dq at rng=42705, then the next block starts at oracle rng=52073 vs ours 33144. * Block: an 8x8 **leaf** (`decode_leaf8`) that decoded `use_intrabc=1`, DV `(-512,-1360)` (identical on both sides -- `EC_TRACE_IBC`, so the DV read is exonerated for the 3rd time). * Element: the luma `tx_type`. `EC_TRACE_COEFF` (our trace now prints the CDF width, `len=`): ours read an 8-slot row (`TX_SET_INTRA_1`, 7 symbols), libaom reads `av1_get_ext_tx_set_type(TX_8X8, is_inter=1, 0)` = `EXT_TX_SET_ALL16` (16 symbols), because `is_inter_block(mbmi)` counts `is_intrabc_block` (`av1/common/blockd.h:373`, set chooser `av1/common/blockd.h` `av1_get_tx_type`). Same value, different interval -- class `wrong-alphabet-same-value`. * Why only there: `decode_leaf8` consumed `use_intrabc` + the DV through `read_intra_mode` and then ignored the result entirely -- no inter ext-tx set, no chroma tx_type inheritance, no prediction from the current frame, no `record_intrabc_mi`. `decode_block` (16x16 and up) had all four since r6. ## Fix (crates/ec-av1/src/decode.rs, `decode_leaf8`) 1. take `INTRABC_DV`; refuse under `TxMode::Select && !skip` with `decode_block`'s EXISTING refusal string (no new inventory entry); a skipped intrabc leaf reads no intra `tx_depth`. 2. luma set `txbset_for_inter(8, reduced_tx_set)`. 3. BILINEAR prediction from the current frame at the DV (8x8 luma, 4x4 chroma) through the `PALETTE_PRED` override slot, in both the skip and non-skip branches. 4. `INTRABC_CHROMA_TX` armed after the luma read and **disarmed** after the V read (leaving it armed leaked the luma tx_type into every later chroma block: 320 chroma samples wrong, luma exact -- second bug, found by re-measuring). 5. `record_intrabc_mi(leaf_mi, 2, intrabc_dv)` on both exits (a later DV's MV stack). Plus counter `LEAF8_INTRABC_HITS` + `stream::leaf8_intrabc_hits()` + a `decode_probe` line. Measured, 8-bit `$HOME/.cache/kf900-r7/S_DIFF_test_55_r0_d8.obu` (same source/cq, rect+1:4 off so no rect-strip refusal fires first): before 320 chroma samples wrong / entropy desync at the leaf; after **0 bytes differ vs ffmpeg** (`cmp -l` = 0), `leaf8_intrabc_hits=1`, and the `all_zero`/`eob` range ladder is identical for all 499 steps. The ORIGINAL r6 stream now stops earlier at the pre-existing named refusal "intra block copy on a HORZ/VERT/1:4 rect intra strip" instead of decoding wrong pixels. ## Gate state `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` gained arm 8 `testsrc2-cq55-leaf8` (`--cq-level=55 --enable-palette=1 --enable-tx-size-search=0 --enable-rect-partitions=0 --enable-1to4-partitions=0` after the base recipe), a hard per-arm `leaf8 > 0` assert and a gate-wide `leaf8_total > 0` vacuity assert. `cargo test -p ec-av1 --lib -j3 -- intrabc palette --nocapture` = **8 passed, 0 failed** (45s). ## Exact next steps 1. FULL SUITE NOT RUN this round (turn cap). Run: `systemd-run --user --unit=kf900-suite-r7-$(date +%s) -p MemoryMax=10G --same-dir bash -lc 'EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-kf900 nice -n 10 cargo test -p ec-av1 --lib -j3 > $HOME/.cache/kf900-suite-r7.log 2>&1'` then `grep -E "^test result|FAILED" $HOME/.cache/kf900-suite-r7.log`. r6 baseline 385/0/33. 2. 10-bit leaf8 arm: the r7 sweep (`$HOME/.cache/kf900-r7/sweep.sh`, 3 sources x 5 cq x rect on/off x 8/10 bit) produced NO decoding 10-bit stream at all (every 10-bit arm refuses on another lane's gap), so the 8x8-leaf intrabc fix is 8-bit-proven only. Widen the sweep (other sources / `--max-partition-size=16`) or wait for the sibling lanes. 3. Still open (unchanged from r6): rect-strip intrabc reconstruction refusal -- now the FIRST thing `DIFF_55_0_1_test.obu` hits; porting BILINEAR prediction at rect shapes closes it.