forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 675eebbf2a223b66ea8314f60b09ec5f5a65de29

2026-09-06

perf(av1): the filter search decodes its tile once instead of once per candidateAhmet Kaan Gümüş · 675eebb
perf(av1): the filter search decodes its tile once instead of once per candidate

`filter_search::pick_filters` scores ~25 deblock/CDEF candidates by handing
the coded tile back to the decoder under each one. The entropy decode and
reconstruction it repeated are identical every time -- both filters run
after them -- and that re-parse was 24% of the encoder's profile.

The decoder now captures its pre-filter frame plus the neighbour state the
filters read (`decode::FilterReplay`, armed for exactly one decode), and
`replay_filters` re-runs `apply_deblock` + `apply_cdef` on a copy of it.
Capture only happens on the shape whose decode tail is those two calls and
nothing else (no superres, no loop restoration, no crop); anything else
decodes for real as before.

Byte-exact: the four-point ladder of the 1080p gate clip is unchanged
(17643/32317/53048/76330 bytes, same FNV-1a per stream); 8.24s -> 6.61s.
perf(av1): the coefficient rate pricer stops rebuilding every CDF table per candidateAhmet Kaan Gümüş · 7947a2d
perf(av1): the coefficient rate pricer stops rebuilding every CDF table per candidate

`tile::coeff_bits` is called once per priced candidate and built a whole
`Cdfs` each time -- 9% of the encoder's profile between `Cdfs::new` and
the copy behind it. It now keeps one pristine and one scratch `Cdfs` per
q-context per thread and restores only the tables `write_coeffs` adapts,
so the price is taken against exactly the same state as before.
`partition_bits` builds its read-only tables once.

Byte-exact: the four-point ladder of the 1080p gate clip is identical
(17643/32317/53048/76330 bytes, same FNV-1a per stream); 9.58s -> 8.24s.
Merge branch 'lane-av1filt' (193d9a9e): the encoder searches deblock levels and CDEF strengths by re-decoding its own tileAhmet Kaan Gümüş · 1b6265b
Merge branch 'lane-av1filt' (193d9a9e): the encoder searches deblock levels and CDEF strengths by re-decoding its own tile

Merge resolution: the trial decoder now takes the frame's own tx_select bit
(c78863b8), so the filter search runs under inter TxMode::Select too instead
of skipping -- with Select the default since lane-av1tx2, the lane's own skip
would have left every inter frame unfiltered (class: merge cross-product).
test(av1): pin that the filter search fires, and record the measured ladderAhmet Kaan Gümüş · 06cf00e
test(av1): pin that the filter search fires, and record the measured ladder

A non-ignored gate proves some frame of a sequence chooses a real deblocking
level or CDEF strength and that decode_stream reproduces the encoder's
filtered reconstruction byte for byte; the BD gate's doc table carries the
per-step numbers.
test(av1): the raw inter-tile decode entry point takes the frame's own tx_select bitAhmet Kaan Gümüş · 2d62fa6
test(av1): the raw inter-tile decode entry point takes the frame's own tx_select bit

Three gop round-trip tests decoded inter tiles through decode_inter_frame_tile,
which hard-coded tx_select=false with a comment claiming this crate's encoder
always writes TxMode::Largest. Inter frames write Select by default now, so
the reader consumed the first tx_depth symbol as coefficient data and failed
with a hallucinated empty-reference-slot refusal (class: test asserts against
a stale header, second instance; the key-frame twin was fixed one merge ago).
The entry point now takes tx_select and the tests pass Encoded::tx_select.
feat(av1): encoder enables CDEF and searches its strengths (cdef_bits = 0)Ahmet Kaan Gümüş · df76271
feat(av1): encoder enables CDEF and searches its strengths (cdef_bits = 0)

The sequence header now sets enable_cdef and every frame header carries one
strength pair per plane type, chosen by the same re-decode search as the
deblocking levels -- cdef_bits = 0 means no cdef_idx literal is read in the
tile, so this costs no tile-writer change. Encoded carries the chosen
CdefParams and the tests that decode Encoded::tile take them from there.

BD-rate vs libaom 198.2/218.1/136.9 -> 143.6/179.5/88.0 (1080p/2160p/screen),
vs rav1e 143.1/162.4/52.7 -> 94.0/128.8/21.5.
feat(av1): encoder picks per-frame deblocking levels by re-decoding its own tileAhmet Kaan Gümüş · 873a1fb
feat(av1): encoder picks per-frame deblocking levels by re-decoding its own tile

The encoder runs no loop filter of its own: filter_search hands the coded
tile back to this crate's decoder under each candidate loop_filter_level and
keeps the winning picture as the reconstruction, so the reference frame stays
identical to what a decoder produces. Encoded now carries the chosen
LoopFilterParams and every test that decodes Encoded::tile takes them from
there (class: test asserts against a stale header).
feat(av1): inter frames code tx_mode Select by defaultAhmet Kaan Gümüş · 2fa64f7
feat(av1): inter frames code tx_mode Select by default

The inter var-tx search is measured: BD-rate vs libaom 233.5 -> 226.1 and
170.9 -> 167.4 on two clips and 212.8 -> 213.2 on the third, vs rav1e
177.5 -> 172.0, 73.0 -> 71.5, 156.4 -> 155.6, for 13% encode wall. The BD
 gate prints the inter var-tx depth histogram alongside the intra one
(18-30% of inter blocks split). EC_AV1_TX_SELECT_INTER=0 turns it off.
Reapply "Merge branch 'lane-av1tx' (723ab821): key-frame TxMode::Select -- intra blocks search tx_depth 0..2 with per-transform-unit prediction/reconstruction, writer codes tx_depth with the deblock-grid context and cul_level-based skip contexts; BD-rate vs rav1e screen +141% -> +73%, films -1; inter var-tx syntax written but desyncs, shipped off behind EC_AV1_TX_SELECT_INTER=1; ffmpeg decodes every default stream sample-exact"Ahmet Kaan Gümüş · 5f7a053
Reapply "Merge branch 'lane-av1tx' (723ab821): key-frame TxMode::Select -- intra blocks search tx_depth 0..2 with per-transform-unit prediction/reconstruction, writer codes tx_depth with the deblock-grid context and cul_level-based skip contexts; BD-rate vs rav1e screen +141% -> +73%, films -1; inter var-tx syntax written but desyncs, shipped off behind EC_AV1_TX_SELECT_INTER=1; ffmpeg decodes every default stream sample-exact"

This reverts commit 582fbd0bb1adb7724e9fa24f57bffd217fa38c3b.
fix(av1): a key frame test decoded its own tile as TxMode::LargestAhmet Kaan Gümüş · 787a14a
fix(av1): a key frame test decoded its own tile as TxMode::Largest

The nine failing gates fed decode_key_frame_tile a hardcoded tx_select =
false while the encoder had moved its key frame header to
TxMode::Select, so the decoder missed the first block tx_depth symbol
and desynced at pixel (0,0). Encoded now carries the header bit and the
encoder-driven decode sites pass it along.
Revert "Merge branch 'lane-av1tx' (723ab821): key-frame TxMode::Select -- intra blocks search tx_depth 0..2 with per-transform-unit prediction/reconstruction, writer codes tx_depth with the deblock-grid context and cul_level-based skip contexts; BD-rate vs rav1e screen +141% -> +73%, films -1; inter var-tx syntax written but desyncs, shipped off behind EC_AV1_TX_SELECT_INTER=1; ffmpeg decodes every default stream sample-exact"Ahmet Kaan Gümüş · 041eb21
Revert "Merge branch 'lane-av1tx' (723ab821): key-frame TxMode::Select -- intra blocks search tx_depth 0..2 with per-transform-unit prediction/reconstruction, writer codes tx_depth with the deblock-grid context and cul_level-based skip contexts; BD-rate vs rav1e screen +141% -> +73%, films -1; inter var-tx syntax written but desyncs, shipped off behind EC_AV1_TX_SELECT_INTER=1; ffmpeg decodes every default stream sample-exact"

This reverts commit 80f4e998bf89f8bfa64daf228d3e2b08dc10191c, reversing
changes made to 79ce824128513b891bfae8a68ee36c1fd54cb062.
feat(av1): inter blocks search the var-tx tree one halving deepAhmet Kaan Gümüş · 710cb11
feat(av1): inter blocks search the var-tx tree one halving deep

With the inter frame at TxMode::Select an inter block now codes its
residual either as one transform over the whole block or as the four
transforms of half the side, chosen by RD against the txfm_split symbols
both arms spend. The writer codes the split root plus one unsplit flag
per child off the interleaved TXFM_CONTEXT bands, and the split units
read the inter coefficient tables. Blocks touching the true frame edge
stay flat: the reader skips var-tx units past the edge.

Still behind EC_AV1_TX_SELECT_INTER=1.
perf(av1): ten headroom bits under the forward network, measured on BDAhmet Kaan Gümüş · 636712f
perf(av1): ten headroom bits under the forward network, measured on BD

Six bits of headroom left the fixed-point network's rounding worth 3.9 BD
points on screen capture against libaom. Ten put the coefficient
resolution at 1/256 of a unit of the `8 * orthonormal` scale a level is
formed on, which is where the BD gate stops moving -- 13 bits measures
identical -- and stays under 2^27 for a 12-bit residual through two
64-point passes.

BD-rate vs libaom 216.6/233.5/289.8 (base 216.4/235.5/289.2), vs rav1e
157.4/175.9/138.1 (base 157.8/178.3/141.1), 1080p/2160p/screen: six of
the eight numbers improve, screen-vs-libaom is +0.6 and 1080p-vs-libaom
+0.2.

Also measured and REVERTED: the row pass's `Vec` in a thread-local
scratch, as the inverse transform's is, +5.0% instructions -- reusing the
buffer needs a `memset` where a fresh allocation is already zeroed, and
that zeroing is what the all-zero-row skip reads. Noted at the function.
fix(av1): an intra block on a tile edge read its tx_depth context off a phantom neighbourAhmet Kaan Gümüş · b8e3b16
fix(av1): an intra block on a tile edge read its tx_depth context off a phantom neighbour

The inter-frame TxMode::Select writer counted the TXFM_CONTEXT band value
of a neighbour that does not exist -- the bands initialise to 64 pixels
(the widest transform), so every intra block on a tile top row or left
column took its tx_depth symbol off a CDF row one higher than the
decoder, whose tx_size_context_txfm drops the term entirely when
has_above/has_left is false. First divergence of every inter Select
stream.

Found with the new encode.rs round trip through our OWN decoder: the
ffmpeg gates could only report "Invalid data found", while our decoder
names the first differing frame/plane/position and can be traced symbol
by symbol.
feat(av1): inter-frame tx_mode Select syntax, opt-in and not yet exactAhmet Kaan Gümüş · 6397783
feat(av1): inter-frame tx_mode Select syntax, opt-in and not yet exact

The tile writer grows the TXFM_CONTEXT bands (above_txfm/left_txfm, decode.rs
txfm_partition_ctx_rect and tx_size_context_txfm_rect) and writes an inter
frame's transform syntax: one zero txfm_split flag per inter block that codes
a residual, none on a skipped one, a searched tx_depth on every intra block.
dav1d refuses the resulting stream and the first diverging symbol was not
located inside this lane, so the inter header stays TxMode::Largest unless
EC_AV1_TX_SELECT_INTER=1. Key frames are unaffected and stay byte-exact.

Also pins the split path in the ffmpeg exactness gate: the test now asserts
some block really resolved tx_depth > 0 before claiming the decode matched.
perf(av1): form the levels off the forward transform's own fixed pointAhmet Kaan Gümüş · 1be1614
perf(av1): form the levels off the forward transform's own fixed point

`forward_and_quantize` transformed into a `Vec<f64>` of coefficients and
then read it back to quantize. With the network already in fixed point
the column pass can hand each column straight to the level formation
while it is still in `t`, so the coefficient buffer and the pass over it
are gone -- and a 64-point transform's uncoded columns (everything
outside the top-left 32x32 the syntax carries) are not transformed at
all.

209.0 G -> 178.9 G instructions:u on the sequence bench (-14.4%).

Two eight-wide column passes were measured and REVERTED: the `[i32; 8]`
Lane over eight columns is +3.4%, an in-place whole-buffer column pass
+2.3%. Both lose the per-column zero skip and the register-resident level
formation, which this encoder's mostly-small transforms live on. Noted at
the call site.
perf(av1): the encoder's forward DCT is the decoder's network, transposedAhmet Kaan Gümüş · eb8e099
perf(av1): the encoder's forward DCT is the decoder's network, transposed

The forward transform was an f64 FFT (Complex math, per-row/column) and
had become the encoder's single largest cost -- `transform::dct1d` 23.6%
of the profile. It is replaced by the transpose of the decoder's own
fixed-point butterfly network: a network's transpose is that network run
backwards with each elementary matrix transposed, and all of this one's
elements are symmetric except the unflipped rotation, whose transpose is
the same rotation at the negated angle. So the forward body IS the
inverse's stages reversed, its unflipped angles negated, its bit-reversal
moved to the end -- generated from the inverse's source, then measured.

Only the quantized levels reach the decoder, so a forward transform owes
a good analysis basis, not a specified one; the gain the levels are
formed on is measured from the network (`forward_gain`, sqrt(n/2) per
pass) rather than asserted, and the residual carries six headroom bits so
the network's own rounding stays well under one unit of the 8x
orthonormal scale a level is formed on.

-13.1% instructions:u on the sequence bench (209.0 G -> 181.6 G).
feat(av1): a key frame's intra blocks search their own transform depthAhmet Kaan Gümüş · 13f5083
feat(av1): a key frame's intra blocks search their own transform depth

TxMode::Select on the key frame header, one tx_depth symbol per block off
get_tx_size_context's own CDF row, and a per-transform-unit intra loop that
predicts each unit from what the units before it reconstructed -- the shape
the decoder has always read (decode_block's multi-unit branch).

BD-rate vs libaom 216.4/235.5/289.2 -> 212.8/233.5/170.9 (1080p/2160p/screen),
vs rav1e 157.8/178.3/141.1 -> 156.4/177.5/73.0.
perf(av1): the partition breakout knob, swept and left offAhmet Kaan Gümüş · 04ff5f8
perf(av1): the partition breakout knob, swept and left off

libaom's `partition_search_breakout` shape, as a coefficient-density
threshold: a block coding at most N non-zero luma coefficients per 256 luma
samples is not offered the split below it. Swept on the BD gate at 1, 2 and
4: the wall halves (6.3/6.0/6.2 s -> 3.6/3.2/4.4 s at 1) but BD-rate rises
+18.4/+24.0/+7.9 points, far past this lane's keep rule of one point. The
default is 0 -- the existing all-skip prune alone -- so this commit changes
no output; the knob and its numbers stay for a future speed preset.
perf(av1): integer SAD in the motion search, a priced-once symbol tableAhmet Kaan Gümüş · 06a3123
perf(av1): integer SAD in the motion search, a priced-once symbol table

Two more bit-exact costs off the RD search's inner loops:

- the motion search accumulated its SAD as one f64 conversion and dependent
  add per sample; a 32x32 block of 8-bit samples sums exactly in u32, and
  that sum converts exactly to f64, so the value is unchanged;
- `symbol_bits` called libm's log2 for every symbol of every candidate the
  search prices, but a CDF interval is a 15-bit width, so there are only
  32769 prices; they are now computed once into a table (each entry exactly
  the expression the call site used to evaluate).

instructions:u on the 24-frame 1280x720 sequence bench: 231.8G -> 209.0G
(-9.8%); output bytes unchanged (64931), BD-rate unchanged on all three gate
clips, gate wall 7.0/6.7/6.7 -> 6.3/6.0/6.2 s.
perf(av1): a NEWMV that lands on the stack's NEARESTMV reuses its trialsAhmet Kaan Gümüş · 12435b7
perf(av1): a NEWMV that lands on the stack's NEARESTMV reuses its trials

Both inter paths ran motion compensation, forward transform, quantize and
reconstruct three planes' worth a second time whenever the motion search
settled on the vector the MV stack already offered as NEARESTMV -- common on
static content. The NEARESTMV trials are kept and reused when the vectors
match, so the two candidates still price separately (their mode syntax
differs) off one set of trials.

instructions:u on the 24-frame 1280x720 sequence bench: 263.5G -> 231.8G
(-12.0%); output bytes unchanged (64931), BD-rate unchanged on all three
gate clips, gate wall 7.8/7.4/7.6 -> 7.0/6.7/6.7 s.
feat(av1): chroma searches its own uv_mode instead of coding DC unconditionallyAhmet Kaan Gümüş · b0a80f3
feat(av1): chroma searches its own uv_mode instead of coding DC unconditionally

Both chroma planes were predicted DC_PRED at every block because that is all
the tile writer coded. They now search the seven modes that read no further
than the row directly above and the column directly to the left -- DC, V, H,
SMOOTH, SMOOTH_V, SMOOTH_H, PAETH -- which is exactly the set a chroma block
coded with `Reach::none()` may offer; the eight directional modes read past
that and UV_CFL_PRED needs its own alpha syntax.

A chroma block never codes a tx_type symbol: the decoder derives it from the
chroma mode (`Intra_Mode_To_Tx_Type`, spec 9.3), so a non-DC uv_mode moves
chroma onto an ADST-bearing transform. The forward half of that is new here
and measured off the decoder's own inverse network -- a unit coefficient
through `inverse_1d` IS the basis function it synthesises -- rather than
written out, which is safe because only the levels and the derived type reach
the decoder: the reconstruction the search scores still comes back through
the exact inverse.

BD-rate vs libaom 234.0/260.3/318.5 -> 216.4/235.5/289.2 and vs rav1e
171.9/203.2/155.3 -> 157.8/178.3/141.1 (1080p/2160p/screen), down on all
three against both references. Wall 9.8s -> ~11.1s per clip ladder. The gate's
own ffmpeg-decodes-sample-exact assertion holds, so the writer's uv_mode and
angle_delta_uv syntax and the derived chroma transform agree with a real
decoder. Fire counts printed per clip: DC wins 79.1/84.1/43.8%, PAETH
7.1/6.6/29.0%, H 3.3/2.5/16.6%.
perf(av1): cached FFT stage twiddles, stack scratch for a motion-compensated trialAhmet Kaan Gümüş · 56cc232
perf(av1): cached FFT stage twiddles, stack scratch for a motion-compensated trial

Two allocation/libm costs on the encoder's hottest paths, neither of which
changes a single output byte:

- `fft`'s stage twiddle depends only on the stage length, so its two
  `sincos` calls per stage per call become one lazily-built table of the
  seven values that exist (`__sincos_fma` was 9% of the encoder profile).
- `mc_trial` heap-allocated a `u16` prediction and a `u8` copy of it for
  every candidate trial; both are at most 32x32 and now live on the stack.

instructions:u on the 24-frame 1280x720 sequence bench: 283.6G -> 263.5G
(-7.1%); output bytes unchanged (64931), BD-rate unchanged on all three
gate clips.
perf(av1): the motion search reads the reference picture's own planeAhmet Kaan Gümüş · 06abb60
perf(av1): the motion search reads the reference picture's own plane

Every call to `motion::search` allocated and converted the WHOLE reference
luma plane from the encoder's `u8` shadow copy to `u16`, once per searched
block. The DPB picture already holds that plane as `u16`, so the search now
takes it directly and the shadow copy is gone.

Output is byte-identical (the BD gate's four points per clip and the
sequence bench's 64931 bytes are unchanged); instructions:u on the 24-frame
1280x720 sequence bench fall 384.4G -> 283.6G (-26.2%).
feat(av1): a 16x16 inter leaf splits into four 8x8 ones on costAhmet Kaan Gümüş · 17448fa
feat(av1): a 16x16 inter leaf splits into four 8x8 ones on cost

The quadtree now runs 32 -> 16 -> 8 inside an inter frame: a 16x16 leaf
wholly inside the frame that carries `eight` is written as a real
PARTITION_SPLIT at BLOCK_16X16 with four 8x8 leaves, where before only a
leaf the true frame edge cut through was ever split (and then on geometry,
with the edge's gathered flag). Same skipped-block prune one level up.

The desync this first shipped with was the skip/intra-inter neighbour
context: `Neighbours` kept it per 16x16 slot, so all four leaves read the
slot's coarse state and left only the last leaf's behind. Under a real
split the bottom-left leaf's above neighbour is the FIRST leaf and the
bottom-right's above and left are two different ones -- the arrays are now
per 4x4 mode-info unit, like `above_side_mi` already was, and each leaf
reads and records its own cells (which also retires the single-previous-
leaf override the straddling path used).

BD-rate vs libaom / rav1e, same 12-frame recipe:
  1080p  +294.5 -> +234.0  |  +215.8 -> +171.9
  2160p  +320.9 -> +260.3  |  +253.2 -> +203.2
  screen +395.6 -> +318.5  |  +181.1 -> +155.3
The 8-way split fires on 5.4% / 4.4% / 7.8% of 16x16 leaves.
feat(av1): a 16x16 inter leaf searches its own motionAhmet Kaan Gümüş · 62967a8
feat(av1): a 16x16 inter leaf searches its own motion

A leaf only ever took the MV stack's NEARESTMV candidate or went intra, so
a 32x32 block that split because its four quarters move differently could
not code the movement it split for. Each leaf now prices the same NEWMV
candidate a whole block does -- motion::search from pred_mv, rounded to a
vector the residual syntax can name -- at its own side.

The reference luma plane is narrowed to 8 bits once per frame rather than
once per searched block (a whole plane's map per 32x32 block before, and
per leaf after this), which is where the added search time comes back.

BD-rate vs libaom / rav1e, same 12-frame recipe:
  1080p  +321.7 -> +294.5  |  +235.4 -> +215.8
  2160p  +343.4 -> +320.9  |  +272.2 -> +253.2
  screen +396.1 -> +395.6  |  +181.2 -> +181.1
Wall 8.1/7.7/9.0 s -> 9.2/8.5/9.2 s. Splits fire on 14.6/12.3/23.7%.
feat(av1): an inter frame's 32x32 blocks pick their own partitionAhmet Kaan Gümüş · e2e76c0
feat(av1): an inter frame's 32x32 blocks pick their own partition

Inside the frame every inter block was coded whole: only a quadrant the
true frame edge cut through was ever split, so the partition decision the
key frame search already makes was left unmade for eleven frames out of
twelve. The block now prices four 16x16 leaves against itself, each leaf
searched against the reconstruction and the mi grid the ones before it
left, and takes whichever costs less -- the writer's Quadrant::Split arm
already codes exactly that tree.

A block the whole-32 search left skipped is not offered the split (the
cpu-used-6 prune), which is where the wall would otherwise go on static
content.

BD-rate vs libaom cpu-used 6 / rav1e speed 6, 12 frames at 640x384:
  1080p  +501.6 -> +321.7  |  vs rav1e +364.8 -> +235.4
  2160p  +502.4 -> +343.4  |  vs rav1e +401.1 -> +272.2
  screen +440.1 -> +396.1  |  vs rav1e +206.9 -> +181.2
Wall 3.7/3.7/5.2 s -> 8.1/7.7/9.0 s (rav1e 4.7/3.8/3.7). The split fires
on 12.8% / 11.0% / 23.6% of in-frame blocks.
feat(h265): default 4x4 transform skip to the per-block RD decisionAhmet Kaan Gümüş · c7b6783
feat(h265): default 4x4 transform skip to the per-block RD decision

Measured over the four-QP ladder against x265 at matched features, BD-PSNR
all-plane: screen capture A -0.438 -> +0.918, B +0.561 -> +0.781, C +0.099 ->
+0.008, film +0.468 -> +0.460. The tool costs a second quantise-and-reconstruct
pass per committed 4x4 luma block (ladder 111s -> 290s on screen capture A,
427s -> 494s on film); TransformSkip::Off buys that back.

The pinned encode hashes move with the default.
perf(av1): one film-grain kernel call per block, no scalar remainderAhmet Kaan Gümüş · 12e1d49
perf(av1): one film-grain kernel call per block, no scalar remainder

The overlap line and the overlap column each added their noise in an
add_noise_to_block call of their own: the column is 1 chroma sample wide,
so its 15 rows were 15 scalar calls, and the block left over was 15 wide,
whose AVX2 kernel handed the 3-sample tail of every row back to the scalar
loop. A 60-frame 4K cut spent 2.19e9 such calls on 4.4e9 samples (23% of
all chroma samples, 12% of luma).

The three noise sources are now assembled into one 32x32 block (16x16
chroma) and applied in a single call whose width is a multiple of 8, so no
scalar remainder is left. Every sample keeps the value its own source gave
it, so the picture is bit-identical.

seg4k 1 thread: 387.00G -> 375.76G instructions:u (-2.9%), 173.4G -> 170.2G
cycles:u; a 4K grain cut 3719.9G -> 3592.4G instructions:u (-3.4%).
12/12 gate hashes unchanged.
perf(av1): the square coefficient loop's trace sites move out of lineAhmet Kaan Gümüş · 70a2869
perf(av1): the square coefficient loop's trace sites move out of line

`eprintln!` builds its `fmt::Arguments` on the stack at the call site, so the
six trace sites inside `read_coeffs`'s base and sign loops kept their values
pinned in the hot loop's frame -- the annotated profile's top line was stack
spill traffic. Each is a `#[cold] #[inline(never)]` call taking the values it
prints; the output is character-for-character what it was.

instructions:u at EC_AV1_THREADS=1: 4K segment -0.25%, 1080p segment -0.32%.

The same treatment on `read_coeffs_rect`'s four sites plus the two remaining
`TRACE` sites of the sign pass measured WORSE (4K +0.04%, 1080p +0.05%,
reproduced in two interleaved pairs on both segments) and was reverted by
inverse edit -- those loops are short enough that the extra call sequences
cost more than the frame they free.
perf(av1): price an inter candidate through the inter 32x32 coefficient setAhmet Kaan Gümüş · c0bc07f
perf(av1): price an inter candidate through the inter 32x32 coefficient set

search_inter_block priced its NEARESTMV/NEWMV candidates through
TxbSet::Luma32, the INTRA table, while sb_coeff_inter_frame_tile codes
an inter block through Luma32Inter -- which carries the inter tx_type
symbol Luma32 has no table for. The BD gate is byte-identical either way
(the symbol is worth ~0.03 bit, far below a decision flip), so this is a
price-matches-the-writer alignment, not a gain.
test(av1): the bounded-pool test allows a small load-dependent growth between decodes (pool grows to busy+queued; 9 -> 10 seen at load 62), keeps the structural boundAhmet Kaan Gümüş · d552955
test(av1): the bounded-pool test allows a small load-dependent growth between decodes (pool grows to busy+queued; 9 -> 10 seen at load 62), keeps the structural bound
feat(av1): price the search at the frame's own coefficient q-context, and measure the rate term's driftAhmet Kaan Gümüş · 40e1d94
feat(av1): price the search at the frame's own coefficient q-context, and measure the rate term's drift

coeff_bits built its CDFs at a pinned q-context 2, so two of the four
points of the BD ladder ranked modes against another quantizer's
tables; it now takes the frame's own q_ctx_of(base_q_idx), the same one
the tile writer hands Cdfs::new.

Adds the instrument the rate work needs: predicted_coeff_bits(_sb) sums
what the search paid for the coefficients each kept block carries, and
predicted_coeff_bits_track_the_tile_the_writer_wrote compares that sum
with the bytes the writer emitted. Measured: -13.5% at the key frame
falling to +1.8% by the fifth frame -- the search over-prices, because
its CDFs stay at the tile defaults while the writer's adapt.
test(mp3): census the distortion loop's exit reason, and record what LAME's shape measuresAhmet Kaan Gümüş · 3458620
test(mp3): census the distortion loop's exit reason, and record what LAME's shape measures

The outer loop's exit reason was only knowable by patching the encoder, so
every round that asked "does the distortion loop run" had to re-instrument it.
`EC_MP3_LOOP_TRACE=1` now prints one `mp3loop <reason> <round>` line per
granule, countable with `sort | uniq -c`.

Measured on two library sources at 128 and 192 kbit/s, 36758 granules: 36494
exit at round 0 on the budget break, 264 after one to five rounds, 3 at the
cap. The loop is a rate loop, as recorded.

Restructuring it into LAME's shape -- drop the budget break, let the distortion
test drive, since the inner loop already fits the budget at every round -- was
built and measured on the same two sources before being reverted. It does make
the loop live (10440 of 36758 granules reach the 20-round cap), and it loses on
both of the gate's metrics: 0.99917 -> 0.99787 correlation at 128 kbit/s, from
ahead of libmp3lame to behind it, and the worst 20 ms window from -15.3 to
-12.4 dB, at about five times the encode time. The finding is in the comment so
the next round does not pay for it again.