Browse Source

Rework after review

pull/2039/head
Ynse Hoornenborg 4 years ago
parent
commit
d1a7569afa
  1. 4
      src/ImageSharp/Formats/Jpeg/Components/Encoder/LuminanceForwardConverter{TPixel}.cs
  2. 4
      src/ImageSharp/Formats/Jpeg/Components/Encoder/RgbForwardConverter{TPixel}.cs

4
src/ImageSharp/Formats/Jpeg/Components/Encoder/LuminanceForwardConverter{TPixel}.cs

@ -103,9 +103,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
ref Vector256<float> destRef = ref yBlock.V0;
const int bytesPerL8Stride = 8;
for (int i = 0; i < 8; i++)
for (nint i = 0; i < 8; i++)
{
Unsafe.Add(ref destRef, i) = Avx2.ConvertToVector256Single(Avx2.ConvertToVector256Int32(Unsafe.AddByteOffset(ref l8ByteSpan, (IntPtr)(bytesPerL8Stride * i))));
Unsafe.Add(ref destRef, i) = Avx2.ConvertToVector256Single(Avx2.ConvertToVector256Int32(Unsafe.AddByteOffset(ref l8ByteSpan, bytesPerL8Stride * i)));
}
#endif
}

4
src/ImageSharp/Formats/Jpeg/Components/Encoder/RgbForwardConverter{TPixel}.cs

@ -132,9 +132,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
Vector256<byte> rgb, rg, bx;
const int bytesPerRgbStride = 24;
for (int i = 0; i < 8; i++)
for (nint i = 0; i < 8; i++)
{
rgb = Avx2.PermuteVar8x32(Unsafe.AddByteOffset(ref rgbByteSpan, (IntPtr)(bytesPerRgbStride * i)).AsUInt32(), extractToLanesMask).AsByte();
rgb = Avx2.PermuteVar8x32(Unsafe.AddByteOffset(ref rgbByteSpan, bytesPerRgbStride * i).AsUInt32(), extractToLanesMask).AsByte();
rgb = Avx2.Shuffle(rgb, extractRgbMask);

Loading…
Cancel
Save