forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 5c8eff8ca5a0d547bfb22a690b3f7afb373da607Filtered to crates/ec-av1/src/stream.rsClear filter

2026-09-12

fix(av1): the raw-tile inter decode wrapper takes the frame's own reduced_tx_set instead of guessing true -- the widened inter search made the bit chroma-relevant (a screen GOP's inter luma takes V_DCT and the chroma inheritance reduces against this exact bit, so the GOP round-trip tests desynced and surfaced the empty-ref-slot refusal), Encoded carries the bit and the GOP and key-frame tile tests pass it; encoder output is byte-identical (witnesses re-run at 8143/8211 bytes), the three tests plus pins are green and the full three-lane suite reads 592 passed / 0 failedAhmet Kaan Gümüş · 9c0a4a2
fix(av1): the raw-tile inter decode wrapper takes the frame's own reduced_tx_set instead of guessing true -- the widened inter search made the bit chroma-relevant (a screen GOP's inter luma takes V_DCT and the chroma inheritance reduces against this exact bit, so the GOP round-trip tests desynced and surfaced the empty-ref-slot refusal), Encoded carries the bit and the GOP and key-frame tile tests pass it; encoder output is byte-identical (witnesses re-run at 8143/8211 bytes), the three tests plus pins are green and the full three-lane suite reads 592 passed / 0 failed

2026-09-08

test(av1): the seven encode-then-decode stream gates take the encoder's own superblock sizeAhmet Kaan Gümüş · 8ef9abd
test(av1): the seven encode-then-decode stream gates take the encoder's own superblock size

Each built a plain FrameCtx (superblock 64) and handed it to
encode_*_with_ctx, so under EC_AV1_SB128=1 the writer coded a 128 root
while the encoder's own trial decode -- and the raw tile decode beside it
-- read at 64. First divergent symbol on the key-frame gate at 216x96:
index 33, the writer's 8-symbol partition_w128 (SPLIT), which the reader
skipped straight past into the 10-symbol partition_w64. The other six
surfaced as the arf refusing a reference slot inside the encoder's trial
decode. Same class the lane-b128 merge swept through ten of their
neighbours; these seven were the rest of it.
test(av1): a witness that builds an SVT-AV1 screen stream whose palette map is cut by the frame edgeAhmet Kaan Gümüş · 7fc807b
test(av1): a witness that builds an SVT-AV1 screen stream whose palette map is cut by the frame edge

docs(av1): lane-svtinter report
fix(av1): a skipped palette block with a split transform predicted DC off its edgesAhmet Kaan Gümüş · 1edcdab
fix(av1): a skipped palette block with a split transform predicted DC off its edges

A square intra block that is SKIPPED predicts its whole side x side luma in
one call; the palette (and intrabc) prediction override was armed only when
the transform covered the whole block, so a 16x16 palette block with
tx_depth == 1 and skip == 1 fell back to edge prediction. Right symbols --
the whole mode ladder diffs clean against an instrumented aomdec -- wrong
pixels: 812 luma samples in the key frame of an SVT-AV1 preset-8 screen
stream, carried by the V_PRED blocks under it to 10122 over 12 frames.

Sibling paths (decode_leaf8, decode_rect_split, the intra-in-inter walk)
already arm on both arms; this was the one site left.

Gate rides the kept stream via EC_AV1_SVT1_STREAM (SKIP when unset), asserts
the fixed arm fires, and adds EC_AV1_DEBUG_SKIP_LR beside the deblock/CDEF
debug rungs for the stage bisect.
test(av1): the straddle gate's SEG_LVL_ALT_Q rows are generated by recipe, not two uncommittable film cropsAhmet Kaan Gümüş · 29e03fe
test(av1): the straddle gate's SEG_LVL_ALT_Q rows are generated by recipe, not two uncommittable film crops

The two pinned .obu files were crops of a real film in the gitignored shared
fixtures dir, so the half of the gate that actually saw the rect dequant
defect SKIPped on every fresh clone. Replaced by a synthetic lavfi source --
half flat grey, half heavy noise -- encoded by libaom -aq-mode 1, whose
activity segmentation gives segments with distinct quantizers; the new
decode::block_q_span() counter asserts that property so the row cannot go
blind. Sensitivity re-measured: with e4cab216's six sites reverted the recipe
row fails at 384x152 crf 20, frame 0 plane U (160,64), 126 vs 123.
fix(av1): the key frame's 64x64 intra root at a superblock the frame edge cutsAhmet Kaan Gümüş · 3603580
fix(av1): the key frame's 64x64 intra root at a superblock the frame edge cuts

The root shipped behind two guards written from a desync report that does not
reproduce: the frame had to be a whole number of superblocks, and the
superblock wholly inside it. The first switched the whole feature off on any
arbitrary export size. Legality is now the spec's has_cols/has_rows pair, the
same the inter root and the tile writer already use, and the new
stream::tests::a_doubly_cut_superblock_root_round_trips_in_every_plane pins
Y, U and V of the reconstruction, our decoder and ffmpeg at four straddling
sizes (three cut on both axes), asserting the edge fire count first.

2026-09-07

fix(av1): two lossless INTER defects on screen content -- a skip 8x8 leaf restored the previous block's luma band, and a rect sub-8x8 intra leaf read one TX_4X8Ahmet Kaan Gümüş · 025c254
fix(av1): two lossless INTER defects on screen content -- a skip 8x8 leaf restored the previous block's luma band, and a rect sub-8x8 intra leaf read one TX_4X8

- decode_leaf8/decode_inter_block8: `saved_luma_ctx` is only valid on the arm that
  actually published per-TU luma state. A SKIP block publishes none, and on a lossless
  frame `read_block_tx_size` hands back 4x4 leaves for a skip block too, so the restore
  put the previous block's levels back over the zeros `record_mi` had written
  (libaom `av1_reset_entropy_context`). Class [[override-slot-on-one-arm]].
- decode_intra_sub8_leaf / decode_leaf_rect8 / the 16x4 rect4 reader: their
  `tx_depth != 0` split guards never fire on a lossless frame (no depth symbol is
  coded), so a 4x8/8x4 intra leaf read ONE rect transform where libaom codes two
  TX_4X4 -- the same widening the five other rect sites already carry.

Gate: a_lossless_libaom_inter_frame_decodes_sample_exact grows a 640x384
tune-content=screen -g 3 six-frame row (inter frames of screen content).
test(av1): the lossless inter gate gets two tune-content=screen key rowsAhmet Kaan Gümüş · c84128d
test(av1): the lossless inter gate gets two tune-content=screen key rows

The palette path is what caught the whole-block palette prediction being
handed to a 4x4 chroma unit, and nothing in the gate coded a palette block.
Screen rows are KEY-only: a screen INTER frame still desyncs (lane report).
feat(av1): lossless INTER frames decode -- the chroma plane is 4x4 units, plane-majorAhmet Kaan Gümüş · 5136c0f
feat(av1): lossless INTER frames decode -- the chroma plane is 4x4 units, plane-major

A lossless frame codes TX_4X4 on every plane (libaom read_tx_size returns
TX_4X4 before it ever consults max_txsize_rect_lookup), and
decode_token_recon_block walks a 64x64 mu chunk PLANE-MAJOR
(for (plane..) for (blk_row..) for (blk_col..)). The inter readers still
read chroma as one transform per block, so a lossless inter frame was
refused by name; they now walk the 4x4 units, and the refusal is gone.

Three defects the previous lane's gate could not see (its source had a FLAT
chroma plane, so every chroma unit coded one txb_skip symbol against
all-zero contexts -- class gate-blind-to-feature):

- decode_block read its chroma units interleaved U,V per unit instead of
  plane-major. Identical order at one unit per plane per chunk (every
  non-lossless case), wrong for a lossless block's 4x4 raster.
- decode_rect_split's lossless chroma branch stamped each unit's neighbour
  context and then let record_split_luma_rect_mi overwrite all of them with
  the LAST unit's state, so the next block read dc_sign_ctx 1 where libaom
  reads 0 (class override-slot-on-one-arm).
- decode_inter_sub8_rect2 kept one 8x4/4x8 luma transform on a lossless
  frame, which fed a rect grid to the 4x4 Walsh-Hadamard.

Gates: the key gate's source is now textured chroma, and
a_lossless_libaom_inter_frame_decodes_sample_exact replaces the retired
refusal gate with four libaom -crf 0 fixtures (256x128 8-bit, 192x96
10-bit, 320x192, 256x256 --sb-size=128), each sample-exact vs ffmpeg.
feat(av1): lossless key frames decode exact; lossless inter refused by nameAhmet Kaan Gümüş · 1e1a080
feat(av1): lossless key frames decode exact; lossless inter refused by name

Key/intra-only lossless frames decode sample-exact at 8 and 10 bit (64x64,
256x128 8-bit, 192x96 10-bit libaom -crf 0 streams, 0 sample diffs vs
ffmpeg). The inter path's luma leaves are synthesized as TX_4X4 but its
chroma plane is still one transform per block, so a lossless INTER frame is
refused by name and the refusal inventory carries it. The old refusal gate
becomes a_lossless_libaom_key_frame_decodes_sample_exact.
feat(av1): lossless decode groundwork -- WHT, TX_4X4 forcing, CfL narrowingAhmet Kaan Gümüş · f0a5a15
feat(av1): lossless decode groundwork -- WHT, TX_4X4 forcing, CfL narrowing

The 4x4 Walsh-Hadamard inverse (libaom av1_iwht4x4_16_add_c) with its own
round-trip test, a per-frame CodedLossless flag replacing the refusal (a
frame mixing lossless and lossy segments is still refused by name), the
TX_4X4 forcing in the square and 8x8-leaf intra readers, no tx_type symbol
(libaom read_tx_type: qindex 0 returns early), DCT_DCT on every plane, the
is_cfl_allowed narrowing to a 4x4 chroma plane block, and the +10 chroma
txb_skip rows at TX_4X4 that only a lossless frame reaches.
fix(av1): refuse lossless frames by name; the 128-intra-in-inter chroma context gateAhmet Kaan Gümüş · 2f8409b
fix(av1): refuse lossless frames by name; the 128-intra-in-inter chroma context gate
test(av1): the ladder decode assertion collects every failing reference point; the force_integer_mv fixture is sensitive againAhmet Kaan Gümüş · 5a13b43
test(av1): the ladder decode assertion collects every failing reference point; the force_integer_mv fixture is sensitive again
test(av1): pin the libaom screen stream whose sub-8x8 groups sit beside palette blocksAhmet Kaan Gümüş · 8d023ec
test(av1): pin the libaom screen stream whose sub-8x8 groups sit beside palette blocks

The stream whose key-frame block mi(76,88) exposed the stale palette bands:
without the fix all 12 frames differ from ffmpeg's decode from luma sample
491904 on. Synthetic 1920x1024 source, no film sample in fixtures.
test(av1): a synthetic 1920x1024 force_integer_mv gate, plus the lane reportAhmet Kaan Gümüş · fabb8ce
test(av1): a synthetic 1920x1024 force_integer_mv gate, plus the lane report

The gate builds its own source -- near-flat dark background (2..=4 luma values
per 16x16 block, libaom's own screen-content counting rule) with a textured
patch stepping 9 px every second frame, so half the frames are exact
duplicates of their predecessor, which is the only condition under which
`av1_is_integer_mv` returns 1. It asserts that libaom really coded an inter
frame with `force_integer_mv` and `use_ref_frame_mvs` before comparing all 12
shown frames against ffmpeg's own decode.

Reported honestly in lanes/dgolomb.report.md: this gate is currently BLIND to
the defect it was written for (stubbing the integer branch out still passes),
so the regression cover is the motion_field unit test whose values come from
the instrumented libaom oracle. The film-B ladder decodes sample-exact at
crf 20/35/45; crf 5 still desyncs on the key frame at mi(184,344).
feat(av1): a decode-side syntax census, and the film B vs rav1e table it producedAhmet Kaan Gümüş · 373b6a2
feat(av1): a decode-side syntax census, and the film B vs rav1e table it produced

The BD gate says our stream is bigger; it never says which syntax it is
bigger in. This adds a per-CDF-table bit accountant to the symbol decoder
(EC_AV1_BITCENSUS=1, one relaxed load per symbol when off) plus block, tx,
mv, mode and frame-header funnels, and an examples/syntax_census.rs that
prints one table per stream -- so our stream and rav1e's are measured by the
same reader.

lanes/census-filmB.md holds the answer for film B at matched PSNR: the whole
gap is in the inter frames (our key frame is the smaller and the worse one),
75% of it in the leaves, and the three mechanisms are the flat pyramid q
ladder, the missing 64x64 blocks and transforms, and a 52.5% vs 84.8% skip
share.
feat(av1): filter intra as an intra-search candidateAhmet Kaan Gümüş · b978eaa
feat(av1): filter intra as an intra-search candidate

Threads the sequence header's `enable_filter_intra` through the raw inter
tile decode entry points and the gates that decode the encoder's own tiles
(stale-header class: five hard-coded `false`s), writes
`filter_intra_mode_info` at all five intra write sites between the palette
colour lists and the colour-index maps, and offers the five recursive
filter-intra modes as RD-priced candidates after the mode/tx-depth/palette
searches. `EC_AV1_FILTER_INTRA=0` restores the previous streams.

2026-09-06

feat(av1): code the both-axes frame-edge cut as the spec's inferred splitAhmet Kaan Gümüş · 0e8b39f
feat(av1): code the both-axes frame-edge cut as the spec's inferred split

A 32x32 or 16x16 block whose true frame edge cuts BOTH axes reads no
partition symbol at all (spec 5.11.4: hasRows and hasCols both false =>
PARTITION_SPLIT inferred), down to the 8x8 leaves whose own mi origin is
inside the frame -- the same leaves the one-axis case already coded. The
encoder refused that geometry by name, claiming it needed a rectangular
HORZ/VERT transform; it needs none, and the refusal was a misreading of
the rule. Both writers now emit the inferred split, and the searches drop
their matching refusals.
fix(av1): never code a transform unit that starts outside the frameAhmet Kaan Gümüş · 683eca4
fix(av1): never code a transform unit that starts outside the frame

The writer's per-unit luma loop walked every unit of a block's transform
grid, including the ones a right-edge- (or bottom-edge-) straddling block
has entirely outside the frame. libaom clips that loop to
max_blocks_wide/high and decode.rs does the same, so the extra all_zero
symbols desynced the tile at the very next symbol: at 216x96 an odd-size
GOP's last block reconstructed a different V, and both libdav1d and
libaom refused the whole key frame.

Clip the loop to the frame's true mi_cols/mi_rows. The block-aligned byte
pins do not move (their clips have no straddling block); the ffmpeg GOP
gate now runs 216x96 as well, three-way exact against reconstruction.
fix(av1): clamp the pricer's committed context to the frame's true extentAhmet Kaan Gümüş · 088a162
fix(av1): clamp the pricer's committed context to the frame's true extent

Plane::commit_ctx published a straddling block's nz/DC state over the cells
past the true frame edge; the writer's own Neighbours::record_mi_planes
clamps to blocks_wide/blocks_high (spec av1_set_entropy_contexts, off the
true mi_cols/mi_rows, with libaom's round-up-even for a subsampled plane)
and leaves those cells uncoded, so the price read a neighbour the writer
never records.
merge main 1c844b01 (tile layout) into the palette laneAhmet Kaan Gümüş · eeee023
merge main 1c844b01 (tile layout) into the palette lane

Hand-resolved: the palette write sits inside the per-tile closures main's
TileLayout introduced, so `arm_screen` is armed per tile job beside
`arm_sign_bias`/`arm_reference_select`; the new plural
`decode_inter_frame_tiles_lr` takes this lane's `allow_screen_content_tools`
and the single-tile wrapper forwards it.
feat(av1): screen-content detection sets allow_screen_content_tools on a key frameAhmet Kaan Gümüş · 3136cbe
feat(av1): screen-content detection sets allow_screen_content_tools on a key frame

libaom's `av1_set_screen_content_options` shape (distinct colours per 16x16
luma block, blocks with 2..=4 of them covering more than a tenth of the
frame), run on the source luma before any header is built. When it fires the
sequence header carries the SELECT form of
`seq_force_screen_content_tools` and the key frame sets its own
`allow_screen_content_tools`; every intra block of that tile then codes the
two `read_palette_mode_info` flags (spec 5.11.46), both at ctx 0 and both
"no palette" -- the syntax a palette block will fire inside next.

A sequence with no screen content leaves the sequence bit at 0 and writes
exactly the stream it wrote before: the byte pins do not move.

Verified with the detector forced on (EC_AV1_SCREEN=1):
ffmpeg_decodes_exactly_what_the_encoder_reconstructed and
every_frame_of_a_sequence_decodes_through_our_own_decoder both pass, so the
new symbols are the ones libaom reads.
feat(av1): a frame's tiles are written in parallel on the crate's own poolAhmet Kaan Gümüş · 1878642
feat(av1): a frame's tiles are written in parallel on the crate's own pool

EC_AV1_TILE_THREADS workers (default 1) take bands of the frame's tiles;
each tile is written from the frame's own starting tables into its own slot,
so the bytes never depend on the thread count -- pinned by
tile_bytes_do_not_depend_on_the_thread_count at 2x1/1x2/2x2/4x2.
Merge branch 'main' (d5fc99e0) into lane-av1lrAhmet Kaan Gümüş · 8e2799a
Merge branch 'main' (d5fc99e0) into lane-av1lr

Nine hunks across three files, all taken both ways.

tile.rs: that lane split each writer into a `_tx` wrapper and a
`_cdfs` worker, so this lane's arm/clear guard moves down into the
worker, where the symbols are actually written.

decode.rs: `decode_inter_frame_tile_lr` now takes `initial_cdfs`
alongside `lr` and both wrappers thread it; the two chained-decode
tests pass this frame's own `loop_restoration` AND its `start_cdfs`.

encode.rs: the tile is written through the CDF-carrying writer, and
this lane's re-codes (for the `cdef_idx` literals and the per-unit
restoration syntax) each restart from the frame's OWN `start_cdfs`
rather than from where the first write left them -- the second tile is
the first tile's symbol sequence plus new ones, so it has to adapt from
the same point the decoder will. The winning re-code publishes its
end-of-tile tables into `next_cdfs`, which is what the next frame's
writer starts from; the first write's would have been stale.

Byte pins re-measured on the merged tree: q=150 7416 -> 7458 bytes,
q=60 27927 -> 27807.
test(av1): the hand-built GOLDEN fixture keeps its frames' CDF carry offAhmet Kaan Gümüş · 4db0da1
test(av1): the hand-built GOLDEN fixture keeps its frames' CDF carry off

Its two inter tiles are hand-coded from a fresh Cdfs, so their headers
must say so now that inter_frame_headers leaves
disable_frame_end_update_cdf off -- otherwise frame 2's decode loads what
frame 1 stored and desyncs at the first symbol. Swept the crate: the only
other hand-built inter headers (frame.rs' header round trip) code no tile.
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).
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.
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

2026-09-05

test(av1): pin the worker pool's thread count across repeated decodesAhmet Kaan Gümüş · 44460db
test(av1): pin the worker pool's thread count across repeated decodes

Two threaded decodes of one stream at 4 frame / 4 filter / 2 recon
threads: the pool stays inside the composed setting and the second
decode adds no thread. The nested-pool shape this replaces had no bound
at all.
perf(av1): two-stage publication on by defaultAhmet Kaan Gümüş · 30b0391
perf(av1): two-stage publication on by default

With the sub-8x8 group predictions deferred, no parse thread reads a
reference pixel at all (instrumented: zero `ref_planes` calls on the
decode threads over both gate segments at 16 threads / 4 filter / 2
recon), so a consumer frame parses its WHOLE tile over its producer's
filter tail instead of the 4.2% that made this flag a wash before.

4K critical chain, interleaved pairs at (16,4,2): off 14450 / 10594 /
14407 ms vs on 12790 / 9207 / 12463 ms -- 11-14% shorter, three pairs
out of three, with wall agreeing (15.74/11.35/15.69 s vs
13.93/10.76/13.92 s). The same interleaving on the pre-lane-sub8group
binary moves 3-7%, so most of the margin is the deferral.

`EC_AV1_TWO_STAGE=0` restores the old publication point. Byte-exact:
the four gate streams at 1, 4, 16(4,2) and 16(3,1) threads with the new
default and at 16(4,2) with the flag forced off, plus six film cuts
base vs new at 16(4,2).
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): 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).
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%).
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.
perf(av1): the reference bank and the output queue share the pictureAhmet Kaan Gümüş · 900cf2d
perf(av1): the reference bank and the output queue share the picture

A decoded frame's picture was copied once per reference slot it
refreshes and once more to leave the worker (`Arc::try_unwrap` never
succeeded -- the slot promise holds the other handle), 24 MB per copy at
4K 10-bit. `ref_slots`, `Reorder` and the worker reply now carry
`Arc<Picture>`: the sink still takes `&Picture`, so no public signature
moves, and grain (which must not be stored in the bank) still allocates
its own output.

seg4k, all 12 sha6t hashes unchanged at (1,1,1), (6,2,4), (1,1,4).
Single thread: 30.39 s -> 29.71 s, page faults 397 k -> 111 k,
instructions:u 599.40 -> 600.57 G (+0.20%). Composed (6,2,4) best-of-2
interleaved: 12.58 s base -> 12.08 s, page faults 3.77 M -> 0.85 M.
perf(av1): persistent worker pools instead of per-frame and per-tile threadsAhmet Kaan Gümüş · a02c7bd
perf(av1): persistent worker pools instead of per-frame and per-tile threads

Every threaded stage spawned its threads per unit of work: one
`thread::scope` per filter stage per frame, `EC_AV1_RECON_THREADS`
workers per tile, one frame worker per coded frame -- 2363 distinct
threads in a 13 s 4K decode. What died with each of them was the
`thread_local!` decode scratch (planes, rows, dq, mc, wiener, sgr),
re-allocated and re-faulted on every new thread.

`par::Batch` submits jobs to a pool owned by the submitting thread
(thread-local, joined at thread exit), growing to `busy + queued` so a
job never queues behind a blocking one -- the recon wavefront's workers
block on their own dependencies. `Batch`'s drop waits every job out and
re-raises the first panic, which is `thread::scope`'s contract minus the
spawns, so the three call sites keep their borrows.

Byte-exact: all 12 sha6t hashes at (frame, filter, recon) = (1,1,1),
(6,2,4) and (1,1,4). seg4k (6,2,4) best-of-2 interleaved: 13.02 s -> 12.24 s.
perf(av1): reconstruction on a superblock-row wavefront (EC_AV1_RECON_THREADS)Ahmet Kaan Gümüş · f7306dd
perf(av1): reconstruction on a superblock-row wavefront (EC_AV1_RECON_THREADS)

lane-wave1 step (ii). Above one reconstruction thread the parser keeps
parsing and never writes the planes: each superblock's drained
`Vec<ReconOp>` becomes one job (one per 128x128 superblock when `sb128`,
since a 128 block writes across its four 64x64 visits), and N scoped-per-
tile workers reconstruct them in wavefront order -- job `(r, c)` starts
once `(r - 1, min(c + 1, last_col))` and `(r, c - 1)` are complete, which
covers every pixel an intra predictor can reach and every CfL AC read.
Jobs are handed out in raster order, so the oldest outstanding one always
has its dependencies met; a `WaveGuard` joins every worker on each exit
from the tile decoder, including the `?` ones.

The two parse-time pixel READS (the intrabc source fetch, the interintra
intra predictor) keep their `flush_recon`, which now waits the wavefront
out first and replays the current superblock inline -- so an intrabc block
serialises the tile at that point instead of trusting the spec's 256-px
delay against our lag, and stays byte-exact.

MEASURED and it does not pay: seg4k 31.8 s at (frame, filter, recon) =
(1,1,1) vs 31.9 s at (1,1,4) with CPU 99% -> 117%, seg1080 9.4 -> 9.9 s;
with frame threading it is a loss (seg4k 13.5 s at (6,2,1) vs 14.5 s at
(6,2,4)). Recording the ops copies the residual and the MC prediction on
the PARSE thread, which cancels what the workers take off it. Default
stays 1 (inline), where nothing is recorded at all.

Byte-exact: sha6 on seg1080/seg4k/seg4k_lr/palette at recon 1, at recon 4,
and at EC_AV1_THREADS=6 EC_AV1_FILTER_THREADS=2 EC_AV1_RECON_THREADS=4;
new gate `a_real_stream_reconstructs_identically_with_one_and_four_recon_threads`
on reelb_arf_witness (hidden ARF, 10-bit) and both palette/intrabc screen
witnesses.

2026-09-04