diff --git a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor{TPixel}.cs
index c3189427fd..c46137e765 100644
--- a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor{TPixel}.cs
@@ -4,7 +4,6 @@
using System;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced;
-using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Processing.Processors.Binarization
@@ -44,8 +43,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
var interest = Rectangle.Intersect(sourceRectangle, source.Bounds());
bool isAlphaOnly = typeof(TPixel) == typeof(A8);
- var operation = new RowIntervalOperation(interest, source, upper, lower, threshold, isAlphaOnly);
- ParallelRowIterator.IterateRowIntervals(
+ var operation = new RowOperation(interest, source, upper, lower, threshold, isAlphaOnly);
+ ParallelRowIterator.IterateRows(
configuration,
interest,
in operation);
@@ -54,7 +53,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
///
/// A implementing the clone logic for .
///
- private readonly struct RowIntervalOperation : IRowIntervalOperation
+ private readonly struct RowOperation : IRowOperation
{
private readonly ImageFrame source;
private readonly TPixel upper;
@@ -65,7 +64,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
private readonly bool isAlphaOnly;
[MethodImpl(InliningOptions.ShortMethod)]
- public RowIntervalOperation(
+ public RowOperation(
Rectangle bounds,
ImageFrame source,
TPixel upper,
@@ -84,22 +83,19 @@ namespace SixLabors.ImageSharp.Processing.Processors.Binarization
///
[MethodImpl(InliningOptions.ShortMethod)]
- public void Invoke(in RowInterval rows)
+ public void Invoke(int y)
{
Rgba32 rgba = default;
- for (int y = rows.Min; y < rows.Max; y++)
- {
- Span row = this.source.GetPixelRowSpan(y);
+ Span row = this.source.GetPixelRowSpan(y);
- for (int x = this.minX; x < this.maxX; x++)
- {
- ref TPixel color = ref row[x];
- color.ToRgba32(ref rgba);
+ for (int x = this.minX; x < this.maxX; x++)
+ {
+ ref TPixel color = ref row[x];
+ color.ToRgba32(ref rgba);
- // Convert to grayscale using ITU-R Recommendation BT.709 if required
- byte luminance = this.isAlphaOnly ? rgba.A : ImageMaths.Get8BitBT709Luminance(rgba.R, rgba.G, rgba.B);
- color = luminance >= this.threshold ? this.upper : this.lower;
- }
+ // Convert to grayscale using ITU-R Recommendation BT.709 if required
+ byte luminance = this.isAlphaOnly ? rgba.A : ImageMaths.Get8BitBT709Luminance(rgba.R, rgba.G, rgba.B);
+ color = luminance >= this.threshold ? this.upper : this.lower;
}
}
}