Browse Source

Initialize backward refs with the pixel count

pull/1846/head
Brian Popow 5 years ago
parent
commit
fae8f0dc31
  1. 2
      src/ImageSharp/Formats/Webp/Lossless/Vp8LBackwardRefs.cs
  2. 2
      src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs

2
src/ImageSharp/Formats/Webp/Lossless/Vp8LBackwardRefs.cs

@ -7,7 +7,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless
{ {
internal class Vp8LBackwardRefs internal class Vp8LBackwardRefs
{ {
public Vp8LBackwardRefs() => this.Refs = new List<PixOrCopy>(); public Vp8LBackwardRefs(int pixels) => this.Refs = new List<PixOrCopy>(pixels);
/// <summary> /// <summary>
/// Gets or sets the common block-size. /// Gets or sets the common block-size.

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

@ -130,7 +130,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless
int refsBlockSize = ((pixelCount - 1) / MaxRefsBlockPerImage) + 1; int refsBlockSize = ((pixelCount - 1) / MaxRefsBlockPerImage) + 1;
for (int i = 0; i < this.Refs.Length; i++) for (int i = 0; i < this.Refs.Length; i++)
{ {
this.Refs[i] = new Vp8LBackwardRefs this.Refs[i] = new Vp8LBackwardRefs(pixelCount)
{ {
BlockSize = refsBlockSize < MinBlockSize ? MinBlockSize : refsBlockSize BlockSize = refsBlockSize < MinBlockSize ? MinBlockSize : refsBlockSize
}; };

Loading…
Cancel
Save