This commit is contained in:
Christopher Taylor 2017-05-30 01:49:48 -07:00
parent 2e1007c4aa
commit d0a3aa287d
3 changed files with 11 additions and 10 deletions

View File

@ -159,7 +159,7 @@
#define LEO_SCHEDULE_OPT #define LEO_SCHEDULE_OPT
// Avoid calculating final FFT values in decoder using bitfield // Avoid calculating final FFT values in decoder using bitfield
//#define LEO_ERROR_BITFIELD_OPT #define LEO_ERROR_BITFIELD_OPT
// Optimize M=1 case // Optimize M=1 case
#define LEO_M1_OPT #define LEO_M1_OPT

View File

@ -1213,11 +1213,11 @@ class ErrorBitfield
static const unsigned kWords = kOrder / 64; static const unsigned kWords = kOrder / 64;
uint64_t Words[kWordMips][kWords] = {}; uint64_t Words[kWordMips][kWords] = {};
static const unsigned kBigMips = 5; static const unsigned kBigMips = 6;
static const unsigned kBigWords = (kWords + 63) / 64; static const unsigned kBigWords = (kWords + 63) / 64;
uint64_t BigWords[kBigMips][kBigWords] = {}; uint64_t BigWords[kBigMips][kBigWords] = {};
static const unsigned kBiggestMips = 5; static const unsigned kBiggestMips = 4;
uint64_t BiggestWords[kBiggestMips] = {}; uint64_t BiggestWords[kBiggestMips] = {};
public: public:
@ -1232,10 +1232,10 @@ public:
{ {
if (mip_level >= 16) if (mip_level >= 16)
return true; return true;
if (mip_level >= 11) if (mip_level >= 12)
{ {
bit /= 4096; bit /= 4096;
return 0 != (BiggestWords[mip_level - 11] & ((uint64_t)1 << bit)); return 0 != (BiggestWords[mip_level - 12] & ((uint64_t)1 << bit));
} }
if (mip_level >= 6) if (mip_level >= 6)
{ {
@ -1276,7 +1276,7 @@ void ErrorBitfield::Prepare()
{ {
uint64_t w_i = 0; uint64_t w_i = 0;
uint64_t bit = 1; uint64_t bit = 1;
const uint64_t* src = &Words[4][i * 64]; const uint64_t* src = &Words[kWordMips - 1][i * 64];
for (unsigned j = 0; j < 64; ++j, bit <<= 1) for (unsigned j = 0; j < 64; ++j, bit <<= 1)
{ {
const uint64_t w = src[j]; const uint64_t w = src[j];
@ -1294,9 +1294,10 @@ void ErrorBitfield::Prepare()
uint64_t w_i = 0; uint64_t w_i = 0;
uint64_t bit = 1; uint64_t bit = 1;
const uint64_t* src = &BigWords[kBigMips - 1][0];
for (unsigned j = 0; j < kBigWords; ++j, bit <<= 1) for (unsigned j = 0; j < kBigWords; ++j, bit <<= 1)
{ {
const uint64_t w = BigWords[kBigMips - 1][j]; const uint64_t w = src[j];
w_i |= (w | (w >> 32) | (w << 32)) & bit; w_i |= (w | (w >> 32) | (w << 32)) & bit;
} }
BiggestWords[0] = w_i; BiggestWords[0] = w_i;

View File

@ -48,7 +48,7 @@ struct TestParameters
unsigned original_count = 128; // under 65536 unsigned original_count = 128; // under 65536
unsigned recovery_count = 128; // under 65536 - original_count unsigned recovery_count = 128; // under 65536 - original_count
#endif #endif
unsigned buffer_bytes = 640; // multiple of 64 bytes unsigned buffer_bytes = 2560; // multiple of 64 bytes
unsigned loss_count = 2; // some fraction of original_count unsigned loss_count = 2; // some fraction of original_count
unsigned seed = 2; unsigned seed = 2;
bool multithreaded = true; bool multithreaded = true;
@ -399,7 +399,7 @@ static LEO_FORCE_INLINE void SIMDSafeFree(void* ptr)
static bool BasicTest(const TestParameters& params) static bool BasicTest(const TestParameters& params)
{ {
static const unsigned kTrials = 10; const unsigned kTrials = params.original_count > 8000 ? 1 : 10;
std::vector<uint8_t*> original_data(params.original_count); std::vector<uint8_t*> original_data(params.original_count);
@ -807,7 +807,7 @@ int main(int argc, char **argv)
if (!BasicTest(params)) if (!BasicTest(params))
goto Failed; goto Failed;
prng.Seed(params.seed, 7); prng.Seed(params.seed, 8);
for (;; ++params.seed) for (;; ++params.seed)
{ {
params.original_count = prng.Next() % 32768; params.original_count = prng.Next() % 32768;