forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 576f72dcd75652f07cda040fafccd3edf3201ccfFiltered to crates/ec-av1/src/encode.rsClear filter

2026-09-01

fix(av1): have_ffmpeg() SKIPped green under EC_AV1_REQUIRE_AOMENC=1Ahmet Kaan Gümüş · 91c1335
fix(av1): have_ffmpeg() SKIPped green under EC_AV1_REQUIRE_AOMENC=1

Every real-aomenc gate opens `if !have_ffmpeg() || !have_aomenc()`, and
only have_aomenc() asserted under the require flag -- have_ffmpeg() is
evaluated first and short-circuits, so a machine without ffmpeg printed
SKIP and the whole 20-gate batch reported green with the require flag
set (class gate-skips-on-its-own-failure).

have_ffmpeg() now mirrors have_aomenc(): absence panics when
EC_AV1_REQUIRE_FFMPEG=1 or EC_AV1_REQUIRE_AOMENC=1 is set (an aomenc
gate decodes its stream through ffmpeg, so requiring the oracle implies
requiring ffmpeg). Applied to all five copies of the helper
(stream/tile/decode/encode/encoder test modules), which had the same
silent-false shape.

2026-08-30

Merge branch 'lane-gm': non-IDENTITY global motion decodes through the warp pathAhmet Kaan Gümüş · 384a874
Merge branch 'lane-gm': non-IDENTITY global motion decodes through the warp path

Four rounds. The first three ported the syntax correctly -- gm_get_motion_vector,
the mvstack neighbour substitution, the is_global_mv_block vs
is_nontrans_global_motion split -- and the wedge gate still mismatched, because
every check that compared mv VALUES passed. A range ladder settled it: our msac
range and the instrumented aomdec's were both 38664 at the offending block, so
entropy was in sync and the defect was prediction-side. libaom's allow_warp has
a global_warp_allowed branch that predicts every is_global_mv_block block with
the full per-pixel affine warp, independent of motion_mode; this decoder only
ever warped for local WARPED_CAUSAL and fell back to translational MC on the
block-centre mv -- a centre-point approximation whose error grows with distance
from the centre, which is exactly the error shape that was observed.

r4 implements that path, reusing the existing warp_affine and shear machinery
rather than writing a second one. The seed-43 pin's frame 1 luma, the divergence
r3 root-caused, now matches, as do frames 0-13. The blanket "any non-IDENTITY
global motion" refusal is replaced by two named ones: AFFINE models, and more
than one concurrently active ROTZOOM/AFFINE ref slot -- the latter is a real
residue r4 localized but did not root-cause, and refusing it beats guessing.

Also fixed en route: gm_get_motion_vector was missing the -1 on both block-centre
offsets that libaom's block_center_x/y apply.

Full lib suite 231 passed / 0 failed. The wedge gate's match count is 11-16 of 40
across runs -- it selects a different aomenc attempt each run, so single-run
counts from any one round are not comparable.
wip(av1): intra HORZ/VERT strip dispatch (skip-only), recovered from stashAhmet Kaan Gümüş · 770cfc0
wip(av1): intra HORZ/VERT strip dispatch (skip-only), recovered from stash

Builder hit its turn cap with the whole implementation sitting in a stash;
committed verbatim as recovered so it cannot be lost. Gate ladder, report and
scope-down rationale still owed.
wip(av1): mvstack global-motion substitution plumbing (inert: NO_GM_MV, all flags false)Ahmet Kaan Gümüş · 149fd7a
wip(av1): mvstack global-motion substitution plumbing (inert: NO_GM_MV, all flags false)

MiInfo gains is_global_mv0/1 (all ctors false), GmMvTable threaded through the
single-ref scans, and the TPL zero_mv_ctx comparison now measures against gm_mv
instead of zero (mvref_common.c:369-370). decode.rs still passes NO_GM_MV, so
behaviour is unchanged until the wiring lands.
feat(av1): widen intra::predict/Edges to rect (bw != bh)Ahmet Kaan Gümüş · 24d69ed
feat(av1): widen intra::predict/Edges to rect (bw != bh)

Predictor + Edges::build now take (bw, bh) instead of one side: DC's
dc_predictor_rect multiply-shift divide (derived, not tabulated, per
libaom's own comment -- AV1's only rect ratios 1:2/1:4 leave d==3/5),
smooth's separate width/height weight rows, and the directional walk's
bw+bh reach with cross-axis edge-filter/upsample extensions (above
extends by bh, left by bw -- reconintra.c's txwpx/txhpx swap). Also
fixes a latent bug this widening surfaced: intra_edge_filter_strength
was missing the blk_wh<=12 branch, unreachable for any square side sum
but live for e.g. a 4x8 block.

All 21 call sites still pass (side, side); full lib suite green
(223/223) proves square behaviour is bit-identical. Tile dispatch
still refuses rect/AB partitions -- next lane's job.

2026-08-28

fix(av1): rect-flake-1 byte-exact -- MiInfo size_h, rect warp samples/projection dims, OBMC per-pass overlap, deblock tx-height gridAhmet Kaan Gümüş · 8e2b541
fix(av1): rect-flake-1 byte-exact -- MiInfo size_h, rect warp samples/projection dims, OBMC per-pass overlap, deblock tx-height grid

Three prediction-side root causes after the CDF rows: (1) neighbour records
carry true height (size_h) so a rect strip donates warp samples at ITS
center and col scans step/weight by height; find_projection gets the
strip's true dims -- wmmat now matches aomdec exactly. (2) obmc_blend:
per-pass neighbour caps (width-log2 above, height-log2 left) and overlaps
(bh/2 above, bw/2 left). (3) tx_h_grid: deblock horizontal edges gate by
transform HEIGHT; the single-scalar grid deblocked the strip seam wrong
(1-px chroma drift).
WIP(av1): compound mvstack candidate machinery, not yet wiredAhmet Kaan Gümüş · 368413c
WIP(av1): compound mvstack candidate machinery, not yet wired

find_mv_stack_compound: parallel entry point to find_mv_stack_with_sign_bias
for a block predicted against a reference-frame pair (spec 7.10.2's
is_compound path). Adds:
- MiInfo.mv1 (the compound second MV, paired with r3's ref_frame1)
- scan_row_compound/scan_col_compound/scan_top_right_compound/
  scan_corner_compound: exact-pair-matched twins of the single-ref scans
- process_compound_ref_mv_candidate + CompoundRefLists +
  combine_compound_candidates: the compound extension/topping pass
  (mvref_common.c's process_compound_ref_mv_candidate + the combine step)
- CompoundTplArgs: compound temporal-MV fold-in, reusing motion_field's
  existing single-ref add_tpl_ref_mv once per side of the pair
- new_mv_ctx/ref_mv_ctx reuse the existing (nearest_match, ref_match_count)
  switch, which libaom's own mode_context switch is ref-count-agnostic about

Documented deviations: tpl compound candidates drop (not zero-fill) a
missing side; the extension combine step dedups by weight-bump instead of
libaom's real is_dup skip-on-first-match. Both noted in find_mv_stack_compound's
doc for a later round to tighten if a live compound gate's drl_ctx disagrees.

Every existing single-reference caller (find_mv_stack/
find_mv_stack_with_sign_bias and their 23 pre-existing tests) is untouched;
this is purely additive, unwired code, same pattern as r1/r3. 6 new tests,
cargo test --release -p ec-av1 --lib: 205 passed / 0 failed / 16 ignored.
WIP(av1): carry a compound second reference through MiInfo/NeighboursAhmet Kaan Gümüş · cfa1e23
WIP(av1): carry a compound second reference through MiInfo/Neighbours

Step 1 of the compound-decode chain (lane-av1comp): MiInfo grows
ref_frame1: Option<i8> (spec RefFrames[1]) and decode.rs's Neighbours
grows above_ref1/left_ref1 alongside above_ref/left_ref, mirroring the
existing i8 single-ref tracking. Every one of the 24 MiInfo literal
sites across decode.rs/encode.rs/mvstack.rs/tile.rs sets it to None --
no decode or encode path here ever produces a compound block yet, so
this is pure plumbing: find_mv_stack's scan still matches candidates
on ref_frame alone, and reference_mode_ctx/comp_reference_type_ctx
(landed r1, 1fcb059) still have no caller.

Next: read_ref_frames replacing stream.rs:181-195's reference_select
refusal (decodemv.c:966-990/1000+, is_comp_ref_allowed blockd.h:65-67),
then inter_compound_mode CDF/tree + compound DRL, then mvstack's dual-
ref candidate scan (process_compound_ref_mv_candidate,
mvref_common.c:435-455/696-762 -- the largest remaining piece), then
the COMPOUND_AVERAGE/dist_wtd_comp_avg MC blend. See the lane-av1comp
ledger entries for the full ordered plan.

2026-08-27

feat(av1): implement the intra edge filter/upsample (spec 7.11.2.7-2.9)Ahmet Kaan Gümüş · 645882d
feat(av1): implement the intra edge filter/upsample (spec 7.11.2.7-2.9)

r5 left directional()'s edge filter/upsample as an unimplemented corner-cut
and left the two new predict() bool params half-plumbed (encode.rs call
sites done, stream.rs/decode.rs test-module sites missing). This round:

- finished the plumbing: decode.rs threads the sequence header's
  enable_intra_edge_filter through a thread-local (ENABLE_EDGE_FILTER,
  set once per decode_key_frame_tile_with_cdfs call, not per-block --
  documented why a thread-local beats touching two dozen call sites)
  down to PlaneBuf::reconstruct's predict() call; stream.rs sets it from
  the parsed seq header; encode.rs sites already passed false (our
  encoder never turns it on, so round-trips stay bit-green regardless).
- filter_intra_edge (5-tap kernel, 3 strength buckets via
  intra_edge_filter_strength's two smooth/non-smooth threshold tables),
  the filter_corner blend, and upsample_intra_edge (av1_upsample_intra_edge_c)
  were transcribed against libaom's reconintra.c and wired into
  directional()'s z1/z2/z3 walk (base/shift math doubled for the
  upsampled-density case). All present, none stubbed.
- flipped the gate's --enable-intra-edge-filter=0 to =1 so
  a_real_aomenc_stream_with_directional_chroma_decodes_pixel_exact
  actually exercises the new path instead of the disabled one.

The gate still fails, but NOT from this filter: patched-aomdec
cross-checks (EC_UDUMP dqcoeff/pred/recon dumps, /tmp/libaom-src's
decodeframe.c, not committed) prove the failing TU (chroma cpx=0/cpy=0,
DC_PRED, tx_type DctDct, skip=1 both sides) reconstructs bit-identically
pre-loop-filter in both decoders -- flat 128 either way, edge filter
inapplicable there (no real neighbours, corner-filter's 2n>=24 gate
doesn't fire at n=8). A PREDEBLOCK/POSTDEBLOCK trace (also not committed)
localizes the actual divergence to apply_deblock: our decoder introduces
a value our own pre-filter data does not justify at the row6-9/col6-9
TU-corner intersection, where both a horizontal and a vertical deblock
edge are filtered back to back. r4/r5's "intra edge filter gap" and
"tx_type path" suspects are both now falsified for this failure; the
next round's target is deblock_plane's edge-intersection order/read-back
(vertical-then-horizontal at a corner where an already-filtered vertical
sample feeds the horizontal filter's taps).

Suite: 174 passed, 1 failed (the known gate above) -- no regression from
r5's own checkpoint of the same numbers; the cdffwd flake did not fire
this run.
wip(av1): chroma tx_type derivation from Intra_Mode_To_Tx_Type, wires default_tx_typeAhmet Kaan Gümüş · 637d48a
wip(av1): chroma tx_type derivation from Intra_Mode_To_Tx_Type, wires default_tx_type

read_coeffs already carried a default_tx_type parameter from a prior round;
both call sites (read_plane's intra path and read_inter_plane's inter path)
didn't pass it yet, so the tree didn't compile. Wires them:

- read_plane (intra): plane_idx==0 or side>=32 -> DctDct (av1_get_tx_type,
  blockd.h: 64-and-up is unconditional, 32x32 chroma survives
  intra_mode_to_tx_type only to be re-forced by EXT_TX_SET_DCTONLY gating
  in av1_get_ext_tx_set_type); otherwise chroma takes
  default_intra_tx_type(predict_mode), a from-libaom transcription of
  intra_mode_to_tx_type's static table (D45_PRED is DCT_DCT, not an ADST
  mode -- transcribed exactly, no set-membership fallback needed since
  every entry the table can produce (DCT_DCT/ADST_DCT/DCT_ADST/ADST_ADST)
  is already inside both TX_SET_INTRA_1 and _2).
- read_inter_plane: always DctDct -- Intra_Mode_To_Tx_Type only applies to
  an intra block's chroma plane per av1_get_tx_type's own is_inter branch.

Cross-checked against a live patched aomdec (EC_CHROMA_TXTYPE trace in
/tmp/libaom-src/av1/decoder/decodetxb.c, not committed here) on the
lane's own seed-42 aomenc fixture: every uv_mode -> tx_type pair libaom
picked for this stream's chroma matches default_intra_tx_type exactly.

Suite: 174 passed, 1 failed (the new
a_real_aomenc_stream_with_directional_chroma_decodes_pixel_exact) --
NOT the pre-existing cdffwd flake. Confirmed the failure predates and
survives this fix: reverting default_tx_type to always-DctDct made the
mismatch start at pixel row 0 (whole-plane wrong); with this fix it
starts at row 6 and grows outward in a triangular fan, meaning the
tx_type choice is not itself wrong (matches libaom's own choice
byte-for-byte) but something downstream of it -- reconstruction/
directional-prediction propagation -- still diverges. Left failing,
not silenced or adjusted, for the next round to chase with the two
named suspects (intra edge filter gap, this tx_type path) now narrowed
to one.
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.
test(av1): let the leaf8 straddle-sequence test dump its stream (EC_AV1_DUMP)Ahmet Kaan Gümüş · fd61351
test(av1): let the leaf8 straddle-sequence test dump its stream (EC_AV1_DUMP)

Same pattern as the single-frame round-trip test, needed to feed the
sequence's frame 2 to an instrumented aomdec for lane-av1inter8 r4's
real-decoder mv comparison.
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.
feat(av1dec): teach the decoder the 8x8-leaf straddle path, lift the RD guardAhmet Kaan Gümüş · ca24626
feat(av1dec): teach the decoder the 8x8-leaf straddle path, lift the RD guard

decode.rs's key-frame partition walk now mirrors write_leaf8: at a
straddling 16x16 (exactly one axis in-frame at the 16 level), it reads
the gathered split bool, then per in-frame 8x8 leaf reads partition_w8
NONE and decodes mode + Luma8/Chroma4 coefficients (decode_leaf8),
carrying the mi-precise Neighbours split (above_side_mi/left_side_mi,
record_mi/around_mi/partition_ctx_mi) already used for the coefficient
context, and mirroring the r15 above_mode/left_mode writeback rule from
the last leaf.

40x32 and 640x360 key frames decode byte-exact against the encoder's
own reconstruction, and 40x32 agrees with ffmpeg. With the read path
proven, encode.rs's `!has_leaf8` RD-cost guard is lifted: leaf8 can now
win on cost anywhere, not just when forced by an illegal whole block.
Full gate: 155 passed, 0 failed, 10 ignored.
fix(av1): keep the leaf8 RD-cost guard until crate::decode reads leaf8Ahmet Kaan Gümüş · 1d41e74
fix(av1): keep the leaf8 RD-cost guard until crate::decode reads leaf8

r15 proved the 8x8-leaf path against ffmpeg, but the in-crate software
decoder has no leaf8 read path yet; letting leaf8 win on cost at sizes
decode_stream round-trips broke 3 decoder tests. Guard re-instated with
the new reason; lifts when decode.rs learns the path.
Merge branch 'lane-av1-rect': mod-32==8 key frames — the 8x8-leaf straddle pathAhmet Kaan Gümüş · e05f550
Merge branch 'lane-av1-rect': mod-32==8 key frames — the 8x8-leaf straddle path

Fifteen rounds: side-8 CDF layer (TX_8X8/TX_4X4, partition_w8), Reach and
scan tables for 8x8 leaves, mi-precise partition/mode contexts, the CFL
alphabet, reduced_tx_set declared in the key-frame header, and the leaf
mode-neighbour write moved out of the per-leaf loop. 640x360-class key
frames now encode and round-trip through ffmpeg bit-exact; the 8x8-leaf
split competes on RD cost; 40x40-class both-axes sizes still refuse.
fix(av1): thread the last leaf's mode past the whole straddling quadrantAhmet Kaan Gümüş · d02638d
fix(av1): thread the last leaf's mode past the whole straddling quadrant

write_leaf8's above_mode[c]/left_mode[r] forced write (r12) ran once per
leaf inside the quadrant's leaf loop, so the first leaf's write clobbered
the true external neighbour mode a second leaf of the *same* straddling
16x16 still needed to read on its non-adjacency axis. Move the write out
of write_leaf8 to run once, after the whole leaf loop, from the last
(bottom/right-most) leaf. a_single_axis_straddle_round_trips_through_ffmpeg
now decodes clean; un-ignored. Lifted the RD-cost guard that kept leaf8
splits from competing on cost (now decoder-proven); full gate 136/0/9.
fix(av1): declare reduced_tx_set in the key-frame header; rng in tracesAhmet Kaan Gümüş · a9fbebe
fix(av1): declare reduced_tx_set in the key-frame header; rng in traces

The writer coded 8x8-leaf tx types against TX_SET_INTRA_2 tables while
the header's reduced_tx_set:false told decoders to read TX_SET_INTRA_1 —
a 7-vs-5-symbol alphabet skew that shifts the arithmetic coder's range
with no symbol value ever differing. All existing sizes still round-trip
bit-exact (16x16 resolves to the same 5-symbol set under both headers).
Straddle test stays ignored: a further divergence remains past leaf(0,8).
fix(av1): 8x8 leaf reads the CFL-allowed uv_mode CDF, threads its mode forwardAhmet Kaan Gümüş · e3b2c93
fix(av1): 8x8 leaf reads the CFL-allowed uv_mode CDF, threads its mode forward

write_leaf8 hardcoded cfl:false for write_intra_mode's chroma-mode CDF, but
is_cfl_allowed (spec 5.11.5) is true up to 32x32 -- every other write_block
caller at 16x16 and up already passes true. The narrower uv_mode_no_cfl
alphabet is one symbol short of uv_mode_cfl, so even an identical DC_PRED
decision consumed a different amount of arithmetic range and derailed the
stream from that leaf onward.

record()'s above_mode/left_mode write is also a no-op at an 8x8 leaf's own
side (side/SUB == 0), and write_leaf8 only called record_mi, never updating
those coarse arrays -- so a second straddling 16x16 quadrant stacked above
or left of the first (outside r11's same-call prev_leaf override) read
whatever stale mode sat in that slot. Fixed by writing the leaf's own mode
into above_mode[c]/left_mode[r] directly.

Full suite still 134/0/10; the straddle round-trip stays ignored -- a
residual divergence now shows up one leaf further in (leaf(2,8) reads its
own luma coefficient block at the wrong tx size), not yet isolated to a
single symbol.
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(av1dec): decode skip blocks, directional intra modes, odd frame sizesAhmet Kaan Gümüş · 632319a
feat(av1dec): decode skip blocks, directional intra modes, odd frame sizes

Extends the software key-frame tile decoder past round 1's whole-superblock
DC_PRED-only scope: skip=1 blocks decode to pure prediction (no residual
read); all thirteen intra modes decode via crate::intra::predict, reusing
encode.rs's Reach edge/reach rules (made pub(crate)) for the directional
above-right/below-left reads; frames that are not a whole number of 64x64
superblocks or 32x32 blocks decode via the same gathered-CDF partial-block
path tile.rs's writer uses, with a duplicated (not shared -- tile.rs is
another lane's territory) Neighbours/gather implementation kept in step by
the byte-exact round-trip tests.

Fixed along the way: read_plane's cdfs.txb() lookup was hardcoded to
DC_PRED's table for every plane, which only worked by coincidence while
every stream really was DC_PRED; real modes need the block's own luma mode
there (matching write_block_planes) even though chroma's own prediction
mode stays DC_PRED.

decode_key_frame_tile's signature grows frame_width/frame_height (the
header's separate true render size) to crop the reconstruction the same way
crop_encoded does, since mi_cols/mi_rows alone cannot invert to it losslessly.
feat(av1): begin a software key-frame decoder (round 1)Ahmet Kaan Gümüş · e6eadb9
feat(av1): begin a software key-frame decoder (round 1)

Promotes msac's test-only SymbolDecoder to a real, non-test decoder
(the inverse of SymbolEncoder, already spec-derived and roundtrip
tested), and adds crates/ec-av1/src/decode.rs: a from-spec reader that
mirrors tile.rs's sb_coeff_key_frame_tile symbol order (partition tree
through 64x64/32x32/16x16, coefficient base/base-range/EOB/Golomb/sign
syntax, CDF adaptation) without importing from tile.rs, which a
sibling lane is editing concurrently.

Round 1 scope: key frames only, DC_PRED blocks only, unskipped, and
frames a whole number of 64x64 superblocks -- everything else refuses
with a named error rather than miscoding. Within that scope, real
encoder output (encode_key_frame_with_modes forced to DC_PRED, two
sizes, real quantised AC/DC residual) decodes byte-exact against the
encoder's own reconstruction. Encoded gains three pub(crate) fields
(tile, mi_cols, mi_rows, base_q_idx) so a decoder test can reach the
raw tile payload without re-deriving it from the OBU stream.

Deferred to round 2: non-DC_PRED intra modes (needs the directional
edge-reach plumbing), inter frames, skipped blocks, and the
partial-superblock/gathered-CDF true-edge path.
fix(av1): mi-precise partition ctx for 8x8 leaves; falsify r7's ctx hypothesisAhmet Kaan Gümüş · 9a69856
fix(av1): mi-precise partition ctx for 8x8 leaves; falsify r7's ctx hypothesis

Neighbours gained above_side_mi/left_side_mi (mi-granularity, mirroring
above/left) and partition_ctx_mi, so a straddling 16x16's second 8x8
leaf reads its own finer neighbour state instead of the enclosing
16x16 slot. Spec-accurate improvement, does not regress the gate
(134 passed, 10 ignored, unchanged).

r7's named falsification candidate for the 40x32 dav1d desync --
partition_w8's ctx reading the enclosing slot -- is FALSIFIED by an
EC_RNG/EC_TRACE2 trace diff against a debug aomdec: libaom's own
partition_plane_context masks at bsl=0 for BLOCK_8X8, and every
partition_context_lookup entry a 4x4-free writer ever produces has
bit 0 clear, so ctx is provably 0 on both sides regardless. The real
first divergence is later, inside leaf0's own luma transform
(TxbSet::Luma8/Chroma4, exercised by no other caller): the decoder
reads a wrong EC_EOBPT category (eob=36 vs the writer's real eob=7)
somewhere between the TX_TYPE and EOB_PT symbols. Named in the test's
doc comment for the next round.
feat(av1): a quality/size targeting surface over base_q_idxAhmet Kaan Gümüş · a55d2ef
feat(av1): a quality/size targeting surface over base_q_idx

RateTarget::{QIndex,Quality,BytesPerFrame} on Av1Encoder::with_rate_target,
additive alongside the existing EncoderConfig::base_q_idx path. Quality
maps to base_q_idx via the calibration sweep's linear fit; BytesPerFrame
steers it with a clamped proportional controller (no accumulated debt, so
no windup class to bound). Calibration sweep test records the curve.
fix(av1): Reach tables for side=8, coeff_bits TX4 scan; wire key-frame 8x8-leaf pathAhmet Kaan Gümüş · 51db03e
fix(av1): Reach tables for side=8, coeff_bits TX4 scan; wire key-frame 8x8-leaf path

Root-caused the r6 panic to two independent bugs, both fixed:
- Reach::of's HAS_TOP_RIGHT/HAS_BOTTOM_LEFT tables only ever covered side
  16/32 (libaom's 128-superblock-relative bit tables); side==8 fell through
  to the 16-table with a 16-wide stride and indexed past its 8-byte length.
  Added libaom's has_tr_8x8/has_bl_8x8 as a third table row.
- tile::coeff_bits's SCANS cache had no TX4 entry, so an 8x8 leaf's 4x4
  chroma coefficient search read TX32's 1024-entry scan against a 16-entry
  grid. Added the missing TX4 scan.

Wired encode_key_frame_inner's key-frame block-generation loop to build
BlockCoeffs::eight for a 16x16 sub-block that straddles the true frame edge
on exactly one axis (mirroring `write_leaf8`'s 1-or-2-leaf geometry), while
still refusing a sub straddling on both axes (needs a rectangular transform
neither writer has). The leaf-8 split is only ever taken when the whole
32x32 is illegal (forced) -- never chosen on RD cost over an already-legal
whole block, since the leaf path is not yet proven against a real decoder
and must not regress sizes that already round-tripped correctly.

Narrowed both_writers_refuse_the_same_strictly_before_half_straddle_size
(now key_frame_encodes_the_inter_frame_still_refuses_at_half_straddle_size)
and a_picture_off_the_block_grid_is_refused to the classes that are still
genuinely refused (both-axes-cut, e.g. 40x40) vs. now accepted without
erroring (640x360, 40x32). Added a decoder round-trip test at 40x32,
`#[ignore]`d: the leaf-8 stream is not yet decoder-clean (dav1d rejects it,
"Invalid data found") -- a genuine desync, not yet traced to its first
mismatched symbol. Added EC_PART/EC_TOK tracing to the leaf-8 write path
for that follow-up.
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.
test(av1): exercise the 16x16 straddle-leaf inter path on real contentAhmet Kaan Gümüş · cdf3858
test(av1): exercise the 16x16 straddle-leaf inter path on real content

real_clip_encodes_within_its_quality_and_size_budget uses 640x384 (both
axes 32-aligned), so Quadrant::Split never fires and the e19bb47
NEARESTMV leaf path was untouched by real, mixed intra/inter content.
Add a sibling at 704x400 (400 mod 32 == 16, the exactly-half straddle
class), same three gates: dav1d decodes every frame, mean luma PSNR
floor, byte ceiling.
fix(av1): mvstack extended row/col scan, intra-aware coverage; enable 16x16 inter leavesAhmet Kaan Gümüş · b26ee9f
fix(av1): mvstack extended row/col scan, intra-aware coverage; enable 16x16 inter leaves

Ports spec 7.10.2.4's extended row/col scan (libaom scan_row_mbmi/
scan_col_mbmi's idx=2..MVREF_ROW_COLS positions), invisible at pure
8-mi geometry because the immediate scan's own processed_rows/cols
coverage already reaches as far -- but only once that coverage counts
every *coded* neighbour cell, intra or inter, the way libaom's
processed_rows update sits outside add_ref_mv_candidate's ref-frame
match. The straddle-test attempt this round started from computed
coverage only from ref-matching (inter) cells, so an intra neighbour
above an 8-mi query silently un-suppressed the extended scan -- a real
8-mi behavior change, caught by two new differential tests
(extended_{row,col}_scan_is_a_no_op_at_8mi_geometry_even_behind_an_intra_neighbour)
that place a distinctively-MV'd tracer candidate at the extended
offsets and assert it never gets picked up. MiGrid now records intra
cells (encode.rs/tile.rs's else branches) so mvstack sees them.

With the no-op proven, lifts the `false &&` gate on 16x16-leaf
NEARESTMV (encode.rs:1231, wired r1, gated since dead code never
touched write_inter_frame_leaf's real symbol chain): full suite
130+3 new = 133/0/9, straddle and real_clip both green with the gate
live. The 640x384 real-clip fixture tiles exactly into 32x32
quadrants (no true-edge straddle), so its numbers are unchanged
(45.41 dB / 69861 bytes) -- the gate's leaf path is unexercised there;
the straddle test is what proves it live.
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).
fix(av1): key the probe stream's temp file per call, not per processAhmet Kaan Gümüş · f9d5fb9
fix(av1): key the probe stream's temp file per call, not per process

ffprobe_size named its temp file by process id alone, so every test in
the binary shared one path; a parallel test's cleanup could delete the
stream another test's ffprobe was mid-read on. This was the recurring
first-run gate flake (127/2 after 3cb60f6, 128/1 after 78fc36c) -- an
atomic counter now makes each call's path distinct.
test(av1): standing real-content regression gate on encode.rsAhmet Kaan Gümüş · 7b73e56
test(av1): standing real-content regression gate on encode.rs

Two recent regressions (a padded-size inter FrameHeader dav1d rejected;
a 1280x720 export refusal) were only caught by a downstream repo's
gate. real_clip_encodes_within_its_quality_and_size_budget encodes 12
frames of a real 1080p H.264 fixture clip, scaled to 640x384, and
asserts dav1d decodes every frame, mean luma PSNR stays within 0.5 dB
of the measured 45.41 dB, and the stream stays within 15% of the
measured 69861 bytes.
feat(av1): SAD-prescreen search_inter_block's intra loop, default K=3Ahmet Kaan Gümüş · 1120e46
feat(av1): SAD-prescreen search_inter_block's intra loop, default K=3

search_inter_block ran every one of the 13 intra candidates through a
full RD trial (forward transform, quantize, reconstruct, coeff_bits)
even though NEWMV/NEARESTMV usually wins on an inter block. Wire the
same SAD-prescreen rule search_block already uses (DC always kept,
cheapest top_k by SAD-plus-mode-cost) into this loop via a new
Plane::intra_scores + shared prune_by_sad, gated by its own
Search::top_k default (INTER_PRUNE_TOP_K, env EC_AV1_PRUNE_K_INTER) so
the key-frame path's default stays untouched.

Real-clip sweep (prune_k_quality_sweep_inter: 3 clips, q 60/150, K in
{3,4,6}) clears the same PSNR/bytes rule for every K tried (worst
-0.011dB / +0.147% bytes), so K=3 -- the cheapest -- ships as the new
inter-path default. sequence_bench_sanity: 807ms/frame -> 556ms/frame
at K=3 (-31%), 73622 -> 73759 bytes (+0.19%). top_k forced unpruned
reproduces byte-identical output vs the pre-change build (73622 bytes
both).
perf(av1): stop repricing an inter block's chroma trial 13 times overAhmet Kaan Gümüş · cc09bf2
perf(av1): stop repricing an inter block's chroma trial 13 times over

An inter frame's intra-candidate loop in search_inter_block always coded
both chroma planes as DC_PRED, independent of which of the 13 luma modes
the loop was on -- so the identical transform/quantize/coeff_bits call
ran twelve times for nothing on every inter block. Hoist it out of the
loop and clone the one result in (bit-identical: same call, same inputs,
same output, verified by the full 129-test suite and an equal output
byte count on the stage_timing_breakdown_inter probe, 1356 bytes before
and after).

Also add stage_timing_breakdown_inter, an #[ignore]d probe that breaks
one inter frame's time into motion search / mc::predict / transform+
quantize / coeff_bits buckets, which is how this was found: transform+
quantize was the largest bucket (454.78ms of 980.36ms), not motion
search (267.26ms, of which 257.01ms is genuine sub-pel interpolation
work already spent inside the diamond search).

1280x720 inter frame: 980.36ms -> 772.05ms (-21%).
test(av1): add prune_k quality sweep + 24-frame 720p sequence sanity probesAhmet Kaan Gümüş · 6c0d621
test(av1): add prune_k quality sweep + 24-frame 720p sequence sanity probes

In-process thread_local override lets prune_k_quality_sweep compare
Search::top_k pruned vs unpruned in one build without env-var races
(#![forbid(unsafe_code)] rules out std::env::set_var here). Both stay
#[ignore] perf/quality probes, not gates -- numbers reported in the
lane report.
perf(av1): SAD-prescreen the 13-mode intra search, gated off by defaultAhmet Kaan Gümüş · 7f9b971
perf(av1): SAD-prescreen the 13-mode intra search, gated off by default

search_block now predicts every mode once (unchanged cost) and ranks by
a cheap SAD-plus-mode-bits pre-pass before spending the full RD trial
(forward transform, quantize, reconstruct, coeff_bits) on the winners;
Search::top_k picks how many survive plus DC, always. Default stays
None (all 13 modes, byte-identical output, 129/0/5 green) until the
quality gate sweep in the lane report picks a K to ship as default.
style(av1): cargo fmtAhmet Kaan Gümüş · 8593d36
style(av1): cargo fmt

cargo test -p ec-av1 --release: 129 passed, 0 failed, 5 ignored.
perf(av1): cache the forward DCT basis; make it contiguous, both bit-exactAhmet Kaan Gümüş · 91b85b5
perf(av1): cache the forward DCT basis; make it contiguous, both bit-exact

Added stage_timing_breakdown (a perf probe, #[ignore]d like the existing
sweeps): 1920x1080 13-mode key frame was 3.97s. forward_and_quantize alone
was 32.25us/call at 32x32, more than inverse+entropy combined -- because
dct_basis() recomputed side*side cosines from scratch on every single
mode trial, size-invariant work redone thousands of times a frame.

Two levers, both exact (same summation order, so identical bits out):
- dct_basis is now built once per transform size and cached (OnceLock),
  not recomputed per trial.
- forward_transform_2d's two matrix passes are written as contiguous
  dot products (row of residual/basis, then a transposed row pass)
  instead of one strided index loop, so the optimizer can vectorize them.

forward_and_quantize: 32.25us -> 15.38us per 32x32 call.
1920x1080 13-mode key frame: 3.97s -> 1.78s (2.2x).
3840x2160: 10.60s -> 7.08s (1.5x).

cargo test -p ec-av1 --release: 129 passed, 0 failed, 5 ignored (the new
probe). All streams stay byte-identical to their own reconstruction.
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.
fix(av1): inter tile writer codes a true-edge-straddling 32x32 quadrantAhmet Kaan Gümüş · cdfc846
fix(av1): inter tile writer codes a true-edge-straddling 32x32 quadrant

sb_coeff_inter_frame_tile refused every straddling 32x32 quadrant
outright, with a message claiming an 8x8 split it never actually
needs for the common edge-at-or-past-halfway case (e.g. 1280x720,
where 720 mod 32 == 16). Ported the key-frame writer's Quadrant::Split
handling: such a quadrant now splits into up to four 16x16 leaves,
coded through the inter frame's intra branch (no Luma16Inter tx_type
table exists for a genuine inter leaf at that size, and these leaves
only fill the true edge's sliver of real content). The genuine
"strictly before half of a 16x16" class -- which does need a
rectangular transform -- still refuses, with an accurate message.

sb_coeff_inter_frame_tile's `blocks` parameter is now `&[Quadrant]`
(reusing the key-frame writer's own type) instead of `&[BlockCoeffs]`;
encode_inter_frame's search does the matching split, reusing
code_square for the 16x16 leaves.
fix(av1): clamp inter MC reads to the reference's true extent, not its coding strideAhmet Kaan Gümüş · 8d520ef
fix(av1): clamp inter MC reads to the reference's true extent, not its coding stride

sequence_round_trips_at_a_non_multiple_size (160x96) failed on inter-frame
chroma/luma content: a spec decoder's reference buffer holds exactly
FrameWidth x FrameHeight (mi_cols*4 x mi_rows*4) -- a superblock's partition
stops early at has_cols/has_rows and never codes syntax for padding
columns/rows beyond the true edge, so those samples are never part of the
decoded picture. MC's Clip3 (spec 7.11.3.4) must clamp reference reads to
that true extent, replicating the true edge, not to this crate's own
padded-to-SUPERBLOCK coding surface.

`mc::sample`/`mc::predict` used one width/height pair for both the buffer's
row stride and the Clip3 clamp bound, conflating the two; split into a
`stride` param (the buffer's real row length, unchanged) plus
`true_width`/`true_height` (the clamp bound, now `Plane::true_width`/
`true_height` at the call site) threaded through `motion::search` and
`encode::mc_trial`.

Gate: 126 passed/1 failed/4 ignored -> 127 passed/0 failed/4 ignored.

2026-08-26

fix(av1): port partial-superblock support to the inter tile writerAhmet Kaan Gümüş · 68e9a25
fix(av1): port partial-superblock support to the inter tile writer

Three fixes closing the remaining true-size reds:

1. a_frame_round_trips_at_its_own_size (1920x1080): encode.rs's split-32x32
   search unconditionally pushed all 4 16x16 sub-block trials into
   Quadrant::Split, but tile.rs's writer (mirroring spec decode_partition's
   r>=MiRows||c>=MiCols early return) only expects entries for sub-blocks
   whose own mi origin is inside the true frame. Filter the search loop to
   match, same predicate both sides.

2. a_picture_off_the_block_grid_is_refused: the 32x48 case in this test was
   a symptom of bug 1 (a block-aligned 48-row true height was refused only
   because the split path demanded 4 subs where just 2 are legal), not a
   genuine 8x8-split requirement -- confirmed by adding it to
   ffmpeg_decodes_exactly_what_the_encoder_reconstructed, where it now
   round-trips pixel-exact. Updated the test's expectations to match.

3. sequence_round_trips_at_a_non_multiple_size (160x96, inter): three
   compounding bugs in the inter path, which had zero partial-superblock
   support before this round:
   - sb_coeff_inter_frame_tile checked check_superblocks (whole-SB-multiple
     only) and used mi_cols/mi_rows / SB_MI, dropping any partial trailing
     superblock; switched to check_blocks and the same block_grid ceiling
     sb_coeff_key_frame_tile uses, plus its three-way has_cols/has_rows
     superblock-level signaling (PARTITION_SPLIT / gathered VERT_ALIKE or
     HORZ_ALIKE / nothing) and quadrant-position filtering. A 32x32 quadrant
     that itself straddles the true edge is refused (this writer has no
     rectangular/further-split representation at that level), mirroring the
     key frame writer's own "cannot be left whole" refusal.
   - encode_inter_frame's block-search loop used picture.width/BLOCK (the
     padded coding surface) for its block grid instead of the true,
     mi_cols-derived grid, overrunning the tile writer's expected block
     count whenever the true size is not a 64-multiple.
   - encode_inter_frame built its FrameHeader from the padded picture's own
     width/height instead of `render` (the true size), the same render vs.
     padded-picture split encode_key_frame_inner already makes for
     key_frame_headers_colour -- this alone produced a bitstream dav1d
     rejected outright ("Invalid data") since inter frame_width/mi_cols
     disagreed with the true size the key frame declared.

Gate 122/3/4 (round start) -> 126/1/4: one chroma-content mismatch remains
on the first inter frame at 160x96, unrelated to true-size handling (all
quadrants there are already block-aligned, no partial-block path involved)
-- a pre-existing inter-frame defect this size never exercised before,
left for its own round.
fix(av1): clamp intra reference reads to the true edge even off a block's own row/colAhmet Kaan Gümüş · dc2d88c
fix(av1): clamp intra reference reads to the true edge even off a block's own row/col

libaom's av1_predict_intra_block (av1/common/reconintra.c) derives xr/yd --
the distance from a block's own right/bottom to the frame edge -- from
mb_to_right_edge/mb_to_bottom_edge, which are built from mi_cols/mi_rows
(the true, decodable extent), never any padded coding surface. n_top_px/
n_left_px is min(side, xr + side) even for a block whose own extent
straddles that edge legally (has_half) -- prediction does not get real
reconstructed pixels past the true edge for its own row/column either,
only reach ever got that clamp before. Plane::edges() now clamps the
own-portion the same way libaom's xr/yd do.

Verified pixel-exact against aomdec on the 216x96 col-edge repro
(mi(8,48)) that was silently wrong before (0 diffs, previously untested).
Gate unchanged at 124/127 -- the remaining 3 reds (854x480, 1920x1080,
non-multiple-size sequence) trace to a separate, not-yet-isolated defect:
a uniform -3 luma offset across every straddling block in a column strip,
first appearing at mi_row=8 mi_col=208 in 854x480 with a nonzero DC
coefficient present, i.e. downstream of this fix (dequant/IDCT or mode
choice, not reference-sample availability).
fix(av1): narrow the true-edge availability clamp to the reach extension onlyAhmet Kaan Gümüş · 01cb49b
fix(av1): narrow the true-edge availability clamp to the reach extension only

A block's own edge read (no `reach`) can land on a block that is legally
whole despite straddling the true frame edge (spec hasRows/hasCols, this
crate's has_half): such a block gets a real transform over its full
padded extent, not a garbage tail, and both this encoder and a real
decoder reconstruct it that way, so clamping that base read to the true
bound (mi_cols*4/mi_rows*4) was wrong -- verified by comparing against a
worktree at the prior commit: it moved the first luma mismatch in both
a_frame_round_trips_at_its_own_size (1920x1080) and
an_854x480_picture_round_trips_through_its_padding earlier in the frame
instead of fixing them, gate unchanged at 124/3/4 either way. Only a
`reach` extension (above-right/below-left) crosses into a block that may
never be coded past the true edge at all, so only that portion still
clamps to true_width/true_height; re-verified against the same baseline
worktree that this leaves the three pre-existing failures at their exact
prior mismatch positions (byte-for-byte), i.e. a true no-op for them,
while still fixing the genuine reach-based true-edge case this lane's
prior commit targeted.
fix(av1): clamp intra reference-sample availability to the true frame edge, not the padded coding surfaceAhmet Kaan Gümüş · f79d3fd
fix(av1): clamp intra reference-sample availability to the true frame edge, not the padded coding surface

Plane::width/height is the picture padded to a 32-aligned coding surface
(Picture::padded_to); Reach::of and Plane::edges used it both to decide
whether a directional mode's above-right/below-left extension is available
and to clamp how far the above/left reference rows read, so a block near
the true frame edge (but still inside the padded surface) read real
padded-reconstruction samples a real decoder never has -- it stops at
mi_cols*4 / mi_rows*4 (spec compute_image_size; libaom
av1/common/reconintra.c build_intra_predictors clamps the same way via
mb_to_right_edge/mb_to_bottom_edge) and replicates the last valid sample
instead. Plane now carries that true bound (true_width/true_height,
mi_cols*4/mi_rows*4) separately from its padded width/height, and Reach::of
plus the edge-row clamp use it.

A partition trial can still price a sub-block whose own origin already
sits past that true bound (kept only for cost comparison against a split
this frame goes on to refuse) -- across/down can now land at or below x/y
for such a block, so edges() treats an empty read range as unavailable
(None) rather than crashing on an empty "last sample" the same way y==0/
x==0 already do.
fix(av1): clamp chroma's dc-sign/skip context to its own subsampled true edge; fix a stale padded-decode testAhmet Kaan Gümüş · 82410a6
fix(av1): clamp chroma's dc-sign/skip context to its own subsampled true edge; fix a stale padded-decode test

Neighbours::record clamped chroma the same as luma (true mi_cols/mi_rows),
but libaom rounds a subsampled plane's edge up to its own 4x4 unit before
clamping (ROUND_POWER_OF_TWO(max_blocks_high, subsampling_y) in
av1_write_intra_coeffs_mb, encodetxb.c:456-459): a chroma unit straddling
an odd luma edge is still whole in chroma's own halved grid. Fixed by
rounding the luma bound up to even before clamping planes 1/2. No test in
the current suite exercises an odd true mi_rows/mi_cols with chroma
residual, so this doesn't move the gate; landed as a correctness fix
proven safe (no regression) pending such a case.

an_854x480_picture_round_trips_through_its_padding decoded at the padded
864x480 size and cropped to 854x480 by hand -- stale since 7ba33dd started
writing the true display size into frame_width/frame_height, which makes
ffmpeg crop to 854x480 on its own. Decoding at padded size now reads past
what ffmpeg emits (out.stdout shorter than expected, not a hard decode
error). Fixed the test to decode at the true size directly; it now
exercises the real desync (a luma mismatch, bitstream confirmed
byte-identical to a real decoder via EC_RNG trace, so a reconstruction-side
bug, not an entropy desync) instead of failing on a wrong expectation.

Gate: cargo test -p ec-av1 --release = 124 passed, 3 failed (same three
tests, still red, no regressions), 4 ignored.