MCPcopy Create free account
hub / github.com/aff3ct/aff3ct / _decode

Method _decode

src/Module/Decoder/RS/Standard/Decoder_RS_std.cpp:40–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38
39template<typename B, typename R>
40int
41Decoder_RS_std<B, R>::_decode(S* Y_N, const size_t /*frame_id*/)
42{
43 bool syn_error = false;
44
45 // first form the syndromes
46 for (auto i = 1; i <= t2; i++)
47 {
48 s[i] = 0;
49 for (auto j = 0; j < this->N_rs; j++)
50 {
51 auto y_idx = this->index_of[Y_N[j]];
52 if (y_idx != -1) s[i] ^= this->alpha_to[(y_idx + i * j) % this->N_p2_1];
53 }
54
55 syn_error |= s[i] != 0; // set error flag if non-zero syndrome
56
57 s[i] = this->index_of[s[i]]; // convert syndrome from polynomial form to index form
58 }
59
60 this->last_is_codeword = !syn_error;
61
62 if (syn_error) // if there are errors, try to correct them
63 {
64 /*
65 * Compute the error location polynomial via the Berlekamp
66 * iterative algorithm. Following the terminology of Lin and
67 * Costello's book : discrepancy[u] is the 'mu'th discrepancy, where
68 * u='mu'+1 and 'mu' (the Greek letter!) is the step number
69 * ranging from -1 to 2*t (see L&C), l[u] is the degree of
70 * the elp at that step, and u_l[u] is the difference between
71 * the step number and the degree of the elp.
72 */
73 // initialise table entries
74 discrepancy[0] = 0; // index form
75 discrepancy[1] = s[1]; // index form
76 elp[0][0] = 0; // index form
77 elp[1][0] = 1; // polynomial form
78 for (auto i = 1; i < t2; i++)
79 {
80 elp[0][i] = -1; // index form
81 elp[1][i] = 0; // polynomial form
82 }
83 l[0] = 0;
84 l[1] = 0;
85 u_lu[0] = -1;
86 u_lu[1] = 0;
87
88 int q, u = 0;
89 do
90 {
91 u++;
92 if (discrepancy[u] == -1)
93 {
94 l[u + 1] = l[u];
95 for (auto i = 0; i <= l[u]; i++)
96 {
97 elp[u + 1][i] = elp[u][i];

Callers 4

_decode_hihoMethod · 0.45
_decode_hiho_cwMethod · 0.45
_decode_sihoMethod · 0.45
_decode_siho_cwMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected