Browse Source

Use single Block8x8F.TransponseInto test

js/color-alpha-handling
James Jackson-South 6 years ago
parent
commit
9380dd5b1e
  1. 48
      tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs

48
tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs

@ -5,10 +5,9 @@
// #define BENCHMARKING
using System;
using System.Diagnostics;
using SixLabors.ImageSharp.Formats.Jpeg.Components;
using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils;
using SixLabors.ImageSharp.Tests.TestUtilities;
using Xunit;
using Xunit.Abstractions;
@ -163,42 +162,29 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
}
[Fact]
public void TransposeIntoFallback()
public void TransposeInto()
{
float[] expected = Create8x8FloatData();
ReferenceImplementations.Transpose8x8(expected);
var source = default(Block8x8F);
source.LoadFrom(Create8x8FloatData());
var dest = default(Block8x8F);
source.TransposeIntoFallback(ref dest);
float[] actual = new float[64];
dest.ScaledCopyTo(actual);
Assert.Equal(expected, actual);
}
static void RunTest()
{
float[] expected = Create8x8FloatData();
ReferenceImplementations.Transpose8x8(expected);
#if SUPPORTS_RUNTIME_INTRINSICS
[Fact]
public void TransposeIntoAvx()
{
float[] expected = Create8x8FloatData();
ReferenceImplementations.Transpose8x8(expected);
var source = default(Block8x8F);
source.LoadFrom(Create8x8FloatData());
var source = default(Block8x8F);
source.LoadFrom(Create8x8FloatData());
var dest = default(Block8x8F);
source.TransposeInto(ref dest);
var dest = default(Block8x8F);
source.TransposeIntoAvx(ref dest);
float[] actual = new float[64];
dest.ScaledCopyTo(actual);
float[] actual = new float[64];
dest.ScaledCopyTo(actual);
Assert.Equal(expected, actual);
}
Assert.Equal(expected, actual);
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX);
}
#endif
private class BufferHolder
{

Loading…
Cancel
Save