Browse Source

Reduce errors, remove unused constant

pull/3153/head
winscripter 1 week ago
parent
commit
352b14df9a
  1. 5
      src/ImageSharp/Formats/Jxl/Processing/JxlLoopFilter.cs
  2. 18
      src/ImageSharp/Formats/Jxl/Processing/JxlQuantizer.cs

5
src/ImageSharp/Formats/Jxl/Processing/JxlLoopFilter.cs

@ -21,11 +21,6 @@ internal sealed class JxlLoopFilter : IJxlFields
/// </summary> /// </summary>
private const float InverseSigmaNum = -1.1715728752538099024f; private const float InverseSigmaNum = -1.1715728752538099024f;
/// <summary>
/// kInvSigmaNum / 0.3
/// </summary>
private const float MinSigma = -3.90524291751269967465540850526868f;
/// <summary> /// <summary>
/// Gets the number of EPF (Edge-preserving filter) sharp entries. /// Gets the number of EPF (Edge-preserving filter) sharp entries.
/// </summary> /// </summary>

18
src/ImageSharp/Formats/Jxl/Processing/JxlQuantizer.cs

@ -52,12 +52,12 @@ internal sealed class JxlQuantizer
/// <summary> /// <summary>
/// Represents the multipliers for the DC coefficients. /// Represents the multipliers for the DC coefficients.
/// </summary> /// </summary>
private readonly InlineArray4<float> mulDc; private InlineArray4<float> mulDc;
/// <summary> /// <summary>
/// Represents the inverse multipliers for the DC coefficients. /// Represents the inverse multipliers for the DC coefficients.
/// </summary> /// </summary>
private readonly InlineArray4<float> inverseMulDc; private InlineArray4<float> inverseMulDc;
/// <summary> /// <summary>
/// Global scale /// Global scale
@ -148,8 +148,8 @@ internal sealed class JxlQuantizer
/// </summary> /// </summary>
public void ClearDcMultipliers() public void ClearDcMultipliers()
{ {
Array.Fill(this.mulDc, 1f); ((Span<float>)this.mulDc).Fill(1f);
Array.Fill(this.inverseMulDc, 1f); ((Span<float>)this.inverseMulDc).Fill(1f);
} }
/// <summary> /// <summary>
@ -303,8 +303,8 @@ internal sealed class JxlQuantizer
{ {
for (int y = 0; y < rect.Height; y++) for (int y = 0; y < rect.Height; y++)
{ {
ReadOnlySpan<float> rowQf = qf.GetRow(in rect, y); ReadOnlySpan<float> rowQf = qf.GetRow(rect, y);
Span<int> rowQi = rawQuantField.GetRow(in rect, y); Span<int> rowQi = rawQuantField.GetRow(rect, y);
for (int x = 0; x < rect.Width; x++) for (int x = 0; x < rect.Width; x++)
{ {
@ -352,7 +352,7 @@ internal sealed class JxlQuantizer
if (rawQuantField != null) if (rawQuantField != null)
{ {
if (rawQuantField.GetSize() != qf.GetSize()) if (rawQuantField.GetRectangle() != qf.GetRectangle())
{ {
data.Dispose(); data.Dispose();
deviations.Dispose(); deviations.Dispose();
@ -360,7 +360,7 @@ internal sealed class JxlQuantizer
return false; return false;
} }
this.SetQuantField(qf, qf.GetRectangle(), rawQuantField); this.SetQuantFieldRect(qf, qf.GetRectangle(), rawQuantField);
} }
data.Dispose(); data.Dispose();
@ -374,6 +374,6 @@ internal sealed class JxlQuantizer
this.ComputeGlobalScaleAndQuant(quantDc, quantAc, 0); this.ComputeGlobalScaleAndQuant(quantDc, quantAc, 0);
int value = Clamp((quantAc * this.InverseGlobalScale) + 0.5f); int value = Clamp((quantAc * this.InverseGlobalScale) + 0.5f);
rawQuantField.Fill(value); JxlImageOperations.FillImage(value, rawQuantField);
} }
} }

Loading…
Cancel
Save