Browse Source

Remove unnecessary Clear() and scratch buffer

pull/1817/head
Brian Popow 5 years ago
parent
commit
3dd7c8ea41
  1. 4
      src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs
  2. 1
      src/ImageSharp/Formats/Webp/Lossy/Vp8Histogram.cs

4
src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs

@ -127,7 +127,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossy
#if SUPPORTS_RUNTIME_INTRINSICS #if SUPPORTS_RUNTIME_INTRINSICS
if (Sse41.IsSupported) if (Sse41.IsSupported)
{ {
int diffSum = TTransformSse41(a, b, w, scratch); int diffSum = TTransformSse41(a, b, w);
return Math.Abs(diffSum) >> 5; return Math.Abs(diffSum) >> 5;
} }
else else
@ -654,7 +654,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossy
/// Returns the weighted sum of the absolute value of transformed coefficients. /// Returns the weighted sum of the absolute value of transformed coefficients.
/// w[] contains a row-major 4 by 4 symmetric matrix. /// w[] contains a row-major 4 by 4 symmetric matrix.
/// </summary> /// </summary>
public static int TTransformSse41(Span<byte> inputA, Span<byte> inputB, Span<ushort> w, Span<int> scratch) public static int TTransformSse41(Span<byte> inputA, Span<byte> inputB, Span<ushort> w)
{ {
// Load and combine inputs. // Load and combine inputs.
Vector128<byte> ina0 = Unsafe.As<byte, Vector128<byte>>(ref MemoryMarshal.GetReference(inputA)); Vector128<byte> ina0 = Unsafe.As<byte, Vector128<byte>>(ref MemoryMarshal.GetReference(inputA));

1
src/ImageSharp/Formats/Webp/Lossy/Vp8Histogram.cs

@ -49,7 +49,6 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossy
this.distribution.AsSpan().Clear(); this.distribution.AsSpan().Clear();
for (j = startBlock; j < endBlock; j++) for (j = startBlock; j < endBlock; j++)
{ {
this.output.AsSpan().Clear();
this.Vp8FTransform(reference.Slice(WebpLookupTables.Vp8DspScan[j]), pred.Slice(WebpLookupTables.Vp8DspScan[j]), this.output); this.Vp8FTransform(reference.Slice(WebpLookupTables.Vp8DspScan[j]), pred.Slice(WebpLookupTables.Vp8DspScan[j]), this.output);
// Convert coefficients to bin. // Convert coefficients to bin.

Loading…
Cancel
Save