Lane-palette r7 report
Browse files at this commit745cab94e6c81980b4a3aecfe5ff45652f199247Parent: 580b3c5- docs
- lane-palette r7 report
1 changed file +120 -0
- lanes/palette-r7.report.md +120 -0
lanes/palette-r7.report.mdadded+120 -0
| @@ -0,0 +1,120 @@ | ||
| 1 | +# lane-palette r7 report | |
| 2 | + | |
| 3 | +VERDICT: DONE -- the fix r6 pinned is implemented, the gate is pixel-exact | |
| 4 | +against ffmpeg, the palette-Y refusal is removed, `refusal_inventory.rs` is | |
| 5 | +updated, main is merged in, and the lane arrives mergeable. | |
| 6 | + | |
| 7 | +## The fix (`crates/ec-av1/src/decode.rs`, `read_intra_mode`) | |
| 8 | + | |
| 9 | +r6's range trace pinned the cause exactly: `decode_color_index_map` was | |
| 10 | +called inline right after the Y colours, but libaom's `av1_visit_palette` | |
| 11 | +(`decoder.c:234`) only runs `decode_color_map_tokens` from | |
| 12 | +`parse_decode_block` (`decodeframe.c:1135`) **after** the whole mode-info | |
| 13 | +read, including UV palette mode_info (`read_palette_mode_info`'s own | |
| 14 | +second half, `decodemv.c:588`) and `filter_intra`. | |
| 15 | + | |
| 16 | +Two changes, both inside `read_intra_mode`: | |
| 17 | + | |
| 18 | +1. **UV palette mode_info read added.** Right after the Y colours are read | |
| 19 | + (or Y palette doesn't fire), read `palette_uv_mode` at | |
| 20 | + `ctx = usize::from(use_palette_y)` whenever `uv_mode == UV_DC_PRED` -- | |
| 21 | + unconditionally, not gated on whether Y fired (that was the actual bug: | |
| 22 | + the old code returned early inside the `use_palette_y` branch, before | |
| 23 | + this read was ever reached). No `read_palette_colors_uv` port was | |
| 24 | + needed: UV palette reconstruction stays out of scope, so the moment the | |
| 25 | + mode symbol fires this decoder refuses by name immediately and the | |
| 26 | + whole decode aborts -- no further bits from that stream matter, so | |
| 27 | + `palette_uv_size`/the UV colour reader never need to exist. `is_chroma_ref` | |
| 28 | + didn't need threading in either: this decoder's scope is squares only | |
| 29 | + and `decode_block` always reconstructs chroma alongside luma, so it is | |
| 30 | + unconditionally true here (matches `av1_visit_palette`'s own `plane == 0 | |
| 31 | + || xd->is_chroma_ref` when `is_chroma_ref` is always true). | |
| 32 | +2. **Y's `decode_color_index_map` call moved.** The Y palette branch now | |
| 33 | + only reads mode/size/colours and stashes them in a local | |
| 34 | + `palette_y_pending: Option<(usize, [u16; 8])>`; the actual | |
| 35 | + `decode_color_index_map` call (and the `PALETTE_HITS` counter bump) now | |
| 36 | + runs after `filter_intra` is read, matching | |
| 37 | + `decode_mbmi_block` → `av1_visit_palette` order exactly. | |
| 38 | + | |
| 39 | +The old "index map decodes but pixels don't match" refusal | |
| 40 | +(`decode.rs`'s r3/r4 comment block) is gone -- replaced by an r7 doc | |
| 41 | +comment explaining the reorder and citing `compare-range-not-tell`. | |
| 42 | + | |
| 43 | +## Gate: refuses-by-name -> decodes-pixel-exact | |
| 44 | + | |
| 45 | +`crates/ec-av1/src/stream.rs`'s | |
| 46 | +`a_real_aomenc_stream_with_palette_y_refuses_by_name` renamed to | |
| 47 | +`a_real_aomenc_stream_with_palette_y_decodes_pixel_exact`: same fixture | |
| 48 | +(`smptebars=size=64x64:rate=25` + `hue=s=0`, `--enable-palette=1 | |
| 49 | +--tune-content=screen`, every non-palette intra tool forced off so a | |
| 50 | +mismatch can only come from palette), but now asserts `decode_stream` | |
| 51 | +succeeds, `palette_hits() > before` (proves the block actually fired, not | |
| 52 | +a vacuous pass), and `frames[0].{y,u,v}` match `ffmpeg_decode_sequence`'s | |
| 53 | +decode of the same bytes exactly. | |
| 54 | + | |
| 55 | +``` | |
| 56 | +EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- \ | |
| 57 | + a_real_aomenc_stream_with_palette_y_decodes_pixel_exact | |
| 58 | +``` | |
| 59 | +-> `test stream::tests::a_real_aomenc_stream_with_palette_y_decodes_pixel_exact ... ok` | |
| 60 | + | |
| 61 | +## refusal_inventory.rs | |
| 62 | + | |
| 63 | +Dropped `"a block that actually uses a palette (Y) -- the index map | |
| 64 | +decodes but the reconstructed pixels do not match libaom yet (lane-palette | |
| 65 | +r3/r4)"` from `REFUSALS` (the string no longer exists in the source, so the | |
| 66 | +pinned-inventory test would otherwise fail). `"a block that actually uses a | |
| 67 | +palette (Y) -- reconstruction is out of scope"` (the excluded-call-site | |
| 68 | +refusal, unaffected by this round) and `"...UV... -- reconstruction is out | |
| 69 | +of scope"` both stay -- neither string changed. | |
| 70 | + | |
| 71 | +`gate_coverage.rs` has no `enable-palette` entry to remove: the gate | |
| 72 | +already passed `--enable-palette=1` before this round, so this milestone's | |
| 73 | +"drops off the list" note in the charter doesn't apply here. | |
| 74 | + | |
| 75 | +## Oracle hygiene | |
| 76 | + | |
| 77 | +No patch to `~/.cache/aom-oracle` was needed this round -- the fix was | |
| 78 | +derived by reading libaom source directly (`av1_visit_palette`, | |
| 79 | +`read_palette_mode_info`, `read_palette_colors_uv`) and verified purely | |
| 80 | +against this repo's own `decode_stream` vs `ffmpeg_decode_sequence`, no | |
| 81 | +`aomdec EC_TRACE`/`decodemv.c` re-instrumentation this time. The checkout | |
| 82 | +is untouched by this lane (its working tree shows pre-existing sibling-lane | |
| 83 | +modifications to `restoration.c`/`decodeframe.c`/`decodemv.c`/`decodetxb.c`/ | |
| 84 | +`detokenize.c` that were already there before this round started -- not | |
| 85 | +mine to revert or rebuild). No new env-gated rung added to | |
| 86 | +`scripts/instrument-aom-oracle.sh` since none was needed. | |
| 87 | + | |
| 88 | +## Checks | |
| 89 | + | |
| 90 | +- `cargo build -p ec-av1 --tests -j4`: clean (pre-existing doc-lint | |
| 91 | + warnings only, no new ones). | |
| 92 | +- `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -j4` (before merging | |
| 93 | + main, timeout 600000ms, ~147s): **244 passed, 0 failed, 17 ignored** | |
| 94 | + (r6's 244-test baseline, palette gate now green instead of "refuses"). | |
| 95 | +- After `git merge main` (main brought in 5 more tests, tile-rows work): | |
| 96 | + `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -j4` (~175s): | |
| 97 | + **249 passed, 0 failed, 17 ignored**. | |
| 98 | + | |
| 99 | +## Commits (this branch, on top of bba4d3c) | |
| 100 | + | |
| 101 | +- `dd399d4` -- the fix + gate flip + refusal_inventory update, all one | |
| 102 | + commit per charter. | |
| 103 | +- `406e0f2` -- `git merge main` (auto-merged cleanly: `decode.rs`, | |
| 104 | + `refusal_inventory.rs`, `stream.rs` all resolved without conflicts, | |
| 105 | + main's `bit depth != 8` refusal and tile-rows work landed alongside | |
| 106 | + this round's palette changes). | |
| 107 | + | |
| 108 | +Branch left unpushed, unmerged to main, per charter ("Never push, never | |
| 109 | +merge this branch into main"). | |
| 110 | + | |
| 111 | +## Handoff for the next round | |
| 112 | + | |
| 113 | +r6's own next-milestone list (`palette_bsize_ctx` rect-strip refusal, | |
| 114 | +`enable-intrabc`) is still fully unstarted -- this round's entire scope was | |
| 115 | +the reorder fix the charter named, and it's done. UV palette | |
| 116 | +*reconstruction* (as opposed to the mode_info read, now correct) also | |
| 117 | +remains a named refusal and unstarted; it was never in this round's scope. | |
| 118 | + | |
| 119 | +`deferred: palette_bsize_ctx rect-strip refusal, intrabc, UV palette | |
| 120 | +reconstruction -- all unstarted, out of this round's charter scope.` |