forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 214cdf2befd543569feaaaf45888fe80e40318df

2026-08-28

feat(av1): read compound DRL + assign compound MVs, still refuse before MCAhmet Kaan Gümüş · 214cdf2
feat(av1): read compound DRL + assign compound MVs, still refuse before MC

find_mv_stack_compound + read_inter_compound_mode now mirrored into
decode_inter_block8's compound arm (task a). A new assign_compound_mv
helper ports libaom decodemv.c's compound read_drl_idx branches and
assign_mv's compound modes (NEAREST_NEARESTMV..NEW_NEWMV) verbatim,
shared by both decode_inter_block and decode_inter_block8 (tasks b/c).
Both paths still refuse right after the MV pair is assigned -- two-
reference motion compensation (COMPOUND_AVERAGE/dist-wtd averaging in
the CONV_BUF domain, not pixel domain) is not wired yet.
feat(av1): read inter_compound_mode past comp_ref, still refuse MCAhmet Kaan Gümüş · cadc399
feat(av1): read inter_compound_mode past comp_ref, still refuse MC

Ports libaom's default_inter_compound_mode_cdf + compound_mode_ctx_map
(entropymode.c / mvref_common.h) and wires read_inter_compound_mode
into decode_inter_block's COMPOUND_REFERENCE arm: once comp_mode/
comp_ref name the reference pair, find_mv_stack_compound now builds
the real compound mvstack (with CompoundTplArgs when tpl_frame is
live) and the block reads its own compound_mode symbol before still
refusing by name -- compound DRL, MV assignment, and two-reference MC
remain unwired. decode_inter_block8's 8x8-leaf arm is untouched (still
refuses at comp_ref). New COMPOUND_MODE_HITS counter (compound_mode_hits())
mirrors COMP_MODE_HITS for a future firing gate.
feat(av1): wire comp_mode/comp_ref reads into both inter-block decodersAhmet Kaan Gümüş · 14ea0a6
feat(av1): wire comp_mode/comp_ref reads into both inter-block decoders

reference_select now threads from the frame header through
decode_inter_frame_tile(_with_cdfs) into decode_inter_block and
decode_inter_block8: when set, each inter block reads comp_mode (spec
5.11.25) first and, on COMPOUND_REFERENCE, reads comp_ref_type/
comp_ref/comp_bwdref via read_compound_ref_frames before refusing the
block by name -- two-reference motion compensation is not wired yet.
This keeps the arithmetic decoder in sync for reference_select streams
that never actually pick compound, and replaces the old blanket
frame-level reference_select refusal with a comp_mode-count-verified
per-block one. skip_mode_present (a separate header bit) gets its own
frame-level refusal since no block-level reader for it exists yet.

Added COMP_MODE_HITS/comp_mode_hits() and a real-aomenc gate
(a_real_aomenc_stream_with_reference_select_reads_comp_mode_correctly)
proving both outcomes: a fully-decoded reference_select stream that
never fired compound, or a refusal that names COMPOUND_REFERENCE with
comp_mode_hits having advanced. Live run: every aomenc attempt in this
recipe hit skip_mode_present or allow_screen_content_tools first (both
separate unimplemented capabilities), so comp_mode itself has not yet
fired live -- next round needs a recipe/attempt-count that clears both
before reaching a bidirectional-reference block.
feat(av1): port comp_mode + compound ref-pair reads, not yet wiredAhmet Kaan Gümüş · a75a2e1
feat(av1): port comp_mode + compound ref-pair reads, not yet wired

read_comp_mode (spec 5.11.25 comp_mode) and read_compound_ref_frames
(comp_reference_type + uni_comp_ref/comp_ref/comp_bwdref trees) mirror
libaom decodemv.c's read_ref_frames compound arm bit-for-bit. Audited
every libaom pred_common.c compound context function against the
existing single_ref_p1..p6_ctx/uni_comp_ref_p1_ctx helpers: each one
(uni_comp_ref_p/p2, comp_ref_p/p1/p2, comp_bwdref_p/p1) is the same
vote-the-neighbours shape under a different libaom name, so no new
context function was needed.

Not yet called from decode_inter_block/decode_inter_block8 -- the
frame-level reference_select refusal in stream.rs still gates every
caller, so this is dead code today (#[allow(dead_code)]), kept
compiling and reviewable for the round that wires it into the block
decode path and adds the inter_compound_mode/DRL/MV/MC chain.
fix(av1): port libaom's real compound mvstack tpl fold-in and combine dedupAhmet Kaan Gümüş · ac83457
fix(av1): port libaom's real compound mvstack tpl fold-in and combine dedup

find_mv_stack_compound carried two documented conservative deviations from
libaom's mvref_common.c: the temporal add_tpl_ref_mv fold-in dropped a
compound candidate when the crate's own re-lookup happened to fail one side
independently, instead of zero-filling; and the extension-pass combine step
ran every candidate through the ordinary weight-bump dedup instead of
libaom's real is_dup check (setup_ref_mv_list ~735-754: exactly one new
entry when the stack already has one, comparing only comp_list[0] against
it and taking comp_list[1] on a match; both entries appended unconditionally,
un-deduped, when the stack is empty).

Both are now exact ports (mvref_common.c:341-433, 692-762), with
compound_dedupes_same_pair_and_sums_weight updated to the real two-entries-
unmerged outcome the is_dup port actually produces. cargo test --release -p
ec-av1 --lib: 205 passed / 0 failed / 16 ignored.
WIP(av1): compound mvstack candidate machinery, not yet wiredAhmet Kaan Gümüş · 368413c
WIP(av1): compound mvstack candidate machinery, not yet wired

find_mv_stack_compound: parallel entry point to find_mv_stack_with_sign_bias
for a block predicted against a reference-frame pair (spec 7.10.2's
is_compound path). Adds:
- MiInfo.mv1 (the compound second MV, paired with r3's ref_frame1)
- scan_row_compound/scan_col_compound/scan_top_right_compound/
  scan_corner_compound: exact-pair-matched twins of the single-ref scans
- process_compound_ref_mv_candidate + CompoundRefLists +
  combine_compound_candidates: the compound extension/topping pass
  (mvref_common.c's process_compound_ref_mv_candidate + the combine step)
- CompoundTplArgs: compound temporal-MV fold-in, reusing motion_field's
  existing single-ref add_tpl_ref_mv once per side of the pair
- new_mv_ctx/ref_mv_ctx reuse the existing (nearest_match, ref_match_count)
  switch, which libaom's own mode_context switch is ref-count-agnostic about

Documented deviations: tpl compound candidates drop (not zero-fill) a
missing side; the extension combine step dedups by weight-bump instead of
libaom's real is_dup skip-on-first-match. Both noted in find_mv_stack_compound's
doc for a later round to tighten if a live compound gate's drl_ctx disagrees.

Every existing single-reference caller (find_mv_stack/
find_mv_stack_with_sign_bias and their 23 pre-existing tests) is untouched;
this is purely additive, unwired code, same pattern as r1/r3. 6 new tests,
cargo test --release -p ec-av1 --lib: 205 passed / 0 failed / 16 ignored.
WIP(av1): carry a compound second reference through MiInfo/NeighboursAhmet Kaan Gümüş · cfa1e23
WIP(av1): carry a compound second reference through MiInfo/Neighbours

Step 1 of the compound-decode chain (lane-av1comp): MiInfo grows
ref_frame1: Option<i8> (spec RefFrames[1]) and decode.rs's Neighbours
grows above_ref1/left_ref1 alongside above_ref/left_ref, mirroring the
existing i8 single-ref tracking. Every one of the 24 MiInfo literal
sites across decode.rs/encode.rs/mvstack.rs/tile.rs sets it to None --
no decode or encode path here ever produces a compound block yet, so
this is pure plumbing: find_mv_stack's scan still matches candidates
on ref_frame alone, and reference_mode_ctx/comp_reference_type_ctx
(landed r1, 1fcb059) still have no caller.

Next: read_ref_frames replacing stream.rs:181-195's reference_select
refusal (decodemv.c:966-990/1000+, is_comp_ref_allowed blockd.h:65-67),
then inter_compound_mode CDF/tree + compound DRL, then mvstack's dual-
ref candidate scan (process_compound_ref_mv_candidate,
mvref_common.c:435-455/696-762 -- the largest remaining piece), then
the COMPOUND_AVERAGE/dist_wtd_comp_avg MC blend. See the lane-av1comp
ledger entries for the full ordered plan.
WIP(av1): compound-reference symbol-reading CDFs and contexts, not yet wiredAhmet Kaan Gümüş · 651448b
WIP(av1): compound-reference symbol-reading CDFs and contexts, not yet wired

Spec 5.11.25's read_ref_frames compound path (comp_mode, comp_reference_type,
uni_comp_ref/comp_ref/comp_bwdref trees) needs five new default-CDF tables
(cdf::COMP_MODE/COMP_REF_TYPE/UNI_COMP_REF/COMP_REF/COMP_BWDREF, ported from
libaom entropymode.c) plus their adaptation state (cdf_state.rs), and two new
context functions (mvstack::reference_mode_ctx/comp_reference_type_ctx,
libaom's av1_get_reference_mode_context/av1_get_comp_reference_type_context)
unit-tested against hand-derived cases matching libaom's branch tables. The
comp_ref*/comp_bwdref* trees reuse the existing single_ref_p2/p3/p4/p5/p6
context shape (ref_ctx) since libaom's own functions are literally aliases of
the single-ref ones; only uni_comp_ref_p1 needed a new vote set.

Not yet wired to decode_inter_block or stream.rs's reference_select refusal:
that needs Neighbours to carry per-cell compound state (today every decoded
neighbour is proven single-ref, so NeighbourRef is exercised only by its unit
tests), and reading comp_mode/comp_ref_type still dead-ends at "decode this
compound block" with no inter_compound_mode CDF, no compound DRL, no mvstack
dual-ref scan, and no distance-weighted MC blend behind it -- porting comp_mode
reading alone without that chain would trade one frame-level refusal for an
identical per-block one, with no stream this decoder can actually finish.
Left as tested, reviewable infrastructure for the next round; see ledger
lane-av1comp entries for the precise next steps and libaom line references.
Merge branch 'lane-av1tmvp'Ahmet Kaan Gümüş · 1229793Browse files
wip(av1): temporal MV projection math (spec 7.9/7.10.2.8), not yet wiredAhmet Kaan Gümüş · 916263c
wip(av1): temporal MV projection math (spec 7.9/7.10.2.8), not yet wired

New crate::motion_field module: MotionField (per-frame saved 8x8 MV grid
+ order-hint bookkeeping), setup_motion_field (av1_setup_motion_field's
LAST/BWDREF/ALTREF2/ALTREF/LAST2 selection + motion_field_projection's
distance-scaled projection into a TplField), and add_tpl_ref_mv (the
per-query-block second projection). All ported from libaom
av1/common/mvref_common.c, unit-tested against hand-checked distance/
projection arithmetic.

mvstack::find_mv_stack_with_sign_bias gains an Option<TplArgs> parameter:
when Some, folds temporal candidates into the stack at libaom's real
insertion point (after the row/col/top-right REF_CAT_LEVEL boost, before
the corner probe) and derives zero_mv_ctx (GLOBALMV_OFFSET) from them;
None (every existing caller today) reproduces the prior always-0 exact
behaviour bit for bit -- all 13 existing mvstack unit tests still pass
unmodified.

NOT DONE: decode_inter_block's only call site still passes tpl: None
(see its own TODO), and nothing in decode_inter_frame_tile_with_cdfs or
stream::decode_stream builds a per-DPB-slot MotionField or calls
setup_motion_field -- so decode::tmv_hits() reads 0 against any real
stream, and no temporal-MV gate exists yet. See ledger DELTA for the
precise remaining wiring.
Merge branch 'lane-av1refs'Ahmet Kaan Gümüş · 2bcbc81Browse files
feat(av1): pixel-exact single-ref decode for LAST2/LAST3/BWDREF/ALTREF2/ALTREFAhmet Kaan Gümüş · 1719c8e
feat(av1): pixel-exact single-ref decode for LAST2/LAST3/BWDREF/ALTREF2/ALTREF

Adds per-reference hit counters (decode::ref_hits) so a gate can prove the
SPECIFIC reference it targets fired, not just non_last_ref_hits. Adds 5
targeted real-aomenc gates (dropping the golden gate's own
--max-reference-frames=3/--reduced-reference-set=1 narrowing, which
suppresses exactly these references; backward refs additionally need
--auto-alt-ref=1/--lag-in-frames for aomenc to code them at all). All 5
decode pixel-exact against ffmpeg across 3 repeated runs (15/15), proving
the WIP's sign_bias threading for BWDREF/ALTREF2/ALTREF is correct.

Also cherry-picks b650420 (--enable-ref-frame-mvs=0 swept into every
recipe) and a668c49 (film-grain gate pinned below the same fix) from
main, which this branch had forked before -- fixes the 3 real-aomenc
gates that were failing on the WIP alone.
fix(av1): pin the film-grain gate below use_ref_frame_mvs's unimplemented pathAhmet Kaan Gümüş · 25e8a4f
fix(av1): pin the film-grain gate below use_ref_frame_mvs's unimplemented path

real_aomenc_film_grain_streams_decode_pixel_exact's frame-1 mismatch was
never a grain bug: aomenc turns on temporal MV projection
(use_ref_frame_mvs) by default once order hints are enabled, and
mvstack.rs's documented corner-cut always computes zero_mv_ctx and the
mode-context GLOBALMV_OFFSET bit as if it were off, desyncing the symbol
stream from the first NEARESTMV block that inherits a temporal-adjusted
context. Add --enable-ref-frame-mvs=0 alongside this gate's other
disabled features so it isolates grain synthesis as its own comment
already claims, matching every real-aomenc gate's envelope pattern.
Temporal MV projection stays a separate, unimplemented capability.
fix(av1): sweep --enable-ref-frame-mvs=0 into every aomenc test recipeAhmet Kaan Gümüş · 6836b28
fix(av1): sweep --enable-ref-frame-mvs=0 into every aomenc test recipe

use_ref_frame_mvs (temporal MV projection) is unimplemented; mvstack
computes zero_mv_ctx/GLOBALMV_OFFSET as if it were off, so any real
aomenc stream with it enabled desyncs the symbol decoder on inter
frames. The film-grain gate hit this (frame-1 luma mismatch pinned to
this, grain falsified); the remaining 7 aomenc recipes carried the same
latent flake and are now pinned inside the supported envelope. The
ffmpeg single-frame helper is keyframe-only and unaffected.
fix(av1): sweep --enable-ref-frame-mvs=0 into every aomenc test recipeAhmet Kaan Gümüş · eb24ce5
fix(av1): sweep --enable-ref-frame-mvs=0 into every aomenc test recipe

use_ref_frame_mvs (temporal MV projection) is unimplemented; mvstack
computes zero_mv_ctx/GLOBALMV_OFFSET as if it were off, so any real
aomenc stream with it enabled desyncs the symbol decoder on inter
frames. The film-grain gate hit this (frame-1 luma mismatch pinned to
this, grain falsified); the remaining 7 aomenc recipes carried the same
latent flake and are now pinned inside the supported envelope. The
ffmpeg single-frame helper is keyframe-only and unaffected.
Merge branch 'lane-grainfix'Ahmet Kaan Gümüş · 553118aBrowse files
fix(av1): pin the film-grain gate below use_ref_frame_mvs's unimplemented pathAhmet Kaan Gümüş · 07a8e46
fix(av1): pin the film-grain gate below use_ref_frame_mvs's unimplemented path

real_aomenc_film_grain_streams_decode_pixel_exact's frame-1 mismatch was
never a grain bug: aomenc turns on temporal MV projection
(use_ref_frame_mvs) by default once order hints are enabled, and
mvstack.rs's documented corner-cut always computes zero_mv_ctx and the
mode-context GLOBALMV_OFFSET bit as if it were off, desyncing the symbol
stream from the first NEARESTMV block that inherits a temporal-adjusted
context. Add --enable-ref-frame-mvs=0 alongside this gate's other
disabled features so it isolates grain synthesis as its own comment
already claims, matching every real-aomenc gate's envelope pattern.
Temporal MV projection stays a separate, unimplemented capability.
fix(av1): port libaom's exact single-ref MV stack extensionAhmet Kaan Gümüş · 81de048
fix(av1): port libaom's exact single-ref MV stack extension

Replace the hand-written GOLDEN-fix extension pass (mvref_common.c
reduction guessed by hand: gated on the 8-entry stack cap, flat
unconditional weight=2 adds) with an exact port of
process_single_ref_mv_candidate + setup_ref_mv_list's single-reference
extension: real gate is MAX_MV_REF_CANDIDATES (2, not 8), real reach
is the query block's own bw4/bh4 (not a flat 16), dedup/weight/
sign-bias now match libaom's function precisely.

Fixes the 3 real-clip encoder regressions the hand-written pass
caused (stack contents diverged from what a real decoder derives,
desyncing DRL/MV coding). All 3 pinned/hand-built golden tests still
green; full ec-av1 suite green (179 passed); forwarding gate 20/20
clean, 0 mismatches. Golden gate fires=0/20 live (aomenc's fixed
seeds never select GOLDEN_FRAME in this environment) -- GOLDEN arm
stays unmasked since the pinned fixtures and forwarding gate already
prove it correct; re-masking per the fires=0 contingency would break
those pinned tests, a direct conflict flagged rather than resolved
silently.
test(av1): drive the film-grain sweep with the repo aomenc and the supported-envelope recipeAhmet Kaan Gümüş · 4da5dbf
test(av1): drive the film-grain sweep with the repo aomenc and the supported-envelope recipe

The sweep probed bare `aomenc` on PATH (always absent) and so always
skipped; it now uses aomenc_path() like every other gate. The recipe
adopts the forwarding gate's constraint set so the streams stay inside
the decoder's supported envelope, with --tune-content=film as the one
flag under test. At 64x64 the streams now reach the GOLDEN_FRAME
refusal on this branch; the test goes green once the mvstack
extension-pass fix (lane-av1golden8) merges and unmasks GOLDEN.
feat(av1): implement spec 7.18.3 film grain synthesis, flip the refusalAhmet Kaan Gümüş · 84e41d9
feat(av1): implement spec 7.18.3 film grain synthesis, flip the refusal

Port the AR-filtered grain template generation, piecewise-linear scaling
LUT, and 32x32/16x16 tiled overlap-blend application from libaom's
reference synthesis (crates/ec-av1/src/film_grain.rs), wired into
decode_stream's frame-finalize path so the reference bank keeps the
clean pre-grain decode (spec 7.18.3.1) while only the caller's output
picture carries grain.

Header parsing (ec-av1-syntax FilmGrainParams, load_grain_params
ref-slot forwarding) was already spec-complete -- no changes needed
there.

Replaces the apply_grain refusal with a pixel-exact gate against
ffmpeg's own AV1 decoder on the pinned aomenc fixture (frame 0, the
span the original mismatch was traced to; later frames in that fixture
hit an unrelated pre-existing GOLDEN_FRAME MC gap, out of this lane's
scope), plus an aomenc multi-seed sweep gate that skips gracefully
when aomenc is unavailable.
fix(av1): re-mask GOLDEN_FRAME behind the LAST_FRAME refusal arm, pin round-9 residualAhmet Kaan Gümüş · 2e169ef
fix(av1): re-mask GOLDEN_FRAME behind the LAST_FRAME refusal arm, pin round-9 residual

Round 9's own forwarding gate still shows GOLDEN_FRAME motion compensation
mismatching a real aomenc stream once the film-grain refusal is in place
(1/20, frame 3 luma, apply_grain=false). Collapse the GOLDEN_FRAME arm back
into the single LAST_FRAME/_ refusal match so it refuses by name again, and
add an #[ignore]d pinned_golden7_stream_decodes_pixel_exact test (same shape
as golden4's) against the pinned repro fixture for round 10. Also drops the
debug-only probe_env_stream test.
fix(ec-aac): serialize sbr_real_library tests against a cross-test env-var raceAhmet Kaan Gümüş · a7e507d
fix(ec-aac): serialize sbr_real_library tests against a cross-test env-var race

Several tests in this binary steer our_decode via process-global env vars
(EC_AAC_SBR_HF_BYPASS, EC_AAC_SBR_SIDEINFO_DEBUG, EC_AAC_SBR_NOISE_ZERO/
_FRACTION), set then removed mid-test with no synchronization. Cargo runs
this binary's tests in parallel threads by default, so sbr_hf_window_band_probe
setting EC_AAC_SBR_HF_BYPASS could -- and, under full-suite contention, did --
flip HF reconstruction off mid-decode for sbr_real_library_matches_reference
running concurrently, collapsing its HF-band correlation and failing the
0.999 gate. A shared Mutex, held for each test's whole body, makes the
toggle window and any concurrent decode mutually exclusive.
fix(av1): gate switchable_interp neighbour ctx by ref_frame, keep GOLDEN_FRAME maskedAhmet Kaan Gümüş · 71a371f
fix(av1): gate switchable_interp neighbour ctx by ref_frame, keep GOLDEN_FRAME masked

resolve_interp_filter fed a block's above/left filter context straight
from Neighbours regardless of which reference frame each neighbour
coded -- a different-ref neighbour's filter choice was corrupting the
symbol read for this block's own filter, instead of reading as unset
([3,3], the same sentinel intra neighbours already produce). Gate both
above_filter and left_filter on above_ref/left_ref matching this
block's ref_frame.

Round 8's GOLDEN_FRAME unmask attempt with this ctx fix still produces
a real mismatch: a golden gate run 20x reproduces a frame-0 (intra
keyframe) luma diff against ffmpeg whenever GOLDEN_FRAME actually
fires later in the same stream (seeds 57, 59, both live-reproduced).
The ctx fix itself is not the cause -- decode_inter_block8 never
resolves switchable_interp context at all (it refuses non-LAST_FRAME
before reaching any filter code), so this bug is golden-adjacent
elsewhere, unproven past that. GOLDEN_FRAME stays a named refusal;
added the same EC_AV1_GATE_DUMP pin-on-mismatch pattern the CDF
forwarding gate already has to the golden gate test, and captured the
reproducing stream for the next round.
test(truehd): replace the noise gate's arbitrary <=100% target with a format-derived framing floorAhmet Kaan Gümüş · b0c2924
test(truehd): replace the noise gate's arbitrary <=100% target with a format-derived framing floor

The r3 restart/major-sync/params-elision rewrite (1b70839) passed all
3 ffmpeg oracle tests unmodified (tests/oracle.rs: ffmpeg_decodes_our_
encoder_bit_exact, externally_encoded_mlp_round_trips_bit_exact,
first_60_seconds_of_a_real_7_1_remux_are_bit_exact) -- mlpdec.c accepts
a stream that only restarts/majorsyncs on access unit 0 and elides
unchanged decoding params on every later one, so no encoder-side fix
was needed this round.

compression_ratio_gates' noise arm still can't hit <=100% for genuinely
incompressible content (100.9% measured, r3's ledger dead-end): this
format's own per-AU container framing (AU header + substream directory
entry + segment alignment, one-time major sync + restart header on AU
0) is a real, non-negotiable floor above raw PCM size, not a missed
optimization. The gate now asserts against that floor computed from
the literal field widths encode_access_unit writes (PER_AU_FRAMING_
FLOOR=8B/AU + FIRST_AU_EXTRA=51B one-time + 8B named rounding slack),
not an arbitrary percentage fitted to the observed byte count.
fix(truehd): Welch-window the LPC autocorrelation; carry FIR history across restarts; amortize restart/major-sync/decoding-params per AUAhmet Kaan Gümüş · 7e95468
fix(truehd): Welch-window the LPC autocorrelation; carry FIR history across restarts; amortize restart/major-sync/decoding-params per AU

Levinson-Durbin fit a rectangular-windowed autocorrelation, which is
measurably biased away from a signal's true poles at the window's own
edges (proven on a pure tone: order-2 fit landed near [1.88,-0.89]
against the analytic [1.99,-1] until windowed). Tapering the analysis
window with a Welch window before autocorrelation fixes the tonal
compression gate (65.9% -> under the 65% target).

decode.rs: read_restart_header no longer zeroes FIR/IIR filter state at
a restart header (ffmpeg's mlpdec.c never does either) -- only real
lossless round-trip bug found this round, independently verified.

encode.rs also now amortizes real per-AU overhead the format was
designed to amortize: only access unit 0 carries a restart header and
major sync (this crate's own decoder's restart_seen persists once set,
and a major sync's presence is autodetected per AU, not flagged), and
later AUs skip the whole decoding-params section when this AU's chosen
plan is identical to the last one actually written. This uncovered and
fixed a real encoder bug along the way: eliding the FIR gate whenever
order was 0 left a decoder's stale nonzero FIR order from the previous
AU applied to un-predicted residuals once restarts stopped resetting
it every AU -- the gate must always be written, since read_filter
always reads the order field itself and that's the only thing that
actually clears a filter.

WIP, not fully green: encoder_round_trips_through_our_own_decoder and
the tonal compression gate now pass; the noise (pure-LCG, incompressible)
gate still overshoots its <=100% target at 100.9% (116210 vs 115200
bytes) even after eliding the restart header, major sync and unchanged
decoding params -- the remaining ~1010 bytes is the format's own
mandatory per-AU framing (4-byte AU header + 2-byte substream directory
entry, unavoidable per AccessUnitHeader::parse), a real overhead floor
this format's own container carries on any AU regardless of content.
ffmpeg oracle tests (tests/oracle.rs) not rerun this round.

2026-08-27

fix(av1): clear apply_deblock for the GOLDEN residue, isolate to MCAhmet Kaan Gümüş · c672fef
fix(av1): clear apply_deblock for the GOLDEN residue, isolate to MC

Bisected the pinned 3-pixel GOLDEN-live residue against a patched
aomdec's pre/post-loop-filter frame dumps: our own decoder's luma is
already wrong at those exact 3 pixels before apply_deblock runs, byte-
identical to the loop filter's post-filter mismatch -- the wide
deblock kernel (round 6's suspect) is cleared. All 3 pixels sit inside
one skip=1 32x32 GOLDEN_FRAME NEWMV block, mv=(-7,-7) 1/8-pel (both
axes fraction 2/16), REGULAR/REGULAR resolved filter -- pure MC output,
no residual. The golden reference bytes that block reads are already
proven bit-exact (frames 0-2 match ffmpeg), so the defect is inside
mc::predict_with_filters's 2D convolution or filter-symbol resolution
for this exact combination, not yet isolated further this round.
Re-masked with an updated round-7 comment recording the bisect.
fix(av1): re-derive the GOLDEN_FRAME loop-filter residue, re-mask with a pinAhmet Kaan Gümüş · d02f017
fix(av1): re-derive the GOLDEN_FRAME loop-filter residue, re-mask with a pin

Un-masked decode_inter_block's GOLDEN_FRAME arm this round and re-ran the
forwarding + golden-reference gates: two real aomenc streams mismatched
(30-run forwarding gate: 4/30 real failures, all a real aomenc GOLDEN
stream, not the documented flake). Pinned one (seed 43, frame 3 luma) as
stream::tests::pinned_golden4_stream_decodes_pixel_exact (#[ignore]d) and
traced it: 3 of 4096 luma pixels off by exactly +-1, all inside the loop
filter's edge window at a GOLDEN_FRAME/LAST_FRAME block boundary. Hand-
checked lf_level's ref_deltas/mode_deltas arithmetic against spec 7.14.4
at that edge -- it matches the default table exactly, so the residue is
still open: a narrow deblock-kernel rounding defect, or a golden-side
pixel one filter tap upstream. Re-narrowed the mask (decode_inter_block's
GOLDEN_FRAME arm refuses by name again) and reverted
a_hand_built_golden_reference_refuses_by_name to its refusal-asserting
form -- no fix proven this round, but the pinned fixture and the
narrowed-down suspect (deblock edge, not lf_level's own math) carry
forward.
fix(av1): loop filter level must not forward from the primary ref frameAhmet Kaan Gümüş · 3024af4
fix(av1): loop filter level must not forward from the primary ref frame

read_loop_filter_params only re-reads loop_filter_level[2]/[3] (chroma)
when a luma level is nonzero (spec 5.9.11); the whole LoopFilterParams
struct -- including level/sharpness -- was being seeded from the primary
reference frame's saved params before that read, so a frame whose own
luma levels are both 0 kept the PREVIOUS frame's nonzero chroma level
instead of the spec's implicit 0. Spec 7.20's load_previous only
forwards ref_deltas/mode_deltas, never level/sharpness. Isolated with a
pinned mismatching stream (seed 47, frame 1 chroma vs ffmpeg): bisected
pre/post-deblock dumps to prove the loop filter kernel itself untouched
by the bug, then a level sweep on the exact failing pixel's 6-tap window
showed a threshold flip precisely between level<=2 (matches ffmpeg) and
level>=3 (our observed wrong output) -- our decoder computed level=8
(carried from frame 0's key frame header) where the true value is 0.

Adds an env-gated EC_AV1_GATE_DUMP pin to the forwarding gate test plus
an #[ignore]d fast-reproduce test reading that pinned stream.
fix(av1): GLOBALMV loop-filter mode delta; mask GOLDEN behind its stacked defectAhmet Kaan Gümüş · ef03524
fix(av1): GLOBALMV loop-filter mode delta; mask GOLDEN behind its stacked defect

lane-av1golden2 round 5. The round-4 GOLDEN flip's hand-built fixture
proved the symbol path and a whole-pel skip copy -- the first real aomenc
GOLDEN streams through the live arm mismatched. Symbol-trace vs a patched
aomdec isolated one cause on the LAST_FRAME-reachable side: lf_level
applied mode_deltas[1] to every inter block, but spec 7.14.4's mode_lf_lut
maps GLOBALMV to mode_deltas[0]. Fixed by packing the GLOBALMV bit into
ref_grid's sign; that moved the forwarding gate's failure from seed 42
frame 1 to seed 48 frame 3 -- at least one more stacked defect on the
GOLDEN-live path, so the GOLDEN arm narrows back to a named refusal
(threading kept, unread) and the hand-built fixture now asserts the mask
by name instead of pixel exactness. A rare (~1/10..1/30) all-LAST
mismatch on the forwarding gate remains reachable even with the mask --
present with semantics identical to the previously pushed baseline --
pinned as this lane's next round.
Merge branch 'lane-av1golden': GOLDEN references, proven by a hand-built streamAhmet Kaan Gümüş · 181baf7
Merge branch 'lane-av1golden': GOLDEN references, proven by a hand-built stream

A test-only fixture hand-encodes tile bytes with the crate's own
SymbolEncoder -- key frame, slot-splitting inter frame, then a block
whose single_ref tree walks out to GOLDEN and copies the keyframe --
and ffmpeg decodes the same wire bytes as the truth. The refusal flips
narrowly (GOLDEN only; the golden plane params turn out to have been
dead code under a doc comment that claimed otherwise), and the real
aomenc golden gate now passes on its own.
feat(av1): flip the GOLDEN_FRAME refusal, proven by a hand-built OBU fixtureAhmet Kaan Gümüş · 5fb6ee3
feat(av1): flip the GOLDEN_FRAME refusal, proven by a hand-built OBU fixture

120+ real aomenc attempts never produced a decodable stream that fired
GOLDEN_FRAME before hitting an unrelated refusal first. A hand-built
3-frame stream (real key frame; a hand-coded intra "different content"
frame refreshing LAST_FRAME's slot; a hand-coded frame whose lone block
codes single_ref out to GOLDEN_FRAME and a skip zero-MV NEARESTMV) drives
decode_stream directly and is cross-checked against ffmpeg's own decode
of the identical wire bytes, 4 consecutive runs. decode_inter_block now
threads GOLDEN_FRAME to the golden_y/u/v planes already passed to it
instead of refusing every non-LAST_FRAME reference; LAST2/LAST3/BWDREF/
ALTREF2/ALTREF still refuse, unproven. intra_inter_ctx made pub(crate)
so the fixture can compute the exact context the decoder does.
Merge branch 'lane-aacperf': the rate loop stops calling powfAhmet Kaan Gümüş · ec41fcd
Merge branch 'lane-aacperf': the rate loop stops calling powf

82% of encode time was libm powf inside the scalefactor search: a
lookup table for q^(4/3), sqrt-composed x^0.75, and bisection over the
already-monotonic noise walk take the bench row from 3.5x to 37.8x
realtime with every quality test green. Also fixes the oracle test's
esds parser, which scanned for a literal tag byte instead of walking
the descriptor tree and false-positived on shifted bitrate bytes.
perf(aac): kill the rate loop's powf hot pathAhmet Kaan Gümüş · d08a7f7
perf(aac): kill the rate loop's powf hot path

Profiling encode_frame (perf record --call-graph dwarf on a 10s real-PCM
loop) showed 82% of wall time in libm's powf_fma, all reached through
write_frame's cost closure -> quantise -> band_noise/quantise_one:
band_noise's per-band scalefactor search called band_noise (two powf
calls per coefficient) up to ~255 times per band, linearly walking every
candidate level.

- quantise_one's x^0.75 -> sqrt(x)*sqrt(sqrt(x)): two sqrtf beat one powf.
- band_noise's q^(4/3) -> a precomputed lookup table over q's bounded
  (MAX_QUANT) integer range, since q is always an integer there.
- the scalefactor search itself -> bisection, since the algorithm already
  assumed monotonic noise-vs-level to break on first overage; that's
  exactly what a binary search needs, and it drops ~255 candidate levels
  to ~8 per band.

ec-bench's aac encode row: 3.54x -> 37.83x realtime (10.9x on a
standalone 10s-PCM loop, matching the profiling harness). All ec-aac
tests green.

Also fixes crates/ec-aac/tests/oracle.rs's esds_asc helper, which scanned
raw bytes for a literal 0x05 instead of walking the MPEG-4 descriptor
tree by tag+length: a legitimate byte in the DecoderConfigDescriptor's
avgBitrate field (which shifted with the quantiser's new floating-point
path) could and did false-positive as the DecSpecificInfoTag.
Merge branch 'lane-h265prune': the depth-pruning rejection, on the recordAhmet Kaan Gümüş · 3115219
Merge branch 'lane-h265prune': the depth-pruning rejection, on the record

The full threshold-sweep table and the reason no global threshold can
serve both content classes live in the lane report; the code ships
nothing beyond r1's early-out.
docs(h265): close lane-h265prune — depth-pruning lever rejectedAhmet Kaan Gümüş · 53b6d97
docs(h265): close lane-h265prune — depth-pruning lever rejected

Round 2's SATD-proxy split pruning cleared film (<=0.02 dB) only at
thresholds where screen capture still lost 0.658-0.274 dB, decaying too
slowly to reach the bar before instructions win vanishes; a content-gated
variant was probed with a p99/mean gradient-ratio classifier but its
distributions overlap on real film/screen frames, so no threshold could be
shipped without an unbuilt real-clip verification pass. Reverted to r1's
merged all-zero-CBF early-out; full sweep table and reasoning in the lane
report.
Merge branch 'lane-h265prune': the RQT all-zero-CBF early outAhmet Kaan Gümüş · d16dd57
Merge branch 'lane-h265prune': the RQT all-zero-CBF early out

Bit-safe by construction, BD-verified flat-to-positive on the real
film and screen library files; roughly one percent of instructions --
kept as a correctness-preserving simplification, honestly not a
speedup. The re-pinned encode hashes reflect the intentional output
change.
feat(h265): all-zero-CBF early out for the RQT split trialAhmet Kaan Gümüş · 4275e27
feat(h265): all-zero-CBF early out for the RQT split trial

Mirror the CU-quadtree's existing last_cu_empty skip one level down at
the transform tree: when a coding unit's luma and both chroma planes
already quantised to nothing, commit it as one leaf transform unit
without running the four-child split trial (which can only add
split_transform_flag and mode-signalling bits on top of an SSD floor
that split cannot beat). Measured neutral-to-positive, not a
double-digit speedup: -0.02% instructions on a synthetic 1080p
gradient/texture profile clip (the CU-level early out already catches
most flat regions before this code path is reached), BD-PSNR vs x265
+0.003 dB luma / +0.004 dB YUV on a 1080p film clip and flat / +0.025
dB YUV on a 2560x1440 screen capture (both real library files, no
regression on either). Kept because it's exactly the lever the charter
named and is bit-safe-by-construction, not because it clears the
lane's own >10%-instructions bar — flagged honestly in the report.

Re-pins rdoq_cache_hash_is_pinned: this intentionally changes output
on any content where the RQT trial used to flip a leaf to split.