Files
effectcraft/crates
a17e1f20d6 av1enc: motion search with visited set and early-exit SAD, fixed-size SATD, region-only snapshots (#2406)
* av1enc: motion search with a visited set and early-exit SAD, fixed-size SATD, region-only BlockDecoded snapshot

- motion_search remembered nothing: the diamond search evaluated the previous
  centre again and every SAD ran to the last row even when it had already
  lost. Full-sample and sub-sample positions are now tracked in a visited
  list (costs are deterministic, so a position that was evaluated cannot beat
  the best cost again), and the SAD stops after a row once sad + mv cost can no
  longer be below the best cost. The stop test is the same f64 expression as
  the strict "<" the callers apply, and it is monotone in the SAD, so the
  chosen vector is the same.
- satd runs with a fixed block size (satd_k::<4> / satd_k::<8>): the
  difference block is a [[i32; K]; K], the vertical butterflies work on whole
  rows at once, and the old per-column gather is gone. The sum is an integer
  sum of the same values.
- A snapshot copies only the BlockDecoded cells of the block area (at most
  16x16 per plane), the only flags coding inside the block can change, instead
  of the whole 3x35x35 array.

The encoded stream is unchanged. A unit test compares the new SATD with the
previous implementation for 4..32 sample blocks at 8 and 10 bit.

Fixes #2387

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* av1enc: tests for the region-only BlockDecoded snapshot and the bounded SADs

- `snapshot_restore_brings_back_every_blockdecoded_flag`: for every block
  size of a 64x64 superblock (4x4 .. 64x64) at every aligned position in two
  superblocks, from an all-clear and a random flag state, marking every
  sub-block of every size inside the block and restoring gives back the whole
  3x35x35 array, so the 16x16 region covers every flag coding can set and
  leaves the neighbours alone.
- `bounded_sad_stops_only_once_the_cost_cannot_win`: `sad_ref` and
  `sad_bounded` return the full SAD whenever `sad + lb < bound`, and
  otherwise a partial sum that already loses the strict `<` of the callers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-06 22:58:00 +01:00
..
2026-11-03 09:05:06 -05:00