# lane-kf900 r6 report -- intrabc chroma tx_type was derived as intra, not inherited from luma Tip on `lane-kf900` (parent `cbfe32d`). GREEN for defect A. Defect B root-caused, NOT fixed (deferred with the exact cause below). ## The charter's premise for defect A was stale -- measured, not assumed The charter said `read_intrabc_dv` desyncs at the square 16x16 intrabc block mi(32,44) of `b.obu`. It does not. The oracle carries an `EC_TRACE_IBC` rung inside `read_intrabc_info` (`~/.cache/aom-oracle/src/av1/decoder/decodemv.c:752`) and prints, for the ONE intrabc block in that stream: ``` EC_IBC mi_row=32 mi_col=44 bsize=6 skip=0 nstack=0 nearest=(0,0) near=(0,0) dv_ref=(-512,0) dv=(-512,-608) ``` Ours (`EC_AV1_TRACE=1`) printed `TRACE intrabc dv=(-512, -608)` -- bit-identical, including the `av1_find_ref_dv` fallback branch (`mvref_common.h:267`: `mi_row - mib_size < tile->mi_row_start` picks the `(0, -(MI_SIZE*mib_size + 256))` column form, else the `(-MI_SIZE*mib_size, 0)` row form). Note also that a wrong DV predictor CANNOT desync anything: `read_mv` reads joint + components before adding `ref`, so the predictor only moves the reconstructed vector. ## Defect A -- root cause (cited) Cross-decoder coefficient ladder (`EC_TRACE_COEFF` both sides, compare `rng` not `tell`): ``` plane=0 all_zero ctx=0 rng=40876 both (the intrabc block's luma TU) plane=0 eob=16 rng=40712 both ours: tx=VDct class=vert plane=0 after_bases rng=58543 both plane=1 all_zero ctx=7 rng=63400 both (chroma U) plane=1 eob ref eob=8 rng=65032 ours eob=5 rng=37532 <-- first divergence ``` Luma coded `V_DCT`. libaom `av1_get_tx_type` (`av1/common/blockd.h`) branches `PLANE_TYPE_UV` on `is_inter_block(mbmi)`, and `is_inter_block` counts `is_intrabc_block` (`blockd.h:373`), so an intrabc block's CHROMA `tx_type` is the colocated LUMA transform's coded type (`mbmi->txk_type[...]`), never `intra_mode_to_tx_type` of the chroma mode. We took the intra rule and got `DCT_DCT`, i.e. `TX_CLASS_2D` where libaom had `TX_CLASS_VERT` -- which changes `eob_multi_ctx` (0 vs 1), the scan order and every nz context. The chroma coefficients desynced at the first `eob` symbol of the first intrabc block and the rest of the tile was garbage. This is the same rule `read_inter_plane` already implements for ordinary inter blocks (`inherited_luma_tx_type`, `decode.rs:15475`); the intrabc path is an intra-side reader, so it never went through it. Class sweep: `read_inter_plane` (inter) and this site (intrabc) are the only two inter-typed chroma reads -- rect-strip and sub-8x8 intrabc still refuse by name, so no third site exists. ## Changes (defect A) | path | why | | --- | --- | | `crates/ec-av1/src/decode.rs` thread-locals `LUMA_TX_TYPE` / `INTRABC_CHROMA_TX` (next to `INTRABC_HITS`) | the luma `read_plane` does not return its coded `tx_type`; same off-stack idiom as `INTRABC_DV`/`PALETTE_PRED` | | `crates/ec-av1/src/decode.rs` `read_plane` `default_tx_type` | chroma inherits the luma type while `INTRABC_CHROMA_TX` is armed; the pre-existing `side >= 32` arm is already libaom's `EXT_TX_SET_DCTONLY` clamp, matching `read_inter_plane`'s own `side < 32` guard | | `crates/ec-av1/src/decode.rs` `read_plane` after `read_coeffs` | records the plane-0 coded `tx_type` | | `crates/ec-av1/src/decode.rs` `decode_block`, `logical_tx == side` branch | arms `INTRABC_CHROMA_TX` for exactly this block's two chroma reads and clears it after V (no leak into the next block) | | `crates/ec-av1/src/stream.rs` `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` | 3 arms -> 7, `--enable-intrabc=1` spelled in the base recipe, every frame of every decoding arm compared, per-arm `intrabc_hits` counter, out-of-scope accounting | | `crates/ec-av1/src/gate_coverage.rs` | `enable-intrabc` removed from the 8-bit `NEVER_EXERCISED` and never-on lists (its stated premise is disproven); the 10-bit hole entry stays | ## Gate ``` cargo test -p ec-av1 --lib a_real_aomenc_screen_key_frame_reads_use_intrabc -- --nocapture ``` ``` testsrc2-cq50-txs0 REFUSED (expected): intra block copy on a HORZ/VERT/1:4 rect intra strip smptebars-cq40-txs0 1 frame(s), 41 rect use_intrabc reads, 1 intrabc block(s), exact=true smptebars-cq45-txs0 1 frame(s), 35 rect use_intrabc reads, 1 intrabc block(s), exact=true smptebars-cq45-txs1 1 frame(s), 0 reads, 0 intrabc block(s), exact=true smptebars-cq50-txs1 1 frame(s), 0 reads, 0 intrabc block(s), exact=true smptebars-cq55-txs0 1 frame(s), 31 rect use_intrabc reads, 1 intrabc block(s), exact=true testsrc2-cq63-txs1 1 frame(s), 0 reads, 0 intrabc block(s), exact=true 185 rect-strip use_intrabc symbol(s) read, 4 intrabc block(s) decoded across 3 arm(s), 1 refused by name, 6 frames compared, 3 out of scope (0 mismatched) -> 1 passed ``` `gate_coverage` (9 tests) green. No refusal string was lifted this round, so `refusal_inventory.rs` is unchanged (47 entries): rect-strip intrabc reconstruction and "intrabc under TxMode::Select" both still stand, and the gate proves the first one still fires. ## Defect B -- root-caused, NOT fixed Stream: `testsrc2=s=256x192:r=25`, cq45 cpu-used 0, `--tune-content=screen --enable-palette=1 --enable-tx-size-search=1 --enable-intrabc=1` (saved `$HOME/.cache/kf900-r6/DIFF_45_1_1_test.obu`). Order question in the charter, answered from the source: `parse_decode_block` (`av1/decoder/decodeframe.c:1158` then `:1176`) calls `av1_visit_palette(..., av1_decode_palette_tokens)` BEFORE `read_tx_size`. Our rect reader already has that order -- it is not the defect. The ladder is exact through mi(0,8) `angle_uv` (rng 42372 both). The block is a 32x8 rect strip with a Y palette. The first colour-index-map symbol is then read at rng **34824** (oracle) vs **51354** (ours), i.e. the divergence is inside `read_palette_mode_info`. Our `read_palette_colors_y`/`_uv` match `decodemv.c` line for line (delta `+1` on Y only, telescoped `range`, the `AOMMIN(bits, ceil_log2(range))` adaptation, the V delta/raw branch) -- so the differing quantity is the COLOUR CACHE size, i.e. the neighbour palette. Root cause: `Neighbours::{above,left}_palette_{size,colors}` are indexed on the **16-px SUB grid** (`decode.rs:4029-4034`), while libaom keeps `palette_size` per 4-px mi cell. The already-documented corner-cut in `record_palette_y_rect` ("safe today because every sub-16 leaf path refuses palette outright") is no longer true: this frame codes 16x8 rect strips WITH palettes. For mi(0,8) libaom's `xd->left_mbmi` is mi(0,7) = the 16x8 block at mi(0,4), palette size 3; our `left_palette_size[0]` had already been overwritten by mi(2,4) (palette size 2, same 16-px cell), so we read 2 cache bits where libaom read 3 and the arithmetic decoder desynced there. `deferred: defect B (palette colour cache at sub-16 granularity) -- the fix is the corner-cut's own stated upgrade path, widening the four Y and four UV palette neighbour arrays from SUB to mi granularity and passing the block's real mi position from all ~8 record/lookup call sites -- unblocked by nothing but budget; a fresh round can start straight at decode.rs:3863-3943, 4010-4045, 4118-4175, 4348-4351, 5806-5817.` ## EVIDENCE * `EVIDENCE: $HOME/.cache/kf900-r5/{b.obu,b2.yuv,b2_ref.yuv} | decode_probe vs ffmpeg -i on the same bytes, before/after the chroma-inheritance fix | before: OK + wrong pixels; after: cmp reports the 73728-byte frame identical (PIXEL_EXACT)` * `EVIDENCE: $HOME/.cache/kf900-r5/{co.txt,cr.txt} | EC_TRACE_COEFF ladder both decoders on b.obu | luma exact through after_bases rng=58543, first divergence at the chroma eob: ref 65032 (eob 8) vs ours 37532 (eob 5)` * `EVIDENCE: oracle EC_TRACE_IBC on $HOME/.cache/kf900-r5/b.obu vs our EC_AV1_TRACE | one intrabc block, mi(32,44) | dv=(-512,-608) identical -- the chartered DV defect does not exist` * `EVIDENCE: $HOME/.cache/kf900-r6/{all_o.txt,all_r.txt} | EC_TRACE_MODE_STEP + EC_TRACE_PALETTE both decoders on DIFF_45_1_1_test.obu | exact to mi(0,8) angle_uv rng=42372, palette map starts at 34824 (ref) vs 51354 (ours)` * `EVIDENCE: $HOME/.cache/kf900-r6/sweep.log | 32-point aomenc sweep (2 sources x cq40/45/50/55 x txs x palette, --enable-intrabc=1) decoded and cmp'd against ffmpeg | every pal=0 arm that decodes is EXACT; the 5 remaining DIFF arms are all pal=1`