forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 5ba1d08ff3bf0db622e8f5d1c17affb8c458bd55

2026-09-05

perf(av1): 24-byte mi grid cellAhmet Kaan Gümüş · 5ba1d08
perf(av1): 24-byte mi grid cell

`MiInfo` is one cell per 4x4 unit of the frame and `find_mv_stack` walks it
for every inter block, so the cell's size is that scan's memory traffic. The
second reference slot carried two `Option` tag words (`ref_frame1`, `mv1`);
slot 1 only ever holds a real reference, so `NO_REF1` (-1) tags it absent and
`mv1` becomes a plain pair -- 32 -> 24 bytes, `is_inter` still giving
`Option<MiInfo>` a niche so the grid cell costs no extra word. An interintra
neighbour (slot 1 = INTRA_FRAME, no second MV) was excluded by its `mv1`
being `None` and is now excluded by `ref_frame1 > 0`, the same condition
libaom's own ref-diff scan uses.

Byte-exact: all 12 gate hashes (4 streams x 1/4/16 threads) unchanged.
instructions:u on the 4K segment 410.629 -> 410.478 G at 1 thread,
419.746 -> 419.481 G at (16,4,2); task-clock at (16,4,2) 42.41 -> 41.81 s
against the lane base.
perf(av1): heap-free MV stack and row-fill mi publicationAhmet Kaan Gümüş · fc982db
perf(av1): heap-free MV stack and row-fill mi publication

The MV stack was two heap allocations per inter block (`entries` plus
`drl_ctx`); both lists are bounded by a spec constant, so they move into a
fixed-capacity inline `SmallVec` that derefs to the same slice API. Mode-info
publication stamped its block footprint cell by cell through `MiGrid::set`;
rows are contiguous, so `MiGrid::fill_rect` fills each row with one
`slice::fill` of the `Copy` cell instead.

Byte-exact: all four gate streams hash unchanged at 1 thread.
instructions:u on the 4K segment 412.376 -> 410.629 G at 1 thread,
421.419 -> 419.746 G at (16,4,2).
perf(av1): hoist the temporal-MV probe out of the per-sample loop, thread-local the mvstack gate countersAhmet Kaan Gümüş · e08e4e4
perf(av1): hoist the temporal-MV probe out of the per-sample loop, thread-local the mvstack gate counters

`add_tpl_ref_mv` re-derived the parity, the field bounds and the row base
on every one of the (up to 19) 8x8 probes a query block makes. Those are
per-BLOCK quantities: `row8 = mi_row + blk_row + (mi_row even)` means the
cell index is `(mi_row + 1 - (mi_row & 1) + blk_row) >> 1`, and an
arithmetic shift keeps the spec's `row8 < 0` rejection exact. `TplProbe`
holds the two bases plus the cell slice, so a probe is an add, a shift and
a bounds check; the compound stack reads the cell ONCE and projects it to
both sides instead of walking the field twice. `EC_TRACE_TPL`'s per-sample
dump is unchanged: the flag is read once per block and the traced path
still goes through `add_tpl_ref_mv` itself.

The four mvstack firing counters (`TMV_HITS` per inter block,
`STACK_FULL_DROPS` per candidate insertion, `COMP_GM_FILL_HITS`,
`TILE_REACH_CLIPS`) were process-global atomics: one shared cache line
bumped by 16 frame threads on the parse critical path. They are now
thread-local `Cell`s, the form every other gate counter in the crate
already uses; the gates that read them decode on their own thread.

-0.21% instructions on the 4K segment at 1 thread (443.29 vs 444.24 G);
the counter step is flat there and inside the box's noise at 16 threads.
Byte-exact: all 12 gate hashes unchanged at 1/4/16 threads.
perf(av1): an all-zero inter residual reconstructs as a prediction copyAhmet Kaan Gümüş · c5b674a
perf(av1): an all-zero inter residual reconstructs as a prediction copy

`reconstruct_mc_rect` expanded the empty all-zero marker into a `side * h`
slice of the 64 KB `ZERO_RESIDUAL` static and added those zeros sample by
sample -- for 60% of the units. The zero case now runs the same clamp
without the residual operand (identical arithmetic at `r == 0`; the
prediction->plane copy the charter names is kept).

instructions:u on the 4K segment: 453.00 G -> 450.45 G at (16, 4, 2)
threads, 444.33 G -> 441.90 G at one thread.
perf(av1): intra edges on the stackAhmet Kaan Gümüş · ee5b8d8
perf(av1): intra edges on the stack

An edge is at most bw + bh + 1 = 129 samples, so Edges holds two arrays
instead of two heap buffers, and the edge filter's working copy is a
stack array too: two allocations gone per predicted block, on a stream
whose intra blocks are mostly 4x4 to 16x16.

Byte-exact on all four gate streams; -0.07% instructions on the 4K
segment, -0.08% on the 1080p one (malloc latency does not show on
instructions:u).
perf(av1): recorded reconstruction ops index per-superblock arenas instead of owning a Vec eachAhmet Kaan Gümüş · ba6ddd4
perf(av1): recorded reconstruction ops index per-superblock arenas instead of owning a Vec each

A recorded transform unit copied its coefficient grid (`grid.to_vec()`) and
a recorded motion-compensated write copied its prediction window into a
fresh `Vec`, both on the parse thread, both freed on a recon worker: ~7.1 M
malloc/free pairs across the 4K segment, with `_int_malloc` on the frame
thread and `_int_free_chunk` on the workers.

The tile now carries two arenas (`FrameCtx::coeff_arena`, `pred_arena`); a
record is an `(offset, len)` into them. They are handed over WITH the ops at
both drain points -- `wave_submit` moves them into the job (`ReconJob`), so
one buffer per superblock reaches the worker instead of one per unit, and
`flush_recon` swaps them through spares -- which keeps every offset relative
to the live arena and every write byte-identical.

instructions:u on the 4K segment at (16 frame, 4 filter, 2 recon) threads:
456.25 G -> 453.00 G (-0.72%); wall on this box is load-dominated and does
not resolve it.
perf(av1): directional intra hoists the zone, the derivative and the blend out of the pixel loopAhmet Kaan Gümüş · e7ac08e
perf(av1): directional intra hoists the zone, the derivative and the blend out of the pixel loop

The z1/z2/z3 walk decided its zone, looked the derivative up in a
27-arm match and called the edge blend through a `&dyn Fn` once per
sample. Three loops, one per zone, with the derivative and the base
constants per block and z1's shift per row; the blend indexes the edge
slice directly.

Byte-exact on all four gate streams. -0.25% instructions on the 4K
segment, -0.47% on the 1080p one (cumulative -2.84% / -1.97%).
perf(av1): intra non-directional prediction loops once per mode, not per pixelAhmet Kaan Gümüş · 29faade
perf(av1): intra non-directional prediction loops once per mode, not per pixel

The seven non-directional modes shared one pixel loop with a 13-arm
`match mode` inside it, so every sample re-ran the dispatch and DC_PRED
re-averaged both edges per sample. One loop per mode instead, with the
per-row terms (smooth weights, the bottom-left/top-right anchors, the
left column sample) hoisted out of the column loop.

Byte-exact: all four gate streams hash to their references at 1 thread.
-2.59% instructions on the 4K segment, -1.51% on the 1080p one.
perf(av1): the compound vertical pass runs the whole block per callAhmet Kaan Gümüş · f2203de
perf(av1): the compound vertical pass runs the whole block per call

vpass_row takes the block's row count too, and the compound kernel
accumulates straight into its i32 destination and rounds it in one
sweep, dropping the per-row accumulator round trip along with the
per-row tap setup. Byte-exact: all four gate streams hash to their
references.
perf(av1): the vertical pass sets its taps up once per block, not once per rowAhmet Kaan Gümüş · 3702d63
perf(av1): the vertical pass sets its taps up once per block, not once per row

vpass_row_u16 and its AVX2/SSE4.1 kernels take the block's row count, so
the tap pairs, the rounding vector and the clamp vector are built once
per predict call. Byte-exact: all four gate streams hash to their
references.
perf(av1): the horizontal pass sets its taps up once per block, not once per rowAhmet Kaan Gümüş · e27ea46
perf(av1): the horizontal pass sets its taps up once per block, not once per row

hpass_avx2/hpass_sse2 take the block's row count and source stride, so
the tap broadcast, the rounding vector and the SIMD dispatch happen once
per predict call instead of once for each of the block_h+7 rows.
Byte-exact: all four gate streams hash to their references.
perf(av1): MC hoists the interior row test and fuses whole-pel-horizontal blocks onto the referenceAhmet Kaan Gümüş · 37ae497
perf(av1): MC hoists the interior row test and fuses whole-pel-horizontal blocks onto the reference

The unscaled horizontal pass tested the vertical clamp, the interior
window, the slice bounds, the tap narrowing and the SIMD level once per
row; when the whole footprint is inside the reference -- the common case
-- every one of those has the same answer for all rows, so the test is
hoisted and the loop is a walk of the stride.

A whole-pel horizontal position makes the horizontal pass the identity
tap, whose intermediate is exactly `s << 4`, so the vertical pass is the
same 8-tap sum taken straight off the reference rows with the taps
scaled by 16. Both the single and the compound kernel now take that
path for interior blocks, which drops the intermediate entirely; the
vertical kernels gained a source-stride parameter to read it.

Byte-exact: all four gate streams hash to their references.
perf(av1): deblock kernel per length, level table per plane passAhmet Kaan Gümüş · b247733
perf(av1): deblock kernel per length, level table per plane pass

The AVX2 edge kernel is monomorphised on the edge length, so each of the
four lengths holds only its own taps live and every wide row is clamped
straight into the tile instead of into a shared twelve-entry result array
the register allocator spilled (35% -> 18% of the kernel's samples on
stack moves). An all-empty filter mask now returns without any write-back
at all, which also drops a vertical edge's second transpose.

edge_params' seven per-plane-pass arguments -- half of them passed on the
stack into the inline(never) body -- collapse into one EdgeCtx built once
per band, carrying libaom's av1_loop_filter_frame_init idea in level
form: get_filter_level for every (base level, ref frame) pair, tabulated
once instead of re-derived per 4-pixel edge group.

Byte-exact: all four gate streams hash identically at 1, 4 and 16
threads.
perf(av1): CDEF direction search row-at-a-time, i16 filter windowsAhmet Kaan Gümüş · 8402ace
perf(av1): CDEF direction search row-at-a-time, i16 filter windows

`cdef_find_dir`'s 64-sample accumulation was 57% of `cdef_band` (22.6% of
the function on decode.rs:15560 alone): 512 scalar read-modify-writes on
i64 partials. Each of libaom `cdef_find_dir_c`'s eight index forms is,
once the row is fixed, "add the row / its reverse / its pairwise sums /
its total into consecutive slots", so the loop is rewritten row at a time
over i32 partials (exact: a partial is at most eight samples in -128..127)
and gains an AVX2 twin, `cdef_find_dir_partials_avx2`, for eight lanes
instead of the four the scalar form auto-vectorises to.

`cdef_gather` now writes the window as i16, which is what the AVX2 tap
kernel wanted anyway: it taps the caller's 256-entry scratch in place
instead of copying and narrowing 144 entries per block.

Byte-exact: all four gate streams unchanged. seg4k instructions:u
504.77 -> 499.27 G (-1.09%); cdef_band 3.02% -> 1.78% of cycles.
New gate `cdef_find_dir_matches_the_per_sample_reference` pins both forms
against a literal transcription of `cdef_find_dir_c`, sentinel rows
included.
perf(av1): put the AVX2 feature on the Lane methods themselvesAhmet Kaan Gümüş · b848139
perf(av1): put the AVX2 feature on the Lane methods themselves

The column pass measured -3.7% instructions when the network was
`#[inline(always)]`d into the `target_feature` wrapper -- and then measured
FLAT again after an unrelated refactor moved the size dispatch into its own
`target_feature` function: the generic network stopped landing inside an AVX2
context, and with it every `_mm256_*` went back to being an out-of-line call
(9.5% + 3.7% of the profile, 65 `vpmuldq` in the binary against 339 now).

Relying on inlining to carry the feature is what was fragile. `Lane`'s two
methods are `unsafe fn` now -- the only form rustc lets an impl carry
`#[target_feature]` -- so the AVX2 impl compiles its intrinsics inline no
matter how its callers are arranged. The scalar impls require nothing of
their callers, and `M256` values still exist only inside the feature-detected
`simd::column_pass_dct`.

seg4k at one thread: 523.15 -> 502.36 G instructions:u (-3.97%), stable across
runs. All 12 gate hashes unchanged.
test(av1): the AVX2 column pass against the scalar network over the full i32 rangeAhmet Kaan Gümüş · 1b7f343
test(av1): the AVX2 column pass against the scalar network over the full i32 range

The intrinsics claim exact 64-bit products, so the gate sweeps `i32::MIN`/
`MAX`, both clamp boundaries at every `r` the decoder uses (16/18/20) and
uniform full-range noise at every size, not only the dequantizer's own bound
-- a single differing lane would be a silent pixel drift on whatever stream
first reached it.
perf(av1): explicit AVX2 inverse-DCT column pass, and an empty all-zero residualAhmet Kaan Gümüş · ef53b7e
perf(av1): explicit AVX2 inverse-DCT column pass, and an empty all-zero residual

The eight-wide column pass lane-tx introduced went through `[i32; 8]`, which
LLVM never vectorised (the butterfly products are 64-bit). This adds an
explicit AVX2 `Lane` impl -- `_mm256_mul_epi32` on the even/odd halves, so
every product is exact in 64 bits and the pass is byte-exact with the scalar
network on every input, not only on conformant ones -- dispatched off
`mc::simd_level()`, with the scalar impl kept as the reference.

`inverse_dct_n` is `#[inline(always)]` because the AVX2 instantiation has to
land inside the `target_feature` wrapper: without it every `_mm256_*` stayed
an out-of-line call and the "SIMD" pass measured 5.6% WORSE.

Second, the 60% of transform units that carry no coefficient now return an
EMPTY residual instead of `w * h` zeros: the reconstruction loops expand the
marker against one static zero block, so the per-unit zero `Vec`, its `to_vec`
clone into the recorded op, and (for a deferred unit) the coefficient-grid
clone all disappear.

seg4k at one thread: 523.1 -> 503.5 G instructions:u (-3.7%), min-of-5
cycles:u 142.1 -> 136.4 G. All 12 gate hashes unchanged.
perf(av1): constant-length row copies on the whole-pel inter pathAhmet Kaan Gümüş · 3a35e5f
perf(av1): constant-length row copies on the whole-pel inter path

A whole-pel prediction is a clamped copy, and its per-row
`copy_from_slice` compiled to a `memcpy` call with a runtime length --
for the 8-sample row of an 8x8 block (the most common inter shape on
real 4K content) the call costs more than the move it makes. The three
common widths get a constant length, which inlines.

-0.11% instructions on the 4K segment (523.67 -> 523.07 G at one
thread), -5.4% cumulative; all twelve gate hashes unchanged.
perf(av1): deblock -- masked transform-alignment gate, inlined edge_params head, running-sum filter14Ahmet Kaan Gümüş · 2a2adba
perf(av1): deblock -- masked transform-alignment gate, inlined edge_params head, running-sum filter14

Three measured steps on the loop filter, all byte-exact (the four gate
streams hash identically at 1, 4 and 16 threads):

1. `edge_params`' transform-alignment test was `coord % cur_tx`, a hardware
   `divl` whose result test carried 10.7% of the function's samples;
   `cur_tx` is a power of two, so it is a mask. -0.29% instructions.
2. That gate rejects most 4-pixel edge groups, so it is now inlined into the
   deblock loops and only survivors pay the call and the register-spilling
   prologue of `edge_params_body`. -1.83%.
3. The AVX2 kernel's wide-filter rows took their weights as slices, leaving a
   branch and a weight load per tap (`testl`/`je`/`movzwl` were 34% of the
   kernel's samples): `filter6`/`filter8` rows are unrolled with const
   weights, and `filter14`'s twelve rows become a running sum over the
   constant row-to-row deltas (168 tap operations -> 44). -1.50%.

seg4k at one thread: 553.30 -> 533.44 G instructions:u (-3.59%); the deblock
share of the 4K profile falls from ~7.3% to ~6.0% and the kernel itself from
4.00% to 2.52%. `deblock_simd_kernel_matches_the_scalar_filter` already pins
the kernel against the scalar `filter_edge` at 8/10/12-bit over every length,
level and sharpness.
perf(av1): fuse the inter vertical pass's rounding into its kernelAhmet Kaan Gümüş · 209d003
perf(av1): fuse the inter vertical pass's rounding into its kernel

The vertical pass stored a row of unrounded `i32` sums to a scratch
buffer that the very next loop read back to round, clamp and narrow to
the block's `u16` samples. The sums never need to reach memory:
`packus_epi32` IS the clamp's lower half (a negative sum saturates to
zero) and `min_epu16` its upper, so `round2(sum, InterRound1).clamp(0,
max)` is two instructions on the register the taps were accumulated in.

`vpass_row` keeps its unrounded form for the compound intermediate and
for restoration's wiener pass, whose roundings differ.

-1.7% instructions on the 4K segment (532.7 -> 523.7 G at one thread),
-5.3% cumulative for the lane; all four gate hashes unchanged.
perf(av1): 16-bit motion-compensation intermediate, vertical pass on maddAhmet Kaan Gümüş · ad664df
perf(av1): 16-bit motion-compensation intermediate, vertical pass on madd

The separable inter filter kept its horizontal output in `i32`, so the
vertical pass spent one `mullo_epi32` per tap per 8 columns and moved
twice the bytes it had to. The intermediate provably fits `i16` at the
bit depths this decoder accepts -- a phase's positive taps sum to at
most 156, so `Round2(1023 * 156, 3)` is 19948, and 12-bit (where
`InterRound0` itself changes) is refused in stream.rs. With the buffer
narrowed, a row PAIR interleaved by `unpack_epi16` is exactly
`madd_epi16`'s shape: two taps of 16 columns per instruction.

The horizontal kernels store through `packs_epi32`, whose saturation is
unreachable on a motion-compensation path (the new
`horizontal_intermediate_fits_i16` enumerates every filter kind, table
and phase to prove it) and composes with the wiener clamp on the
restoration path, whose bounds are inside `i16` at 8- and 10-bit.

-3.7% instructions on the 4K segment (553.2 -> 532.7 G at one thread);
all four gate hashes unchanged.
perf(av1): monomorphise the inverse DCT per size, take the column pass eight columns at a time, skip all-zero transform unitsAhmet Kaan Gümüş · 484b7c3
perf(av1): monomorphise the inverse DCT per size, take the column pass eight columns at a time, skip all-zero transform units

The inverse transform was ~10% of a 4K decode. Three measured steps, all
byte-exact (12/12 gate hashes at 1/4/16 threads unchanged):

- the spec's one generic butterfly network is now monomorphised on
  `N = log2(size)`, so every size guard, every `brev` fold and every
  butterfly angle is a compile-time constant instead of per-call work
  (-1.03%);
- the column pass runs eight neighbouring columns through one network
  (a `Lane` trait with an `i32` and an `[i32; 8]` impl, so the network
  itself is still written once), turning the strided per-column gather
  into a contiguous load (-2.67%);
- 60% of the transform units on the 4K perf segment carry no coefficient
  at all (3.46M of 5.7M, measured with a temporary histogram): a zero
  level grid dequantizes to zero and inverse-transforms to zero, so one
  scan replaces the dequantization and both passes (-1.55%).

Together 559.05 -> 530.19 G instructions:u at one thread on the 4K
segment, -5.16%.

Two steps measured flat and are not here: compiling the eight-wide
network a second time with AVX2 enabled (LLVM emits the same scalar code
either way -- the i64 butterfly products do not vectorise, so an
explicit vpmuldq kernel is the remaining lever), and an in-place
bit-reversal permute.
test(av1): pin Option<MiInfo> at 32 bytes or lessAhmet Kaan Gümüş · 4bb9310
test(av1): pin Option<MiInfo> at 32 bytes or less

The 4K mi grid is ~518k cells refilled per frame and walked by every mv-stack
scan, so a widened field here is a measurable throughput regression rather
than a free change.
perf(av1): coefficient reading -- buffered msac bit window, static scan tables, no per-block level allocationAhmet Kaan Gümüş · 8841aa8
perf(av1): coefficient reading -- buffered msac bit window, static scan tables, no per-block level allocation

The frame thread's coefficient path paid four avoidable costs per transform
block, all bit-exact to remove:

* every symbol's renormalisation assembled five bytes out of the payload and
  shifted twice; `SymbolDecoder` now keeps a 64-bit window refilled once per
  eight bytes (`bulk_bit_reads_match_the_per_bit_form` still pins `f(n)`
  against the per-bit form, through the new `seek_bits`);
* `symbol_fixed`/`symbol`/`f`/`update_cdf` were out-of-line across codegen
  units, and the CDF walk indexed a slice the bounds checker could not see
  the end of -- inlined, and the walk iterates instead;
* `default_scan` allocated a `Vec` and regenerated the whole anti-diagonal
  walk on every block: one table per side (4/8/16/32), built once;
* `read_coeffs` divided by the transform side per coefficient (always a power
  of two) and allocated its level buffer per block.

instructions:u on the 4K segment at one thread: 570.76 G -> 559.11 G (-2.0%).
All 12 gate hashes unchanged at 1/4/16 threads; lib suite 500 passed, 27
ignored.
perf(av1): mi-grid writers fill whole rows and MiInfo carries u8 block sidesAhmet Kaan Gümüş · 77576dd
perf(av1): mi-grid writers fill whole rows and MiInfo carries u8 block sides

The mode-info bookkeeping the parse thread runs per coded block wrote its
grids one 4x4 cell at a time, each write a bounds check: `fill_lf_grid_rect`
(6 grids), `fill_skip_grid_rect` (4), `record_uv_mode_mi`, `record_mi_rect`
and `record_inter_rect_mi`. A mi rect's cells are contiguous inside one grid
row, so each of those rows is one `fill_span` -- same cells, same values,
including the out-of-range drop the per-cell `get_mut`/`break` did.

`record_mi_rect`'s per-cell `array::from_fn` predicate is monotone in the
plane bound (`bound[1] == bound[2] >= bound[0]`), so the left/above neighbour
state is three contiguous runs, not a branch per cell.

`MiInfo::size`/`size_h` are 4x4-cell counts that never exceed 32; as `u8`
they take `Option<MiInfo>` from 48 to 28 bytes, shrinking both the per-frame
grid fill and the mv-stack scans' cache footprint.

Byte-exact: all 12 gate hashes unchanged. instructions:u on the 4K segment
570.74 G -> 565.02 G (-1.00%).
perf(av1): the output crop and the post-deblock snapshot stop copying whole planesAhmet Kaan Gümüş · 36f0c53
perf(av1): the output crop and the post-deblock snapshot stop copying whole planes

Two bulk copies on the frame thread's serial tail, both of them avoidable:

* The output crop rebuilt every plane row by row whenever the padded
  coding surface was bigger than the visible frame. A 4K 3840x1608 frame
  is superblock-aligned in WIDTH and padded only in HEIGHT, so its padded
  buffer's stride already equals the visible width and the "crop" is a
  pure truncation of the buffer we already own. `crop_owned` takes the
  plane by value and truncates in that case, falling back to the old
  row-by-row copy for a genuinely narrower plane.

* The post-deblock snapshot loop restoration reads cloned all three
  planes. Spec 7.17.2's stripe boundary substitution only ever reads the
  two rows above and the two below each interior stripe boundary
  (`restoration::lr_src_row` resolves every out-of-stripe row to
  `stripe_v_start-1/-2` or `stripe_v_end/+1`), and stripes are
  `64 >> ss_y` rows offset by `RESTORATION_UNIT_OFFSET`, so the snapshot
  now copies 4 rows in 64 into a pooled buffer whose other rows keep a
  previous frame's samples -- initialised values no reader reaches.

Byte-exact: seg1080/seg4k/seg4k_lr/palette hashes unchanged at 1, 4 and
16 frame threads (the last with 4 filter + 2 recon threads).
perf(av1): remove four per-block allocation sites from the parse pathAhmet Kaan Gümüş · d4c852e
perf(av1): remove four per-block allocation sites from the parse path

lane-alloc. A tracking global allocator (new `alloc_probe` example: size
histogram plus a sampled backtrace per 512 allocations, with line numbers)
ranked the decoder's allocation sites on the 4K segment -- 83.6 M
allocations over 272 frames. Four of the top sites are removed here:

* `find_samples` built a `String` per warp block (`format!("{mi_row},
  {mi_col}")` plus the env snapshot's own `String` clone) to compare against
  an unset debug flag; the OBMC blend did the same for `EC_MCB`. Both now
  sit behind the per-call-site `env_flag!` load.
* `Edges::build` allocated four vectors per intra prediction (collect,
  grow, then a second buffer to prepend the corner); it builds each edge
  once, corner first. `directional`'s two working buffers were a copy of
  those same vectors, so it takes the `Edges` by value instead.
* `obmc_neighbour_pred` allocated its prediction buffer per neighbour per
  plane; the caller now keeps one buffer per plane for the whole block.
* The MV stacks and the OBMC neighbour lists are capped (8 entries /
  `max_neighbors`), so they reserve once rather than growing and memcpying
  up to four times.

seg4k at one thread: 601.657 -> 599.329 G instructions:u (-0.39%, perf stat
-r 3). Reverting only the reserve step measured 600.014 G, so it stays
despite raising the raw allocation COUNT (an empty stack now allocates):
the saved reallocation memcpys outweigh the extra tcache hits.

Byte-exact: sha6t hashes equal the reference for all four streams at
threads 1, 4 and 16 (the last with FILTER_THREADS=4 RECON_THREADS=2).
perf(av1): film grain noise rows take the whole block in one AVX2 callAhmet Kaan Gümüş · 4786458
perf(av1): film grain noise rows take the whole block in one AVX2 call

The 32x32 grain block is 30 luma / 15 chroma samples wide once the
2-column overlap is cut off, so the per-row AVX2 kernels paid their
10-broadcast prologue once per row and handed the `30 % 8 == 6` /
`15 % 8 == 7` remainder to the scalar loop -- half of every chroma row.
That is why `chroma_noise_row_scalar` outweighed the AVX2 kernel it was
supposed to be the fallback of.

The row loop moves inside the kernels (`luma_noise_rows` /
`chroma_noise_rows`, strides and a row count), so the prologue is paid
once per block, and the remainder takes a 4-wide SSE step before the at
most 3 scalar samples. The row-level entry points stay as thin wrappers
for the tests that pin them against the scalar reference.

seg4k at one thread: 601.754 G -> 585.462 G instructions:u (-2.7% of the
whole decode, a quarter of film grain's 65 G). Byte-exact: all four gate
hashes unchanged at 1 and 4 threads.
perf(av1): sgrproj box sums in i32 over a contiguous row, (A,B) map under AVX2Ahmet Kaan Gümüş · 9c6f09f
perf(av1): sgrproj box sums in i32 over a contiguous row, (A,B) map under AVX2

`compute_ab` fetched every window sample through `lr_sample` -- a
stripe-boundary decision plus a column clamp per element -- and carried
both box sums as `i64`. A sample is at most `2^bd - 1 <= 4095`, so the
widest window sum of squares is `25 * 4095^2 == 419M`: the sums fit `i32`
with room to spare, and the column clamp is a pure function of the
column, so one contiguous per-row copy with the plane edge replicated
serves the whole accumulate pass branch-free.

On top of that the per-grid-point `(A[k], B[k])` map -- the part a
previous lane measured as the real cost -- becomes a straight-line pass
over two row arrays, so it runs eight points at a time under AVX2:
lane-wise the same arithmetic, with the only two products that exceed 32
bits (`p * s` and `(256 - A) * one_by_x * b`) formed in 64-bit even/odd
halves and packed back after their rounding shift, and `av1_x_by_xplus1`
read by gather. `ab_point` stays the scalar reference for the tail and
for every non-AVX2 target.

Byte-exact: all four gate streams hash identically to the parent at 1 and
4 threads. instructions:u on the 4K restoration segment 602.650 G ->
597.501 G (-0.86%; -0.29% from the sums, -0.57% from the AVX2 map).
perf(av1): recon workers pick per superblock ROW, not raster orderAhmet Kaan Gümüş · bdf81cd
perf(av1): recon workers pick per superblock ROW, not raster order

At EC_AV1_RECON_THREADS > 1 the wavefront handed out jobs from one FIFO in
raster order, so N workers popped N CONSECUTIVE superblocks of the SAME
row -- which the wavefront rule serialises (a job waits on its own left
neighbour). The workers then all blocked on one dependency chain and the
tile ran near-serial: 4 workers, 155% CPU, 1.23x.

The queue is now per superblock row and a worker takes the lowest row whose
front job's dependencies are met, which is the only job of that row that can
be runnable; deadlock-freedom is unchanged (the globally oldest job is always
runnable once no worker is active). EC_AV1_WAVE_STATS=1 dumps the per-worker
busy/wait/jobs accounting, the parse-thread time between submits and the
barrier/drain waits, cumulatively, on every tile.

seg4k (frame,filter,recon)=(1,1,4): 24.43 s -> 22.90 s, the parse-side
barrier wait 1917 ms -> 123 ms over the same 6712 barriers. All 12 sha6t
hashes exact at (1,1,1), (1,1,4) and (16,2,2).
refactor(av1): name the pool worker threads by submitting class; drop two dead recordersAhmet Kaan Gümüş · 9a4d798
refactor(av1): name the pool worker threads by submitting class; drop two dead recorders

The persistent pool is thread-local and shared by every class a thread
submits, so a worker's name is the class that grew the pool for it:
`ec-av1-frame` (stream.rs), `ec-av1-recon` (the tile wavefront) and
`ec-av1-filter` (par::run_bands), plus its index. The test-only ffmpeg
and aomenc stdin writers in decode.rs/stream.rs get names too.

Also deletes `push_intra_owned`/`push_mc_rect_owned`, dead since the
wavefront lanes, and replaces a `drop` of a `Copy` `Shared` in
film_grain.rs with `let _ =`, which was the last ec-av1 warning.

Byte-exact: the four perf6 inputs hash unchanged at default and at
(6,2,4) threads.