From d785309b2f40dd3b23f64abd7db82846ab28559e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 25 Sep 2026 15:56:03 +0300 Subject: [PATCH] ec-av1: lane-av1-422kf -- the frame-0 U (0,23) first diff fixed: decode_rect_split's chroma_tiled arm never set the uv-palette prediction, so the square 4:2:2 chroma rows of a uv-palette strip decoded as plain DC (entropy in sync: pre-filter luma byte-exact and the unit's coefficient read pairs with aomdec by rng at both ends 48179/64520, levels identical); the arm now windows m.palette_uv per unit like every other chroma arm; U (0,23) decodes 49 == oracle, frame-0 U final diffs 4491->1774, V 4888->2165, pre-filter 3148->533, chroma422_square=24 (non-vacuity); remaining class named for the next lane at U (108,72)/V (48,0); header refusal stays unconditional, read_coeffs_rect untouched, cargo check 0 warnings, refusal-by-name + 420 aomenc gate green; report lanes/av1422kf.report.md --- crates/ec-av1/src/decode.rs | 14 +++++++ lanes/av1422kf.report.md | 82 +++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 lanes/av1422kf.report.md diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 13d39523..6e5e9abd 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -10666,6 +10666,20 @@ fn decode_rect_split( ), ) }); + // lane-av1-422kf: the palette colour map is consumed per + // unit here like every other chroma arm (`av1_visit_palette` + // feeds the whole plane block; window it to this unit). + // Without this the square chroma rows decoded a uv-palette + // strip's chroma as plain DC (class same-symbols-silent- + // prediction: the rng stayed in sync, only the prediction + // was dropped). + if let Some((ub, vb)) = &m.palette_uv { + let buf = if plane_idx == 1 { ub } else { vb }; + set_palette_pred( + palette_window(buf, chroma_w, cu_col * uw, cu_row * uh, uw, uh), + fctx, + ); + } // 32x32 does not fit read_coeffs_rect's scratch (768). The // square reader is the path every other 32x32 chroma unit uses. let levels = if uw == uh { diff --git a/lanes/av1422kf.report.md b/lanes/av1422kf.report.md new file mode 100644 index 00000000..e6929aac --- /dev/null +++ b/lanes/av1422kf.report.md @@ -0,0 +1,82 @@ +# lane-av1-422kf — the frame-0 U (0, 23) first diff: NAMED and FIXED (one +# missing arm in [`decode_rect_split`]'s chroma_tiled walk: the uv-palette +# prediction was never set, so the square 4:2:2 chroma rows decoded a +# uv-palette strip's chroma as plain DC) + +## Outcome + +1. NAMED the sample: frame 0, plane U, row 0, col 23, ours 50 vs oracle 49. + The parent attributed the class to [`decode_rect_split`]'s own-chroma + keyframe gap; this lane localized it to the exact unit and mechanism. +2. The owning unit: chroma 8x8 at chroma px (24, 0) — the square chroma of a + 16x8 luma strip at luma px (48..63, rows 0..7) — pushed by + [`decode_rect_split`]'s chroma_tiled `(8, 8)` arm through `read_plane` + (backtrace: inline_intra ← read_plane ← decode_rect_split ← + decode_leaf_rect). +3. Entropy PROVEN in sync: pre-loop-filter frame-0 LUMA is byte-exact against + the oracle's `EC_AV1_PREFILT_DUMP`, and the U/V coefficient read of the + unit pairs with the oracle by rng at BOTH ends (ours rng0=48179 / rng1= + 64520 == the oracle's `EC_COEFF plane=1 tx_size=1 mi_row=0 mi_col=12 + rng=48179` and the following V unit's rng=64520). Same symbols, same + levels (±1 at scan c=9/10/21, libaom dequant ±63 == ac_q(8-bit, 56)=63 — + note the oracle's `pos=` fields are column-major; 3/4/6 there == raster + 24/32/48 here), so the divergence was prediction-side only. +4. The paired oracle EC_ISTEP ladder for the strip (skip/cdef/dq/mode/ + angle_y/uv_mode/angle_uv — every value and rng identical to ours) plus the + oracle's EC_PALSYN line (`y=2`) identified the mechanism: the strip is a + **uv-PALETTE block**. Our `chroma_tiled` arm — uniquely among the chroma + arms — never called `set_palette_pred`, so `read_plane` consumed no palette + prediction and reconstructed plain DC (ours flat 97 where the oracle has + the palette colour map). Class: same-symbols-silent-prediction. +5. FIX (14 lines, one arm): the chroma_tiled unit loop now sets the palette + prediction per unit per plane (`palette_window` of `m.palette_uv` to the + unit's rect), mirroring the skip/lossless/unsplit arms. 4:2:0 and 4:4:4 + untouched unless `m.palette_uv` is Some (previously broken output anyway). +6. MEASURED (pinned fixture, frame 0, single-frame cut sha256 + `3dd3f768ef553c02316848c2d3184c3765030c0a6fcb95887e4719add9ded3af` — first + OBU prefix of the pinned 22-frame t422.obu; local `EC_AV1_ALLOW_422_PROBE` + bypass, reverted byte-identical after): + - U (0, 23) now decodes **49 == oracle final 49** — the named sample is + EXACT. + - U final diffs 4491 → **1774**; V final diffs 4888 → **2165**; U + pre-filter recon diffs 3148 → **533**. + - `chroma422_square` counter = 24 on this frame (the fixed arm provably + ran; non-vacuity). +7. REMAINING class for the next lane: U pre-filter diffs now start at + (108, 72) (rows 72..79, then 104+; V first diff (48, 0)) — chroma of the + 16x8 strip at chroma (96, 72) and the 16x32 strip at (112, 64): NOT the + palette arm fixed here (both decoded with their own modes); needs its own + localization. Frame 0 is still not pixel-exact, so the + "delete the header refusal" condition stays unmet. + +## Decision + +- The named col-23 sample WAS one arm in [`decode_rect_split`] — fixed, not + punted. The frame-9 [`read_coeffs_rect`] scratch panic is untouched + (another lane's, and the single-frame cut sidesteps it). The four TX_4X8 + chunk and the Some(3) offset are untouched. `read_coeffs_rect` untouched. +- Header refusal STAYS in `stream.rs`, unconditional (no env gate in the + commit; verified firing by name without the env after revert). + +## Verification + +- `cargo check -p ec-av1` (target `~/.cache/cargo-target-av1422kf`): 0 + warnings, 0 errors. +- 420 gate green under `EC_AV1_REQUIRE_AOMENC=1`: + `stream::tests::a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_ + whose_tx_split_decodes_pixel_exact`: 1 passed, 0 failed. +- `stream::tests::a_non_420_subsampled_sequence_header_is_refused_by_name`: + 1 passed, 0 failed (and the example probe refuses the fixture by name + without the env). +- `git diff` after the bypass revert carries ONLY the decode.rs fix; all + temporary EC_KF422DBG/TEMPQM probes and the local bypass are out. + +## State + +- Commit on lane-av1-422kf (no push): the chroma_tiled palette fix + this + report. +- Next stop named for the owning lane: U (108, 72) / V (48, 0) pre-filter + recon class at the (96, 72) 16x8 and (112, 64) 16x32 strips' own chroma — + same localization recipe applies (single-frame fixture + rng pairing + against `$HOME/.cache/aom-oracle/build` aomdec, `EC_AV1_ALLOW_422_PROBE` + local-only).