Browse Source

Use single Block8x8F.TransponseInto test

pull/1385/head
James Jackson-South 6 years ago
parent
commit
296d9f6220
  1. 48
      tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs

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

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

Loading…
Cancel
Save