forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to crates/ec-av1/src/warp.rsClear filter

2026-10-23

Restore edith_codecs after local data loss (2026-10-23)Ahmet Kaan Gümüş · b7434a2
Restore edith_codecs after local data loss (2026-10-23)

On 2026-10-23 an automated agent ran `rm -rf $HOME` and deleted the local
repository with all of its history. This commit restores the working tree
from the newest surviving copy, the host-c server lane mirror. That mirror
matches local main as of the testcut Phase 2 reports, including the tool
cache, the nextest fast profile and changed-crates.sh. The history before
this commit was not recovered.

2026-09-24

2026-09-04

refactor(av1): FrameCtx stays crate-private -- public signatures back to what they wereAhmet Kaan Gümüş · 1c71b70
refactor(av1): FrameCtx stays crate-private -- public signatures back to what they were

The FrameCtx refactor threaded `&crate::decode::FrameCtx` through 21 `pub fn`
signatures, which put a `pub(crate)` type in the crate's public API: external
callers of `Av1Encoder::encode` stopped compiling (tools/ec-bench).

`Av1Encoder` now owns its `FrameCtx` -- one per stream, not per frame, since
the inter-frame inheritance guards carry state across frames -- so `encode`
takes `(&mut self, picture)` again. `encode_key_frame`,
`encode_key_frame_with_modes` and `encode_sequence` keep their old public
signatures as wrappers over `pub(crate) *_with_ctx` inners that make the
context. The other 14 helpers that gained the parameter (intra/mc/warp/motion
predictors, `decode_key_frame_tile`) have no caller outside the crate and
become `pub(crate)`.

`Av1Encoder` is still `Send` (compile-time assert), but owning cells makes it
`!Sync`; nothing in the workspace shares one by reference.
refactor(av1): the 38 per-frame decode-state thread_locals become one FrameCtxAhmet Kaan Gümüş · b9a9498
refactor(av1): the 38 per-frame decode-state thread_locals become one FrameCtx

Every per-frame/per-stream decode state in ec-av1 lived in a thread_local!
static, so a decode was a function of the calling THREAD's history rather
than of the bitstream, and a worker thread saw empty state -- the blocker
for frame-parallel decoding.

All 38 (SB128, BIT_DEPTH, SUPERRES, CDEF_*, DELTA_Q_*/DELTA_LF_*,
CURRENT_Q_IDX, QUANT_DELTAS, the 9 SEG* maps, TX_SELECT_INTER,
REDUCED_TX_SET_INTER, ENABLE_FILTER_INTRA_INTER, PALETTE_PRED, INTRABC_*,
LUMA_TX_TYPE, INTRA_IN_INTER_MODE, INTER_STRIP_CHROMA, INTER_LAST_MC,
ENABLE_EDGE_FILTER, LAST_FRAME_WIDE_MARGIN, REACH_SB_PX, GRAIN_BIT_DEPTH)
are now fields of decode::FrameCtx, owned by decode_stream_with and threaded
as `fctx: &FrameCtx` down the decode call graph (~1200 call sites).

The fields keep the Cell/RefCell interior mutability the statics had, so
every read/write site is byte-identical and this is a pure ownership move;
Cell/RefCell also make FrameCtx !Sync on purpose -- one context per decoding
thread, never shared. The scratch pools, gate hit counters and trace
switches stay thread_local by design.
perf(av1): snapshot the remaining per-pixel EC_* env readsAhmet Kaan Gümüş · 2baca5a
perf(av1): snapshot the remaining per-pixel EC_* env reads

`restoration.rs`'s three `EC_LR_CALL_DUMP` guards sit inside the sgrproj
per-pixel loops (`compute_ab`, the combine tap) and `warp.rs`'s
`EC_MC_TRACE` on the per-MC-call warp entry; each was a live `getenv` +
`strlen` + `CStr` validation, 17.75% of `decode_probe`'s self time at 4K.
Same predicates, served by `envflags::env_flag!` (one `LazyLock<bool>`
per call site). `motion_field.rs`'s two `EC_TRACE_TPL` reads move with
them. `tile.rs`'s two sites stay: :34 already caches into an atomic and
:3002 is test-only.

Byte-exact on seg1080/seg4k/seg4k_lr/palette; 4K 55.31 s -> 48.53 s
(interleaved medians of 3), 1080p 10.54 s -> 9.83 s.

2026-09-02

fix(av1): per-frame stage dumps + MC trace, and re-localise the 192x128 frame-2 mismatch to a 64x64 INTRA blockAhmet Kaan Gümüş · f866759
fix(av1): per-frame stage dumps + MC trace, and re-localise the 192x128 frame-2 mismatch to a 64x64 INTRA block

EC_AV1_POSTDEBLOCK_DUMP/EC_AV1_POSTCDEF_DUMP wrote .f0 for every frame, so any
per-frame filter-stage bisection silently compared the last decoded frame; they
are now keyed on the decode-order picture index like the prefilt dump.

EC_MC_TRACE prints every mc::predict_with_filters / predict_compound_intermediate
/ warp_affine call with its q4 position, block size, subpel fractions and kernels,
placed before the whole-pel fast path, plus EC_IB at decode_inter_block entry and
is_inter/skip on EC_MODE -- an absent MC call is now visible.

With that: the 192x128 8-bit stream's frame-2 luma-only mismatch at px(128,64) is
a 64x64 PARTITION_NONE INTRA block in an inter frame, not the inter NEWMV block
the charter described (that mv belongs to frame 1's split superblock, which is
exact). Zero MC calls for the block in either decoder; chroma bit-exact, so the
64-length luma transform is the suspect. Stream pinned as a fixture because its
aomenc recipe does not reproduce it.

2026-09-01

feat(av1): per-reference GLOBAL warp on compound blocks (was silently translational)Ahmet Kaan Gümüş · e67ae7f
feat(av1): per-reference GLOBAL warp on compound blocks (was silently translational)

decode_inter_block's compound branch predicted both taps through
mc::predict_compound_intermediate; libaom runs av1_init_warp_params per
reference, so each ref of a GLOBAL_GLOBALMV block under a ROTZOOM/AFFINE
model is filtered through av1_warp_plane into the compound intermediate.
No refusal named this -- silently wrong pixels.

warp.rs: warp_affine split into warp_inner + store closure, hardcoded BD=8
replaced by crate::decode::bit_depth(), new warp_affine_compound
(av1_highbd_warp_affine_c's is_compound branch, unbiased to match this
crate's intermediate domain). mc.rs: diffwtd_mask's round was missing
libaom's (bd - 8) term. New gate a_real_compound_global_warp_stream_decodes_pixel_exact:
6/6 pixel-exact, compound_warp_hits=37. 10-bit arm ignored, blocked by a
pre-existing 10-bit compound MC defect (ablation in its doc comment).

2026-08-30

feat(av1): global-warp prediction for single-ref GLOBALMV (allow_warp's global_warp_allowed branch)Ahmet Kaan Gümüş · eed6f8c
feat(av1): global-warp prediction for single-ref GLOBALMV (allow_warp's global_warp_allowed branch)

Wires global_motion[ref] into crate::warp::global_warp_params (reuses
find_projection's get_shear_params, no second warp implementation) for
every single-ref is_global_mv_block, gated independent of motion_mode
matching libaom's allow_warp exactly (local WARPED_CAUSAL short-circuits
first, else-if global). Pin gm-seed43.obu: frame 1 luma mismatch (r3's
root cause) now MATCH; frames 0-13 all match. Frame 14+ hits a NEW,
narrower, distinct shape (two ref slots concurrently ROTZOOM) -- refused
by name rather than guess-fixed. stream.rs's whole-frame refusal narrowed
from "any non-IDENTITY global motion" to two named remaining gaps: AFFINE
models, and more-than-one concurrently active ROTZOOM/AFFINE ref slot.
Wedge gate: 27/40->30/40 other-capability refusals (10 matches, wii_hits=4),
full lib suite 227/0 unchanged.
fix(av1): gm_get_motion_vector block-centre -1 offset; root-cause seed-43 wedge mismatch to missing global-warp prediction path (not fixed)Ahmet Kaan Gümüş · 75017f1
fix(av1): gm_get_motion_vector block-centre -1 offset; root-cause seed-43 wedge mismatch to missing global-warp prediction path (not fixed)

Root-caused lane-gm r2's interintra-wedge gate mismatch (seed 43, frame 1
luma) via a pinned/self-decoded-twice reproduction and a msac range-ladder
comparison against a patched aomdec: entropy is in sync at the divergent
block (rng=38664 both sides), and this decoder's gm_get_motion_vector
computes the spec-correct mv once block_center_x/y's missing "- 1" is
fixed (found by diffing against the real oracle's mv.h). The remaining
gap is real but unfixed this round: libaom predicts every
is_global_mv_block (ROTZOOM/AFFINE GLOBALMV, >=8x8) with the full
per-pixel affine global-motion warp (reconinter.c's allow_warp /
global_warp_allowed), independent of motion_mode; this decoder only
builds a warp prediction for local WARPED_CAUSAL and falls back to
translational MC for every other GLOBALMV block. Whole-frame
global_motion != IDENTITY refusal in stream.rs stays in place.
feat(av1): gm_get_motion_vector port (spec 7.10.2.1)Ahmet Kaan Gümüş · 9f844b1
feat(av1): gm_get_motion_vector port (spec 7.10.2.1)

Pure port of libaom's gm_get_motion_vector: IDENTITY->0, TRANSLATION's
swapped-axis shift-by-13, ROTZOOM/AFFINE's block-centre projection +
convert_to_trans_prec, and force_integer_mv's integer_mv_precision
rounding. Unit-tested with hand-computed arithmetic in each test's own
doc comment. Not yet wired to any decode site.

2026-08-28

wip(av1): affine warp estimation + filter ported, wired into leaf16 -- COMPILING WIPAhmet Kaan Gümüş · efe3e65
wip(av1): affine warp estimation + filter ported, wired into leaf16 -- COMPILING WIP

lane-warp round 2, budget-capped stop. Step 0 (verify r1's alphabet-
selection change) ran clean first: warp/obmc(x2)/deblocking gates all
green on e886150 before touching anything -- no desync from r1's
num_proj_ref-gated 3-symbol motion_mode_cdf read.

Ported this round (new module crates/ec-av1/src/warp.rs):
- av1_findSamples in full: decode.rs's num_proj_ref (count-only) replaced
  by find_samples, which now also records each sample's own (pts1, pts2)
  1/8-pel coordinates (record_samples, mvref_common.c) -- num_proj_ref is
  now find_samples(..).len(), a pure refactor kept bit-identical (verified:
  both OBMC gates + the warp refuse-or-match gate still green after it).
- av1_selectSamples: MV-diff threshold filter (thresh = clamp(max(bw,bh),
  16, 112)), run only when num_proj_ref > 1, matching decodemv.c's own
  gate.
- find_affine_int + av1_get_shear_params -> find_projection: the full
  least-squares affine fit (LS_SQUARE/LS_PRODUCT1/LS_PRODUCT2, the 64-bit
  divisor-resolution div_lut, get_mult_shift_diag/ndiag) plus the shear
  decomposition/validity check (alpha/beta/gamma/delta, WARP_PARAM_REDUCE_
  BITS, is_affine_shear_allowed). Returns None on a singular fit or
  non-representable shear -- both spec fallback cases collapse to "use the
  block's own translational MV" at the call site, matching libaom's own
  wm_params.invalid handling (reconinter.c allow_warp: global warp is
  never the fallback here since this decoder's global motion is always
  IDENTITY).
- av1_warp_affine_c: the 8x8-tile, two-pass 8-tap affine filter
  (av1_warped_filter, 193 rows, transcribed verbatim from warped_motion.c),
  8-bit non-compound only (this decoder's warp arm only ever reaches a
  single-ref, non-skip-mode block, so conv_params->is_compound is always
  false on this path -- the compound/highbd branches are dropped).

Wired into decode_inter_block (the 16x16+ leaf) only: motion_mode == 2
no longer refuses by name. It computes samples via find_samples +
select_samples, calls find_projection, and when Some(params) overrides
the block's already-computed translational-MV prediction (pred_y/u/v)
with warp_affine's own output (luma subsampling 0/0, chroma 1/1, 4:2:0)
before the OBMC blend check (mutually exclusive with motion_mode==1).
When find_projection returns None, the existing translational-MV
prediction is left untouched -- exactly the spec's own invalid-warp
fallback.

NOT ported/wired this round (steps 5-6 remaining):
- decode_inter_block8 (the 8x8 leaf): STILL refuses motion_mode == 2 by
  name unconditionally -- warp.rs's functions are leaf16-only so far.
- The a_real_aomenc_stream_with_warped_motion_refuses_or_matches gate
  (stream.rs ~3255, "gradients" lavfi content, default aomenc flags) still
  reads "40 named refusals, 0 pixel-exact matches out of 40" after this
  round's wiring -- unchanged from before. NOT diagnosed within budget
  whether that's because (a) the gate's own content/encoder flags never
  actually reach a WARPED_CAUSAL-coded block on this decoder's supported
  path (matches the documented never-fired-gate class: gradients content +
  default flags is a different recipe from the charter's own
  --auto-alt-ref=1 --lag-in-frames=16 --enable-fwd-kf=0
  --enable-ref-frame-mvs=0), or (b) it does reach one and either
  find_projection legitimately returns None every time (falls back to
  translational, no visible difference), or hits some OTHER named refusal
  first (interintra, screen-content-tools, sub-16 partition -- all seen in
  the OBMC gate's own refusal list on identical content). WARP_SELECTED_HITS
  was not read back this round to disambiguate -- next round's first move.
- Gate itself not flipped to require pixel-exact + no self-pin added
  (step 6) -- premature until the above is diagnosed with real fire
  evidence.

cargo check -p ec-av1 --lib: clean, 0 errors. Verified green this round:
both OBMC gates (a_real_aomenc_stream_with_obmc_decodes_pixel_exact +
_obmc_8x8), a_real_aomenc_stream_with_warped_motion_refuses_or_matches
(still legally refuse-or-match, unchanged pass/fail shape). Deblocking
gate verified green at step 0 before any edit this round (unaffected by
this round's changes -- warp.rs is dead code on that path).

NEXT: read WARP_SELECTED_HITS after a run against the charter's own
aomenc flags (--auto-alt-ref=1 --lag-in-frames=16 --enable-fwd-kf=0
--enable-ref-frame-mvs=0, dims mult of 64) to get a real fire count
before touching leaf8 or the gate; wire decode_inter_block8 the same way
find_samples/select_samples/find_projection/warp_affine already support
(the bw4/bw/bh plumbing is generic, only the call site inside
decode_inter_block8's own motion_mode match needs the same three-call
sequence copied over).