forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 38162979329cab4dc2cb8285cc65ee94d5601d34

2026-08-27

Merge branch 'lane-av1dec' (r4): public decode_stream + NEARMV + real bench rowAhmet Kaan Gümüş · 3816297
Merge branch 'lane-av1dec' (r4): public decode_stream + NEARMV + real bench row

decode_stream walks raw OBUs via the syntax parser and threads the DPB;
GOP round-trips + ffmpeg agreement green; av1 software decode benches at
3.30x realtime on the 640x384 GOP shape.
feat(av1dec): public decode_stream OBU walker, bench decode row, NEARMV liftAhmet Kaan Gümüş · 16b0ce0
feat(av1dec): public decode_stream OBU walker, bench decode row, NEARMV lift

decode_stream(&[u8]) walks a raw AV1 stream via ec-av1-syntax's Av1Parser,
extracts each Frame OBU's header + tile payload and dispatches to the
existing decode_key_frame_tile/decode_inter_frame_tile, threading a
single-slot DPB -- the first real entry point that does not need Encoded's
pub(crate) fields. ec-bench's av1 row now times decode_stream instead of
reporting "no decoder present". decode_inter_block also reconstructs NEARMV
(mvstack already carries the second stack candidate), tested by hand-driving
a symbol stream since this crate's own encoder never chooses that mode.
Merge branch 'lane-h265perf2': closed-form bit proxy for h265 mode rankingAhmet Kaan Gümüş · 555bbde
Merge branch 'lane-h265perf2': closed-form bit proxy for h265 mode ranking

estimate_residual_bits replaces per-candidate encode_residual in
choose_luma_mode; BD-PSNR within 0.05dB on both ladders (winner still
gets real RDOQ). Real remaining lever is RDOQ's own inner trial loop.
feat(h265): cheap coefficient-statistics proxy for mode-ranking bitsAhmet Kaan Gümüş · c8c466c
feat(h265): cheap coefficient-statistics proxy for mode-ranking bits

choose_luma_mode's per-candidate cost used the real CABAC-costed
encode_residual to rank ~6 intra mode survivors; replace it with a
closed-form proxy (last-position binarization + a log2 magnitude
estimate per level, no context updates) so ranking no longer pays for
a full residual_coding() walk per candidate. The winner still gets the
real encode_residual/RDOQ below. Magnitude scale swept against
bd_psnr_vs_x265 on the synthetic clip and a real screen capture;
1.5 lands within 0.05 dB of the real-bits baseline on both.
Merge branch 'lane-h265dec' (r1): software HEVC decoder coreAhmet Kaan Gümüş · 84c3ac5
Merge branch 'lane-h265dec' (r1): software HEVC decoder core

CabacDecoder + bin-for-bin residual decode + full CTU quadtree walk with
WPP; round-trips byte-exact vs encoder recon at whole-CTB sizes; the
70x50 content-triggered desync stays a documented ignored test for r2.
Merge branch 'lane-av1dec' (r3): inter-frame decode + ffmpeg cross-oracleAhmet Kaan Gümüş · 57878ee
Merge branch 'lane-av1dec' (r3): inter-frame decode + ffmpeg cross-oracle

Single-ref NEARESTMV/NEWMV inter decode with MC against a single-slot
DPB; GOP round-trips byte-exact vs encoder recon at 128x64 and 216x96,
and ffmpeg agrees with our decoder on key frames and a full GOP.
feat(av1dec): ffmpeg cross-oracle + inter-frame GOP decodeAhmet Kaan Gümüş · 8f45f31
feat(av1dec): ffmpeg cross-oracle + inter-frame GOP decode

decode.rs now decodes single-reference NEARESTMV/NEWMV inter frames
(whole 32x32 blocks and the 16x16-leaf split at a straddling true
edge), motion-compensating from the previous decoded frame and
chaining frame-to-frame like a single-slot DPB, byte-exact against the
encoder's own reconstruction across a GOP (incl. an odd frame size)
and cross-checked against ffmpeg on both a lone key frame and a full
GOP.
perf(h264): vectorize satd4 with the crate's wide-SIMD idiomAhmet Kaan Gümüş · 9d613d5
perf(h264): vectorize satd4 with the crate's wide-SIMD idiom

Bit-identical: sha256 of all access units over the 640x360x30 bench clip
matches the scalar build exactly (15b0075e...); full suite green.
Merge branch 'lane-av1dec' (r2): decoder covers directional modes, skip, odd sizesAhmet Kaan Gümüş · 468f128
Merge branch 'lane-av1dec' (r2): decoder covers directional modes, skip, odd sizes

All 13 intra modes, skip=1 blocks, and non-superblock-aligned frames now
decode byte-exact against the encoder reconstruction (854x480, 216x96,
128x128, 192x128). Fixes a right-by-coincidence txb mode index from r1.
feat(av1dec): decode skip blocks, directional intra modes, odd frame sizesAhmet Kaan Gümüş · 632319a
feat(av1dec): decode skip blocks, directional intra modes, odd frame sizes

Extends the software key-frame tile decoder past round 1's whole-superblock
DC_PRED-only scope: skip=1 blocks decode to pure prediction (no residual
read); all thirteen intra modes decode via crate::intra::predict, reusing
encode.rs's Reach edge/reach rules (made pub(crate)) for the directional
above-right/below-left reads; frames that are not a whole number of 64x64
superblocks or 32x32 blocks decode via the same gathered-CDF partial-block
path tile.rs's writer uses, with a duplicated (not shared -- tile.rs is
another lane's territory) Neighbours/gather implementation kept in step by
the byte-exact round-trip tests.

Fixed along the way: read_plane's cdfs.txb() lookup was hardcoded to
DC_PRED's table for every plane, which only worked by coincidence while
every stream really was DC_PRED; real modes need the block's own luma mode
there (matching write_block_planes) even though chroma's own prediction
mode stays DC_PRED.

decode_key_frame_tile's signature grows frame_width/frame_height (the
header's separate true render size) to crop the reconstruction the same way
crop_encoded does, since mi_cols/mi_rows alone cannot invert to it losslessly.
feat(h265): begin a software HEVC decoder — CABAC decode + CTU quadtreeAhmet Kaan Gümüş · d55730b
feat(h265): begin a software HEVC decoder — CABAC decode + CTU quadtree

Module map (crates/ec-h265):
- cabac.rs: CabacDecoder, the arithmetic-decode mirror of CabacEncoder,
  sharing RANGE_TAB_LPS/TRANS_IDX_LPS/TRANS_IDX_MPS/Contexts. Promoted from
  a test-only RefDecoder that already existed and matched the spec
  flowcharts; added decode_bin/decode_bypass/decode_terminate and a WPP
  byte_position_aligned() helper.
- residual.rs: decode_residual, a bin-for-bin mirror of encode_residual.
  Round-trip tested against encode_residual across every block
  size/scan/plane/sign-hiding combination.
- decode.rs (new): the coding-tree/transform-tree walk ec-h265 had no
  decode-shaped twin for. Reuses crate::intra and crate::transform as-is.
  decode_idr_au() parses VPS/SPS/PPS + one I slice and refuses inter
  slices with a stated reason.

Gates: decoder_inverts_the_encoder_bin_by_bin and
decode_residual_inverts_encode_residual green; tests/decode.rs round-trip
green at 32x32 and 96x64 (WPP), 70x50 checkpoint-ignored (same coded dims
as the passing 96x64 case — content-triggered desync, documented for the
next round). Pre-existing cargo test -p ec-h265 --release: 15/15 green.
Merge branch 'lane-av1dec' (r1): software AV1 key-frame decoder coreAhmet Kaan Gümüş · 2023929
Merge branch 'lane-av1dec' (r1): software AV1 key-frame decoder core

decode.rs decodes the encoder's own key-frame tiles byte-exact against
the encoder reconstruction (DC_PRED, whole-superblock frames this round);
msac SymbolDecoder promoted to a public reader. Directional/inter/skip
and odd sizes refuse with named errors — lane continues.
feat(av1): begin a software key-frame decoder (round 1)Ahmet Kaan Gümüş · e6eadb9
feat(av1): begin a software key-frame decoder (round 1)

Promotes msac's test-only SymbolDecoder to a real, non-test decoder
(the inverse of SymbolEncoder, already spec-derived and roundtrip
tested), and adds crates/ec-av1/src/decode.rs: a from-spec reader that
mirrors tile.rs's sb_coeff_key_frame_tile symbol order (partition tree
through 64x64/32x32/16x16, coefficient base/base-range/EOB/Golomb/sign
syntax, CDF adaptation) without importing from tile.rs, which a
sibling lane is editing concurrently.

Round 1 scope: key frames only, DC_PRED blocks only, unskipped, and
frames a whole number of 64x64 superblocks -- everything else refuses
with a named error rather than miscoding. Within that scope, real
encoder output (encode_key_frame_with_modes forced to DC_PRED, two
sizes, real quantised AC/DC residual) decodes byte-exact against the
encoder's own reconstruction. Encoded gains three pub(crate) fields
(tile, mi_cols, mi_rows, base_q_idx) so a decoder test can reach the
raw tile payload without re-deriving it from the OBU stream.

Deferred to round 2: non-DC_PRED intra modes (needs the directional
edge-reach plumbing), inter frames, skipped blocks, and the
partial-superblock/gathered-CDF true-edge path.
chore(h264): add a throwaway profiling example for the encode bench shapeAhmet Kaan Gümüş · dfbf8b3
chore(h264): add a throwaway profiling example for the encode bench shape

lane-h264perf r1: MEASURE FIRST. tools/ec-bench mixes every codec's rows
into one process, so perf can't isolate ec-h264 encode; this repeats the
bench's own 640x360x30-frame encode loop N times against a pre-extracted
raw yuv file so perf record has enough samples on just this path.
Merge branch 'lane-h265perf': RDOQ refines the winner onlyAhmet Kaan Gümüş · 7173115
Merge branch 'lane-h265perf': RDOQ refines the winner only

choose_luma_mode ran the full per-coefficient RDOQ search on every
prescreened candidate just to rank them; candidates now score with the
dead-zone quantiser and RDOQ runs once on the winning mode. Bench row
15621ms->4008ms (0.02x->0.08x RTF); BD-PSNR vs x265 unchanged above floor.
perf(h265): score mode candidates without RDOQ, refine only the winnerAhmet Kaan Gümüş · 32fb6a8
perf(h265): score mode candidates without RDOQ, refine only the winner

encode_residual was 73% of encode wall time (perf record, ec-bench h265
row). choose_luma_mode ran full RDOQ (its per-coefficient CABAC-costed
search) for every SATD-prescreened mode candidate just to rank them,
then discarded all but the winner's levels. RDOQ's expensive refinement
loop now runs once, after the winning mode is picked, instead of once
per candidate (~6x fewer calls into the hot loop).

ec-bench h265 row: 15621ms -> 4008ms wall (0.02x -> 0.08x RTF), ~3.9x.
cargo test -p ec-h265 --release: 27+15+1+3 green, including
bd_psnr_vs_x265 (+7.98/+8.44 dB, comfortably above its floor) and the
RDOQ/RQT/cu64/threads bit-exactness conformance tests.
Merge branch 'lane-bench': standing codec performance harnessAhmet Kaan Gümüş · 9fab3bf
Merge branch 'lane-bench': standing codec performance harness

tools/ec-bench sweeps real library media through every public decode/encode
surface and prints a ranked realtime-factor table — the optimization queue
and regression baseline for the all-codecs perf push.
feat(bench): cover ec-image decode (all sniffed formats) and ec-inflateAhmet Kaan Gümüş · 1ee915b
feat(bench): cover ec-image decode (all sniffed formats) and ec-inflate

Extends the harness with the two remaining tractable groups: ec-image's
single decode() entry point runs over every real still and fixture, and
ec-inflate is measured on the zlib stream a real PNG's own IDAT chain
already carries.
Merge branch 'lane-av1-fdct': FFT-based forward DCTAhmet Kaan Gümüş · 6fe6ddf
Merge branch 'lane-av1-fdct': FFT-based forward DCT

Makhoul DCT-II via FFT replaces the basis matmul in forward_transform_2d;
naive path kept as the test oracle. 4K 13-mode key frame 11.30s->8.52s,
suite wall 7.62s->5.43s; 16x16 keeps a small constant-overhead regression.
feat(bench): standing realtime-factor harness across every codec crateAhmet Kaan Gümüş · 4d8621c
feat(bench): standing realtime-factor harness across every codec crate

One new bin (tools/ec-bench) that drives each crate's own public one-shot
API against real media (h264/h265/av1 video, aac/mp3/opus/vorbis/flac/alac
audio via ec-probe's unified reader) and prints a ranked markdown table —
the baseline every future optimization lane measures against.
perf(av1): replace the forward DCT's matmul with an FFT factorizationAhmet Kaan Gümüş · 5bfacbb
perf(av1): replace the forward DCT's matmul with an FFT factorization

forward_transform_2d ran an O(n^2) dot product against a cached DCT-II
basis per row and column, on every RD trial. Replaced with Makhoul's
FFT-based DCT-II reduction (O(n log n)), with the twist table and FFT
stage twiddles precomputed per size and the 1D transform working on
fixed-size stack buffers -- both measured necessary; a first cut with
runtime cos/sin and heap Vec scratch was slower than the matmul it
replaced.

The old matmul is kept under #[cfg(test)] as the differential oracle
for a new fast_forward_matches_the_naive_matmul test. All existing
transform tests, including the quantizer roundtrip and 64x64 coded-
quarter tests, pass unchanged.
feat(av1): a quality/size targeting surface over base_q_idxAhmet Kaan Gümüş · a55d2ef
feat(av1): a quality/size targeting surface over base_q_idx

RateTarget::{QIndex,Quality,BytesPerFrame} on Av1Encoder::with_rate_target,
additive alongside the existing EncoderConfig::base_q_idx path. Quality
maps to base_q_idx via the calibration sweep's linear fit; BytesPerFrame
steers it with a clamped proportional controller (no accumulated debt, so
no windup class to bound). Calibration sweep test records the curve.
Merge branch 'lane-av1-msearch': whole-pel fast path in mc::predictAhmet Kaan Gümüş · a717fd8
Merge branch 'lane-av1-msearch': whole-pel fast path in mc::predict

Motion-search bucket 408.55ms->181.85ms, inter frame total 818.88ms->585.24ms
at 720p, bit-identical output (SUBPEL_FILTERS[0] is the exact identity kernel).
perf(av1): bypass sub-pel filtering for whole-pel motion predictionAhmet Kaan Gümüş · ef383d9
perf(av1): bypass sub-pel filtering for whole-pel motion prediction

Profiled the inter path (stage_timing_breakdown_inter, 720p GOP): 403 of a
408ms motion-search bucket was crate::mc::predict, almost entirely from the
search's own whole-pel log/diamond stage. SUBPEL_FILTERS[0] is the identity
tap and both rounding shifts are exactly that filter's gain, so the two
8-tap passes reproduce the reference sample byte-for-byte at zero fraction
(integer_mv_is_identity already pinned this) -- a clamped direct copy is
bit-identical, not an approximation. Motion search bucket 408.55ms ->
181.85ms, frame total 818.88ms -> 585.24ms, same 997 output bytes.
Merge branch 'lane-av1-regr2': the real-content gate now covers a straddle sizeAhmet Kaan Gümüş · f44b458
Merge branch 'lane-av1-regr2': the real-content gate now covers a straddle size

A sibling of the standing quality gate at 704x400 -- height mod 32 is
16, so every inter frame splits its bottom superblock row into the
16x16 NEARESTMV leaves that landed in e19bb47 (probed live: 22 splits
a frame). Eight real frames must decode through dav1d, hold 44.98 dB
mean luma PSNR and 62703 bytes (measured 45.48 dB / 54525 bytes,
2026-08-27, same margins as the aligned sibling).
test(av1): exercise the 16x16 straddle-leaf inter path on real contentAhmet Kaan Gümüş · cdf3858
test(av1): exercise the 16x16 straddle-leaf inter path on real content

real_clip_encodes_within_its_quality_and_size_budget uses 640x384 (both
axes 32-aligned), so Quadrant::Split never fires and the e19bb47
NEARESTMV leaf path was untouched by real, mixed intra/inter content.
Add a sibling at 704x400 (400 mod 32 == 16, the exactly-half straddle
class), same three gates: dav1d decodes every frame, mean luma PSNR
floor, byte ceiling.
Merge branch 'lane-av1-ileaf': real inter coding for 16x16 straddle leavesAhmet Kaan Gümüş · 3ac79d5
Merge branch 'lane-av1-ileaf': real inter coding for 16x16 straddle leaves

An inter frame whose true size straddles a 32x32 boundary at exactly
half used to code the whole straddling row intra. Its 16x16 leaves now
weigh NEARESTMV against intra like any other block. Underneath: the mv
stack gains spec 7.10.2.4's extended row/col scan -- invisible at 8-mi
geometry only because coverage from the immediate scan suppresses it,
so coverage must advance from ANY coded neighbour, intra included
(three no-op differential tests pin that), and the mi grid now records
intra cells, which it previously left indistinguishable from uncoded.
Straddle sequences round-trip bit-exact through dav1d with the leaves
live; 32-aligned streams are untouched.
fix(av1): mvstack extended row/col scan, intra-aware coverage; enable 16x16 inter leavesAhmet Kaan Gümüş · b26ee9f
fix(av1): mvstack extended row/col scan, intra-aware coverage; enable 16x16 inter leaves

Ports spec 7.10.2.4's extended row/col scan (libaom scan_row_mbmi/
scan_col_mbmi's idx=2..MVREF_ROW_COLS positions), invisible at pure
8-mi geometry because the immediate scan's own processed_rows/cols
coverage already reaches as far -- but only once that coverage counts
every *coded* neighbour cell, intra or inter, the way libaom's
processed_rows update sits outside add_ref_mv_candidate's ref-frame
match. The straddle-test attempt this round started from computed
coverage only from ref-matching (inter) cells, so an intra neighbour
above an 8-mi query silently un-suppressed the extended scan -- a real
8-mi behavior change, caught by two new differential tests
(extended_{row,col}_scan_is_a_no_op_at_8mi_geometry_even_behind_an_intra_neighbour)
that place a distinctively-MV'd tracer candidate at the extended
offsets and assert it never gets picked up. MiGrid now records intra
cells (encode.rs/tile.rs's else branches) so mvstack sees them.

With the no-op proven, lifts the `false &&` gate on 16x16-leaf
NEARESTMV (encode.rs:1231, wired r1, gated since dead code never
touched write_inter_frame_leaf's real symbol chain): full suite
130+3 new = 133/0/9, straddle and real_clip both green with the gate
live. The 640x384 real-clip fixture tiles exactly into 32x32
quadrants (no true-edge straddle), so its numbers are unchanged
(45.41 dB / 69861 bytes) -- the gate's leaf path is unexercised there;
the straddle test is what proves it live.
feat(av1): wire NEARESTMV inter coding for 16x16 straddle leaves, gated offAhmet Kaan Gümüş · cac7aab
feat(av1): wire NEARESTMV inter coding for 16x16 straddle leaves, gated off

Adds the full machinery for real inter coding of the 16x16 leaves a
half-straddling 32x32 inter-frame quadrant splits into: a Luma16Inter
TxbSet/CDF table (reduced_tx_set forces the same two-symbol DCT_IDTX set
16x16 already shares the shape of with Luma32Inter), a leaf writer
(write_inter_frame_leaf) that codes is_inter/single_ref/mv-stack/DRL/mv at
this leaf's own 4x4-mi window, and an encode-side NEARESTMV-vs-intra cost
comparison (code_square_inter) with matching per-leaf MvStack/grid updates.

The NEARESTMV selection itself is left gated off (`false &&`, corner-cut
comment at the site) -- enabling it desyncs the decoder ("Invalid data
found") on the existing straddle round-trip test, not yet isolated within
this round's budget. Confirmed via a false/true toggle that the desync is
in the new is_inter leaf path, not in the reduced_tx_set frame-header flag
(that alone round-trips clean). Gate: cargo test -p ec-av1 --release ==
130 passed, 9 ignored, 0 failed (same as baseline).
Merge branch 'lane-tmpsweep': close out the shared-temp-path race classAhmet Kaan Gümüş · 4114098
Merge branch 'lane-tmpsweep': close out the shared-temp-path race class

Repo-wide audit of every process::id()-keyed temp path after 9b60697:
ec-h264's ffmpeg_decode and x264_encode_qp keyed theirs by stream
length and qp value -- six and two concurrent tests respectively could
collide on the same name -- and now carry a per-call sequence number.
The twelve other sites are safe by construction: a single test per
binary, or a distinct literal name per caller.
fix(h264): key ffmpeg/x264 scratch files per call, not per processAhmet Kaan Gümüş · 3c9d243
fix(h264): key ffmpeg/x264 scratch files per call, not per process

ffmpeg_decode and x264_encode_qp named their temp files by process id
plus stream length / qp alone. Both helpers are called from several
#[test] functions that cargo test runs on parallel threads, so two
concurrent calls with the same stream length or qp shared a path -- one
call's cleanup (remove_file) could delete a file another call's ffmpeg
child was still reading. An atomic per-call sequence number now makes
every path distinct, matching the ec-av1 fix in 9b60697.

Audited every other process::id()-keyed temp path in the repo
(ec-flac, ec-opus, ec-ogg, ec-mp3, ec-vorbis, ec-alac, ec-h265,
ec-probe, ec-truehd): each is either called from a single #[test] in
its binary or discriminated by a unique literal/tag per caller, so none
of those share a path across concurrent tests.
fix(av1): key the probe stream's temp file per call, not per processAhmet Kaan Gümüş · f9d5fb9
fix(av1): key the probe stream's temp file per call, not per process

ffprobe_size named its temp file by process id alone, so every test in
the binary shared one path; a parallel test's cleanup could delete the
stream another test's ffprobe was mid-read on. This was the recurring
first-run gate flake (127/2 after 3cb60f6, 128/1 after 78fc36c) -- an
atomic counter now makes each call's path distinct.
Merge branch 'lane-av1-regr': a standing real-content quality gateAhmet Kaan Gümüş · 417cf64
Merge branch 'lane-av1-regr': a standing real-content quality gate

Twelve frames of a real 1080p H.264 fixture clip, scaled to 640x384 and
encoded at q100, must decode back through dav1d, hold a 44.91 dB mean
luma PSNR floor and a 80340-byte ceiling (measured 45.41 dB / 69861
bytes, 2026-08-27, margins -0.5 dB / x1.15). Runs in the suite proper --
2.2 s -- so a quality or compatibility regression fails in-repo instead
of surfacing in a downstream export.
test(av1): standing real-content regression gate on encode.rsAhmet Kaan Gümüş · 7b73e56
test(av1): standing real-content regression gate on encode.rs

Two recent regressions (a padded-size inter FrameHeader dav1d rejected;
a 1280x720 export refusal) were only caught by a downstream repo's
gate. real_clip_encodes_within_its_quality_and_size_budget encodes 12
frames of a real 1080p H.264 fixture clip, scaled to 640x384, and
asserts dav1d decodes every frame, mean luma PSNR stays within 0.5 dB
of the measured 45.41 dB, and the stream stays within 15% of the
measured 69861 bytes.
Merge branch 'lane-av1-mot2': SAD-prescreen the inter path's intra candidatesAhmet Kaan Gümüş · dda53a8
Merge branch 'lane-av1-mot2': SAD-prescreen the inter path's intra candidates

search_inter_block now ranks its 13 intra candidates by SAD plus mode
cost and full-RD-trials only the top K, DC always kept -- the same
prescreen the key-frame path carries, wired through its own knob
(EC_AV1_PRUNE_K_INTER / INTER_PRUNE_TOP_K). Here it ships ON at K=3:
a 3-clip x 2-quantizer real-content sweep puts the worst cell at
-0.011 dB and +0.15% bytes, and a 24-frame 720p GOP drops from 807 to
556 ms a frame. The key-frame default stays unpruned; forcing K>=13
reproduces the old stream byte for byte.
feat(av1): SAD-prescreen search_inter_block's intra loop, default K=3Ahmet Kaan Gümüş · 1120e46
feat(av1): SAD-prescreen search_inter_block's intra loop, default K=3

search_inter_block ran every one of the 13 intra candidates through a
full RD trial (forward transform, quantize, reconstruct, coeff_bits)
even though NEWMV/NEARESTMV usually wins on an inter block. Wire the
same SAD-prescreen rule search_block already uses (DC always kept,
cheapest top_k by SAD-plus-mode-cost) into this loop via a new
Plane::intra_scores + shared prune_by_sad, gated by its own
Search::top_k default (INTER_PRUNE_TOP_K, env EC_AV1_PRUNE_K_INTER) so
the key-frame path's default stays untouched.

Real-clip sweep (prune_k_quality_sweep_inter: 3 clips, q 60/150, K in
{3,4,6}) clears the same PSNR/bytes rule for every K tried (worst
-0.011dB / +0.147% bytes), so K=3 -- the cheapest -- ships as the new
inter-path default. sequence_bench_sanity: 807ms/frame -> 556ms/frame
at K=3 (-31%), 73622 -> 73759 bytes (+0.19%). top_k forced unpruned
reproduces byte-identical output vs the pre-change build (73622 bytes
both).
Merge branch 'lane-av1-mot': stop repricing an inter block's chroma trial 13xAhmet Kaan Gümüş · 348639c
Merge branch 'lane-av1-mot': stop repricing an inter block's chroma trial 13x

The intra-candidate loop inside search_inter_block recomputed the u/v
chroma Trial -- always DC_PRED, independent of the luma mode -- on all
13 iterations. One computation, cloned. Bit-identical (probe frame's
bytes unchanged), and a 24-frame 720p GOP drops 994.5 -> 797.0 ms/frame.
A stage_timing_breakdown_inter probe now attributes inter-frame time;
the remaining big bucket is the same loop's 13 full luma RD trials.
perf(av1): stop repricing an inter block's chroma trial 13 times overAhmet Kaan Gümüş · cc09bf2
perf(av1): stop repricing an inter block's chroma trial 13 times over

An inter frame's intra-candidate loop in search_inter_block always coded
both chroma planes as DC_PRED, independent of which of the 13 luma modes
the loop was on -- so the identical transform/quantize/coeff_bits call
ran twelve times for nothing on every inter block. Hoist it out of the
loop and clone the one result in (bit-identical: same call, same inputs,
same output, verified by the full 129-test suite and an equal output
byte count on the stage_timing_breakdown_inter probe, 1356 bytes before
and after).

Also add stage_timing_breakdown_inter, an #[ignore]d probe that breaks
one inter frame's time into motion search / mc::predict / transform+
quantize / coeff_bits buckets, which is how this was found: transform+
quantize was the largest bucket (454.78ms of 980.36ms), not motion
search (267.26ms, of which 257.01ms is genuine sub-pel interpolation
work already spent inside the diamond search).

1280x720 inter frame: 980.36ms -> 772.05ms (-21%).
Merge branch 'lane-av1-perf2': an opt-in SAD prescreen for the intra mode searchAhmet Kaan Gümüş · 091129f
Merge branch 'lane-av1-perf2': an opt-in SAD prescreen for the intra mode search

Modes rank by SAD-on-residual plus a rate term and only the top K
(DC always kept) pay the full RD trial: 2.5x at K=3 on the key-frame
stage, every real-clip PSNR delta under 0.05 dB. Default stays the
full 13-mode search -- bytes rise up to 0.7% pruned, and a 24-frame
720p GOP bench shows inter frames hide the win anyway (23.9s -> 23.4s):
export time lives in motion search, which this does not touch.
EC_AV1_PRUNE_K opts in; K=6 is the best of the swept tradeoffs.
test(av1): add prune_k quality sweep + 24-frame 720p sequence sanity probesAhmet Kaan Gümüş · 6c0d621
test(av1): add prune_k quality sweep + 24-frame 720p sequence sanity probes

In-process thread_local override lets prune_k_quality_sweep compare
Search::top_k pruned vs unpruned in one build without env-var races
(#![forbid(unsafe_code)] rules out std::env::set_var here). Both stay
#[ignore] perf/quality probes, not gates -- numbers reported in the
lane report.
perf(av1): SAD-prescreen the 13-mode intra search, gated off by defaultAhmet Kaan Gümüş · 7f9b971
perf(av1): SAD-prescreen the 13-mode intra search, gated off by default

search_block now predicts every mode once (unchanged cost) and ranks by
a cheap SAD-plus-mode-bits pre-pass before spending the full RD trial
(forward transform, quantize, reconstruct, coeff_bits) on the winners;
Search::top_k picks how many survive plus DC, always. Default stays
None (all 13 modes, byte-identical output, 129/0/5 green) until the
quality gate sweep in the lane report picks a K to ship as default.
Merge branch 'lane-av1-perf': cache the DCT basis; the sweep gains four edge sizesAhmet Kaan Gümüş · 2e9837a
Merge branch 'lane-av1-perf': cache the DCT basis; the sweep gains four edge sizes

forward_and_quantize recomputed side^2 cosines on every mode trial;
a OnceLock-cached basis plus contiguous dot-product passes (same
summation order, bit-identical output) takes a 1080p key frame from
3.97s to 1.78s and 3840x2160 from 10.6s to 7.1s. The own-size sweep
now covers 64x56 (historical V-plane bug confirmed closed), 854x480,
216x96 and 192x120; the never-written high-precision-mv CDF fields
are gone.
style(av1): cargo fmtAhmet Kaan Gümüş · 8593d36
style(av1): cargo fmt

cargo test -p ec-av1 --release: 129 passed, 0 failed, 5 ignored.
perf(av1): cache the forward DCT basis; make it contiguous, both bit-exactAhmet Kaan Gümüş · 91b85b5
perf(av1): cache the forward DCT basis; make it contiguous, both bit-exact

Added stage_timing_breakdown (a perf probe, #[ignore]d like the existing
sweeps): 1920x1080 13-mode key frame was 3.97s. forward_and_quantize alone
was 32.25us/call at 32x32, more than inverse+entropy combined -- because
dct_basis() recomputed side*side cosines from scratch on every single
mode trial, size-invariant work redone thousands of times a frame.

Two levers, both exact (same summation order, so identical bits out):
- dct_basis is now built once per transform size and cached (OnceLock),
  not recomputed per trial.
- forward_transform_2d's two matrix passes are written as contiguous
  dot products (row of residual/basis, then a transposed row pass)
  instead of one strided index loop, so the optimizer can vectorize them.

forward_and_quantize: 32.25us -> 15.38us per 32x32 call.
1920x1080 13-mode key frame: 3.97s -> 1.78s (2.2x).
3840x2160: 10.60s -> 7.08s (1.5x).

cargo test -p ec-av1 --release: 129 passed, 0 failed, 5 ignored (the new
probe). All streams stay byte-identical to their own reconstruction.
test(av1): widen the own-size sweep; close hp-mv dead codeAhmet Kaan Gümüş · 1457eaa
test(av1): widen the own-size sweep; close hp-mv dead code

64x56 now round-trips clean through ffmpeg (its historical wrong-V-plane
bug is closed by later MC/edge fixes) -- added alongside 854x480,
216x96, 192x120 to the existing own-size sweep, all green.

Dropped MvComponentCdfs::class0_hp/hp: this encoder always sets
allow_high_precision_mv=false, so the spec syntax that reads them
(mv_class0_hp/mv_hp) never fires -- genuinely dead, not staged.

cargo test -p ec-av1 --release: 129 passed, 0 failed, 4 ignored.
Merge branch 'lane-av1-interedge': inter frames split edge-straddling quadrants like key framesAhmet Kaan Gümüş · 0e70b27
Merge branch 'lane-av1-interedge': inter frames split edge-straddling quadrants like key frames

A 32x32 inter quadrant straddling the true frame edge at or past
halfway now splits into filtered 16x16 leaves (coded intra, matching
the key-frame writer's only 16x16 path) instead of refusing the whole
export; 1280x720 -- 720 mod 32 = 16 -- is exactly this case. The
genuine gap keeps its refusal with an accurate message and a test on
both writers: an edge strictly before halfway of a 16x16 leaf needs
the rectangular-transform path this encoder does not have.
fix(av1): inter tile writer codes a true-edge-straddling 32x32 quadrantAhmet Kaan Gümüş · cdfc846
fix(av1): inter tile writer codes a true-edge-straddling 32x32 quadrant

sb_coeff_inter_frame_tile refused every straddling 32x32 quadrant
outright, with a message claiming an 8x8 split it never actually
needs for the common edge-at-or-past-halfway case (e.g. 1280x720,
where 720 mod 32 == 16). Ported the key-frame writer's Quadrant::Split
handling: such a quadrant now splits into up to four 16x16 leaves,
coded through the inter frame's intra branch (no Luma16Inter tx_type
table exists for a genuine inter leaf at that size, and these leaves
only fill the true edge's sliver of real content). The genuine
"strictly before half of a 16x16" class -- which does need a
rectangular transform -- still refuses, with an accurate message.

sb_coeff_inter_frame_tile's `blocks` parameter is now `&[Quadrant]`
(reusing the key-frame writer's own type) instead of `&[BlockCoeffs]`;
encode_inter_frame's search does the matching split, reusing
code_square for the 16x16 leaves.
Merge branch 'lane-av1-truesize': write the true frame size, reconstruct it like a decoderAhmet Kaan Gümüş · 5a60e3d
Merge branch 'lane-av1-truesize': write the true frame size, reconstruct it like a decoder

AV1 streams now declare the true display size as frame_width/height
(mi dims from 2*((w+7)>>3)) instead of a 32-aligned padded size with a
render_size hint players ignore. Everything the padded convention hid
had to be fixed to survive it: per-level partition legality with
gathered split bools, DC-sign/skip contexts gathered per 4x4 unit with
true-edge zeroing (chroma at its own subsampled edge), intra reference
reads clamped to the true bound with spec replication (dc() included),
partial-superblock signaling in the inter tile writer, inter frame
headers on the true size, and motion compensation clamping reads to
the true extent instead of the encoder's own padding. Gate 127/0/4;
854x480 and other off-grid sizes round-trip bit-exact through
ffmpeg/dav1d at their own size.