ImageMagick merges sliding-window optimization making statistics up to 33x faster

cneuralnetwork · x · 2026-11-04

cneuralnetwork's ImageMagick PR was merged: instead of visiting every pixel of the neighborhood for each output pixel and channel, StatisticImage() now slides the neighborhood along each row — column-wise running sums/sums-of-squares for Mean/StdDev, per-column extrema for Min/Max, and a skip-list for Median/Mode where the left-hand column is removed as the right one is inserted.

Per-pixel cost drops from O(width×height) to O(width), skip-list inserts drop to 2×height, with some statistics up to 33x faster. Row-parallel OpenMP, virtual-pixel striping, and write-mask handling are unchanged.

Original post →

More from Fun

Fun channel →