Browse Source

Block8x8F.MultiplyInPlace no longer use unsafe casts

Improved performance, no need for Unsafe calls.
pull/1632/head
Dmitry Pentin 5 years ago
parent
commit
fbf0ff1466
  1. 16
      src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs

16
src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs

@ -313,14 +313,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
if (Avx.IsSupported) if (Avx.IsSupported)
{ {
var valueVec = Vector256.Create(value); var valueVec = Vector256.Create(value);
Unsafe.As<Vector4, Vector256<float>>(ref this.V0L) = Avx.Multiply(Unsafe.As<Vector4, Vector256<float>>(ref this.V0L), valueVec); this.V0 = Avx.Multiply(this.V0, valueVec);
Unsafe.As<Vector4, Vector256<float>>(ref this.V1L) = Avx.Multiply(Unsafe.As<Vector4, Vector256<float>>(ref this.V1L), valueVec); this.V1 = Avx.Multiply(this.V1, valueVec);
Unsafe.As<Vector4, Vector256<float>>(ref this.V2L) = Avx.Multiply(Unsafe.As<Vector4, Vector256<float>>(ref this.V2L), valueVec); this.V2 = Avx.Multiply(this.V2, valueVec);
Unsafe.As<Vector4, Vector256<float>>(ref this.V3L) = Avx.Multiply(Unsafe.As<Vector4, Vector256<float>>(ref this.V3L), valueVec); this.V3 = Avx.Multiply(this.V3, valueVec);
Unsafe.As<Vector4, Vector256<float>>(ref this.V4L) = Avx.Multiply(Unsafe.As<Vector4, Vector256<float>>(ref this.V4L), valueVec); this.V4 = Avx.Multiply(this.V4, valueVec);
Unsafe.As<Vector4, Vector256<float>>(ref this.V5L) = Avx.Multiply(Unsafe.As<Vector4, Vector256<float>>(ref this.V5L), valueVec); this.V5 = Avx.Multiply(this.V5, valueVec);
Unsafe.As<Vector4, Vector256<float>>(ref this.V6L) = Avx.Multiply(Unsafe.As<Vector4, Vector256<float>>(ref this.V6L), valueVec); this.V6 = Avx.Multiply(this.V6, valueVec);
Unsafe.As<Vector4, Vector256<float>>(ref this.V7L) = Avx.Multiply(Unsafe.As<Vector4, Vector256<float>>(ref this.V7L), valueVec); this.V7 = Avx.Multiply(this.V7, valueVec);
} }
else else
#endif #endif

Loading…
Cancel
Save