# lane-kf900 r5 report -- rect intra strips never read `use_intrabc` Tip `a7113f5` on `lane-kf900` (parent `9a01750`). GREEN. ## Defect (chartered) and root cause The chartered stream -- 8-bit `testsrc2=s=256x192:r=25`, cq59 cpu-used 0, rect + 1:4 partitions, `--tune-content=screen --enable-palette=1 --sb-size=64` -- decoded `OK` (`rect4_32: horz=8 vert=8`) and every luma sample of frame 0 differed from ffmpeg. `--tune-content=screen` sets `allow_screen_content_tools`, and the key-frame header then sets **`allow_intrabc = 1`**. `av1_allow_intrabc` is a FRAME-level test (libaom `decodemv.c:892`, `read_intra_frame_mode_info`): every intra block reads a `use_intrabc` symbol after `skip`/`cdef`/`delta_q` and before `mbmi->mode`, with **no block-shape term**. `read_intra_mode` (square leaf) and `read_intra_mode_sub8` both read it; `read_intra_mode_rect` -- the reader for EVERY HORZ/VERT/1:4 rect strip -- did not. The arithmetic decoder therefore desynced at the first mode symbol of the first rect block of the frame, i.e. at mi(0,0), and every later symbol and pixel was garbage. Decisive measurement (cross-decoder range ladder, `EC_TRACE_MODE_STEP` both sides): ``` ref EC_ISTEP mi_row=0 mi_col=0 name=skip rng=32874 ours ... rng=32874 (identical) ref EC_ISTEP mi_row=0 mi_col=0 name=mode rng=58628 ours ... rng=62696 (diverged) ``` 62696 is exactly `kf_y_mode[0][0]` symbol 0 from 32874. 58628 is that same read after ONE default `intrabc` symbol was consumed first (32874 -> 30694 -> normalised 61388 -> 58628), computed by hand from `od_ec_decode_cdf_q15` (`aom_dsp/entdec.c`) with `default_intrabc_cdf = AOM_CDF2(30531)`. That is the missing symbol, not a table row. ## Changes | path | why | | --- | --- | | `crates/ec-av1/src/decode.rs` `allow_intrabc_frame()` (new, next to `intrabc_hits`) | `INTRABC_MI_GRID` is `Some` exactly when the frame header set `allow_intrabc`, so the flag reaches the rect reader with no new plumbing through 5 functions | | `crates/ec-av1/src/decode.rs` `read_intra_mode_rect`, right after `istep!("dq", 0)` | reads `use_intrabc`; refuses by name when it fires (rect intrabc reconstruction is not ported); bumps `RECT_INTRABC_READS` | | `crates/ec-av1/src/decode.rs` `RECT_INTRABC_READS` + `rect_intrabc_reads()` / `reset_rect_intrabc_reads()` | gate hit counter: strips that READ the symbol (distinct from `INTRABC_HITS` = blocks that USE intrabc) | | `crates/ec-av1/src/stream.rs` `rect_intrabc_reads()` re-export + new gate | gate + probe surface | | `crates/ec-av1/src/refusal_inventory.rs` | new refusal `"intra block copy on a HORZ/VERT/1:4 rect intra strip (reconstruction is not ported at this shape)"` (45 -> 46) | | `crates/ec-av1/examples/decode_probe.rs` | prints `rect_intrabc_reads:` | Class sweep: `grep -n "cdfs.kf_y_mode\[" crates/ec-av1/src/decode.rs` -> 3 intra mode readers (5630 rect, 8828 square, 10709 sub8); all three now read `cdfs.intrabc` under the frame flag (5618 / 8807 / 10700). No other site. ## Gate `crates/ec-av1/src/stream.rs::a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` -- three real-aomenc 8-bit arms, base recipe `--codec=av1 --bit-depth=8 --input-bit-depth=8 --passes=1 --end-usage=q --cpu-used=0 --lag-in-frames=0 --kf-max-dist=1 --limit=1 --threads=1 --tile-columns=0 --enable-rect-partitions=1 --enable-1to4-partitions=1 --min-partition-size=8 --max-partition-size=32 --sb-size=64 --tune-content=screen`, per-arm overrides last: * `testsrc2-screen-nopalette-cq50` -- rect strips really use intrabc; must refuse by NAME (was: a silently wrong frame). * `smptebars-screen-nopalette-cq45` -- decodes the whole frame, 69 rect `use_intrabc` reads; entropy coverage (see residue). * `testsrc2-screen-nopalette-cq63` -- screen tools but header `allow_intrabc = 0`; frame compared pixel-exact against ffmpeg, proving the new read is not taken when libaom does not write it. ``` cargo test -p ec-av1 --lib a_real_aomenc_screen_key_frame_reads_use_intrabc -- --nocapture -> 1 passed: 147 rect-strip use_intrabc symbol(s) read, 1 refused by name, 1 frames compared pixel-exact ``` `refusal_inventory` (3 tests) and `gate_coverage` (7 tests) green. ## EVIDENCE * `EVIDENCE: $HOME/.cache/kf900-r5/{s.obu,ours.yuv,ref.yuv} | aomenc chartered recipe (sha256 4fe2e7ba57...; encoded twice byte-identical as bf048186e3... in IVF form), decode_probe vs `ffmpeg -i` | before fix: OK + 73438 bytes differ, first luma (0,0) ours 128 vs ref 74; after fix: named refusal instead of a wrong frame` * `EVIDENCE: $HOME/.cache/kf900-r5/{c45_ours.txt,c45_ref.txt} | EC_TRACE_MODE_STEP ladder both decoders | first divergence mi(0,0) name=mode: ours 62696 vs oracle 58628 = one unconsumed intrabc symbol` * `EVIDENCE: $HOME/.cache/kf900-r5/{b_o.n,b_r.n} | same ladder on the smptebars cq45 arm after the fix | 429 mode-ladder elements identical, first divergence at mi(32,44) (a SQUARE intrabc block's DV read)` * `EVIDENCE: $HOME/.cache/kf900-suite-r5.log | full ec-av1 lib suite as systemd unit kf900-suite-r5-1788331689 | test result: ok. 385 passed; 0 failed; 33 ignored, 1088.55s` ## Residue * `deferred: pixel-exactness on frames that actually USE intrabc -- read_intrabc_dv desyncs inside the DV of a SQUARE 16x16 intrabc block at mi(32,44) (smptebars cq45 arm: 429 ladder elements exact, then diverges); it is a separate defect from this lane's read -- unblocked by a DV-symbol ladder against the oracle at that block` * `deferred: rect-strip intrabc RECONSTRUCTION (the new refusal) -- needs the DV path above working first, plus the square path's own open "intrabc block under TxMode::Select" refusal` * `deferred: 8-bit screen key frame with palette, cq45 --enable-tx-size-search=1 -- after this fix the ladder is exact for 46 elements and diverges in the TAIL of the palette block at mi(0,8) (palette colour-index map / tx). Separate palette defect, not intrabc`