Commits
Commits on
dfeffbcebd64426ceeebbf03214c8d6fe57282d6Filtered to crates/ec-vp8/src/modes.rsClear filter2026-09-12
ec-vp8 M3: inter frames byte-exact vs ffmpeg on ALL fixturesAhmet Kaan Gümüş · 80115ee
ec-vp8 M3: inter frames byte-exact vs ffmpeg on ALL fixtures
Four bugs fixed this pass:
- inter-frame B_PRED subblock modes used the keyframe context table
(KF_BMODE_PROB[a][l]); libvpx decodemv.c:467 reads fc.bmode_prob —
the FLAT vp8_bmode_prob {120,90,79,133,87,85,80,111,151}, no context
- MC interpolation filter is per-frame from the tag version bits
(vp8_setup_version): version 0 = six-tap for BOTH planes; chroma was
hardcoded bilinear. Version 3 fullpixel_mask (~7) added to the chroma
MV derivation
- SPLITMV chroma: quadrants are 4x4 CHROMA pixels at 4-px offsets; the
old loop predicted 8x8 at 8-px offsets, so the residual add read the
top-left quadrant's prediction for all four quadrants (whole-MB modes
masked the bug; every SPLITMV MB got wrong chroma)
- key frame with refresh_entropy==0 now reverts to DEFAULTS (libvpx
inits fc before lfc=fc), not the pre-keyframe context
keyframe_exact now witnesses full streams: gop/clip-obs/altref added as
interframe_streams_match_ffmpeg; suite 55 lib + 4 header_parse + 4
keyframe_exact green, zero rustc warnings. Model fixed to match libvpx
(inter ymode/uv defaults 112/86/140/37 + 162/101/204, flat inter bmode)ec-vp8 M3: long MV components read bits 9,8,7,6,5,4 (mvlong_width=10) — bit 9 was missingAhmet Kaan Gümüş · d5796e3
ec-vp8 M3: long MV components read bits 9,8,7,6,5,4 (mvlong_width=10) — bit 9 was missing RFC 6386 §17.1 and libvpx read SIX long-form bits (9 down to 4) before the sometimes-implicit bit 3; the port read only five (8..4), so every large motion vector decoded as garbage while short MVs and ZEROMV stayed correct. gop-160x96 frame 1: 51% -> 95.3% pixel match; frames 0-3 of gop and clip-obs now byte-exact vs ffmpeg. Remaining divergence from frame 4 onward is the next M3 target.
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 WIP: full inter-frame pipeline decodes; walled on one mode-record divergenceAhmet Kaan Gümüş · 10ef9be
ec-vp8 M3 WIP: full inter-frame pipeline decodes; walled on one mode-record divergence Lands: inter mode/MV parse (prob_intra/last/gf, mv_ref census port of libvpx read_mb_modes_mv incl. the dead CNT_SPLITMV merge, SPLITMV with mbsplit leader/fill tables, NEAREST/NEAR clamps, NEW/SPLIT best-MV deltas), chroma MV derivation (round-half-away mv/2 whole-MB; sum/8 SPLITMV), motion compensation in new mc.rs (6-tap luma + bilinear chroma + 32px border extension; 6 unit tests plus 31,000-case differential fuzz vs verbatim libvpx filter.c/extend.c - byte-identical; chroma whole-MB path re-clamps unconditionally per reconinter.c:336), reference buffer management in libvpx swap_frame_buffers order (copy_arf, copy_gf, refresh_gf, refresh_arf, refresh_last), entropy save/restore gated on refresh_entropy (probs only, like libvpx fc/lfc), persisted segment map, inter LF levels with ref/mode deltas and skip_lf inner-edge rule, EC_VP8_TRACE B-line per-read tracing in BoolDecoder mirroring scripts/vp8ref_model.py. State: inter frames decode end-to-end with no desync error; gop frame 1 matches ffmpeg 51% (frame 0 100%), diverging from MB(0,5) rightward - one remaining mode-record/token divergence. Next: diff the B streams (python3 scripts/vp8ref_model.py vs EC_VP8_TRACE=1) to localize it; the python model still needs the inter-frame header/mode extension. Suite: 55 lib (incl. 6 mc) + 4 header_parse + webp witness green; keyframe_exact 1/3 (2 cases need the M3 fix to pass).
ec-vp8: two partition-0 desync bugs fixed (M2 debugging state)Ahmet Kaan Gümüş · d9a9866
ec-vp8: two partition-0 desync bugs fixed (M2 debugging state) BUG 1 (found by decision-trace diff vs a python dixie model): the MV probability update loop ran on KEY frames - dixie/libvpx parse it only for interframes. On key frames the 38 extra bool reads desynced the whole partition-0 parse. Moved inside the !is_keyframe branch. BUG 2: decode_keyframe created a FRESH bool decoder over partition 0 for the per-MB mode records - re-reading the partition from its start. FrameHeader::parse now returns its partition-0 decoder so the mode records CONTINUE from where the header stopped (dixie decode_frame shares one decoder). Result: single-MB 16x16 black q0 fixture now decodes BYTE-EXACT vs ffmpeg (chroma and luma). Multi-MB fixtures still diverge: decision traces (python dixie model scripts side /tmp/vp8ref.py vs EC_VP8_TRACE) match to decision 2562 and split at 2563 inside the token walk of MB(0,1) block 0 (ref consults prob 11, rust prob 4 at the same stream position) - a coefficient-context/bookkeeping difference in the multi-MB token pass that is now precisely localized for the next session. Debug tooling retained: EC_VP8_TRACE decision trace, EC_VP8_DEBUG per-MB coeff dump, examples/dbg_first.rs.
ec-vp8 M2 WIP: full key-frame decode pipeline (tokens/intra/transform/loopfilter/reconstruct) — unit tests 100% green, ffmpeg exactness witnesses RED (luma bug)Ahmet Kaan Gümüş · 5b0ae03
ec-vp8 M2 WIP: full key-frame decode pipeline (tokens/intra/transform/loopfilter/reconstruct) — unit tests 100% green, ffmpeg exactness witnesses RED (luma bug) - tokens.rs: RFC 6386 sec 13 coefficient decoding (GetCoeffs port: bands, 3-context model, EOB-skip-after-zero, dequant-on-write, Y2-first block order, dixie skip-MB context reset with Y2 preservation). - modes.rs: all mode/MV trees + tables (kf/inter ymode, bmode, uv, mv_ref, sub_mv_ref, SPLITMV partitions with RFC enum-value indexing). - decode.rs: per-row pipeline (modes -> tokens -> reconstruct), bordered planes (127/129), above-right synthesis, B_PRED interleaved predict+residual (reconstructed-pixel chaining), Y2 WHT DC override, per-MB LF level (dixie double-clamp), LF post-pass via loopfilter. - loopfilter.rs + intra.rs + transform.rs: subagent kernels, rustc-verified vs libvpx C (differential fuzz: 400k IDCT/WHT vectors, 20k intra streams, dixie-table-exact LF limits). - FIX along the way: per-MB-row token left-context reset (dixie reset_row_context) was missing. - tests/keyframe_exact.rs: ffmpeg byte-compare witnesses — FAILING: single 16x16 black q0 frame decodes chroma exact but luma ~99-130 vs 16 (B_PRED MB, coeffs plausible); suspected in luma pred/apply path, NOT yet localized. Debug: EC_VP8_DEBUG=1 dump + examples/dbg_first. - 49 lib + 4 header tests green; zero warnings in lib.