Browse Source

Remove dead code

pull/2219/head
Ynse Hoornenborg 3 years ago
parent
commit
bb3acac4d2
  1. 7
      src/ImageSharp/Processing/Processors/Convolution/MedianBlurProcessor{TPixel}.cs
  2. 4
      src/ImageSharp/Processing/Processors/Convolution/MedianRowOperation{TPixel}.cs

7
src/ImageSharp/Processing/Processors/Convolution/MedianBlurProcessor{TPixel}.cs

@ -30,9 +30,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
var interest = Rectangle.Intersect(this.SourceRectangle, source.Bounds());
// We use a rectangle with width set to 2 * kernelSize^2 + width, to allocate a buffer big enough
// for kernel source and target bulk pixel conversion.
var operationBounds = new Rectangle(interest.X, interest.Y, (2 * kernelSize * kernelSize) + interest.Width + (kernelSize * interest.Width), interest.Height);
// We use a rectangle with width set wider, to allocate a buffer big enough
// for kernel source, channel buffers, source rows and target bulk pixel conversion.
int operationWidth = (2 * kernelSize * kernelSize) + interest.Width + (kernelSize * interest.Width);
var operationBounds = new Rectangle(interest.X, interest.Y, operationWidth, interest.Height);
using var map = new KernelSamplingMap(this.Configuration.MemoryAllocator);
map.BuildSamplingOffsetMap(kernelSize, kernelSize, interest, this.definition.BorderWrapModeX, this.definition.BorderWrapModeY);

4
src/ImageSharp/Processing/Processors/Convolution/MedianRowOperation{TPixel}.cs

@ -85,7 +85,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
ref Vector4 target = ref Unsafe.Add(ref targetBase, x);
for (int kY = 0; kY < state.Kernel.Rows; kY++)
{
int currentYIndex = Unsafe.Add(ref sampleRowBase, kY);
Span<Vector4> sourceRow = sourceVectorBuffer.Slice(kY * boundsWidth);
ref Vector4 sourceRowBase = ref MemoryMarshal.GetReference(sourceRow);
for (int kX = 0; kX < state.Kernel.Columns; kX++)
@ -98,7 +97,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
}
target = this.FindMedian3(state.Kernel.Span, xChannel, yChannel, zChannel, kernelCount);
state.Kernel.Clear();
}
}
else
@ -111,7 +109,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
ref Vector4 target = ref Unsafe.Add(ref targetBase, x);
for (int kY = 0; kY < state.Kernel.Rows; kY++)
{
int currentYIndex = Unsafe.Add(ref sampleRowBase, kY);
Span<Vector4> sourceRow = sourceVectorBuffer.Slice(kY * boundsWidth);
ref Vector4 sourceRowBase = ref MemoryMarshal.GetReference(sourceRow);
for (int kX = 0; kX < state.Kernel.Columns; kX++)
@ -124,7 +121,6 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
}
target = this.FindMedian4(state.Kernel.Span, xChannel, yChannel, zChannel, wChannel, kernelCount);
state.Kernel.Clear();
}
}

Loading…
Cancel
Save