forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on bdf0874309fefca60d2c4bcd4f26d40c632d3e69

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.
perf(mp3): the quantiser runs the level curve eight lanes wideAhmet Kaan Gümüş · 59ae240
perf(mp3): the quantiser runs the level curve eight lanes wide

quantise_span evaluates |xr·scale|^(3/4) for a whole band through
wide::f32x8 (abs, cube, two sqrt lanes, clamp, copysign, trunc) with a
scalar tail, replacing the per-line f64 closure that 30% of the mono
profile and a fifth of the stereo one lived in. Overflow lanes land in
the same MAX_QUANT clamp the scalar path uses; every bench fixture still
encodes byte-identically and the suite is green. encode: stereo CBR
109.8x -> 127.9x realtime (ratio 0.819 vs the incumbent, target 0.7
met), VBR 55.7x -> 67.5x.
test(av1): enc_probe prints the arfmode engagement counter per point -- the probe's arm rows must print a non-zero count under EC_AV1_ARFMODE itself, not rely on the in-process witness (take_arfmode_hits is pub now, was cfg(test)); the first probe sweep never exported the knob and every arm row came back byte-identical to the control, which is how that class looks from the outsideAhmet Kaan Gümüş · 54adc86
test(av1): enc_probe prints the arfmode engagement counter per point -- the probe's arm rows must print a non-zero count under EC_AV1_ARFMODE itself, not rely on the in-process witness (take_arfmode_hits is pub now, was cfg(test)); the first probe sweep never exported the knob and every arm row came back byte-identical to the control, which is how that class looks from the outside
perf(mp3): the encoder stops shuffling its own buffersAhmet Kaan Gümüş · dcaf6bb
perf(mp3): the encoder stops shuffling its own buffers

Three allocation/memmove habits from the profile's tail: the packet
layer drained one frame at a time, memmoving the whole remaining push
per frame (quadratic on a single large push); encode_block built a fresh
deinterleave Vec per channel per frame; emit_frame cloned every held
granule (subbands and thresholds) to satisfy a borrow that a drain
before the loop removes. Byte-identical on all eight fixtures, suite
green. encode: stereo CBR 96.0x -> 109.8x realtime (ratio 0.693), VBR
52.4x -> 55.7x.
perf(mp3): the gain search brackets instead of stepping one unitAhmet Kaan Gümüş · 59a18cf
perf(mp3): the gain search brackets instead of stepping one unit

Instrumentation showed the rate loop running ~31 quantise-plus-plan
evaluations per granule: the gain search walked one step at a time from
the start estimate to the boundary. "Fits the budget without clipping"
is monotone in the gain (a higher gain shrinks every line, and a smaller
spectrum costs no more to code), so the boundary is now bracketed by a
doubling stride from the start estimate and bisected — about 2·log2 of
the distance instead of the distance, with the walk's gain-255 cap (the
low-pass loop below still trims) and gain-0 floor kept exactly. Seven of
eight bench fixtures still encode byte-identically; music3s moves a
few ulp-boundary lines with decoded correlation unchanged to six
decimals. Suite green. encode: stereo CBR 43.7x -> 96.0x realtime
(ratio 0.608 vs the incumbent), VBR 20.9x -> 52.4x.
perf(aac): the outer rate loop warm-starts at last frame's working point and gallops to the edge -- bits fall monotonically as the offset rises, so fits-the-budget is true on an upper interval and the full-range bisection and a gallop from the previous frame's answer find the same left edge; steady state costs a probe at 240, one at the warm offset and two-to-three bracket probes instead of nine (warm_offset field, AacEncoder). The requant passes skip bands the +/-60 delta chain left alone (dirty vector) -- measured neutral on its own, kept because it is the same class of work the noise memo already avoids. Byte-identical on stereo 256k and 5.1 512k vs the base build; stereo 59.1 -> 103.1x RT (1.31x rusty_aac's 78.4x single-thread, was 0.44x at the lane start), 5.1 21.8 -> 44.3x (1.44x rusty's 30.8x); ec-aac suite green 75/75; quality rows unchanged (0.8857/0.9827/0.9829 worst-channel vs the same synthetic program, ec still clearing rusty on every one)Ahmet Kaan Gümüş · 17417bc
perf(aac): the outer rate loop warm-starts at last frame's working point and gallops to the edge -- bits fall monotonically as the offset rises, so fits-the-budget is true on an upper interval and the full-range bisection and a gallop from the previous frame's answer find the same left edge; steady state costs a probe at 240, one at the warm offset and two-to-three bracket probes instead of nine (warm_offset field, AacEncoder). The requant passes skip bands the +/-60 delta chain left alone (dirty vector) -- measured neutral on its own, kept because it is the same class of work the noise memo already avoids. Byte-identical on stereo 256k and 5.1 512k vs the base build; stereo 59.1 -> 103.1x RT (1.31x rusty_aac's 78.4x single-thread, was 0.44x at the lane start), 5.1 21.8 -> 44.3x (1.44x rusty's 30.8x); ec-aac suite green 75/75; quality rows unchanged (0.8857/0.9827/0.9829 worst-channel vs the same synthetic program, ec still clearing rusty on every one)
perf(av1): the ARFMODE intra arm cuts the top ARF's whole-32 candidates too -- the probe falsified the leaf-only scope (film A arm 1 byte-identical to the control at q150 AND q90: the ARF's 15% intra area lives in search_inter_block's whole-32 intra loop, not in the leaves), so the scene-cut hatch as chartered was a hatch nothing else was using; per-block engagement counter moved to the whole-32 site, docs updated, witness and pins re-greenAhmet Kaan Gümüş · 7ea5133
perf(av1): the ARFMODE intra arm cuts the top ARF's whole-32 candidates too -- the probe falsified the leaf-only scope (film A arm 1 byte-identical to the control at q150 AND q90: the ARF's 15% intra area lives in search_inter_block's whole-32 intra loop, not in the leaves), so the scene-cut hatch as chartered was a hatch nothing else was using; per-block engagement counter moved to the whole-32 site, docs updated, witness and pins re-green
perf(mp3): one walk over the region prices every candidate tableAhmet Kaan Gümüş · 19b1017
perf(mp3): one walk over the region prices every candidate table

best_table walked the region's pairs once per shortlisted table (up to
nine pair_bits passes per region) and plan_spectrum walked a tenth time
to price the winner; half the remaining profile lived in that loop. The
region is now walked once, accumulating every candidate's cost in
parallel, with a dead candidate dropped the moment a pair falls outside
it — the same accept/reject decisions in the same order, so every bench
fixture still encodes byte-identically and the suite is green. The
orphaned pair_bits helper is folded into the new walk. encode: stereo
CBR 37.3x -> 43.7x realtime, VBR 17.8x -> 20.9x.
perf(aac): the frame's noise search is memoised per (channel, band, scalefactor) -- band_noise is pure for one frame's coefficients, and the outer bisection's probes re-ask the same pairs, so each pair computes at most once per frame (stamp/cur generation, no clearing pass); fresh NoiseMemo per write_frame, capacity channels*max_sfb*256. The first cut keyed (band, sf) only and the byte-identity gate caught it instantly: stereo's two channels collided in the slots and one channel replayed the other's noise (10x deltas) -- the key now carries the channel slot. Byte-identical on stereo 256k and 5.1 512k vs base; stereo 42.1 -> 59.1x RT, 5.1 15.6 -> 21.8x (quiet-core min-of-7, both harnesses agreeing); ec-aac suite green 75/75Ahmet Kaan Gümüş · 6d09e0a
perf(aac): the frame's noise search is memoised per (channel, band, scalefactor) -- band_noise is pure for one frame's coefficients, and the outer bisection's probes re-ask the same pairs, so each pair computes at most once per frame (stamp/cur generation, no clearing pass); fresh NoiseMemo per write_frame, capacity channels*max_sfb*256. The first cut keyed (band, sf) only and the byte-identity gate caught it instantly: stereo's two channels collided in the slots and one channel replayed the other's noise (10x deltas) -- the key now carries the channel slot. Byte-identical on stereo 256k and 5.1 512k vs base; stereo 42.1 -> 59.1x RT, 5.1 15.6 -> 21.8x (quiet-core min-of-7, both harnesses agreeing); ec-aac suite green 75/75
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(av1): the top ARF's leaf offer set behind EC_AV1_ARFMODE -- 1 no intra candidate at the 16x16/8x8 leaves (the intra trial's commit was always overwritten by the inter winner's, so the planes never change), 2 no RD-optional 8x8 split (16x16 is the leaf floor; the spec-forced 8x8s at straddling 16x16s are a different site), 4 no compound candidates at the leaves; the 32x32 whole keeps its full set as the scene-cut hatch; default 0 is bit-exact (pins 8291/33227 hold at the default and EC_AV1_SPEED=6); witness proves per-arm engagement counters, stream movement on a level-ramp fixture (middle group's ARF sits between its two anchors), coding-order stability and sample-exact decode through decode_stream AND ffmpegAhmet Kaan Gümüş · 5e19f1a
perf(av1): the top ARF's leaf offer set behind EC_AV1_ARFMODE -- 1 no intra candidate at the 16x16/8x8 leaves (the intra trial's commit was always overwritten by the inter winner's, so the planes never change), 2 no RD-optional 8x8 split (16x16 is the leaf floor; the spec-forced 8x8s at straddling 16x16s are a different site), 4 no compound candidates at the leaves; the 32x32 whole keeps its full set as the scene-cut hatch; default 0 is bit-exact (pins 8291/33227 hold at the default and EC_AV1_SPEED=6); witness proves per-arm engagement counters, stream movement on a level-ramp fixture (middle group's ARF sits between its two anchors), coding-order stability and sample-exact decode through decode_stream AND ffmpeg
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.
perf(aac): the rate loop's per-coefficient powf becomes two lookup tables -- pow_quarter carries 2^(v/4) for every integer v in -155..=155 (band_noise's gain, quantise_one's reciprocal) and POW_HALF carries the bisection's 2^(offset/2) mask scale in -240..=240; every entry is built by the identical powf expression it replaces, so the values -- and the bitstream -- are unchanged. The band gain is hoisted to per-band granularity in band_noise and the requant pass instead of being recomputed per coefficient. Byte-identical on stereo 256k and 5.1 512k vs base; stereo 37.9 -> 42.1x RT, 5.1 14.2 -> 15.6x; ec-aac suite green (43+1+1+14, remaining two suites landed green)Ahmet Kaan Gümüş · 0fe46e1
perf(aac): the rate loop's per-coefficient powf becomes two lookup tables -- pow_quarter carries 2^(v/4) for every integer v in -155..=155 (band_noise's gain, quantise_one's reciprocal) and POW_HALF carries the bisection's 2^(offset/2) mask scale in -240..=240; every entry is built by the identical powf expression it replaces, so the values -- and the bitstream -- are unchanged. The band gain is hoisted to per-band granularity in band_noise and the requant pass instead of being recomputed per coefficient. Byte-identical on stereo 256k and 5.1 512k vs base; stereo 37.9 -> 42.1x RT, 5.1 14.2 -> 15.6x; ec-aac suite green (43+1+1+14, remaining two suites landed green)
docs(av1): lane-arfmode charter -- the top-ARF syntax gap re-censused at 0d81d6c5 (film B +2188 B/frame, film A +3528: mode+partition+mv now 44%/38% of it), carried by the intra fallback's CDF poisoning (intra_inter 138 vs rav1e's 10 B/frame on film B), compound at the ARF (ours 19-24% of area vs rav1e's 0%), and an 8x8-heavy partition mix (2.4x rav1e's split rate on film B); the lever is EC_AV1_ARFMODE (default OFF, bit-exact): bitmask of ARF-leaf-only offer-set cuts -- 1 no intra at 16x16/8x8 leaves, 2 no RD-optional 8x8 split, 4 no compound at leaves, 32x32 whole and spec-forced 8x8s untouchedAhmet Kaan Gümüş · 20925bd
docs(av1): lane-arfmode charter -- the top-ARF syntax gap re-censused at 0d81d6c5 (film B +2188 B/frame, film A +3528: mode+partition+mv now 44%/38% of it), carried by the intra fallback's CDF poisoning (intra_inter 138 vs rav1e's 10 B/frame on film B), compound at the ARF (ours 19-24% of area vs rav1e's 0%), and an 8x8-heavy partition mix (2.4x rav1e's split rate on film B); the lever is EC_AV1_ARFMODE (default OFF, bit-exact): bitmask of ARF-leaf-only offer-set cuts -- 1 no intra at 16x16/8x8 leaves, 2 no RD-optional 8x8 split, 4 no compound at leaves, 32x32 whole and spec-forced 8x8s untouched