forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 8dbd683068d7f87f21dcc4ed1dfdca786d82c52bFiltered to crates/ec-av1/src/cdf_state.rsClear filter

2026-08-28

wip(av1): reduced_tx_set=false inter tx sets -- CDFs + inverse transforms, NOT WIRED YETAhmet Kaan Gümüş · 8dbd683
wip(av1): reduced_tx_set=false inter tx sets -- CDFs + inverse transforms, NOT WIRED YET

Compiles clean; NOT YET reachable from any decode path (dying-words WIP,
budget exhausted mid-lane -- entropy layer is done, threading is not).

What this round did (root cause from r1: cdf_state.rs TxbSet::Luma16Inter/
Luma8Inter hardcode the reduced_tx_set=true 2-symbol table; a real aomenc
stream with reduced_tx_set=false needs wider sets there):

1. Transcribed from /tmp/libaom-src (entropymode.c:369-403, entropymode.h:
   169-185, blockd.h:1036-1122, common_data.h:149-159, av1_txfm.h:169-207,
   txb_common.h:32-47, aom_dsp/txfm_common.h:52-68):
   - av1_ext_tx_set_lookup[is_inter=1][tx_size_sqr==TX_16X16] gives, for a
     16x16 inter block, EXT_TX_SET_DTT9_IDTX_1DDCT (12 symbols) -- NOT
     DTT4_IDTX_1DDCT as the r1 handoff guessed (right symbol count, wrong
     set name); for 8x8 (and 4x4) inter, EXT_TX_SET_ALL16 (16 symbols).
   - New cdf.rs tables INTER_TX_TYPE_SET2_16 (TX_16X16 row of
     default_inter_ext_tx_cdf[EXT_TX_SET_DTT9_IDTX_1DDCT]) and
     INTER_TX_TYPE_SET1_8 (TX_8X8 row of
     default_inter_ext_tx_cdf[EXT_TX_SET_ALL16]), transcribed verbatim.
   - New cdf_state.rs storage (inter_tx_type_16_set2, inter_tx_type_8_set1),
     reset1-wired (adaptation) and seeded from the new cdf.rs tables in
     Cdfs::new -- both join the existing reset sweep so a forwarded-CDF
     frame carries them too (av1-cdffwd-three-bugs class: nothing here is a
     new table left off the forwarding/reset map).
   - New TxbSet::Luma16InterSet1/Luma8InterSet1 variants + txb() match arms.

2. Coverage check (tx-class-cross-cutting class, repo memory) -- swept
   every libaom array indexed by tx_type/tx_set for the new TxType members
   this needs (FLIPADST_DCT, DCT_FLIPADST, FLIPADST_FLIPADST, ADST_FLIPADST,
   FLIPADST_ADST, V_ADST, H_ADST, V_FLIPADST, H_FLIPADST -- 9 new variants):
   - transform.rs: TxType gained the 9 variants + from_symbol_set2_12 (12-
     symbol table, av1_ext_tx_inv[EXT_TX_SET_DTT9_IDTX_1DDCT]) +
     from_symbol_all16 (16-symbol, av1_ext_tx_inv[EXT_TX_SET_ALL16]).
   - axes(): FLIPADST reads the *same* 1D ADST kernel as ADST (common_data.h
     vtx_tab/htx_tab map both FLIPADST_1D and ADST_1D to the identical
     butterfly network) -- no new 1D transform to port, confirmed against
     av1_inv_txfm2d.c's inv_txfm2d_add_c (lines 234-316): the flip is pure
     post-processing (lr_flip reverses which column the column-pass reads,
     ud_flip reverses which output row the result lands in), never a
     different arithmetic kernel. Added TxType::flip() and rewired
     inverse_transform_2d_typed to read from an un-mutated `residual`
     buffer into a separate `out` buffer under the flip (the naive in-place
     version has a real RAW hazard: for side/2 columns, a flipped write at
     iteration j clobbers a source column iteration side-1-j will read
     later -- caught before it shipped, not left as a corner-cut).
   - decode.rs TxClass::of: V_ADST/V_FLIPADST -> Vert, H_ADST/H_FLIPADST ->
     Horiz (txb_common.h's tx_type_to_class table), matching V_DCT/H_DCT's
     existing treatment -- coefficient scan/context tables are already
     generic over TxClass, not TxType, so no further surface needed there.
   - decode.rs read_coeffs: CDF-length dispatch (already the crate's own
     idiom, doc'd at the read site) extended from 2-way to 4-way: 17 slots
     -> from_symbol_all16, 13 -> from_symbol_set2_12, 8 -> from_symbol_set1,
     else -> from_symbol (unchanged 2-/5-symbol sets).

3. NOT DONE (why this is WIP, not a fix): no call site actually threads
   reduced_tx_set into TxbSet::Luma16InterSet1/Luma8InterSet1 selection.
   decode_inter_frame_tile_with_cdfs (decode.rs:6197) does not even take a
   reduced_tx_set parameter -- the entire inter tile path hardcodes the
   reduced (2-symbol) inter tables today, unconditionally. Wiring needs:
     - reduced_tx_set: bool added to decode_inter_frame_tile/_with_cdfs
       (decode.rs:6147/6197) and its caller (stream.rs, frame-header
       reduced_tx_set bit -- already parsed for the key-frame/intra path,
       needs finding/threading for inter frames too).
     - threaded through decode_inter_block (4259) and decode_inter_block8
       (5384) as a new parameter, to their four call sites (6399, 6465,
       6535, 7307).
     - TxbSet::Luma16Inter -> Luma16InterSet1 and Luma8Inter ->
       Luma8InterSet1 selection gated on !reduced_tx_set at decode.rs:6484,
       7326 (Luma16*) and 5746, 5940 (Luma8*) -- mirroring txbset_for's
       existing reduced_tx_set match, but for the inter call sites which
       currently have no such helper.
     - the pinned repro (cdfflake-stream-seed45.bin) will not go green
       until this wiring lands; not run this round since the desync path
       is still unreached.
   Intra ext-tx (default_intra_ext_tx_cdf) was NOT re-checked for the same
   hardcoding this round -- r8's comment (Luma8Set1/Luma4Set1 exist) says
   intra's reduced_tx_set split is already handled at 8x8/4x4, and 16x16
   intra is DCT_IDTX-set-only regardless of the flag per
   av1_get_ext_tx_set_type (`tx_size_sqr == TX_16X16` branch skips the
   `use_reduced_set` check for BOTH is_inter values) -- so intra should
   already be correct, but this was reasoned, not re-verified against
   entropymode.c line by line this round.
   Also unaddressed (pre-existing, r1-noted gap): no Luma4Inter path exists
   at all in this crate -- an inter TX_4X4 transform (also EXT_TX_SET_ALL16
   under reduced_tx_set=false, TX_4X4 row of the same CDF, not yet
   transcribed) has nowhere to decode to. Out of this round's scope.
feat(av1): add skip_mode CDF table + adaptation state (unwired)Ahmet Kaan Gümüş · 3403b03
feat(av1): add skip_mode CDF table + adaptation state (unwired)

default_skip_mode_cdfs (libaom entropymode.c, SKIP_MODE_CONTEXTS=3) ported
as cdf::SKIP_MODE, plumbed through Cdfs::new/reset/forwarding the same way
comp_mode/comp_group_idx are. Not yet read by any block decoder -- the
frame-level skip_mode_params() derivation (spec 5.9.22) already lives in
ec-av1-syntax's read_skip_mode_params (SkipModeFrame ref-pair via nearest
forward/backward order-hint distance, matching libaom
av1_setup_skip_mode_allowed bit for bit) and needed no change; the
block-level skip_mode symbol read (spec 7.11.3, forced NEAREST_NEARESTMV
compound + skip=1, decodemv.c read_skip_mode/read_inter_block_mode_info)
is the next round's work, still refused by name at stream.rs:191.
wip(av1): compound r11 — comp_group_idx/compound_idx read, MC blend wired in main pathAhmet Kaan Gümüş · fed4a60
wip(av1): compound r11 — comp_group_idx/compound_idx read, MC blend wired in main path

Round capped mid-wiring; committed by orchestrator after fixing the two
test-wrapper call sites (the five new seq/order-hint params threaded, not
neutralised, where the tile fn has them in scope). 211/211 lib tests green.
Remaining: decode_inter_block8 blend path, record_inter threading of
ref_frame1/mv1/compound_idx, remaining COMPOUND_REFERENCE refusals, firing
gate.
feat(av1): read inter_compound_mode past comp_ref, still refuse MCAhmet Kaan Gümüş · cadc399
feat(av1): read inter_compound_mode past comp_ref, still refuse MC

Ports libaom's default_inter_compound_mode_cdf + compound_mode_ctx_map
(entropymode.c / mvref_common.h) and wires read_inter_compound_mode
into decode_inter_block's COMPOUND_REFERENCE arm: once comp_mode/
comp_ref name the reference pair, find_mv_stack_compound now builds
the real compound mvstack (with CompoundTplArgs when tpl_frame is
live) and the block reads its own compound_mode symbol before still
refusing by name -- compound DRL, MV assignment, and two-reference MC
remain unwired. decode_inter_block8's 8x8-leaf arm is untouched (still
refuses at comp_ref). New COMPOUND_MODE_HITS counter (compound_mode_hits())
mirrors COMP_MODE_HITS for a future firing gate.
WIP(av1): compound-reference symbol-reading CDFs and contexts, not yet wiredAhmet Kaan Gümüş · 651448b
WIP(av1): compound-reference symbol-reading CDFs and contexts, not yet wired

Spec 5.11.25's read_ref_frames compound path (comp_mode, comp_reference_type,
uni_comp_ref/comp_ref/comp_bwdref trees) needs five new default-CDF tables
(cdf::COMP_MODE/COMP_REF_TYPE/UNI_COMP_REF/COMP_REF/COMP_BWDREF, ported from
libaom entropymode.c) plus their adaptation state (cdf_state.rs), and two new
context functions (mvstack::reference_mode_ctx/comp_reference_type_ctx,
libaom's av1_get_reference_mode_context/av1_get_comp_reference_type_context)
unit-tested against hand-derived cases matching libaom's branch tables. The
comp_ref*/comp_bwdref* trees reuse the existing single_ref_p2/p3/p4/p5/p6
context shape (ref_ctx) since libaom's own functions are literally aliases of
the single-ref ones; only uni_comp_ref_p1 needed a new vote set.

Not yet wired to decode_inter_block or stream.rs's reference_select refusal:
that needs Neighbours to carry per-cell compound state (today every decoded
neighbour is proven single-ref, so NeighbourRef is exercised only by its unit
tests), and reading comp_mode/comp_ref_type still dead-ends at "decode this
compound block" with no inter_compound_mode CDF, no compound DRL, no mvstack
dual-ref scan, and no distance-weighted MC blend behind it -- porting comp_mode
reading alone without that chain would trade one frame-level refusal for an
identical per-block one, with no stream this decoder can actually finish.
Left as tested, reviewable infrastructure for the next round; see ledger
lane-av1comp entries for the precise next steps and libaom line references.

2026-08-27

Merge branch 'lane-av1tx4': TX4 luma decode and the 1D transform classesAhmet Kaan Gümüş · 843a5a8
Merge branch 'lane-av1tx4': TX4 luma decode and the 1D transform classes

Seven rounds: TX4 coefficient tables (transcription cross-verified),
V_DCT/H_DCT scan orders and the class-split eob_pt CDF, the leaf8
scan-table fix, and a gate that fires the class-1 path on real aomenc
bytes and decodes pixel-exact. The tx-class lesson: a transform class
is a cross-cutting dimension -- scan, eob table, and context each
carry it.
fix(av1): TX4/TX8 eob_pt CDF is class-split (V_DCT/H_DCT vs 2D)Ahmet Kaan Gümüş · ea55462
fix(av1): TX4/TX8 eob_pt CDF is class-split (V_DCT/H_DCT vs 2D)

libaom's av1_default_eob_multi{16,64}_cdfs carry a [2] dimension this
decoder never read: TX_CLASS_2D vs TX_CLASS_HORIZ/VERT. Read order
(all_zero -> tx_type -> eob) verified against decodetxb.c's
read_coeffs_txb; the class-1 tables transcribed from token_cdfs.h and
checked value-for-value. Wired only where TX_SET_INTRA_1 (the 7-type
set carrying V_DCT/H_DCT) is reachable: Luma4/Luma4Set1/Luma8/Luma8Set1.

Verified: full ec-av1 suite green (172 passed), and a synthetic
8x8-partition intra stream now exercises H_DCT (tx_type=3) through
read_eob's class1 branch without desyncing before an unrelated,
pre-existing refusal later in the same frame (small-partition support
is a separate gap, not this one).

Removed the scratch probe_tx4.rs example used to drive this check.
fix(av1): V_DCT/H_DCT coefficient scan order + TX4 leaf8 scan table mixupAhmet Kaan Gümüş · 700543b
fix(av1): V_DCT/H_DCT coefficient scan order + TX4 leaf8 scan table mixup

Two real desync causes past r3's tx-class context-derivation fix:

1. read_coeffs always read coefficients in the default zigzag scan
   regardless of tx_type. libaom's V_DCT/H_DCT classes use Mrow_Scan/
   Mcol_Scan instead (scan.c av1_scan_orders index 10/11) -- decoded
   here as class_scan_table: V_DCT's class-scan is our grid's own
   natural row-major order (0..N), H_DCT's is that walk transposed.
   base_ctx/br_ctx's row/col-offset formulas (r3's fix) were already
   correct; only the scan order feeding position/row/col into them
   was wrong.

2. decode_leaf8's TX4 split loop (an 8x8 leaf's tx_depth=1 case) read
   its four 4x4 luma transform units with `scans.0` -- the leaf's own
   *8x8* scan table (64 entries) -- instead of `scans.1` (the 4x4
   table), so `pos` values up to 63 got written into a 16-cell grid.
   Pre-existing bug, only reachable/visible once (1) stopped eating
   the stream earlier.

5-scale probe (examples/probe_tx4.rs, /tmp/tx4work/s*.obu) moved
past every prior refusal point to new, later ones (scale 1.5 now
refuses on "a directional chroma mode (round 2)" instead of an
angle_delta/partition desync) -- real progress, not yet clean;
next round needs the same trace-correlation to chase the remaining
divergence(s). Suite green 172/172.
feat(av1): interpolation filters beyond REGULAR, incl. per-block SWITCHABLEAhmet Kaan Gümüş · 10f24e6
feat(av1): interpolation filters beyond REGULAR, incl. per-block SWITCHABLE

The ~13% decodes-but-wrong inter flake was a whole missing filter
family: motion compensation always used the REGULAR subpel tables,
while real encoders pick SMOOTH/SHARP per frame -- or SWITCHABLE,
reading a per-block filter symbol pair this decoder never read (the
silently-unread class again; our own encoder writes one fixed filter).
All four table sets land in mc.rs with an aomdec-pinned unit test, the
switchable_interp CDFs and neighbour context follow libaom's
read_mb_interp_filter, and the filter threads from the frame header
through both inter block paths. The forwarding gate ran 10/10 with
zero pixel mismatches and no vacuous skips.
feat(av1): the seven-type TX_SET_INTRA_1 tx_type row, V_DCT/H_DCT, gate firesAhmet Kaan Gümüş · 2411791
feat(av1): the seven-type TX_SET_INTRA_1 tx_type row, V_DCT/H_DCT, gate fires

A reduced_tx_set=0 frame's 8x8-and-under intra transforms read tx_type
from the seven-symbol TX_SET_INTRA_1, not the five-symbol reduced row
our tables carried (the row-held-constant class, on the tx-set
dimension -- our own encoder always writes reduced_tx_set=1, the same
writer-never-needs-it trap as mv_hp). New set-1 CDF row, the set-1
symbol order from av1_ext_tx_inv, and the V_DCT/H_DCT inverse
transforms (one-axis DCT, identity on the other). The tx-select gate
now actually FIRES: mandelbrot content at min-partition 16 splits
16x16 blocks into TX8 TUs that read the set-1 rows and decode
pixel-exact vs ffmpeg, 4/4 runs, no skips. Resolved 4x4 luma stays a
named refusal (no TX4 coefficient tables yet).
wip(av1): finish the txb_skip 7-context rewire; find TX16 tx_type mismatchAhmet Kaan Gümüş · dcf1147
wip(av1): finish the txb_skip 7-context rewire; find TX16 tx_type mismatch

Adds the luma_skip_ctx debug trace and a partition_w16 trace print (both
gated behind EC_AV1_TRACE) used to bisect the pinned mb.obu stream against
a fprintf-instrumented aomdec build. The 7-context txb_skip rewire itself
(cdf.rs/cdf_state.rs/decode.rs, prior round) compiles and the whole ec-av1
suite is green, but the pinned stream still desyncs: tracing symbol-by-
symbol against real aomdec's EC_TXBCTX/EC_TXBSKIP/EC_TXTYPE_VAL output
shows the two decoders already disagree on a NON-split 16x16 block's own
tx_type (mi_row=4,mi_col=0 in the second superblock quadrant: real reads
tx_type=3 off a reduced 5-symbol intra set, txs_ctx=2/tx_set_type=2/eset=2;
ours reads tx_type=2) -- upstream of the txb_skip multi-TU logic this round
targeted, and not fixed by it. tx_size_context/get_txb_ctx_general/
SKIP_CONTEXTS were all checked byte-for-byte against libaom's
av1/common/txb_common.h and match.

The gate (a_real_aomenc_intra_stream_with_tx_select_decodes_pixel_exact,
stream.rs) is not wired to this recipe: it still passes today only via its
own soft-skip path (every attempt either refuses or never resolves a split
tx_depth), so wiring it now would just turn a silent skip into the same
real failure traced above. Left unwired until the tx_type mismatch is
fixed.
feat(av1): read tx_depth under TxMode::Select on key framesAhmet Kaan Gümüş · ab94637
feat(av1): read tx_depth under TxMode::Select on key frames

Threads a tx_select flag through decode_key_frame_tile's block walk so an
intra frame using TxMode::Select reads the tx_depth symbol (cat0..3 CDFs,
tx_size_context) instead of assuming TxMode::Largest, resolving to a
per-TU split-luma decode path when the block's transform is smaller than
its own side. A resolved 4x4 luma transform still refuses by name (no 4x4
coefficient tables yet). Narrows the old whole-stream TxMode::Select
refusal to inter frames only, since decode_inter_frame's block loop does
not thread tx_select yet.

Adds tx_depth_hits() (before/after counter, same pattern as
filter_intra_hits/deblock_hits) and a real-aomenc gate test proving a
split transform actually decodes pixel-exact against ffmpeg -- currently
SKIPs (no fixture recipe found in this session reliably lands a stream
that both avoids this decoder's other named round-2 gaps and resolves a
tx_depth split without exhausting to 4x4); it never fails, so the suite
stays green while that fixture search continues.

Investigated a reported suite regression on this branch first: it does
not reproduce against this diff -- the cdf-forwarding inter-sequence gate
(a_real_aomenc_inter_sequence_with_cdf_forwarding_decodes_pixel_exact)
fails at the same ~17% rate with this diff fully reverted, confirmed over
30 stashed runs on HEAD. Pre-existing flake, not a regression.
feat(av1): read the mv_hp/class0_hp bits real hp streams carryAhmet Kaan Gümüş · e192a62
feat(av1): read the mv_hp/class0_hp bits real hp streams carry

The dropped-as-dead half-pel MV CDFs (our own writer never sets
allow_high_precision_mv) were silently unread on foreign streams whose
headers set the flag -- every later symbol shifted one bit, the same
silently-unread-symbol shape as use_filter_intra. Tables restored,
reads gated on the frame header's flag, plumbed through the inter tile
path. On the pinned forwarding stream frame 3's desync drops from
2618 wrong luma pixels (worst 35) to 541 (all within 1, chroma exact)
-- entropy now aligned, a luma-only reconstruction residue remains.
fix(av1): reset every CDF's symbol counter before saving it forwardAhmet Kaan Gümüş · 6404564
fix(av1): reset every CDF's symbol counter before saving it forward

Spec 7.20 save_cdfs (libaom av1_reset_cdf_symbol_counters, entropy.c)
zeroes each table's adaptation-rate counter before storing the tile's
end-of-tile state into a reference slot for cross-frame forwarding --
the probabilities carry forward, the counts do not. This decoder was
forwarding the raw counts, so every table an inter frame resumed from
adapted faster than the real decoder's for the rest of that frame: too
small a drift to flip a symbol after one hop, but compounding across
two into a genuine desync (a pinned aomenc stream showed frame 0/1
pixel-exact, then ~60% of frame 2's luma wrong by +-1 once the drift
caught up).

crates/ec-av1/src/cdf_state.rs adds Cdfs::reset_counts (and the
MvComponentCdfs half it delegates to), zeroing the last entry of every
adapting array without touching its probabilities.
crates/ec-av1/src/stream.rs calls it on the saved (non-
disable_frame_end_update_cdf) branch only, matching libaom's REFRESH_
FRAME_CONTEXT_BACKWARD path; the disable_frame_end_update_cdf branch
already stores the untouched loaded state, which needs no reset.

The forwarding-gate test is still flaky, but no longer on this bug: a
20-run sample after the fix shows zero pixel-mismatch failures (the
class this commit targets); every failure left is a variant of the
same pre-existing, already-documented round-2 refusal (aomenc's RD
search occasionally choosing a reference other than LAST_FRAME or a
partition/tx-type this decoder does not model), unaffected by CDF
state. Full `cargo test -p ec-av1 --release` here: 170 passed, 1
failed (that same refusal), 12 ignored.
feat(av1): extend the 8x8-leaf straddle path to inter framesAhmet Kaan Gümüş · cc290f5
feat(av1): extend the 8x8-leaf straddle path to inter frames

Mirrors lane-av1-rect's key-frame 16x16-straddles-one-axis -> up-to-two
8x8-leaf path (code_square side==8, tile.rs write_leaf8) on the inter
side: code_square_inter takes a `side` param (8 or 16) and picks
Luma8Inter/Chroma4 or Luma16Inter/Chroma8 accordingly; the encoder's
inter loop builds `eight` leaves per straddling 16x16 the same way the
key-frame search does, each leaf's own NEARESTMV mv-stack window at
2x2-mi; the tile writer (write_inter_frame_leaf8) and decoder
(decode_inter_block8) mirror that leaf-by-leaf, with the same
prev_leaf skip/intra-inter context override write_leaf8 uses for mode
context (Neighbours' above/left arrays only resolve to SUB=16
granularity). New TxbSet::Luma8Inter/INTER_TX_TYPE_SET3_8 CDF
(libaom default_inter_ext_tx_cdf[EXT_TX_SET_DCT_IDTX][TX_8X8] = 4167,
distinct default+adaptation state from the 16x16/32x32 rows already
carried).

Encoder-side round-trips clean (both-axis-cut still refuses correctly);
a real multi-frame decode round-trip through ffmpeg desyncs starting
at the third coded frame (the second inter frame, U plane) -- logged
as an open dead-end for the next round, not chased further this round.
fix(av1): read the unread use_filter_intra flag; audit the same blindness classAhmet Kaan Gümüş · beeeec5
fix(av1): read the unread use_filter_intra flag; audit the same blindness class

lane-av1real r10 added the FILTER_INTRA/FILTER_INTRA_MODE CDF tables and
Cdfs fields but stopped mid-wiring; this finishes threading
enable_filter_intra (from the sequence header) through decode_key_frame_tile
-> decode_block/decode_leaf8 -> read_intra_mode, which now reads
use_filter_intra after DC_PRED at <=32x32 (spec 5.11.14,
av1_filter_intra_allowed) and refuses use_filter_intra==1 blocks (this
decoder does not implement the 5.11.14 recursive predictor) rather than
silently miscoding.

The pinned CfL stream's actual bug was exactly this: its block reads
use_filter_intra=0, so the flag's own bits were never consumed before,
desyncing every later symbol read self-consistently -- both the Python
cross-checks and debug aomdec traces shared that blindness. With the flag
read, the pin decodes pixel-exact (luma/U/V) against ffmpeg, and the
previously-#[ignore]d a_real_libaom_cfl_stream_decodes_pixel_exact test now
passes green with no split needed.

Blindness-audit sweep of read_intra_frame_mode_info (libaom decodemv.c)
found three more per-block/per-superblock symbols this crate silently never
reads while accepting the header fields that would gate them:
allow_screen_content_tools (intrabc/palette_mode_info), delta.q_present/
delta.lf_present (per-SB delta_q/delta_lf), and segmentation.enabled
(per-block segment_id) -- named refusals added in decode_stream next to the
existing CDEF/TxMode::Select refusals.

Full ec-av1 suite: 165 passed, 0 failed, 12 ignored.
wip(av1): CfL CDFs, alpha reads, and prediction math — r2 checkpointAhmet Kaan Gümüş · e37bffe
wip(av1): CfL CDFs, alpha reads, and prediction math — r2 checkpoint

CfL sign/alpha CDFs converted from AOM_ICDF storage, read_cfl_alphas
wired, cfl.c subsample/average/alpha math ported. The pinned CfL-stream
gate stays ignored: its LUMA decodes near-flat where ffmpeg shows a
gradient, so a bug upstream of the chroma math remains — r3 isolates.
wip(av1): r11 checkpoint — leaf-8 trace instrumentation and partial ctx fixesAhmet Kaan Gümüş · 3a1f168
wip(av1): r11 checkpoint — leaf-8 trace instrumentation and partial ctx fixes

Full suite green (134/0/10); the 40x32 straddle round-trip still desyncs
and stays ignored. Diff spans cdf/cdf_state/encode/tile from the r11
trace session; r12 continues from the committed trace artifacts.
feat(av1): 8x8-leaf CDF, mi-precise neighbour contexts, write_leaf8 (r6, unwired)Ahmet Kaan Gümüş · 83656d8
feat(av1): 8x8-leaf CDF, mi-precise neighbour contexts, write_leaf8 (r6, unwired)

Lands the groundwork for lane-av1-rect's 8x8-leaf write path: the
PARTITION_W8 CDF (+ adapted state field), Neighbours::record_mi/around_mi
(mi-precise coeff-context entry points, the SUB-granularity above_mode/
above_side arrays untouched), and write_leaf8 (mirrors write_block for one
8x8 leaf, reading its intra-mode context from the enclosing 16x16 slot).
BlockCoeffs gained an `eight: Option<Vec<BlockCoeffs>>` carrier and the
coded-mode-validation loop flat_maps it.

The key-frame Quadrant::Split writer now wires write_leaf8 for a straddling
16x16 (one axis only, mod-32==8 targets): the gathered split bit + per-leaf
partition_w8 symbol + write_leaf8, matching the existing 32x32/64x64 edge
pattern.

encode.rs's block-generation loop does NOT populate `.eight` yet: an attempt
to wire it hit an index-out-of-bounds in code_square's edge-sample read
(Plane::edges, encode.rs ~1027) for a leaf at the frame's own edge, and a
"exactly one straddler" geometry assumption that also turned out wrong (a
32x32-aligned straddling 16x16 row/column band is generically two leaves,
not one) -- both are next-round work, not this round's budget. The refusal
at encode.rs's split loop is therefore unchanged; both_writers_refuse_the_
same_strictly_before_half_straddle_size is unchanged and still green.

Suite: 134/0/9, unchanged from cf71e1e.
fix(av1): correct the r4 chroma-granularity assumption for 8x8 leavesAhmet Kaan Gümüş · b91e4ec
fix(av1): correct the r4 chroma-granularity assumption for 8x8 leaves

libaom's is_chroma_reference (av1_common_int.h) is unconditionally true
for bsize >= BLOCK_8X8 (4:2:0 or not), so a split 16x16's 8x8 children
each code their own chroma at 4x4 -- chroma does not stay at the
parent's 8x8 granularity as the r4 doc comments claimed (never checked
against a real decoder). Corrects TxbSet::Chroma4's doc and flips
code_square's still-unreached side==8 branch to the chroma set a real
caller will need, so the next lane does not inherit a wrong premise.

No behavior change (134/0/9, unchanged): the branch has no caller yet.
feat(av1): land TX_8X8/TX_4X4 CDF tables for the mod-32==8 straddle leafAhmet Kaan Gümüş · dc6d790
feat(av1): land TX_8X8/TX_4X4 CDF tables for the mod-32==8 straddle leaf

Extracted byte-exact libaom Default_*_Cdf tables for Luma8/Chroma4
coefficient coding plus the TX_8X8 intra tx_type table, wired through
new TxbSet::Luma8/Chroma4 variants and code_square's third side==8
branch. Not yet reachable from the tile writer -- SPLIT_BLOCKS still
refuses mod-32==8 sizes -- landing the compiling infrastructure layer
per the charter's budget-exhausted fallback; the 16x16-leaf split
emission (tile.rs Quadrant::Split), the leaf-under-leaf carrier, and
aomdec/dav1d parity verification are unstarted.

134 baseline ec-av1 tests still green; no behavior change.
feat(av1): wire NEARESTMV inter coding for 16x16 straddle leaves, gated offAhmet Kaan Gümüş · cac7aab
feat(av1): wire NEARESTMV inter coding for 16x16 straddle leaves, gated off

Adds the full machinery for real inter coding of the 16x16 leaves a
half-straddling 32x32 inter-frame quadrant splits into: a Luma16Inter
TxbSet/CDF table (reduced_tx_set forces the same two-symbol DCT_IDTX set
16x16 already shares the shape of with Luma32Inter), a leaf writer
(write_inter_frame_leaf) that codes is_inter/single_ref/mv-stack/DRL/mv at
this leaf's own 4x4-mi window, and an encode-side NEARESTMV-vs-intra cost
comparison (code_square_inter) with matching per-leaf MvStack/grid updates.

The NEARESTMV selection itself is left gated off (`false &&`, corner-cut
comment at the site) -- enabling it desyncs the decoder ("Invalid data
found") on the existing straddle round-trip test, not yet isolated within
this round's budget. Confirmed via a false/true toggle that the desync is
in the new is_inter leaf path, not in the reduced_tx_set frame-header flag
(that alone round-trips clean). Gate: cargo test -p ec-av1 --release ==
130 passed, 9 ignored, 0 failed (same as baseline).
test(av1): widen the own-size sweep; close hp-mv dead codeAhmet Kaan Gümüş · 1457eaa
test(av1): widen the own-size sweep; close hp-mv dead code

64x56 now round-trips clean through ffmpeg (its historical wrong-V-plane
bug is closed by later MC/edge fixes) -- added alongside 854x480,
216x96, 192x120 to the existing own-size sweep, all green.

Dropped MvComponentCdfs::class0_hp/hp: this encoder always sets
allow_high_precision_mv=false, so the spec syntax that reads them
(mv_class0_hp/mv_hp) never fires -- genuinely dead, not staged.

cargo test -p ec-av1 --release: 129 passed, 0 failed, 4 ignored.

2026-08-26

fix(av1): code tx_type for inter 32x32 residuals; drop the skip-only corner-cutAhmet Kaan Gümüş · ac63d1d
fix(av1): code tx_type for inter 32x32 residuals; drop the skip-only corner-cut

Spec 5.11.48: an is_inter 32x32 luma transform sits in TX_SET_INTER_3, not
TX_SET_DCTONLY, so the decoder reads a tx_type bit right after all_zero. The
writer reused the intra DCT-only TxbSet for inter blocks and never wrote it,
desyncing every symbol after the first coded inter coefficient. New
TxbSet::Luma32Inter carries the TX_SET_INTER_3 CDF row (libaom
entropymode.c:369); search_inter_block now prices real residuals and derives
skip from the quantized levels.
feat(av1): coefficient CDFs for all four q contextsAhmet Kaan Gümüş · 2edeb94
feat(av1): coefficient CDFs for all four q contexts

Q0/Q1/Q3 tables added alongside the existing Q2 (61..=120) family for
all 34 coefficient CDF groups, transcribed and verified against the
Q2 baseline. tile::q_ctx_of buckets base_q_idx into the four bands
(0..=20, 21..=60, 61..=120, 121..=255) and Cdfs::pick selects the
matching table, so the tile writer now accepts the full 0..=255 range
instead of refusing everything outside 61..=120.

Removed the three test assertions that pinned the old refusal
(a_picture_off_the_block_grid_is_refused, dc_levels_the_base_syntax_-
cannot_carry_are_refused, coefficients_the_writer_cannot_code_are_-
refused) and extended the ffmpeg roundtrip and quantizer-monotonicity
gates to exercise one q index from each context, including the three
context boundaries.
feat(av1): default CDF tables for inter-frame mode and MV syntaxAhmet Kaan Gümüş · e9086ec
feat(av1): default CDF tables for inter-frame mode and MV syntax

Spec 9.4's Default_Intra_Inter_Cdf, Default_Single_Ref_Cdf,
Default_Y_Mode_Cdf, the new/zero/ref-mv and drl-mode families, and the
full per-component motion vector set (joint, class, class0 bit/fr/hp,
bit, fr, hp, sign), transcribed from libaom's own default tables
(av1/common/entropymode.c, entropymv.c) rather than rav1e's transposed
layout. Cdfs gains owned copies, with the MV tables split into a
two-element per-component array so adapting one component cannot leak
into the other.

Compound reference and compound-mode CDFs are left out: this encoder
never sets reference_select.
feat(av1): 32x32 quadrants split into 16x16 blocks when RD says soAhmet Kaan Gümüş · 7d10ec2
feat(av1): 32x32 quadrants split into 16x16 blocks when RD says so

Each quadrant is now coded twice -- whole, and as four 16x16 sub-blocks --
and the cheaper of the two is kept, with the partition symbol's own rate in
both costs. The reconstruction is snapshotted and restored between trials so
prediction always reads the winner, and mode bookkeeping moved to the 16x16
grid the spec's mode context is defined on.

Measured over a three-point ladder against the whole-only encoder: -9.15%
BD-rate on 1080p film, -27.20% on screen capture, -9.05% on a phone clip,
-22.45% on the synthetic diagonal, and +0.00% on stripes, which never splits.

Mixing block sizes exposed a real conformance defect: the chroma txb_skip and
DC-sign contexts were read from a single neighbour cell, while the decoder
gathers over every 4x4 unit the block spans (spec 5.11.39, 8.3.2). Under a
uniform 32x32 encoder the one cell is the whole span, so the bug could not
show; with a 16x16 beside a 32x32 the arithmetic decoder desynchronised as
+-1 sample drift. Neighbours::around now gathers both edges. Two gates added:
a 16x16 inverse-transform comparison against ffmpeg, and a direct test that
the gathered read sees a cell the single-cell read misses.
feat(av1): the tile adapts its CDFs as it writesAhmet Kaan Gümüş · 8a54f53
feat(av1): the tile adapts its CDFs as it writes

AV1's symbol decoder updates every non-literal CDF it reads, so an encoder
that leaves `disable_cdf_update` off has to keep the same state and update it
in the same order. This adds that state and writes the key frame's tile
through it.

Tables the decoder keeps one copy of are one copy here too: a 64x64 luma
transform reads the 32x32 base-range rows, both luma sets share one DC sign
and one 1024-position end-of-block table, and both chroma sets share their own
sign table. The gathered partition CDF an edge superblock reads is built for
the read and thrown away, so nothing adapts there.

The coefficient rate term still prices against the defaults: the mode search
runs before the tile is written, so the adapted state does not exist yet.

BD-rate against the same encoder with adaptation off, over a three-point
ladder: -3.52% on a 1080p film frame, -5.63% on a screen capture, -11.25% on
the test card. The ffmpeg/dav1d roundtrips are the gate -- a decoder adapting
its own tables desyncs the moment the order or the sharing differs.