Browse Source

fix ProfilingSandbox

pull/1773/head
Anton Firszov 4 years ago
parent
commit
387bdfa533
  1. 26
      tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs

26
tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs

@ -341,6 +341,32 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
seed);
}
// Benchmark, for local execution only
// [Theory]
// [InlineData(false)]
// [InlineData(true)]
public void BenchmarkYCbCr(bool simd)
{
int count = 2053;
int times = 50000;
JpegColorConverter.ComponentValues values = CreateRandomValues(3, count, 1);
var result = new Vector4[count];
JpegColorConverter converter = simd ? (JpegColorConverter)new JpegColorConverter.FromYCbCrVector4(8) : new JpegColorConverter.FromYCbCrBasic(8);
// Warm up:
converter.ConvertToRgbInplace(values);
using (new MeasureGuard(this.Output, $"{converter.GetType().Name} x {times}"))
{
for (int i = 0; i < times; i++)
{
converter.ConvertToRgbInplace(values);
}
}
}
private static JpegColorConverter.ComponentValues CreateRandomValues(
int componentCount,
int inputBufferLength,

Loading…
Cancel
Save