mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 17:37:14 +00:00
Neighbours are read at precomputed offsets into the window instead of per channel through bounds-checked Image::get. Normal mode with 1-5 channels runs the interior (whole kernel in the window) offset-major over each row with a branchless select: a rejected neighbour adds -0.0, an exact identity, and every pixel sums in the same order, so the output is bit-identical. Border pixels, the edge modes and 6+ channels keep the per-pixel path. 24 MP RGBA8, High quality: r3 0.55 -> 0.23 s, r12 6.25 -> 1.78 s, r100 3.64 -> 0.95 s. bench_filters2 gains r12 and r100 rows. The old kernel stays as a test oracle, compared bit for bit across colour modes, 1-8 channels, alpha, radii, qualities, modes, thresholds, output rects and NaN/inf samples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>