forge
Explore
Log in

Don't you dare go Hollow

R5 report -- rect strips never read use_intrabc, ladder proof, gate, 3 deferred residues

Browse files at this commit

c54230608663870fadf4215ef86172e84831c0abAhmet Kaan GümüşParent: 0bdf223
  • docs
    • r5 report -- rect strips never read use_intrabc, ladder proof, gate, 3 deferred residues
Show full message
docs(kf900): r5 report -- rect strips never read use_intrabc, ladder proof, gate, 3 deferred residues
lanes/kf900-r5.report.mdadded+88 -0
@@ -0,0 +1,88 @@
1+# lane-kf900 r5 report -- rect intra strips never read `use_intrabc`
2+
3+Tip `a7113f5` on `lane-kf900` (parent `9a01750`). GREEN.
4+
5+## Defect (chartered) and root cause
6+
7+The chartered stream -- 8-bit `testsrc2=s=256x192:r=25`, cq59 cpu-used 0, rect + 1:4
8+partitions, `--tune-content=screen --enable-palette=1 --sb-size=64` -- decoded `OK`
9+(`rect4_32: horz=8 vert=8`) and every luma sample of frame 0 differed from ffmpeg.
10+
11+`--tune-content=screen` sets `allow_screen_content_tools`, and the key-frame header then
12+sets **`allow_intrabc = 1`**. `av1_allow_intrabc` is a FRAME-level test (libaom
13+`decodemv.c:892`, `read_intra_frame_mode_info`): every intra block reads a `use_intrabc`
14+symbol after `skip`/`cdef`/`delta_q` and before `mbmi->mode`, with **no block-shape term**.
15+`read_intra_mode` (square leaf) and `read_intra_mode_sub8` both read it;
16+`read_intra_mode_rect` -- the reader for EVERY HORZ/VERT/1:4 rect strip -- did not. The
17+arithmetic decoder therefore desynced at the first mode symbol of the first rect block of
18+the frame, i.e. at mi(0,0), and every later symbol and pixel was garbage.
19+
20+Decisive measurement (cross-decoder range ladder, `EC_TRACE_MODE_STEP` both sides):
21+
22+```
23+ref EC_ISTEP mi_row=0 mi_col=0 name=skip rng=32874 ours ... rng=32874 (identical)
24+ref EC_ISTEP mi_row=0 mi_col=0 name=mode rng=58628 ours ... rng=62696 (diverged)
25+```
26+
27+62696 is exactly `kf_y_mode[0][0]` symbol 0 from 32874. 58628 is that same read after ONE
28+default `intrabc` symbol was consumed first (32874 -> 30694 -> normalised 61388 -> 58628),
29+computed by hand from `od_ec_decode_cdf_q15` (`aom_dsp/entdec.c`) with
30+`default_intrabc_cdf = AOM_CDF2(30531)`. That is the missing symbol, not a table row.
31+
32+## Changes
33+
34+| path | why |
35+| --- | --- |
36+| `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 |
37+| `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` |
38+| `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) |
39+| `crates/ec-av1/src/stream.rs` `rect_intrabc_reads()` re-export + new gate | gate + probe surface |
40+| `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) |
41+| `crates/ec-av1/examples/decode_probe.rs` | prints `rect_intrabc_reads:` |
42+
43+Class sweep: `grep -n "cdfs.kf_y_mode\[" crates/ec-av1/src/decode.rs` -> 3 intra mode
44+readers (5630 rect, 8828 square, 10709 sub8); all three now read `cdfs.intrabc` under the
45+frame flag (5618 / 8807 / 10700). No other site.
46+
47+## Gate
48+
49+`crates/ec-av1/src/stream.rs::a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips`
50+-- three real-aomenc 8-bit arms, base recipe `--codec=av1 --bit-depth=8 --input-bit-depth=8
51+--passes=1 --end-usage=q --cpu-used=0 --lag-in-frames=0 --kf-max-dist=1 --limit=1
52+--threads=1 --tile-columns=0 --enable-rect-partitions=1 --enable-1to4-partitions=1
53+--min-partition-size=8 --max-partition-size=32 --sb-size=64 --tune-content=screen`,
54+per-arm overrides last:
55+
56+* `testsrc2-screen-nopalette-cq50` -- rect strips really use intrabc; must refuse by NAME
57+ (was: a silently wrong frame).
58+* `smptebars-screen-nopalette-cq45` -- decodes the whole frame, 69 rect `use_intrabc`
59+ reads; entropy coverage (see residue).
60+* `testsrc2-screen-nopalette-cq63` -- screen tools but header `allow_intrabc = 0`; frame
61+ compared pixel-exact against ffmpeg, proving the new read is not taken when libaom does
62+ not write it.
63+
64+```
65+cargo test -p ec-av1 --lib a_real_aomenc_screen_key_frame_reads_use_intrabc -- --nocapture
66+-> 1 passed: 147 rect-strip use_intrabc symbol(s) read, 1 refused by name, 1 frames compared pixel-exact
67+```
68+
69+`refusal_inventory` (3 tests) and `gate_coverage` (7 tests) green.
70+
71+## EVIDENCE
72+
73+* `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`
74+* `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`
75+* `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)`
76+* `EVIDENCE: $HOME/.cache/kf900-suite-r5.log | full ec-av1 lib suite as a systemd unit | see below`
77+
78+## Residue
79+
80+* `deferred: pixel-exactness on frames that actually USE intrabc -- read_intrabc_dv desyncs
81+ inside the DV of a SQUARE 16x16 intrabc block at mi(32,44) (smptebars cq45 arm: 429
82+ ladder elements exact, then diverges); it is a separate defect from this lane's read --
83+ unblocked by a DV-symbol ladder against the oracle at that block`
84+* `deferred: rect-strip intrabc RECONSTRUCTION (the new refusal) -- needs the DV path above
85+ working first, plus the square path's own open "intrabc block under TxMode::Select" refusal`
86+* `deferred: 8-bit screen key frame with palette, cq45 --enable-tx-size-search=1 -- after this
87+ fix the ladder is exact for 46 elements and diverges in the TAIL of the palette block at
88+ mi(0,8) (palette colour-index map / tx). Separate palette defect, not intrabc`