COMPILES. No behaviour change: new EC_AV1_EOBPT_CDF-gated
`debug_state()`/eprintln! diagnostics only (msac.rs's new `pub(crate) fn
debug_state`, decode.rs's three new state prints in `read_coeffs` and
`read_eob`), same pattern as every prior round's instrumentation.
R6'S OWN PLAN'S STEP 1/2 (msac.rs correctness) IS NOW CLOSED, NEGATIVE:
hand-derived `symbol_fixed` (msac.rs:301-329) against libaom's actual
`od_ec_decode_cdf_q15` source (`/tmp/libaom-src/aom_dsp/entdec.c:204`,
read fresh this round, not from memory) term-by-term for nsyms=11
specifically -- `N = nsyms - 1`, loop increments `ret` before indexing
`icdf[++ret]`, `v = ((r>>8)*(icdf[ret]>>EC_PROB_SHIFT))>>(7-EC_PROB_SHIFT)
+ EC_MIN_PROB*(N-ret)`, loop continues `while (c < v)`. This is
algebraically IDENTICAL to our `cur = (((range>>8)*(f>>EC_PROB_SHIFT))
>>(7-EC_PROB_SHIFT)) + EC_MIN_PROB*(nsyms-1-symbol)`, loop `while value
< cur`. nsyms=11 is not special-cased anywhere in either implementation.
r5's suspicion (1) is FALSIFIED -- do not re-open without new evidence.
DECISIVE NEW EVIDENCE (this round's actual find): added a
`debug_state()` accessor to `SymbolDecoder` and printed `(range, value)`
before/after the `all_zero` (txb_skip) read, after the `tx_type` read,
and entering `eob_pt` -- then added the SAME state to aomdec's
`decodetxb.c` (`EC_AV1_EOBPT_STATE_IN`, plus `rng_before` on the
existing `EC_PLANE` trace). Result: **the coder state ALREADY diverges
before the `txb_skip` read even starts** -- ours enters at
`range=46855`, aomdec enters at `rng_before=50720`. So r5's "CDF +
symbol byte-identical at tx_type/eob_pt" was real but downstream of an
earlier, silent divergence; walking back from there:
Between `EC_MV` (motion vector, matches exactly: `mv=(-2,-8)` both
sides) and `EC_TXBCTX`/`EC_PLANE` (first plane's coeff decode), the ONLY
symbol read possible on this path is the switchable interpolation
filter (`resolve_interp_filter`, decode.rs:3726 / libaom's
`read_mb_interp_filter`, decodemv.c:1122). Ours takes the *real-symbol*
branch (`interp_fixed == None`, i.e. the frame header says
`interpolation_filter == Switchable`) and decodes `filter=[3, 3]`
(BILINEAR both directions) -- a real, adapting 3-symbol CDF read.
aomdec's own trace for this exact block (`mi_row=0 mi_col=0`, frame=14,
ref=1, mode=NEWMV=16) shows `interp=(0,0)` (REGULAR both directions)
with **no `IFILTER_DBG` line at all** -- confirmed by instrumenting
`av1_is_interp_needed()`'s own three sub-conditions directly
(`IFILTER_NEEDED ... skip_mode=0 motion_mode=0 mode=16 needed=1`): the
function returns TRUE (the read is not skipped by the gate), yet
`read_mb_interp_filter`'s OWN symbol-read branch never fires for this
block, which by its source (decodemv.c:1134,
`if (interp_filter != SWITCHABLE)`) is only possible if **libaom's own
per-frame `features->interp_filter` is a FIXED value for frame 14, not
`SWITCHABLE`** -- i.e. aomdec's `interpolation_filter` header field for
THIS frame differs from what our decoder computed.
CONCLUSION / R7 HANDOFF, IN ORDER:
1. This is very likely NOT an msac bug at all (closed, see above). The
live suspect is `read_interpolation_filter()`
(`ec-av1-syntax/src/frame.rs:1165`) or, more likely given the header
bit-parsing there matches spec 5.9.10 exactly on inspection, a
**frame-header/frame-index MISMATCH**: this pin's "decode-order frame
1" may not be resolving to the same underlying temporal-unit frame
aomdec calls its own "frame=14" -- ties back to f952bb4's
already-flagged "hidden frame" suspicion from round 3, never fully
closed. Confirm by dumping `header.interpolation_filter` (and ideally
`show_frame`/`frame_type`/`order_hint`) for EVERY frame header our
decoder parses in this stream, aligned against aomdec's own
`cm->current_frame.frame_number` sequence (add an
`EC_AV1_FRAME_NUMBER`-style eprintln! to `av1_read_coeffs_txb` or the
frame-header decode point on aomdec's side, matching the counters
already in place) -- find the first frame where the two disagree on
`interpolation_filter`, and from there whether it's a genuine
off-by-one in which OBU/frame our pin harness treats as
"decode-order frame 1", or a real per-frame header field ours reads
as `Switchable` when it should not.
2. If frame alignment IS correct and headers genuinely disagree on this
field for the SAME frame: re-derive `read_interpolation_filter`
against spec 5.9.10 word-for-word once more (looks correct on this
round's read, but re-check the surrounding `allow_high_precision_mv`
/`force_integer_mv` order just above it, frame.rs:963-968 -- an
earlier misread bit could shift every subsequent header field by one
bit position without desyncing the *tile* data at all, which is
exactly the shape of "everything downstream of one header field
looks locally consistent but globally wrong").
3. Once the true cause is found and fixed, re-run the pin
(`EC_AV1_PIN_N=24`) for exactness, THEN full
`cargo test -p ec-av1 --release` (not just `--lib`) per existing
done-criteria -- a header-parsing fix is even more likely than an
msac fix to touch every stream.
4. If the pin goes exact: run the three flaking gates 15x each
(`compound_references`, `reference_select`, `deblocking`) and report
pass counts honestly.
Instrumentation added this round, env-gated (no behaviour change when
unset): `SymbolDecoder::debug_state()` (msac.rs, `pub(crate)`, mirrors
the existing `debug_bitpos()`), three new `EC_AV1_EOBPT_CDF`-gated
state prints in decode.rs (`EC_AV1_STATE_BEFORE_TXBSKIP`,
`EC_AV1_STATE_AFTER_TXBSKIP`, `EC_AV1_STATE_AFTER_TXTYPE`). External,
not committed to this repo: `/tmp/libaom-src`'s
`av1/decoder/decodetxb.c` (`EC_AV1_EOBPT_STATE_IN`, `rng_before` on
`EC_PLANE`) and `av1/decoder/decodemv.c` (`IFILTER_NEEDED`, gated on the
pre-existing `EC_IFILTER_DBG`) -- rebuilt into
`/tmp/libaom-src/build/decoder-debug/aomdec`; this source tree is
outside the repo and NOT reproducible from a fresh checkout, note for
whoever runs r7 without the same `/tmp` state.
class: sibling of [[stale-premise-lanes]] -- r4 and r5 both suspected
mechanisms one level too deep (a table's forwarding, then a coder
primitive) because both were proven correct in isolation without first
walking the state itself backward to its true entry point; the actual
divergence sits one whole syntax element earlier (a per-block symbol
read that should not have fired at all), in territory ([[hidden frame]]
frame-index resolution) an even earlier round (f952bb4) already named
and left open.