Pin verdict: r2's neighbour-ref1 filter-ctx fix (b7977cd) is a real, correct
fix but does NOT close fixtures/av1idx-refsel-pin.obu -- 3x repro identical
(149 y mismatches, worst delta 1, frame 8, row 32 col 58). The mismatching
frame (aomdec's frame 8, this decoder's internal r17 index 7) has ZERO
compound blocks -- all 4 32x32 leaves are single-ref -- so the CREF ref1
fix cannot be the cause of THIS fixture's residual defect; keeping it
anyway as an independently-real bug fix.
Isolation (new IFILTER_RS dump, gated EC_AV1_SREF_DUMP, kept as
instrumentation): built an instrumented aomdec (decodemv.c
read_mb_interp_filter, EC_IFILTER_DBG env var, /tmp/libaom-src
decoder-debug target) and traced every switchable_interp read in this
frame. mi(0,0) dir0 (ctx=3) and the next three blocks' reads all decode
identically to aomdec (values AND post-adapt CDF state converted through
AOM_ICDF match byte-for-byte). Exactly one read diverges: mi(0,0) dir1
(ctx=11, the x_filter direction) -- both decoders enter this read holding
the literal default CDF ([27403, 32636, 32768], confirmed against both
crates/ec-av1/src/cdf.rs::SWITCHABLE_INTERP[11] and libaom
entropymode.c's default_switchable_interp_cdf row 11 via the AOM_ICDF
inversion) -- yet we decode symbol=1, aomdec decodes symbol=0 (confirmed
via aomdec's post-adapt CDF shape matching a symbol=0 adaptation, same
direction/magnitude as the confirmed-matching dir0 case).
Matching CDF + matching context + a symbol=0 decode on both sides for the
immediately preceding dir0 read is NOT proof the raw entropy coder
(value/range) state was actually synced entering dir1 -- CDF state is a
pure function of decoded symbols and says nothing about the coder's
internal value/range, so a desync introduced earlier in this exact block
(is_inter, ref_frame, new_mv/zero_mv/ref_mv, or partition reads before
this leaf) that happens to still decode the SAME symbol at dir0 by
coincidence remains a live hypothesis, not ruled out. msac.rs::symbol_fixed
was read against spec 8.2.6 and looks structurally sound; did not find a
defect in it directly, and it is used by thousands of other passing reads
across the suite, making a generic bug there unlikely.
Next step: instrument this crate's own SymbolDecoder value/range
(self.value, self.range) immediately after EVERY symbol read in this
exact block (partition down through mode/mv/ref_frame/is_inter, ahead of
the two interp_filter reads) and diff against an aomdec od_ec_dec trace
of the same (needs a matching dif/rng eprintf added to
av1/decoder/decodemv.c's read path, not just read_mb_interp_filter) --
find the FIRST read in this block where value/range diverges, not just
where a decoded symbol first differs. The mismatching block is
mi_row=8/mi_col=8 (frame's 4th leaf, ref_frame=7) but the diverging
SYMBOL read is on the FIRST leaf mi_row=0/mi_col=0 dir1 -- i.e. the
divergence is a probability-table/entropy-state issue from block 1 that
apparently self-corrects for blocks 2-4's decoded symbol VALUES (all
match aomdec) yet still produces a different final pixel outcome at block
4 -- suggesting the wrong dir1 symbol at block 1 changes block 1's own
x_filter kernel (used for MC) without moving the bitstream position
differently enough to cascade a symbol-level desync, but IS enough to
shift block 4's reconstruction via some other coupling (context array
carrying the wrong filter forward?) -- re-check whether block1's WRONG
x_filter[dir1]=1 (SMOOTH) vs correct 0 (REGULAR) is used as `above_filter`
context for block 3 (mi_row=8,mi_col=0) and beyond, which could
explain why block 4 (not block 1) is where the PIXEL mismatch surfaces
even though block1's own MC output apparently still matched (rows 0-31
all MATCH per the pin's per-plane report).
Instrumented aomdec: /tmp/libaom-src/build/decoder-debug/aomdec, rebuilt
after adding EC_IFILTER_DBG to decodemv.c (patch is outside this repo, in
/tmp/libaom-src, not committed here -- reapply by re-adding the
getenv("EC_IFILTER_DBG") block in read_mb_interp_filter before the
!enable_dual_filter check, then `cd /tmp/libaom-src/build/decoder-debug
&& make -j12 aomdec`).
Class sweep (neighbour-votes-all-its-fields) and the wide-gate unmask are
both DEFERRED to the next round -- the pin still fails, so unmasking the
compound gates would ship an unproven blend again per the r1/r6/r7
history's own lesson.