report(av1): lane-chroma r1 -- smooth/paeth chroma refusal root-caused, not landed
Browse files at this commita869d13c4573c4a696fad4134306d6d718cb813fParent: 24b6c711 changed file +126 -0
- lanes/chroma-r1.report.md +126 -0
lanes/chroma-r1.report.mdadded+126 -0
| @@ -0,0 +1,126 @@ | |||
| 1 | +# lane-chroma r1 report — smooth/paeth chroma refusal | ||
| 2 | + | ||
| 3 | +VERDICT: NOT LANDED — root cause found and localized, refusal kept (reverted | ||
| 4 | +to HEAD). This is the charter's documented fallback outcome: "the report | ||
| 5 | +explains precisely what a chroma block needs that is missing." | ||
| 6 | + | ||
| 7 | +## What was established (charter step 1-2) | ||
| 8 | + | ||
| 9 | +The predictor itself (`crate::intra::predict`, `SMOOTH_PRED`/`SMOOTH_V_PRED`/ | ||
| 10 | +`SMOOTH_H_PRED`/`PAETH_PRED` branches) IS shared between luma and chroma, | ||
| 11 | +and its formula matches spec 7.11.2.6 / libaom `intrapred.c` exactly (weight | ||
| 12 | +tables, `round2` shifts, no-neighbour `Edges::build` fallback of 127/129/128 | ||
| 13 | +which is the spec's own default for a corner block). The chroma call path | ||
| 14 | +(`PlaneBuf::reconstruct`) is the SAME function luma uses — there is no | ||
| 15 | +missing chroma-specific machinery for the predictor math itself. | ||
| 16 | + | ||
| 17 | +`git log -S "smooth or paeth chroma"` shows the refusal was added in the SAME | ||
| 18 | +commit (4f93fb2, "chroma tx_type derivation…") that landed the predictor | ||
| 19 | +plumbing — its own comment already named the reason: a corner block with no | ||
| 20 | +above/left neighbour, fed `SMOOTH_PRED`, produced a wrong pixel (worst delta | ||
| 21 | +78 vs ffmpeg), traced 2026-08-27. So the earlier round deferred this because | ||
| 22 | +it was HARD (a real bug found), not because it was merely out of scope. | ||
| 23 | + | ||
| 24 | +## What this round found (charter step 3, attempted, then reverted) | ||
| 25 | + | ||
| 26 | +Removed both refusals (`decode.rs` ~1970 and ~2458, the two `read_intra_mode` | ||
| 27 | +variants), added a `SMOOTH_UV_HITS` counter, and wrote | ||
| 28 | +`a_real_aomenc_stream_with_smooth_paeth_chroma_decodes_pixel_exact` (same | ||
| 29 | +structure as the existing `..._with_directional_chroma_...` gate, but | ||
| 30 | +`--enable-smooth-intra=1 --enable-paeth-intra=1`). First attempt (seed 42) | ||
| 31 | +FAILED: luma mismatched ffmpeg, not chroma. | ||
| 32 | + | ||
| 33 | +Grepped every other real-aomenc gate in `stream.rs` (23 call sites): every | ||
| 34 | +single one passes `--enable-smooth-intra=0 --enable-paeth-intra=0`. So | ||
| 35 | +smooth/paeth has NEVER been exercised end-to-end against a real encoder | ||
| 36 | +stream before this lane, for EITHER plane — the charter's premise "already | ||
| 37 | +exercises them for LUMA" holds only in `intra.rs`'s own unit tests, not | ||
| 38 | +against a real bitstream. This is a real, previously-unverified defect, not | ||
| 39 | +a chroma-specific gap. | ||
| 40 | + | ||
| 41 | +Root-caused with `EC_AV1_TRACE=1` (mode dump) + a throwaway pixel-diff test | ||
| 42 | +against the pinned stream, with and without the loop filter | ||
| 43 | +(`--loopfilter-control=0` reproduces it too, ruling out deblocking): | ||
| 44 | + | ||
| 45 | +- First mismatch (no-LF stream): `row=16 col=48`, inside luma block | ||
| 46 | + `px=48 py=16 side=16 mode=5` (`D113_PRED`, a directional mode). | ||
| 47 | +- Its ABOVE neighbour is `px=48 py=0 side=16 mode=11` (`SMOOTH_H_PRED`). | ||
| 48 | + | ||
| 49 | +This is exactly the corner-cut already named in the code, verbatim, at the | ||
| 50 | +`reconstruct()` call site's own doc comment: | ||
| 51 | + | ||
| 52 | +> `smooth_neighbor` (spec `get_intra_edge_filter_type`) is left `false`: | ||
| 53 | +> exact for chroma here (a smooth `uv_mode` is refused before decode reaches | ||
| 54 | +> this call) and a corner-cut for LUMA -- ceiling is one wrong filter-strength | ||
| 55 | +> bucket on a block whose real neighbour predicted smooth; upgrade path is | ||
| 56 | +> threading `Neighbours::above_mode`/`left_mode`'s `SMOOTH_PRED..=SMOOTH_H_PRED` | ||
| 57 | +> membership down instead of `false`. | ||
| 58 | + | ||
| 59 | +Enabling `--enable-smooth-intra=1` makes the RD search reachable to actually | ||
| 60 | +land SMOOTH_H on a block, which is exactly the case the corner-cut's own | ||
| 61 | +comment predicted would break: `intra_edge_filter_strength`'s | ||
| 62 | +`smooth_neighbor` threshold bucket is picked wrong for the directional | ||
| 63 | +neighbour below it, producing the observed off-by-one-ish deltas | ||
| 64 | +(`intra_edge_filter_strength` returns the wrong strength index -> different | ||
| 65 | +filter kernel -> pixels shift by 1-2). | ||
| 66 | + | ||
| 67 | +## Why it wasn't landed this round | ||
| 68 | + | ||
| 69 | +The fix is well-scoped (`Neighbours::above_mode`/`left_mode` already track | ||
| 70 | +per-16x16-cell LUMA mode; threading `SMOOTH_PRED..=SMOOTH_H_PRED.contains()` | ||
| 71 | +into every `reconstruct`/`reconstruct_rect` call site's `smooth_neighbor` | ||
| 72 | +argument is mechanical) but touches ~9 call sites across 3 planes x 3 partition | ||
| 73 | +shapes (`decode.rs:2161,2174,2186,2279,2317,2354,2928,3038,3050,3061,3337, | ||
| 74 | +3349,3360,7850,7862,7873,8923,8934,8945`), and the CHROMA side of the same | ||
| 75 | +question needs a NEW piece of state this decoder does not track at all: a | ||
| 76 | +per-cell UV-mode neighbour array (today's `Neighbours` only has `above_mode`/ | ||
| 77 | +`left_mode` for LUMA). Landing chroma smooth/paeth correctly needs BOTH the | ||
| 78 | +luma-side threading (fixes the observed defect) AND new UV-mode tracking | ||
| 79 | +(so a chroma block's own `smooth_neighbor` reflects its chroma neighbour, not | ||
| 80 | +its luma one) — verified but not measured against a gate this round, out of | ||
| 81 | +budget. Shipping only the luma-side half and leaving chroma's `smooth_neighbor` | ||
| 82 | +hardcoded `false` would silently reintroduce the same bug on the chroma side | ||
| 83 | +the moment two chroma smooth/directional blocks sit adjacent, which is exactly | ||
| 84 | +the kind of silently-wrong decode this lane's own rules forbid landing. | ||
| 85 | + | ||
| 86 | +Given the choice between (a) landing a two-line refusal removal with a KNOWN, | ||
| 87 | +now-quantified pixel defect gated by a passing test that happened not to | ||
| 88 | +exercise the bad case, and (b) reverting to the safe refusal with the root | ||
| 89 | +cause fully documented, this round takes (b). The attempted diff (refusal | ||
| 90 | +removal + counter + gate + throwaway diagnostic test) is saved at | ||
| 91 | +`/tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/baaa03f8-c4ff-4469-8ebb-83100429b150/scratchpad/chroma-r1-attempt.diff` | ||
| 92 | +for whichever round lands the `smooth_neighbor` threading. | ||
| 93 | + | ||
| 94 | +## Gate firing count | ||
| 95 | + | ||
| 96 | +None — the gate (`a_real_aomenc_stream_with_smooth_paeth_chroma_decodes_pixel_exact`) | ||
| 97 | +was written and fired real smooth/paeth chroma symbols on its very first | ||
| 98 | +attempt (seed 42), but FAILED on luma pixel mismatch before reaching a | ||
| 99 | +chroma pixel-exact assertion; it was reverted along with the refusal removal | ||
| 100 | +rather than left in the tree failing or disabled. `smooth_uv_hits` counter: | ||
| 101 | +1 firing observed (chroma `uv_mode=11` on block `px=32 py=16`), never | ||
| 102 | +verified pixel-exact. | ||
| 103 | + | ||
| 104 | +## The directional-chroma sibling ("a directional chroma mode (round 2)") | ||
| 105 | + | ||
| 106 | +Not touched this round; it lives at a DIFFERENT, unrelated code path | ||
| 107 | +(`decode.rs:7786`, inside the intra-block-within-an-inter-frame reader) than | ||
| 108 | +the two smooth/paeth refusals (`~1970`/`~2458`, the key-frame `read_intra_mode` | ||
| 109 | +variants). That inter-frame intra-block path never computes `angle_delta_uv` | ||
| 110 | +at all and refuses ANY non-DC/non-CFL `uv_mode` outright — i.e. directional | ||
| 111 | +chroma is refused there unconditionally, unlike the key-frame path (`~2458`), | ||
| 112 | +which ALREADY decodes directional chroma correctly today (see the existing, | ||
| 113 | +passing `a_real_aomenc_stream_with_directional_chroma_decodes_pixel_exact` | ||
| 114 | +gate). Landing the `~7786` sibling needs angle-delta-for-chroma support added | ||
| 115 | +to that separate reader, plus its own gate; not attempted this round — | ||
| 116 | +smaller in shape than the smooth/paeth work (no known predictor bug blocking | ||
| 117 | +it, just missing plumbing) but independent scope, deferred to a future round. | ||
| 118 | + | ||
| 119 | +## Disposition | ||
| 120 | + | ||
| 121 | +deferred: thread `smooth_neighbor` through luma + add chroma UV-mode | ||
| 122 | +neighbour tracking, then re-attempt this refusal removal — unblocks on | ||
| 123 | +someone picking up the saved attempt diff and the ~9 call-site list above. | ||
| 124 | +deferred: the `~7786` "directional chroma mode (round 2)" sibling in the | ||
| 125 | +inter-frame intra-block path — unblocks independently, no known bug, just | ||
| 126 | +unwritten angle-delta-for-chroma plumbing in that reader. | ||