forge
Explore
Log in

Don't you dare go Hollow

debug(av1): env-gated dump of frame-2 saved CDF tables, decisive negative result

Browse files at this commit

a45ccae00a952718b1c128479c332c61e817a794Ahmet Kaan GümüşParent: 82a96d2
EC_AV1_DUMP_TABLES dumps the reference-slot CDF tables a frame saves
(partition_w64/w32/w16, skip, new_mv, zero_mv, ref_mv, mv_joint) in the
spec's cumulative-probability orientation. Cross-checked against a matching
libaom decodeframe.c dump (converting its inverted icdf storage back to the
same orientation) on the pinned cdffwd stream: frame 2's saved tables are
byte-identical between the two decoders across every table sampled. This
falsifies the CDF-forwarding hypothesis (stale/never-adapted forwarded
table, specifically the gathered-partition-never-adapted theory) for the
frame-3 partition_w32[ctx=8] divergence — the bug is elsewhere (context
computation entering frame 3, an untabled CDF, or an actual bitstream
desync inside frame 3 itself). Also confirmed by libaom source
(bitreader.h aom_read_symbol_ vs aom_read_cdf_) that libaom's own gathered
partition reads never call update_cdf on the full table either, matching
our symbol_fixed's behavior -- the gathered-adaptation theory was wrong on
both sides independently.
crates/ec-av1/src/stream.rsmodified+18 -0
@@ -236,6 +236,24 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
236236 end_cdfs.reset_counts();
237237 end_cdfs
238238 };
239+ if let Ok(path) = std::env::var("EC_AV1_DUMP_TABLES") {
240+ use std::io::Write;
241+ if let Ok(mut f) = std::fs::OpenOptions::new()
242+ .create(true)
243+ .append(true)
244+ .open(&path)
245+ {
246+ let _ = writeln!(f, "=== frame idx={} ===", pictures.len());
247+ let _ = writeln!(f, "partition_w64 {:?}", stored_cdfs.partition_w64);
248+ let _ = writeln!(f, "partition_w32 {:?}", stored_cdfs.partition_w32);
249+ let _ = writeln!(f, "partition_w16 {:?}", stored_cdfs.partition_w16);
250+ let _ = writeln!(f, "skip {:?}", stored_cdfs.skip);
251+ let _ = writeln!(f, "new_mv {:?}", stored_cdfs.new_mv);
252+ let _ = writeln!(f, "zero_mv {:?}", stored_cdfs.zero_mv);
253+ let _ = writeln!(f, "ref_mv {:?}", stored_cdfs.ref_mv);
254+ let _ = writeln!(f, "mv_joint {:?}", stored_cdfs.mv_joint);
255+ }
256+ }
239257 for i in 0..NUM_REF_FRAMES {
240258 if header.refresh_frame_flags & (1 << i) != 0 {
241259 cdf_slots[i] = Some(stored_cdfs.clone());