|
|
@ -611,23 +611,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components |
|
|
#if SUPPORTS_RUNTIME_INTRINSICS
|
|
|
#if SUPPORTS_RUNTIME_INTRINSICS
|
|
|
if (Avx.IsSupported) |
|
|
if (Avx.IsSupported) |
|
|
{ |
|
|
{ |
|
|
this.TransposeIntoAvx(ref d); |
|
|
// https://stackoverflow.com/questions/25622745/transpose-an-8x8-float-using-avx-avx2/25627536#25627536
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
#endif
|
|
|
|
|
|
{ |
|
|
|
|
|
this.TransposeIntoFallback(ref d); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if SUPPORTS_RUNTIME_INTRINSICS
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// AVX-only variant for executing <see cref="TransposeInto(ref Block8x8F)"/>.
|
|
|
|
|
|
/// <see href="https://stackoverflow.com/questions/25622745/transpose-an-8x8-float-using-avx-avx2/25627536#25627536"/>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
public void TransposeIntoAvx(ref Block8x8F d) |
|
|
|
|
|
{ |
|
|
|
|
|
Vector256<float> r0 = Avx.InsertVector128( |
|
|
Vector256<float> r0 = Avx.InsertVector128( |
|
|
Unsafe.As<Vector4, Vector128<float>>(ref this.V0L).ToVector256(), |
|
|
Unsafe.As<Vector4, Vector128<float>>(ref this.V0L).ToVector256(), |
|
|
Unsafe.As<Vector4, Vector128<float>>(ref this.V4L), |
|
|
Unsafe.As<Vector4, Vector128<float>>(ref this.V4L), |
|
|
@ -692,6 +676,81 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components |
|
|
Unsafe.As<Vector4, Vector256<float>>(ref d.V6L) = Avx.Blend(t5, v, 0xCC); |
|
|
Unsafe.As<Vector4, Vector256<float>>(ref d.V6L) = Avx.Blend(t5, v, 0xCC); |
|
|
Unsafe.As<Vector4, Vector256<float>>(ref d.V7L) = Avx.Blend(t7, v, 0x33); |
|
|
Unsafe.As<Vector4, Vector256<float>>(ref d.V7L) = Avx.Blend(t7, v, 0x33); |
|
|
} |
|
|
} |
|
|
|
|
|
else |
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
{ |
|
|
|
|
|
d.V0L.X = this.V0L.X; |
|
|
|
|
|
d.V1L.X = this.V0L.Y; |
|
|
|
|
|
d.V2L.X = this.V0L.Z; |
|
|
|
|
|
d.V3L.X = this.V0L.W; |
|
|
|
|
|
d.V4L.X = this.V0R.X; |
|
|
|
|
|
d.V5L.X = this.V0R.Y; |
|
|
|
|
|
d.V6L.X = this.V0R.Z; |
|
|
|
|
|
d.V7L.X = this.V0R.W; |
|
|
|
|
|
|
|
|
|
|
|
d.V0L.Y = this.V1L.X; |
|
|
|
|
|
d.V1L.Y = this.V1L.Y; |
|
|
|
|
|
d.V2L.Y = this.V1L.Z; |
|
|
|
|
|
d.V3L.Y = this.V1L.W; |
|
|
|
|
|
d.V4L.Y = this.V1R.X; |
|
|
|
|
|
d.V5L.Y = this.V1R.Y; |
|
|
|
|
|
d.V6L.Y = this.V1R.Z; |
|
|
|
|
|
d.V7L.Y = this.V1R.W; |
|
|
|
|
|
|
|
|
|
|
|
d.V0L.Z = this.V2L.X; |
|
|
|
|
|
d.V1L.Z = this.V2L.Y; |
|
|
|
|
|
d.V2L.Z = this.V2L.Z; |
|
|
|
|
|
d.V3L.Z = this.V2L.W; |
|
|
|
|
|
d.V4L.Z = this.V2R.X; |
|
|
|
|
|
d.V5L.Z = this.V2R.Y; |
|
|
|
|
|
d.V6L.Z = this.V2R.Z; |
|
|
|
|
|
d.V7L.Z = this.V2R.W; |
|
|
|
|
|
|
|
|
|
|
|
d.V0L.W = this.V3L.X; |
|
|
|
|
|
d.V1L.W = this.V3L.Y; |
|
|
|
|
|
d.V2L.W = this.V3L.Z; |
|
|
|
|
|
d.V3L.W = this.V3L.W; |
|
|
|
|
|
d.V4L.W = this.V3R.X; |
|
|
|
|
|
d.V5L.W = this.V3R.Y; |
|
|
|
|
|
d.V6L.W = this.V3R.Z; |
|
|
|
|
|
d.V7L.W = this.V3R.W; |
|
|
|
|
|
|
|
|
|
|
|
d.V0R.X = this.V4L.X; |
|
|
|
|
|
d.V1R.X = this.V4L.Y; |
|
|
|
|
|
d.V2R.X = this.V4L.Z; |
|
|
|
|
|
d.V3R.X = this.V4L.W; |
|
|
|
|
|
d.V4R.X = this.V4R.X; |
|
|
|
|
|
d.V5R.X = this.V4R.Y; |
|
|
|
|
|
d.V6R.X = this.V4R.Z; |
|
|
|
|
|
d.V7R.X = this.V4R.W; |
|
|
|
|
|
|
|
|
|
|
|
d.V0R.Y = this.V5L.X; |
|
|
|
|
|
d.V1R.Y = this.V5L.Y; |
|
|
|
|
|
d.V2R.Y = this.V5L.Z; |
|
|
|
|
|
d.V3R.Y = this.V5L.W; |
|
|
|
|
|
d.V4R.Y = this.V5R.X; |
|
|
|
|
|
d.V5R.Y = this.V5R.Y; |
|
|
|
|
|
d.V6R.Y = this.V5R.Z; |
|
|
|
|
|
d.V7R.Y = this.V5R.W; |
|
|
|
|
|
|
|
|
|
|
|
d.V0R.Z = this.V6L.X; |
|
|
|
|
|
d.V1R.Z = this.V6L.Y; |
|
|
|
|
|
d.V2R.Z = this.V6L.Z; |
|
|
|
|
|
d.V3R.Z = this.V6L.W; |
|
|
|
|
|
d.V4R.Z = this.V6R.X; |
|
|
|
|
|
d.V5R.Z = this.V6R.Y; |
|
|
|
|
|
d.V6R.Z = this.V6R.Z; |
|
|
|
|
|
d.V7R.Z = this.V6R.W; |
|
|
|
|
|
|
|
|
|
|
|
d.V0R.W = this.V7L.X; |
|
|
|
|
|
d.V1R.W = this.V7L.Y; |
|
|
|
|
|
d.V2R.W = this.V7L.Z; |
|
|
|
|
|
d.V3R.W = this.V7L.W; |
|
|
|
|
|
d.V4R.W = this.V7R.X; |
|
|
|
|
|
d.V5R.W = this.V7R.Y; |
|
|
|
|
|
d.V6R.W = this.V7R.Z; |
|
|
|
|
|
d.V7R.W = this.V7R.W; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|