forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 69a575cbf41364441abf53e2773d6a2fe45da3e9

2026-08-28

wip(av1): self-pin-on-mismatch for compound-refs and reference-select gates (owed 3 rounds)Ahmet Kaan Gümüş · 69a575c
wip(av1): self-pin-on-mismatch for compound-refs and reference-select gates (owed 3 rounds)

Both gates now write the mismatching stream to a fixed
std::env::temp_dir() path (ec-av1-compound-refs-gate-fail.obu /
ec-av1-reference-select-gate-fail.obu) unconditionally inside the
mismatch branch, panic message includes the pin path -- same pattern
as the deblocking gate. EC_AV1_GATE_DUMP env var kept as an
additional opt-in dump target, unchanged. No behaviour change besides
the pin write + panic message text.
wip(av1): pre-filter dump pinned frame-1 desync to Luma32Inter's tx_type read; flip-to-None regressed 16 tests, reverted. Round 4, capped at budget.Ahmet Kaan Gümüş · a3dcb12
wip(av1): pre-filter dump pinned frame-1 desync to Luma32Inter's tx_type
read; flip-to-None regressed 16 tests, reverted. Round 4, capped at budget.

COMPILES. Does not fix the pin. Full suite back to baseline (instrumentation
only, no behaviour change from r3's HEAD besides the two new dumps below).

STEP 1 DONE, DECISIVE NEW EVIDENCE:

Added `EC_AV1_PREFILT_DUMP` (decode.rs, both apply_deblock call sites,
`PREFILT_PICTURE_IDX` global counter mirroring stream.rs's own
`pictures_decoded`), diffed against aomdec's own `EC_AV1_PREFILT_DUMP`
(decodeframe.c ~5451, already built into /tmp/libaom-src's debug aomdec).
Confirmed r3's own pre/post-filter accounting: decode-order frame 1's
mismatch (4407/6144 bytes) is already present PRE-filter -- reconstruction,
not the loop filter, exactly as r3 inferred from aomdec's own before/after
delta being tiny (333 bytes) by comparison.

STEP 2 DONE: pulled aomdec's unconditional per-block `EC_TRACE`
(decodemv.c ~1681, fires for every block regardless of env var) for
decode-order frame 1 specifically (the FIRST group of `is_inter=1` lines
after the keyframe's intra-only group, not "frame 1" by display/order_hint
-- r2's mistake) and cross-checked block-by-block against our own
`EC_AV1_TRACE`:

  block (mi 0,0):  ours skip=0 mv=(-2,-8) ref=LAST   -- MATCHES aomdec
                    exactly (mode=NEWMV both sides, motion_mode SIMPLE
                    both sides, no OBMC either side)
  block (mi 0,8):  ours skip=0 mv=(-14,8)  vs  aomdec skip=1 mv=(22,-40)
                    -- FIRST DIVERGENCE, immediately after block(0,0)

Since block(0,0)'s own mode-info matches bit-for-bit, the desync happens
inside block(0,0)'s own RESIDUAL decode (it is skip=0, so tokens are read)
-- the last thing before block(0,8)'s mode-info starts. Traced both sides'
coefficient reads for that one 32x32 luma transform (our own inline
`EC_AV1_TRACE` coeff logging in `read_coeffs`, decode.rs ~606, vs aomdec's
`EC_TRACE2`, decodetxb.c):

  ours:   tx_type symbol read, value=1 (from a real 2-symbol CDF, len=3)
  aomdec: EC_TXTYPE_VAL tx_type=0 (from a degenerate 1-symbol CDF -- no
          real bits consumed; spec `av1_get_ext_tx_set_type` resolves
          every tx_size_sqr >= TX_32X32 to `EXT_TX_SET_DCTONLY`, i.e. no
          tx_type is coded at all for a 32x32 inter transform)
  ours:   eob_pt=6 -> eob=18/17 (varies by exact run)
  aomdec: eob_pt=5 -> eob=13

`cdf_state.rs`'s `TxbSet::Luma32` (intra) already has `tx_type: None`
(correctly forced `DctDct`, matching `Luma64`'s `None` too) -- but
`TxbSet::Luma32Inter` (the one this block's `read_inter_plane` actually
uses, decode.rs ~5591) sets `tx_type: Some(self.inter_tx_type_32...)`,
reading a real symbol that spec says should never be read at this size.

TRIED AND REVERTED: flipping `Luma32Inter`'s `tx_type` to `None` (matching
`Luma32`) does NOT fix the pin -- `eob_pt` still reads 6 instead of
aomdec's 5 immediately afterward (same wrong value as before the flip),
proving the primary desync is NOT (only) the tx_type read; `eob_pt`'s own
context/table selection for this size class has a separate, still-unfound
bug. Worse: the flip regressed `cargo test -p ec-av1 --release --lib` from
green to 201 passed / 16 failed -- `inter_tx_type_32`'s CDF is evidently
depended on (adaptively, via `end_cdfs`/`cdf_slots` propagation into a
later frame's `started_from`, most likely) by other streams that DO expect
a real symbol read at this size, so `None` is not simply "more correct" in
isolation. REVERTED to `Some(...)` (baseline, all tests green again).

class: two independent-looking desync leads (tx_type over-read AND a wrong
eob_pt for 32x32) sit back-to-back in the exact same transform block --
this looks less like "one bug" and more like the CDF/context wiring for
`TxbSet::Luma32Inter` overall not matching spec's 32x32 inter path, closer
to [[tx-class-cross-cutting]] than a single point fix.

R5 UPGRADE PATH, IN ORDER:
1. Do NOT re-attempt the bare `tx_type: None` flip without first finding
   and fixing the `eob_pt` bug too -- confirmed above it does not fix
   anything alone and breaks 16 tests, so it is not a safe partial step.
2. Find the `eob_pt` bug first, in isolation: `read_eob`/`eob_pt` selection
   for `TxClass::TwoD` at side=32 (decode.rs ~549-560) against libaom's own
   `get_eob_pos_token`/`eob_multi_ctx` derivation for `TX_32X32`
   (av1/decoder/decodetxb.c, the `EC_EOBPT` trace line's own call site) --
   the aomdec fixture already prints `eob_pt=5 txs_ctx=3 tx_class=0
   eob_multi_ctx=0`, giving every context input needed to hand-derive the
   expected CDF row without more instrumentation.
3. Once eob_pt is confirmed fixed AND matches for this exact block, retry
   the `tx_type: None` flip for `Luma32Inter` and rerun the FULL
   `cargo test -p ec-av1 --release --lib` (not just the pin) before
   declaring it safe -- the 16-test regression must be understood (which
   16, why they wanted `Some`) or reproduced-fixed, not just silently
   re-broken again.
4. Re-run pin (`EC_AV1_PIN_N=24`) only after both land together.

Instrumentation added this round, env-gated (no behaviour change when
unset): `EC_AV1_PREFILT_DUMP` (decode.rs, `PREFILT_PICTURE_IDX` counter).
Reused, unchanged: `EC_AV1_TRACE` (decode.rs, already had inline coeff
tracing in `read_coeffs`/mode-info logging -- did not need new plumbing),
aomdec's own always-on `EC_TRACE`/`EC_TRACE2`/`EC_AV1_PREFILT_DUMP`
(/tmp/libaom-src, prebuilt at build/decoder-debug/aomdec).

STEP 5 (self-pin-on-mismatch for the two gates) -- STILL NOT reached, now
owed 3 rounds. Must be r5's first task per the standing charter note.

class: dpb-propagation-from-an-unverified-hidden-frame (r3's class) is
CONFIRMED as the correct causal chain (hidden frame 1 -> corrupts later
refs via refresh_frame_flags), origin now narrowed from "frame 1's
reconstruction" to "frame 1's very first non-skip 32x32 luma transform's
own token decode", two candidate bugs identified, neither closes it alone.
wip(av1): r2's skip_mode-desync theory FALSIFIED; real defect is decode-order frame 1's own reconstruction, invisible to the existing pin (hidden frame)Ahmet Kaan Gümüş · 8d878fe
wip(av1): r2's skip_mode-desync theory FALSIFIED; real defect is decode-order
frame 1's own reconstruction, invisible to the existing pin (hidden frame)

COMPILES. Does not fix the pin. Round 3 of lane-comppin, capped at budget.

STEP 1/2 OF THE CHARTER, DONE -- DECISIVE, OVERTURNS r2:
Added EC_AV1_SKIPMODE_DUMP (decode.rs ~4623, ctx+tell before/after the
skip_mode symbol read) and a matching hook in libaom's own read_skip_mode
(/tmp/libaom-src/av1/decoder/decodemv.c ~453, EC_SKIPMODE env var, rebuilt
into /tmp/libaom-src/build/decoder-debug/aomdec). Direct comparison for the
frame r2 called "frame 1" (order_hint=1, the pin's 2nd *shown* frame):

  ctx sequence:    ours 0,1,1,2   aomdec 0,1,1,2   -- MATCH
  result sequence: ours T,T,T,T   aomdec T,T,T,T   -- MATCH

r2's claim ("real bitstream's block (0,0) is SINGLE-ref LAST, skip_mode
false") does not hold under this direct comparison -- it was very likely an
artifact of comparing OUR decode-order frame index against aomdec's own
*decode*-order frame_number without accounting for AV1's hierarchical-B
reorder (decode order for this pin's skip_mode-bearing frames is
order_hint 7, then 3, then 1 -- NOT ascending display order; r2's manual
aomdec read likely landed on a different frame_number than intended). The
raw `tell` numeric gap noted in-flight this round (19 vs 5 bits before the
first read) is ALSO not evidence: aom_reader_tell()/od_ec_dec_tell() is a
fractional-bit *estimate*, not a raw bit-offset like our debug_bitpos() --
apples to oranges, not comparable numerically.

Also confirmed from libaom source (decodemv.c ~1541-1578): comp_group_idx
and compound_idx are NEVER read for a skip_mode block -- both stay at their
init values (0, 1 = COMPOUND_AVERAGE) unconditionally. So compound_idx is
not a desync candidate for this pin's all-skip_mode frame either, closing
off the other half of r2's upgrade path 2/3 as inapplicable here (right
answer, wrong question -- there is no compound_idx *read* to desync).

NEW FINDING THIS ROUND (the actual lead for r4): the existing pixel-diff
harness (`scratch_isolate_pinned_mismatch`) only ever compares *shown*
frames (display order) against ffmpeg's own (also display-order) output --
so it never directly checks the hidden altref/bwdref frames a shown frame's
compound prediction is built from. Added EC_AV1_DECODE_ORDER_DUMP
(stream.rs, dumps every decoded frame's post-loop-filter Y+U+V in DECODE
order, `pictures_decoded` counter) and cross-checked against aomdec's own
EC_AV1_POSTFILT_DUMP for the same pin:

  decode-order frame 0 (keyframe):        byte-exact (as already known)
  decode-order frame 1 (first hidden alt, predicts ONLY from the exact
    keyframe -- no other reference exists yet, so DPB/ref_slots corruption
    is RULED OUT as a cause here):        4439 / 6144 bytes differ (72%),
    mostly +-1/+-2 (row0 col0: 126 vs 127 ...), one outlier delta 31 at
    Y offset 4033 (row 63, col 1)
  cross-checked against aomdec's OWN pre- vs post-loop-filter dump for that
    same frame: only 333/6144 bytes change from its own loop filter, so the
    bulk of our 4439-byte gap already exists in *reconstruction*, upstream
    of loop filtering, not a filter-strength mismatch.

This is a much cleaner, earlier, and larger divergence than the "display
frame 1" comparison r1/r2 chased (worst delta 4, growing to 60 by frame 23)
-- that number was symptom, not source: it is contamination flowing forward
from THIS frame (decode-order 1) through refresh_frame_flags into every
later reference, exactly like lane-av1blend's already-documented DPB
propagation class, except here the corruption's true origin is now pinned
to one fully-isolated single-reference-input frame instead of a whole GOP.

R4 UPGRADE PATH, IN ORDER:
1. Add a Rust-side PRE-loop-filter dump (hook before apply_deblock is
   called in decode_inter_frame_tile_with_cdfs, same shape as
   EC_AV1_DECODE_ORDER_DUMP) and diff against aomdec's EC_AV1_PREFILT_DUMP
   for decode-order frame 1 specifically -- confirms whether the ~4100+
   byte gap is present pre-filter (reconstruction/MC bug) as the pre-vs-post
   accounting above already implies, or partly filter-side.
2. If pre-filter also mismatches widely: decode-order frame 1's own blocks
   are skip_mode=true/compound (per the r2/r3 traces), predicting from a
   single known-exact source (the keyframe) with an MV this round did NOT
   yet verify against aomdec's own decoded MV for THIS frame (r2's MV claim
   was for the wrong frame per the falsification above) -- get
   EC_TRACE mode/mv/ref dumps from decodemv.c for decode-order frame 1
   specifically (not "frame 1" by order_hint) and diff mv/ref pair
   block-by-block against our own EC_AV1_TRACE.
3. Given the pattern (widespread +-1/+-2, one 31-outlier) looks like either
   a systematic rounding bug in the compound blend/MC round-off (the
   ALTREF_FRAME single-ref altref-context special case in record_inter,
   decode.rs ~1023-1032, is one plausible site: this frame's ref pair likely
   *is* LAST+ALTREF) or a wrong film-grain/identity-matrix path leaking in
   before the DPB store -- check `film_grain.apply_grain` isn't
   accidentally hitting this "hidden" frame's stored (pre-grain) picture,
   though stream.rs's grain gating already looks correct on inspection.

STEP 5 (self-pin-on-mismatch for the two gates) -- NOT reached this round,
still owed to r4.

Instrumentation left in place, all env-var-gated (no behaviour change when
unset): EC_AV1_SKIPMODE_DUMP (decode.rs), EC_AV1_DECODE_ORDER_DUMP
(stream.rs), EC_SKIPMODE (libaom decodemv.c, rebuild with `make -j12 aomdec`
in /tmp/libaom-src/build/decoder-debug if stale).

class: dpb-propagation-from-an-unverified-hidden-frame -- same shape as
lane-av1blend's already-filed ref_slots/refresh_frame_flags class, but here
the true origin is now isolated to ONE frame with only one possible input.
wip(av1): trace skip_mode/compound_idx on the sb128-compound-refs pin -- NOT the compound blend, it is skip_mode desyncAhmet Kaan Gümüş · 15f253d
wip(av1): trace skip_mode/compound_idx on the sb128-compound-refs pin -- NOT the compound blend, it is skip_mode desync

COMPILES. Does not fix the pin (still mismatches). round 2 of lane-comppin,
capped at budget -- leaving the decisive lead + instrumentation for round 3.

WHAT THIS ROUND RULED OUT (all re-verified against libaom source, all correct):
- mc.rs predict_compound_intermediate/combine_compound: CONV_BUF-domain i32
  intermediates, round2 offsets, INTER_ROUND_1_COMPOUND=7/INTER_POST_ROUND=4/
  DIST_PRECISION_BITS=4 all match av1_dist_wtd_convolve_2d_c bit-for-bit
  (already landed pre-r1, re-audited this round, still correct).
- compound.rs dist_wtd_comp_weight_assign: QUANT_DIST_WEIGHT/LOOKUP_TABLE
  match libaom's reconinter.c/common_data.h row-for-row.
- decode.rs get_comp_index_context / get_comp_group_idx_context: match
  pred_common.c av1_get_comp_index_context/av1_get_pred_context_comp_group_idx
  line for line, including the single-ref ALTREF_FRAME special case
  (Neighbours::record_inter's altref bit at decode.rs ~1028-1032).
- reference_mode_ctx (mvstack.rs ~1876): matches av1_get_reference_mode_context
  exactly, including the has_second_ref asymmetric branches.
- read_skip_mode_params (ec-av1-syntax/src/frame.rs:1644): matches spec 5.9.22's
  skipModeAllowed forward/backward-ref search verbatim.

THE ACTUAL DEFECT (new this round): decode-order frame 1 of the pin
(sb128-compound-refs-flake.obu, EC_AV1_PIN_N=24) is 4x 32x32 leaves, all
identical: ref0=LAST(1) ref1=ALTREF(7 or 5), mv=(0,0)/(0,0), mode
NEAREST_NEARESTMV, compound_idx=1 (plain average) -- EVERY block reads
skip_mode=true (added EC_AV1_COMPIDX_DUMP trace at decode.rs ~5017/~6022,
EC_PRECOMP trace at ~4671 dumps skip_mode/skip/reference_select/tell before
the comp_mode read).

Cross-checked against a real instrumented aomdec (rebuilt
/tmp/libaom-src/build/decoder-debug/aomdec with a `mbmi->compound_idx` field
added to decodemv.c's existing EC_TRACE fprintf ~1671-1685, since the prior
round's patch only traced comp_group_idx not compound_idx): the REAL
bitstream's frame 1 block (0,0) is `ref=(1,-1)` -- SINGLE reference LAST_FRAME,
real coded MV (-2,-8) in 1/8-pel, skip_mode is NEVER forced there. Any true
skip_mode block would be forced compound by spec 5.11.24 -- a single-ref
result at that block proves the real bitstream's skip_mode bit read false
there, not true.

skip_mode_present (the frame-level bit, spec 5.9.22) is very likely read
correctly -- header fields after it (force_integer_mv, primary_ref_frame,
etc, dumped for all 24 frames by the existing scratch_isolate_pinned_mismatch
test) look sane and stay sane for the rest of the stream, which would not
survive a header-level bit-count desync this early. So the bug is specific to
the PER-BLOCK skip_mode symbol read at decode.rs ~4623 (skip_mode_ctx =
above_skip_mode[c] + left_skip_mode[r], SKIP_MODE cdf table cdf.rs:1206):
`SKIP_MODE = [[32621,32768,0], [20708,32768,0], [8127,32768,0]]` (verified
byte-identical to libaom's default_skip_mode_cdfs) means ctx=0 (both
neighbours false, true at any tile's mi_row=0/mi_col=0 corner if Neighbours
resets its skip_mode arrays per frame) has ~99.6% weight on skip_mode=false
-- decoding true there, then AGAIN at (0,8)/(8,0)/(8,8) (all four leaves of
the frame, tell values repeating 8/16/24 across MANY of the 24 frames, not
just frame 1) is not plausible as a correctly-drawn symbol from that CDF. The
leading hypothesis: `Neighbours::above_skip_mode`/`left_skip_mode` are stale
(not reset per frame, or reset at the wrong granularity) so skip_mode_ctx is
NOT actually 0 at (0,0) despite no real neighbour existing yet -- OR the same
DPB/ref_frame_idx bookkeeping the r1-era av1blend investigation already
flagged (ref_slots/refresh_frame_flags) is corrupting `skip_mode_frame`'s
own reference *pair* (LAST vs ALTREF/BWDREF getting mixed up across frames --
note ref1 alternates 7/5/4 across frames in the EC_COMPIDX dump, tracking
DPB slot churn) even when the boolean itself is right.

UPGRADE PATH for round 3, in order:
1. Print skip_mode_ctx (not just skip_mode) at every read (the second Edit
   attempt this round hit "2 matches, use replace_all" on the identical
   leaf16/leaf8 skip_mode block -- disambiguate by including the `skip_ctx`
   line that follows, which differs between the two call sites) and confirm
   ctx is really 0 at (0,0) of frame 1. If ctx != 0, the neighbour-array
   reset is the bug (grep Neighbours::new / wherever it's re-constructed
   per frame in decode_stream, stream.rs).
2. If ctx IS 0 and the symbol still reads 1, instrument SymbolDecoder::symbol
   itself (msac.rs) to dump (cdf_before, symbol_read, rng, value) for this
   ONE call across frames 1-3 and diff against a fresh COMPIDX_BLK-style hook
   in decodemv.c's own skip_mode read (~line before 1656 in
   /tmp/libaom-src/av1/decoder/decodemv.c -- not yet added, do this first).
3. Only after (1)/(2) rule out a local read bug: chase the DPB/ref_frame_idx
   bookkeeping the ref1=7/5/4 churn hints at (stream.rs's ref_slots /
   refresh_frame_flags, same suspect the pre-existing decode.rs ~4832-4845
   comment already named for a different fixture).

Gates a_real_aomenc_stream_with_compound_references_decodes_pixel_exact /
_reference_select_ NOT yet given the self-pin-on-failure treatment (step 4 of
the charter) -- deferred to round 3, no budget left this round.

Instrumented aomdec debug build lives at
/tmp/libaom-src/build/decoder-debug/aomdec (not repo-tracked, rebuild with
`make -j12 aomdec` there if it goes stale); its decodemv.c EC_TRACE fprintf
now also carries mbmi->compound_idx.
wip(av1): skip mv fr symbols under force_integer_mv (spec 5.11.32)Ahmet Kaan Gümüş · e48aa4c
wip(av1): skip mv fr symbols under force_integer_mv (spec 5.11.32)

lane-comppin r1 dying words: COMPILING. Spec-conformance fix, real but
NOT the pinned defect -- pin sb128-compound-refs-flake.obu decodes with
an IDENTICAL mismatch signature before and after (frame 0 exact; frame 1
Y 1640 px worst-delta 4, first at row 0 col 4 ours=128 theirs=129, U
first col 15, V first col 5, all planes accumulating to worst 60 by
frame 23). Frame 1 has force_integer_mv=true, frames 2+ false; signature
unchanged means the fr reads either never fire on frame 1 or the drift
sits elsewhere. Suspects remaining: dist-wtd compound blend rounding
(round0/round1 intermediate precision, quant_dist_lookup), plain-average
vs jnt_comp path selection, subpel MC on the compound path.
Merge branch 'lane-sb128': consume the interintra symbol; the deblocking-gate flake was this bit-driftAhmet Kaan Gümüş · 6a5f24d
Merge branch 'lane-sb128': consume the interintra symbol; the deblocking-gate flake was this bit-drift

The pin's sequence header enables interintra compound: libaom reads an
interintra symbol (spec 5.11.24, after assign_mv, before
read_motion_mode) that this decoder never consumed, silently
mis-aligning every later symbol -- the first visible casualty was a
neighbouring block's skip flag. interintra == 1 is a NAMED refusal
(blended inter+intra prediction unimplemented); == 0 decodes on.
Pinned stream now 4/4 frames all-plane exact; second pin honestly
refuses (it genuinely codes interintra). Deblocking gate 20/20.
Sequence-header enable_* sweep: no other silently-dropped symbols.
fix(av1): consume the interintra symbol behind enable_interintra_compoundAhmet Kaan Gümüş · c06aac0
fix(av1): consume the interintra symbol behind enable_interintra_compound

Root cause closed (lane-sb128 r4): libaom read_inter_block_mode_info reads
`interintra` (spec 5.11.24) right after assign_mv and before read_motion_mode
whenever the sequence header's enable_interintra_compound is set and
is_interintra_allowed(mbmi) holds (single-ref, BLOCK_8X8..=BLOCK_32X32, any
single-ref mode). This decoder never consumed that symbol, so any stream
with the bit set desynced from the first eligible block onward -- the
"BL skip flip" deblocking-gate flake was this bit-consumption drift.

- cdf.rs already had default_interintra_cdf (INTERINTRA); cdf_state.rs now
  resets it every keyframe (reset2) alongside obmc, closing the gap the r3
  dying words flagged.
- decode_inter_block/decode_inter_block8 both read `interintra` at the
  libaom-verified placement (after MV, before motion_mode), gated on
  enable_interintra_compound && !skip_mode && bsize-in-range, indexed by
  size_group_lookup (16x16->2, 32x32->3, 8x8 leaf->1). interintra==1 is a
  named refusal (inter+intra blended prediction unimplemented), not a
  mis-decode.
- enable_interintra_compound threaded from stream.rs's sequence header
  through decode_inter_frame_tile_with_cdfs's 3 call sites (already landed
  r3) down into both leaf functions' new parameter + every caller
  (decode.rs's plain wrapper, stream.rs's real driver, the decode_inter_block
  unit test).

Verified: scratchpad deblkflake-pin-197.obu now 4/4 all-plane MATCH x3
(previously mismatched -- root cause confirmed); deblkflake-pin-214.obu now
gets an honest named refusal x3 instead of a silent mis-decode (that stream
genuinely uses interintra prediction, unimplemented -- capability gap, not a
bug). Real aomenc deblocking gate 20/20; cdf_forwarding 10/10; obmc 2/2;
reference_select 3/3; compound_references 2/3 pass (1 flake matches the
already-documented aomenc-RD-nondeterminism class, re-ran green standalone).
wip(av1): interintra symbol consumption -- CDF landed, threading INCOMPLETE, NOT COMPILINGAhmet Kaan Gümüş · 35abdb5
wip(av1): interintra symbol consumption -- CDF landed, threading INCOMPLETE, NOT COMPILING

Dying words (r3 capped at 75 calls):
- ROOT-CAUSE DIRECTION: pin stream's sequence header has
  enable_interintra_compound set; libaom read_interintra_mode reads an
  interintra symbol for eligible blocks (single-ref, BLOCK_8X8..=32X32,
  mode NEARESTMV..NEWMV, size_group_lookup-indexed CDF) that our
  decoder never consumes -- the bit-consumption drift that flips BL's
  skip read (TR reads it first). Consuming the symbol (refusing on
  interintra==1) restores alignment.
- LANDED: cdf.rs INTERINTRA (default_interintra_cdf, 4 size groups);
  Cdfs.interintra storage + seed (CHECK: reset2 arm may still be
  missing in reset list -- verify); enable_interintra_compound param
  added to decode_inter_frame_tile_with_cdfs + passed at 3 call sites
  (~6880/6953/7017).
- REMAINING: (1) add enable_interintra_compound param to
  decode_inter_block AND decode_inter_block8 signatures; (2) the
  actual read site: AFTER which symbol exactly? verify against libaom
  decodemv.c read order (read_interintra_mode placement relative to
  ref/mode/motion_mode reads) -- get placement from libaom, not
  memory; interintra==1 => named refusal (interintra prediction
  unimplemented); interintra==0 => continue; (3) eligibility
  is_interintra_allowed port (single-ref + bsize group + mode range +
  !skip_mode?) -- verify exact libaom condition; (4) thread from
  stream.rs caller (sequence header bit -- check field name in our
  seq header struct, may need parsing if not stored); (5) pin P1+P2
  proof + gate sweeps per r3 charter; (6) EC_TRACE line gained
  motion_mode_eligible/obmc_selected/tell fields (scratch-ish but
  env-gated -- keep or trim at close).
- TOOLS: libaom EC_TRACE patches in /tmp/libaom-src/av1/decoder/decodemv.c;
  rebuild cd /tmp/libaom-src/build/decoder-debug && make -j12 aomdec
  (fallback /tmp/libaom-src/build). debug_bitpos vs aom_reader_tell
  remains INVALID cross-comparison.
Merge branch 'lane-motionmode': decode OBMC motion mode (SIMPLE vs OBMC_CAUSAL)Ahmet Kaan Gümüş · f77976c
Merge branch 'lane-motionmode': decode OBMC motion mode (SIMPLE vs OBMC_CAUSAL)

read_motion_mode after MV assignment, before the interp filter read
(libaom decodemv.c order); eligibility ports motion_mode_allowed +
overlappable-neighbour walk; OBMC blend ports
av1_build_obmc_inter_prediction (above+left passes, real obmc_mask
tables, luma + 4:2:0 chroma), wired through both 16x16 and 8x8
leaves. allow_warped_motion=1 at an eligible block is a NAMED
refusal, proven 40/40 seeds refuse with zero mis-decodes. New gates:
OBMC sequence pixel-exact vs ffmpeg (real OBMC blocks fire), 8x8
variant records honest never-fired skip (aomenc RD never splits this
content to 8x8).
feat(av1): thread read_motion_mode/OBMC through decode_inter_block8's 8x8 leavesAhmet Kaan Gümüş · 1944bfc
feat(av1): thread read_motion_mode/OBMC through decode_inter_block8's 8x8 leaves

Round 2 left an OBMC correctness hole: bsize 8x8 is motion_mode_allowed-
eligible but decode_inter_block8 never read the symbol, so an OBMC stream
coding motion_mode on an 8x8 leaf would desync silently. Mirrors the
16x16 decode_inter_block read (same 2-symbol obmc_cdf, same
allow_warped_motion=1 refusal, same obmc_blend call after MC prediction)
and threads switchable_motion_mode/allow_warped_motion/interp_fixed into
decode_inter_block8's signature.

Added a_real_aomenc_stream_with_obmc_8x8_decodes_pixel_exact plus an
obmc_hits_8 counter to try to exercise this path. Measured live: 80
attempts, aomenc's cpu-used=0 RD search never once splits a 16x16 down
to a clean 4-way 8x8 leaf for the gate's smooth gradients fixture (large
blocks always win); kept as an honest never-fired record, matching the
file's existing never_fired-skip convention.
feat(av1): decode OBMC_CAUSAL motion mode (SIMPLE vs OBMC, warp refused)Ahmet Kaan Gümüş · c0d4024
feat(av1): decode OBMC_CAUSAL motion mode (SIMPLE vs OBMC, warp refused)

read_motion_mode ported (spec 5.11.24 / decodemv.c ~1520-1600), placed
between MV assignment and the switchable interp filter read, matching
libaom's own order. motion_mode_allowed (reconinter.h) reduces on this
decoder's single-ref path to "an inter neighbour borders the above row
or left column" -- overlappable_above/left port
foreach_overlappable_nb_{above,left} (obmc.h) over the existing MiGrid,
bsize/global-mv/interintra conditions all hold unconditionally here
(global motion is always IDENTITY, no interintra reader, single-ref
only). allow_warped_motion=1 is refused right at an eligible block
(av1_findSamples/num_proj_ref not ported, so this decoder cannot tell
OBMC_CAUSAL from WARPED_CAUSAL once the header allows warp) rather than
guessed at or refused at the header.

OBMC prediction (av1_build_obmc_inter_prediction, reconinter.c): each
bordering above/left inter neighbour is re-predicted over the overlap
strip with its own mv/ref/filter and blended in with the real
obmc_mask_{4,8,16,32} tables, luma then both 4:2:0 chroma planes,
above pass then left -- max_neighbor_obmc's own cap applied, eligibility
scan stays unbounded per libaom.

New gates: a_real_aomenc_stream_with_obmc_decodes_pixel_exact (3x
green, fires 3 real OBMC blocks pixel-exact against ffmpeg) and
a_real_aomenc_stream_with_warped_motion_refuses_or_matches (40/40 named
refusals, 0 desyncs -- confirms the refuse-vs-desync verdict). Existing
cdf_forwarding/deblocking/compound_references/reference_select gates and
the full lib suite (216/0/16) stay green.

Corner-cut: the obmc.h "4-wide block treated as half a chroma pair"
merge is not ported -- no block this decoder codes is narrower than 8px,
so it never fires on any stream this decoder can reach.
wip(av1): OBMC decode round 1 -- CDF + header-bit plumbing, symbol NOT read yetAhmet Kaan Gümüş · 0b6a5ba
wip(av1): OBMC decode round 1 -- CDF + header-bit plumbing, symbol NOT read yet

Dying words (builder capped at 75 calls):
- COMPILES (warnings only). Landed: default_obmc_cdf transcribed
  (cdf.rs OBMC, 4 square bsizes 8/16/32/64 = BLOCK_SIZES_ALL
  3/6/9/12); Cdfs.obmc storage + reset + seed; decode_inter_block +
  decode_inter_frame_tile_with_cdfs take switchable_motion_mode /
  allow_warped_motion, threaded from header at stream.rs:382; the
  16x16 leaf call sites pass them; decode_inter_block8 (8x8 leaves)
  intentionally NOT wired (round 2 per plan).
- REMAINING: (1) read_motion_mode symbol read inside
  decode_inter_block -- placement per libaom decodemv.c:1575 region
  read order, AFTER compound/interp reads; eligibility =
  av1_count_overlappable_neighbors port (whole edge span, not one
  cell) + global-mv/bsize checks per motion_mode_allowed
  (reconinter.h); round-1 scope reads 2-sym obmc_cdf only
  (allow_warped_motion=0 streams). (2) OBMC prediction:
  av1_build_obmc_inter_predictors_sb port (above/left overlap
  predictors, av1_get_obmc_mask blend, luma + 4:2:0 chroma plane
  loop). (3) aomenc OBMC gate (--enable-obmc=1
  --enable-warped-motion=0 on base recipe) 10x + existing 4 gates
  10x + lib suite 3x. (4) warp-stream refusal accuracy check.
- Refuse-vs-desync verdict for pre-fix OBMC streams: NOT yet
  established by this round -- handoff must check before claiming.
test(av1): self-pin the deblocking gate's stream on mismatch; correct the variance commentAhmet Kaan Gümüş · 4d29711
test(av1): self-pin the deblocking gate's stream on mismatch; correct the variance comment

The gate's content is fresh every run (gradients ignores seed for its
colors), so an unpinned failure may never reproduce. On mismatch the
stream is written to a stable temp path and the panic names it.
Merge branch 'lane-deblkflake': EC_AV1_GATE_DUMP pins the deblocking gate's streamAhmet Kaan Gümüş · 87eb5ee
Merge branch 'lane-deblkflake': EC_AV1_GATE_DUMP pins the deblocking gate's stream

1503 filtered attempts on 95e9170 all green -- the ledger's 1-in-10
flake rate was stale-premise. Real variance mechanism: lavfi
gradients ignores its seed option for c0..c7 colors (default
"random"), so the gate encodes different content every run. The
dump hook captures the exact aomenc stream decoded, so any future
organic failure is pinnable immediately.
wip(av1): deblocking gate flake -- localize selection mechanism, not currently reproducibleAhmet Kaan Gümüş · 66f2499
wip(av1): deblocking gate flake -- localize selection mechanism, not currently reproducible

Root cause of the SELECTION MECHANISM (not the decoder bug itself):
the test's source fixture is genuinely nondeterministic run-to-run.
`ffmpeg -f lavfi -i gradients=...:seed=42` does NOT honor `seed` for
its c0..c7 colors (they default to "random", drawn from an unseeded
RNG independent of the filter's own `seed` option) -- confirmed by
sha256-hashing 5 consecutive y4m generations with identical args: all
5 differ, and a byte-level cmp shows the first divergence inside the
pixel data (not the header). So every test run encodes genuinely
different frame content through aomenc, which is itself a second,
compounding nondeterminism source (cq=55/cpu-used=0 RD search hashes
differently run-to-run even with --threads=1, confirmed separately).
This is NOT the documented parallel-flake-is-attempt-selection class
(no seed loop exists in this test at all) -- it's fixture-content
variance, a new mechanism for the same flake family.

Added EC_AV1_GATE_DUMP (env-gated, mirrors EC_AV1_PIN/EC_AV1_PIN_N
convention) to dump the exact encoded stream this test decoded, for
pinning a future failure without re-deriving the mechanism.

Could NOT reproduce the mismatch this round: 1503 attempts of the
single filtered test (parallel, EC_AV1_GATE_DUMP capturing every
stream) plus 3 full `cargo test -p ec-av1 --release --lib` runs, all
green, 0 failures. The ledger's "reproduced 2x at 9/10 rate on 95e9170
(post chroma fix)" note does not hold at this HEAD in this environment
-- P(0 failures in 1503 trials | true rate 10%) is astronomically
small, so either the historical 9/10 estimate was from a much smaller
sample (2 failures observed over some earlier N, not a measured 10%),
or e74ceb5's chroma tx_type inherit fix (which reads an actual CDF
symbol per inter chroma block) incidentally closed a desync that was
also reachable from specific luma-only content -- unconfirmed,
flagged as the next hypothesis to chase if a failing stream ever
surfaces again. Class: stale-premise lanes (5th instance) --
re-measure the claimed rate before trusting a lane charter's numbers.
Merge branch 'lane-chromau': inter chroma inherits the colocated luma's coded tx_typeAhmet Kaan Gümüş · 30b9833
Merge branch 'lane-chromau': inter chroma inherits the colocated luma's coded tx_type

libaom av1_get_tx_type: an inter block's chroma plane codes no tx_type
symbol of its own -- it inherits the colocated luma transform's coded
type verbatim (DCT_DCT clamp at tx_size_sqr_up >= TX_32X32). Our
DCT_DCT default gave a wrong inverse-transform basis on chroma
residuals: delta-1 chroma-U mismatch on the pinned seed-45 stream,
now 4/4 frames all-plane byte-exact.
fix(av1): inter chroma tx_type inherits colocated luma's coded typeAhmet Kaan Gümüş · 752b1ef
fix(av1): inter chroma tx_type inherits colocated luma's coded type

read_inter_plane now takes inherited_luma_tx_type: Option<TxType> and
threads the luma call's coded tx_type through to both chroma calls at
all 4 inter block-decode call sites (leaf16 compound/single, leaf8
compound/single), matching libaom av1_get_tx_type: an inter block's
chroma plane never codes its own tx_type symbol but inherits the
colocated luma transform's type verbatim (DCT_DCT-clamped at side>=32).
Fixes the delta-1 U-only pin mismatch on cdfflake-stream-seed45.bin,
now 4/4 frames all-plane byte-exact x3.

Also removes the scratch_dump_prefilt/EC_AV1_PREFILT_DUMP_OURS bisect
helper and EC_AV1_CHROMA_TRACE eprintln used to isolate this, keeping
the standing scratch_isolate_pinned_mismatch pin tool.
wip(av1): inter chroma tx_type inherits colocated luma's coded type -- NOT COMPILINGAhmet Kaan Gümüş · 74c4dbd
wip(av1): inter chroma tx_type inherits colocated luma's coded type -- NOT COMPILING

Dying words (builder capped at 75 calls mid-edit):
- ROOT CAUSE identified: read_inter_plane defaulted chroma tx_type to
  DCT_DCT; libaom av1_get_tx_type (blockd.h) makes an inter block's
  chroma inherit the colocated luma transform's *coded* tx_type
  verbatim (clamped to DCT_DCT only when tx_size_sqr_up >= TX_32X32,
  i.e. side >= 32). Delta-1 U-only pin mismatch = wrong inverse
  transform basis on chroma residual.
- read_inter_plane signature changed: new param inherited_luma_tx_type:
  Option<TxType>, returns (Vec<i32>, TxType) so the luma call's coded
  type can feed the chroma calls.
- REMAINING: update all 8 call sites (luma call passes None and
  captures returned TxType; chroma calls pass Some(luma_tx_type)),
  then compile + pin gates.
- Scratch added (remove before close): scratch_dump_prefilt /
  EC_AV1_PREFILT_DUMP_OURS + EC_AV1_CHROMA_TRACE eprintln in
  read_inter_plane.
Merge branch 'lane-cdffwd2': decode non-reduced inter tx sets (DTT9_IDTX_1DDCT, ALL16)Ahmet Kaan Gümüş · 3a8f2f2
Merge branch 'lane-cdffwd2': decode non-reduced inter tx sets (DTT9_IDTX_1DDCT, ALL16)

Three rounds. reduced_tx_set=false inter streams now decode: 12- and
16-symbol ext-tx CDF tables, nine new TxTypes (FLIPADST combos via the
ADST kernel plus flip pass), forwarding/adaptation wiring, and the
reduced_tx_set gate threaded through the inter tile path. Pinned
forwarding stream's luma now bit-exact all frames; a small residual
chroma-U defect on that pin is separate and stays open.
feat(av1): wire reduced_tx_set=false inter tx_type gating through decodeAhmet Kaan Gümüş · 8cc4428
feat(av1): wire reduced_tx_set=false inter tx_type gating through decode

Threads header.reduced_tx_set from stream.rs into
decode_inter_frame_tile_with_cdfs -> decode_inter_block (16x16, gated to
Luma16InterSet1) and the new decode_inter_block8 parameter (8x8, gated to
Luma8InterSet1). 32x32 inter stays fixed on Luma32Inter -- get_tx_set never
splits TX_32X32 on reduced_tx_set. TX_4X4 inter has no reachable path
(decode_inter_block8 never resolves a further tx_depth split; the only TX4
reads on the inter side are the fixed Chroma4 UV transform), so no
Luma4Inter table is needed.

cdfflake-stream-seed45.bin pin: luma now MATCH on all 4 frames (was 359/2734
mismatched px on frames 2/3 pre-wiring); a residual ~33px delta-1 chroma-U
mismatch on frames 2/3 remains and is out of scope (chroma never reads a
tx_type symbol, so reduced_tx_set cannot reach it) -- a separate, smaller,
pre-existing defect.

Also removes the r1 bisect scratch instrumentation (msac.rs EC_RNG decoder
trace, decode.rs scratch_dump_prefilt/EC_AV1_PREFILT_DUMP_OURS) now that the
gap it was hunting is wired; scratch_isolate_pinned_mismatch,
scratch_decode_pinned_stream_once, and the pin fixtures stay.
wip(av1): reduced_tx_set=false inter tx sets -- CDFs + inverse transforms, NOT WIRED YETAhmet Kaan Gümüş · 8dbd683
wip(av1): reduced_tx_set=false inter tx sets -- CDFs + inverse transforms, NOT WIRED YET

Compiles clean; NOT YET reachable from any decode path (dying-words WIP,
budget exhausted mid-lane -- entropy layer is done, threading is not).

What this round did (root cause from r1: cdf_state.rs TxbSet::Luma16Inter/
Luma8Inter hardcode the reduced_tx_set=true 2-symbol table; a real aomenc
stream with reduced_tx_set=false needs wider sets there):

1. Transcribed from /tmp/libaom-src (entropymode.c:369-403, entropymode.h:
   169-185, blockd.h:1036-1122, common_data.h:149-159, av1_txfm.h:169-207,
   txb_common.h:32-47, aom_dsp/txfm_common.h:52-68):
   - av1_ext_tx_set_lookup[is_inter=1][tx_size_sqr==TX_16X16] gives, for a
     16x16 inter block, EXT_TX_SET_DTT9_IDTX_1DDCT (12 symbols) -- NOT
     DTT4_IDTX_1DDCT as the r1 handoff guessed (right symbol count, wrong
     set name); for 8x8 (and 4x4) inter, EXT_TX_SET_ALL16 (16 symbols).
   - New cdf.rs tables INTER_TX_TYPE_SET2_16 (TX_16X16 row of
     default_inter_ext_tx_cdf[EXT_TX_SET_DTT9_IDTX_1DDCT]) and
     INTER_TX_TYPE_SET1_8 (TX_8X8 row of
     default_inter_ext_tx_cdf[EXT_TX_SET_ALL16]), transcribed verbatim.
   - New cdf_state.rs storage (inter_tx_type_16_set2, inter_tx_type_8_set1),
     reset1-wired (adaptation) and seeded from the new cdf.rs tables in
     Cdfs::new -- both join the existing reset sweep so a forwarded-CDF
     frame carries them too (av1-cdffwd-three-bugs class: nothing here is a
     new table left off the forwarding/reset map).
   - New TxbSet::Luma16InterSet1/Luma8InterSet1 variants + txb() match arms.

2. Coverage check (tx-class-cross-cutting class, repo memory) -- swept
   every libaom array indexed by tx_type/tx_set for the new TxType members
   this needs (FLIPADST_DCT, DCT_FLIPADST, FLIPADST_FLIPADST, ADST_FLIPADST,
   FLIPADST_ADST, V_ADST, H_ADST, V_FLIPADST, H_FLIPADST -- 9 new variants):
   - transform.rs: TxType gained the 9 variants + from_symbol_set2_12 (12-
     symbol table, av1_ext_tx_inv[EXT_TX_SET_DTT9_IDTX_1DDCT]) +
     from_symbol_all16 (16-symbol, av1_ext_tx_inv[EXT_TX_SET_ALL16]).
   - axes(): FLIPADST reads the *same* 1D ADST kernel as ADST (common_data.h
     vtx_tab/htx_tab map both FLIPADST_1D and ADST_1D to the identical
     butterfly network) -- no new 1D transform to port, confirmed against
     av1_inv_txfm2d.c's inv_txfm2d_add_c (lines 234-316): the flip is pure
     post-processing (lr_flip reverses which column the column-pass reads,
     ud_flip reverses which output row the result lands in), never a
     different arithmetic kernel. Added TxType::flip() and rewired
     inverse_transform_2d_typed to read from an un-mutated `residual`
     buffer into a separate `out` buffer under the flip (the naive in-place
     version has a real RAW hazard: for side/2 columns, a flipped write at
     iteration j clobbers a source column iteration side-1-j will read
     later -- caught before it shipped, not left as a corner-cut).
   - decode.rs TxClass::of: V_ADST/V_FLIPADST -> Vert, H_ADST/H_FLIPADST ->
     Horiz (txb_common.h's tx_type_to_class table), matching V_DCT/H_DCT's
     existing treatment -- coefficient scan/context tables are already
     generic over TxClass, not TxType, so no further surface needed there.
   - decode.rs read_coeffs: CDF-length dispatch (already the crate's own
     idiom, doc'd at the read site) extended from 2-way to 4-way: 17 slots
     -> from_symbol_all16, 13 -> from_symbol_set2_12, 8 -> from_symbol_set1,
     else -> from_symbol (unchanged 2-/5-symbol sets).

3. NOT DONE (why this is WIP, not a fix): no call site actually threads
   reduced_tx_set into TxbSet::Luma16InterSet1/Luma8InterSet1 selection.
   decode_inter_frame_tile_with_cdfs (decode.rs:6197) does not even take a
   reduced_tx_set parameter -- the entire inter tile path hardcodes the
   reduced (2-symbol) inter tables today, unconditionally. Wiring needs:
     - reduced_tx_set: bool added to decode_inter_frame_tile/_with_cdfs
       (decode.rs:6147/6197) and its caller (stream.rs, frame-header
       reduced_tx_set bit -- already parsed for the key-frame/intra path,
       needs finding/threading for inter frames too).
     - threaded through decode_inter_block (4259) and decode_inter_block8
       (5384) as a new parameter, to their four call sites (6399, 6465,
       6535, 7307).
     - TxbSet::Luma16Inter -> Luma16InterSet1 and Luma8Inter ->
       Luma8InterSet1 selection gated on !reduced_tx_set at decode.rs:6484,
       7326 (Luma16*) and 5746, 5940 (Luma8*) -- mirroring txbset_for's
       existing reduced_tx_set match, but for the inter call sites which
       currently have no such helper.
     - the pinned repro (cdfflake-stream-seed45.bin) will not go green
       until this wiring lands; not run this round since the desync path
       is still unreached.
   Intra ext-tx (default_intra_ext_tx_cdf) was NOT re-checked for the same
   hardcoding this round -- r8's comment (Luma8Set1/Luma4Set1 exist) says
   intra's reduced_tx_set split is already handled at 8x8/4x4, and 16x16
   intra is DCT_IDTX-set-only regardless of the flag per
   av1_get_ext_tx_set_type (`tx_size_sqr == TX_16X16` branch skips the
   `use_reduced_set` check for BOTH is_inter values) -- so intra should
   already be correct, but this was reasoned, not re-verified against
   entropymode.c line by line this round.
   Also unaddressed (pre-existing, r1-noted gap): no Luma4Inter path exists
   at all in this crate -- an inter TX_4X4 transform (also EXT_TX_SET_ALL16
   under reduced_tx_set=false, TX_4X4 row of the same CDF, not yet
   transcribed) has nowhere to decode to. Out of this round's scope.
wip(av1): root-cause cdfflake-stream-seed45 pin -- reduced_tx_set=false inter tx_type gapAhmet Kaan Gümüş · dcd3feb
wip(av1): root-cause cdfflake-stream-seed45 pin -- reduced_tx_set=false inter tx_type gap

Bisected the pinned frame-2 mismatch (cdfflake-stream-seed45.bin, 359/4096
luma px, worst delta 6, right-edge block). Added scratch instrumentation
(env-gated, zero behavior change): scratch_dump_prefilt in decode.rs
(EC_AV1_PREFILT_DUMP_OURS, mirrors the instrumented aomdec's own
EC_AV1_PREFILT_DUMP) and an EC_RNG per-symbol trace in msac.rs
(SymbolDecoder::symbol_fixed), matching libaom's aom_dsp/entdec.c format
exactly (rng_before/rng_after/nsyms/symbol, shared global counter).

Verdict: PIXEL-PATH, not entropy garbage-cascade in the usual sense --
pre-deblock buffers already differ (497/4096 luma mismatches at frame 2,
rows 48-63 cols 32-63, exactly the mi(12,8)/mi(12,12) 16x16x2 region),
proving the defect is in reconstruction, but the root symbol-level cause
IS a real entropy divergence: gdb-bisected via `EC_RNG` + a conditional
breakpoint on od_ec_decode_cdf_q15 in the instrumented aomdec build to
n=787, which resolves (backtrace) to av1_read_tx_type ->
decodetxb.c:read_coeffs_txb, nsyms=12 -- libaom's EXT_TX_SET_DTT4_IDTX_1DDCT,
selected by av1_get_ext_tx_set_type(TX_16X16, is_inter=1,
use_reduced_set=0) (blockd.h:1097, av1_ext_tx_set_lookup[1][1]). Our
decoder read a 2-symbol table (nsyms=2) at the same point instead.

Root cause: cdf_state.rs's TxbSet::Luma16Inter (and Luma8Inter) are
hardcoded to the *reduced_tx_set=true* 2-symbol EXT_TX_SET_DCT_IDTX table
only (doc comments there already say so explicitly); this crate's own
writer always emits reduced_tx_set=true so the gap never showed up on a
round-trip test. A real aomenc stream with reduced_tx_set=false (this
pin) hits an inter 16x16 block whose tx_type this decoder cannot read at
all -- it silently misreads a binary CDF where the real bitstream encoded
a 12-way EXT_TX_SET_DTT4_IDTX_1DDCT symbol, desyncing the rest of the
frame's own coefficient reads (491 more luma reads through the tile) and
poisoning the CDFs forwarded into frame 3.

Same-shape sibling gaps found by reading av1_get_ext_tx_set_type
(NOT yet fixed, name only): 8x8 inter + reduced_tx_set=false wants
EXT_TX_SET_ALL16 (16-symbol), also unimplemented (Luma8Inter is likewise
reduced-only per its own doc comment). 32x32+/64x64 inter are fine
(EXT_TX_SET_DCT_IDTX unconditionally regardless of reduced_tx_set, per
blockd.h:1101-1102) -- Luma32Inter's existing 2-symbol table is already
correct there.

NOT fixed this round (budget): needs a new TxbSet::Luma16InterSet1
(12-symbol CDF, transcribed from libaom entropymode.c
default_inter_ext_tx_cdf[EXT_TX_SET_DTT4_IDTX_1DDCT][TX_16X16], + the
EXT_TX_SET_DTT4_IDTX_1DDCT symbol->TxType mapping from
av1_ext_tx_used/inter table), wired into decode_inter_block's TxbSet
selection (currently hardcoded to TxbSet::Luma16Inter at every call site,
e.g. decode.rs:6484) gated on `!reduced_tx_set`, and the same for
TxbSet::Luma8InterSet1 (16-symbol EXT_TX_SET_ALL16). Dying words: pull
default_inter_ext_tx_cdf's 16x16-DTT4_IDTX_1DDCT row (12 probs) and the
matching tx_type index table from
/tmp/libaom-src/av1/common/av1_entropymode.c +
av1/common/enums.h(EXT_TX_SET_DTT4_IDTX_1DDCT symbol order), add the two
TxbSet variants + a reduced_tx_set-gated select at every `16 =>` /
`8 if reduced_tx_set` dispatch site feeding an inter block, then rerun
scratch_isolate_pinned_mismatch on cdfflake-stream-seed45.bin to confirm
4/4 frames byte-exact, then remove scratch_dump_prefilt/EC_RNG (or leave
as documented scratch, orchestrator's call), then the cdf-forwarding gate
5x + full ec-av1 --lib suite 3x.
Merge branch 'lane-av1idx': compound_idx defect class closed -- neighbours vote with both reference slotsAhmet Kaan Gümüş · 9cd7fd0
Merge branch 'lane-av1idx': compound_idx defect class closed -- neighbours vote with both reference slots

Seven rounds. mvstack single-ref scans and the extension pass now match
either of a compound neighbour's two coded references (libaom
add_ref_mv_candidate rf_idx loop); switchable_interp ctx gains
INTER_FILTER_COMP_OFFSET and either-ref filter matching. Pinned stream
20/20 byte-exact, both wide compound gates 10/10, older compound pin
24/24; class sweep of every neighbour-ctx site clean. Bisect scratch
instrumentation removed.
chore(av1): remove bisect scratch instrumentation (SREF/COMPIDX/COMPOUND_DEBUG/r17 dump)Ahmet Kaan Gümüş · d6ab49e
chore(av1): remove bisect scratch instrumentation (SREF/COMPIDX/COMPOUND_DEBUG/r17 dump)

Strips the env-gated dump machinery (EC_AV1_SREF_DUMP, EC_AV1_COMPIDX_DUMP,
EC_AV1_COMPOUND_DEBUG, BITPOS_BLK_START, IFILTER_RS prints) and the r17_dump
frame-counter/PREFILT/POSTFILT scaffolding from decode.rs/stream.rs, plus the
three scratch #[ignore] tests that depended on it in stream.rs
(scratch_decode_pinned_stream, scratch_dump_compound_idx_cdf_state,
scratch_sweep_compound_mismatch). Keeps scratch_isolate_pinned_mismatch and
scratch_decode_pinned_stream_once as generic pin-repro tools, GATE_COUNTER_LOCK,
the hardened cdf gate, pin fixtures, tile.rs's own EC_RNG trace, and the
comp_group_idx==1 wedge/diffwtd refusal untouched.
wip(av1): r6 -- sweep clean, class sweep clean, CURRENT_OP scaffolding removedAhmet Kaan Gümüş · a3b0b8a
wip(av1): r6 -- sweep clean, class sweep clean, CURRENT_OP scaffolding removed

Sweep: both wide gates (reference_select, compound_references) 10/10
green, all pixel-exact, no defect found. Old pins re-verified: av1blend-
r1-mismatch.obu 24/24 MATCH (already closed by r6/r7's ref_ctx fix, not
a new result); cdfflake-stream-seed45.bin still mismatches at frame 2
(359/4096 luma, worst delta 6) -- unrelated cdf-forwarding defect, NOT
closed by the mvstack fix.

Charter's "comp_group_idx==0 refusal" premise did not match HEAD
8f08e06: only a comp_group_idx==1 (wedge/diffwtd) refusal exists, which
is a genuinely-unsupported blend type the charter itself says must stay
masked. No comp_group_idx==0/compound_idx refusal exists anywhere in
decode.rs -- that path is already live and unmasked, and the sweep
confirms it is currently defect-free. Nothing to unmask.

Class sweep (neighbour votes all its fields): every remaining site
(single_ref/comp_ref/comp_bwdref/uni_comp_ref ctx family,
reference_mode_ctx, comp_reference_type_ctx, get_comp_group_idx_context,
get_comp_index_context, switchable_interp_ctx, the either-ref filter_ctx
checks) already threads both compound slots correctly -- verified
against mvstack.rs/decode.rs source, no new bug found.

Cleanup (partial, budget-bound): removed msac.rs's EC_RNG trace block
and the CURRENT_OP thread_local plus all 102 call sites in decode.rs
that set it. tile.rs's separate, older EC_RNG trace (lane-av1truesize,
still load-bearing for the encoder side) is untouched -- out of this
lane's scope. Still owed: EC_AV1_SREF_DUMP/EC_AV1_COMPIDX_DUMP/
EC_AV1_COMPOUND_DEBUG/BITPOS_BLK_START blocks, r17_dump/
R17_DUMP_FRAME_IDX (EC_AV1_PREFILT/POSTFILT_DUMP), and scratch_* #[ignore]
tests beyond the two pin-repro tools -- next round.

cargo test -p ec-av1 --lib: 214 passed/0 failed/19 ignored (individual
runs); one flaked FAILED in a full-suite run reproduced green in
isolation -- pre-existing aomenc-RD-nondeterminism flake class, not a
regression from this change.
fix(av1): single-ref mvstack scan votes a compound neighbour's second slotAhmet Kaan Gümüş · 2b9615f
fix(av1): single-ref mvstack scan votes a compound neighbour's second slot

Named read #538 (EC_RNG global trace): L5039, the new_mv symbol in
decode_inter_block16's single-ref path, fed a new_mv_ctx computed from
find_mv_stack_with_sign_bias. Its row/col/corner scans and the
single-ref extension pass (process_single_ref_mv_candidate) matched a
neighbour on info.ref_frame alone, silently dropping the vote whenever
a compound-coded neighbour's match sat in its second slot
(ref_frame1/mv1) -- the third instance of the neighbour-votes-all-its-
fields class. Frame 10 (decode order) has reference_select=true, so a
compound neighbour is live next to the diverging single-ref query.

Added single_ref_match() (mirrors libaom's add_ref_mv_candidate `for
ref in 0..1+is_compound`), used by scan_row/scan_col/scan_corner/
scan_top_right; extended process_single_ref_mv_candidate to donate
both of a compound candidate's slots instead of just the first.

Proof: av1idx-refsel-pin.obu (20 frames) now 60/60 plane-MATCH against
ffmpeg (0 mismatches), 3x. Full ec-av1 --lib suite 214/0/19 green.

Also: added a CURRENT_OP thread-local (msac.rs) plus a per-call-site
tag before every dec.symbol()/symbol_fixed() read in decode.rs (r5
scratch instrumentation, EC_RNG=1 trace now prints op=L<line>), and a
reference_select/primary_ref_frame field on the EC_AV1_SREF_DUMP print
(stream.rs) used to confirm frame 10's header state.
wip(av1): r4 -- EC_RNG global trace finds the real desync read, r3's frame-8 fidx claim falsifiedAhmet Kaan Gümüş · d0ddce6
wip(av1): r4 -- EC_RNG global trace finds the real desync read, r3's frame-8 fidx claim falsified

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.
wip(av1): r3 -- r2's ref1 fix real but does not close the pin; isolate to one switchable_interp symbolAhmet Kaan Gümüş · 8cbebd5
wip(av1): r3 -- r2's ref1 fix real but does not close the pin; isolate to one switchable_interp symbol

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.
wip(av1): r2 -- interp filter ctx matches neighbour's SECOND ref tooAhmet Kaan Gümüş · 49ec72b
wip(av1): r2 -- interp filter ctx matches neighbour's SECOND ref too

get_ref_filter_type: a neighbour votes with EITHER of its two references
(record_compound_ctx supplies the real second ref); ref0-only matching
dropped real filter matches to the no-neighbour sentinel. Second instance
of the neighbour-votes-all-its-fields class.

Dying words: checking whether the per-OBU loop's local header is
stale/different vs the header used elsewhere for the same frame.
Merge branch 'lane-h265rdoq': estimated fracbits RDOQ trial costing, default onAhmet Kaan Gümüş · 5296865
Merge branch 'lane-h265rdoq': estimated fracbits RDOQ trial costing, default on

ENTROPY_BITS table (HM/x265 entropyBits idiom) replaces exact CABAC
replay inside RDOQ candidate costing; committing coder still writes real
bins. 1.61x encode speedup; BD vs x265 improves on real clips (film YUV
-0.002 -> +0.071 dB, screen -1.576 -> -1.457 dB). rdoq_estimate=false
keeps the exact path for A/B.
fix(av1): switchable_interp compound-block ctx offset; re-pin second compound_idx defectAhmet Kaan Gümüş · 3ab7e16
fix(av1): switchable_interp compound-block ctx offset; re-pin second compound_idx defect

Fix (real, spec-verified): switchable_interp_ctx never folded in libaom's
INTER_FILTER_COMP_OFFSET (av1_get_pred_context_switchable_interp,
pred_common.c) for a block that itself has a second reference -- a stale
"this decoder never codes a compound reference" doc comment baked the
offset to always-0. resolve_interp_filter now takes is_compound and adds
+4 to the CDF context bucket for the compound leaf16 call site only (the
single-ref leaf16 call site passes false; leaf8 still never resolves a
switchable filter at all -- pre-existing documented corner-cut, out of
scope this round).

Bisect (lane-av1idx r1): unmasked both comp_group_idx==0 refusals locally,
looped a_real_aomenc_stream_with_reference_select_reads_comp_mode_correctly
with EC_AV1_GATE_DUMP until a mismatch pinned (seed 61) ->
fixtures/av1idx-refsel-pin.obu. Confirmed deterministic 3x via
scratch_isolate_pinned_mismatch. First divergence: decode-order frame 8
(the stream's one Switchable-interpolation-filter frame), small deltas
(worst 1-2), 149-299 luma px, propagating through frames 9-12 via DPB
reference before frames 13-19 return to MATCH -- consistent with a wrong
CDF context bucket (occasional wrong bit) rather than a hard desync.

Re-tested the pinned fixture after the ctx-offset fix: mismatch UNCHANGED
(same frame, same deltas) -- this fix is real and kept, but does not
explain this fixture's defect. A second, still-unfound compound_idx bug
remains. Re-masked both refusals (still non-pixel-exact beyond the two
bugs now fixed across lane-av1blend r6/r7 + this round).

Next step: scratch_isolate_pinned_mismatch already narrows it to frame 8's
own decode or an upstream DPB slot corruption reaching it -- bisect frame
8's tile decode (EC_TOK/EC_PART trace vs instrumented aomdec) now that the
fixture is small (501 bytes, 20 frames of 64x64) and cheap to iterate on.

Both wide gates green (legal named refusal), cargo test -p ec-av1 --lib
--skip aomenc: 196 passed/0 failed/19 ignored.
perf(h265): estimated per-context fracbits table replaces exact CABAC replay in RDOQ trial costingAhmet Kaan Gümüş · 50e18de
perf(h265): estimated per-context fracbits table replaces exact CABAC replay in RDOQ trial costing

RDOQ's per-candidate rate was priced by re-simulating the exact adaptive
CABAC coder for every trial (encode_subblock measured 26% self time, cost
structural to exact counting since range/low/context state carries forward).
Adds an x265/HM-`entropyBits`-style estimated fractional-bit table
(ENTROPY_BITS[64], entropy of the current CDF/probability state via the
CABAC probability-state geometric model, alpha=0.9493) and a CabacEncoder
`estimating` mode that looks it up instead of replaying range/renorm
arithmetic. Only RDOQ's dedicated counting instrument (`rdoq_enc`) ever
estimates; the committing encoder always writes exact bits, so streams stay
conformant.

Measured: ec-bench h265 640x360x10f encode ~2953ms -> ~1833ms (1.61x, 4-run
median each). bd_psnr_vs_x265 (synthetic clip): BD-PSNR-YUV +7.880 -> +7.948
dB vs x265 (a gain, not a loss), wall time 28.85s -> 20.70s. Both comfortably
clear the repo's adopt bar (speedup >=1.15x, BD loss <=0.05 dB) with room to
spare, so `EncoderConfig::rdoq_estimate` defaults on; `false` keeps the
exact-replay path for A/B. rdoq_cache_hash's pinned bytes re-pinned to the
new default's output.
Merge branch 'lane-av1blend': ref-frame ctx counts both compound-neighbour refs; interp_filter read orderAhmet Kaan Gümüş · c806031
Merge branch 'lane-av1blend': ref-frame ctx counts both compound-neighbour refs; interp_filter read order

Seven-round bisect. Real fixes: mvstack ref_ctx family now counts both
refs of a compound neighbour (libaom av1_collect_neighbors_ref_counts);
resolve_interp_filter read moved after the compound reads per spec
5.11.19. Pinned compound fixture now decodes 24/24 frames byte-exact
unmasked; a second compound_idx defect remains, so comp_group_idx==0
blends stay refused-by-name and gates stay green. Trace instrumentation
from the bisect rides along, cleanup queued.
Merge branch 'lane-h265perf': hoist loop-invariant scan/size derivation out of encode_subblockAhmet Kaan Gümüş · e117d90
Merge branch 'lane-h265perf': hoist loop-invariant scan/size derivation out of encode_subblock

Bit-exact (identical AU bytes), suite green; wall-clock inert at bench
scale -- kept for the removed redundant recompute. Real RDOQ lever
(estimated bit-cost table) goes to its own BD-gated lane.
fix(av1): r7 -- fix leftover test call sites for the r6 ref_ctx fix, but re-mask compound_idx blendAhmet Kaan Gümüş · 3f636a9
fix(av1): r7 -- fix leftover test call sites for the r6 ref_ctx fix, but re-mask compound_idx blend

Two stream.rs test call sites (single_ref_p1/p3/p5_ctx) still used the pre-r6
2-arg signature, so the crate did not compile after r6's committed fix -- now
pass all four (above0, above1, left0, left1).

Verification of r6's own claim ("root cause found") does NOT hold up under the
wide gate sweep: the fresh seed-45 pinned fixture (av1blend-r1-mismatch.obu)
now decodes byte-exact for all 24 frames/72 planes, confirming r6/r7's
mvstack.rs ref_ctx fix (single_ref_p*/comp_ref*/comp_bwdref* now count both
sides of a compound neighbour, matching libaom's
av1_collect_neighbors_ref_counts) is a real, independently-correct fix -- kept.

But re-running a_real_aomenc_stream_with_compound_references_decodes_pixel_exact
and a_real_aomenc_stream_with_reference_select_reads_comp_mode_correctly
(cq-level=45, many seeds) with the plain-average (comp_group_idx == 0) blend
unmasked on that fix alone still mismatches roughly half the time, at a
different frame each run for the identical seed (aomenc's own cpu-used=0 RD
search is run-to-run nondeterministic, so "same seed" is not "same
bitstream"). r6's own residual-mismatch note already flagged this: 321/846
mismatched pixels in its analysis did not fit the (9,7)-vs-plain-average
hypothesis its fix addresses either -- more than one compound_idx bug lives
here. Re-masked both leaf16 and leaf8's comp_group_idx == 0 path (dead code
kept beneath, #[allow(unreachable_code)]) rather than ship a blend that is
right only sometimes; widened the reference_select gate's refusal-accept
back to accept COMPOUND_REFERENCE, since that refusal is legal again.

cdfflake pin (frame 2 luma 359/4096, right-edge col 63, seed 45,
w=64 h=64 n=4) reproduces exactly as pinned -- unrelated to this lane's
compound work, still open.

Full `cargo test -p ec-av1 --release --lib` 214/0/19 green x2.
perf(h265): hoist scan-table lookups out of encode_subblock's hot RDOQ loopAhmet Kaan Gümüş · b54343a
perf(h265): hoist scan-table lookups out of encode_subblock's hot RDOQ loop

profile-first (perf record on ec-bench's 640x360x10f h265 encode row):
encode_subblock is 26% self time, the single hottest symbol, driven by
RDOQ's per-trial tail re-encode (encode_subblock_range walks every
sub-block from the trial position down to sub-block 0 on every candidate,
since a real adaptive-CABAC bit count cannot be decomposed into a local
delta -- range/low state and context adaptation both carry forward). That
replay cost is structural to exact-CABAC RDOQ and not safely reducible
without changing which candidate wins (disallowed: this lane's gate is
bit-exact output before/after).

What's still free: log2_size/sub_wide/the two scan tables were re-derived
from `n` on every single encode_subblock call, even though they are loop
invariants for the whole encode_subblock_range walk (and, in rdoq's own
direct-call site, invariant for the whole rdoq() call). Hoisted to the
callers and threaded through as parameters -- same values, fewer
recomputations, zero behavior change.

Verified bit-exact: sha256 of ec-bench's h265 AU output identical
before/after (temporary EC_BENCH_DUMP_H265_AUS dump hook, reverted).
cargo test -p ec-h265 --release: 57 passed, 0 failed, including the
pinned rdoq_cache_hash tests. No measurable wall-clock change at the
640x360x10f bench's scale (~2610-2650ms both sides, noise-dominated) --
this hoist's savings are real but too small relative to the required
CABAC replay volume to show above that noise floor.
wip(av1): r6 root cause -- ref-frame ctx undercounts compound neighboursAhmet Kaan Gümüş · d706250
wip(av1): r6 root cause -- ref-frame ctx undercounts compound neighbours

libaom av1_collect_neighbors_ref_counts (mvref_common.h) counts BOTH
ref_frame[0] and ref_frame[1] of a compound neighbour; our ref_ctx family
took one scalar per side, so every single_ref/comp_ref/comp_bwdref ctx row
was wrong next to a compound neighbour -- value-equal decodes with
different interval narrowing, drifting entropy state into compound_idx.
All vote functions now take each side's pair. Compiles clean.

Dying words: rebuild and rerun the failing test, then full proof chain
(unmask both blends, seed-45 byte-exact, cdfflake pin re-decode, gates 3x,
suite 3x, scratch cleanup).
fix(av1): r5 -- interp_filter read-order spec bug (real, inert on this fixture); re-mask leaf16 blend, deepen compound_idx traceAhmet Kaan Gümüş · 4d7335c
fix(av1): r5 -- interp_filter read-order spec bug (real, inert on this fixture); re-mask leaf16 blend, deepen compound_idx trace

Two things this round:

1. Real bug, independently found and fixed: `resolve_interp_filter`'s
   symbol read sat BEFORE `comp_group_idx`/`compound_idx` in the compound
   leaf16 path. Spec 5.11.19 / libaom decodemv.c:1575 reads
   `read_mb_interp_filter` AFTER `read_compound_type`, not before. Moved
   the call to after the compound_idx read (still before its h_filter/
   v_filter are used for MC). Confirmed via a one-off dump that this
   fixture's own stream carries `interp_fixed = Some(Regular)` (fixed,
   non-Switchable filter), so the reorder moves zero bits here and does
   NOT explain the fixture's mismatch -- kept anyway as a genuine,
   independently-verified spec-order fix for the next Switchable-filter
   compound stream.

2. r4 had left leaf16's compound blend UNMASKED (live) with no gate rerun;
   confirmed this round that live state FAILS both compound gates (frame
   17 luma mismatch, seed 42). Re-added leaf16's refusal-by-name (matching
   leaf8's existing one), restoring both compound gates to green
   (a_real_aomenc_stream_with_compound_references_decodes_pixel_exact,
   a_real_aomenc_stream_with_reference_select_reads_comp_mode_correctly,
   1x each) and the full `cargo test -p ec-av1 --release --lib` suite to
   213 passed / 1 failed (bwdref-reference gate, known parallel-run flake
   per ledger's "PID-keyed temp path" class -- green standalone).

Root cause of the actual compound_idx mismatch is still open. This round
falsified: CDF-forwarding-map gap (rebuilt+ran the instrumented aomdec's
own COMPIDX_PRE dump -- ctx0..ctx5 identical to ours at the same frame,
byte for byte) and the interp_filter reorder (inert here, see above).
Comparing `SymbolDecoder::debug_bitpos()` to aomdec's `aom_reader_tell()`
is NOT a valid probe (different quantities -- see the code comment right
above the restored refusal) -- do not repeat it. Next real lead: audit
`read_comp_mode`/`read_compound_ref_frames`/`read_inter_compound_mode`'s
own context computations for this exact (LAST, BWDREF) pair -- all three
decode the SAME symbol values as aomdec on this block (ref0=1, ref1=5,
mode=NEAREST_NEARESTMV), which does not rule out a context/CDF mismatch
that happens to decode the same value while still narrowing `range` by a
different amount than aomdec, drifting entropy state into the next read
(compound_idx) without ever showing up as a value mismatch upstream.

Scratch instrumentation kept, not cleaned up (r1-r5 EC_AV1_COMPIDX_DUMP/
EC_AV1_COMPOUND_DEBUG dumps, IFILTER_PRE/BITPOS_BLK_START additions this
round, scratch_dump_compound_idx_cdf_state/scratch_sweep_compound_mismatch
tests) -- budget spent on the bisection above, not cleanup.
wip(av1): r4 compound_idx CDF-state trace instrumentation, built not yet runAhmet Kaan Gümüş · dc3404f
wip(av1): r4 compound_idx CDF-state trace instrumentation, built not yet run

COMPIDX_PRE dumps per-frame pre-tile compound_idx CDF words; COMPIDX_BLK/VAL
trace every read. scratch_dump_compound_idx_cdf_state pins the fixture run.
fix(av1): r3 bisect -- falsify deblock hypothesis, narrow BWDREF compound defect to compound_idx's decoded valueAhmet Kaan Gümüş · 210dfc8
fix(av1): r3 bisect -- falsify deblock hypothesis, narrow BWDREF compound defect to compound_idx's decoded value

Recalibrated the r2 pre-deblock frame-index gap (23 ours vs 24 aomdec
dumps): the keyframe never calls this crate's own r17_dump at all
(only decode_inter_frame_tile does) -- not a real alignment bug.
Content-hash-matched every pre-deblock dump against an instrumented
aomdec build: PRE-deblock already differs at decode-order frame 3
(fixtures/av1blend-r1-mismatch.obu, seed 45), falsifying the
deblock-parameterization hypothesis. decodemv's own EC_TRACE
(mode/mv/skip) matches this decoder's block loop exactly for every
block in that frame, and both compound inputs are independently
bit-exact pre- and post-deblock. Solving aomval = (key*w0+bwd*w1+8)>>4
against the ~20% of mismatching luma pixels picks out w0=9, w1=7 for
the majority with zero matches for the plain average this decoder
emits -- compound_idx is being decoded as 1 (simple average) when the
real bitstream encoded 0 (COMPOUND_DISTWTD, whose weights for this
frame's order-hint distances are exactly (9, 7)). CDF table, context
function, and read gate were all independently reverified correct
against libaom source; the wrong value is local to this one symbol's
decode, not a wider desync. Masks stay in place, comments updated
with the narrowed finding for the next round.
fix(av1): r2 bisect -- BWDREF compound divergence is per-block, not DPB slotAhmet Kaan Gümüş · 70c2a11
fix(av1): r2 bisect -- BWDREF compound divergence is per-block, not DPB slot

r1's fixture (av1blend-r1-mismatch.obu) was gitignored and lost; could not
be regenerated byte-exact. Static review of stream.rs's ref_slots/
refresh_frame_flags/cdf_slots bookkeeping and the show_existing_frame
refresh arm (spec 7.21, already correctly gated on frame_type==Key in
ec-av1-syntax's frame.rs) found nothing wrong -- the DPB slot bookkeeping
r1 suspected is spec-correct.

A fresh unmasked sweep (seed 45, same recipe) isolated a narrower shape:
decode-order frame 3 (BWDREF compound, zero MV, simple average) is the
first to diverge from ffmpeg even though both its compound inputs are
independently proven pixel-exact and the blend arithmetic is the same
formula r1 proved algebraically exact. That rules out a stale/wrong
reference picture for this fixture -- the defect is in that frame's own
per-block decode (entropy desync or the compound mode/MV read itself),
not reference-slot bookkeeping. Not isolated further within budget.

Both masks stay (comp_group_idx == 0 and == 1); instrumentation is
env-gated (EC_AV1_COMPOUND_DEBUG frame-state trace in stream.rs,
scratch_sweep_compound_mismatch to find a fresh repro seed). Full
`cargo test --release -p ec-av1 --lib`: 214 passed, 0 failed, 18 ignored.
Merge branch 'lane-cdfflake': harden the CDF-forwarding gate — length asserts, fingerprints, on-mismatch pinningAhmet Kaan Gümüş · 81586f2
Merge branch 'lane-cdfflake': harden the CDF-forwarding gate — length asserts, fingerprints, on-mismatch pinning

The gate's rare parallel-run failure is now proven a real deterministic
decode defect (pinned stream reproduces standalone 3/3), not subprocess
instability; the decoder fix is tracked on the compound/DPB lane.
fix(av1): pin a real cdf-forwarding decode defect, harden the gate's instrumentationAhmet Kaan Gümüş · bc99468
fix(av1): pin a real cdf-forwarding decode defect, harden the gate's instrumentation

The cdf-forwarding gate's rare parallel-run "flake" is not instability: a
standalone 3x-reproduction of the pinned seed-45 stream deterministically
mismatches frame 2 luma (359/4096 bytes, first diff row 43 col 63) every
time -- a real decode defect that only a lucky seed sequence exposes, not
a race. The gate itself never reads a counter-gated compare (no
GATE_COUNTER_LOCK coverage needed here), so hypothesis A's "attempt
selection" shape does not apply to this test.

Hardens the gate for future triage instead of masking the defect:
- hard length assert on the y4m fixture (header + frames*(6 + w*h*3/2))
- FNV-1a fingerprints of the y4m/stream/ffmpeg-raw bytes on every attempt
- unconditional (no env var needed) pin-to-scratchpad of both the aomenc
  stream and ffmpeg's raw reference bytes on any mismatch

Repro pinned at /tmp/.../scratchpad/cdfflake-stream-seed45.bin (gitignored
scratchpad, not committed) for the follow-on lane that fixes the decoder.
fix(av1): r1 bisect -- falsify the compound-blend arithmetic hypothesisAhmet Kaan Gümüş · 793125d
fix(av1): r1 bisect -- falsify the compound-blend arithmetic hypothesis

r16/r17 called the masked COMPOUND_REFERENCE reconstruction a
predict_compound_intermediate/combine_compound rounding bug. Unmasking
both sites and running the real gates falsifies that: combine_compound's
combined round2 shift is proven algebraically identical to libaom's
separate DIST_PRECISION_BITS-then-ROUND_POWER_OF_TWO sequence, and a
whole-pel zero-MV compound block reproduces aomdec's own pre-deblock
dump byte-for-byte for several consecutive frames (decode-order 0, 1,
10-18 of the r1 gate fixture).

The real defect: decode-order frame 2 (first block pair to reference
BWDREF_FRAME instead of ALTREF_FRAME, same zero MV, same math shape as
the matching frame 1) is the first frame to diverge from aomdec, and
the corruption propagates into every later frame via refresh_frame_flags
regardless of which reference a later block names -- a DPB slot/
reference-bookkeeping bug, not an MC/blend arithmetic bug. Re-masked
both sites (comp_group_idx == 0) with the corrected root-cause comment;
kept the r17_dump/EC_AV1_COMPOUND_DEBUG instrumentation used to find
this, per the bisect's own re-mask-and-report contingency.
Merge branch 'lane-av1comp': compound-reference symbol chain, skip_mode decode, show_existing_frame outputAhmet Kaan Gümüş · 0b7c477
Merge branch 'lane-av1comp': compound-reference symbol chain, skip_mode decode, show_existing_frame output

17 rounds. Compound refs read fully (comp_mode through per-side MV assign,
comp_group_idx/compound_idx, DRL) in both block paths; skip_mode decoded
(forced NEAREST_NEARESTMV of the SkipModeFrame pair); show_existing_frame
now outputs the named slot instead of emitting hidden altrefs in decode
order. Compound MC blend is implemented but masked by a named refusal:
a real-stream reconstruction defect (one 32x32 quadrant, pre-deblock,
loop filter cross-checked clean) is pinned with live r17_dump scaffolding
and stays a lane away from unmasking.
fix(av1): r17 bisect -- falsify loop-filter hypothesis for the masked compound blendAhmet Kaan Gümüş · 80caed5
fix(av1): r17 bisect -- falsify loop-filter hypothesis for the masked compound blend

r16 called the plain-average COMPOUND_REFERENCE blend defect
"loop-filter-shaped". r17 adds an env-gated pre/post-deblock frame dump
(decode.rs's r17_dump, EC_AV1_PREFILT_DUMP/EC_AV1_POSTFILT_DUMP, matching
aomdec's own hooks of the same name) and a one-shot pinned-stream decode
test (stream.rs's scratch_decode_pinned_stream_once, needed so this
decoder's own frame-index counter lines up with aomdec's numbering).

Result: the 32x32-quadrant mismatch (898/1024 px, rows 32-63 cols 32-63 of
a 64x64 luma plane) is already present *before* this decoder's own loop
filter runs, at parity with aomdec's own pre-deblock buffer for the same
frame -- this falsifies "loop-filter-shaped, not a desync" from r16. It is
a predict_compound_intermediate/combine_compound reconstruction defect.
Root cause still not isolated within that arithmetic (out of this round's
budget); both refusal sites stay masked, with the comment corrected to
this finding and the exact fixture location so the next round can bisect
predict_compound_intermediate itself instead of the loop filter.

Task B (cdf_forwarding-gate flake) not reached this round -- no budget
left after the bisect; the flake did not fire in 3x full-suite runs here
either (214 passed/0 failed/17 ignored each), consistent with its known
low reproduction rate.
fix(av1): mask non-pixel-exact COMPOUND_REFERENCE plain-average blend — r16Ahmet Kaan Gümüş · 232e604
fix(av1): mask non-pixel-exact COMPOUND_REFERENCE plain-average blend — r16

Root cause found: the reference_select/compound_references gate flake was
not a test-harness or counter race (aomenc encode is byte-deterministic
under load, decode_stream is deterministic and pure; both proven by
standalone repro). It is a real, seed/content-dependent defect in the
compound plain/distance-weighted average blend (predict_compound_intermediate
+ combine_compound): a saved aomenc seed-42 stream decodes with up to 4/255
error concentrated in one 32x32 quadrant (683/1024 px), spilling a few px
into neighbours -- loop-filter-shaped, not a desync. DRL/assign_compound_mv/
dist_wtd_comp_weight_assign were cross-checked bit-for-bit against libaom
decodemv.c/reconinter.c and match; round_offset omission in
predict_compound_intermediate is provably a no-op (bias cancels exactly
under arithmetic right shift). True cause not isolated in budget.

Masks comp_group_idx == 0 (the only path this decoder ever reaches) at both
call sites, matching the existing comp_group_idx == 1 mask style -- refuses
by name instead of shipping a non-pixel-exact compound reconstruction.
"pixel-flaky gate = unpinned defect, always" (ledger).
feat(av1): add skip_mode CDF table + adaptation state (unwired)Ahmet Kaan Gümüş · 3403b03
feat(av1): add skip_mode CDF table + adaptation state (unwired)

default_skip_mode_cdfs (libaom entropymode.c, SKIP_MODE_CONTEXTS=3) ported
as cdf::SKIP_MODE, plumbed through Cdfs::new/reset/forwarding the same way
comp_mode/comp_group_idx are. Not yet read by any block decoder -- the
frame-level skip_mode_params() derivation (spec 5.9.22) already lives in
ec-av1-syntax's read_skip_mode_params (SkipModeFrame ref-pair via nearest
forward/backward order-hint distance, matching libaom
av1_setup_skip_mode_allowed bit for bit) and needed no change; the
block-level skip_mode symbol read (spec 7.11.3, forced NEAREST_NEARESTMV
compound + skip=1, decodemv.c read_skip_mode/read_inter_block_mode_info)
is the next round's work, still refused by name at stream.rs:191.