mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
The 8-bit sliding histogram (#631) can't serve 16-bit or float layers: a 16-bit threshold spans thousands of levels and floats have none. The weight `1 - |v - v0| / t` is linear on each side of the centre value, so the weighted window sum only needs the count, Σv and Σv² of the samples within the threshold below and above it. A Fenwick tree over the window's distinct values holds those and slides along the row, so a pixel costs O(radius · log n) instead of O(radius²), for any depth, with the direct sum's own weight test deciding which samples count. Used from radius 10, where it overtakes the direct sum; non-finite samples keep the direct sum.