Lane-palette r7 charter -- UV palette mode_info port + call-site reorder
Browse files at this commit85c524691a3ed68ed85aaa682ee137ca5e47321dParent: b07f07a- docs
- lane-palette r7 charter -- UV palette mode_info port + call-site reorder
1 changed file +56 -0
- lanes/palette-r7.charter.md +56 -0
lanes/palette-r7.charter.mdadded+56 -0
| @@ -0,0 +1,56 @@ | ||
| 1 | +# lane-palette r7 — implement the fix r6 pinned | |
| 2 | + | |
| 3 | +At bba4d3c. Read `lanes/palette-r6.report.md` first — it carries the root cause, | |
| 4 | +the range table, the fixture regen command and the oracle 3-print patch. | |
| 5 | + | |
| 6 | +r6 did the decisive work: every symbol up through `read_palette_colors_y` is | |
| 7 | +bit-exact against the oracle (partition, skip, y_mode, uv_mode, palette_y_mode, | |
| 8 | +palette_y_size, colours — all rng-for-rng). Divergence begins exactly at | |
| 9 | +`decode_color_index_map`'s entry (oracle rng=51752, ours 39432). Cause is call | |
| 10 | +ORDER, not a table: libaom reaches `decode_color_map_tokens` from | |
| 11 | +`parse_decode_block` (`decodeframe.c:1135`, `av1_visit_palette`) AFTER the whole | |
| 12 | +mode-info decode including UV palette mode_info and filter_intra; we call | |
| 13 | +`decode_color_index_map` inline right after the Y colours (`decode.rs` ~3023) | |
| 14 | +and never read UV palette mode_info at all — which this gate's block genuinely | |
| 15 | +has (`uv_mode = UV_DC_PRED`, chroma-referenced). | |
| 16 | + | |
| 17 | +## Do the fix, in this order, committing each green step | |
| 18 | +1. Port UV palette mode_info — `palette_uv_mode_cdf`, `palette_uv_size_cdf`, | |
| 19 | + `read_palette_colors_uv` — into `read_intra_mode`'s palette branch, | |
| 20 | + immediately after the Y colours. New adapting CDFs need all four wiring | |
| 21 | + sites: struct field, defaults array, save/restore, and the per-frame counter | |
| 22 | + reset. `reset2`/`reset3` are length-generic and save/restore is a whole-struct | |
| 23 | + `Clone`, so the defaults array is the one to hand-check — but confirm the | |
| 24 | + counter reset covers them. A table missing from the reset gives right values | |
| 25 | + at the wrong adaptation rate, which reads as a slow drift, not a desync | |
| 26 | + ([[cdf-counter-not-reset]]). | |
| 27 | +2. Move BOTH the Y and UV `decode_color_index_map` calls to run after | |
| 28 | + `filter_intra` is read, matching libaom's `decode_mbmi_block` → | |
| 29 | + `av1_visit_palette` order. | |
| 30 | +3. Re-run r6's exact trace recipe and confirm the ranges match to the END of the | |
| 31 | + block, not just past the old divergence point. | |
| 32 | +4. Only with the gate pixel-exact: flip it green, remove the palette-Y refusal, | |
| 33 | + and update `refusal_inventory.rs`'s pinned list — all in ONE commit. A branch | |
| 34 | + that lifts a refusal without a gate does not merge to main. | |
| 35 | + | |
| 36 | +Then merge `main` into this branch (main has moved a long way: multi-tile, | |
| 37 | +delta_q/delta_lf, a `bit_depth != 8` refusal, three reworded partition | |
| 38 | +refusals) and resolve it yourself, so the lane arrives mergeable. | |
| 39 | + | |
| 40 | +Note `gate_coverage.rs` still lists `enable-palette` only if this lane's gate | |
| 41 | +does not enable it — when your gate is green with the tool on, that entry comes | |
| 42 | +off the list in the same commit. | |
| 43 | + | |
| 44 | +Oracle hygiene: the aomenc checkout at `~/.cache/aom-oracle` is SHARED with five | |
| 45 | +sibling lanes. r6 patched `decodemv.c` for its trace and reverted it after use — | |
| 46 | +do the same, and never leave the shared oracle modified or half-rebuilt. Prefer | |
| 47 | +adding a permanent env-gated rung to `scripts/instrument-aom-oracle.sh` (silent | |
| 48 | +when unset, idempotent) over a throwaway patch. | |
| 49 | + | |
| 50 | +Hard rules: `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-palette`; foreground | |
| 51 | +`nice -n 19 cargo ... -j4`; every `cargo test` a timeout >= 600000 ms; fixtures | |
| 52 | +through `gradients_source(seed, w, h, tail)`; ffmpeg generates bounded with `-t`; | |
| 53 | +`EC_AV1_REQUIRE_AOMENC=1`; aomenc `--threads=1 --row-mt=0 --sb-size=64`. Sibling | |
| 54 | +worktrees have live agents — never build in or edit them. Never push, never | |
| 55 | +merge this branch into main. 75-turn cap, does not reset: COMMIT AT EVERY GREEN | |
| 56 | +STEP. End with `lanes/palette-r7.report.md`, VERDICT on line 1. |