From 3ab8e305a49e9b284cd765ddad40771f4dd81762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 24 Sep 2026 23:28:01 +0300 Subject: [PATCH] av1intrapred: intrabc TX4 leaf chroma predicts from the frame copy decode_leaf8 wrapped only palette_y_buf with intrabc_bufs (lane-t900 r32); the TX4 arm's chroma reads overrode prediction from the raw palette_uv_bufs, so an intrabc leaf whose var-tx tree split to TX_4X4 predicted its chroma units INTRA from the UV mode (intrabc's is DC_PRED) instead of copying the frame at the DV. decode_block already wraps its palette_uv_bufs with the intrabc copies (this file's single-TU/multi-TU chroma reads) - decode_leaf8 now does the same chroma twin wrap. With the previous INTRABC_CHROMA_TX arming fix, R5 (testsrc2 640x360 sb64 maxp64 cq20 screen intrabc, 1 frame) is now byte-exact vs aomdec AND ffmpeg; W2 (cq8 re-encode) byte-exact vs aomdec; R9 stays byte-exact vs ffmpeg; cached A1-A3/D1-D3 sweep byte-exact. Targeted intrabc/ lossless/screen tests: 14 passed, 0 failed. Full suite at the parent commit: 607 passed / 0 failed. --- crates/ec-av1/src/decode.rs | 11 +++++++++ lanes/av1intrapred.report.md | 44 ++++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 9cc66916..bd8d3e3c 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -17050,6 +17050,17 @@ fn decode_leaf8( Some((yb, _, _)) => Some(yb.clone()), None => palette_y_buf, }; + // lane-av1intrapred: the chroma twin of the `palette_y_buf` wrap above -- + // `decode_block` does the same for its own `palette_uv_bufs` + // (decode.rs's single-TU and multi-TU chroma reads). Without it, an + // intrabc leaf whose var-tx tree split to TX_4X4 reached the TX4 arm's + // chroma reads with the override unset: the unit predicted INTRA from + // the UV mode (intrabc's is DC) instead of copying the frame at the DV, + // R5 first differing pixel U(184,4), block mi (2,92). + let palette_uv_bufs = match &intrabc_bufs { + Some((_, ub, vb)) => Some((ub.clone(), vb.clone())), + None => palette_uv_bufs, + }; let (luma_grid, u_grid, v_grid); if skip { // lane-hgkf r2 (same shape as `decode_block`'s own skip branch): an diff --git a/lanes/av1intrapred.report.md b/lanes/av1intrapred.report.md index cdf199ce..cc0ba248 100644 --- a/lanes/av1intrapred.report.md +++ b/lanes/av1intrapred.report.md @@ -1,4 +1,4 @@ -# lane-av1-intrapred — stop-report: first divergence is a chroma txb_skip CDF-content divergence at mi (36,66) plane 2, not intra prediction +# lane-av1-intrapred — r2: the chroma txb_skip CDF fork (intrabc TX4 chroma tx inheritance) and the intrabc chroma frame-copy prediction fork are FIXED; R5/W2 byte-exact Base 7f863c5f (lane-av1-ibcvtx), worktree edith_codecs-av1intra, branch lane-av1-intrapred. Tree left CLEAN (all temporary probes reverted; decode.rs/tile.rs byte-identical to base). No push. @@ -71,7 +71,7 @@ which I could not complete within this run's budget. --- -# lane-av1-intrapred r2 — the reported CDF fork is FIXED; next fork is intrabc chroma prediction +# lane-av1-intrapred r2 — the reported CDF fork is FIXED; the follow-up intrabc chroma prediction fork is also FIXED Base 3f6748d5, same worktree/branch. The reported "chroma txb_skip CDF-content" fork was neither the Chroma4 defaults (all four q tables match aom `token_cdfs.h` exactly) nor the @@ -117,24 +117,28 @@ adaptation — it was the missing `INTRABC_CHROMA_TX` arming in `decode_leaf8`'s * Pre-fix non-vacuity: scratch worktree at 3f6748d5 rebuild reproduces the byte-352 fork on W2 and byte-82216 on R5. -## Next fork (new class — NOT entropy, NOT the ticket's CDF fork) +## Next fork — FIXED in the same pass (r2b): intrabc chroma frame-copy prediction `R5` first differing byte 231864 = chroma U pixel **(184,4)**; 3305 differing bytes, all chroma (U 1730 / V 1575), origin unit = the chroma 4x4 at cpx (184,4), i.e. the 8x8 -**intrabc** leaf at luma (368,8), mi **(2,92)**, var-tx TX4 split, luma TU (1,0) coded -`H_ADST`, TU (0,0) `DCT_DCT`, chroma inherits `DCT_DCT` on BOTH sides (ours: probe slot -`Some(DctDct)`; aom: `EC_TXTYPE mi=2,92 plane=1 tx_type=0`). The full symbol stream is -aligned (3321/3321 `all_zero` reads, rng-identical), luma is byte-exact, so this is a -**prediction-stage** divergence: the intrabc chroma frame-copy (bilinear at the chroma -half-pel phase of the block DV) produces different samples than aomdec for this unit and -everything predicted off it. Trace line: - -``` -R5: ours U(184,4)=[103,97,107,101] aom=[86,116,55,110]; entropy identical - (read 2428 U / 2429 V of block mi (2,92) match through their coefficients); - suspect the chroma DV rounding/clamp in the leaf8 intrabc_bufs path - (mv_to_q4(cpx, dv_col, false) — odd-DV chroma phase) vs libaom's - av1_predict_intra_block intrabc clamp. -``` - -W2 shows the same signature (first diff U(168,4), byte 231848). +**intrabc** leaf at luma (368,8), mi **(2,92)**, var-tx TX4 split. Entropy was fully +aligned (3321/3321 `all_zero` reads rng-identical, luma byte-exact), the DV matched +exactly (`EC_DV mi_row=2 mi_col=92 dv_col=-2560 dv_row=0`, same as aom's `mv0=(0,-2560)`, +source = integer-phase copy of U(24,4)), so the divergence was prediction-stage: the TX4 +arm's chroma reads override the intra prediction through `palette_uv_bufs`, but only +`decode_block` wrapped that pair with the leaf's `intrabc_bufs` frame-copy buffers +(decode.rs:15833) — `decode_leaf8` wrapped only `palette_y_buf` (lane-t900 r32), so an +intrabc TX4 leaf's chroma predicted INTRA from the UV mode (intrabc's is DC) instead of +copying the frame at the DV. + +**Fix (r2b, third hunk):** `decode_leaf8` wraps `palette_uv_bufs` with `intrabc_bufs`'s +`ub`/`vb` right after the `palette_y_buf` wrap — the chroma twin of decode.rs:15833. + +**Gates after r2b (all machine-captured):** + +* R5: **byte-exact vs aomdec AND ffmpeg** (the stop report's primary gate). +* W2 (cq8 re-encode): **byte-exact vs aomdec**. +* R9: byte-exact vs ffmpeg (regression clean). +* Cached-fixture sweep A1/A2/A3/D1/D2/D3: byte-exact vs their ffmpeg raws. +* Targeted tests (intrabc/lossless/screen filters): 14 passed, 0 failed. Full suite on + the r2 fix alone: 607 passed / 0 failed (exit 0).