Implementation of heavily optimized true contrast limited adaptive histogram equalization with O(r) pixel time complexity where r is the window size. There is a O(1) algorithm available, refere to this paper: P. Härtinger and C. Steger, “Adaptive histogram equalization in constant time,” Journal of Real-Time Image Processing, vol. 21, p. 93, 2024.
Here's a little review paper covering the most CLAHE algorithms: https://doi.org/10.5281/zenodo.20276305