forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on c67d95ad32fef0f10f35f3cdf423d6efd53f0031

2026-09-19

Merge lane-vp9-refsetup: intra-only frames + scaled references onto the u16 planesAhmet Kaan Gümüş · c67d95a
Merge lane-vp9-refsetup: intra-only frames + scaled references onto the u16 planes

The lane was cut from 79984549 and wrote its scaling against the u8 kernels;
main had since absorbed lane-vp9-hbd, which converted every ec-vp9 plane to
u16 (`ec_vp9::Sample`) and threaded `bd` through every kernel. Not a
mechanical merge — resolved by porting the lane's semantics onto the u16
substrate.

- mc.rs (conflicts at the convolve signatures / inter_predictor / the
  predictor entry): main's u16 kernels + `bd` win as the substrate; the lane's
  `ScaleFactors`, step-aware `convolve_horiz`/`convolve_vert` (x_step/y_step
  alongside bd, both defaults `SUBPEL_SHIFTS`), the scaled dispatch in
  `inter_predictor`, the extracted `convolve_2d` and the scaled block/MV
  mapping in `build_inter_predictors` are ported onto it. The scale arithmetic
  is depth-independent and kept verbatim.
- decode.rs (conflict was the capability doc only): combined doc; the lane's
  `decode_intra_only_frame`, `frame_is_intra_only` dispatch, `ScaleFactors`
  setup + `valid_ref_frame_size` refusal, and the removed size-change refusal
  kept as written.
- The lane's tests compared u16 planes against ffmpeg's u8 rawvideo; they now
  go through `as u8` like the rest of the crate.

Verified on the merged tree: full `cargo test -p ec-vp9` green (0 failed,
0 ignored), warning parity = the 5 pre-existing, and the 10-stream corpus
re-swept from this build byte-identical vs libvpx 1.15.0 (8-bit, 10-bit,
odd, scaled-reference, intra-only).
vp9refsetup: drop the unreproducible ffmpeg SIGSEGV sentenceAhmet Kaan Gümüş · e6a3f0c
vp9refsetup: drop the unreproducible ffmpeg SIGSEGV sentence

The reviewer cannot reproduce the "scale=...:eval=frame exits 139 with a
0-byte file" claim; the builder can. Environment-dependent, so it does not
belong in load-bearing docs. Keep only the verified fact: ffmpeg's rawvideo
output size is locked to the first decoded frame, hence the two-pass dump
recipe (frame 0 alone with -frames:v 1, frames 2..N with select=gte(n,1)).
vp9refsetup: regenerate the odd fixture from the current patcher; narrow the ffmpeg claimAhmet Kaan Gümüş · 1426489
vp9refsetup: regenerate the odd fixture from the current patcher; narrow the ffmpeg claim

- tests/data/scaledref_odd.ivf now reproduces from
  gen_scaledref.c + patch_kf_size.py <in> <out> 1279 719 (sha256
  af289a0f8dd91bfa854adeac1814dc77644ad87b9df0af884d33abaae2595413); the old
  bytes predated the patcher's IVF container-header rewrite (3 bytes).
  Still byte-identical to libvpx (drv_pix3 vs ours, 4490801 bytes, cmp).
- the "ffmpeg SIGSEGVs on a changing filter output" wording is narrowed to the
  verified scope: the scale=...:eval=frame route exits 139 with a 0-byte file,
  and independently ffmpeg's output size is locked to the first decoded frame.
ec-vp9: decode intra-only frames and scaled references, byte-exact vs libvpxAhmet Kaan Gümüş · 2251b71
ec-vp9: decode intra-only frames and scaled references, byte-exact vs libvpx

Two header/frame-setup refusals replaced with the libvpx 1.15.0 behaviour:

* intra-only frames (an INTER frame with intra_only=1, show_frame=0) decode
  through the keyframe body, but load their frame context from storage
  (reset only for reset_frame_context 2/3 or error-resilient mode), read the
  const vp9_kf_partition_probs, and refresh only the slots their
  refresh_frame_flags names.
* a reference whose coded size differs from the current frame is SCALED during
  prediction: ScaleFactors (vp9_setup_scale_factors_for_frame / vp9_scale_mv),
  the sf->predict kernel selection and the step-aware convolve walk.

Witnesses (committed fixtures, generators in lanes/vp9refsetup/) are
byte-identical to libvpx; the whole 8-bit regression corpus is unchanged
(including the 120-frame 60fps stream and the 2160p stream). The odd reference
case (1279x719 -> 640x360) is covered too. Tests fail pre-fix with the named
refusals.
vp9: decode profile 2 (10-bit 4:2:0) byte-exact vs libvpx 1.15Ahmet Kaan Gümüş · 9025ed3
vp9: decode profile 2 (10-bit 4:2:0) byte-exact vs libvpx 1.15

Store every plane as u16 and thread the frame's bd through the pixel
kernels (clip_pixel_bd, bd-scaled loop-filter thresholds, base =
128 << (bd-8) intra fills, highbd idct guard), so one decode walk serves
8- and 10-bit. The one depth-dependent bitstream element is the CAT6
coefficient token: 14 bits/vp9_cat6_prob at 8-bit, 16 bits/
vp9_cat6_prob_high12 + 2 at 10/12-bit -- ported.

Profile gate now accepts 0 and 2; profiles 1/3 and 12-bit are refused
by name; non-4:2:0 subsampling stays refused.

Byte-exact vs libvpx 1.15 on both 10-bit corpus streams (48 and 120
frames) and the whole 8-bit regression corpus. cargo test -p ec-vp9
green; warning parity (the 5 pre-existing). See lanes/vp9hbd.report.md.
vp9f72: record merge-side follow-ups (merge commit, clean resolution, gates, sweeps)Ahmet Kaan Gümüş · 02d10ba
vp9f72: record merge-side follow-ups (merge commit, clean resolution, gates, sweeps)

Merge commit 357f3437 (real merge over the odd-dims lane), clean auto-merge
of decode.rs, P3 TDK diagnostic fix folded in, merged-tree gate 34/34 with
5-warning parity, integration sweeps 120/120 and odd 12/12, worktree and
private target dirs cleaned.
Merge lane-vp9-f72: inter context write-back zeroes the window's tailAhmet Kaan Gümüş · 177bb19
Merge lane-vp9-f72: inter context write-back zeroes the window's tail

The lane fixes the frame-72 tile desync: `write_tx_context` must narrow
libvpx's context spread to the transform window's width before applying
the frame-edge shift, so the shift zeroes the window's tail rather than
bytes past it. The odd-dims lane (e8152b9b) touched only RefPlane
extents/crop_picture; the two regions are disjoint and the merge is clean.

Fold in the reviewer's P3 nit: the `TDK` diagnostic (gated by
`EC_VP9_TOKDGB`) now prints the CLEARED window at the reset offset per
plane, mirroring the oracle's `SKIPCTX` print, instead of the whole
rolling left buffer from base index 0.
vp9: inter context write-back zeroes the window's tail, not bytes past itAhmet Kaan Gümüş · 6743870
vp9: inter context write-back zeroes the window's tail, not bytes past it

libvpx's vp9_decode_block_tokens (vp9_detokenize.c:273-323) applies the
frame-edge shift from get_ctx_shift to a value whose WIDTH IS THE WRITTEN
WINDOW's -- a uint16_t for TX_8X8, uint32_t for TX_16X16, uint64_t for
TX_32X32 -- so (eob>0)*0x0101 >> 8 yields 0x0001, i.e. bytes [1,0]: the
shift zeroes the window's TAIL.

The port shifted a full 64-bit spread instead and then took byte k, so the
window's last slot kept its previous value. get_ctx_shift only fires for a
block that runs past an edge (mb_to_*_edge < 0), which at a 1080-tall frame
(mi_rows 135) is the last PARTIAL superblock row, so the defect is
invisible to every non-edge block: a bottom-row chroma transform block
handed a stale 1 to the next row's entropy-context read and the tile bool
decoder desynced on the 120-frame 60fps corpus stream at input frame 72.

That stream now decodes all 120 frames byte-identically to the libvpx 1.15
oracle, with every transform block's context read and every write window
equal to the oracle's on every tile.

Both token paths share a new write_tx_context helper, whose narrowing is
libvpx's cast; the intra path's per-width casts were already correct.

Witness: corpus_1080p_60fps_matches_ffmpeg_past_frame_72 (media-gated,
against ffmpeg's rawvideo) fails on the base tree with the desync and
passes here. lanes/vp9f72.report.md has the oracle recipe and the tables.
vp9: decode odd coded extents (chroma ceils at (w+1)/2)Ahmet Kaan Gümüş · 73605cd
vp9: decode odd coded extents (chroma ceils at (w+1)/2)

libvpx stores and crops 4:2:0 chroma at uv_crop_width = (w+1)/2 /
uv_crop_height = (h+1)/2, i.e. it ceils an odd coded extent. The
decoder used `>> 1` in two places, so an odd extent was one chroma
column/row short: the inter predictor's border/inside test clipped the
last sample and the returned Picture cropped floor(w/2) x floor(h/2).
For odd extents the two disagreed, and the lane refused them by name
("vp9 inter odd frame dimensions").

Unify on ceil:
- inter_predict_plane: RefPlane width/height = (coded + s) >> s, so
  chroma is (w+1)/2 (unchanged for luma, s = 0).
- crop_picture: chroma crop + uv_stride = (w+1)/2 x (h+1)/2.
- drop the odd-dimension refusal.

Witness: tests/odd_dimensions_exact.rs patches the keyframe size fields
of an even 322x242 encode to an odd target (mi-grid invariant) and
compares every decoded frame to ffmpeg's libvpx rawvideo byte for byte
for odd width, odd height, and both. The whole visible corpus re-sweeps
all-identical (1080p 48/48, 2160p 48/48, altref 60/60, both entry
streams 3/3) and the same streams patched to odd extents are all
byte-identical too (1080p 48/48, altref 60/60).

2026-09-18

vp9: decode inter-frame pixels byte-exactly (MC, residual, loop filter, ref slots)Ahmet Kaan Gümüş · 83125b4
vp9: decode inter-frame pixels byte-exactly (MC, residual, loop filter, ref slots)

decode() no longer refuses inter frames. New mc.rs ports libvpx's inter
predictor: umv-border MV clamping, per-block reference border extension
(build_mc_border), the direct path window read, the four 8-tap/bilinear
convolve kernels, compound averaging and average_split_mvs. decode.rs gains
the prediction/residual/reconstruction driver, an 8-slot reference DPB that
stores each frame at its 64-aligned extent after the loop filter, and the
skip/skip_inter loop-filter mask rules.

Byte-exact against a locally built libvpx 1.15 oracle: the 1080p single-tile
inter stream (3/3 frames), both static fixture GOPs (48 frames at 1080p and
2160p), the altref stream (60/60) and a two-tile-column stream (3/3). Loop
filter verified separately by per-superblock mask identity (0 of 510 SBs
differ) and by edge-set containment. A 120-frame 60fps stream decodes
identically through frame 71 and hits an open entropy desync at frame 72,
filed in lanes/vp9pix.report.md with its disposition.

Also fixes a two-entry mv_ref_list overflow in the merged inter syntax path:
the successful second candidate add inside the different-reference loop is a
goto Done in libvpx and must leave the loop; without the break a later
candidate wrote past the list (the altref fixture panicked at frame 14).

Refusals kept/added by name: intra-only, other profiles, other subsamplings,
a reference whose coded size differs from the current frame, odd dimensions.

2026-09-17

av1: close the enable-intrabc gate-integrity entry with a 10-bit engagement witnessAhmet Kaan Gümüş · 30624f2
av1: close the enable-intrabc gate-integrity entry with a 10-bit engagement witness

The last entry of the tool-disabled-in-every-gate class rested on a flag
SPELLING: the palette gate's arms name --enable-intrabc=1, but the 10-bit
depth measured zero intrabc blocks on all five arms (regenerated and
probed with the crate's own decode_probe: intrabc=false in the parsed
frame header, rect_intrabc_reads 0, intrabc_hits 0). The premise of the
entry was also stale - three real-aomenc gates have passed
--enable-intrabc=1 and asserted engagement counters since 2026-09-02.

Replaced with a real witness: an_sb128_screen_stream_with_intrabc_
decodes_pixel_exact proves engagement from BOTH sides - the parsed
allow_intrabc frame-header bit (libaom clears it when no block selected
intrabc, av1/encoder/encodeframe.c:2335-2337) and the decoder-side
intrabc_hits counter - and the frames decode pixel-exact against ffmpeg
at both depths. The unported shape still gets an honest named refusal
(intra block copy on a HORZ/VERT/1:4 rect intra strip), asserted as
exactly one refusal per gate.

Verified by an independent reviewer: all nine claims reproduced, including
the zero-engagement measurement on all 5 arms x 2 depths and a byte-
identical yuv420p10le pixel comparison; the debt line is deleted.
Merge lane-vp9-inter: VP9 inter syntax next to tile-row byte-exactnessAhmet Kaan Gümüş · 9f13c77
Merge lane-vp9-inter: VP9 inter syntax next to tile-row byte-exactness

Both sides descend from 43c9c913 and both touched the tile/context setup, so
decode.rs and modes.rs conflicted. Resolved by combining:

- decode.rs keeps the tile-row work's signatures: decode_block and
  decode_partition no longer carry tile_row_start, so the inter lane's
  read_inter_block_info and its own tile walk thread tile_col_start alone,
  and decode_block's keyframe call passes the whole FrameContext (&self.ctx)
  as the tile-row revision does. The inter parse path is semantically
  unchanged: it allocates a fresh MiState per tile, so a frame-scoped
  above-availability gate sees no decoded cell above that tile's own
  row_lo, exactly what the dropped tile_row_start gate saw.
- modes.rs keeps the tile-row frame-scoped MiState::above_mi (mi_row != 0)
  AND the inter lane's new MiState::at() helper.
- The inter walk's tile loop drops the tile_row_start argument it passed to
  decode_partition; inter.rs's InterBlockCtx loses its tile_row_start field.

Folded in (verifier policy finding): scratch_interdump.rs FAILS when
INTER_IVF is explicitly set to a file that does not exist; the loud SKIP is
kept only for the unset default.

Evidence on the merged tree: cargo test -p ec-vp9 green (18 suites, 27
passed, keyframe_exact 4/4 incl. inter_is_named_unsupported); cargo check
--all-targets adds no warning beyond the 5 baseline ones; inter gate
1213/1851 blocks; tr/tr2/w1366/h242 sweeps each "RESULT 3 of 3 frames
byte-exact"; explicit-missing-fixture run fails as required.
docs(av1): intrabc_hits counts DV READS (a refused rect-strip block bumps it but is never reconstructed); depth-parameterised recipe helper counts at both depths in the gate-coverage derivationAhmet Kaan Gümüş · b89dee0
docs(av1): intrabc_hits counts DV READS (a refused rect-strip block bumps it but is never reconstructed); depth-parameterised recipe helper counts at both depths in the gate-coverage derivation
vp9kf: VP9 inter-frame syntax parses block-for-block identical to libvpxAhmet Kaan Gümüş · 834983e
vp9kf: VP9 inter-frame syntax parses block-for-block identical to libvpx

Slice 1 of inter-frame support: an inter frame is now parsed end to end
(compressed header, mode info, MVs, references) and every block matches
libvpx 1.15's own instrumented decoder on the test stream - frame 1
1213/1213, frame 2 1851/1851 on row/col/bsize/tx/mode/skip/seg/ref0/ref1/
interp/MV - with the frame-1 compressed header bit-identical (1200/1200
bools) and frame 2 likewise.

Causes closed while getting there, each ported from libvpx with its line:
update_mv_probs is MV_UPDATE_PROB + seven literal bits + (lit<<1)|1, NOT
diff_update_prob; keyframe partition probs are a const selected by
get_partition_probs and must never be stored in a FrameContext (stored
contexts are new(false), the active keyframe copy new(true) + a
reset_inter_partition before the save); vp9_switchable_interp_tree is
{0,2,-1,-2} (libvpx's EIGHTTAP/EIGHTTAP_SMOOTH/EIGHTTAP_SHARP #defines,
not the spec's naming order); mv_ref_blocks' POSITION is {row,col} and one
accessor added .0 to the column; clamp_mv_ref's edge arithmetic is signed
(usize underflowed on a frame's partial last row) and clamps the COLUMN
with the left/right edges and the ROW with the top/bottom ones; and the
mode-derived candidate-count override sits AFTER libvpx's Done: label, so
an early exit skips it - reproduced bug-for-bug.

This slice is SYNTAX ONLY: decode() still refuses inter frames by name and
no inter pixel is produced. The keyframe path still decodes to pixels and
keyframe_exact is green.

Verified by an independent reviewer in three passes (structural claims
re-derived from libvpx source, the identity comparison re-implemented
independently, a dropped-field audit of the two stale fields, and
delta re-verification of the clamp/error-propagation/gate fixes).
vp9kf: report -- the third odd-extent cross-product cell is coveredAhmet Kaan Gümüş · ae29de7
vp9kf: report -- the third odd-extent cross-product cell is covered

`/tmp/odd_hw_tr.ivf` (1913x1210, `-tile-rows 1`) decodes 3 of 3 frames
byte-exact, closing the last unexercised shape: odd width x odd height x
tile rows. All three odd-extent x tile-grid cells now have a byte-exact
witness.

Encoder note recorded with the fixture: libvpx-vp9 declines `-tile-rows`
whenever `-tile-columns` is non-zero in the same command (1366x768,
1366x1200, 1366x1210, 1913x1210 and 1918x1200 with `-tile-columns 1
-tile-rows 1` all come out cols 1 rows 0), and it declines tile rows
outright on short frames (320x242). The tile-row witness therefore needs
`-tile-columns 0` at a tall resolution; layout confirmed with
scratch_tiledbg before the sweep.
vp9kf: tile-ROW streams decode byte-exact -- MI-aligned extents, frame-scoped contextsAhmet Kaan Gümüş · 332f251
vp9kf: tile-ROW streams decode byte-exact -- MI-aligned extents, frame-scoped contexts

Tile-row streams (log2_tile_rows > 0) now decode byte-exact: tr.ivf and
tr2.ivf 3 of 3 frames, previously 0 of 3. Seven fixes, each ported from
libvpx with its line:

1. tx probabilities come from the frame's FrameContext tables
   (get_tx_probs, vp9_pred_common.h:173), not the TX_* const defaults.
2. the tx-size context carries libvpx's "if (!has_above) above_ctx =
   left_ctx" fallback (vp9_pred_common.h:156-170).
3. above availability is gated on the FRAME (mi_row != 0, set_mi_row_col
   vp9_onyxc_int.h:430), not on the tile-row start; tile_row_start is gone
   from the decode chain.
4. ectx/mi are frame-scoped: allocated once per frame, above cleared once,
   left per SB row (vp9_decodeframe.c:2079-2083 / :2260-2261).
5. the above entropy/partition arrays are sized mi_cols_aligned_to_sb,
   closing a pre-existing OOB panic at widths not a multiple of 8
   (decode.rs:767 on a 1366-wide frame; the baseline panicked too).
6. intra edge extension is a branch-for-branch port of
   vp9_reconintra.c:300-394: the extend-vs-direct decision comes from
   mb_to_bottom_edge/mb_to_right_edge, the extension length from the
   MI-ALIGNED buffer extent (vp9_alloc_frame_buffer sets y_width =
   (width+7)&~7 -- yv12config.c:173-174,250-251), and the arithmetic is
   isize, closing an "attempt to subtract with overflow" at intra.rs:72 on
   320x242.
7. the chroma loop filter takes no plane-width bound: all five uv_w column
   clamps are gone, matching vp9_filter_block_plane_ss11's unclamped
   MI_BLOCK_SIZE>>1 groups (vp9_loopfilter.c:1394, :313-399) which write
   into the padded plane. At 1366 wide the last chroma group overhangs the
   visible plane by 4, so every clamped edge was dropped: luma stayed
   byte-exact while chroma was off by one (U 4/5/6, V 37/33/16).

Matrix (scratch_realsweep, 3 frames each): h242, h1082, h1082tr, h1082trc,
tr, tr2, t1080, t1080-single, single1080, w1366, w1366tc and the 320x240
tile0 sweep are all byte-exact. Still unexercised: odd width x odd height x
tile ROWS -- the encoder declines -tile-rows at those heights.

Verified by an independent reviewer with revert-alone discrimination: a
visible-length extent fails h242/h1082, a 64-aligned extent fails the 1080p
fixtures, the MI-aligned extent passes all; restoring the uv_w clamps
reproduces the chroma-only residue exactly. cargo test -p ec-vp9 is green
and cargo check prints the 5 baseline warnings.

2026-09-16

vp9kf: real content decodes byte-exact -- per-SB-row left contexts, MI-row chroma extentsAhmet Kaan Gümüş · bd4fadc
vp9kf: real content decodes byte-exact -- per-SB-row left contexts, MI-row chroma extents

Two boundary bugs, both found by driving real content through the decoder
(a real 320x240 clip and a real 1920x1080 clip, all-intra VP9 transcodes):

1. decode.rs: the left entropy and partition contexts were zeroed only on the
   tile's FIRST superblock row (`if sb_row == row_lo`). libvpx zeroes them at
   the start of EVERY SB row - vp9_decodeframe.c:2256-2258 (plain decode_tiles;
   row-mt twin :2114-2115, per-tile-row twins :1825-1826 / :1898-1899). Our
   luma left index wraps at mi_row 16, so the first block of SB row 2 read a
   stale slot: ctx 1 instead of 0. First divergent bool of a real 320x240 frame
   was #74792, block mi_row 16 mi_col 0, coef_probs[TX_4X4][Y][band 0][ctx]:
   oracle prob 195 (ctx 0) vs ours 84 (ctx 1) - everything before it agreed
   bit-for-bit.
2. loopfilter.rs: the chroma ss11 row-group extents were gated on the visible
   chroma height; libvpx iterates MI rows (`r += 4`, vp9_loopfilter.c:1400;
   horizontal `r += 2`, :1431), so a group whose first MI row is inside the
   frame is filtered even when its 8 chroma rows overhang the visible height.
   1080p lost chroma rows 536-539 (last SB row, mi_rows 135); the level read
   also goes through a bounds-safe `level_at` now.

Evidence (all reproduced independently by a reviewer in hermetic scratch
copies): real 320x240 0/3 -> 3/3 byte-exact; 1080p single-tile 0/3 -> 3/3;
1080p with 4 tile columns refused -> 3/3 (both this and the BE tile-prefix fix
meet here); keyframe_exact 4/4 and the whole crate green; 5 lib warnings
unchanged. Reverting either hunk alone regresses the matching sweep.

Also: lanes/realdesync.report.md (the diagnosis: first divergent decision,
ranked causes, the tile-row class caveat) and a report section recording that
the tile-ROW path (log2_tile_rows > 0) is NOT correct yet - three pre-existing
defects isolated there, listed in lanes/vp9kf.report.md.
vp9kf: report -- multi-tile is closed at 4b6a68b9Ahmet Kaan Gümüş · 7bd2aba
vp9kf: report -- multi-tile is closed at 4b6a68b9

The report's "third finding, not fixed" and the "next lane charter seed" item 2
both described the multi-tile refusal as an open walk/offset question. They now
record the closed finding: the per-tile size prefix is big-endian
(mem_get_be32, vp9_decodeframe.c:1674/1688/1690), the offset and the
get_tile_offset geometry were already right, an 8-tile 2560x1440 stream now
walks exactly, a 4-tile stream decodes 2/2 byte-exact, the single-tile path is
untouched, and the residual real-content divergence is tile-independent. The
desync item stays open for the diagnosis lane.
vp9kf: VP9 tile size prefixes are BIG-endianAhmet Kaan Gümüş · de9bde5
vp9kf: VP9 tile size prefixes are BIG-endian

decode.rs read the per-tile 4-byte size prefix as little-endian, so any frame
with more than one tile - ffmpeg's default at 1080p, cols_log2 = 2 - starved
the walk and refused a VALID stream as `Corrupt: truncated tile data`:
00 00 0D DC little-endian is 3691839488 against a 71110-byte tail.

libvpx `get_tile_buffer` reads it with `mem_get_be32`
(vp9_decodeframe.c:1688/1690; vpx_ports/mem_ops.h:88). One token changed,
plus the comment and the diagnostic probe's accounting print.

Evidence: an 8-tile 2560x1440 IVF now walks exactly (prefixes 120646 + last
tile 11383 == 132029 tail; frame 1 120851 + 11355 == 132206); a 4-tile stream
decodes 2/2 byte-exact against ffmpeg; keyframe_exact 4/4 (a single-tile frame
takes the whole tail, so that path cannot change); 5 lib warnings unchanged.
Reviewed independently: SAFE TO COMMIT.

Not this: the residual real-content divergence is tile-independent - the same
source re-encoded with -tile-columns 0 -tile-rows 0 still differs, so the tile
walk was never the entropy problem.
fix(mp3): the word-buffered bit accumulator no longer shifts by 64Ahmet Kaan Gümüş · 82ba265
fix(mp3): the word-buffered bit accumulator no longer shifts by 64

push_bits computed `(value & mask) << (64 - used - n)`. For a ZERO-LENGTH run
on an empty buffer (used == 0, n == 0) that shift count is exactly 64: debug
builds panicked ("attempt to shift left with overflow") and release builds
wrapped it to a shift of 0, OR-ing the unmasked value into the accumulator.
The scalefactor coder emits such a run for every band whose slen is 0 - the
normal case when all scalefactors are zero. The debt's "used + n > 64" framing
was wrong: used < 8 always, so free >= 57 and the old subtraction never
underflowed.

Fix: n == 0 returns early; a run longer than the free space fills the word,
drains its complete bytes and starts the remainder in a fresh word (the
remainder is under eight bits, so the trailing drain is the one the un-split
path already ran). For n >= 1 with n <= free the arithmetic is unchanged and
the emitted bytes are identical, so previously working encodes are
byte-for-byte the same.

Evidence: ec-mp3 lib 22/22 (3 panicked before at the old huffman.rs:211);
edith `cargo test -p engine --test audio_export -- --test-threads=1` 14/14
(`exports_the_timeline_as_an_mp3` and `the_sound_is_written_at_the_rate_that_
was_asked_for` failed pre-fix with "export worker panicked: attempt to shift
left with overflow"); new boundary test compares byte-for-byte against a plain
MSB-first reference across n = 0, full-word and spill runs, and fails on the
old body. Both reviewed independently: SAFE TO COMMIT.
vp9kf: filter the luma internal-4x4 H edge on the frame's last MI rowAhmet Kaan Gümüş · a050448
vp9kf: filter the luma internal-4x4 H edge on the frame's last MI row

Reviewer finding (independent panel seat, PASS on the other five claims). The
port gated the luma int4 H edge on `sbr + row != mi_rows - 1`, labelled "UV
edge" - but skip_border_4x4_r lives only in the 4:2:0-chroma path
(vp9_filter_block_plane_ss11, vp9_loopfilter.c:1382) and in non420 under ss_y.
vp9_filter_block_plane_ss00 passes int_4x4_y & 0xff for every MI row
(:1286-1311) and vp9_adjust_mask keeps the last row's bits (:798-805), so real
content loses one filter tap set in the bottom 8 rows whenever the bottom MI
row holds a 4x4-tx cell. Neither fixture does (last int4 anchors at y=200/204
vs last MI row 232-239), so no existing gate could see it.

Witness, fails pre-fix: loopfilter::tests::
luma_int4_h_edge_is_filtered_on_the_last_mi_row - a 64x64 grid of BLOCK_4X4
cells at level 8, plane stepped by 4 at row 60 (sharper steps fail
filter_mask's gradient test and move nothing), asserting rows 60-61 changed.
With the guard restored it panics "was not filtered"; without it, green.
lib 9/9, keyframe_exact 4/4, ec-vp9-syntax 13+3, warnings unchanged (5).
vp9kf: drop the aw/ah locals the extent change orphanedAhmet Kaan Gümüş · 07af9df
vp9kf: drop the aw/ah locals the extent change orphaned

filter_frame now takes mi_cols*8/mi_rows*8, so decode_keyframe_inner's aw/ah
reads were dead (two new unused-variable warnings). Warning set is back to the
base commit's five. keyframe_exact 4/4.
vp9kf: real-content sweep -- SB-padded plane buffers, honest Picture strides, and the desync it foundAhmet Kaan Gümüş · 3678cfd
vp9kf: real-content sweep -- SB-padded plane buffers, honest Picture strides, and the desync it found

Adds crates/ec-vp9/tests/scratch_realsweep.rs (all-intra VP9 transcode of a real
video, ours vs ffmpeg, per-frame diff counts) and scratch_tiledbg.rs. The
library holds no VP9 content of its own, so this is the first time the keyframe
path has seen real imagery - and it is NOT byte-exact: a real 320x240 frame is
exact for rows 0-127 and wrong from row 128 down (19477/15337 diffs), i.e. the
entropy decoder diverges at a block in SB row 2. "Byte-exact" was
fixture-exact.

Two real defects fixed (fixture suite re-verified green, 17 binaries):

1. Plane buffers were 8-aligned; libvpx decodes an edge block at full size and
   lets the overhang land in the frame border (decodeframe.c:1216). A 32x32
   block at mi_row 132 of a 1080-row frame wrote 8 rows past the buffer and
   panicked at intra.rs:380. Buffers are now SB-aligned, and filter_frame gets
   the MI-aligned visible extent (the padded size OOB'd the level grid).
2. Picture::stride/uv_stride reported the aligned aw while the crop packs rows;
   a consumer trusting stride misread any non-64-aligned width. Now width/2.

Reported, not fixed: multi-tile frames (ffmpeg's default at 1080p) refuse with
'Corrupt: truncated tile data' - either the tile walk or the tile-data offset
is wrong for >1 tile, and 'corrupt' is the wrong claim until that is known.
lanes/vp9kf.report.md carries the table, the next-lane charter seed, and a note
that the fixture recipes were never recorded.
vp9kf: fix the stale tile-bounds pin in ec-vp9-syntax; record the merge follow-upsAhmet Kaan Gümüş · 0f31b1d
vp9kf: fix the stale tile-bounds pin in ec-vp9-syntax; record the merge follow-ups

The lane's gates were crate-scoped (cargo test -p ec-vp9), so the merge into
main is what surfaced a stale in-lib test: tile_bounds_match_the_spec_formulas
still pinned the pre-lane model - (0,3)/(0,4)/(0,1) for 30/60/1 superblocks.
libvpx's get_max_log2_tile_cols returns max_log2 - 1 (vp9_tile_common.c:45-49),
so the values are (0,2)/(0,3)/(0,0), and a single-superblock frame reads NO
increment bit (setup_tile_info's `while (max_ones-- && vpx_rb_read_bit(rb))`
with max_ones == 0). The code was right; the test was old.

Gates on main: ec-vp9 14 binaries green; ec-vp9-syntax 13/13 + 3/3;
cargo check --workspace --all-targets clean; ec-hw lib 12/12.

Also records in lanes/vp9kf.report.md: the merged/branch/removed-worktree state,
the fixtures/vp9 copy main needed (fixtures/ is gitignored), the next-lane
candidates, and the trace-hook/scratch-harness cleanup still open.
vp9kf: scratch_synth skips when its tmpfs fixture is goneAhmet Kaan Gümüş · 2a10cb5
vp9kf: scratch_synth skips when its tmpfs fixture is gone

The probe parses /tmp/synth-kf-frame.bin, a dump produced ad hoc in an
earlier session with no recorded generator. With tmpfs wiped it panicked,
which made a scratch harness look like a regression in every workspace run.
Print a SKIP line instead; the probe still runs whenever the dump exists.
vp9kf: drop crates/ec-vp9/src/decode.rsdecode.rsAhmet Kaan Gümüş · fcfe947
vp9kf: drop crates/ec-vp9/src/decode.rsdecode.rs

A stale 620-line duplicate of decode.rs committed by accident in the first
lane commit (7b94a0dc); not in the module tree (lib.rs declares `mod decode`,
which resolves to decode.rs), referenced by nothing, superseded by the 877-line
decode.rs. Found by reading the merge's create list.
vp9kf: keyframes byte-exact vs ffmpeg -- iadst16 stage 4, mask-driven loop filterAhmet Kaan Gümüş · 03cbf64
vp9kf: keyframes byte-exact vs ffmpeg -- iadst16 stage 4, mask-driven loop filter

keyframes_match_ffmpeg PASSES: FRAME=1 pre-LF Y 1310 diffs -> post-LF Y/U/V 0
(FRAME=0: Y pre 746 -> post 0). Byte dumps are the evidence channel.

1. iadst16 stage 4 + output permutation, ported from inv_txfm.c:520-554:
   negated sum for pairs (2,3)/(14,15), (-x_i + x_j) for the second slot of
   (6,7)/(10,11), output[13] = -x13. Reverting this alone fails frame 1 at
   Y(120,68) 209 vs 210.
2. The loop filter is now driven by vp9_setup_mask's masks for luma AND
   chroma: build_masks/build_y_mask (blocks <16x16: only the first 8x8
   touches the UV masks), then vp9_adjust_mask (TX_32->TX_16, 4-tap border
   promotion, rows/columns edge masks, rows==1 and rows==5 UV demotions,
   mask_uv_int for internal edges). All eight mask tables re-read against
   vp9_loopfilter.c:39-205 constant by constant.
3. Luma's V and H passes no longer interleave per mask bit (chroma already
   knew this); that was the last 19 Y diffs after the mask port.

Dead code: LfGrids.tx4 (write-only, drops a per-frame mi grid),
tables::uv_txsize_lookup and tables::BLOCK_INVALID (only user was the old
chroma tx-grid walk). Warning count back to HEAD's 5.

Suites: lib 8/8, keyframe_exact 4/4, dump_probe + 8 scratch harnesses PASS.
scratch_synth still fails on the tmpfs-gone /tmp/synth-kf-frame.bin
(pre-existing, fixture-dependent).

2026-09-14

vp9kf: chroma 64x64 border 4-tap is 8-tap (adjust_mask)Ahmet Kaan Gümüş · e2fa4f0
vp9kf: chroma 64x64 border 4-tap is 8-tap (adjust_mask)

left_border_uv 0x1111 / above_border_uv 0x000f. U 16→7, V 20→11, Y still
byte-exact. keyframes_match_ffmpeg still FAIL at U(31,11). Not pushed.
vp9kf: d153 row, idct32 stage 8, flat2 q0, chroma tx-grid — Y byte-exactAhmet Kaan Gümüş · 82ca712
vp9kf: d153 row, idct32 stage 8, flat2 q0, chroma tx-grid — Y byte-exact

generic d153 no longer skips row 1; idct32 runs vpx stage 8; flat_mask5
compares q4..q7 to q0 (not p0). Pre-LF Y matches libvpx; post-LF Y matches
ffmpeg. Chroma still 16 U + 20 V off (HANDOFF #6). Not pushed.
vp9-kf: loopfilter per-MI masks, 4-line kernel walk, flat_mask5 semanticsAhmet Kaan Gümüş · 9769de2
vp9-kf: loopfilter per-MI masks, 4-line kernel walk, flat_mask5 semantics

- luma edge masks per-MI (internal MI boundaries of wide blocks filter;
  left/above_64x64_txform_mask rules), luma edge set now matches the
  instrumented-libvpx trace 3044/3044 anchors
- lpf_edge walks the 4 pixel-lines of each chunk (was filtering only
  every 4th row/col)
- flat2 follows flat_mask5's shifted params: q7 vs q0, no |q0-p0| clause
- probes: EC_VP9_SKIP_LF, LFTRACE (ours + patched oracle), scratch_lfdump
  Y-plane dumps; HANDOFF #5 in lanes/vp9kf.report.md

keyframes_match_ffmpeg still FAIL: first diff (76,2) 47 vs 48; pre-LF
decode divergence from (88,24) tracked as the next dominant bug.
vp9kf: entropy round 2 — trees, kf partition probs, 8x8 partition symbol, tile-info boundsAhmet Kaan Gümüş · c445467
vp9kf: entropy round 2 — trees, kf partition probs, 8x8 partition symbol, tile-info bounds

- INTRA_MODE_TREE leaf order fixed to libvpx vp9_intra_mode_tree; the invented
  spec-doc chain UV_MODE_TREE deleted (v1.15 decodes uv with the same tree,
  decodemv.c:232). SEGMENT_TREE corrected to vp9_seg_common.c:58 balanced form.
- Keyframes now code partitions with vp9_kf_partition_probs (added; spec 7.2),
  not the inter defaults. FrameContext::new(key_frame).
- The 8x8-level partition symbol is read (decodeframe.c:1188 runs before the
  !hbs branch); sub-8x8 shapes occupy the full 8x8 mi area (luma 2x2 4x4 TUs,
  chroma 4x4 once per 8x8). bsize_of_n4 mapping fixed (2->16x16, 1->8x8).
  Duplicate kf_uv_probs removed from modes.rs (kept in tables).
- ec-vp9-syntax DEVIATION (flagged for merge review): tile_cols_log2_bounds
  returned max-1, skipping the terminating tile-cols increment bit; bounds are
  now inclusive and rows mirrors vp9_get_tile_n_bits. Test re-pinned to
  libvpx/spec values (1920 -> (0,3), 3840 -> (0,4), 1 -> (0,1)).
- keyframes_match_ffmpeg still FAILING (ours 120 vs 72 at pixel (0,0); was 133).
  inter_is_named_unsupported PASSES as a named Error. Debug traces (TILE/B/C/RC,
  EC_VP9_FORCE_TAIL) and scratch_* harnesses kept for the next round; see
  lanes/vp9kf.report.md HANDOFF #2.
docs(av1): arfmode keep-rule close -- default stays OFFAhmet Kaan Gümüş · 83675bb
docs(av1): arfmode keep-rule close -- default stays OFF

server-1 unreachable; re-ran long-GOP on server-2 (control+arm2+arm3) and
server-3 (control+arm7). Both controls reprint standing table to the digit
(film A +20.9/-9.0, film B +70.4/-2.2). Arms vs same-server control (libaom):
arm 2 +0.9/+0.6 worse, arm 3 +2.9/-0.3, arm 7 +4.9/+1.7. Bytes dropped,
PSNR dropped more. Probe sign was wrong. Native skipped (ON required it).
speed::ARFMODE stays [0; 11].

2026-09-13

docs(av1): lane-arfmode report -- the top-ARF syntax gap re-censused at 0d81d6c5 (film B +2188 B/frame total, mode+partition+mv 44%/38% of it: intra-fallback CDF poisoning intra_inter 138 vs rav1e's 10 B/frame, compound at 19-24% of ARF area vs rav1e's 0%, 8x8-heavy partitions at 2.4x the split rate); EC_AV1_ARFMODE (default OFF, bit-exact, pins 8291/33227 hold at default and EC_AV1_SPEED=6): 1 no intra at the ARF incl. the whole-32 loop the probe proved is where the intra area lives, 2 no RD-optional 8x8 split, 4 no leaf compound; witness green (per-arm counters 580/113/568, stream moves, sample-exact through both decoders); two-point probe all arms engage on real content (printed counts 63k-131k/point), arm 2 -2.05%/-2.49%, arm 1 -0.28%/-2.61%, arm 4 -1.58%/-0.30% bytes at control PSNR; server-1 chain launched (control film A +20.9/-9.0 = standing table to the digit), arm gates and native pair PENDING on the running chain, disposition stays default OFF pending those logsAhmet Kaan Gümüş · e135fad
docs(av1): lane-arfmode report -- the top-ARF syntax gap re-censused at 0d81d6c5 (film B +2188 B/frame total, mode+partition+mv 44%/38% of it: intra-fallback CDF poisoning intra_inter 138 vs rav1e's 10 B/frame, compound at 19-24% of ARF area vs rav1e's 0%, 8x8-heavy partitions at 2.4x the split rate); EC_AV1_ARFMODE (default OFF, bit-exact, pins 8291/33227 hold at default and EC_AV1_SPEED=6): 1 no intra at the ARF incl. the whole-32 loop the probe proved is where the intra area lives, 2 no RD-optional 8x8 split, 4 no leaf compound; witness green (per-arm counters 580/113/568, stream moves, sample-exact through both decoders); two-point probe all arms engage on real content (printed counts 63k-131k/point), arm 2 -2.05%/-2.49%, arm 1 -0.28%/-2.61%, arm 4 -1.58%/-0.30% bytes at control PSNR; server-1 chain launched (control film A +20.9/-9.0 = standing table to the digit), arm gates and native pair PENDING on the running chain, disposition stays default OFF pending those logs
perf(mp3): the region walk prices zero pairs once and drops out-of-range tables upfrontAhmet Kaan Gümüş · 5081e9a
perf(mp3): the region walk prices zero pairs once and drops out-of-range tables upfront

The per-pair range check never fired: the shortlist is built from the
region's maximum, so a candidate that would reject any pair rejects the
one carrying that maximum, and the check now happens once per candidate
before the walk. Zero pairs cost every candidate the same single code
length and take a dedicated path. Same accept/reject decisions in the
same order; seven of eight fixtures byte-identical (music3s inherited
its one-ulp difference from the gain-search step, correlation unchanged
to six decimals). Suite green. encode: stereo CBR 127.9x -> 139.2x
realtime (ratio 0.886), VBR 67.5x -> 74.3x, mono tone 55.5x -> 78.3x.