Browse Source

Apply suggestions from code review

Co-authored-by: Günther Foidl <gue@korporal.at>
pull/1824/head
Brian Popow 4 years ago
committed by GitHub
parent
commit
7959d0bd8b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/ImageSharp/Formats/Webp/Lossless/ColorSpaceTransformUtils.cs
  2. 2
      src/ImageSharp/Formats/Webp/Lossless/PredictorEncoder.cs

8
src/ImageSharp/Formats/Webp/Lossless/ColorSpaceTransformUtils.cs

@ -56,7 +56,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless
{
Span<uint> srcSpan = bgra.Slice(y * stride);
ref uint inputRef = ref MemoryMarshal.GetReference(srcSpan);
for (int x = 0; x + span <= tileWidth; x += span)
for (int x = 0; x <= tileWidth - span; x += span)
{
int input0Idx = x;
int input1Idx = x + (span / 2);
@ -101,7 +101,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless
{
Span<uint> srcSpan = bgra.Slice(y * stride);
ref uint inputRef = ref MemoryMarshal.GetReference(srcSpan);
for (int x = 0; x + span <= tileWidth; x += span)
for (int x = 0; x <= tileWidth - span; x += span)
{
int input0Idx = x;
int input1Idx = x + (span / 2);
@ -170,7 +170,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless
{
Span<uint> srcSpan = bgra.Slice(y * stride);
ref uint inputRef = ref MemoryMarshal.GetReference(srcSpan);
for (int x = 0; x + span <= tileWidth; x += span)
for (int x = 0; x <= tileWidth - span; x += span)
{
int input0Idx = x;
int input1Idx = x + (span / 2);
@ -211,7 +211,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless
{
Span<uint> srcSpan = bgra.Slice(y * stride);
ref uint inputRef = ref MemoryMarshal.GetReference(srcSpan);
for (int x = 0; x + span <= tileWidth; x += span)
for (int x = 0; x <= tileWidth - span; x += span)
{
int input0Idx = x;
int input1Idx = x + (span / 2);

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

@ -561,7 +561,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless
return (byte)(lower + (quantization >> 1));
}
return (byte)(upper & 0xff);
return (byte)upper;
}
/// <summary>

Loading…
Cancel
Save