Commits
Commits on
082d0dcbc2cbe9f300c4d925194e67c3ca03714c2026-09-06
wip(av1): motion-search census, stack-seeded starts, extra-ref NEWMV behind knobsAhmet Kaan Gümüş · 082d0dcBrowse files
Merge branch 'lane-av1s3' (91f6923f): NEARMV/GLOBALMV with a real DRL index, GOLDEN/ALTREF references, CDF carry across framesAhmet Kaan Gümüş · 0f15668
Merge branch 'lane-av1s3' (91f6923f): NEARMV/GLOBALMV with a real DRL index, GOLDEN/ALTREF references, CDF carry across frames Merge resolution: the byte pins from lane-av1fwd move to the merged tree's streams (7416 / 27927 bytes), since the inter syntax changed on purpose.
test(av1): fold the golden-only ref bank helper into the three-slot oneAhmet Kaan Gümüş · a947556Browse files
feat(av1): ALTREF as the frame two back, on an alternating slotAhmet Kaan Gümüş · 9310981
feat(av1): ALTREF as the frame two back, on an alternating slot Frame n refreshes slot 0 for odd n and slot 2 for even n, so the frame two back is still intact in the very slot this one is about to overwrite (read before write): ref_frame_idx names it as ALTREF_FRAME, LAST names the other slot, GOLDEN stays on slot 1. inter_frame_headers_slots is the header builder that takes the three slots apart; the five-argument inter_frame_headers keeps its old read-and-write-one-slot meaning for the hand-built fixtures. The RD prices each extra reference's two search-free modes from a slice, so LAST/GOLDEN/ALTREF share one code path. ALTREF is picked for 337/405/1793 blocks per ladder. BD-rate vs libaom 127.3/153.4/83.0 -> 126.5/152.9/80.9, vs rav1e 78.6/105.7/18.3 -> 77.9/105.5/17.6; wall 7.8/7.1/7.8 -> 8.0/7.2/7.7 s. ffmpeg decodes every stream sample-exact.
Merge branch 'lane-av1fwd' (ea3cd233): encoder pricer keeps its CDF tables, filter search replays filters instead of re-decoding, zero-residual transform skipsAhmet Kaan Gümüş · 93d97dc
Merge branch 'lane-av1fwd' (ea3cd233): encoder pricer keeps its CDF tables, filter search replays filters instead of re-decoding, zero-residual transform skips Byte-exact vs a6649c4e (pinned by count + FNV-1a); instructions:u -27.0% / -25.6% / -22.1% on the gate clips. The AVX2 forward pass was NOT built: the census puts 70% of forward calls on an all-zero residual and the profile put the pricer and the filter re-decode 2-3x above the whole transform.
test(av1): pin the encoder's own streams byte for byteAhmet Kaan Gümüş · f79740b
test(av1): pin the encoder's own streams byte for byte The BD gate measures quality, which a speed lane can move by a hair without failing anything. This pins two points of the 1080p gate clip's own ladder by byte count and FNV-1a hash; both values are identical at a6649c4e (the merge before this lane) and at its tip, which is what "exact speed work" has to mean.
docs(av1): the BD gate's own table records what the speed lane cost it (nothing) and boughtAhmet Kaan Gümüş · eadf8b5Browse files
feat(av1): a real GOLDEN reference beside LASTAhmet Kaan Gümüş · 2f069ae
feat(av1): a real GOLDEN reference beside LAST The key frame refreshes all eight DPB slots and every inter frame only slot 0, so slot 1 still holds the key frame however long the GOP runs: inter_frame_headers now points ref_frame_idx[3] (GOLDEN_FRAME) at it, the encoder carries that picture through encode_sequence and Av1Encoder, and the 32x32 inter RD prices GOLDEN's two search-free modes (NEARESTMV off its own mv stack, GLOBALMV) beside LAST's whole mode set. No second motion search -- that stage owns the wall -- and one trial set per distinct (reference, vector) pair, so the added modes mostly reuse work. The trial decode of the filter search and the two GOP tests take the golden plane at RefPix index 4 (the array is keyed by reference NAME, not by DPB slot). GOLDEN is picked for 50%/56%/37% of inter blocks. BD-rate vs libaom 133.7/162.3/83.8 -> 127.3/153.4/83.0, vs rav1e 84.7/113.1/18.0 -> 78.6/105.7/18.3; wall 10.1/9.5/9.4 -> 7.8/7.1/7.8 s. ffmpeg decodes every stream sample-exact (ffmpeg_and_this_decoder_agree_on_a_gop).
feat(av1): the writer mirrors the decoder's single_ref context functionsAhmet Kaan Gümüş · f5cb29a
feat(av1): the writer mirrors the decoder's single_ref context functions InterInfo carries its own ref_frame and the writer codes the whole single_ref_p1..p6 tree through write_single_ref, each symbol at the context decode.rs read_single_ref uses (single_ref_p1_ctx/p2/p3/p4/p5/p6 on the immediate above/left neighbours' references, -1 for an intra or unavailable one) -- the writer's Neighbours now tracks above_ref/left_ref the way the decoder's does. The mv stack and the MI grid take the block's own reference too. Byte-exact against the previous streams: the BD gate reports the same bytes at all twelve points (133.7/162.3/83.8 vs libaom, 84.7/113.1/18.0 vs rav1e), which is what proves the mirrored contexts equal the collapsed all-LAST ones they replace. mvstack::single_ref_ctx is now test-only.
perf(av1): the forward transform skips an all-zero residual, and the quantizer stops dividing per coefficientAhmet Kaan Gümüş · eca6458
perf(av1): the forward transform skips an all-zero residual, and the quantizer stops dividing per coefficient A census of the BD gate's own ladder (12 frames, four quality points): 4.14M DCT_DCT forward transforms (67% 4x4, 24% 8x8, 6% 16x16, 2% 32x32) of which 72% carry an all-zero residual, and 1.86M non-DCT ones (77% 4x4, 23% 8x8) of which 68% do. The fixed-point path skipped those row by row and column by column but still allocated the row buffer; the f64 analysis basis the non-DCT types use had no skip at all and ran both matmuls over zeros. Both now return early -- exactly, since a row of zeros contributes only `0.0 * b` terms and a sum of zeros is `+0.0` -- and `quantize` walks rows and columns instead of recovering them with a division per coefficient. Byte-exact: 1080p gate ladder unchanged (same FNV-1a per stream); 6.61s -> 6.24s.
perf(av1): the filter search decodes its tile once instead of once per candidateAhmet Kaan Gümüş · 675eebb
perf(av1): the filter search decodes its tile once instead of once per candidate `filter_search::pick_filters` scores ~25 deblock/CDEF candidates by handing the coded tile back to the decoder under each one. The entropy decode and reconstruction it repeated are identical every time -- both filters run after them -- and that re-parse was 24% of the encoder's profile. The decoder now captures its pre-filter frame plus the neighbour state the filters read (`decode::FilterReplay`, armed for exactly one decode), and `replay_filters` re-runs `apply_deblock` + `apply_cdef` on a copy of it. Capture only happens on the shape whose decode tail is those two calls and nothing else (no superres, no loop restoration, no crop); anything else decodes for real as before. Byte-exact: the four-point ladder of the 1080p gate clip is unchanged (17643/32317/53048/76330 bytes, same FNV-1a per stream); 8.24s -> 6.61s.
perf(av1): the coefficient rate pricer stops rebuilding every CDF table per candidateAhmet Kaan Gümüş · 7947a2d
perf(av1): the coefficient rate pricer stops rebuilding every CDF table per candidate `tile::coeff_bits` is called once per priced candidate and built a whole `Cdfs` each time -- 9% of the encoder's profile between `Cdfs::new` and the copy behind it. It now keeps one pristine and one scratch `Cdfs` per q-context per thread and restores only the tables `write_coeffs` adapts, so the price is taken against exactly the same state as before. `partition_bits` builds its read-only tables once. Byte-exact: the four-point ladder of the 1080p gate clip is identical (17643/32317/53048/76330 bytes, same FNV-1a per stream); 9.58s -> 8.24s.
merge main a6649c4e (lane-av1filt): thread this frame's start_cdfs into the filter search's trial decodeAhmet Kaan Gümüş · 97f0e31Browse files
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.
Merge branch 'lane-av1filt' (193d9a9e): the encoder searches deblock levels and CDEF strengths by re-decoding its own tileAhmet Kaan Gümüş · 1b6265b
Merge branch 'lane-av1filt' (193d9a9e): the encoder searches deblock levels and CDEF strengths by re-decoding its own tile Merge resolution: the trial decoder now takes the frame's own tx_select bit (c78863b8), so the filter search runs under inter TxMode::Select too instead of skipping -- with Select the default since lane-av1tx2, the lane's own skip would have left every inter frame unfiltered (class: merge cross-product).
test(av1): pin that the filter search fires, and record the measured ladderAhmet Kaan Gümüş · 06cf00e
test(av1): pin that the filter search fires, and record the measured ladder A non-ignored gate proves some frame of a sequence chooses a real deblocking level or CDEF strength and that decode_stream reproduces the encoder's filtered reconstruction byte for byte; the BD gate's doc table carries the per-step numbers.
feat(av1): carry the CDF state across frames (spec 7.20)Ahmet Kaan Gümüş · e161916
feat(av1): carry the CDF state across frames (spec 7.20)
Inter frames now leave `disable_frame_end_update_cdf` off, so each one
stores its end-of-tile tables with the counts reset and the next frame's
writer starts from them -- the encoder mirrors `stream::stored_cdfs_for`
exactly, and the key frame keeps the bit set, so what it stores is the
defaults it started from and the first inter frame is unchanged.
`sb_coeff_{key,inter}_frame_tile_cdfs` are the writers that take and leave
the caller's `Cdfs`; the old entry points wrap them with a fresh one.
`Encoded` carries `start_cdfs`/`next_cdfs`, `Av1Encoder` carries the state
between `encode` calls, and `decode_inter_frame_tile` takes an
`initial_cdfs` -- the same threading the frame's `tx_select` bit needed,
third instance of that class, and the three GOP tests (one of which checks
ffmpeg against us) now pass the frame's own start state.
BD-rate vs libaom 210.1/218.7/167.4 -> 202.6/206.6/159.0, vs rav1e
151.8/164.7/72.7 -> 144.5/153.2/65.9; wall unchanged at 7.9/7.4/7.6 s.test(av1): the raw inter-tile decode entry point takes the frame's own tx_select bitAhmet Kaan Gümüş · 52ec542
test(av1): the raw inter-tile decode entry point takes the frame's own tx_select bit Three gop round-trip tests decoded inter tiles through decode_inter_frame_tile, which hard-coded tx_select=false with a comment claiming this crate's encoder always writes TxMode::Largest. Inter frames write Select by default now, so the reader consumed the first tx_depth symbol as coefficient data and failed with a hallucinated empty-reference-slot refusal (class: test asserts against a stale header, second instance; the key-frame twin was fixed one merge ago). The entry point now takes tx_select and the tests pass Encoded::tx_select.
test(av1): the raw inter-tile decode entry point takes the frame's own tx_select bitAhmet Kaan Gümüş · 2d62fa6
test(av1): the raw inter-tile decode entry point takes the frame's own tx_select bit Three gop round-trip tests decoded inter tiles through decode_inter_frame_tile, which hard-coded tx_select=false with a comment claiming this crate's encoder always writes TxMode::Largest. Inter frames write Select by default now, so the reader consumed the first tx_depth symbol as coefficient data and failed with a hallucinated empty-reference-slot refusal (class: test asserts against a stale header, second instance; the key-frame twin was fixed one merge ago). The entry point now takes tx_select and the tests pass Encoded::tx_select.
perf(av1): cap the NEARMV DRL search at index 2Ahmet Kaan Gümüş · 8cfe3a6
perf(av1): cap the NEARMV DRL search at index 2 Index 3 fires 4 times in a whole clip ladder and costs a trial set on every block whose stack is four deep: 2160p wall 8.7 -> 7.3 s at identical BD (libaom 218.7, rav1e 164.7).
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): single-reference NEARMV/GLOBALMV and a real DRL indexAhmet Kaan Gümüş · 9147adb
feat(av1): single-reference NEARMV/GLOBALMV and a real DRL index The writer's inter chain was NEARESTMV or NEWMV-at-DRL-0. It now codes the whole single-reference mode set of spec 5.11.24 through one helper, `tile::write_inter_mode`, that mirrors the decoder's `read_inter_mode` / `read_drl_idx` / `assign_mv` reads symbol for symbol -- the three writer sites (32x32, 16x16, 8x8 leaf) that each carried their own copy of the two-mode chain now route through it, so a mode is added once. `InterInfo` grows `ref_mv_idx` (the spec's `RefMvIdx`): NEWMV codes its residual against `entries[idx]`, NEARMV takes `entries[idx]` outright. GLOBALMV is the identity model's zero vector -- this encoder writes no `gm_params`, so `gm_get_motion_vector` is (0,0) and `is_global_mv_block` stays false, adding no motion-mode syntax. The 32x32 inter RD prices every mode as (vector, cheapest syntax reaching it) and trials one vector once, so the added modes cost mode-bit arithmetic rather than more motion compensation; NEWMV picks the DRL index whose residual plus DRL bits is cheapest. BD-rate vs libaom 211.9/223.4/167.4 -> 210.1/218.7/167.4, vs rav1e 154.8/169.7/72.7 -> 151.7/164.7/72.7 (1080p/2160p/screen); wall 7.8/7.3/7.6 -> 7.9/8.7/7.6 s. Mode histogram printed by the gate.
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).
Merge branch 'lane-av1tx2' (e67d4eda): inter TxMode::Select on by default -- the writer counted TXFM_CONTEXT bands of neighbours outside the tile (decoder drops the term), var-tx depth-1 RD search (whole block vs four halves), own-decoder sequence round trip test naming the first differing sample; BD-rate vs rav1e 156/172/72, vs libaom 213/226/167; ffmpeg decodes every stream sample-exactAhmet Kaan Gümüş · f649e1cBrowse files
feat(av1): inter frames code tx_mode Select by defaultAhmet Kaan Gümüş · 2fa64f7
feat(av1): inter frames code tx_mode Select by default The inter var-tx search is measured: BD-rate vs libaom 233.5 -> 226.1 and 170.9 -> 167.4 on two clips and 212.8 -> 213.2 on the third, vs rav1e 177.5 -> 172.0, 73.0 -> 71.5, 156.4 -> 155.6, for 13% encode wall. The BD gate prints the inter var-tx depth histogram alongside the intra one (18-30% of inter blocks split). EC_AV1_TX_SELECT_INTER=0 turns it off.
Merge branch 'lane-av1txfix' (e4821479): re-land key-frame TxMode::Select (tx_depth search, per-transform-unit intra) with the fix -- the encoder-driven decode tests fed decode_key_frame_tile a hard-coded tx_select=false, so Encoded now carries the header's tx_select and the five sites pass it (class: test asserts against a stale header; regression test pins the bit); no decoder change; film hashes unchanged; BD-rate vs rav1e screen +141% -> +73%Ahmet Kaan Gümüş · b4e787dBrowse files
Reapply "Merge branch 'lane-av1tx' (723ab821): key-frame TxMode::Select -- intra blocks search tx_depth 0..2 with per-transform-unit prediction/reconstruction, writer codes tx_depth with the deblock-grid context and cul_level-based skip contexts; BD-rate vs rav1e screen +141% -> +73%, films -1; inter var-tx syntax written but desyncs, shipped off behind EC_AV1_TX_SELECT_INTER=1; ffmpeg decodes every default stream sample-exact"Ahmet Kaan Gümüş · 5f7a053
Reapply "Merge branch 'lane-av1tx' (723ab821): key-frame TxMode::Select -- intra blocks search tx_depth 0..2 with per-transform-unit prediction/reconstruction, writer codes tx_depth with the deblock-grid context and cul_level-based skip contexts; BD-rate vs rav1e screen +141% -> +73%, films -1; inter var-tx syntax written but desyncs, shipped off behind EC_AV1_TX_SELECT_INTER=1; ffmpeg decodes every default stream sample-exact" This reverts commit 582fbd0bb1adb7724e9fa24f57bffd217fa38c3b.
fix(av1): a key frame test decoded its own tile as TxMode::LargestAhmet Kaan Gümüş · 787a14a
fix(av1): a key frame test decoded its own tile as TxMode::Largest The nine failing gates fed decode_key_frame_tile a hardcoded tx_select = false while the encoder had moved its key frame header to TxMode::Select, so the decoder missed the first block tx_depth symbol and desynced at pixel (0,0). Encoded now carries the header bit and the encoder-driven decode sites pass it along.
Revert "Merge branch 'lane-av1tx' (723ab821): key-frame TxMode::Select -- intra blocks search tx_depth 0..2 with per-transform-unit prediction/reconstruction, writer codes tx_depth with the deblock-grid context and cul_level-based skip contexts; BD-rate vs rav1e screen +141% -> +73%, films -1; inter var-tx syntax written but desyncs, shipped off behind EC_AV1_TX_SELECT_INTER=1; ffmpeg decodes every default stream sample-exact"Ahmet Kaan Gümüş · 041eb21
Revert "Merge branch 'lane-av1tx' (723ab821): key-frame TxMode::Select -- intra blocks search tx_depth 0..2 with per-transform-unit prediction/reconstruction, writer codes tx_depth with the deblock-grid context and cul_level-based skip contexts; BD-rate vs rav1e screen +141% -> +73%, films -1; inter var-tx syntax written but desyncs, shipped off behind EC_AV1_TX_SELECT_INTER=1; ffmpeg decodes every default stream sample-exact" This reverts commit 80f4e998bf89f8bfa64daf228d3e2b08dc10191c, reversing changes made to 79ce824128513b891bfae8a68ee36c1fd54cb062.
Merge branch 'lane-av1dct' (98e4912e): encoder forward DCT is the decoder's fixed-point network transposed (i32, no libm; f64 FFT path deleted), gain measured from the network, forward_and_quantize fused; -14.3% encoder instructions; BD-rate vs rav1e 157.4/175.9/138.1 (was 157.8/178.3/141.1), vs libaom 216.6/233.5/289.8 (was 216.4/235.5/289.2)Ahmet Kaan Gümüş · dad20abBrowse files
feat(av1): inter blocks search the var-tx tree one halving deepAhmet Kaan Gümüş · 710cb11
feat(av1): inter blocks search the var-tx tree one halving deep With the inter frame at TxMode::Select an inter block now codes its residual either as one transform over the whole block or as the four transforms of half the side, chosen by RD against the txfm_split symbols both arms spend. The writer codes the split root plus one unsplit flag per child off the interleaved TXFM_CONTEXT bands, and the split units read the inter coefficient tables. Blocks touching the true frame edge stay flat: the reader skips var-tx units past the edge. Still behind EC_AV1_TX_SELECT_INTER=1.
perf(av1): ten headroom bits under the forward network, measured on BDAhmet Kaan Gümüş · 636712f
perf(av1): ten headroom bits under the forward network, measured on BD Six bits of headroom left the fixed-point network's rounding worth 3.9 BD points on screen capture against libaom. Ten put the coefficient resolution at 1/256 of a unit of the `8 * orthonormal` scale a level is formed on, which is where the BD gate stops moving -- 13 bits measures identical -- and stays under 2^27 for a 12-bit residual through two 64-point passes. BD-rate vs libaom 216.6/233.5/289.8 (base 216.4/235.5/289.2), vs rav1e 157.4/175.9/138.1 (base 157.8/178.3/141.1), 1080p/2160p/screen: six of the eight numbers improve, screen-vs-libaom is +0.6 and 1080p-vs-libaom +0.2. Also measured and REVERTED: the row pass's `Vec` in a thread-local scratch, as the inverse transform's is, +5.0% instructions -- reusing the buffer needs a `memset` where a fresh allocation is already zeroed, and that zeroing is what the all-zero-row skip reads. Noted at the function.
fix(av1): an intra block on a tile edge read its tx_depth context off a phantom neighbourAhmet Kaan Gümüş · b8e3b16
fix(av1): an intra block on a tile edge read its tx_depth context off a phantom neighbour The inter-frame TxMode::Select writer counted the TXFM_CONTEXT band value of a neighbour that does not exist -- the bands initialise to 64 pixels (the widest transform), so every intra block on a tile top row or left column took its tx_depth symbol off a CDF row one higher than the decoder, whose tx_size_context_txfm drops the term entirely when has_above/has_left is false. First divergence of every inter Select stream. Found with the new encode.rs round trip through our OWN decoder: the ffmpeg gates could only report "Invalid data found", while our decoder names the first differing frame/plane/position and can be traced symbol by symbol.
Merge branch 'lane-av1tx' (723ab821): key-frame TxMode::Select -- intra blocks search tx_depth 0..2 with per-transform-unit prediction/reconstruction, writer codes tx_depth with the deblock-grid context and cul_level-based skip contexts; BD-rate vs rav1e screen +141% -> +73%, films -1; inter var-tx syntax written but desyncs, shipped off behind EC_AV1_TX_SELECT_INTER=1; ffmpeg decodes every default stream sample-exactAhmet Kaan Gümüş · 96d82d0Browse files
feat(av1): inter-frame tx_mode Select syntax, opt-in and not yet exactAhmet Kaan Gümüş · 6397783
feat(av1): inter-frame tx_mode Select syntax, opt-in and not yet exact The tile writer grows the TXFM_CONTEXT bands (above_txfm/left_txfm, decode.rs txfm_partition_ctx_rect and tx_size_context_txfm_rect) and writes an inter frame's transform syntax: one zero txfm_split flag per inter block that codes a residual, none on a skipped one, a searched tx_depth on every intra block. dav1d refuses the resulting stream and the first diverging symbol was not located inside this lane, so the inter header stays TxMode::Largest unless EC_AV1_TX_SELECT_INTER=1. Key frames are unaffected and stay byte-exact. Also pins the split path in the ffmpeg exactness gate: the test now asserts some block really resolved tx_depth > 0 before claiming the decode matched.
perf(av1): form the levels off the forward transform's own fixed pointAhmet Kaan Gümüş · 1be1614
perf(av1): form the levels off the forward transform's own fixed point `forward_and_quantize` transformed into a `Vec<f64>` of coefficients and then read it back to quantize. With the network already in fixed point the column pass can hand each column straight to the level formation while it is still in `t`, so the coefficient buffer and the pass over it are gone -- and a 64-point transform's uncoded columns (everything outside the top-left 32x32 the syntax carries) are not transformed at all. 209.0 G -> 178.9 G instructions:u on the sequence bench (-14.4%). Two eight-wide column passes were measured and REVERTED: the `[i32; 8]` Lane over eight columns is +3.4%, an in-place whole-buffer column pass +2.3%. Both lose the per-column zero skip and the register-resident level formation, which this encoder's mostly-small transforms live on. Noted at the call site.
perf(av1): the encoder's forward DCT is the decoder's network, transposedAhmet Kaan Gümüş · eb8e099
perf(av1): the encoder's forward DCT is the decoder's network, transposed The forward transform was an f64 FFT (Complex math, per-row/column) and had become the encoder's single largest cost -- `transform::dct1d` 23.6% of the profile. It is replaced by the transpose of the decoder's own fixed-point butterfly network: a network's transpose is that network run backwards with each elementary matrix transposed, and all of this one's elements are symmetric except the unflipped rotation, whose transpose is the same rotation at the negated angle. So the forward body IS the inverse's stages reversed, its unflipped angles negated, its bit-reversal moved to the end -- generated from the inverse's source, then measured. Only the quantized levels reach the decoder, so a forward transform owes a good analysis basis, not a specified one; the gain the levels are formed on is measured from the network (`forward_gain`, sqrt(n/2) per pass) rather than asserted, and the residual carries six headroom bits so the network's own rounding stays well under one unit of the 8x orthonormal scale a level is formed on. -13.1% instructions:u on the sequence bench (209.0 G -> 181.6 G).
WIP lane-av1tx: orchestrator snapshot at the agent turn cap (unverified)Ahmet Kaan Gümüş · b56ffceBrowse files
feat(av1): a key frame's intra blocks search their own transform depthAhmet Kaan Gümüş · 13f5083
feat(av1): a key frame's intra blocks search their own transform depth TxMode::Select on the key frame header, one tx_depth symbol per block off get_tx_size_context's own CDF row, and a per-transform-unit intra loop that predicts each unit from what the units before it reconstructed -- the shape the decoder has always read (decode_block's multi-unit branch). BD-rate vs libaom 216.4/235.5/289.2 -> 212.8/233.5/170.9 (1080p/2160p/screen), vs rav1e 157.8/178.3/141.1 -> 156.4/177.5/73.0.
Merge branch 'lane-av1speed' (715aa56a): encoder motion search reads the reference picture's u16 plane (was converting the whole plane per searched block), fft twiddles cached, trial scratch on the stack, NEWMV equal to NEARESTMV reuses its trials, integer SAD and a symbol price table; -45.6% encoder instructions with byte-identical output; key-frame top-K pruning and partition breakout measured as quality dead-ends and left inertAhmet Kaan Gümüş · 0e574b5Browse files
wip(av1): tile writer codes tx_depth and per-transform-unit intra lumaAhmet Kaan Gümüş · cf8b659Browse files
perf(av1): the partition breakout knob, swept and left offAhmet Kaan Gümüş · 04ff5f8
perf(av1): the partition breakout knob, swept and left off libaom's `partition_search_breakout` shape, as a coefficient-density threshold: a block coding at most N non-zero luma coefficients per 256 luma samples is not offered the split below it. Swept on the BD gate at 1, 2 and 4: the wall halves (6.3/6.0/6.2 s -> 3.6/3.2/4.4 s at 1) but BD-rate rises +18.4/+24.0/+7.9 points, far past this lane's keep rule of one point. The default is 0 -- the existing all-skip prune alone -- so this commit changes no output; the knob and its numbers stay for a future speed preset.
Merge branch 'lane-av1rd3' (a2efc7d3): encoder chroma uv_mode search (DC/V/H/SMOOTH/SMOOTH_V/SMOOTH_H/PAETH) with the forward ADST basis measured off the decoder's inverse; writer codes uv_mode + angle_delta_uv; BD-rate vs rav1e +172/+203/+155% -> +158/+178/+141%, vs libaom -> +216/+236/+289%; ffmpeg decodes every stream sample-exact vs reconstructionAhmet Kaan Gümüş · a192019Browse files
perf(av1): integer SAD in the motion search, a priced-once symbol tableAhmet Kaan Gümüş · 06a3123
perf(av1): integer SAD in the motion search, a priced-once symbol table Two more bit-exact costs off the RD search's inner loops: - the motion search accumulated its SAD as one f64 conversion and dependent add per sample; a 32x32 block of 8-bit samples sums exactly in u32, and that sum converts exactly to f64, so the value is unchanged; - `symbol_bits` called libm's log2 for every symbol of every candidate the search prices, but a CDF interval is a 15-bit width, so there are only 32769 prices; they are now computed once into a table (each entry exactly the expression the call site used to evaluate). instructions:u on the 24-frame 1280x720 sequence bench: 231.8G -> 209.0G (-9.8%); output bytes unchanged (64931), BD-rate unchanged on all three gate clips, gate wall 7.0/6.7/6.7 -> 6.3/6.0/6.2 s.
perf(av1): a NEWMV that lands on the stack's NEARESTMV reuses its trialsAhmet Kaan Gümüş · 12435b7
perf(av1): a NEWMV that lands on the stack's NEARESTMV reuses its trials Both inter paths ran motion compensation, forward transform, quantize and reconstruct three planes' worth a second time whenever the motion search settled on the vector the MV stack already offered as NEARESTMV -- common on static content. The NEARESTMV trials are kept and reused when the vectors match, so the two candidates still price separately (their mode syntax differs) off one set of trials. instructions:u on the 24-frame 1280x720 sequence bench: 263.5G -> 231.8G (-12.0%); output bytes unchanged (64931), BD-rate unchanged on all three gate clips, gate wall 7.8/7.4/7.6 -> 7.0/6.7/6.7 s.
feat(av1): chroma searches its own uv_mode instead of coding DC unconditionallyAhmet Kaan Gümüş · b0a80f3
feat(av1): chroma searches its own uv_mode instead of coding DC unconditionally Both chroma planes were predicted DC_PRED at every block because that is all the tile writer coded. They now search the seven modes that read no further than the row directly above and the column directly to the left -- DC, V, H, SMOOTH, SMOOTH_V, SMOOTH_H, PAETH -- which is exactly the set a chroma block coded with `Reach::none()` may offer; the eight directional modes read past that and UV_CFL_PRED needs its own alpha syntax. A chroma block never codes a tx_type symbol: the decoder derives it from the chroma mode (`Intra_Mode_To_Tx_Type`, spec 9.3), so a non-DC uv_mode moves chroma onto an ADST-bearing transform. The forward half of that is new here and measured off the decoder's own inverse network -- a unit coefficient through `inverse_1d` IS the basis function it synthesises -- rather than written out, which is safe because only the levels and the derived type reach the decoder: the reconstruction the search scores still comes back through the exact inverse. BD-rate vs libaom 234.0/260.3/318.5 -> 216.4/235.5/289.2 and vs rav1e 171.9/203.2/155.3 -> 157.8/178.3/141.1 (1080p/2160p/screen), down on all three against both references. Wall 9.8s -> ~11.1s per clip ladder. The gate's own ffmpeg-decodes-sample-exact assertion holds, so the writer's uv_mode and angle_delta_uv syntax and the derived chroma transform agree with a real decoder. Fire counts printed per clip: DC wins 79.1/84.1/43.8%, PAETH 7.1/6.6/29.0%, H 3.3/2.5/16.6%.
perf(av1): cached FFT stage twiddles, stack scratch for a motion-compensated trialAhmet Kaan Gümüş · 56cc232
perf(av1): cached FFT stage twiddles, stack scratch for a motion-compensated trial Two allocation/libm costs on the encoder's hottest paths, neither of which changes a single output byte: - `fft`'s stage twiddle depends only on the stage length, so its two `sincos` calls per stage per call become one lazily-built table of the seven values that exist (`__sincos_fma` was 9% of the encoder profile). - `mc_trial` heap-allocated a `u16` prediction and a `u8` copy of it for every candidate trial; both are at most 32x32 and now live on the stack. instructions:u on the 24-frame 1280x720 sequence bench: 283.6G -> 263.5G (-7.1%); output bytes unchanged (64931), BD-rate unchanged on all three gate clips.
Merge branch 'lane-av1rd2' (27b5fb12): inter-frame RD quadtree 32->16->8 with per-leaf NEWMV search and a skipped-block prune; writer codes PARTITION_SPLIT at 16x16 into four 8x8 inter leaves with skip/intra-inter contexts at mi granularity; BD-rate vs rav1e speed 6 +365/+401/+207% -> +172/+203/+155%, vs libaom +502/+502/+440% -> +234/+260/+319% (1080p/2160p/screen); encode wall 3.8x rav1e; every stream ffmpeg-decoded sample-exact vs reconstructionAhmet Kaan Gümüş · 246c9cfBrowse files
perf(av1): the motion search reads the reference picture's own planeAhmet Kaan Gümüş · 06abb60
perf(av1): the motion search reads the reference picture's own plane Every call to `motion::search` allocated and converted the WHOLE reference luma plane from the encoder's `u8` shadow copy to `u16`, once per searched block. The DPB picture already holds that plane as `u16`, so the search now takes it directly and the shadow copy is gone. Output is byte-identical (the BD gate's four points per clip and the sequence bench's 64931 bytes are unchanged); instructions:u on the 24-frame 1280x720 sequence bench fall 384.4G -> 283.6G (-26.2%).
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