forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 14f4482798ce82c4e41c6a9c6a047c36d3ad3df0

2026-09-05

perf(av1): answer 'this unit coded nothing' by pointer, not by scanning its gridAhmet Kaan Gümüş · 7002e78
perf(av1): answer 'this unit coded nothing' by pointer, not by scanning its grid

The zero grid is now shared (previous commit), so is_zero_grid recognises it
with one pointer compare. The dequantizer's all-zero test and the neighbour
state's cul_level sum both walked the whole grid for the 60% of transform
units that code no coefficient -- the sum has no early exit at all.
-1.2% instructions:u at 1 thread, -0.7% at (16,4,2); byte-exact.
perf(av1): two-stage reference promises default OFF -- byte-exact, but the overlap is too short to payAhmet Kaan Gümüş · 4231093
perf(av1): two-stage reference promises default OFF -- byte-exact, but the overlap is too short to pay

Measured, not assumed. An inter tile parses 4.2% of its own length before its
first `ref_planes` call (seg4k, 272 frames, 16/4/2, instrumented first-touch
timer) because the 8x8-leaf, OBMC and sub-8x8-piece predictions build INLINE
on the parse thread -- only the 16x16-and-bigger blocks go to a recon worker.
So a consumer overlaps ~3 ms of its parse plus its 1.2 ms setup with a
producer tail of ~7 ms per chain frame. The chain report shows exactly that:
the segments now sum to 108% of the chain instead of 101% (the tail IS
overlapped), while the chain itself is unchanged (5621.7 ms vs 5547.2 ms) and
the wall does not move (seg4k at (16,4,2): base 5143/5337/5350 ms vs
5244/5738 ms; at (6,1,1): base 10498/10635/11232 vs 10128/10309/11747).

The machinery stays -- it is byte-exact on all four gate configs and the six
film cuts, and it is the half of the lever that is hard to build. It pays
once the 8x8-leaf/OBMC/sub-8x8 predictions are deferred to the recon workers
too; until then `EC_AV1_TWO_STAGE=1` enables it and the default publishes a
frame's meta after its filters, as before.
perf(av1): coefficient readers return the shared zero grid instead of a fresh VecAhmet Kaan Gümüş · f969486
perf(av1): coefficient readers return the shared zero grid instead of a fresh Vec

read_coeffs/read_coeffs_rect now return the existing Grid enum: an all-zero
transform unit (60% of the 4K segment's) names ZERO_RESIDUAL instead of
allocating and memsetting its own side*side Vec, and the coded corner's
zero-extension (extend_corner) keeps that when nothing was coded. read_plane,
read_inter_plane, read_inter_plane_rect and read_inter_luma8 return Grid, so
nine Grid::Own(read_*(..)) wrappers and every skipped-arm vec![0i32; ..]
collapse to Grid::Zero. Residual::coeffs recognises the shared grid by pointer
instead of scanning it.
test(av1): the inter-block gates take the reference bank as a RefPix handleAhmet Kaan Gümüş · 386b506
test(av1): the inter-block gates take the reference bank as a RefPix handle

Same reference pictures, reached the way the decoder now reaches them.
perf(av1): inline the temporal-MV probe and shrink the tpl cell, -0.4% parse instructionsAhmet Kaan Gümüş · ac23155
perf(av1): inline the temporal-MV probe and shrink the tpl cell, -0.4% parse instructions

The mv-stack builders' temporal-MV sample was a closure LLVM would not
inline into either builder (both far past its size threshold), so it was
emitted as a real function -- find_mv_stack_with_sign_bias::{closure#1}
and find_mv_stack_compound::{closure#1}, together 3.5% of the parse
thread -- and every one of the up-to-19 probes per inter block paid a
call plus the argument shuffle. Making it an #[inline(always)] free
function with the EC_TRACE_TPL dump split off #[cold] removes both
symbols (-0.26% instructions).

motion_field_projection re-derived two of libaom's three pos_valid terms
for every one of a 4K field's 129600 cells per direction although
neither depends on the cell; they are now one early return and one
per-ref table, and the cell walk reads contiguous row slices instead of
a bounds-checked accessor (-0.13%).

The projected tpl cell dropped its Option tag: the projection only ever
stores a strictly positive ref_frame_offset, so 0 already is libaom's
own 'never projected' marker, and the tag cost 8 bytes per cell (20 vs
12) over a field that is 2.6 MB at 4K.

Byte-exact: 12/12 gate hashes at 1, 4 and 16 threads.
perf(av1): narrow the mode-info publish surface -- palette colours only from palette blocks, (u16,u8)/u8 edge mapsAhmet Kaan Gümüş · ce0464d
perf(av1): narrow the mode-info publish surface -- palette colours only from palette blocks, (u16,u8)/u8 edge maps

The parse thread stamps every block's mode info into the per-mi neighbour
bands, and a large part of what it wrote was width, not information:

* `record_palette_y_rect`/`record_palette_uv_rect`/`record_strip_palette`
  wrote 16 bytes of base colours per mi per side for EVERY block, palette
  or not. Spec 5.11.46 `get_palette_cache` (and the palette-mode ctx)
  reads a neighbour's colours only where its size is non-zero, so a
  size-0 stamp can leave the previous colours untouched; only the size
  has to be published.
* `sub8_mode_col`/`sub8_mode_row`/`uv_mode_col`/`uv_mode_row` held
  `(usize, usize)` = 16 bytes for an mi index and a mode: now `(u16, u8)`
  = 4, sentinel `u16::MAX` (an mi index cannot reach it -- the largest
  legal frame is 65536 px = 16384 mi).
* `above_side_mi`/`left_side_mi` and the four palette size bands were
  `usize` for values that never exceed 128 resp. 8: now `u8`.

Measured on the 4K segment, instructions:u (deterministic, +-0.00%),
ABBA-interleaved against the base build:
  palette colours   398.257 -> 398.018 G (1 thr)   403.16 -> 402.93 G (16,4,2)
  (u16,u8) maps     398.019 -> 397.823 G           402.92 -> 402.70 G
  u8 side/palette   397.825 -> 397.742 G           402.72 -> 402.69 G
  total             -0.129% (1 thr)                -0.115% ((16,4,2))
Task-clock was not usable this round (loadavg 7-20 throughout).

Byte-exact: all 12 gate hashes (seg1080/seg4k/seg4k_lr/palette witness at
1, 4 and 16/4/2 threads) unchanged.

Also drops two stale notes on `above_ref1`/`left_ref1` claiming no decode
path ever produces a compound block: audited this round, compound blocks
do occur, `record_compound_ctx_rect_mi` fills the array correctly and six
context sites read it. Code was right, the comments were not.
perf(av1): two-stage reference promises -- meta at the tile boundary, pixels after the filtersAhmet Kaan Gümüş · b8ec726
perf(av1): two-stage reference promises -- meta at the tile boundary, pixels after the filters

A consumer frame used to wait for its references' FILTERED pixels before it
could start: the tile decoder built the reference `PlaneBuf`s at frame entry,
so the borrow existed from the first block even though the first pixel READ
comes later. Measured on a 4K stream (272 frames, 16/4/2): an inter tile
parses 4.2% of its own length before its first `ref_planes` call, and the
producer tail a consumer waits through (recon tail + filters + publish) is
8.2% of the decode chain.

So a reference slot is published in two stages. Stage 1 -- end-of-tile CDFs
(spec 7.20's `save_cdfs`, shared with the frame's own slot store), segment
map, motion field and picture size -- is fulfilled the moment the last tile
symbol is read, before the filters run; the motion field moves up with it
(it is built from the mode-info grid, no pixel). Stage 2 is the filtered
picture, fulfilled where the single promise was fulfilled before. A consumer
waits stage 1 for setup and carries a `RefPix` handle into the tile decoder,
which serves reference SIZES (`mc::scale_factor`) from stage-1 metadata and
waits stage 2 at the first `ref_planes` call.

DEADLOCK: unchanged in shape. Both stages of a producer are fulfilled by the
producer itself and wait on nothing but its own decode; every wait still
points from a later coded frame to an earlier one, so the wait graph is the
reference DAG. A failing frame now fails BOTH promises.

`EC_AV1_TWO_STAGE=0` restores the old publish point (meta after the filters).
perf(av1): an intra transform unit no longer clones its coefficient gridAhmet Kaan Gümüş · ad3e7b0
perf(av1): an intra transform unit no longer clones its coefficient grid

read_plane returned residual_grid_placeholder(&levels, side) -- a to_vec of
the whole coded grid -- on the tx_side == side arm, and the levels Vec
itself on the other; both arms are the same value, so the copy was pure
waste per intra transform unit. Byte-exact: 12/12 gate hashes at 1/4/16
threads.

instructions:u on the 4K segment: 396.613 G -> 396.536 G at 1 thread,
401.464 G -> 401.371 G at (16,4,2) (the copy itself is memmove traffic
instructions:u barely sees).
perf(av1): coefficient context frame stores byte levelsAhmet Kaan Gümüş · 8a8b3ca
perf(av1): coefficient context frame stores byte levels

read_coeffs/read_coeffs_rect kept their padded neighbour-context frame as
i32 although every level written there is a magnitude in 0..=15 (base <= 3
plus at most COEFF_BASE_RANGE from the br loop; the Golomb tail is added in
the sign pass, straight into the output grid). Storing u8 makes the
five-tap base_ctx/br_ctx sum a byte gather and drops the abs() the signed
frame needed. Byte-exact: 12/12 gate hashes at 1/4/16 threads.

instructions:u on the 4K segment: 398.293 G -> 396.613 G (-0.42%) at 1
thread, 403.145 G -> 401.464 G (-0.42%) at (16,4,2).
perf(av1): decode_probe skips the u16->LE conversion when the sink is /dev/nullAhmet Kaan Gümüş · 459c34c
perf(av1): decode_probe skips the u16->LE conversion when the sink is /dev/null

Timing runs point EC_PROBE_OUT16 at /dev/null, yet every shown frame was
still flattened into a byte buffer and written. Compare the path string and
account the byte count directly instead; the real-output path keeps the exact
bytes, now filled by a chunked to_le_bytes loop rather than a per-sample
FlatMap extend.
feat(av1): EC_AV1_TIMELINE -- per-frame decode timeline + critical-path reportAhmet Kaan Gümüş · 9cdd364
feat(av1): EC_AV1_TIMELINE -- per-frame decode timeline + critical-path report

Two lanes pipelined the loop filters per superblock row and recovered 2.3%
wall although the filters were 19% of frame-thread time; nobody had measured
the actual critical path. `EC_AV1_TIMELINE=1` records ~10 timestamps per
coded frame on one monotonic clock -- submit, worker start, each reference
slot wait (with the producing frame, so the DAG has real edges), header
setup, tile parse, wavefront drain, filters, slot publish, grain, output --
plus every block of the dispatcher at the in-flight bound, and dumps them as
TSV at stream end. `scripts/av1-timeline-report.py` reports phase medians,
the reference waits, the work-weighted critical path through the DAG,
concurrency at 10 ms ticks (in-flight vs actually RUNNING) and the cap waits.

Measured at (16,4,2) on the 4K segment, 3 runs: wall 5.44 s, of which the
measured dependency chain is 4.96 s = 91%, and 90.8% of that chain is parse.
Only 2.9 frames are runnable at any instant while 18 are in flight, so the
dispatcher cap is never the bound (48 threads on the 1080p cut: 4.0 running,
no wall gain). The filters are 5.0% of the chain -- which is exactly the
2.3% the pipelining lanes could recover.

Off, this is one `LazyLock<bool>` load per event at frame granularity: eight
gate hashes byte-identical at 1 and 16 threads, instructions:u +0.056%
(gate 0.05%, wall -0.5%).
perf(av1): run the pipelined loop restoration as its own workerAhmet Kaan Gümüş · eca8ad9
perf(av1): run the pipelined loop restoration as its own worker

Serialised as a fourth step inside pipe_run's band loop, LR measured ~1%
slower than the whole-frame form (which at least spread its RU rows over
the filter pool). A second batch task, chained one CDEF band behind the
first through its own PipeSync, keeps it off the deblock/CDEF critical
path instead.
perf(av1): loop restoration joins the per-superblock-row filter pipelineAhmet Kaan Gümüş · 013daf3
perf(av1): loop restoration joins the per-superblock-row filter pipeline

Restoration-unit row r writes out rows v_start..v_end, reads post-CDEF
rows only inside that span and the post-deblock snapshot at most two rows
past v_end, so it is ready as soon as CDEF band (v_end-1)/64 is done --
the same pipeline iteration, right after that band's CDEF. The snapshot
condition ((v_end+1)/64 <= k-2) is implied, the two row indices being at
most one band apart.

apply_loop_restoration_plane grows an RU-row range; the whole-frame form
is unchanged and stays for the fallback path (superres, key frames,
EC_AV1_PIPE_FILTERS=0). Byte-exact on the 16 gate hashes.
perf(av1): memoise the deblocker's level LUT per plane and passAhmet Kaan Gümüş · 4dff42a
perf(av1): memoise the deblocker's level LUT per plane and pass

`EdgeCtx::new` builds `lf_level` over the whole (base level, ref frame)
domain -- 960 calls -- and the row pipeline builds an `EdgeCtx` per
superblock-row band instead of per frame, which turned ~20 builds a frame
into ~680 and cost +1.0% instructions:u on seg4k.

The table is a pure function of the frame's LoopFilterParams, the plane, the
pass and segment 0's own SEG_LVL_ALT_LF_* datum (the only thing `lf_level`
reads out of the FrameCtx at segment_id = 0), so it is memoised per thread
under exactly that key. seg4k at 16/(4,2): instructions:u 407.33 G -> 403.27 G,
i.e. back to the pre-pipeline 403.30 G.
test(av1): the clamp gate's candidate is far outside the frame but inside the spec's MV widthAhmet Kaan Gümüş · 3ec98b7
test(av1): the clamp gate's candidate is far outside the frame but inside the spec's MV width

lane-migrid: the fixture stored 100000 in a motion vector, which the spec
(and libaom's own int16_t `MV`) cannot represent; 30000 is still far past
this 16x16-px frame's clamp window, so the expected clamped value is
unchanged.
perf(av1): the frame's plane buffers are no longer zero-filled at the frame headAhmet Kaan Gümüş · f982308
perf(av1): the frame's plane buffers are no longer zero-filled at the frame head

The new frame's three plane buffers (25 MB at 4K) were allocated with
`vec![0u16; n]` at the very top of both frame decoders, serially on the
frame thread, before any tile work: 3.2% of frame-thread cycles spent in
memset on a surface the tile walk overwrites sample-for-sample.

`fresh_plane` hands out the same capacity uninitialised instead. The proof
that no unwritten sample reaches the output is `EC_AV1_PLANE_SENTINEL=1`,
which fills with 0xDEAD (above any legal clamped sample): the four gate
streams and the six film cuts hash identically with the zero fill, with the
sentinel fill and uninitialised, at 1, 4 and (16,4,2) threads.
perf(av1): the mi grid's cell is 16 bytes -- MiInfo motion vectors ride as i16Ahmet Kaan Gümüş · 3c15699
perf(av1): the mi grid's cell is 16 bytes -- MiInfo motion vectors ride as i16

`MiInfo` is written per 4x4 cell for every coded block and read by every MV
stack scan, so the cell's size is that scan's memory traffic. Both motion
vectors now ride as `i16` pairs, which is libaom's own `MV` (`int16_t row,
col`) and the spec's MV range, taking the cell (and `Option<MiInfo>`, whose
niche still lives in `is_inter`) from 24 bytes to 16 and the grid's index
arithmetic from a multiply to a shift. `mv32`/`mv16` widen/narrow at the
handful of producer/consumer sites; `mv16` debug-asserts the range.

`MiGrid::get`/`get_frame` return the cell by value now (16 bytes, one move)
instead of by reference.

Measured on the 4K segment, interleaved ABAB: instructions:u -0.03% at 1
thread and -0.09% at (16,4,2), task-clock:u lower in 3/3 threaded pairs
(-1.6%/-9.4%/-3.2%, box loaded, so the sign is the claim, not the size).
All 12 gate hashes unchanged at 1/4/16 threads.
perf(av1): run the loop filters per superblock row, pipelined behind reconstructionAhmet Kaan Gümüş · 7fd0e67
perf(av1): run the loop filters per superblock row, pipelined behind reconstruction

The frame's filters used to run only once the whole tile was parsed and
reconstructed: the tile loop ended, the wavefront drained, and then
apply_deblock / plane_snapshot / apply_cdef walked the whole picture on the
frame thread. With ~2.5 frames in flight the wall tracks that frame thread's
own latency, and the whole-frame filter stage is ~19% of it. dav1d and libaom
instead run the filters a few superblock rows behind reconstruction, so the
filter work overlaps the parse.

DEPENDENCY SHAPE (a band = 64 luma rows = one superblock row; derived from
this decoder's own whole-frame order: all vertical deblock edges, then all
horizontal ones, then CDEF, then superres, then loop restoration):

  * intra prediction of band r+1 reads the UNFILTERED bottom rows of band r,
    so no filter may touch band r until band r+1 is fully reconstructed:
    V(r) waits for ready >= r+2.
  * the horizontal edge at y = r*64 reads and writes 6-7 rows either side of
    the band boundary, so H(r-1)'s last edge reaches into band r, which the
    whole-frame order has already vertical-filtered. Running V(r) before
    H(r-1) reproduces that exactly.
  * band j's own bottom rows are still rewritten by H(j+1)'s first edge, so
    j's post-deblock snapshot may only be taken after H(j+1).
  * CDEF(j) reads the post-deblock picture 2-3 rows across its 64x64
    boundaries, i.e. bands j-1..j+1, so it runs after snap(j+1).

Iteration k therefore runs V(k), H(k-1), snap(k-2), CDEF(k-3), on the filter
pool, released by the frame thread at every superblock row start from the
wavefront's own per-row completion (WaveQueue now tracks the last column
parsed and the last job pushed per row, so a row that recorded no write still
counts as complete). Rows still pending at the end of the tile loop are
drained there; loop restoration, the superres upscale, motion field and grain
stay in the frame thread's tail, and LR reads the snapshot the pipeline built
band by band (whole rows when CDEF is on, else only the four rows per stripe
boundary plane_snapshot copied).

Kept whole-frame, and counted (EC_AV1_WAVE_STATS prints pipe=<pipelined>/<frames>):
superres frames (a whole-plane resample between CDEF and LR), segmentation
(the deblocker reads seg_ids while the parse thread is still filling it),
delta_lf, more than one tile COLUMN, every pixel-dump/stage-skip debug flag,
and the (1,1) thread setting -- where the filters would move to a worker
thread for nothing and the crate's thread_local gate counters would miss them.
EC_AV1_PIPE_FILTERS=0 forces the whole-frame path. Key frames keep it too:
only the inter tile decoder is wired.

Byte-exact: the 12-hash gate at 4 and at 16/(4,2) reproduces every reference
hash; seg4k reports pipe=272/272.
fix(av1): film grain panicked on a zero-row overlap block at the ragged tailAhmet Kaan Gümüş · 6b9fb3c
fix(av1): film grain panicked on a zero-row overlap block at the ragged tail

A picture whose chroma plane height is 16k+1 (luma height 32k+2) makes the
last block row's `half_h` zero under `overlap_flag` -- the single tail row IS
the overlap row, already written by the line-buffer call -- and the block's
row base `py0 * y_stride` then addresses one row past the plane, so slicing
it panicked with "range start index out of range". Spec 7.18.3.5 runs the
block's noise loops `for i in 0..h`, so a block with no rows (or no columns,
the 16k+1-wide twin) writes nothing: return before any slice is formed.

The new gate builds the noise image from an independent transcription of
7.18.3.4/7.18.3.5 (per-stripe horizontal overlap, stripe-to-image vertical
overlap) and compares 64x66, 66x64, 64x98 and a 48x100 control sample for
sample; it panics without the fix. The 12 decode hashes are unchanged.
perf(av1): one packed cell for the four skip/pu-edge mi maps, one pass for around_miAhmet Kaan Gümüş · dcb88a2
perf(av1): one packed cell for the four skip/pu-edge mi maps, one pass for around_mi

Block publication walked the same mi rectangle once per map. `skip`, its
written-instrument bit, and the covering block's origin and dims are written
by `fill_skip_grid_rect` and by nothing else, so they become one 8-byte
`BlkCell` and one fill per row instead of four -- the deblocker's `pu_edge`
also reads origin and dims off one cache line now.

`around_mi`/`around_mi_rect` gathered the neighbour coded/DC-sign state one
plane at a time, so the three planes of a cell (one `[Neighbour; 3]`) were
loaded three times; one pass over the cells accumulates all three.

Byte-exact: 12/12 gate hashes at 1, 4 and 16 threads. seg4k instructions:u
405.019 -> 402.414 G at 1 thread (-0.64%) and 408.299 -> 405.731 G at
(16,4,2) (-0.63%); task-clock at (16,4,2) 41.08 -> 40.78/41.03 s interleaved.
perf(av1): a plane that codes nothing names the shared zero grid instead of allocating oneAhmet Kaan Gümüş · 833833b
perf(av1): a plane that codes nothing names the shared zero grid instead of allocating one

`decode_inter_block` built its three block-level coefficient-level grids as
fresh `Vec`s (up to 64 KB for a 128x128 luma block) even when the plane coded
nothing at all -- a skipped block, a strip that is not the chroma reference,
luma under a var-tx split whose leaves already wrote their own contexts. The
three bindings become a `Grid` enum that derefs to `[i32]`: `Grid::Zero(n)`
points at the existing `ZERO_RESIDUAL` static, so those blocks allocate and
memset nothing, and the block-tail neighbour writes are byte-identical.

Two more per-block allocations go with it: the mu-chunk chroma collectors
(`u_units`/`v_units`) were allocated and zeroed by every var-tx block although
only a block above 64 px on either side ever writes into them -- they are now
filled in by the first unit that does; and the leaf loop's `vartx_leaves` list
is borrowed instead of cloned per block. The skipped luma/chroma units of the
intra var-tx path take the same zero grid.

Byte-exact: all 12 gate hashes (4 streams x 1/4/16 threads, the 16-thread arm
with 4 filter and 2 recon threads) equal the reference. instructions:u on the
4K segment 405.018 -> 402.630 G at 1 thread (-0.59%) and 408.381 -> 405.961 G
at (16,4,2) (-0.59%).

Measured and reverted: pooling the six compound-prediction intermediates per
thread was flat (-0.04% / +0.05%), and moving the sub-8x8 4x4 prediction
buffers to the stack was flat both ways -- those paths are cold on this stream.
perf(av1): the arithmetic reader takes its two-symbol shape straightAhmet Kaan Gümüş · 864a703
perf(av1): the arithmetic reader takes its two-symbol shape straight

Most symbols the tile reader reads are two-symbol: every flag, and every
bit of a literal, which coded its bit through the general alphabet walk
against a fixed equiprobable CDF. That walk set up a loop, tested two
candidates and multiplied out the `EC_MIN_PROB` floor to read one
boundary. `symbol_fixed` now computes that single boundary directly for
a two-symbol alphabet and `literal` reads its bits through the same
path, where the range multiply is a shift.

The general walk keeps its loop but stops one candidate early: the last
boundary is always `CDF_TOP`, whose interval end is zero, so the last
candidate needs no test and its arithmetic is the fall-through. The
`EC_MIN_PROB` floor counts down instead of being multiplied per
candidate. The renormalisation tail all three paths share is one
inlined helper.

Byte-exact: the four gate streams hash identically at 1, 4 and (16,4,2)
threads. A new lockstep test decodes 20k mixed symbols and literals
twice -- once through the fast paths, once through the spec-literal
8.2.6 walk kept in the test -- and compares the symbol, the adapted CDF
and the coder's (range, value) after every read.

instructions:u at one thread: 1080p 131.684 -> 131.442 G (-0.18%),
4K 405.018 -> 404.483 G (-0.13%). Cycles were not usable as a verdict
this session (box load ~15-35, base repeated to +-14% on cycles while
instructions repeated to 0.0002%).
perf(av1): film grain writes its output once, from the bandsAhmet Kaan Gümüş · 8db0d01
perf(av1): film grain writes its output once, from the bands

apply_grain cloned the whole clean picture on the frame thread and then
wrote the noise over the copy -- a serial 25 MB memmove per 4K frame
ahead of the parallel block-row walk. The grain bands already own a
partition of the picture's rows, so each band now copies its own rows
out of the clean source one block row AHEAD of the noise it adds to
them: the copy runs on the filter pool, the rows the kernels read back
are still in the core's cache, and the destination is allocated
uninitialised instead of cloned or zeroed.

Byte-exact: 12/12 gate hashes at 1, 4 and 16 threads, plus a real
film-cut decode at (16,4,2) hashing identical to the base binary. seg4k
at (16,4,2), 4 interleaved rounds: task-clock 48.50/47.07/46.62/45.34 s
base -> 46.44/45.12/45.74/44.76 s, -1.3..-4.2% every round; instructions
408.385 -> 408.404 G (flat); page-faults flat. At 1 thread task-clock
36.98 -> 32.41 s.
perf(av1): the wavefront's op list and prediction buffers are reused per blockAhmet Kaan Gümüş · e1f00c9
perf(av1): the wavefront's op list and prediction buffers are reused per block

`wave_submit` took the recorded op list and left a zero-capacity `Vec`
behind, so every superblock regrew it -- and memmoved every op already
recorded -- from nothing; it is now replaced sized for the next
superblock, exactly as the two arenas beside it already were.

A deferred prediction build returned three fresh `Vec<u16>` per block
and dropped the previous three; the build now refills the buffers the
worker already holds (`refill`, which still allocates zeroed when the
buffer has to grow, since `calloc` beats an element-wise resize).

Byte-exact 12/12 at 1/4/16 threads. seg4k instructions:u at (16,4,2)
409.809 -> 408.259 G (-0.38%); at 1 thread 404.579 -> 405.005 G
(+0.11%, the inline path has no previous buffer to reuse and pays the
plumbing) -- kept for the threaded config the 4K target names.
perf(av1): skipped blocks stop allocating and copying their zero coefficient gridsAhmet Kaan Gümüş · bccf2c8
perf(av1): skipped blocks stop allocating and copying their zero coefficient grids

A skipped block handed every consumer a freshly heap-allocated all-zero
level grid -- up to 64 KB per block, three of them for the neighbour
record and one per plane for the recorded write. Those buffers are
read-only at every consumer, so they are now the existing static
`ZERO_RESIDUAL` slice: `Neighbours::record*` takes `&[&[i32]; 3]`
instead of owning Vecs, and the 53 `&vec![0i32; n]` argument
temporaries index the static instead.

`Residual::done` recognises that slice by pointer and records the
all-zero marker `Done(0, 0)` (the one `Residual::coeffs` already
produces), so a skipped block no longer copies its zeros into the
coefficient arena either.

Byte-exact 12/12 at 1/4/16 threads. seg4k instructions:u 414.794 ->
409.809 G at (16,4,2) (-1.2%), 406.145 -> 404.579 G at 1 thread
(-0.39%); page-faults 1.034 -> 1.014 M at (16,4,2).
perf(av1): padded coefficient level buffers, stack-allocated rect levelsAhmet Kaan Gümüş · 3fdf4ac
perf(av1): padded coefficient level buffers, stack-allocated rect levels

read_coeffs / read_coeffs_rect pad their level buffer the way libaom's own
does (TX_PAD_HOR/TX_PAD_VER): a fixed stride of side + 4 columns and four
spare rows, all zero and never written, so the five neighbour reads
base_ctx/br_ctx make per coefficient index the buffer unconditionally
instead of running the row >= side || col >= side edge test. The rect
reader's per-unit heap vec![0; w * h] becomes a stack frame sized to the
padded unit, and its pos / w, pos % w a shift and a mask.

Byte-exact: 12/12 gate hashes at 1/4/16 threads. instructions:u on the 4K
segment -0.53% at one thread (412.376 -> 410.195 G) and -0.51% at
(16,4,2) (422.503 -> 420.353 G).
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): the saved motion field builds off the frame thread, one other-side table per frameAhmet Kaan Gümüş · 259f3b7
perf(av1): the saved motion field builds off the frame thread, one other-side table per frame

`build_motion_field` (libaom `av1_copy_frame_mvs`) was a serial whole-frame
4x4-unit pass on the frame thread that re-evaluated the `other_side`
order-hint comparison for every reference slot of every inter unit.

Two changes, both output-identical:

* the per-reference `other_side` answer is a `[bool; 8]` computed once per
  frame instead of two `get_relative_dist` calls per inter unit;
* the pass is split into cell-row bands over the filter pool with the
  existing `par::bands`/`Shared`/`run_bands` pattern. An 8x8 motion-field
  cell lives entirely in one cell row, so a band owns `cells[r0 * cols..r1 *
  cols]` and no two bands ever touch the same cell -- the write order inside
  a band is unchanged, so the "last qualifying slot wins" and
  "clear-then-maybe-write" semantics are preserved exactly.

The field is consumed only by LATER frames, never by this frame's entropy
decode; it is published as part of `SlotValue` at `SlotPromise::fulfil`, so it
cannot be deferred past the fulfil without splitting that publication.

seg4k, 4dc14f52 -> here: instructions:u 412.358 -> 410.565 G at 1 thread
(-0.44%, the hoist alone -- bands collapse to 1 at FILTER_THREADS=1) and
421.45 -> 419.13 G at (16,4,2) (-0.55%). All 12 gate hashes unchanged at 1, 4
and 16 threads.
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).