-
-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1374 from SixLabors/js/Block8x8F_TransposeAVX
Add Avx backed Block8x8F Transpose method
- Loading branch information
Showing
6 changed files
with
172 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_Transpose.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
using BenchmarkDotNet.Attributes; | ||
using SixLabors.ImageSharp.Formats.Jpeg.Components; | ||
|
||
namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations | ||
{ | ||
public class Block8x8F_Transpose | ||
{ | ||
private static readonly Block8x8F Source = Create8x8FloatData(); | ||
|
||
[Benchmark(Baseline=true)] | ||
public void TransposeIntoVector4() | ||
{ | ||
var dest = default(Block8x8F); | ||
Source.TransposeIntoFallback(ref dest); | ||
} | ||
|
||
#if SUPPORTS_RUNTIME_INTRINSICS | ||
[Benchmark] | ||
public void TransposeIntoAvx() | ||
{ | ||
var dest = default(Block8x8F); | ||
Source.TransposeIntoAvx(ref dest); | ||
} | ||
#endif | ||
|
||
private static Block8x8F Create8x8FloatData() | ||
{ | ||
var result = new float[64]; | ||
for (int i = 0; i < 8; i++) | ||
{ | ||
for (int j = 0; j < 8; j++) | ||
{ | ||
result[(i * 8) + j] = (i * 10) + j; | ||
} | ||
} | ||
|
||
var source = default(Block8x8F); | ||
source.LoadFrom(result); | ||
return source; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters