From f84b03b5f13208296db10b841ec051b8d9f5281a Mon Sep 17 00:00:00 2001 From: popow Date: Tue, 31 Jul 2018 19:41:46 +0200 Subject: [PATCH] only applying clipping once, effect applying it multiple times is neglectable --- .../AdaptiveHistEqualizationProcessor.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistEqualizationProcessor.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistEqualizationProcessor.cs index 9b66d434ee..3d2ef02d52 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistEqualizationProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistEqualizationProcessor.cs @@ -169,8 +169,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization /// /// The histogram to apply the clipping. /// The histogram clip limit. Histogram bins which exceed this limit, will be capped at this value. - /// The number of pixels redistributed to all other bins. - private int ClipHistogram(Span histogram, int clipLimit) + private void ClipHistogram(Span histogram, int clipLimit) { int sumOverClip = 0; for (int i = 0; i < histogram.Length; i++) @@ -187,15 +186,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Normalization { histogram[i] += addToEachBin; } - - // The redistribution will push some bins over the clip limit again. - // Re-Applying the clipping until this effect no longer occurs. - while (addToEachBin > 1) - { - addToEachBin = this.ClipHistogram(histogram, clipLimit); - } - - return addToEachBin; } ///