mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 22:35:44 +00:00
added update_syndromes() helper
This commit is contained in:
parent
8268ba3f85
commit
6b3bc5e534
2 changed files with 39 additions and 21 deletions
|
|
@ -20,21 +20,27 @@ public:
|
|||
typedef typename GF::ValueType ValueType;
|
||||
typedef typename GF::IndexType IndexType;
|
||||
static const int N = GF::N, K = MSG, NP = N - K;
|
||||
private:
|
||||
ReedSolomonErrorCorrection<NR, FCR, GF> algorithm;
|
||||
int compute_syndromes(uint8_t *code, ValueType *syndromes)
|
||||
void update_syndromes(uint8_t *poly, ValueType *syndromes, int begin, int end)
|
||||
{
|
||||
// $syndromes_i = code(pe^{FCR+i})$
|
||||
ValueType coeff(get_be_bit(code, 0));
|
||||
for (int i = 0; i < NR; ++i)
|
||||
syndromes[i] = coeff;
|
||||
for (int j = 1; j < N; ++j) {
|
||||
ValueType coeff(get_be_bit(code, j));
|
||||
for (int j = begin; j < end; ++j) {
|
||||
ValueType coeff(get_be_bit(poly, j));
|
||||
IndexType root(FCR), pe(1);
|
||||
for (int i = 0; i < NR; ++i) {
|
||||
syndromes[i] = fma(root, syndromes[i], coeff);
|
||||
root *= pe;
|
||||
}
|
||||
}
|
||||
}
|
||||
public:
|
||||
int compute_syndromes(uint8_t *code, ValueType *syndromes)
|
||||
{
|
||||
// $syndromes_i = code(pe^{FCR+i})$
|
||||
ValueType coeff(get_be_bit(code, 0));
|
||||
for (int i = 0; i < NR; ++i)
|
||||
syndromes[i] = coeff;
|
||||
update_syndromes(code, syndromes, 1, N);
|
||||
int nonzero = 0;
|
||||
for (int i = 0; i < NR; ++i)
|
||||
nonzero += !!syndromes[i];
|
||||
|
|
@ -79,21 +85,27 @@ public:
|
|||
typedef typename GF::ValueType ValueType;
|
||||
typedef typename GF::IndexType IndexType;
|
||||
static const int N = GF::N, K = MSG, NP = N - K;
|
||||
private:
|
||||
ReedSolomonErrorCorrection<NR, FCR, GF> algorithm;
|
||||
int compute_syndromes(ValueType *code, ValueType *syndromes)
|
||||
void update_syndromes(ValueType *poly, ValueType *syndromes, int begin, int end)
|
||||
{
|
||||
// $syndromes_i = code(pe^{FCR+i})$
|
||||
ValueType coeff(code[0]);
|
||||
for (int i = 0; i < NR; ++i)
|
||||
syndromes[i] = coeff;
|
||||
for (int j = 1; j < N; ++j) {
|
||||
ValueType coeff(code[j]);
|
||||
for (int j = begin; j < end; ++j) {
|
||||
ValueType coeff(poly[j]);
|
||||
IndexType root(FCR), pe(1);
|
||||
for (int i = 0; i < NR; ++i) {
|
||||
syndromes[i] = fma(root, syndromes[i], coeff);
|
||||
root *= pe;
|
||||
}
|
||||
}
|
||||
}
|
||||
public:
|
||||
int compute_syndromes(ValueType *code, ValueType *syndromes)
|
||||
{
|
||||
// $syndromes_i = code(pe^{FCR+i})$
|
||||
ValueType coeff(code[0]);
|
||||
for (int i = 0; i < NR; ++i)
|
||||
syndromes[i] = coeff;
|
||||
update_syndromes(code, syndromes, 1, N);
|
||||
int nonzero = 0;
|
||||
for (int i = 0; i < NR; ++i)
|
||||
nonzero += !!syndromes[i];
|
||||
|
|
|
|||
|
|
@ -19,21 +19,27 @@ public:
|
|||
typedef typename GF::ValueType ValueType;
|
||||
typedef typename GF::IndexType IndexType;
|
||||
static const int N = GF::N, K = N - NR, NP = NR;
|
||||
private:
|
||||
ReedSolomonErrorCorrection<NR, FCR, GF> algorithm;
|
||||
int compute_syndromes(ValueType *code, ValueType *syndromes)
|
||||
void update_syndromes(ValueType *poly, ValueType *syndromes, int begin, int end)
|
||||
{
|
||||
// $syndromes_i = code(pe^{FCR+i})$
|
||||
ValueType coeff(code[0]);
|
||||
for (int i = 0; i < NR; ++i)
|
||||
syndromes[i] = coeff;
|
||||
for (int j = 1; j < N; ++j) {
|
||||
ValueType coeff(code[j]);
|
||||
for (int j = begin; j < end; ++j) {
|
||||
ValueType coeff(poly[j]);
|
||||
IndexType root(FCR), pe(1);
|
||||
for (int i = 0; i < NR; ++i) {
|
||||
syndromes[i] = fma(root, syndromes[i], coeff);
|
||||
root *= pe;
|
||||
}
|
||||
}
|
||||
}
|
||||
public:
|
||||
int compute_syndromes(ValueType *code, ValueType *syndromes)
|
||||
{
|
||||
// $syndromes_i = code(pe^{FCR+i})$
|
||||
ValueType coeff(code[0]);
|
||||
for (int i = 0; i < NR; ++i)
|
||||
syndromes[i] = coeff;
|
||||
update_syndromes(code, syndromes, 1, N);
|
||||
int nonzero = 0;
|
||||
for (int i = 0; i < NR; ++i)
|
||||
nonzero += !!syndromes[i];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue