Skip to content

Commit

Permalink
Rename of test classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ynse01 committed Nov 20, 2024
1 parent 682b05c commit 5aca407
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 33 deletions.
38 changes: 19 additions & 19 deletions src/ImageSharp/Formats/Heif/Av1/Entropy/Av1SymbolEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ public void WriteSplitOrVertical(Av1PartitionType partitionType, Av1BlockSize bl
public int WriteCoefficients(
Av1TransformSize transformSize,
Av1TransformType transformType,
uint txb_index, // TODO: Doesn't seem to be used, remove.
Av1PredictionMode intraLumaDir,
Span<int> coeff_buffer_ptr,
int txbIndex, // TODO: Doesn't seem to be used, remove.
Av1PredictionMode intraDirection,
Span<int> coeffBuffer,
Av1ComponentType componentType,
short txb_skip_ctx,
short dc_sign_ctx,
short transformBlockSkipContext,
short dcSignContext,
ushort eob,
bool useReducedTransformSet,
int baseQIndex,
Expand All @@ -151,17 +151,17 @@ public int WriteCoefficients(
Guard.MustBeLessThan((int)transformSizeContext, (int)Av1TransformSize.AllSizes, nameof(transformSizeContext));

bool hasEndOfBlock = eob != 0;
this.WriteSkip(!hasEndOfBlock, txb_skip_ctx);
this.WriteSkip(!hasEndOfBlock, transformBlockSkipContext);

if (eob == 0)
{
return 0;
}

InitializeLevels(coeff_buffer_ptr, width, height, levels);
InitializeLevels(coeffBuffer, width, height, levels);
if (componentType == Av1ComponentType.Luminance)
{
this.WriteTransformType(transformType, transformSize, useReducedTransformSet, baseQIndex, filterIntraMode, intraLumaDir);
this.WriteTransformType(transformType, transformSize, useReducedTransformSet, baseQIndex, filterIntraMode, intraDirection);
}

short endOfBlockPosition = GetEndOfBlockPosition(eob, out int eob_extra);
Expand All @@ -186,7 +186,7 @@ public int WriteCoefficients(
for (c = eob - 1; c >= 0; --c)
{
short pos = scan[c];
int v = coeff_buffer_ptr[pos];
int v = coeffBuffer[pos];
short coeff_ctx = coeff_contexts[pos];
int level = Math.Abs(v);

Expand Down Expand Up @@ -222,7 +222,7 @@ public int WriteCoefficients(
for (c = 0; c < eob; ++c)
{
short pos = scan[c];
int v = coeff_buffer_ptr[pos];
int v = coeffBuffer[pos];
int level = Math.Abs(v);
cul_level += level;

Expand All @@ -231,7 +231,7 @@ public int WriteCoefficients(
{
if (c == 0)
{
w.WriteSymbol((int)sign, this.dcSign[(int)componentType][dc_sign_ctx]);
w.WriteSymbol((int)sign, this.dcSign[(int)componentType][dcSignContext]);
}
else
{
Expand All @@ -248,22 +248,22 @@ public int WriteCoefficients(
cul_level = Math.Min(Av1Constants.CoefficientContextMask, cul_level);

// DC value
SetDcSign(ref cul_level, coeff_buffer_ptr[0]);
SetDcSign(ref cul_level, coeffBuffer[0]);
return cul_level;
}

/// <summary>
/// SVT: set_dc_sign
/// </summary>
private static void SetDcSign(ref int cul_level, int dc_val)
private static void SetDcSign(ref int culLevel, int dcValue)
{
if (dc_val < 0)
if (dcValue < 0)
{
cul_level |= 1 << Av1Constants.CoefficientContextBitCount;
culLevel |= 1 << Av1Constants.CoefficientContextBitCount;
}
else if (dc_val > 0)
else if (dcValue > 0)
{
cul_level += 2 << Av1Constants.CoefficientContextBitCount;
culLevel += 2 << Av1Constants.CoefficientContextBitCount;
}
}

Expand Down Expand Up @@ -432,8 +432,8 @@ private static void InitializeLevels(Span<int> coefficientBuffer, int width, int
/// <summary>
/// SVT: set_levels from EbCommonUtils.h
/// </summary>
private static Span<byte> SetLevels(Span<byte> levels_buf, int width)
=> levels_buf.Slice(Av1Constants.TransformPadTop * (width + Av1Constants.TransformPadHorizontal));
private static Span<byte> SetLevels(Span<byte> levelsBuffer, int width)
=> levelsBuffer.Slice(Av1Constants.TransformPadTop * (width + Av1Constants.TransformPadHorizontal));

private void WriteSkip(bool hasEndOfBlock, int context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace SixLabors.ImageSharp.Tests.Formats.Heif.Av1;

internal class EchoTestTransformer : IAv1Forward1dTransformer
internal class Av1EchoTestTransformer : IAv1Forward1dTransformer
{
public void Transform(Span<int> input, Span<int> output, int cosBit, Span<byte> stageRange)
=> input.CopyTo(output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace SixLabors.ImageSharp.Tests.Formats.Heif.Av1;

[Trait("Format", "Avif")]
public class EntropyTests
public class Av1EntropyTests
{
private const int BaseQIndex = 23;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void ScaleFactorTest(int txSize, int txType, int _)
Array.Fill<short>(input, 1);
int[] actual = new int[64 * 64];
Av1Transform2dFlipConfiguration config = new(transformType, transformSize);
IAv1Forward1dTransformer transformer = new EchoTestTransformer();
IAv1Forward1dTransformer transformer = new Av1EchoTestTransformer();
int width = transformSize.GetWidth();
int height = transformSize.GetHeight();
int blockSize = width * height;
Expand Down Expand Up @@ -123,7 +123,7 @@ public void FlipNothingTest()
Av1Transform2dFlipConfiguration config = new(Av1TransformType.Identity, Av1TransformSize.Size4x4);
config.SetFlip(false, false);
config.SetShift(0, 0, 0);
IAv1Forward1dTransformer transformer = new EchoTestTransformer();
IAv1Forward1dTransformer transformer = new Av1EchoTestTransformer();

// Act
Av1ForwardTransformer.Transform2d(
Expand Down Expand Up @@ -157,7 +157,7 @@ public void FlipHorizontalTest()
Av1Transform2dFlipConfiguration config = new(Av1TransformType.Identity, Av1TransformSize.Size4x4);
config.SetFlip(false, true);
config.SetShift(0, 0, 0);
IAv1Forward1dTransformer transformer = new EchoTestTransformer();
IAv1Forward1dTransformer transformer = new Av1EchoTestTransformer();

// Act
Av1ForwardTransformer.Transform2d(
Expand Down Expand Up @@ -191,7 +191,7 @@ public void FlipVerticalTest()
Av1Transform2dFlipConfiguration config = new(Av1TransformType.Identity, Av1TransformSize.Size4x4);
config.SetFlip(true, false);
config.SetShift(0, 0, 0);
IAv1Forward1dTransformer transformer = new EchoTestTransformer();
IAv1Forward1dTransformer transformer = new Av1EchoTestTransformer();

// Act
Av1ForwardTransformer.Transform2d(
Expand Down Expand Up @@ -225,7 +225,7 @@ public void FlipHorizontalAndVerticalTest()
Av1Transform2dFlipConfiguration config = new(Av1TransformType.Identity, Av1TransformSize.Size4x4);
config.SetFlip(true, true);
config.SetShift(0, 0, 0);
IAv1Forward1dTransformer transformer = new EchoTestTransformer();
IAv1Forward1dTransformer transformer = new Av1EchoTestTransformer();

// Act
Av1ForwardTransformer.Transform2d(
Expand Down Expand Up @@ -261,7 +261,7 @@ public void NonSquareTransformSizeLandscapeTest()
Av1Transform2dFlipConfiguration config = new(Av1TransformType.Identity, Av1TransformSize.Size8x4);
config.SetFlip(true, false);
config.SetShift(0, 0, 0);
IAv1Forward1dTransformer transformer = new EchoTestTransformer();
IAv1Forward1dTransformer transformer = new Av1EchoTestTransformer();

// Act
Av1ForwardTransformer.Transform2d(
Expand Down Expand Up @@ -305,7 +305,7 @@ public void NonSquareTransformSizePortraitTest()
Av1Transform2dFlipConfiguration config = new(Av1TransformType.Identity, Av1TransformSize.Size4x8);
config.SetFlip(true, false);
config.SetShift(0, 0, 0);
IAv1Forward1dTransformer transformer = new EchoTestTransformer();
IAv1Forward1dTransformer transformer = new Av1EchoTestTransformer();

// Act
Av1ForwardTransformer.Transform2d(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void AccuracyOfIdentity1dTransformSize64Test()

[Fact]
public void AccuracyOfEchoTransformSize4Test()
=> AssertAccuracy1d(Av1TransformType.Identity, Av1TransformSize.Size4x4, 0, new EchoTestTransformer(), new EchoTestTransformer());
=> AssertAccuracy1d(Av1TransformType.Identity, Av1TransformSize.Size4x4, 0, new Av1EchoTestTransformer(), new Av1EchoTestTransformer());

[Fact]
public void FlipNothingTest()
Expand All @@ -96,7 +96,7 @@ public void FlipNothingTest()
config.GenerateStageRange(8);
config.SetFlip(false, false);
config.SetShift(0, 0, 0);
IAv1Forward1dTransformer transformer = new EchoTestTransformer();
IAv1Forward1dTransformer transformer = new Av1EchoTestTransformer();

// Act
Av1Inverse2dTransformer.Transform2dAdd(
Expand Down Expand Up @@ -132,7 +132,7 @@ public void FlipHorizontalTest()
Av1Transform2dFlipConfiguration config = new(Av1TransformType.Identity, Av1TransformSize.Size4x4);
config.SetFlip(false, true);
config.SetShift(0, 0, 0);
IAv1Forward1dTransformer transformer = new EchoTestTransformer();
IAv1Forward1dTransformer transformer = new Av1EchoTestTransformer();

// Act
Av1Inverse2dTransformer.Transform2dAdd(
Expand Down Expand Up @@ -168,7 +168,7 @@ public void FlipVerticalTest()
Av1Transform2dFlipConfiguration config = new(Av1TransformType.Identity, Av1TransformSize.Size4x4);
config.SetFlip(true, false);
config.SetShift(0, 0, 0);
IAv1Forward1dTransformer transformer = new EchoTestTransformer();
IAv1Forward1dTransformer transformer = new Av1EchoTestTransformer();

// Act
Av1Inverse2dTransformer.Transform2dAdd(
Expand Down Expand Up @@ -204,7 +204,7 @@ public void FlipHorizontalAndVerticalTest()
Av1Transform2dFlipConfiguration config = new(Av1TransformType.Identity, Av1TransformSize.Size4x4);
config.SetFlip(true, true);
config.SetShift(0, 0, 0);
IAv1Forward1dTransformer transformer = new EchoTestTransformer();
IAv1Forward1dTransformer transformer = new Av1EchoTestTransformer();

// Act
Av1Inverse2dTransformer.Transform2dAdd(
Expand Down

0 comments on commit 5aca407

Please sign in to comment.