mirror of https://github.com/SixLabors/ImageSharp
7 changed files with 96 additions and 1 deletions
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
namespace SixLabors.ImageSharp.Formats.Jxl.Splines; |
|||
|
|||
internal sealed class JxlQuantizedSpline |
|||
{ |
|||
public JxlQuantizedSpline() |
|||
{ |
|||
for (int i = 0; i < 3; i++) |
|||
{ |
|||
this.ColorDct[i] = new int[32]; |
|||
} |
|||
} |
|||
|
|||
public Dictionary<long, long> ControlPoints { get; set; } = []; |
|||
|
|||
// NOTE: Do not use Configuration.MemoryAllocator.Allocate2D. This is
|
|||
// a 3x32 array, and renting memory introduces too much overhead for
|
|||
// 384 bytes of memory.
|
|||
// Additionally, prefer jagged arrays instead of multidimensional arrays
|
|||
// for performance.
|
|||
public int[][] ColorDct { get; set; } = new int[3][]; |
|||
|
|||
public int[] SigmaDct { get; set; } = new int[32]; |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
namespace SixLabors.ImageSharp.Formats.Jxl.Splines; |
|||
|
|||
internal sealed class JxlSpline |
|||
{ |
|||
public List<PointF> ControlPoints { get; set; } = []; |
|||
|
|||
public JxlDct32[] ColorDct { get; set; } = []; |
|||
|
|||
public JxlDct32 SigmaDct { get; set; } |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
namespace SixLabors.ImageSharp.Formats.Jxl.Splines; |
|||
|
|||
internal sealed class JxlSplineDataView |
|||
{ |
|||
public List<JxlQuantizedSpline> Splines { get; set; } = []; |
|||
|
|||
public List<PointF> StartingPoints { get; set; } = []; |
|||
|
|||
public bool HasAny => this.Splines.Count > 0; |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
namespace SixLabors.ImageSharp.Formats.Jxl.Splines; |
|||
|
|||
internal enum JxlSplineEntropyContext |
|||
{ |
|||
QuantizationAdjustment, |
|||
StartingPosition, |
|||
NumSplines, |
|||
NumControlPoints, |
|||
ControlPoints, |
|||
Dct, |
|||
NumSplineContexts |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
namespace SixLabors.ImageSharp.Formats.Jxl.Splines; |
|||
|
|||
internal struct JxlSplineSegment |
|||
{ |
|||
public PointF Center { get; set; } |
|||
|
|||
public float MaximumDistance { get; set; } |
|||
|
|||
public float InverseSigma { get; set; } |
|||
|
|||
public float SigmaOver4TimesIntensity { get; set; } |
|||
|
|||
public InlineArray3<float> Color { get; set; } |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
namespace SixLabors.ImageSharp.Formats.Jxl.Splines; |
|||
|
|||
internal struct JxlSplineSegmentSpan(int startInclusive, int endInclusive) |
|||
{ |
|||
public int StartInclusive { get; set; } = startInclusive; |
|||
|
|||
public int EndInclusive { get; set; } = endInclusive; |
|||
} |
|||
Loading…
Reference in new issue