diff --git a/crates/ec-av1/src/cdf_state.rs b/crates/ec-av1/src/cdf_state.rs index dbdf2d10..26008f56 100644 --- a/crates/ec-av1/src/cdf_state.rs +++ b/crates/ec-av1/src/cdf_state.rs @@ -1038,6 +1038,18 @@ impl Cdfs { tx_type: None, eob_pt_class1: None, }, + // lane-comppin r4 (REVERTED, see r4's own commit message): + // `Some(inter_tx_type_32)` looked wrong against aomdec's 32x32 + // trace (degenerate 1-symbol EC_TXTYPE_VAL=0 read) and matches + // spec `av1_get_ext_tx_set_type`'s `EXT_TX_SET_DCTONLY` for + // every tx_size_sqr >= TX_32X32 -- but flipping this to `None` + // regressed 16 previously-green `ec-av1` tests (full-suite count + // went 217/217 -> 201/216), and did NOT fix the pin's own + // eob_pt desync either (still reads 6 instead of aomdec's 5 + // right after this read, proving eob_pt's own context/table + // selection is a SEPARATE, still-unfound bug upstream of this + // one) -- kept `Some` pending a real fix that ports both without + // breaking the 16. TxbSet::Luma32Inter => TxbTables { side: 32, txb_skip: &mut self.txb_skip_luma_32, diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index a2e070f6..549897fe 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -62,6 +62,11 @@ pub(crate) fn filter_intra_hits() -> usize { /// before/after counter pattern as [`FILTER_INTRA_HITS`], proving a stream /// exercised `apply_deblock` rather than every edge landing on level 0. static DEBLOCK_HITS: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0); +/// lane-comppin r4: decode-order picture counter for `EC_AV1_PREFILT_DUMP`, +/// mirroring stream.rs's `pictures_decoded` so the two dumps index +/// identically against aomdec's own `ec_frame_idx` in decodeframe.c. +static PREFILT_PICTURE_IDX: std::sync::atomic::AtomicUsize = + std::sync::atomic::AtomicUsize::new(0); /// Current value of [`DEBLOCK_HITS`]. pub(crate) fn deblock_hits() -> usize { @@ -3613,6 +3618,22 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( } } + // lane-comppin r4: pre-loop-filter decode-order dump, matching aomdec's + // own EC_AV1_PREFILT_DUMP shape (decodeframe.c ~5451) -- diffs against + // that isolate whether a decode-order frame's mismatch already exists + // in reconstruction (this dump) vs is introduced by the loop filter + // (EC_AV1_DECODE_ORDER_DUMP's post-filter dump). + if let Ok(path) = std::env::var("EC_AV1_PREFILT_DUMP") { + use std::io::Write; + let idx = PREFILT_PICTURE_IDX.fetch_add(1, std::sync::atomic::Ordering::SeqCst); + if let Ok(mut f) = std::fs::File::create(format!("{path}.f{idx}")) { + let _ = f.write_all(&y.data); + let _ = f.write_all(&u.data); + let _ = f.write_all(&v.data); + } + } else { + PREFILT_PICTURE_IDX.fetch_add(1, std::sync::atomic::Ordering::SeqCst); + } apply_deblock(&mut y, &mut u, &mut v, loop_filter, &neighbours); apply_cdef(&mut y, &mut u, &mut v, cdef, &neighbours); @@ -7190,6 +7211,22 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( } } + // lane-comppin r4: pre-loop-filter decode-order dump, matching aomdec's + // own EC_AV1_PREFILT_DUMP shape (decodeframe.c ~5451) -- diffs against + // that isolate whether a decode-order frame's mismatch already exists + // in reconstruction (this dump) vs is introduced by the loop filter + // (EC_AV1_DECODE_ORDER_DUMP's post-filter dump). + if let Ok(path) = std::env::var("EC_AV1_PREFILT_DUMP") { + use std::io::Write; + let idx = PREFILT_PICTURE_IDX.fetch_add(1, std::sync::atomic::Ordering::SeqCst); + if let Ok(mut f) = std::fs::File::create(format!("{path}.f{idx}")) { + let _ = f.write_all(&y.data); + let _ = f.write_all(&u.data); + let _ = f.write_all(&v.data); + } + } else { + PREFILT_PICTURE_IDX.fetch_add(1, std::sync::atomic::Ordering::SeqCst); + } apply_deblock(&mut y, &mut u, &mut v, loop_filter, &neighbours); apply_cdef(&mut y, &mut u, &mut v, cdef, &neighbours);