mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-30 21:16:52 -06:00
The normalized cross-correlation only had a fast path for an exactly identity shape, which tracked footage never has after the first frame, so every candidate went through Plane::sample. All candidates of a search are the reference centre plus integer offsets, so each template pixel has the same fractional offsets for all of them. Build one table of taps per (level, seed, shape) and score each candidate with integer-indexed lerps, with one bounding-box check up front (outside the plane the old path is used). lk_refine only reads the level-0 gradients around the match, so compute them for that window (with an interior fast path in Plane::gradients_in) and fall back to the full gradients if the iteration leaves it. The results are unchanged: same lerp form and accumulation order. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>