Commits
Commits on
cbbd6e2ef6acafb00aeb55e460423f024126f90fFiltered to crates/ec-av1/src/tile.rsClear filter2026-09-06
chore(av1): the intrabc gate counters are read only from the cfg(test) gatesAhmet Kaan Gümüş · 4241847Browse files
test(av1): a repeated-pattern key frame codes intrabc blocks, ffmpeg and our own decoder read them back sample-exactAhmet Kaan Gümüş · ffa03f8Browse files
Merge branch 'lane-av1comp3' (d9be6595): compound candidates at the 16x16/8x8 leaves; straddling-leaf mi publication goes through record_miAhmet Kaan Gümüş · 8b1a733
Merge branch 'lane-av1comp3' (d9be6595): compound candidates at the 16x16/8x8 leaves; straddling-leaf mi publication goes through record_mi BD vs libaom +94.4/+104.3/+66.8 -> +83.0/+99.9/+66.4, vs rav1e +47.5/+63.6/+10.7 -> +39.7/+60.0/+10.2; compound share 26-34% of inter blocks; EC_COMP_MISMATCH 0. SPLIT_RD_THRESHOLD re-swept, stays 0.125.
Merge branch 'lane-av1pal2' (be1937b0): chroma palette and a 128-colour palette boundAhmet Kaan Gümüş · 691f69e
Merge branch 'lane-av1pal2' (be1937b0): chroma palette and a 128-colour palette bound Screen BD vs libaom +66.4 -> +55.1, vs rav1e +10.3 -> +1.1; both film clips byte-identical. The 32-colour bound was an unswept constant (-9.5 points on its own). Screen tools forced on for film measured worse on 1080p and non-monotone, so the detector stays; the 32x32 palette arm was dead work and is not in.
feat(av1): compound candidates at the 16x16 and 8x8 inter leavesAhmet Kaan Gümüş · 9dbe40f
feat(av1): compound candidates at the 16x16 and 8x8 inter leaves The two straddling-leaf mi publications spelled their vote out by hand with ref_frame pinned to LAST and mv1 to (0,0) -- the encoder-grid-drift class, correct only for as long as a leaf could never be compound. Both now go through record_mi, byte-identically. A leaf is then offered the compound candidates a whole 32x32 block is: NEAREST_NEARESTMV, GLOBAL_GLOBALMV and NEW_NEARESTMV off the vector the leaf already searched, against the compound stack built at the leaf's own bw4/bh4. The tile writer already codes a compound block at any leaf size, so no writer change was needed.
feat(av1): chroma palette -- palette_uv_mode, the U cache/delta colours, V, and the shared index mapAhmet Kaan Gümüş · ace59f5
feat(av1): chroma palette -- palette_uv_mode, the U cache/delta colours, V, and the shared index map The decoder read every one of these symbols already; the encoder wrote palette_uv_mode == 0 unconditionally. Now search_chroma prices a chroma palette arm against the best ordinary chroma mode: one 1-D k-means over U (the same palette_candidates the luma arm uses, which is what keeps u_colors ascending and distinct for read_palette_colors_uv's merge), V taken as each cluster's mean, one index map shared by both planes at (side/2).max(4) -- av1_get_plane_block_size, not a plain halving. Mirrored from the decoder: read_palette_colors_uv (U's range starts at 256-first and its deltas are unbiased, both unlike Y), palette_uv_cache_mi and record_palette_uv_rect (new above/left uv bands in tile.rs Neighbours, drained through record_mi_planes so a block that takes no chroma palette clears its column), and the plane order -- both colour lists, then both index maps. corner-cut: V's colours take the reader's raw form (leading bit 0, n 8-bit literals) instead of the signed-delta form; ceiling ~n bits per block, and the RD pricer sees it, so it can only make the encoder take fewer chroma palettes than it should. Screen clip: +56.9%/+2.3% -> +55.1%/+1.1% vs libaom/rav1e, 126 chroma palette blocks, 6.1s -> 6.4s. Film clips do not set the header bit and are byte-unchanged. The oracle test now proves size-2 and size-4 chroma palettes AND 36 colours taken from the neighbour cache.
Merge branch 'lane-av1tsearch' (52ab4845): the RD/motion search runs one job per tileAhmet Kaan Gümüş · fe25c8d
Merge branch 'lane-av1tsearch' (52ab4845): the RD/motion search runs one job per tile 1080p 4x2 at 8 threads 11.49 -> 6.98 s (1.04 -> 1.72 fps); 3840x1608 4x2 17.12 -> 8.64 s. Inter frames byte-identical at every layout; key frames at multi-tile layouts now price modes against tile-local bands (what the writer reads back). 1x1 unchanged. ~43% of an inter frame is outside the tile search (frame-level filter search): that is the next serial wall.
chore(av1): drop the stray duplicated bd_rate doc block and the dead-code warningAhmet Kaan Gümüş · bd0a799Browse files
feat(av1): the motion search starts from a step scaled by the reference's order-hint distanceAhmet Kaan Gümüş · d53c852
feat(av1): the motion search starts from a step scaled by the reference's order-hint distance A reference twice as far back holds content that has moved about twice as far, so motion::search now takes that reference's own order-hint distance and opens its log stage at step * (1 + 0.5 * (dist - 1)), capped at 4x the flat step. LAST stays at the flat step; GOLDEN (the key frame, 2..12 frames back in this GOP) and ALTREF (2) widen. The hints had to be armed before the search: tile::arm_order_hints ran beside the tile WRITE, so ref_distance read (0, 0, [0; 7]) and returned 1 for every reference -- the first sweep came out byte-identical at every scale (the knob never reached the tool). Armed in encode_inter_frame's header setup, the traced distances are ALTREF 2 and GOLDEN 2..12. Sweep vs libaom (1080p/2160p, screen byte-identical at every point): 0 +100.7/+115.8, 0.25 +98.5/+112.2, 0.375 +98.2/+115.6, 0.5 +94.4/+104.3, 0.625 +95.9/+106.5, 0.75 +92.8/+112.7, 1.0 +98.8/+113.0. Ships at 0.5 (-6.3/-11.5 /flat, vs rav1e +47.5/+63.6/+13.8); wall 5.7s/5.1s/5.8s, unchanged. Byte pins move with the streams.
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.
perf(av1): the RD/motion search runs per tile, on the tile thread poolAhmet Kaan Gümüş · 8421ce2
perf(av1): the RD/motion search runs per tile, on the tile thread pool The frame's superblock loop was one whole-frame pass in raster order even when the frame carried a tile grid; only the entropy write was split (lane-av1tiles), which is why tile threads bought nothing measurable. Both search loops now run one job per tile through `search_tiles`, the search-side counterpart of `write_tiles`: each job owns its own reconstruction planes, its own `MiGrid`, its own neighbour-mode bands and its own `FrameCtx`, and copies its rectangle back into the frame's planes at the end. Availability was already tile-relative, so a tile reads nothing another tile wrote. Inter frames are byte-identical to the whole-frame loop at every layout. Key frames change at MULTI-TILE layouts only: the mode-cost bands are now tile-local, which is what the tile writer actually reads back (a tile resets its neighbour contexts, spec 5.11.1) -- the old frame-scoped bands let a block at a tile's left edge cost its mode against the tile to its west. One tile is unchanged, and the byte pins hold.
feat(av1): palette on the intra blocks of inter frames tooAhmet Kaan Gümüş · 17922e6
feat(av1): palette on the intra blocks of inter frames too The three intra arms of the inter-frame writers (32/16/8) now code the same spec 5.11.46 syntax the key frame's does, through one shared `write_palette_syntax`; the neighbour bands are published from `record_mi_planes` -- the single point EVERY block of either frame type passes through -- so an inter block clears what an earlier palette block left in its column instead of desyncing the next context (the hazard lane-t900 r23 hit on the decoder side). The inter frame sets `allow_screen_content_tools` from its own detection, gated on the sequence having offered the bit at all (the key frame's decision); `decode_inter_frame_tile_lr` takes the flag rather than assuming false, and `Encoded::screen` carries it to every raw-tile decode. The leaf (16/8) intra candidates get the palette RD for free -- they route through `code_square`. The 32x32 inter search's own intra loop does NOT yet offer one (corner-cut: its candidates are hand-rolled beside the inter ones). Check: a_screen_content_picture_codes_palette_blocks_ffmpeg_decodes_exactly now codes a 4-frame GOP as well -- 3 inter frames set the bit, 56 palette blocks, ffmpeg reconstructs all four frames exactly in all three planes.
fix(av1): the encoder's own mi grid recorded a compound block as single-referenceAhmet Kaan Gümüş · 9b0008b
fix(av1): the encoder's own mi grid recorded a compound block as single-reference record_mi published every 32x32 inter block with ref_frame1 = NO_REF1 and mv1 = (0,0), so from the first compound block on the encoder searched against a grid the tile writer -- and therefore the decoder -- never had. The damage is silent: the reconstruction the gate measures comes from re-decoding the written tile, so 95 blocks per gate run were predicted from a vector the encoder had never trialled and the ffmpeg sample-exact assert still passed. The grid now votes both references, both vectors and decode.rs' own is_new_mv (NEWMV plus compound modes 2/3/7). EC_COMP_MISMATCH=1 arms a writer-side report of every block whose written vectors differ from the trialled ones: 95 -> 0 over the whole BD gate. BD vs libaom +120.1/+128.5/+73.0 -> +101.7/+116.6/+73.3, vs rav1e +67.8/+86.0/+13.7 -> +54.0/+74.5/+13.8; compound share 8.8/8.8/13.8% -> 11.5/12.9/31.9%. Wall 6.4s/5.1s/5.6s. Also adds writer support and env-gated encoder candidates for NEAR_NEARMV / NEAREST_NEWMV / NEW_NEARESTMV (EC_AV1_COMP_NEARNEAR, EC_AV1_COMP_HALFNEW), both default off pending their own measurement.
merge: lane-av1tiles with main ac6e60b4 (compound prediction)Ahmet Kaan Gümüş · e6c05e0
merge: lane-av1tiles with main ac6e60b4 (compound prediction) The per-tile jobs arm the compound lane's new thread-locals (arm_reference_select / arm_order_hints) on their own workers.
feat(av1): writer support for NEAR_NEAR / NEAREST_NEW / NEW_NEAREST compound modesAhmet Kaan Gümüş · d49885f
feat(av1): writer support for NEAR_NEAR / NEAREST_NEW / NEW_NEAREST compound modes The tile writer now forms three more of the spec's INTER_COMPOUND_MODES, mirroring decode.rs assign_compound_mv exactly: NEAR_NEARMV walks the DRL from index 1 and reads stack entry ref_mv_idx + 1, NEAREST_NEWMV and NEW_NEARESTMV code no DRL index at all and write their single residual against stack entry 0. is_new_mv now reports the decoder's own modes 2/3/4/5/7. No encoder candidate forms them yet, so every gate stream is byte-identical: BD +120.1/+128.5/+73.0 vs libaom, +67.8/+86.0/+13.7 vs rav1e, same bytes at all twelve ladder points.
feat(av1): palette-coded luma intra blocks on a screen-content key frameAhmet Kaan Gümüş · f2eac79
feat(av1): palette-coded luma intra blocks on a screen-content key frame The whole spec 5.11.46 chain, mirrored symbol for symbol from this crate's own decoder: `palette_y_mode` off the real `av1_get_palette_mode_ctx` neighbour bands, `palette_y_size`, the colours coded against the above/left colour cache `av1_get_palette_cache` builds (`palette_ctx_and_cache`, the decoder's own merge and dedup), and the colour-index map on `decode_color_map_tokens`' wavefront diagonal with `av1_get_palette_color_index_context`'s ordering. The candidate palettes are libaom `av1_k_means`-shaped: a block with at most 8 distinct colours takes them all (exact prediction), a busier one is quantised to 8 and to 4 by a histogram Lloyd iteration, and each is priced through the very writers the tile uses (`palette_bits` on a `SymbolEncoder::pricer`) against the mode the intra search already settled. Check: encode::tests::a_screen_content_picture_codes_palette_blocks_ffmpeg_decodes_exactly -- 48 palette blocks (sizes 2/3/4, 16 each) on a 192x96 screen card, ffmpeg and our own decoder both reconstruct the encoder's picture exactly, and the film-shaped test card leaves the detector off.
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): compound-reference blocks -- comp_ref/compound_mode syntax and averaged two-reference predictionAhmet Kaan Gümüş · 3cac217
feat(av1): compound-reference blocks -- comp_ref/compound_mode syntax and averaged two-reference prediction The tile writer now codes a COMPOUND_REFERENCE block: comp_mode = 1, the comp_ref_type/uni_comp_ref/comp_ref/comp_bwdref pair tree, the inter_compound_mode symbol at the compound MV stack's own context, and (for NEW_NEWMV) the compound DRL walk plus both motion vectors -- mirrored symbol for symbol from decode.rs read_compound_ref_frames / read_inter_compound_mode / assign_compound_mv. comp_group_idx/compound_idx are NOT coded: this crate's sequence header clears enable_masked_compound and enable_jnt_comp, under which decode.rs reads neither and infers the simple average, which is the only blend the encoder forms. The 32x32 block search offers NEAREST_NEARESTMV, GLOBAL_GLOBALMV and NEW_NEWMV (seeded from the two single-reference searches, no joint search) for the pairs LAST+GOLDEN and LAST+ALTREF, predicted through mc::predict_compound_intermediate + mc::combine_compound at the 8/8 split. Root cause found on the way: write_single_ref dropped the neighbour's SECOND reference from every single_ref_p*_ctx vote (libaom av1_collect_neighbors_ref_counts counts both), so every single-reference block sitting under a compound neighbour decoded a different reference name.
feat(av1): the encoder writes multi-tile frames, sample-exact at every layoutAhmet Kaan Gümüş · a01d142
feat(av1): the encoder writes multi-tile frames, sample-exact at every layout Uniform tile spacing (spec 5.9.15), one tile group OBU with per-tile sizes, context_update_tile_id on the largest tile, and per-tile CDF / LR-reference / neighbour-band / MV-grid resets mirroring the decoder's own tile loop. The writer's availability answers are tile-relative now (the intra_inter and tx-size contexts asked mi_row > 0 and coded a tile's first row against a neighbour the decoder does not have). EncoderConfig gains tile_cols_log2/tile_rows_log2 (default 0/0, byte-identical to the one-tile stream); ec-bench takes EC_AV1_TILES=<cols>:<rows>.
wip(av1): compound syntax writers, snapshot at the agent cap (may not compile)Ahmet Kaan Gümüş · b22678dBrowse files
wip(av1): multi-tile writer, snapshot at the agent cap (may not compile)Ahmet Kaan Gümüş · 252b2d1Browse files
feat(av1): reference_select frames -- the comp_mode symbol and its skip-mode header gateAhmet Kaan Gümüş · 14a71ba
feat(av1): reference_select frames -- the comp_mode symbol and its skip-mode header gate The frame-header writer refused reference_select outright; it now writes the bit, and with it spec 5.9.22's skip_mode_present gate (skipModeAllowed mirrored from ec-av1-syntax's own read_skip_mode_params, off the per-reference order hints the encoder now hands the header from its DPB). Every inter block of a reference_select frame codes a comp_mode symbol at mvstack::reference_mode_ctx's context -- the writer side of decode.rs read_comp_mode -- and every block still names SINGLE, so the only stream change is that one symbol per block. Armed by EC_AV1_COMPOUND=1 in a test build; off by default until compound candidates exist to pay for the bit.
feat(av1): the encoder writes multi-tile frames (uniform spacing, per-tile CDF/LR/neighbour reset)Ahmet Kaan Gümüş · b8332ebBrowse files
merge: main (lane-av1mv motion search, lane-av1price msac pricer) into lane-av1pyrAhmet Kaan Gümüş · a802372Browse files
feat(av1): a two-level frame pyramid in the encoder facadeAhmet Kaan Gümüş · d496905
feat(av1): a two-level frame pyramid in the encoder facade Hidden ALTREF coded ahead of its display position and re-output by a show_existing_frame header, per-level quantizer offsets, a per-level rate loop and packet dts/level. The flat one-in-one-out path is untouched.
perf(av1): settle an all-zero transform block before the scan-order searchAhmet Kaan Gümüş · c3d93a7
perf(av1): settle an all-zero transform block before the scan-order search Finding the end of block walks the scan backwards through one dependent grid load per position, so an all-zero block pays the whole scan -- once per priced candidate. A straight-line all-zero test runs first: it vectorises, and a block that codes anything at all almost always codes its DC, so the test stops at the first element. Byte-exact on all twelve ladder points; 1080p ladder -0.41% instructions:u (110.14G -> 109.69G, ABAB x2).
perf(av1): gather a coefficient's context neighbours without per-neighbour edge testsAhmet Kaan Gümüş · 02bd8ae
perf(av1): gather a coefficient's context neighbours without per-neighbour edge tests `neighbour` was a third of `write_coeffs`'s self time: five (base) or three (base-range) loads, each behind its own pair of edge compares plus a slice bound check, for every coefficient of every candidate the search prices. A coefficient clear of the far edges reaches all of them, so that case indexes straight off the position. Byte-exact on all twelve ladder points; 1080p ladder -0.71% instructions:u (110.95G -> 110.15G, ABAB x2).
perf(av1): price a symbol string off its final interval, not one log2 per symbolAhmet Kaan Gümüş · fb3fa69
perf(av1): price a symbol string off its final interval, not one log2 per symbol The bit account the RD search prices with cost `__log2_fma` 8.2% of the encoder's profile, one call per symbol written or priced. A symbol costs `log2(r) - log2(rng)` for the two widths it narrows between, and the next symbol's `r` is this one's `rng` shifted up by the renormalisation, so a whole string's cost telescopes to `bits_base + shifts - log2(rng)`: one `log2` per price asked for. Same reading as libaom's `od_ec_enc_tell_frac`. A pricing coder also keeps `low`, `cnt` and the precarry buffer whose only consumer is `finish`, which a search never calls; `SymbolEncoder::pricer` drops that bookkeeping and keeps the interval width the account reads. Byte-exact: all twelve ladder points of the three gate clips keep their length and FNV-1a hash. 1080p ladder -4.76% instructions:u (116.49G -> 110.95G, ABAB x2), of which the pricer accounts for -0.92%.
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.
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.
Merge branch 'main' (45b942bd) into lane-av1lrAhmet Kaan Gümüş · 3bf4b1b
Merge branch 'main' (45b942bd) into lane-av1lr Five hunks in `pick_and_apply_filters` and its two call sites, resolved so both lanes survive: the deblocking/CDEF coordinate search runs through main's `FilterReplay` (one decode, then the filters alone per candidate), and the per-64x64 error this lane's CDEF preset search reads comes off those REPLAYED pictures -- the replay is pinned byte-exact against a decode, so the per-unit measurement is the same measurement. The tile recode with `cdef_idx` literals and the one capturing decode the loop restoration stage needs both run after the replay is cleared. The byte pins move, as that lane's own comment said they would for new tile syntax: 7823 -> 7796 bytes at q=150 and 28189 -> 28182 at q=60, both SMALLER, re-measured on this merged tree.
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).
wip(av1): loop restoration unit syntax + search, snapshot at the agent cap (may not compile)Ahmet Kaan Gümüş · c3b0776Browse files
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.
feat(av1): the encoder codes one CDEF strength per 64x64 superblockAhmet Kaan Gümüş · 93429cb
feat(av1): the encoder codes one CDEF strength per 64x64 superblock The filter search only ever wrote `cdef_bits = 0`: one strength pair for the whole frame, because a per-unit choice needs a `cdef_idx` literal in the tile payload and the whole-frame re-decode the search runs cannot reach one. It can. Every candidate the coordinate search already decodes carries its own error PER 64x64 unit, so the pool of strength pairs tried under the winning deblocking levels doubles as libaom `av1_cdef_search`'s preset list: the units vote, the list grows by that histogram, and the cheapest list length wins on error plus lambda times the literals it costs. The tile is then written a second time with those literals (`tile::arm_cdef_idx`, mirroring the decoder's own `cdef_transmitted` slot) and the winner re-decoded from it, so the encoder's reference frame is still exactly what a decoder reconstructs. The BD gate prints the per-clip `cdef_bits` distribution and how many 64x64 units left the default preset.
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.
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.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): 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.
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.