Browse Source

Add symmetric weights; fix broken using

See convolve.h
pull/3153/head
winscripter 2 months ago
parent
commit
b15c190a8e
  1. 1
      src/ImageSharp/Formats/Jxl/Processing/JxlBlockContextMap.cs
  2. 52
      src/ImageSharp/Formats/Jxl/Processing/JxlWeightsSymmetric3.cs
  3. 94
      src/ImageSharp/Formats/Jxl/Processing/JxlWeightsSymmetric5.cs

1
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;

52
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<float> c;
private InlineArray4<float> r;
private InlineArray4<float> d;
public Vector128<float> GetCVector()
{
ref float first = ref Unsafe.AsRef(in this.c[0]);
return Vector128.LoadUnsafe(ref first);
}
public Vector128<float> GetRVector()
{
ref float first = ref Unsafe.AsRef(in this.r[0]);
return Vector128.LoadUnsafe(ref first);
}
public Vector128<float> GetDVector()
{
ref float first = ref Unsafe.AsRef(in this.d[0]);
return Vector128.LoadUnsafe(ref first);
}
public void SetC(Vector128<float> vec)
{
ref float first = ref Unsafe.AsRef(in this.c[0]);
vec.StoreUnsafe(ref first);
}
public void SetD(Vector128<float> vec)
{
ref float first = ref Unsafe.AsRef(in this.d[0]);
vec.StoreUnsafe(ref first);
}
public void SetR(Vector128<float> vec)
{
ref float first = ref Unsafe.AsRef(in this.r[0]);
vec.StoreUnsafe(ref first);
}
}

94
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<float> c;
private InlineArray4<float> r;
private InlineArray4<float> r2;
private InlineArray4<float> d;
private InlineArray4<float> d2;
private InlineArray4<float> l;
public Vector128<float> GetCVector()
{
ref float first = ref Unsafe.AsRef(in this.c[0]);
return Vector128.LoadUnsafe(ref first);
}
public Vector128<float> GetRVector()
{
ref float first = ref Unsafe.AsRef(in this.r[0]);
return Vector128.LoadUnsafe(ref first);
}
public Vector128<float> GetR2Vector()
{
ref float first = ref Unsafe.AsRef(in this.r2[0]);
return Vector128.LoadUnsafe(ref first);
}
public Vector128<float> GetDVector()
{
ref float first = ref Unsafe.AsRef(in this.d[0]);
return Vector128.LoadUnsafe(ref first);
}
public Vector128<float> GetD2Vector()
{
ref float first = ref Unsafe.AsRef(in this.d2[0]);
return Vector128.LoadUnsafe(ref first);
}
public Vector128<float> GetLVector()
{
ref float first = ref Unsafe.AsRef(in this.l[0]);
return Vector128.LoadUnsafe(ref first);
}
public void SetC(Vector128<float> vec)
{
ref float first = ref Unsafe.AsRef(in this.c[0]);
vec.StoreUnsafe(ref first);
}
public void SetD(Vector128<float> vec)
{
ref float first = ref Unsafe.AsRef(in this.d[0]);
vec.StoreUnsafe(ref first);
}
public void SetD2(Vector128<float> vec)
{
ref float first = ref Unsafe.AsRef(in this.d2[0]);
vec.StoreUnsafe(ref first);
}
public void SetR(Vector128<float> vec)
{
ref float first = ref Unsafe.AsRef(in this.r[0]);
vec.StoreUnsafe(ref first);
}
public void SetR2(Vector128<float> vec)
{
ref float first = ref Unsafe.AsRef(in this.r2[0]);
vec.StoreUnsafe(ref first);
}
public void SetL(Vector128<float> vec)
{
ref float first = ref Unsafe.AsRef(in this.l[0]);
vec.StoreUnsafe(ref first);
}
}
Loading…
Cancel
Save