Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
82b07ab
Renamed ParallelRowIterator.IterateRows to IterateRowIntervals
Sergio0694 Feb 27, 2020
1cadad4
Removed unnecessary using directives
Sergio0694 Feb 27, 2020
6baa109
Added single row value delegate interfaces
Sergio0694 Feb 27, 2020
0d990e0
Added single row value delegate wrappers
Sergio0694 Feb 27, 2020
7fd93e8
Renamed new APIs
Sergio0694 Feb 27, 2020
96a0893
Introduced single row parallel helpers
Sergio0694 Feb 27, 2020
db68d7d
Removed IterationParameters type
Sergio0694 Feb 27, 2020
3d31033
Refactored BinaryThresholdProcessor<TPixel>
Sergio0694 Feb 27, 2020
ec4a56b
Micro-optimization in BinaryThresholdProcessor<TPixel>
Sergio0694 Feb 27, 2020
cf625a0
Refactored BokehBlurProcessor<TPixel>
Sergio0694 Feb 27, 2020
e302f35
Refactored Convolution2DProcessor<TPixel>
Sergio0694 Feb 27, 2020
badd5bf
Refactored Convolution2PassProcessor<TPixel>
Sergio0694 Feb 27, 2020
247cc6d
Refactored ConvolutionProcessor<TPixel>
Sergio0694 Feb 27, 2020
ee6f7f3
Refactored EdgeDetectorCompassProcessor<TPixel>
Sergio0694 Feb 27, 2020
c4cdc77
Refactored DrawImageProcessor<TPixelBg,TPixelFg>
Sergio0694 Feb 27, 2020
d152b14
Refactored PixelRowDelegateProcessor<TPixel,TDelegate>
Sergio0694 Feb 27, 2020
c8b69f1
Refactored FilterProcessor<TPixel>
Sergio0694 Feb 27, 2020
d5a98fc
Refactored GlobalHistogramEqualizationProcessor<TPixel>
Sergio0694 Feb 27, 2020
7c1d297
Refactored BackgroundColorProcessor<TPixel>
Sergio0694 Feb 27, 2020
41af0b5
Refactored GlowProcessor<TPixel>
Sergio0694 Feb 27, 2020
0f684e6
Refactored VignetteProcessor<TPixel>
Sergio0694 Feb 27, 2020
3feccec
Refactored AffineTransformProcessor<TPixel>
Sergio0694 Feb 27, 2020
4c0acaf
Refactored FlipProcessor<TPixel>
Sergio0694 Feb 27, 2020
1c49cea
Refactored ProjectiveTransformProcessor<TPixel>
Sergio0694 Feb 27, 2020
91e8353
Refactored RotateProcessor<TPixel>
Sergio0694 Feb 27, 2020
ba596b2
Refactored ResizeProcessor<TPixel>
Sergio0694 Feb 27, 2020
8811994
Refactored CropProcessor<TPixel>
Sergio0694 Feb 27, 2020
1cee460
Merge branch 'master' into feature/single-row-value-delegate-optin
Sergio0694 Feb 27, 2020
5626260
Merge branch 'master' into feature/single-row-value-delegate-optin
Sergio0694 Mar 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Renamed ParallelRowIterator.IterateRows to IterateRowIntervals
  • Loading branch information
Sergio0694 committed Feb 27, 2020
commit 82b07abc626afa4e3b15c583c94fa298ee5b71ff
12 changes: 6 additions & 6 deletions src/ImageSharp/Advanced/ParallelRowIterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public static partial class ParallelRowIterator
/// <param name="rectangle">The <see cref="Rectangle"/>.</param>
/// <param name="operation">The operation defining the iteration logic on a single <see cref="RowInterval"/>.</param>
[MethodImpl(InliningOptions.ShortMethod)]
public static void IterateRows<T>(Configuration configuration, Rectangle rectangle, in T operation)
public static void IterateRowIntervals<T>(Configuration configuration, Rectangle rectangle, in T operation)
where T : struct, IRowIntervalOperation
{
var parallelSettings = ParallelExecutionSettings.FromConfiguration(configuration);
IterateRows(rectangle, in parallelSettings, in operation);
IterateRowIntervals(rectangle, in parallelSettings, in operation);
}

/// <summary>
Expand All @@ -39,7 +39,7 @@ public static void IterateRows<T>(Configuration configuration, Rectangle rectang
/// <param name="rectangle">The <see cref="Rectangle"/>.</param>
/// <param name="parallelSettings">The <see cref="ParallelExecutionSettings"/>.</param>
/// <param name="operation">The operation defining the iteration logic on a single <see cref="RowInterval"/>.</param>
public static void IterateRows<T>(
public static void IterateRowIntervals<T>(
Rectangle rectangle,
in ParallelExecutionSettings parallelSettings,
in T operation)
Expand Down Expand Up @@ -84,12 +84,12 @@ public static void IterateRows<T>(
/// <param name="configuration">The <see cref="Configuration"/> to get the parallel settings from.</param>
/// <param name="rectangle">The <see cref="Rectangle"/>.</param>
/// <param name="operation">The operation defining the iteration logic on a single <see cref="RowInterval"/>.</param>
public static void IterateRows<T, TBuffer>(Configuration configuration, Rectangle rectangle, in T operation)
public static void IterateRowIntervals<T, TBuffer>(Configuration configuration, Rectangle rectangle, in T operation)
where T : struct, IRowIntervalOperation<TBuffer>
where TBuffer : unmanaged
{
var parallelSettings = ParallelExecutionSettings.FromConfiguration(configuration);
IterateRows<T, TBuffer>(rectangle, in parallelSettings, in operation);
IterateRowIntervals<T, TBuffer>(rectangle, in parallelSettings, in operation);
}

/// <summary>
Expand All @@ -101,7 +101,7 @@ public static void IterateRows<T, TBuffer>(Configuration configuration, Rectangl
/// <param name="rectangle">The <see cref="Rectangle"/>.</param>
/// <param name="parallelSettings">The <see cref="ParallelExecutionSettings"/>.</param>
/// <param name="operation">The operation defining the iteration logic on a single <see cref="RowInterval"/>.</param>
public static void IterateRows<T, TBuffer>(
public static void IterateRowIntervals<T, TBuffer>(
Rectangle rectangle,
in ParallelExecutionSettings parallelSettings,
in T operation)
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/ImageFrame{TPixel}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ internal ImageFrame<TPixel2> CloneAs<TPixel2>(Configuration configuration)
var target = new ImageFrame<TPixel2>(configuration, this.Width, this.Height, this.Metadata.DeepClone());
var operation = new RowIntervalOperation<TPixel2>(this, target, configuration);

ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
this.Bounds(),
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
bool isAlphaOnly = typeof(TPixel) == typeof(A8);

var operation = new RowIntervalOperation(interest, source, upper, lower, threshold, isAlphaOnly);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
interest,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
{
// Preliminary gamma highlight pass
var gammaOperation = new ApplyGammaExposureRowIntervalOperation(this.SourceRectangle, source.PixelBuffer, this.Configuration, this.gamma);
ParallelRowIterator.IterateRows<ApplyGammaExposureRowIntervalOperation, Vector4>(
ParallelRowIterator.IterateRowIntervals<ApplyGammaExposureRowIntervalOperation, Vector4>(
this.Configuration,
this.SourceRectangle,
in gammaOperation);
Expand All @@ -88,7 +88,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)

// Apply the inverse gamma exposure pass, and write the final pixel data
var operation = new ApplyInverseGammaExposureRowIntervalOperation(this.SourceRectangle, source.PixelBuffer, processingBuffer, this.Configuration, inverseGamma);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
this.Configuration,
this.SourceRectangle,
in operation);
Expand Down Expand Up @@ -121,14 +121,14 @@ private void OnFrameApplyCore(

// Compute the vertical 1D convolution
var verticalOperation = new ApplyVerticalConvolutionRowIntervalOperation(sourceRectangle, firstPassBuffer, source.PixelBuffer, kernel);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
sourceRectangle,
in verticalOperation);

// Compute the horizontal 1D convolutions and accumulate the partial results on the target buffer
var horizontalOperation = new ApplyHorizontalConvolutionRowIntervalOperation(sourceRectangle, processingBuffer, firstPassBuffer, kernel, parameters.Z, parameters.W);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
sourceRectangle,
in horizontalOperation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds());
var operation = new RowIntervalOperation(interest, targetPixels, source.PixelBuffer, this.KernelY, this.KernelX, this.Configuration, this.PreserveAlpha);

ParallelRowIterator.IterateRows<RowIntervalOperation, Vector4>(
ParallelRowIterator.IterateRowIntervals<RowIntervalOperation, Vector4>(
this.Configuration,
interest,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)

// Horizontal convolution
var horizontalOperation = new RowIntervalOperation(interest, firstPassPixels, source.PixelBuffer, this.KernelX, this.Configuration, this.PreserveAlpha);
ParallelRowIterator.IterateRows<RowIntervalOperation, Vector4>(
ParallelRowIterator.IterateRowIntervals<RowIntervalOperation, Vector4>(
this.Configuration,
interest,
in horizontalOperation);

// Vertical convolution
var verticalOperation = new RowIntervalOperation(interest, source.PixelBuffer, firstPassPixels, this.KernelY, this.Configuration, this.PreserveAlpha);
ParallelRowIterator.IterateRows<RowIntervalOperation, Vector4>(
ParallelRowIterator.IterateRowIntervals<RowIntervalOperation, Vector4>(
this.Configuration,
interest,
in verticalOperation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)

var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds());
var operation = new RowIntervalOperation(interest, targetPixels, source.PixelBuffer, this.KernelXY, this.Configuration, this.PreserveAlpha);
ParallelRowIterator.IterateRows<RowIntervalOperation, Vector4>(
ParallelRowIterator.IterateRowIntervals<RowIntervalOperation, Vector4>(
this.Configuration,
interest,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
}

var operation = new RowIntervalOperation(source.PixelBuffer, pass.PixelBuffer, interest);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
this.Configuration,
interest,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ in Unsafe.AsRef(this),
palette,
ImageMaths.GetBitsNeededForColorDepth(palette.Span.Length));

ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
quantizer.Configuration,
bounds,
in ditherOperation);
Expand All @@ -145,7 +145,7 @@ in Unsafe.AsRef(this),
scale,
ImageMaths.GetBitsNeededForColorDepth(palette.Span.Length));

ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
bounds,
in ditherOperation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected override void OnFrameApply(ImageFrame<TPixelBg> source)
}

var operation = new RowIntervalOperation(source, targetImage, blender, configuration, minX, width, locationY, targetX, this.Opacity);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
workingRect,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
source.CopyTo(targetPixels);

var operation = new RowIntervalOperation(this.SourceRectangle, targetPixels, source, this.Configuration, brushSize >> 1, this.definition.Levels);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
this.Configuration,
this.SourceRectangle,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds());
var operation = new RowIntervalOperation(interest.X, source, this.Configuration, this.modifiers, this.rowDelegate);

ParallelRowIterator.IterateRows<RowIntervalOperation, Vector4>(
ParallelRowIterator.IterateRowIntervals<RowIntervalOperation, Vector4>(
this.Configuration,
interest,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds());
var operation = new RowIntervalOperation(interest.X, source, this.definition.Matrix, this.Configuration);

ParallelRowIterator.IterateRows<RowIntervalOperation, Vector4>(
ParallelRowIterator.IterateRowIntervals<RowIntervalOperation, Vector4>(
this.Configuration,
interest,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
}

var operation = new RowIntervalOperation(cdfData, tileYStartPositions, tileWidth, tileHeight, tileCount, halfTileWidth, luminanceLevels, source);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
this.Configuration,
new Rectangle(0, 0, sourceWidth, tileYStartPositions.Count),
in operation);
Expand Down Expand Up @@ -522,7 +522,7 @@ public void CalculateLookupTables(ImageFrame<TPixel> source, HistogramEqualizati
this.luminanceLevels,
source);

ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
this.configuration,
new Rectangle(0, 0, this.sourceWidth, this.tileYStartPositions.Count),
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)

// Build the histogram of the grayscale levels
var grayscaleOperation = new GrayscaleLevelsRowIntervalOperation(interest, histogramBuffer, source, this.LuminanceLevels);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
this.Configuration,
interest,
in grayscaleOperation);
Expand All @@ -76,7 +76,7 @@ ref MemoryMarshal.GetReference(histogram),

// Apply the cdf to each pixel of the image
var cdfOperation = new CdfApplicationRowIntervalOperation(interest, cdfBuffer, source, this.LuminanceLevels, numberOfPixelsMinusCdfMin);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
this.Configuration,
interest,
in cdfOperation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
PixelBlender<TPixel> blender = PixelOperations<TPixel>.Instance.GetPixelBlender(graphicsOptions);

var operation = new RowIntervalOperation(configuration, interest, blender, amount, colors, source);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
interest,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
rowColors.GetSpan().Fill(glowColor);

var operation = new RowIntervalOperation(configuration, interest, rowColors, this.blender, center, maxDistance, blendPercent, source);
ParallelRowIterator.IterateRows<RowIntervalOperation, float>(
ParallelRowIterator.IterateRowIntervals<RowIntervalOperation, float>(
configuration,
interest,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
rowColors.GetSpan().Fill(vignetteColor);

var operation = new RowIntervalOperation(configuration, interest, rowColors, this.blender, center, maxDistance, blendPercent, source);
ParallelRowIterator.IterateRows<RowIntervalOperation, float>(
ParallelRowIterator.IterateRowIntervals<RowIntervalOperation, float>(
configuration,
interest,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private static void SecondPass<TFrameQuantizer, TPixel>(
if (dither is null)
{
var operation = new RowIntervalOperation<TFrameQuantizer, TPixel>(quantizer, source, output, bounds, palette);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
quantizer.Configuration,
bounds,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source)
using QuantizedFrame<TPixel> quantized = frameQuantizer.QuantizeFrame(source, interest);

var operation = new RowIntervalOperation(this.SourceRectangle, source, quantized);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
interest,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source, ImageFrame<TPixe

var operation = new RowIntervalOperation(bounds, source, destination);

ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
bounds,
in parallelSettings,
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void ApplyTransform<TResampler>(in TResampler sampler)
if (sampler is NearestNeighborResampler)
{
var nnOperation = new NNAffineOperation(source, destination, matrix);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
destination.Bounds(),
in nnOperation);
Expand Down Expand Up @@ -105,7 +105,7 @@ public void ApplyTransform<TResampler>(in TResampler sampler)
radialExtents,
maxSourceExtents);

ParallelRowIterator.IterateRows<AffineOperation<TResampler>, Vector4>(
ParallelRowIterator.IterateRowIntervals<AffineOperation<TResampler>, Vector4>(
configuration,
destination.Bounds(),
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private void FlipX(ImageFrame<TPixel> source, Configuration configuration)
private void FlipY(ImageFrame<TPixel> source, Configuration configuration)
{
var operation = new RowIntervalOperation(source);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
source.Bounds(),
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void ApplyTransform<TResampler>(in TResampler sampler)
if (sampler is NearestNeighborResampler)
{
var nnOperation = new NNProjectiveOperation(source, destination, matrix);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
destination.Bounds(),
in nnOperation);
Expand Down Expand Up @@ -105,7 +105,7 @@ public void ApplyTransform<TResampler>(in TResampler sampler)
radialExtents,
maxSourceExtents);

ParallelRowIterator.IterateRows<ProjectiveOperation<TResampler>, Vector4>(
ParallelRowIterator.IterateRowIntervals<ProjectiveOperation<TResampler>, Vector4>(
configuration,
destination.Bounds(),
in operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private bool OptimizedApply(
private void Rotate180(ImageFrame<TPixel> source, ImageFrame<TPixel> destination, Configuration configuration)
{
var operation = new Rotate180RowIntervalOperation(source.Width, source.Height, source, destination);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
source.Bounds(),
in operation);
Expand All @@ -147,7 +147,7 @@ private void Rotate180(ImageFrame<TPixel> source, ImageFrame<TPixel> destination
private void Rotate270(ImageFrame<TPixel> source, ImageFrame<TPixel> destination, Configuration configuration)
{
var operation = new Rotate270RowIntervalOperation(destination.Bounds(), source.Width, source.Height, source, destination);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
source.Bounds(),
in operation);
Expand All @@ -162,7 +162,7 @@ private void Rotate270(ImageFrame<TPixel> source, ImageFrame<TPixel> destination
private void Rotate90(ImageFrame<TPixel> source, ImageFrame<TPixel> destination, Configuration configuration)
{
var operation = new Rotate90RowIntervalOperation(destination.Bounds(), source.Width, source.Height, source, destination);
ParallelRowIterator.IterateRows(
ParallelRowIterator.IterateRowIntervals(
configuration,
source.Bounds(),
in operation);
Expand Down
Loading