Browse Source

Allocate clean buffer in AnalyzeEntropy

pull/1873/head
Brian Popow 5 years ago
parent
commit
72c6f52909
  1. 4
      src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs

4
src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs

@ -192,7 +192,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless
public bool UseCrossColorTransform { get; set; } public bool UseCrossColorTransform { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether to use the substract green transform. /// Gets or sets a value indicating whether to use the subtract green transform.
/// </summary> /// </summary>
public bool UseSubtractGreenTransform { get; set; } public bool UseSubtractGreenTransform { get; set; }
@ -1049,7 +1049,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless
return EntropyIx.Palette; return EntropyIx.Palette;
} }
using IMemoryOwner<uint> histoBuffer = this.memoryAllocator.Allocate<uint>((int)HistoIx.HistoTotal * 256); using IMemoryOwner<uint> histoBuffer = this.memoryAllocator.Allocate<uint>((int)HistoIx.HistoTotal * 256, AllocationOptions.Clean);
Span<uint> histo = histoBuffer.Memory.Span; Span<uint> histo = histoBuffer.Memory.Span;
uint pixPrev = bgra[0]; // Skip the first pixel. uint pixPrev = bgra[0]; // Skip the first pixel.
ReadOnlySpan<uint> prevRow = null; ReadOnlySpan<uint> prevRow = null;

Loading…
Cancel
Save