Commits
Commits on
d2d7dd10b169b54c2dafd2a361cac237497224fa2026-09-06
Merge branch 'lane-sballoc' (e9bd3392): the three per-superblock reconstruction buffers are recycled through a bounded free list on the wave queue (no three allocations per superblock); byte-exact on 32 hashes across both feature builds, -0.12% instructions at the composed settingAhmet Kaan Gümüş · d2d7dd1Browse files
Merge branch 'lane-coefread' (d486f907): coefficient reader keeps a packed non-zero list for the sign pass, per-unit flat neighbour taps replace per-coefficient (row,col) arithmetic and the tx-class match, trace sites in the square loops moved cold, msac literal inlined (it was a real call per bit); domain-enumerating equivalence test; byte-exact, -1.3% instructions on 4K and -1.7% on 1080pAhmet Kaan Gümüş · e8b9893Browse files
Merge branch 'lane-grainrow' (a3061e1b): film grain assembles the line buffer, column buffer and template into one 32x32/16x16 noise scratch and adds it in a single call per block (no 1/2-wide overlap calls, no scalar remainder); byte-exact on 12 gate hashes + 6 film cuts, -2.9% instructions on the 4K segment, -3.4% on a grain film cutAhmet Kaan Gümüş · aa1bc76Browse files
Merge branch 'lane-av1rd1' (35bc9854): encoder prices coefficients at the frame's q-context (was pinned 2) and inter candidates through the inter tx set; predicted-vs-written coefficient bits drift test (-13.5% at the key frame: search prices at tile-default CDFs, writer adapts); lambda 0.1 re-confirmed (clips disagree on direction); exact neighbour contexts measured mixed and left outAhmet Kaan Gümüş · 45dba91Browse files
Merge branch 'lane-h265screen' (f07a63e8): per-4x4 luma transform-skip RD decision (TransformSkip::Rd, new default): screen-capture BD-PSNR all-plane vs x265 worst clip -0.438 -> +0.918, film unchanged; transform_skip_flag now written for every 4x4 once the PPS enables the tool (presence-vs-value bug caught by the decode gate); EC_H265_TSKIP test knobAhmet Kaan Gümüş · afff48eBrowse files
Merge branch 'lane-mp3loop' (36c6cf04): ec-mp3 granule exit-reason census behind EC_MP3_LOOP_TRACE (no behaviour change); measured: the encoder already beats libmp3lame 14/14 on both gate metrics and a LAME-shaped outer loop scores worse on this MSE gate (finding recorded at the call site)Ahmet Kaan Gümüş · 7302779Browse files
feat(h265): default 4x4 transform skip to the per-block RD decisionAhmet Kaan Gümüş · c7b6783
feat(h265): default 4x4 transform skip to the per-block RD decision Measured over the four-QP ladder against x265 at matched features, BD-PSNR all-plane: screen capture A -0.438 -> +0.918, B +0.561 -> +0.781, C +0.099 -> +0.008, film +0.468 -> +0.460. The tool costs a second quantise-and-reconstruct pass per committed 4x4 luma block (ladder 111s -> 290s on screen capture A, 427s -> 494s on film); TransformSkip::Off buys that back. The pinned encode hashes move with the default.
perf(av1): one film-grain kernel call per block, no scalar remainderAhmet Kaan Gümüş · 12e1d49
perf(av1): one film-grain kernel call per block, no scalar remainder The overlap line and the overlap column each added their noise in an add_noise_to_block call of their own: the column is 1 chroma sample wide, so its 15 rows were 15 scalar calls, and the block left over was 15 wide, whose AVX2 kernel handed the 3-sample tail of every row back to the scalar loop. A 60-frame 4K cut spent 2.19e9 such calls on 4.4e9 samples (23% of all chroma samples, 12% of luma). The three noise sources are now assembled into one 32x32 block (16x16 chroma) and applied in a single call whose width is a multiple of 8, so no scalar remainder is left. Every sample keeps the value its own source gave it, so the picture is bit-identical. seg4k 1 thread: 387.00G -> 375.76G instructions:u (-2.9%), 173.4G -> 170.2G cycles:u; a 4K grain cut 3719.9G -> 3592.4G instructions:u (-3.4%). 12/12 gate hashes unchanged.
perf(av1): the square coefficient loop's trace sites move out of lineAhmet Kaan Gümüş · 70a2869
perf(av1): the square coefficient loop's trace sites move out of line `eprintln!` builds its `fmt::Arguments` on the stack at the call site, so the six trace sites inside `read_coeffs`'s base and sign loops kept their values pinned in the hot loop's frame -- the annotated profile's top line was stack spill traffic. Each is a `#[cold] #[inline(never)]` call taking the values it prints; the output is character-for-character what it was. instructions:u at EC_AV1_THREADS=1: 4K segment -0.25%, 1080p segment -0.32%. The same treatment on `read_coeffs_rect`'s four sites plus the two remaining `TRACE` sites of the sign pass measured WORSE (4K +0.04%, 1080p +0.05%, reproduced in two interleaved pairs on both segments) and was reverted by inverse edit -- those loops are short enough that the extra call sequences cost more than the frame they free.
perf(av1): price an inter candidate through the inter 32x32 coefficient setAhmet Kaan Gümüş · c0bc07f
perf(av1): price an inter candidate through the inter 32x32 coefficient set search_inter_block priced its NEARESTMV/NEWMV candidates through TxbSet::Luma32, the INTRA table, while sb_coeff_inter_frame_tile codes an inter block through Luma32Inter -- which carries the inter tx_type symbol Luma32 has no table for. The BD gate is byte-identical either way (the symbol is worth ~0.03 bit, far below a decision flip), so this is a price-matches-the-writer alignment, not a gain.
test(av1): the bounded-pool test allows a small load-dependent growth between decodes (pool grows to busy+queued; 9 -> 10 seen at load 62), keeps the structural boundAhmet Kaan Gümüş · d552955
test(av1): the bounded-pool test allows a small load-dependent growth between decodes (pool grows to busy+queued; 9 -> 10 seen at load 62), keeps the structural bound
feat(av1): price the search at the frame's own coefficient q-context, and measure the rate term's driftAhmet Kaan Gümüş · 40e1d94
feat(av1): price the search at the frame's own coefficient q-context, and measure the rate term's drift coeff_bits built its CDFs at a pinned q-context 2, so two of the four points of the BD ladder ranked modes against another quantizer's tables; it now takes the frame's own q_ctx_of(base_q_idx), the same one the tile writer hands Cdfs::new. Adds the instrument the rate work needs: predicted_coeff_bits(_sb) sums what the search paid for the coefficients each kept block carries, and predicted_coeff_bits_track_the_tile_the_writer_wrote compares that sum with the bytes the writer emitted. Measured: -13.5% at the key frame falling to +1.8% by the fifth frame -- the search over-prices, because its CDFs stay at the tile defaults while the writer's adapt.
test(mp3): census the distortion loop's exit reason, and record what LAME's shape measuresAhmet Kaan Gümüş · 3458620
test(mp3): census the distortion loop's exit reason, and record what LAME's shape measures The outer loop's exit reason was only knowable by patching the encoder, so every round that asked "does the distortion loop run" had to re-instrument it. `EC_MP3_LOOP_TRACE=1` now prints one `mp3loop <reason> <round>` line per granule, countable with `sort | uniq -c`. Measured on two library sources at 128 and 192 kbit/s, 36758 granules: 36494 exit at round 0 on the budget break, 264 after one to five rounds, 3 at the cap. The loop is a rate loop, as recorded. Restructuring it into LAME's shape -- drop the budget break, let the distortion test drive, since the inner loop already fits the budget at every round -- was built and measured on the same two sources before being reverted. It does make the loop live (10440 of 36758 granules reach the 20-round cap), and it loses on both of the gate's metrics: 0.99917 -> 0.99787 correlation at 128 kbit/s, from ahead of libmp3lame to behind it, and the worst 20 ms window from -15.3 to -12.4 dB, at about five times the encode time. The finding is in the comment so the next round does not pay for it again.
perf(av1): coefficient reading walks a non-zero list and flat neighbour tapsAhmet Kaan Gümüş · de3e402
perf(av1): coefficient reading walks a non-zero list and flat neighbour taps The sign pass re-walked `scan[..eob]`, redid the `pos >> sh` / `& mask` decomposition and loaded each level back out of the padded frame only to skip the zeros. The base pass already knows both, so it now records `(scan_idx << 4) | level` per non-zero coefficient and the sign pass walks that list in reverse -- same coefficients, same order, same trace output. The five base-context neighbour taps and the three base-range ones are a function of the tx class alone, which is fixed for a whole transform unit: `flat_taps` resolves them once per unit as flat offsets into the padded level frame, so the per-coefficient path loses the class match and the `(dr, dc)` -> `dr * stride + dc` arithmetic. Both readers (square and rect) share the new `base_mag`/`br_mag`; `br_ctx`/`br_ctx_rect` stay as the `(row, col)` form the new test pins the flat one against, over every class, every square size and the whole `(row, col)` domain. `SymbolDecoder::literal` was a real call per raw bit across a codegen-unit boundary (this crate builds without LTO) -- the sign pass and the Golomb tail read one bit at a time; it is `#[inline]` now. instructions:u at EC_AV1_THREADS=1: 4K segment -1.01%, 1080p segment -1.42%.
feat(h265): decide transform skip per 4x4 luma block by rate-distortionAhmet Kaan Gümüş · a9d41bf
feat(h265): decide transform skip per 4x4 luma block by rate-distortion Unconditional 4x4 transform skip is worth +1.8 dB BD-PSNR-YUV on one screen-capture clip and -0.34 dB on another, so the tool wants a per-block decision, not a switch. TransformSkip::Rd codes the committed 4x4 luma block both ways and keeps the cheaper one. The writer emitted the transform_skip_flag only when it was set, which was consistent only because every 4x4 skipped; the decoder reads a bin for every 4x4 once the PPS enables the tool. encode_residual now takes Option<bool>: None when the PPS left the tool off, Some(v) for the flag to write.
Merge branch 'lane-av1bdgate' (5b132459): ignored gate bd_rate_vs_libaom_and_rav1e measures ec-av1 encoder BD-rate + wall vs ffmpeg libaom-av1 cpu-used 6 and librav1e speed 6 on ffmpeg-decoded pixels (baseline: +441..+504% rate vs libaom, +206..+401% vs rav1e); ec-bench AV1 encode row gains fps + bytes/frame; no encoder code changedAhmet Kaan Gümüş · f336d0cBrowse files
docs(av1): pin the measured BD-rate baseline in the gate's doc commentAhmet Kaan Gümüş · e1f8c49Browse files
test(av1): BD-rate + wall-clock baseline gate for the encoder vs libaom and rav1eAhmet Kaan Gümüş · 0930a1c
test(av1): BD-rate + wall-clock baseline gate for the encoder vs libaom and rav1e Both reference ladders and ours are measured on ffmpeg-decoded pixels only, all-plane PSNR; our own decode is asserted sample-exact against the encoder's reconstruction. ec-bench's av1 encode row gains fps and bytes/frame.
perf(av1): recycle the three per-superblock recon-job buffers instead of allocating them per submitAhmet Kaan Gümüş · ce3d0d9
perf(av1): recycle the three per-superblock recon-job buffers instead of allocating them per submit wave_submit made three fresh Vecs per superblock (op list, coefficient arena, prediction arena) and the worker freed them when the ReconJob dropped -- 4680 allocations and frees per 4K frame, each first-touched. The worker now clears them and hands them back to a bounded free list inside the queue mutex both sides already take, so only the first few superblocks of a tile allocate. -0.12% instructions at (16,4,2) on the 4K segment; byte-exact.
2026-09-05
Merge branch 'lane-memfix' (167e98e9): a pool job submits back into the pool it runs on (no nested pools: 1053 -> 59 threads), whole-plane scratch is one process-wide best-fit pool capped at 32 buffers (frame thread and filter workers share it); 4K peak RSS 10 GB -> 4.1-5.0 GB, page faults -30%, +0.1% instructions; byte-exact on 20 gate hashes + 6 film cuts; bounded-pool test addedAhmet Kaan Gümüş · 2426e3dBrowse files
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.
Merge branch 'lane-counters' (0ec260f9): 388 gate-counter bumps routed through hit!/hit_do! behind the default-on cargo feature gate-counters; --no-default-features drops them (-0.8% instructions) with 24/24 gate hashes identical on both builds; inter_last_mc and the trace latch are decode state, left aloneAhmet Kaan Gümüş · e548d52Browse files
perf(av1): one pool per job tree and a shared capped plane-scratch poolAhmet Kaan Gümüş · 2636658
perf(av1): one pool per job tree and a shared capped plane-scratch pool A filter band job opened a sub-pool on the worker running it, one level per pipeline stage, and no pool ever shrank: 1038 threads at (16,4,2). A job now submits back into the pool it is running on (`ON_POOL`), so the thread count is the peak of `busy + queued` over the whole job tree. `Pool`'s handles moved behind the queue lock because the thread that grows the pool is now whichever one submits. The whole-plane scratch pool was per thread while its buffers are not: the frame thread allocates the snapshots and a filter worker returns them, so ~19 MB a set leaked into every worker the decode touched. One process-wide pool, best-fit by capacity, hard-capped at 32 buffers. 4K peak RSS 9.33 GB -> 4.07 GB, peak threads 1053 -> 59, instructions:u +0.10% and page faults -30% on seg4k at (16,4,2).
Merge branch 'lane-sub8group' (35f7ba64): the four sub-8x8 group predictions build inside PredBuild closures (parse thread makes zero reference-pixel reads, instrumented), rect groups drop the per-unit prediction copy; EC_AV1_TWO_STAGE default ON (4K chain -11..-13% in interleaved runs; =0 restores the old publication point); byte-exact on 20 gate hashes + 6 film cutsAhmet Kaan Gümüş · b3aab18Browse files
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): gate the three reference-through-a-LocalKey counter bumps tooAhmet Kaan Gümüş · 06bf080Browse files
fix(av1): inter_last_mc and the coeff-trace latch are state, not counters -- unwrap themAhmet Kaan Gümüş · 3c710ecBrowse files
perf(av1): the sub-8x8 group predictions build on the recon worker tooAhmet Kaan Gümüş · 9137abf
perf(av1): the sub-8x8 group predictions build on the recon worker too The four remaining parse-thread reference-pixel readers -- the 4x4 SPLIT group's per-sub-block luma, the 8x4/4x8 HORZ/VERT group's per-piece luma, and both groups' one chroma unit -- now build inside `PredBuild` closures through `push_pred`, exactly as lane-defer8 did for the 8x8 leaf: each piece's ref/mv/filters travel by value, the reference PICTURES resolve inside the closure (`ref_planes_deferred`, failures parked on `RefPix`), and the parse thread only asks `ref_dims` for the scale factor its own counter needs. A group pushes one `Pred` op per piece, each immediately followed by the ops that read it, so the worker's block-prediction slot is consumed before the next piece overwrites it. The rect group's transform units take their window of the block prediction (`Pred::offset` at the block stride) instead of copying it out on the parse thread; `push_mc_rect_tx` already densifies that window where the residual is dense, which is the copy that was made here. `Pred::dense` has no caller left and is gone. Byte-exact: all four gate streams at 1, 4, 16(4,2), 16(3,1) threads and at 16(4,2) with EC_AV1_TWO_STAGE=1.
perf(av1): route every gate counter through hit!/hit_do! behind a default-on gate-counters featureAhmet Kaan Gümüş · 04187f1Browse files
Merge branch 'lane-defer8' (ffaef710): 8x8-leaf, OBMC (planned at parse, run on the worker) and sub-8x8 chroma-piece predictions build inside PredBuild closures, and reference pictures are resolved on the worker (parse reads only ref_dims); deferred failures parked on RefPix and taken after the tile loop; byte-exact on 16 gate hashes + 6 film cuts, two-stage default unchangedAhmet Kaan Gümüş · 36b27a7Browse files
perf(av1): the parse thread stops reading reference pixels -- 8x8 leaf, OBMC and the sub-8x8 chroma piece deferred to the recon workersAhmet Kaan Gümüş · fb24177
perf(av1): the parse thread stops reading reference pixels -- 8x8 leaf, OBMC and the sub-8x8 chroma piece deferred to the recon workers
Every whole-block inter prediction now happens inside its `PredBuild`
closure, so at more than one reconstruction thread it runs on the worker
that writes it:
* `decode_inter_block8` builds both of its arms (single-reference and
compound) through `push_pred`, recording `Pred::Cur` windows exactly
as the 16x16+ path does, instead of predicting into dense `Vec`s on the
parse thread;
* OBMC splits into `obmc_plan` (the two neighbour walks and every
mode-info/neighbour-band read they make, on the parse thread, where that
state is still this block's) and `obmc_run` (the neighbour predictions
and blends, from the plan and reference pixels alone);
* the sub-8x8 chroma piece captures its previous strip's ref/mv/filters
plus that reference's SIZE and rebuilds the piece inside the closure;
* the reference PICTURES themselves are resolved inside the closures --
the parse only asks for `ref_dims`, which answers from the stage-1
metadata without waiting for a producer's filters.
Ordering is the wavefront rule the deferred path already relied on: a
worker runs a block's ops only once (r-1, c+1) and (r, c-1) are complete,
which covers the interintra predictor's own above/left edges; the inline
arm keeps its `flush_recon` before the build. A deferred prediction has no
`?`, so a reference resolution failure is parked on the `RefPix` and taken
by the frame decoder once every tile's workers are joined.
Byte-exact: all four gate streams at 1, 4, 16(4,2), 16(3,1) threads and at
16(4,2) with EC_AV1_TWO_STAGE=1, plus six film cuts base vs new. Measured
instructions:u +0.13% (1 thread) / +0.19% (16,4,2) -- the closure boxing and
the OBMC plan. EC_AV1_TWO_STAGE stays default OFF: its chain is 5562 ms vs
base 5618 ms (1%), inside the noise of a box at load 8-18.Merge branch 'lane-coefgrid' (2e37f9aa): coefficient readers return the Grid enum so all-zero units alias the static zero residual (no per-unit Vec, no zero fill), pointer test replaces the full all-zero scan in the dequantiser and the neighbour-state sum; byte-exact, -1.2% instructions, -44% single-thread page faultsAhmet Kaan Gümüş · 14f4482Browse files
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.
Merge branch 'lane-twostage' (fe745ecc): two-stage reference promises (CDFs per spec 7.20, seg map, motion field, size at the tile boundary; filtered pixels after the filters) through a RefPix handle waited at the first ref_planes; default OFF (EC_AV1_TWO_STAGE=1) because inline 8x8-leaf/OBMC/sub-8x8 predictions touch ref pixels 4% into the parse; byte-exact on 16 gate hashes + 6 film cuts both waysAhmet Kaan Gümüş · 1d9f0d3Browse files
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.
Merge branch 'lane-mvstack3' (b54e2c88): temporal mv probe as inline(always) free fns with the trace dump split off cold (the two outlined closures are gone), motion field projection hoists its loop-invariant validity terms and walks row slices, projected tpl cell drops its redundant Option tag (20 -> 12 bytes); byte-exact, -0.4% instructionsAhmet Kaan Gümüş · c870931Browse files
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.Merge branch 'lane-publish2' (3737303f): palette colour caches stamped only by palette blocks (spec reads them only where size > 0), sub-8 and uv mode edge arrays narrowed to (u16,u8), side and palette-size bands to u8; second-reference edge array audited as correct (stale comments fixed); byte-exact, -0.13% instructionsAhmet Kaan Gümüş · b032d07Browse files
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.
Merge branch 'lane-coefbuf' (af6174b0): coefficient context frame stores u8 magnitudes, per-intra-unit residual grid clone removed; byte-exact, -0.44% instructionsAhmet Kaan Gümüş · 59bce73Browse files
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).
Merge branch 'lane-probenull' (f0859633): decode_probe skips the u16->bytes conversion when EC_PROBE_OUT16=/dev/null and formats real output with a chunked to_le_bytes loop; gate hashes unchangedAhmet Kaan Gümüş · 38d2f82Browse files
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.
Merge branch 'lane-timeline' (6fda9471): EC_AV1_TIMELINE=1 per-frame event timestamps with dependency edges + scripts/av1-timeline-report.py critical-path walk; measured: 4K wall = reference chain (91% of wall), 90.8% of the chain is per-frame parse; byte-exact, +0.056% instructions (codegen shift)Ahmet Kaan Gümüş · a263e1eBrowse files
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%).
Merge branch 'lane-pipefilt2' (69fbe27b): loop restoration pipelined as a second filter-pool worker one CDEF band behind (RU row ready when CDEF band (v_end-1)/64 is done); byte-exact on 16 gate hashes + 6 film cuts; -3% wall at one frame thread, flat at sixteenAhmet Kaan Gümüş · c604fcdBrowse files