forge
Explore
Log in

Don't you dare go Hollow

wip(av1): r4 -- EC_RNG global trace finds the real desync read, r3's frame-8 fidx claim falsified

Browse files at this commit

d0ddce625dbafd4d03dcca42606e8de7427d8f01Ahmet Kaan GümüşParent: 8cbebd5
STREAM_HEADER dump extended with is_motion_mode_switchable/enable_interintra_compound/
allow_warped_motion. Checked against the pin: all three are false on every one of its
20 frames -- the motion_mode/OBMC/interintra/warped-motion read paths (confirmed via
libaom decodemv.c grep to be entirely unimplemented in decode.rs: zero hits for
"motion_mode"/"obmc"/"warped"/"interintra") are a real capability gap but NOT this
pin's defect, since the bits that would gate those reads are off throughout.

Ran the existing EC_RNG global trace (msac.rs symbol_fixed, already instrumented a
prior round) on both sides: ours 658 symbol reads for the whole 20-frame stream vs
aomdec 655 -- a genuine 3-read count mismatch, confirming a structural desync
somewhere, not a pure "same reads, wrong probs" bug.

Diffed the two EC_RNG logs read-by-read (rng_before/rng_after/nsyms/symbol, ignoring
the "n=" index since counts differ): identical for the first 538 reads, then:
  ours: rng_before=44723 rng_after=32887 nsyms=2 symbol=0
  aom:  rng_before=44723 rng_after=38110 nsyms=2 symbol=1
Same range state and same nsyms into the read, different decoded symbol -- a real
context/CDF divergence, not a narrowing coincidence. Counting frame-boundary markers
(rng_before=32768, i.e. every SymbolDecoder::new) up to that point: 10 boundaries
passed, so this read is in decode-order frame index 10, NOT frame index 8. Frame
index 8's segment (log lines 363-486, containing the nsyms=3 reads r3 attributed to
the mi(0,0) dir1 switchable_interp mismatch) diffs byte-for-byte identical between
ours and aomdec -- r3's "mismatch frame 8" identification was built on the
fidx-offset trap the r2 handoff already warned about and does not hold up against
this direct value/range trace. The real first divergence is a *later* frame, a
different symbol (nsyms=2, not switchable_interp's nsyms=3), ~25 reads into that
frame's tile.

Not yet identified which flag nsyms=2 at that position corresponds to (no call-site
tag on the shared EC_RNG print -- it's a global counter over every dec.symbol() call
in the crate). Next step: tag EC_RNG (or add a parallel thread-local "current op"
string set right before each dec.symbol() call near candidate binary reads --
skip_mode, is_inter, single/comp ref bits, comp_group_idx, delta_q/delta_lf presence,
palette presence, filter_intra, tx_depth splits) so the divergent read's call site is
named directly, then cross-check that site's context computation against libaom's
matching function for real-frame-10 pixel content (not frame 8).

Masks untouched (compound_references/reference_select refusals still in stream.rs).
No pixel-level re-verification needed yet -- pin still mismatches, unchanged.
crates/ec-av1/src/stream.rsmodified+5 -2
@@ -268,9 +268,12 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
268268 };
269269 if std::env::var_os("EC_AV1_SREF_DUMP").is_some() {
270270 eprintln!(
271- "STREAM_HEADER r17_before={} interpolation_filter={:?} interp_fixed={interp_fixed:?}",
271+ "STREAM_HEADER r17_before={} interpolation_filter={:?} interp_fixed={interp_fixed:?} is_motion_mode_switchable={} enable_interintra_compound={:?} allow_warped_motion={}",
272272 crate::decode::r17_dump_frame_idx(),
273- header.interpolation_filter
273+ header.interpolation_filter,
274+ header.is_motion_mode_switchable,
275+ parser.sequence_header().map(|s| s.enable_interintra_compound),
276+ header.allow_warped_motion,
274277 );
275278 }
276279