forge
Explore
Log in

Don't you dare go Hollow

av1intrapred: intrabc TX4 leaf chroma predicts from the frame copy

Browse files at this commit

3ab8e305a49e9b284cd765ddad40771f4dd81762Ahmet Kaan GümüşParent: 7fb533f
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.rsmodified+11 -0
@@ -17050,6 +17050,17 @@ fn decode_leaf8(
17050 Some((yb, _, _)) => Some(yb.clone()),17050 Some((yb, _, _)) => Some(yb.clone()),
17051 None => palette_y_buf,17051 None => palette_y_buf,
17052 };17052 };
17053+ // lane-av1intrapred: the chroma twin of the `palette_y_buf` wrap above --
17054+ // `decode_block` does the same for its own `palette_uv_bufs`
17055+ // (decode.rs's single-TU and multi-TU chroma reads). Without it, an
17056+ // intrabc leaf whose var-tx tree split to TX_4X4 reached the TX4 arm's
17057+ // chroma reads with the override unset: the unit predicted INTRA from
17058+ // the UV mode (intrabc's is DC) instead of copying the frame at the DV,
17059+ // R5 first differing pixel U(184,4), block mi (2,92).
17060+ let palette_uv_bufs = match &intrabc_bufs {
17061+ Some((_, ub, vb)) => Some((ub.clone(), vb.clone())),
17062+ None => palette_uv_bufs,
17063+ };
17053 let (luma_grid, u_grid, v_grid);17064 let (luma_grid, u_grid, v_grid);
17054 if skip {17065 if skip {
17055 // lane-hgkf r2 (same shape as `decode_block`'s own skip branch): an17066 // lane-hgkf r2 (same shape as `decode_block`'s own skip branch): an
lanes/av1intrapred.report.mdmodified+24 -20
@@ -1,4 +1,4 @@
1-# lane-av1-intrapred — stop-report: first divergence is a chroma txb_skip CDF-content divergence at mi (36,66) plane 2, not intra prediction1+# 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
2 2
3 Base 7f863c5f (lane-av1-ibcvtx), worktree edith_codecs-av1intra, branch lane-av1-intrapred.3 Base 7f863c5f (lane-av1-ibcvtx), worktree edith_codecs-av1intra, branch lane-av1-intrapred.
4 Tree left CLEAN (all temporary probes reverted; decode.rs/tile.rs byte-identical to base). No push.4 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.
71 71
72 ---72 ---
73 73
74-# lane-av1-intrapred r2 — the reported CDF fork is FIXED; next fork is intrabc chroma prediction74+# lane-av1-intrapred r2 — the reported CDF fork is FIXED; the follow-up intrabc chroma prediction fork is also FIXED
75 75
76 Base 3f6748d5, same worktree/branch. The reported "chroma txb_skip CDF-content" fork was76 Base 3f6748d5, same worktree/branch. The reported "chroma txb_skip CDF-content" fork was
77 neither the Chroma4 defaults (all four q tables match aom `token_cdfs.h` exactly) nor the77 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
117 * Pre-fix non-vacuity: scratch worktree at 3f6748d5 rebuild reproduces the byte-352 fork117 * Pre-fix non-vacuity: scratch worktree at 3f6748d5 rebuild reproduces the byte-352 fork
118 on W2 and byte-82216 on R5.118 on W2 and byte-82216 on R5.
119 119
120-## Next fork (new class — NOT entropy, NOT the ticket's CDF fork)120+## Next fork — FIXED in the same pass (r2b): intrabc chroma frame-copy prediction
121 121
122 `R5` first differing byte 231864 = chroma U pixel **(184,4)**; 3305 differing bytes, all122 `R5` first differing byte 231864 = chroma U pixel **(184,4)**; 3305 differing bytes, all
123 chroma (U 1730 / V 1575), origin unit = the chroma 4x4 at cpx (184,4), i.e. the 8x8123 chroma (U 1730 / V 1575), origin unit = the chroma 4x4 at cpx (184,4), i.e. the 8x8
124-**intrabc** leaf at luma (368,8), mi **(2,92)**, var-tx TX4 split, luma TU (1,0) coded124+**intrabc** leaf at luma (368,8), mi **(2,92)**, var-tx TX4 split. Entropy was fully
125-`H_ADST`, TU (0,0) `DCT_DCT`, chroma inherits `DCT_DCT` on BOTH sides (ours: probe slot125+aligned (3321/3321 `all_zero` reads rng-identical, luma byte-exact), the DV matched
126-`Some(DctDct)`; aom: `EC_TXTYPE mi=2,92 plane=1 tx_type=0`). The full symbol stream is126+exactly (`EC_DV mi_row=2 mi_col=92 dv_col=-2560 dv_row=0`, same as aom's `mv0=(0,-2560)`,
127-aligned (3321/3321 `all_zero` reads, rng-identical), luma is byte-exact, so this is a127+source = integer-phase copy of U(24,4)), so the divergence was prediction-stage: the TX4
128-**prediction-stage** divergence: the intrabc chroma frame-copy (bilinear at the chroma128+arm's chroma reads override the intra prediction through `palette_uv_bufs`, but only
129-half-pel phase of the block DV) produces different samples than aomdec for this unit and129+`decode_block` wrapped that pair with the leaf's `intrabc_bufs` frame-copy buffers
130-everything predicted off it. Trace line:130+(decode.rs:15833) — `decode_leaf8` wrapped only `palette_y_buf` (lane-t900 r32), so an
131-131+intrabc TX4 leaf's chroma predicted INTRA from the UV mode (intrabc's is DC) instead of
132-```132+copying the frame at the DV.
133-R5: ours U(184,4)=[103,97,107,101] aom=[86,116,55,110]; entropy identical133+
134- (read 2428 U / 2429 V of block mi (2,92) match through their coefficients);134+**Fix (r2b, third hunk):** `decode_leaf8` wraps `palette_uv_bufs` with `intrabc_bufs`'s
135- suspect the chroma DV rounding/clamp in the leaf8 intrabc_bufs path135+`ub`/`vb` right after the `palette_y_buf` wrap — the chroma twin of decode.rs:15833.
136- (mv_to_q4(cpx, dv_col, false) — odd-DV chroma phase) vs libaom's136+
137- av1_predict_intra_block intrabc clamp.137+**Gates after r2b (all machine-captured):**
138-```138+
139-139+* R5: **byte-exact vs aomdec AND ffmpeg** (the stop report's primary gate).
140-W2 shows the same signature (first diff U(168,4), byte 231848).140+* W2 (cq8 re-encode): **byte-exact vs aomdec**.
141+* R9: byte-exact vs ffmpeg (regression clean).
142+* Cached-fixture sweep A1/A2/A3/D1/D2/D3: byte-exact vs their ffmpeg raws.
143+* Targeted tests (intrabc/lossless/screen filters): 14 passed, 0 failed. Full suite on
144+ the r2 fix alone: 607 passed / 0 failed (exit 0).