diff --git a/src/ImageSharp/Formats/Jxl/Processing/JxlBlockContextMap.cs b/src/ImageSharp/Formats/Jxl/Processing/JxlBlockContextMap.cs index cf7008eb5..2642a2295 100644 --- a/src/ImageSharp/Formats/Jxl/Processing/JxlBlockContextMap.cs +++ b/src/ImageSharp/Formats/Jxl/Processing/JxlBlockContextMap.cs @@ -2,7 +2,6 @@ // Licensed under the Six Labors Split License. using System.Runtime.CompilerServices; -using SixLabors.ImageSharp.Formats.Jxl.Coefficients; namespace SixLabors.ImageSharp.Formats.Jxl.Processing; diff --git a/src/ImageSharp/Formats/Jxl/Processing/JxlWeightsSymmetric3.cs b/src/ImageSharp/Formats/Jxl/Processing/JxlWeightsSymmetric3.cs new file mode 100644 index 000000000..4d350b3ab --- /dev/null +++ b/src/ImageSharp/Formats/Jxl/Processing/JxlWeightsSymmetric3.cs @@ -0,0 +1,52 @@ +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. + +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; + +namespace SixLabors.ImageSharp.Formats.Jxl.Processing; + +internal sealed class JxlWeightsSymmetric3 +{ + private InlineArray4 c; + + private InlineArray4 r; + + private InlineArray4 d; + + public Vector128 GetCVector() + { + ref float first = ref Unsafe.AsRef(in this.c[0]); + return Vector128.LoadUnsafe(ref first); + } + + public Vector128 GetRVector() + { + ref float first = ref Unsafe.AsRef(in this.r[0]); + return Vector128.LoadUnsafe(ref first); + } + + public Vector128 GetDVector() + { + ref float first = ref Unsafe.AsRef(in this.d[0]); + return Vector128.LoadUnsafe(ref first); + } + + public void SetC(Vector128 vec) + { + ref float first = ref Unsafe.AsRef(in this.c[0]); + vec.StoreUnsafe(ref first); + } + + public void SetD(Vector128 vec) + { + ref float first = ref Unsafe.AsRef(in this.d[0]); + vec.StoreUnsafe(ref first); + } + + public void SetR(Vector128 vec) + { + ref float first = ref Unsafe.AsRef(in this.r[0]); + vec.StoreUnsafe(ref first); + } +} diff --git a/src/ImageSharp/Formats/Jxl/Processing/JxlWeightsSymmetric5.cs b/src/ImageSharp/Formats/Jxl/Processing/JxlWeightsSymmetric5.cs new file mode 100644 index 000000000..1e2481dbb --- /dev/null +++ b/src/ImageSharp/Formats/Jxl/Processing/JxlWeightsSymmetric5.cs @@ -0,0 +1,94 @@ +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. + +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; + +namespace SixLabors.ImageSharp.Formats.Jxl.Processing; + +internal sealed class JxlWeightsSymmetric5 +{ + private InlineArray4 c; + + private InlineArray4 r; + + private InlineArray4 r2; + + private InlineArray4 d; + + private InlineArray4 d2; + + private InlineArray4 l; + + public Vector128 GetCVector() + { + ref float first = ref Unsafe.AsRef(in this.c[0]); + return Vector128.LoadUnsafe(ref first); + } + + public Vector128 GetRVector() + { + ref float first = ref Unsafe.AsRef(in this.r[0]); + return Vector128.LoadUnsafe(ref first); + } + + public Vector128 GetR2Vector() + { + ref float first = ref Unsafe.AsRef(in this.r2[0]); + return Vector128.LoadUnsafe(ref first); + } + + public Vector128 GetDVector() + { + ref float first = ref Unsafe.AsRef(in this.d[0]); + return Vector128.LoadUnsafe(ref first); + } + + public Vector128 GetD2Vector() + { + ref float first = ref Unsafe.AsRef(in this.d2[0]); + return Vector128.LoadUnsafe(ref first); + } + + public Vector128 GetLVector() + { + ref float first = ref Unsafe.AsRef(in this.l[0]); + return Vector128.LoadUnsafe(ref first); + } + + public void SetC(Vector128 vec) + { + ref float first = ref Unsafe.AsRef(in this.c[0]); + vec.StoreUnsafe(ref first); + } + + public void SetD(Vector128 vec) + { + ref float first = ref Unsafe.AsRef(in this.d[0]); + vec.StoreUnsafe(ref first); + } + + public void SetD2(Vector128 vec) + { + ref float first = ref Unsafe.AsRef(in this.d2[0]); + vec.StoreUnsafe(ref first); + } + + public void SetR(Vector128 vec) + { + ref float first = ref Unsafe.AsRef(in this.r[0]); + vec.StoreUnsafe(ref first); + } + + public void SetR2(Vector128 vec) + { + ref float first = ref Unsafe.AsRef(in this.r2[0]); + vec.StoreUnsafe(ref first); + } + + public void SetL(Vector128 vec) + { + ref float first = ref Unsafe.AsRef(in this.l[0]); + vec.StoreUnsafe(ref first); + } +}