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

Method _decode

src/Module/Decoder/BCH/Standard/Decoder_BCH_std.cpp:53–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 4

_decode_hihoMethod · 0.95
_decode_hiho_cwMethod · 0.95
_decode_sihoMethod · 0.95
_decode_siho_cwMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected