Browse Source

Implement Butteraugli core functions

pull/3153/head
winscripter 1 month ago
parent
commit
765c892df0
  1. 2333
      src/ImageSharp/Formats/Jxl/Processing/Butteraugli/Butteraugli.cs
  2. 46
      src/ImageSharp/Formats/Jxl/Processing/Butteraugli/ButteraugliComparator.cs
  3. 12
      src/ImageSharp/Formats/Jxl/Processing/Butteraugli/ButteraugliParameters.cs
  4. 1
      src/ImageSharp/Formats/Jxl/Processing/JxlQuantizer.cs
  5. 8
      src/ImageSharp/Formats/Jxl/Processing/JxlWeightsSeparable5.cs

2333
src/ImageSharp/Formats/Jxl/Processing/Butteraugli/Butteraugli.cs

File diff suppressed because it is too large

46
src/ImageSharp/Formats/Jxl/Processing/Butteraugli/ButteraugliComparator.cs

@ -0,0 +1,46 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Formats.Jxl.Memory.ImageTypes;
namespace SixLabors.ImageSharp.Formats.Jxl.Processing.Butteraugli;
internal sealed class ButteraugliComparator
{
private int xSize;
private int ySize;
private ButteraugliParameters parameters;
private readonly ButteraugliPsychoImage pi0;
private readonly JxlImage3F temp;
private bool tempInUse;
private readonly ButteraugliBlurTemp blurTemp;
/// <summary>
/// Computes the butteraugli map between the original image given in the constructor and the distorted image given here.
/// </summary>
public bool Diffmap(JxlImage3F rgb1, JxlImageF result)
{
throw new NotImplementedException();
}
/// <summary>
/// Same as Diffmap but OpsinDynamicsImage() was already applied.
/// </summary>
public bool DiffmapOpsinDynamicsImage(JxlImage3F xyb1, JxlImageF result)
{
throw new NotImplementedException();
}
/// <summary>
/// Same as above but the frequency decomposition was already applied.
/// </summary>
public bool DiffmapPsychoImage(ButteraugliPsychoImage pi1, JxlImageF diffmap)
{
throw new NotImplementedException();
}
public bool Mask(JxlImageF mask)
{
throw new NotImplementedException();
}
}

12
src/ImageSharp/Formats/Jxl/Processing/Butteraugli/ButteraugliParameters.cs

@ -9,18 +9,18 @@ namespace SixLabors.ImageSharp.Formats.Jxl.Processing.Butteraugli;
internal struct ButteraugliParameters()
{
/// <summary>
/// Multiplier for penalizing new HF artifacts more than
/// Gets or sets the multiplier for penalizing new HF artifacts more than
/// blurring away features. Value of 1.0 represents neutral.
/// </summary>
public float HfAsymmetry = 1f;
public float HfAsymmetry { get; set; } = 1f;
/// <summary>
/// Multiplier for the psychovisual difference in the X channel.
/// Gets or sets the multiplier for the psychovisual difference in the X channel.
/// </summary>
public float XMultiplier = 1f;
public float XMultiplier { get; set; } = 1f;
/// <summary>
/// Number of nits that correspond to 1.0f input values.
/// Gets or sets the number of nits that correspond to 1.0f input values.
/// </summary>
public float IntensityTarget = 80f;
public float IntensityTarget { get; set; } = 80f;
}

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

@ -4,7 +4,6 @@
using System.Buffers;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Formats.Jxl.Fields;
using SixLabors.ImageSharp.Formats.Jxl.IO;
using SixLabors.ImageSharp.Formats.Jxl.Memory;
using SixLabors.ImageSharp.Formats.Jxl.Memory.ImageTypes;

8
src/ImageSharp/Formats/Jxl/Processing/JxlWeightsSeparable5.cs

@ -3,9 +3,11 @@
namespace SixLabors.ImageSharp.Formats.Jxl.Processing;
internal sealed class JxlWeightsSeparable5
internal struct JxlWeightsSeparable5
{
public InlineArray12<float> Horizontal { get; set; }
// Don't make these a property so we can ref into them.
public InlineArray12<float> Vertical { get; set; }
public InlineArray12<float> Horizontal;
public InlineArray12<float> Vertical;
}

Loading…
Cancel
Save