mirror of https://github.com/status-im/leopard.git
Bug fixes
This commit is contained in:
parent
cea6e3b718
commit
0aa1cdd4f3
|
@ -336,10 +336,10 @@ void VectorXOR(
|
||||||
while (count >= 4)
|
while (count >= 4)
|
||||||
{
|
{
|
||||||
xor_mem4(
|
xor_mem4(
|
||||||
y[0], x[0],
|
x[0], y[0],
|
||||||
y[1], x[1],
|
x[1], y[1],
|
||||||
y[2], x[2],
|
x[2], y[2],
|
||||||
y[3], x[3],
|
x[3], y[3],
|
||||||
bytes);
|
bytes);
|
||||||
x += 4, y += 4;
|
x += 4, y += 4;
|
||||||
count -= 4;
|
count -= 4;
|
||||||
|
|
|
@ -871,10 +871,11 @@ void ReedSolomonEncode(
|
||||||
|
|
||||||
// work <- IFFT(data, m, m)
|
// work <- IFFT(data, m, m)
|
||||||
|
|
||||||
|
const ffe_t* skewLUT = FFTSkew + m - 1;
|
||||||
|
|
||||||
for (unsigned width = 1; width < m; width <<= 1)
|
for (unsigned width = 1; width < m; width <<= 1)
|
||||||
{
|
{
|
||||||
const unsigned range = width << 1;
|
const unsigned range = width << 1;
|
||||||
const ffe_t* skewLUT = FFTSkew + m - 1;
|
|
||||||
|
|
||||||
#ifdef LEO_SCHEDULE_OPT
|
#ifdef LEO_SCHEDULE_OPT
|
||||||
for (unsigned j = width; j < first_end; j += range)
|
for (unsigned j = width; j < first_end; j += range)
|
||||||
|
@ -911,7 +912,9 @@ void ReedSolomonEncode(
|
||||||
|
|
||||||
for (unsigned width = 1; width < m; width <<= 1)
|
for (unsigned width = 1; width < m; width <<= 1)
|
||||||
{
|
{
|
||||||
for (unsigned j = width; j < m; j += (width << 1))
|
const unsigned range = width << 1;
|
||||||
|
|
||||||
|
for (unsigned j = width; j < m; j += range)
|
||||||
{
|
{
|
||||||
VectorIFFTButterfly(
|
VectorIFFTButterfly(
|
||||||
buffer_bytes,
|
buffer_bytes,
|
||||||
|
@ -949,11 +952,12 @@ void ReedSolomonEncode(
|
||||||
|
|
||||||
// temp <- IFFT(temp, m, m + i)
|
// temp <- IFFT(temp, m, m + i)
|
||||||
|
|
||||||
|
const ffe_t* skewLUT = FFTSkew + m + i - 1;
|
||||||
|
|
||||||
for (unsigned width = 1, shift = 1; width < m; width <<= 1, ++shift)
|
for (unsigned width = 1, shift = 1; width < m; width <<= 1, ++shift)
|
||||||
{
|
{
|
||||||
// Calculate stop considering that the right is all zeroes
|
// Calculate stop considering that the right is all zeroes
|
||||||
const unsigned range = width << 1;
|
const unsigned range = width << 1;
|
||||||
const ffe_t* skewLUT = FFTSkew + m + i - 1;
|
|
||||||
|
|
||||||
#ifdef LEO_SCHEDULE_OPT
|
#ifdef LEO_SCHEDULE_OPT
|
||||||
const unsigned stop = ((last_count + width - 1) >> shift) << shift;
|
const unsigned stop = ((last_count + width - 1) >> shift) << shift;
|
||||||
|
@ -1095,15 +1099,12 @@ void ReedSolomonDecode(
|
||||||
ErrorBitfield ErrorBits;
|
ErrorBitfield ErrorBits;
|
||||||
#endif // LEO_SCHEDULE_OPT
|
#endif // LEO_SCHEDULE_OPT
|
||||||
|
|
||||||
ffe_t ErrorLocations[kOrder];
|
ffe_t ErrorLocations[kOrder] = {};
|
||||||
for (unsigned i = 0; i < recovery_count; ++i)
|
for (unsigned i = 0; i < recovery_count; ++i)
|
||||||
ErrorLocations[i] = recovery[i] ? 0 : 1;
|
if (!recovery[i])
|
||||||
|
ErrorLocations[i] = 1;
|
||||||
for (unsigned i = recovery_count; i < m; ++i)
|
for (unsigned i = recovery_count; i < m; ++i)
|
||||||
ErrorLocations[i] = 1;
|
ErrorLocations[i] = 1;
|
||||||
|
|
||||||
// Clear the remainder in bulk
|
|
||||||
memset(ErrorLocations + m, 0, (n - m) * sizeof(ffe_t));
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < original_count; ++i)
|
for (unsigned i = 0; i < original_count; ++i)
|
||||||
{
|
{
|
||||||
if (!original[i])
|
if (!original[i])
|
||||||
|
@ -1156,6 +1157,7 @@ void ReedSolomonDecode(
|
||||||
|
|
||||||
const unsigned input_count = m + original_count;
|
const unsigned input_count = m + original_count;
|
||||||
unsigned mip_level = 0;
|
unsigned mip_level = 0;
|
||||||
|
|
||||||
for (unsigned width = 1; width < n; width <<= 1, ++mip_level)
|
for (unsigned width = 1; width < n; width <<= 1, ++mip_level)
|
||||||
{
|
{
|
||||||
const unsigned range = width << 1;
|
const unsigned range = width << 1;
|
||||||
|
|
|
@ -389,11 +389,11 @@ struct TestParameters
|
||||||
unsigned original_count = 1000; // under 65536
|
unsigned original_count = 1000; // under 65536
|
||||||
unsigned recovery_count = 100; // under 65536 - original_count
|
unsigned recovery_count = 100; // under 65536 - original_count
|
||||||
#else
|
#else
|
||||||
unsigned original_count = 128; // under 65536
|
unsigned original_count = 32; // under 65536
|
||||||
unsigned recovery_count = 128; // under 65536 - original_count
|
unsigned recovery_count = 16; // under 65536 - original_count
|
||||||
#endif
|
#endif
|
||||||
unsigned buffer_bytes = 64000; // multiple of 64 bytes
|
unsigned buffer_bytes = 64000; // multiple of 64 bytes
|
||||||
unsigned loss_count = 128; // some fraction of original_count
|
unsigned loss_count = 16; // some fraction of original_count
|
||||||
unsigned seed = 0;
|
unsigned seed = 0;
|
||||||
bool multithreaded = true;
|
bool multithreaded = true;
|
||||||
};
|
};
|
||||||
|
@ -792,6 +792,9 @@ int main(int argc, char **argv)
|
||||||
if (argc >= 6)
|
if (argc >= 6)
|
||||||
params.multithreaded = (atoi(argv[5]) != 0);
|
params.multithreaded = (atoi(argv[5]) != 0);
|
||||||
|
|
||||||
|
if (params.loss_count > params.recovery_count)
|
||||||
|
params.loss_count = params.recovery_count;
|
||||||
|
|
||||||
cout << "Parameters: [original count=" << params.original_count << "] [recovery count=" << params.recovery_count << "] [buffer bytes=" << params.buffer_bytes << "] [loss count=" << params.loss_count << "] [random seed=" << params.seed << "]" << endl;
|
cout << "Parameters: [original count=" << params.original_count << "] [recovery count=" << params.recovery_count << "] [buffer bytes=" << params.buffer_bytes << "] [loss count=" << params.loss_count << "] [random seed=" << params.seed << "]" << endl;
|
||||||
|
|
||||||
BasicTest(params);
|
BasicTest(params);
|
||||||
|
|
|
@ -600,8 +600,8 @@ int main(int argc, char **argv)
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef LEO_SHORT_FIELD
|
#ifdef LEO_SHORT_FIELD
|
||||||
const unsigned input_count = 128;
|
const unsigned input_count = 32;
|
||||||
const unsigned recovery_count = 128;
|
const unsigned recovery_count = 16;
|
||||||
#else // LEO_SHORT_FIELD
|
#else // LEO_SHORT_FIELD
|
||||||
const unsigned input_count = 10000;
|
const unsigned input_count = 10000;
|
||||||
const unsigned recovery_count = 2000;
|
const unsigned recovery_count = 2000;
|
||||||
|
|
Loading…
Reference in New Issue