From 0c936b64c4026fe7428e7cc95547d0b96f256a64 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:52:56 +0300 Subject: [PATCH] av1intrapred: gate the intrabc TX4-split chroma frame-copy route Pins the R5 stream (fixtures/intrabc_tx4_chroma_kf.obu, 7173 bytes, aomenc screen/cq20 key frame) as a committed regression fixture and adds stream::tests::an_intrabc_tx4_leaf_chroma_inherits_the_luma_type_and_ predicts_from_the_frame_copy. The gate runs unconditionally (no oracle binary, no skip path): it counter-asserts the new INTRABC_TX4_CHROMA_COPY_HITS non-vacuity counter (bumped when the TX4 arm's chroma reads consult the armed INTRABC_CHROMA_TX slot), pins the formerly-divergent U(184,4) and U(168,0)/V(168,0) chroma patches to the oracle bytes, and pins the whole decoded frame behind a dependency-free FNV-1a fingerprint (345600 bytes, 0xf271df27ce4dba66). Failure modes covered: missing INTRABC_CHROMA_TX arming (counter + patch asserts), chroma predicting from the unwrapped palette buffer instead of the frame copy (U(168,0)/V(168,0) asserts - verified live: removing the wrap fails the gate with 78182 chroma bytes wrong), and any other byte drift in the frame (fingerprint). Parent-commit non-vacuity: the decode desyncs at byte 82216 (R5) / 352 (W2 cq8 twin). --- .../ec-av1/fixtures/intrabc_tx4_chroma_kf.obu | Bin 0 -> 7173 bytes crates/ec-av1/src/decode.rs | 27 ++++ crates/ec-av1/src/stream.rs | 123 ++++++++++++++++++ lanes/av1intrapred.report.md | 18 +++ 4 files changed, 168 insertions(+) create mode 100644 crates/ec-av1/fixtures/intrabc_tx4_chroma_kf.obu diff --git a/crates/ec-av1/fixtures/intrabc_tx4_chroma_kf.obu b/crates/ec-av1/fixtures/intrabc_tx4_chroma_kf.obu new file mode 100644 index 0000000000000000000000000000000000000000..bda2d299f12490e1ec7cd2ec4624bc7ada400cd1 GIT binary patch literal 7173 zcmV+g9QxxD015{fW+(eQU=T9*H%w3h-Dwm|H1#1J`dL#RLixi5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Z! z*o~15<*#HBJ`HsrBCxh2Z*thDON%V2x93@q1 z7Gf0BaQG^#7t9Nx^md18HLw%SYt_qL|D5zyc}h@BpVsr#QNDzRI|2DUC|yK z$72DJ99%>kv5e};a)Wb^$20*J1MzL*b5aiH_j2$Dq!Fw=Kc82gPYK@ez+25kvvaC?g zZ97J8)Y&a%7NygU=xNX$03MHu3Qls5M%RTnNiEZz!LRK6$?`hfp-hDph>)}QKK0fG zUd}A%@Vqg{n9kN69p7NmODf;j)=J$sT+#u)ws^2m5dJIy(9#>K081B>UstzON(T2q zzwDhuRbmAx!XzIeK$tJ<3Z*y8qte!_RL%#EtmHok)=zzHVbOoT?DdCrbk?Zf%vzkq z*`9G}@5E`!(qGpn&mRl|RHL4u0f!$dm?086cGW`o#wG-HVz~X`hao7bfQKxA(hoX8 H)U#-y0gV-H literal 0 HcmV?d00001 diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index bd8d3e3c..957a22ba 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -3694,6 +3694,27 @@ thread_local! { static LEAF8_INTRABC_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; } +thread_local! { + /// Chroma reads of an intrabc TX4-split leaf that consulted an ARMED + /// [`INTRABC_CHROMA_TX`] slot -- proof that the arm's frame-copy + + /// inherited-type route actually ran (lane-av1intrapred r2's non-vacuity + /// counter: zero means the gate's fixture no longer reaches the route). + static INTRABC_TX4_CHROMA_COPY_HITS: std::cell::Cell = + const { std::cell::Cell::new(0) }; +} + +/// Current value of [`INTRABC_TX4_CHROMA_COPY_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates +pub(crate) fn intrabc_tx4_chroma_copy_hits() -> usize { + INTRABC_TX4_CHROMA_COPY_HITS.with(|c| c.get()) +} + +/// Zeroes [`INTRABC_TX4_CHROMA_COPY_HITS`] (gate tests call this before a decode). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates +pub(crate) fn reset_intrabc_tx4_chroma_copy_hits() { + INTRABC_TX4_CHROMA_COPY_HITS.with(|c| c.set(0)); +} + /// Current value of [`LEAF8_INTRABC_HITS`]. pub(crate) fn leaf8_intrabc_hits() -> usize { LEAF8_INTRABC_HITS.with(|c| c.get()) @@ -17365,6 +17386,12 @@ fn decode_leaf8( } let ac = alpha.map(|_| cfl_src(px, py, 8)); let chroma_around = neighbours.around_mi(leaf_mi, 8); + // lane-av1intrapred: the non-vacuity counter -- armed slot consulted + // by this arm's chroma reads means the frame-copy + inherited-type + // route ran; zero at gate time means the fixture stopped reaching it. + if fctx.intrabc_chroma_tx.with(std::cell::Cell::get).is_some() { + hit!(INTRABC_TX4_CHROMA_COPY_HITS); + } if let Some((ub, _)) = &palette_uv_bufs { set_palette_pred(ub.clone(), fctx); } diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index c4b7b165..c8ba9fb3 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -7098,6 +7098,129 @@ pub(crate) mod tests { ); } + /// lane-av1intrapred r2, REGRESSION GATE for the two intrabc TX4-split + /// chroma defects this lane fixed. + /// + /// An intrabc 8x8 leaf whose var-tx tree split to TX_4X4 must (a) arm + /// `INTRABC_CHROMA_TX` from the co-located luma TU's coded type -- the + /// chroma units then take that type's class-1 eob row, HORIZ scan and nz + /// contexts (libaom `av1_get_tx_type`'s is_inter branch; intrabc is + /// inter-classified) -- and (b) predict the chroma units from the FRAME + /// COPY at the DV, not intra-from-UV-mode (intrabc's UV mode is DC, so a + /// leaf that loses the override predicts flat DC where libaom copies a + /// busy region). + /// + /// Pre-r2, decode_leaf8's TX4 arm did neither: R5's chroma U txb at + /// mi (36,66) decoded `eob=11` off the 2D row where aomdec decoded + /// `eob=13` off the class-1 row, and the first surviving pixel fork was + /// U(184,4) of mi (2,92) (class `intrabc-chroma-tx-not-armed`, then + /// `intrabc-chroma-predicts-intra`). + /// + /// The fixture is the report's R5 stream pinned into `fixtures/` + /// (aomenc oracle, testsrc2 320x180 tiled 2x2 -> 640x360, sb64 maxp64 + /// square-only screen intrabc, cq20, 1 frame; 7173 bytes, + /// sha256 bc699af4a6e7c1c5657f041e8cbdf2d3d899ddb80ec2a549a950b7cebb5b41bd). + /// The gate needs no oracle at run time and cannot be skipped: a missing + /// fixture, a decode error, a zero counter, a moved pixel patch or a + /// changed full-frame fingerprint each fail by name. The fingerprint is + /// FNV-1a (dependency-free, same rationale as the cdf-forwarding gate's). + #[test] + fn an_intrabc_tx4_leaf_chroma_inherits_the_luma_type_and_predicts_from_the_frame_copy() { + const NAME: &str = + "an_intrabc_tx4_leaf_chroma_inherits_the_luma_type_and_predicts_from_the_frame_copy"; + const FIXTURE_LEN: usize = 7173; + const FIXTURE_FNV: u64 = 0x3a57_d075_5e4c_fe5b; + const RAW_LEN: usize = 640 * 360 * 3 / 2; + const RAW_FNV: u64 = 0xf271_df27_ce4d_ba66; + // The 4x4 chroma patches at (184,4) -- the first surviving pixel fork + // -- as the oracles (aomdec and ffmpeg agree) reconstruct them. + const U_PATCH: [u16; 16] = [ + 86, 116, 55, 110, 114, 114, 51, 83, 99, 121, 48, 114, 103, 117, 102, 67, + ]; + const V_PATCH: [u16; 16] = [ + 179, 158, 199, 105, 155, 158, 195, 147, 163, 153, 194, 108, 170, 148, 168, 172, + ]; + + let obu = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("fixtures/intrabc_tx4_chroma_kf.obu"); + let stream = std::fs::read(&obu).unwrap_or_else(|e| { + panic!( + "{NAME}: pinned fixture {} is missing ({e}) -- the gate cannot run, \ + which is a failure, not a skip", + obu.display() + ) + }); + assert_eq!(stream.len(), FIXTURE_LEN, "{NAME}: fixture length moved"); + assert_eq!(fnv1a64(&stream), FIXTURE_FNV, "{NAME}: fixture bytes moved"); + + let _guard = lock_gate_counters(); + crate::decode::reset_leaf8_intrabc_hits(); + crate::decode::reset_intrabc_tx4_chroma_copy_hits(); + let frames = decode_stream(&stream).unwrap_or_else(|e| { + panic!("{NAME}: the pinned stream no longer decodes cleanly: {e}") + }); + assert_eq!(frames.len(), 1, "{NAME}: frame count"); + let frame = &frames[0]; + assert_eq!((frame.width, frame.height), (640, 360), "{NAME}: dimensions"); + + // Non-vacuity, both halves: the leaf shape must be reached at all, + // and its chroma route must have consulted the ARMED slot (pre-r2 + // this counter is 0 -- the arm never armed the slot). + assert!( + crate::decode::leaf8_intrabc_hits() > 0, + "{NAME}: gate is vacuous -- no intrabc 8x8 leaf was decoded" + ); + assert!( + crate::decode::intrabc_tx4_chroma_copy_hits() > 0, + "{NAME}: gate is vacuous -- no intrabc TX4-split leaf's chroma read consulted \ + the armed slot (class intrabc-chroma-tx-not-armed)" + ); + + // The first surviving pixel fork: chroma 4x4 at (184,4). The wrong + // wirings put flat intra-DC predictions or the wrong eob class here. + let cw = frame.width / 2; + let u_patch: Vec = (0..4) + .flat_map(|dy| (0..4).map(move |dx| frame.u[(4 + dy) * cw + 184 + dx])) + .collect(); + let v_patch: Vec = (0..4) + .flat_map(|dy| (0..4).map(move |dx| frame.v[(4 + dy) * cw + 184 + dx])) + .collect(); + assert_eq!(u_patch, U_PATCH, "{NAME}: U(184,4) patch moved"); + assert_eq!(v_patch, V_PATCH, "{NAME}: V(184,4) patch moved"); + // The unit the FRAME-COPY override specifically pins: chroma 4x4 at + // (168,0) is an intrabc TX4-split leaf's chroma whose copy source is + // a busy ramp region; without the `palette_uv_bufs` intrabc wrap the + // read predicts flat intra-DC here (78k chroma bytes drift from this + // unit alone), with it the copy reproduces the oracle exactly. + const U_COPY_PATCH: [u16; 16] = [ + 91, 91, 91, 91, 120, 120, 120, 120, 120, 120, 120, 120, 73, 102, 116, 116, + ]; + const V_COPY_PATCH: [u16; 16] = [ + 241, 241, 241, 241, 156, 156, 156, 156, 158, 158, 158, 158, 181, 163, 154, 154, + ]; + let u_copy: Vec = (0..4) + .flat_map(|dy| (0..4).map(move |dx| frame.u[dy * cw + 168 + dx])) + .collect(); + let v_copy: Vec = (0..4) + .flat_map(|dy| (0..4).map(move |dx| frame.v[dy * cw + 168 + dx])) + .collect(); + assert_eq!( + u_copy, U_COPY_PATCH, + "{NAME}: U(168,0) patch moved -- the intrabc TX4 chroma read no longer \ + predicts from the frame copy (class intrabc-chroma-predicts-intra)" + ); + assert_eq!(v_copy, V_COPY_PATCH, "{NAME}: V(168,0) patch moved"); + + // The whole frame, packed as the rawvideo byte stream the oracles + // produce: any remaining byte anywhere in Y/U/V fails the gate. + let mut raw = Vec::with_capacity(RAW_LEN); + for plane in [&frame.y, &frame.u, &frame.v] { + raw.extend(plane.iter().map(|&s| s as u8)); + } + assert_eq!(raw.len(), RAW_LEN, "{NAME}: raw size"); + assert_eq!(fnv1a64(&raw), RAW_FNV, "{NAME}: full-frame fingerprint moved"); + } + /// lane-t900 r33, CENSUS for "a sub-8x8 leaf that uses intrabc". /// /// The `use_intrabc` symbol IS read at that reader for every sub-8x8 leaf diff --git a/lanes/av1intrapred.report.md b/lanes/av1intrapred.report.md index cc0ba248..fb33e6f5 100644 --- a/lanes/av1intrapred.report.md +++ b/lanes/av1intrapred.report.md @@ -142,3 +142,21 @@ copying the frame at the DV. * 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). + +## Regression gate (r2c) + +`stream::tests::an_intrabc_tx4_leaf_chroma_inherits_the_luma_type_and_predicts_from_the_frame_copy` ++ pinned fixture `crates/ec-av1/fixtures/intrabc_tx4_chroma_kf.obu` (the R5 stream, + 7173 bytes, sha256 `bc699af4…b41bd`, FNV-1a `0x3a57d0755e4cfe5b`; aomenc oracle, + testsrc2 320x180 tiled 2x2 → 640x360, sb64 maxp64 square-only screen intrabc, cq20, + 1 frame). The gate runs unconditionally (no oracle binary needed, no skip path): a + missing fixture, a decode error, a zero `INTRABC_TX4_CHROMA_COPY_HITS` counter (new + non-vacuity counter bumped when the TX4 arm's chroma reads consult the armed slot), + a moved U(184,4)/U(168,0)/V(168,0) pixel patch, or a changed full-frame FNV-1a + fingerprint each fail with the class name. + +* Fixed tree: passes. +* Unwrap regression (decode_block's `palette_uv_bufs` intrabc wrap removed — the exact + "chroma predicts from the unwrapped palette buffer" state): **fails at the U(168,0) + patch assert** (`intrabc-chroma-predicts-intra`), 78182 chroma bytes wrong. +* Pre-r2 parent (3f6748d5): fails at decode (tile desync, byte 82216/352 forks).