Browse Source

Removed debug ssse3 zig-zag shuffle table

pull/1761/head
Dmitry Pentin 4 years ago
parent
commit
8cd4c9724c
  1. 66
      src/ImageSharp/Formats/Jpeg/Components/ZigZag.Intrinsic.cs

66
src/ImageSharp/Formats/Jpeg/Components/ZigZag.Intrinsic.cs

@ -21,107 +21,43 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
/// Gets shuffle vectors for <see cref="ApplyZigZagOrderingSse"/>
/// zig zag implementation.
/// </summary>
private static ReadOnlySpan<byte> SseShuffleMasks1 => new byte[]
{
// row0
0, 1, 2, 3, _, _, _, _, _, _, 4, 5, 6, 7, _, _,
_, _, _, _, 0, 1, _, _, 2, 3, _, _, _, _, 4, 5,
_, _, _, _, _, _, 0, 1, _, _, _, _, _, _, _, _,
// row1
_, _, _, _, _, _, _, _, _, _, _, _, 8, 9, 10, 11,
2, 3, _, _, _, _, _, _, 4, 5, _, _, _, _, _, _,
_, _, 0, 1, _, _, 2, 3, _, _, _, _, _, _, _, _,
// row2
_, _, _, _, _, _, 2, 3, _, _, _, _, _, _, 4, 5,
_, _, _, _, _, _, _, _, 0, 1, _, _, 2, 3, _, _,
// row3
_, _, _, _, _, _, 12, 13, 14, 15, _, _, _, _, _, _,
_, _, _, _, 10, 11, _, _, _, _, 12, 13, _, _, _, _,
_, _, 8, 9, _, _, _, _, _, _, _, _, 10, 11, _, _,
6, 7, _, _, _, _, _, _, _, _, _, _, _, _, 8, 9,
// row4
_, _, 4, 5, _, _, _, _, _, _, _, _, 6, 7, _, _,
_, _, _, _, 2, 3, _, _, _, _, 4, 5, _, _, _, _,
_, _, _, _, _, _, 0, 1, 2, 3, _, _, _, _, _, _,
// row5
_, _, 12, 13, _, _, 14, 15, _, _, _, _, _, _, _, _,
10, 11, _, _, _, _, _, _, 12, 13, _, _, _, _, _, _,
// row6
_, _, _, _, _, _, _, _, 12, 13, _, _, 14, 15, _, _,
_, _, _, _, _, _, 10, 11, _, _, _, _, _, _, 12, 13,
4, 5, 6, 7, _, _, _, _, _, _, _, _, _, _, _, _,
// row7
10, 11, _, _, _, _, 12, 13, _, _, 14, 15, _, _, _, _,
_, _, 8, 9, 10, 11, _, _, _, _, _, _, 12, 13, 14, 15
};
private static ReadOnlySpan<byte> SseShuffleMasks => new byte[]
{
// row0
// A B C
0, 1, 2, 3, _, _, _, _, _, _, 4, 5, 6, 7, _, _,
_, _, _, _, 0, 1, _, _, 2, 3, _, _, _, _, 4, 5,
_, _, _, _, _, _, 0, 1, _, _, _, _, _, _, _, _,
// row1
// A B C D E
_, _, _, _, _, _, _, _, _, _, _, _, 8, 9, 10, 11,
_, _, _, _, _, _, _, _, _, _, 6, 7, _, _, _, _,
2, 3, _, _, _, _, _, _, 4, 5, _, _, _, _, _, _,
_, _, 0, 1, _, _, 2, 3, _, _, _, _, _, _, _, _,
_, _, _, _, 0, 1, _, _, _, _, _, _, _, _, _, _,
// row2
// B C D E F G
8, 9, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
_, _, 6, 7, _, _, _, _, _, _, _, _, _, _, _, _,
_, _, _, _, 4, 5, _, _, _, _, _, _, _, _, _, _,
_, _, _, _, _, _, 2, 3, _, _, _, _, _, _, 4, 5,
_, _, _, _, _, _, _, _, 0, 1, _, _, 2, 3, _, _,
_, _, _, _, _, _, _, _, _, _, 0, 1, _, _, _, _,
// row3
// A B C D
// D shuffle mask is the for row4 E row shuffle mask
_, _, _, _, _, _, 12, 13, 14, 15, _, _, _, _, _, _,
_, _, _, _, 10, 11, _, _, _, _, 12, 13, _, _, _, _,
_, _, 8, 9, _, _, _, _, _, _, _, _, 10, 11, _, _,
6, 7, _, _, _, _, _, _, _, _, _, _, _, _, 8, 9,
// row4
// E F G H
6, 7, _, _, _, _, _, _, _, _, _, _, _, _, 8, 9,
_, _, 4, 5, _, _, _, _, _, _, _, _, 6, 7, _, _,
_, _, _, _, 2, 3, _, _, _, _, 4, 5, _, _, _, _,
_, _, _, _, _, _, 0, 1, 2, 3, _, _, _, _, _, _,
// row5
// B C D E F G
_, _, _, _, 14, 15, _, _, _, _, _, _, _, _, _, _,
_, _, 12, 13, _, _, 14, 15, _, _, _, _, _, _, _, _,
10, 11, _, _, _, _, _, _, 12, 13, _, _, _, _, _, _,
_, _, _, _, _, _, _, _, _, _, 10, 11, _, _, _, _,
_, _, _, _, _, _, _, _, _, _, _, _, 8, 9, _, _,
_, _, _, _, _, _, _, _, _, _, _, _, _, _, 6, 7,
// row6
// D E F G H
_, _, _, _, _, _, _, _, _, _, 14, 15, _, _, _, _,
_, _, _, _, _, _, _, _, 12, 13, _, _, 14, 15, _, _,
_, _, _, _, _, _, 10, 11, _, _, _, _, _, _, 12, 13,
_, _, _, _, 8, 9, _, _, _, _, _, _, _, _, _, _,
4, 5, 6, 7, _, _, _, _, _, _, _, _, _, _, _, _,
// row7
// F G H
_, _, _, _, _, _, _, _, 14, 15, _, _, _, _, _, _,
10, 11, _, _, _, _, 12, 13, _, _, 14, 15, _, _, _, _,
_, _, 8, 9, 10, 11, _, _, _, _, _, _, 12, 13, 14, 15
};
@ -199,7 +135,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
{
DebugGuard.IsTrue(Ssse3.IsSupported, "Ssse3 support is required to run this operation!");
fixed (byte* maskPtr = SseShuffleMasks1)
fixed (byte* maskPtr = SseShuffleMasks)
{
Vector128<byte> rowA = block.V0.AsByte();
Vector128<byte> rowB = block.V1.AsByte();

Loading…
Cancel
Save