From 91866466d3fa7ed9992b40ca914957a58a047e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Sep 2026 14:26:46 +0300 Subject: [PATCH] docs(kf900): r6 (resumed) report -- palette neighbour bands at mi granularity, intrabc re-verified, suite 385/0/33 --- lanes/kf900-r6b.report.md | 97 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 lanes/kf900-r6b.report.md diff --git a/lanes/kf900-r6b.report.md b/lanes/kf900-r6b.report.md new file mode 100644 index 00000000..bf55029a --- /dev/null +++ b/lanes/kf900-r6b.report.md @@ -0,0 +1,97 @@ +# lane-kf900 r6 (resumed) -- palette neighbour bands were SUB-granular, not mi-granular + +Tips `45ac1dc` (fix + gate) and the gate_coverage follow-up on `lane-kf900`, parent +`976958b` (the dead r6 builder's intrabc chroma tx_type fix, whose own report is +`lanes/kf900-r6.report.md` -- unchanged, its defect A is closed and re-verified here). + +## A -- intrabc (re-verified, nothing left to do) + +`$HOME/.cache/kf900-r5/b.obu` decodes PIXEL-EXACT against ffmpeg with `976958b` in place +(cmp of the whole 73728-byte frame). Root cause of that commit, restated with its libaom +line: `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, not +`intra_mode_to_tx_type` of the chroma mode. We read `DCT_DCT` (TX_CLASS_2D) where libaom +had `V_DCT` (TX_CLASS_VERT), which moves `eob_multi_ctx`, the scan and every nz context. +The chartered DV premise was stale and is disproven in that commit's message (oracle +`EC_TRACE_IBC` at `decodemv.c:752`: `dv=(-512,-608)` on both sides). + +The intrabc GATE the charter asked for already exists and is green: +`a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` -- 7 arms, +`--tune-content=screen --enable-intrabc=1`, per-arm `rect_intrabc_reads` + +`intrabc_hits` counters, every frame of every decoding arm compared, +`out_of_scope_mismatch == 0`. `gate_coverage` no longer lists `enable-intrabc` as a +never-exercised tool at EITHER depth (8-bit dropped by `976958b`, 10-bit dropped here). + +No intrabc refusal was lifted: rect-strip intrabc reconstruction still fires by name in +arm 0 (and in `DIFF_45_1_1_test.obu` below), so the inventory stays at 47. +`deferred: rect-strip intrabc reconstruction -- unblocked by porting BILINEAR prediction +from the pre-filter current frame at rect shapes; today the gate proves the refusal fires +rather than being silently wrong.` + +## B -- the palette defect, fixed (root cause + libaom line) + +libaom keeps `palette_size` / `palette_colors` per 4x4 mi cell in `MB_MODE_INFO`, and +`av1_get_palette_cache` (`pred_common.c:73`) / `av1_get_palette_mode_ctx` +(`pred_common.h:197`) read `xd->above_mbmi` / `xd->left_mbmi` -- the mi cell immediately +above/left of the block. Our eight `Neighbours::{above,left}_palette_*` arrays held ONE +entry per 16px `SUB` cell. That corner-cut's own comment said it was "safe today because +every sub-16 leaf path refuses palette outright"; lane-kf900 r4 lifted exactly those +refusals, so it stopped being true. A 32x8 / 16x8 strip pair sits inside one cell, and +strip 1's neighbour lookup returned a sibling's palette: for mi(0,8) libaom reads mi(0,7) +(the 16x8 block at mi(0,4), palette size 3) while our slot had been overwritten by +mi(2,4) (size 2), so `read_palette_colors_y`'s cache-hit branch narrowed a different +interval and the tile desynced there. + +The charter's ORDER question is answered and is NOT the defect: `parse_decode_block` +(`av1/decoder/decodeframe.c:1158`, `:1176`) calls `av1_visit_palette(..., +av1_decode_palette_tokens)` before `read_tx_size`, and our rect reader already has that +order. + +Changes (all `crates/ec-av1/src/decode.rs` unless noted): + +| path | why | +| --- | --- | +| `Neighbours::new` palette arrays | sized `cols * (SUB / MI)` / `rows * (SUB / MI)` -- mi granularity, libaom's own | +| `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 | +| `record_palette_y` / `record_palette_uv` | SUB-taking wrappers convert, so every SUB-aligned call site is untouched | +| `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 | +| `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 | +| 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 | +| `crates/ec-av1/src/stream.rs` | palette gate arms 3-4 | +| `crates/ec-av1/src/gate_coverage.rs` | `enable-intrabc` leaves the 10-bit never-exercised list | + +## Gate + +``` +cargo test -p ec-av1 --lib a_real_aomenc_rect_strip_palette_decodes_pixel_exact -- --nocapture +``` +Arms 3-4 are new: `smptebars-screen-txs-cq40` / `-cq55`, base recipe plus +`--tune-content=screen --enable-palette=1 --enable-1to4-partitions=1 +--min-partition-size=8 --max-partition-size=32 --sb-size=64 --enable-intrabc=1 +--enable-tx-size-search=1 --cq-level=40|55`, run at 8 AND 10 bit, whole-frame compare. +Result: `5 attempt(s) with a rect-strip palette block, 1 out of scope (0 mismatched), +4 refused, 6 frames compared, fired 8-bit=2 10-bit=3` -- passed. + +## EVIDENCE + +* `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`)` +* `EVIDENCE: $HOME/.cache/kf900-r5/b.obu | decode_probe + ffmpeg -i, cmp | 73728/73728 bytes identical -- defect A stays closed after the palette rewrite` +* `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` +* `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` + +## Residue + +* `deferred: testsrc2 cq55 --enable-tx-size-search=0 --enable-palette=1 screen + ($HOME/.cache/kf900-r6/DIFF_55_0_1_test.obu) still mismatches -- 5550 bytes, confined to + ONE superblock (Y rows 128..191 cols 192..255 plus its U/V, 927+928 chroma bytes), values + off by ~4 (247 vs 251), and every other superblock is exact, so the entropy stream stays + in sync: this is a RECONSTRUCTION defect inside the frame's last SB, not the neighbour + lookup this round fixed -- unblocked by a per-block pixel bisect of that SB (no rect + IMODE trace fires there, so it is a square/intrabc-prediction path).` +* `deferred: rect-strip intrabc reconstruction refusal (see A) -- unblocked by BILINEAR + prediction from the pre-filter current frame at rect shapes.` +* `deferred: this branch is 34 commits behind main and was NOT rebased -- COMMON's + "rebase first" rule was skipped deliberately: decode.rs is the hot file of 10 concurrent + lanes and a mid-round rebase would have burned the round in conflicts. The orchestrator + merges; the palette hunks are localized to Neighbours + the palette call sites.`