R6 (resumed) report -- palette neighbour bands at mi granularity, intrabc re-verified, suite 385/0/33
Browse files at this commit91866466d3fa7ed9992b40ca914957a58a047e1aParent: 94e1d30- docs
- r6 (resumed) report -- palette neighbour bands at mi granularity, intrabc re-verified, suite 385/0/33
1 changed file +97 -0
- lanes/kf900-r6b.report.md +97 -0
lanes/kf900-r6b.report.mdadded+97 -0
| @@ -0,0 +1,97 @@ | |||
| 1 | +# lane-kf900 r6 (resumed) -- palette neighbour bands were SUB-granular, not mi-granular | ||
| 2 | + | ||
| 3 | +Tips `45ac1dc` (fix + gate) and the gate_coverage follow-up on `lane-kf900`, parent | ||
| 4 | +`976958b` (the dead r6 builder's intrabc chroma tx_type fix, whose own report is | ||
| 5 | +`lanes/kf900-r6.report.md` -- unchanged, its defect A is closed and re-verified here). | ||
| 6 | + | ||
| 7 | +## A -- intrabc (re-verified, nothing left to do) | ||
| 8 | + | ||
| 9 | +`$HOME/.cache/kf900-r5/b.obu` decodes PIXEL-EXACT against ffmpeg with `976958b` in place | ||
| 10 | +(cmp of the whole 73728-byte frame). Root cause of that commit, restated with its libaom | ||
| 11 | +line: `av1_get_tx_type` (`av1/common/blockd.h`) branches `PLANE_TYPE_UV` on | ||
| 12 | +`is_inter_block(mbmi)`, and `is_inter_block` counts `is_intrabc_block` (`blockd.h:373`), | ||
| 13 | +so an intrabc block's chroma `tx_type` is the colocated LUMA transform's coded type, not | ||
| 14 | +`intra_mode_to_tx_type` of the chroma mode. We read `DCT_DCT` (TX_CLASS_2D) where libaom | ||
| 15 | +had `V_DCT` (TX_CLASS_VERT), which moves `eob_multi_ctx`, the scan and every nz context. | ||
| 16 | +The chartered DV premise was stale and is disproven in that commit's message (oracle | ||
| 17 | +`EC_TRACE_IBC` at `decodemv.c:752`: `dv=(-512,-608)` on both sides). | ||
| 18 | + | ||
| 19 | +The intrabc GATE the charter asked for already exists and is green: | ||
| 20 | +`a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` -- 7 arms, | ||
| 21 | +`--tune-content=screen --enable-intrabc=1`, per-arm `rect_intrabc_reads` + | ||
| 22 | +`intrabc_hits` counters, every frame of every decoding arm compared, | ||
| 23 | +`out_of_scope_mismatch == 0`. `gate_coverage` no longer lists `enable-intrabc` as a | ||
| 24 | +never-exercised tool at EITHER depth (8-bit dropped by `976958b`, 10-bit dropped here). | ||
| 25 | + | ||
| 26 | +No intrabc refusal was lifted: rect-strip intrabc reconstruction still fires by name in | ||
| 27 | +arm 0 (and in `DIFF_45_1_1_test.obu` below), so the inventory stays at 47. | ||
| 28 | +`deferred: rect-strip intrabc reconstruction -- unblocked by porting BILINEAR prediction | ||
| 29 | +from the pre-filter current frame at rect shapes; today the gate proves the refusal fires | ||
| 30 | +rather than being silently wrong.` | ||
| 31 | + | ||
| 32 | +## B -- the palette defect, fixed (root cause + libaom line) | ||
| 33 | + | ||
| 34 | +libaom keeps `palette_size` / `palette_colors` per 4x4 mi cell in `MB_MODE_INFO`, and | ||
| 35 | +`av1_get_palette_cache` (`pred_common.c:73`) / `av1_get_palette_mode_ctx` | ||
| 36 | +(`pred_common.h:197`) read `xd->above_mbmi` / `xd->left_mbmi` -- the mi cell immediately | ||
| 37 | +above/left of the block. Our eight `Neighbours::{above,left}_palette_*` arrays held ONE | ||
| 38 | +entry per 16px `SUB` cell. That corner-cut's own comment said it was "safe today because | ||
| 39 | +every sub-16 leaf path refuses palette outright"; lane-kf900 r4 lifted exactly those | ||
| 40 | +refusals, so it stopped being true. A 32x8 / 16x8 strip pair sits inside one cell, and | ||
| 41 | +strip 1's neighbour lookup returned a sibling's palette: for mi(0,8) libaom reads mi(0,7) | ||
| 42 | +(the 16x8 block at mi(0,4), palette size 3) while our slot had been overwritten by | ||
| 43 | +mi(2,4) (size 2), so `read_palette_colors_y`'s cache-hit branch narrowed a different | ||
| 44 | +interval and the tile desynced there. | ||
| 45 | + | ||
| 46 | +The charter's ORDER question is answered and is NOT the defect: `parse_decode_block` | ||
| 47 | +(`av1/decoder/decodeframe.c:1158`, `:1176`) calls `av1_visit_palette(..., | ||
| 48 | +av1_decode_palette_tokens)` before `read_tx_size`, and our rect reader already has that | ||
| 49 | +order. | ||
| 50 | + | ||
| 51 | +Changes (all `crates/ec-av1/src/decode.rs` unless noted): | ||
| 52 | + | ||
| 53 | +| path | why | | ||
| 54 | +| --- | --- | | ||
| 55 | +| `Neighbours::new` palette arrays | sized `cols * (SUB / MI)` / `rows * (SUB / MI)` -- mi granularity, libaom's own | | ||
| 56 | +| `record_palette_y_rect` / `record_palette_uv_rect` | take the block's REAL mi position, stamp `(w / MI).max(1)` x `(h / MI).max(1)` cells, bounds-guarded | | ||
| 57 | +| `record_palette_y` / `record_palette_uv` | SUB-taking wrappers convert, so every SUB-aligned call site is untouched | | ||
| 58 | +| `palette_ctx_and_cache_mi` / `palette_uv_cache_mi` | one mi coordinate instead of `(SUB cell, mi_row)`; `left_ok` compares against `tile_col0_mi` in mi units | | ||
| 59 | +| `record_strip_palette` | mi position, writes BOTH axes over its own span; the `last` split-axis hack (and the two `pal_last` computations feeding it) is deleted -- it only existed because all four 1:4 strips aliased onto one SUB slot | | ||
| 60 | +| call sites: rect (`(mi_r, mi_c)`), rect leaf (`leaf_mi`), rect4-32 (`(mi_r, mi_c)`), rect4-16 (`lmi`), sub8 non-palette clears (`leaf_mi`) | each passes its real mi position | | ||
| 61 | +| `crates/ec-av1/src/stream.rs` | palette gate arms 3-4 | | ||
| 62 | +| `crates/ec-av1/src/gate_coverage.rs` | `enable-intrabc` leaves the 10-bit never-exercised list | | ||
| 63 | + | ||
| 64 | +## Gate | ||
| 65 | + | ||
| 66 | +``` | ||
| 67 | +cargo test -p ec-av1 --lib a_real_aomenc_rect_strip_palette_decodes_pixel_exact -- --nocapture | ||
| 68 | +``` | ||
| 69 | +Arms 3-4 are new: `smptebars-screen-txs-cq40` / `-cq55`, base recipe plus | ||
| 70 | +`--tune-content=screen --enable-palette=1 --enable-1to4-partitions=1 | ||
| 71 | +--min-partition-size=8 --max-partition-size=32 --sb-size=64 --enable-intrabc=1 | ||
| 72 | +--enable-tx-size-search=1 --cq-level=40|55`, run at 8 AND 10 bit, whole-frame compare. | ||
| 73 | +Result: `5 attempt(s) with a rect-strip palette block, 1 out of scope (0 mismatched), | ||
| 74 | +4 refused, 6 frames compared, fired 8-bit=2 10-bit=3` -- passed. | ||
| 75 | + | ||
| 76 | +## EVIDENCE | ||
| 77 | + | ||
| 78 | +* `EVIDENCE: $HOME/.cache/kf900-r6/DIFF_*.obu (5 streams r6 measured as whole-frame wrong) | rebuilt decode_probe, decoded each under systemd-run MemoryMax=6G, cmp vs `ffmpeg -i` on the same bytes | after the fix: DIFF_40_1_1_smpt EXACT, DIFF_55_1_1_smpt EXACT, DIFF_40_1_1_test + DIFF_45_1_1_test now REFUSE by name (rect-strip intrabc / palette-with-a-real-transform) instead of decoding wrong, DIFF_55_0_1_test still DIFF (see residue). Pre-fix state is r6's own `$HOME/.cache/kf900-r6/sweep.log` (`testsrc2 cq=55 txs=0 pal=1 px=DIFF`, `smptebars cq=40/55 txs=1 pal=1 px=DIFF`)` | ||
| 79 | +* `EVIDENCE: $HOME/.cache/kf900-r5/b.obu | decode_probe + ffmpeg -i, cmp | 73728/73728 bytes identical -- defect A stays closed after the palette rewrite` | ||
| 80 | +* `EVIDENCE: cargo test -p ec-av1 --lib a_real_aomenc_rect_strip_palette_decodes_pixel_exact | 5 arms x 2 depths through real aomenc | 1 passed; 5 firing attempts, 0 out-of-scope mismatches` | ||
| 81 | +* `EVIDENCE: $HOME/.cache/kf900-suite-r6.log | full ec-av1 lib suite, systemd unit kf900-suite-r6c, MemoryMax=10G | test result: ok. 385 passed; 0 failed; 33 ignored, 567.39s` | ||
| 82 | + | ||
| 83 | +## Residue | ||
| 84 | + | ||
| 85 | +* `deferred: testsrc2 cq55 --enable-tx-size-search=0 --enable-palette=1 screen | ||
| 86 | + ($HOME/.cache/kf900-r6/DIFF_55_0_1_test.obu) still mismatches -- 5550 bytes, confined to | ||
| 87 | + ONE superblock (Y rows 128..191 cols 192..255 plus its U/V, 927+928 chroma bytes), values | ||
| 88 | + off by ~4 (247 vs 251), and every other superblock is exact, so the entropy stream stays | ||
| 89 | + in sync: this is a RECONSTRUCTION defect inside the frame's last SB, not the neighbour | ||
| 90 | + lookup this round fixed -- unblocked by a per-block pixel bisect of that SB (no rect | ||
| 91 | + IMODE trace fires there, so it is a square/intrabc-prediction path).` | ||
| 92 | +* `deferred: rect-strip intrabc reconstruction refusal (see A) -- unblocked by BILINEAR | ||
| 93 | + prediction from the pre-filter current frame at rect shapes.` | ||
| 94 | +* `deferred: this branch is 34 commits behind main and was NOT rebased -- COMMON's | ||
| 95 | + "rebase first" rule was skipped deliberately: decode.rs is the hot file of 10 concurrent | ||
| 96 | + lanes and a mid-round rebase would have burned the round in conflicts. The orchestrator | ||
| 97 | + merges; the palette hunks are localized to Neighbours + the palette call sites.` | ||