forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on f4ce2b8901eca8a6e46e192e4b165be56ec96ad7

2026-09-13

perf(mp3): the forward MDCT reads its cosine kernel from a tableAhmet Kaan Gümüş · f4ce2b8
perf(mp3): the forward MDCT reads its cosine kernel from a table

mdct_long and mdct_short recomputed cos(pi/72(2n+19)(2k+1)) (and the
short-block twin) with libm for every subband of every granule — 23% of
the encode profile, and roughly the whole cost of the transform. Both
kernels are now LazyLock f32 tables ([k][n], one dot product per output
coefficient) built from the same angles; the f64 accumulation and the
f32 windowing order are kept, so every bench fixture still encodes
byte-identically and the crate suite is green. encode: stereo CBR 21.1x
-> 37.3x realtime, VBR 13.0x -> 17.8x.
perf(mp3): the 3/4-power curve as cube and two square rootsAhmet Kaan Gümüş · 2d2451a
perf(mp3): the 3/4-power curve as cube and two square roots

|xr·scale|^(3/4) ran libm powf for every line of every rate-loop round —
10.8% of the encoder's profile — and the noise pass re-ran band_gain's
exp2 per line. Both are now per-band or table-free arithmetic (a cube and
two sqrts in f64, one band gain per band); the short-block quantiser also
stops searching for each line's band. Decoded correlations are unchanged
to six decimals on every bench fixture (seven of eight byte-identical;
music3s flips one ulp-boundary line). Suite green. encode: stereo CBR
18.2x -> 21.1x realtime, VBR 10.6x -> 13.0x.
perf(mp3): word-buffered granule bit emission, cost-only rate loopAhmet Kaan Gümüş · d97b1ac
perf(mp3): word-buffered granule bit emission, cost-only rate loop

The profile was 45% inside BitWriter's per-bit loop and most of another
22% in code_spectrum's Vec<bool> round-trip: every rate-loop round wrote
the granule's bits out and re-expanded them one bool per bit for the
frame writer. BitBuf buffers the same MSB-first bitstream through a u64
accumulator; the rate loop now judges candidate gains by Huffman cost
alone and the kept configuration is materialised exactly once. All eight
bench fixtures encode byte-identically; the crate suite is green.
encode: stereo CBR 8.2x -> 18.2x realtime, VBR 4.0x -> 10.6x.

2026-09-12

fix(h264): combine explicit-weight bipred chroma with chroma weightsAhmet Kaan Gümüş · 1b55d6c
fix(h264): combine explicit-weight bipred chroma with chroma weights

The fused weighted path built its Put::AvgW once from the luma weight
lookup and reused it inside the per-component chroma loop, discarding the
loop's own per-component lookup. Luma and chroma prediction weights are
independent syntax (separate log2 denoms, weights and offsets; absent
entries default to 1<<denom), so an explicit-weight B bipred
macroblock (weighted_bipred_idc == 1) whose chroma weights differ from
luma's combined chroma with luma weights: wrong output bytes. The
fixtures could not catch it (x264 B weights are implicit, hence
component-independent) and no JVT vector covers it.

The chroma loop now shadows weighted_put with one built from its own
lookup. Witness: a decoder-level unit test drives an explicit-weight
bipred macroblock with luma != chroma weights through compensate and
asserts per-component output — verified to fail on the pre-fix code
(cb 131 vs 165 at (0,0)) and pass post-fix. RefList::push and
Plane8::extend_borders become pub(crate) as the test's constructors.

Byte-exact A/B: all five fixture hashes unchanged. Suite green (80 lib
+ 23 conformance + 12 encode + 1 decode-first).
🛡️ fix(ac3): a packet tail that begins a syncframe is refused by name, never dropped in silenceAhmet Kaan Gümüş · 49e4498
🛡️ fix(ac3): a packet tail that begins a syncframe is refused by name, never dropped in silence

decode_frame decoded the first substream and discarded the rest of the
packet (let _ = consumed) -- the shape a Matroska block for 7.1 DD+
really carries (independent substream plus its dependent): 1536 samples
out, the extension channels gone, no error. Old decoders of record
walked that tail, so the silent drop was a regression hiding under the
named refusals.

Now reject_tail runs after every successful frame: padding that is not
itself a syncframe (the container slack the spec allows) still decodes
sample-for-sample like the bare frame, but a tail that begins a
syncframe is Unsupported naming what it is -- an E-AC-3 dependent
substream in the tail (the 7.1 extension channels) or a second
syncframe altogether (one packet is one frame and its substreams; hand
frames over one at a time). A 0x0B77 coincidence that parses as no
header stays junk.

Witnesses in decode_matrix: concatenated real fixture frames (AC-3 and
E-AC-3) refuse as second syncframes; the E-AC-3 tail flipped to
dependent refuses with the dependent wording; padded frames decode
bit-identically to bare ones. Fixture matrix vs ffmpeg stays green.
docs(av1): lane-tplfut-arf report -- the tpl-future-map lever the arffilt reconciliation defers is shipped prior art (stale-deferred-pointer, see charter f606fb57); no knob, no code change; witnesses re-proven at d27a904d (pins 8291/33227 at default and EC_AV1_SPEED=6, the future-window stream-moves + both-decoder witness, lookahead drain witness, every-preset exactness) plus a gate-shape blindness probe proving the 12-frame native arm IS its control (gop=12 one group of 11; a gop-32 probe is a false RED, the [8,3] truncation genuinely engages); server-3 first proven per the managed skill -- long-GOP control EC_AV1_TPL_FUT=0 (+21.2/-8.9, +71.4/-1.6) vs shipped-default arm (+20.9/-9.0, +70.4/-2.2, the standing table to the digit): the lever's current contribution is film B -1.0/-0.6, film A -0.3/-0.1, walls -0.3/-0.7 percent -- keep rule met, disposition stays default ON; native control five rows all to the digit (screen +13.7/-33.6 = intertx's documented delta); suite 592/0 three lanes, cargo check 0 errors 0 ec-av1 warnings (two pre-existing ec-vorbis oracle warnings named)Ahmet Kaan Gümüş · b9ff510
docs(av1): lane-tplfut-arf report -- the tpl-future-map lever the arffilt reconciliation defers is shipped prior art (stale-deferred-pointer, see charter f606fb57); no knob, no code change; witnesses re-proven at d27a904d (pins 8291/33227 at default and EC_AV1_SPEED=6, the future-window stream-moves + both-decoder witness, lookahead drain witness, every-preset exactness) plus a gate-shape blindness probe proving the 12-frame native arm IS its control (gop=12 one group of 11; a gop-32 probe is a false RED, the [8,3] truncation genuinely engages); server-3 first proven per the managed skill -- long-GOP control EC_AV1_TPL_FUT=0 (+21.2/-8.9, +71.4/-1.6) vs shipped-default arm (+20.9/-9.0, +70.4/-2.2, the standing table to the digit): the lever's current contribution is film B -1.0/-0.6, film A -0.3/-0.1, walls -0.3/-0.7 percent -- keep rule met, disposition stays default ON; native control five rows all to the digit (screen +13.7/-33.6 = intertx's documented delta); suite 592/0 three lanes, cargo check 0 errors 0 ec-av1 warnings (two pre-existing ec-vorbis oracle warnings named)
perf(h264): fuse the weighted bi-prediction combining pass into motion compensationAhmet Kaan Gümüş · 928abb0
perf(h264): fuse the weighted bi-prediction combining pass into motion compensation

x264's default streams carry weighted_bipred_idc=2 (implicit), so most
B partitions took the weighted combining path: two temporaries, a scalar
per-sample combine, and a copy back. The combining formula of 8.4.2.3.2
is per-sample, so list 0 now interpolates straight into the picture and
list 1 combines on top of it (Put::AvgW) with 8.4.2.3.2's exact
integers — same tree, same rounding, on the same bytes. Non-fusable
weights keep the temporary path.

Byte-exact A/B vs d27a904d on the five fixture classes: all
display-order frame hashes identical. ec-h264 suite green (79 lib + 23
conformance + 12 encode + 1 decode-first).
refactor(ec-opus): bits2pulses row-window bound becomes a debug_assert (reviewer P3) - statically decidable from the unchanged CACHE_BITS table; the fixed-window copy still panics if the table ever outgrew itAhmet Kaan Gümüş · 70ebc17
refactor(ec-opus): bits2pulses row-window bound becomes a debug_assert (reviewer P3) - statically decidable from the unchanged CACHE_BITS table; the fixed-window copy still panics if the table ever outgrew it
ec-vp8: mc.rs blank-line tidyAhmet Kaan Gümüş · 1b64551Browse files
ec-vp8: restore shared avx2 probe after idct revertAhmet Kaan Gümüş · 7ffca32
ec-vp8: restore shared avx2 probe after idct revert

The revert of 4d6a9f27 also dropped lib.rs's avx2_supported(), which
mc.rs's six-tap/bilinear kernels import since 79e13d22.
Revert "ec-vp8 perf: idct_add_into -- fused strided reconstruct + AVX2 kernel"Ahmet Kaan Gümüş · bb830d8
Revert "ec-vp8 perf: idct_add_into -- fused strided reconstruct + AVX2 kernel"

This reverts commit 4d6a9f2729070667f54554f1489603e0d29d0824.
ec-vp8 perf: idct_add_into -- fused strided reconstruct + AVX2 kernelAhmet Kaan Gümüş · abc2cab
ec-vp8 perf: idct_add_into -- fused strided reconstruct + AVX2 kernel

idct_add_into (28% of the post-MC-decode profile) now runs through
transform::idct_add_strided: the prediction gather, the transform, the
clamp-add and the strided stores in one function, with an explicit
std::arch::x86_64 AVX2 kernel dispatched off a shared LazyLock probe and
the scalar path kept as the libvpx transcription and lane-for-lane
oracle.

The kernel preserves the module's precision contract in full: the
butterflies are the scalar i32 arithmetic lane-parallel (products exact,
|i16 * 35468| < 2^31), and the only narrowing points are the oracle's
short stores -- pass one's tmp and pass two's residual -- implemented as
low-16-bit truncations via shuffle_epi8, never saturation. Coefficients
transpose to column groups (rows woven by unpack_epi16), pass one's
store-pattern transpose hands row groups to pass two, and the final
clamp is explicit max 0 / min 255 in i32 before a saturating pack that
never fires beyond the clamp. The equivalence test pushes coefficients
to the i16 rails precisely because the network is exact for every input.

Witness suite: 58 lib (new: simd-vs-scalar equivalence over rails +
random, four stride shapes) + 4 header_parse + 4 keyframe_exact + 3
stream_exact, byte-exact, debug and release. Zero warnings.
perf(ec-opus): optional rustfft FFT backend becomes the default (fft-rustfft feature; pure Rust, no C; scratch preallocated so the steady-state encode stays zero-alloc) and stereo_itheta matches the reference float build's fast_atan2f instead of libm's f64 atan2 — 5.1 film decode 0.82 -> 0.95 of ruopus-FFT, stereo 0.87 -> 0.97, stereo encode 0.65 -> 0.69 of opus-rs (510k at parity 1.00); bits2pulses bisects a fixed row window; dependency-free build stays green under --no-default-featuresAhmet Kaan Gümüş · 68cf7a6
perf(ec-opus): optional rustfft FFT backend becomes the default (fft-rustfft feature; pure Rust, no C; scratch preallocated so the steady-state encode stays zero-alloc) and stereo_itheta matches the reference float build's fast_atan2f instead of libm's f64 atan2 — 5.1 film decode 0.82 -> 0.95 of ruopus-FFT, stereo 0.87 -> 0.97, stereo encode 0.65 -> 0.69 of opus-rs (510k at parity 1.00); bits2pulses bisects a fixed row window; dependency-free build stays green under --no-default-features
perf(h264): bulk-read CABAC renorm and zero-fill bit supplyAhmet Kaan Gümüş · f3d387e
perf(h264): bulk-read CABAC renorm and zero-fill bit supply

RenormD doubles codIRange by leading_zeros-23 positions in one shift and
supplies the matching bits with one bulk read, replacing the per-bit
loop; BitCursor::bits_zero_fill is the engine's supply contract made
explicit (zero-filled past the RBSP, position accounting unchanged), so
bit() drops its Result plumbing. The coeff_abs_level prefix loop hoists
the inc0/inc1 context spelling out of the per-bin branch.

Byte-exact A/B vs d27a904d on the five fixture classes: all
display-order frame hashes identical. ec-h264 lib suite green.
perf(h264): fuse the bi-predicted combining pass into motion compensationAhmet Kaan Gümüş · 57ad7eb
perf(h264): fuse the bi-predicted combining pass into motion compensation

Default-weighted bi-prediction (8.4.2.3.1) is the rounded average of the
two lists' clipped byte predictions, so list 0 now interpolates straight
into the picture and list 1 averages on top of it (Put::Avg) instead of
both landing in 256/64-byte temporaries, going through combine(), and
being copied back per row. Weighted slices keep the temporary path.

SliceCtx::no_weights() hoists the per-component weights_for lookup for
streams that signal no weighted prediction at all.

Byte-exact A/B vs d27a904d on five fixture classes (720p High CABAC+B,
720p CAVLC baseline, 1440p High no-B, 1080p Main, 4K Main): all display-
order frame hashes identical. ec-h264 suite green (79 lib + 23
conformance + 12 encode + 1 decode-first).
ec-vp8 perf: MC kernels -- AVX2 six-tap + bilinear passesAhmet Kaan Gümüş · c4fe596
ec-vp8 perf: MC kernels -- AVX2 six-tap + bilinear passes

sixtap_block and bilinear_block (18% of a decode: the sub-pel MC passes
for luma and chroma) now run on explicit std::arch::x86_64 AVX2 kernels
following the ec-av1 mc::simd pattern: the scalar functions stay as the
libvpx transcription and the reference oracle, feature-gated at the
block level via a LazyLock capability probe.

Both passes share one clamped u8 intermediate at a fixed 16-lane stride
(the first pass is clamped to 0..=255 by filter.c's clamp_pixel, so u8
storage is representation-only; lanes bw..16 hold discarded values).
The six-tap kernels pair adjacent samples into _mm*_madd_epi16 with
packed tap pairs -- exact in i32 (|byte*tap| <= 255*128, six-product
sums < 2^23) -- and the two-stage packs/packus narrowing reproduces the
per-pass clamp exactly: packs' i16 saturation provably never fires
(range [-76, 319]) and packus' u8 saturation IS clamp_pixel. Bilinear
taps are non-negative and sum to 128, so its i16 accumulator is exact.

Also repairs a debug-build regression from 2e4c5f96's chunked loop-
filter loads: the hoisted row address 'anchor - (4 - k) * stride'
underflows usize for k past the upper taps at frame-top edges (the
add-first form anchor + k*stride - 4*stride is what the per-pixel code
evaluated). The three h-edge kernels get the add-first form plus the
bounds contract as debug_asserts; the three driver tests that had been
panicking in debug builds are green again (57 lib tests now).

Witness suite: 57 lib + 4 header_parse + 4 keyframe_exact + 3
stream_exact, byte-exact, debug and release.
perf(ec-opus): PVQ unranking walks the reference 1272-entry U table instead of stepping rows at runtime — decode_pulses/encode_pulses drop from O(N*K) row arithmetic to O(N) lookups (5.1 film decode 0.70 -> 0.82 of ruopus-FFT, stereo 0.66 -> 0.87, stereo encode 0.59 -> 0.65 of opus-rs); the const table is the same recurrence in wrapping arithmetic and the lib test cross-checks every stored entry against a fresh runtime buildAhmet Kaan Gümüş · e06f8b9
perf(ec-opus): PVQ unranking walks the reference 1272-entry U table instead of stepping rows at runtime — decode_pulses/encode_pulses drop from O(N*K) row arithmetic to O(N) lookups (5.1 film decode 0.70 -> 0.82 of ruopus-FFT, stereo 0.66 -> 0.87, stereo encode 0.59 -> 0.65 of opus-rs); the const table is the same recurrence in wrapping arithmetic and the lib test cross-checks every stored entry against a fresh runtime build
ec-vp8 perf: loop-filter kernels — chunked loads, conditional storesAhmet Kaan Gümüş · 289ae2c
ec-vp8 perf: loop-filter kernels — chunked loads, conditional stores

The six edge kernels did 8-14 individually bounds-checked accesses per
pixel/column. Horizontal edges (contiguous columns, strided taps) now
pull each tap row in with one slice load and keep per-column stores
(most pixels fail the threshold, so bulk write-back was a net loss —
measured 175->89 MP/s on big-obs before switching to conditional
stores). Vertical edges read the contiguous tap window as one slice.

Under sibling-lane load (loadavg ~20, numbers noisy): gop-160x96
82->108 MP/s, altref 55->66, gop-1280x720 211->221, big-obs-2560x1320
~175->~180 (48-55 fps observed vs 45-fps seat target). Witnesses
byte-exact green.
docs(av1): lanes/tplfutarf.charter.md -- the tpl-future-map-at-the-ARF lever the arffilt reconciliation defers is already shipped: lane-tplfut (9ed92a1d, merged daed0265) passed the buffered next group to the top ARF's temporal lambda window (EC_AV1_TPL_FUT mode 2) and lane-tplhalf (0c8d5778, merged aab48896) tuned its split to 2 past and budget to 11, both ancestors of lane-arffilt's own base 7db5094a -- the deferred line is a stale pointer (class: stale-deferred-pointer); a second default-OFF EC_AV1_TPLFUT_ARF knob beside EC_AV1_TPL_FUT refused on the arffilt precedent (mode 0 IS the bit-exact off); this lane re-proves the witnesses at d27a904d and re-measures the lever's current contribution on server-3 (film long-GOP EC_AV1_TPL_FUT=0 control vs the shipped default, native control five rows, the 12-frame arm being structurally blind)Ahmet Kaan Gümüş · 763d85e
docs(av1): lanes/tplfutarf.charter.md -- the tpl-future-map-at-the-ARF lever the arffilt reconciliation defers is already shipped: lane-tplfut (9ed92a1d, merged daed0265) passed the buffered next group to the top ARF's temporal lambda window (EC_AV1_TPL_FUT mode 2) and lane-tplhalf (0c8d5778, merged aab48896) tuned its split to 2 past and budget to 11, both ancestors of lane-arffilt's own base 7db5094a -- the deferred line is a stale pointer (class: stale-deferred-pointer); a second default-OFF EC_AV1_TPLFUT_ARF knob beside EC_AV1_TPL_FUT refused on the arffilt precedent (mode 0 IS the bit-exact off); this lane re-proves the witnesses at d27a904d and re-measures the lever's current contribution on server-3 (film long-GOP EC_AV1_TPL_FUT=0 control vs the shipped default, native control five rows, the 12-frame arm being structurally blind)
ec-vp8 perf: per-bool env lookups were 46% of decode profileAhmet Kaan Gümüş · 1a98a0f
ec-vp8 perf: per-bool env lookups were 46% of decode profile

std::env::var_os ran per bool read (bool.rs read_bool) and per MB
(decode.rs reconstruct) — each call takes std's ENV lock and allocates;
perf showed 46% of samples in getenv/__strlen. OnceLock::get_or_init
was no better (closure re-entry still hit the env path). Now both flags
resolve once per process into an AtomicU8 (relaxed load-only hot path).

Before -> after (decode MP/s): gop-160x96 32->82, clip-obs 51->122,
altref 16->55, gop-1280x720 137->211, big-obs-2560x1320 121->175
(35.7 -> 51.9 fps). Full witness suite byte-exact green.
ec-vp8: review fixes — full fixture provenance + real hidden-frame coverageAhmet Kaan Gümüş · 733f426
ec-vp8: review fixes — full fixture provenance + real hidden-frame coverage

P1: gen_vp8_fixtures.sh now generates ALL 12 IVF fixtures. The two
ad-hoc vectors are recorded reproducible encodes (kf-16x16-black-q0:
color=black 16x16 q0; clip-obs-320x192: testsrc2 320x192 q28) and
altref-160x96 moved to vpxenc --auto-alt-ref=1 --passes=2 (one-pass
CQ/VBR never inserts hidden altrefs for this content; two-pass vbr
does). Regenerating the 9 pre-existing fixtures reproduces them
byte-identical (sha256 verified).

P2: the new altref-160x96 contains 6 HIDDEN frames (show_frame=0) at
decode indices 1,17,33,49,65,81 of 96 total. Coverage: the interframe
witness censuses the tags and refuses a shown-only stream (>=6 gate);
compare() now walks every frame, requiring Ok(None) exactly on hidden
frames and byte-exact planes on shown ones (ffmpeg output indexed by
shown position); stream_exact's hidden_frames_update_references_and_
produce_no_picture proves decode returns None for hidden frames while
the frame AFTER the first hidden altref is byte-exact vs ffmpeg — the
hidden reference is live. Decoder needed NO changes: hidden frames
were already handled correctly; the gap was coverage only.

Suite: 55 lib + 4 header_parse + 4 keyframe_exact + 3 stream_exact,
zero rustc warnings.
ec-vp8 M4: public whole-stream API (ec-av1 decode_stream shape)Ahmet Kaan Gümüş · 93dee5c
ec-vp8 M4: public whole-stream API (ec-av1 decode_stream shape)

stream::decode_stream(IVF bytes) -> Result<Vec<Picture>> collects every
shown picture; stream::decode_stream_with hands each picture to a sink
(picture, decode_idx, IVF pts) the moment it exists. Hidden frames
(show_frame == 0) update the reference state and produce no sink call.
Container envelope (DKIF magic, VP80 fourcc, framing arithmetic) is
validated as ec_core::Error variants, not panics. Picture gains Clone.

Witness tests/stream_exact.rs: decode_stream byte-exact vs ffmpeg on
ALL 12 IVF fixtures (every frame, all planes) + malformed-container
errors. Suite: 55 lib + 4 header_parse + 4 keyframe_exact + 2
stream_exact, zero rustc warnings.
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)
docs(av1): lane-arffilt report -- the ARF temporal-filter charter reconciles to merged prior art: arf_pred_census re-run at 7db5094a reproduces lane-arfpred's SAD table to the digit (film B 14.3 percent at s30 +-2, 10.2 at the shipped s2), the filter itself shipped ON in lane-arfpred/arftf/lookahead (strength 2, +-3 window, gate-measured +85.3/+6.7 -> +72.1/-1.2 on film B), so no encoder change and no EC_AV1_ARFFILT second knob; witnesses re-proven (pins 8291/33227 hold, EC_AV1_ARF_TF=0 moves the stream, both-decoder sample-exactness at every preset)Ahmet Kaan Gümüş · 09db827
docs(av1): lane-arffilt report -- the ARF temporal-filter charter reconciles to merged prior art: arf_pred_census re-run at 7db5094a reproduces lane-arfpred's SAD table to the digit (film B 14.3 percent at s30 +-2, 10.2 at the shipped s2), the filter itself shipped ON in lane-arfpred/arftf/lookahead (strength 2, +-3 window, gate-measured +85.3/+6.7 -> +72.1/-1.2 on film B), so no encoder change and no EC_AV1_ARFFILT second knob; witnesses re-proven (pins 8291/33227 hold, EC_AV1_ARF_TF=0 moves the stream, both-decoder sample-exactness at every preset)
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 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 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).
docs(av1): lane-l2 report -- LAST2 re-judged on the current substrate and stays off: control reproduces the standing table to the digit (screen row moves exactly along intertx's documented 14.4->13.7), the deciding long-GOP gate reads -0.3 best (keep rule asks >=0.5), LAST2 codes 0.5-1.1 percent of film inter blocks and never on screen, walls +2.4-9.7 percent; the per-lag SAD census re-run reproduces refs.report section 1 exactly; witness 0-off/40-on LAST2 blocks exact through both decoders; pins unmoved 8291/33227Ahmet Kaan Gümüş · 1100a98
docs(av1): lane-l2 report -- LAST2 re-judged on the current substrate and stays off: control reproduces the standing table to the digit (screen row moves exactly along intertx's documented 14.4->13.7), the deciding long-GOP gate reads -0.3 best (keep rule asks >=0.5), LAST2 codes 0.5-1.1 percent of film inter blocks and never on screen, walls +2.4-9.7 percent; the per-lag SAD census re-run reproduces refs.report section 1 exactly; witness 0-off/40-on LAST2 blocks exact through both decoders; pins unmoved 8291/33227
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).