mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 03:47:07 -05:00
109 lines
3.1 KiB
C++
109 lines
3.1 KiB
C++
#include "Tables.hpp"
|
|
|
|
const int32 g_table[8][4] = {
|
|
{ 2, 8, -2, -8 },
|
|
{ 5, 17, -5, -17 },
|
|
{ 9, 29, -9, -29 },
|
|
{ 13, 42, -13, -42 },
|
|
{ 18, 60, -18, -60 },
|
|
{ 24, 80, -24, -80 },
|
|
{ 33, 106, -33, -106 },
|
|
{ 47, 183, -47, -183 }
|
|
};
|
|
|
|
const int64 g_table256[8][4] = {
|
|
{ 2*256, 8*256, -2*256, -8*256 },
|
|
{ 5*256, 17*256, -5*256, -17*256 },
|
|
{ 9*256, 29*256, -9*256, -29*256 },
|
|
{ 13*256, 42*256, -13*256, -42*256 },
|
|
{ 18*256, 60*256, -18*256, -60*256 },
|
|
{ 24*256, 80*256, -24*256, -80*256 },
|
|
{ 33*256, 106*256, -33*256, -106*256 },
|
|
{ 47*256, 183*256, -47*256, -183*256 }
|
|
};
|
|
|
|
const uint32 g_id[4][16] = {
|
|
{ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
{ 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2 },
|
|
{ 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4 },
|
|
{ 7, 7, 6, 6, 7, 7, 6, 6, 7, 7, 6, 6, 7, 7, 6, 6 }
|
|
};
|
|
|
|
const uint32 g_avg2[16] = {
|
|
0x00,
|
|
0x11,
|
|
0x22,
|
|
0x33,
|
|
0x44,
|
|
0x55,
|
|
0x66,
|
|
0x77,
|
|
0x88,
|
|
0x99,
|
|
0xAA,
|
|
0xBB,
|
|
0xCC,
|
|
0xDD,
|
|
0xEE,
|
|
0xFF
|
|
};
|
|
|
|
const uint32 g_flags[64] = {
|
|
0x80800402, 0x80800402, 0x80800402, 0x80800402,
|
|
0x80800402, 0x80800402, 0x80800402, 0x8080E002,
|
|
0x80800402, 0x80800402, 0x8080E002, 0x8080E002,
|
|
0x80800402, 0x8080E002, 0x8080E002, 0x8080E002,
|
|
0x80000402, 0x80000402, 0x80000402, 0x80000402,
|
|
0x80000402, 0x80000402, 0x80000402, 0x8000E002,
|
|
0x80000402, 0x80000402, 0x8000E002, 0x8000E002,
|
|
0x80000402, 0x8000E002, 0x8000E002, 0x8000E002,
|
|
0x00800402, 0x00800402, 0x00800402, 0x00800402,
|
|
0x00800402, 0x00800402, 0x00800402, 0x0080E002,
|
|
0x00800402, 0x00800402, 0x0080E002, 0x0080E002,
|
|
0x00800402, 0x0080E002, 0x0080E002, 0x0080E002,
|
|
0x00000402, 0x00000402, 0x00000402, 0x00000402,
|
|
0x00000402, 0x00000402, 0x00000402, 0x0000E002,
|
|
0x00000402, 0x00000402, 0x0000E002, 0x0000E002,
|
|
0x00000402, 0x0000E002, 0x0000E002, 0x0000E002
|
|
};
|
|
|
|
#ifdef __SSE4_1__
|
|
const uint8 g_flags_AVX2[64] =
|
|
{
|
|
0x63, 0x63, 0x63, 0x63,
|
|
0x63, 0x63, 0x63, 0x7D,
|
|
0x63, 0x63, 0x7D, 0x7D,
|
|
0x63, 0x7D, 0x7D, 0x7D,
|
|
0x43, 0x43, 0x43, 0x43,
|
|
0x43, 0x43, 0x43, 0x5D,
|
|
0x43, 0x43, 0x5D, 0x5D,
|
|
0x43, 0x5D, 0x5D, 0x5D,
|
|
0x23, 0x23, 0x23, 0x23,
|
|
0x23, 0x23, 0x23, 0x3D,
|
|
0x23, 0x23, 0x3D, 0x3D,
|
|
0x23, 0x3D, 0x3D, 0x3D,
|
|
0x03, 0x03, 0x03, 0x03,
|
|
0x03, 0x03, 0x03, 0x1D,
|
|
0x03, 0x03, 0x1D, 0x1D,
|
|
0x03, 0x1D, 0x1D, 0x1D,
|
|
};
|
|
|
|
const __m128i g_table_SIMD[2] =
|
|
{
|
|
_mm_setr_epi16( 2, 5, 9, 13, 18, 24, 33, 47),
|
|
_mm_setr_epi16( 8, 17, 29, 42, 60, 80, 106, 183)
|
|
};
|
|
const __m128i g_table128_SIMD[2] =
|
|
{
|
|
_mm_setr_epi16( 2*128, 5*128, 9*128, 13*128, 18*128, 24*128, 33*128, 47*128),
|
|
_mm_setr_epi16( 8*128, 17*128, 29*128, 42*128, 60*128, 80*128, 106*128, 183*128)
|
|
};
|
|
const __m128i g_table256_SIMD[4] =
|
|
{
|
|
_mm_setr_epi32( 2*256, 5*256, 9*256, 13*256),
|
|
_mm_setr_epi32( 8*256, 17*256, 29*256, 42*256),
|
|
_mm_setr_epi32( 18*256, 24*256, 33*256, 47*256),
|
|
_mm_setr_epi32( 60*256, 80*256, 106*256, 183*256)
|
|
};
|
|
#endif
|
|
|