Commits
2026-09-12
ec-vp8 M3: census merge fix — above-left third-candidate merge is ALIVE in libvpx, mode records now agree read-for-read for all 60 MBsAhmet Kaan Gümüş · 71acae1
ec-vp8 M3: census merge fix — above-left third-candidate merge is ALIVE in libvpx, mode records now agree read-for-read for all 60 MBs The predecessor's 'dead in libvpx too' note about the cnt[CNT_SPLITMV] merge was a misread: when the above-left pushes a THIRD distinct candidate, cntx reaches slot 3 and its count lands in cnt[CNT_SPLITMV], so decodemv.c:366's merge check sees it non-zero and absorbs the candidate into NEAREST when it equals the nearest. Rust's find_near_mvs already implemented this correctly (the ported guard is live); the model lacked the merge entirely. Model fixed (plus a closure-scope idx/ix bug it exposed) — CNT and SP streams now zero-diff across all 60 MBs of gop frame 1, and the B streams agree through the entire mode-record phase (first divergence moved into frame 1's token phase at MB(0,1)'s Y2, prob 131 vs 202 — next suspect: the frame-0 refresh_entropy revert path feeding frame 1's coef prob tables).
ec-vp8 M3 debugging: inter census localization — model extended to inter frames, divergence pinned to MB(2,7) census countAhmet Kaan Gümüş · 1c98b09
ec-vp8 M3 debugging: inter census localization — model extended to inter frames, divergence pinned to MB(2,7) census count vp8ref_model.py now parses inter frames (refresh header, prob_intra/ last/gf, ymode/uv/MV updates, per-MB inter mode records with the census, SPLITMV, per-row tokens) with B/G/CNT/SP/IMB traces mirroring the Rust decoder's. Two model bugs fixed on the way (inter partition-0 offset is byte 3 not 10; clamp_mv2 wrote the clamped row into the column slot). Rust gained CNT (census result) and SP (SPLITMV subset) traces plus STAGE markers in the header parse. Result: model and Rust B streams agree read-for-read through frame 1's mode records up to MB(2,7), where the census diverges: model cnt=[0,2,2,3] vs rust cnt=[0,3,2,3] with IDENTICAL neighbour states (above=r1c7 NEAREST mv (-138,-100), left=r2c6 SPLITMV bmi15 (-134,-76), aboveleft=r1c6 mv (-138,-100) — rows 0-1 parse identically on both sides). The above-left +1 lands in cnt[NEAREST] (rust) vs cnt[NEAR] (model) — one of the two census implementations mishandles the above-left same-as-previous comparison; libvpx decodemv.c:307-361 is the arbiter to re-read next session. Pixel state: gop frame 1 at 51% vs ffmpeg before this divergence was understood.
ec-vp8: fix M2 token walk — ONE path missed sign/EOB; frame-0 byte-exact on all kf fixturesAhmet Kaan Gümüş · dd7b5a6
ec-vp8: fix M2 token walk — ONE path missed sign/EOB; frame-0 byte-exact on all kf fixtures get_coeffs' ONE-token path (p[2] branch) had the sign read, coefficient write, and EOB-after-nonzero check nested inside the magnitude branch only. The reference walk (libvpx detokenize.c GetCoeffs / RFC 6386 section 13.2) shares that tail between the ONE and magnitude paths. A ONE token therefore skipped the sign read and EOB check and re-entered the walk at the ZERO node — read counts stayed in lockstep (so stream positions matched) while the decoded stream diverged from the first ONE token, which is why the lossless single-MB fixture passed and busy fixtures split ~28 reads into block 0. Evidence: - EC_VP8_TRACE G-lines (n, band, ctx, prob, bit) vs scripts/vp8ref_model.py on kf-160x96-q20.ivf: 19131 decisions, 0 diffs (model also fixed: persistent per-partition decoders, G tracing with consulted prob + decoded bit). - examples/dump_frame frame 0 vs 'ffmpeg -frames:v 1': byte-exact on all 7 kf fixtures + mparts-160x96 kf0. - cargo test -p ec-vp8: unit 49 + header_parse 4 + webp green; keyframe_exact 1/3 (the 2 red cases decode every frame of each fixture and complete when M3 inter frames land).