31 #error "NROOTS not defined" 35 #error "NN not defined" 39 #error "PAD not defined" 42 #if !defined(ALPHA_TO) 43 #error "ALPHA_TO not defined" 46 #if !defined(INDEX_OF) 47 #error "INDEX_OF not defined" 51 #error "MODNN not defined" 55 #error "FCR not defined" 59 #error "PRIM not defined" 63 #define NULL ((void *)0) 67 #define MIN(a,b) ((a) < (b) ? (a) : (b)) 87 for (j = 1; j <
NN -
PAD; j++)
89 for (i = 0; i <
NROOTS; i++) {
101 for (i = 0; i <
NROOTS; i++)
115 memset(&lambda[1], 0, NROOTS *
sizeof(lambda[0]));
122 for (i = 1; i < no_eras; i++) {
124 for (j = i + 1; j > 0; j--) {
137 for (i = 1; i <= no_eras; i++) {
144 for (j = 1; j <= no_eras; j++)
146 reg[
j] =
MODNN(reg[j] + j);
157 if (count != no_eras) {
158 printf(
"count = %d no_eras = %d\n lambda(x) is WRONG\n", count, no_eras);
163 printf(
"\n Erasure positions as determined by roots of Eras Loc Poly:\n");
164 for (i = 0; i <
count; i++) {
165 printf(
"%d ", loc[i]);
171 for (i = 0; i < NROOTS + 1; i++)
182 while (++r <= NROOTS)
186 for (i = 0; i <
r; i++) {
187 if ((lambda[i] != 0) && (s[r - i - 1] !=
A0)) {
194 memmove(&b[1], b, NROOTS *
sizeof(b[0]));
200 for (i = 0 ; i <
NROOTS; i++) {
205 t[i + 1] = lambda[i + 1];
208 if (2 * el <= r + no_eras - 1) {
209 el = r + no_eras -
el;
214 for (i = 0; i <=
NROOTS; i++) {
220 memmove(&b[1], b, NROOTS *
sizeof(b[0]));
223 memcpy(lambda, t, (NROOTS + 1)*
sizeof(t[0]));
229 for (i = 0; i < NROOTS + 1; i++)
232 if (lambda[i] !=
A0) {
237 memcpy(®[1], &lambda[1], NROOTS *
sizeof(reg[0]));
242 for (j = deg_lambda; j > 0; j--) {
244 reg[
j] =
MODNN(reg[j] + j);
253 printf(
"count %d root %d loc %d\n", count, i, k);
260 if (++count == deg_lambda) {
264 if (deg_lambda != count)
277 deg_omega = deg_lambda - 1;
281 for (j = i; j >= 0; j--) {
282 if ((s[i - j] !=
A0) && (lambda[j] !=
A0)) {
293 for (j = count - 1; j >= 0; j--)
296 for (i = deg_omega; i >= 0; i--) {
297 if (omega[i] !=
A0) {
305 for (i =
MIN(deg_lambda, NROOTS - 1) & ~1; i >= 0; i -= 2) {
306 if (lambda[i + 1] !=
A0) {
312 printf(
"\n ERROR: denominator = 0\n");
318 if (num1 != 0 && loc[j] >= PAD) {
324 if (eras_pos !=
NULL)
327 eras_pos[
i] = loc[
i];
int r
Definition: decode_rs.h:71
data_t t[NROOTS+1]
Definition: decode_rs.h:77
int i
Definition: decode_rs.h:71
int j
Definition: decode_rs.h:71
data_t num2
Definition: decode_rs.h:74
int count
Definition: decode_rs.h:79
data_t q
Definition: decode_rs.h:74
data_t root[NROOTS]
Definition: decode_rs.h:78
memset(parity, 0, NROOTS *sizeof(data_t))
#define PAD
Definition: char.h:19
data_t lambda[NROOTS+1]
Definition: decode_rs.h:75
#define NULL
Definition: decode_rs.h:63
#define NN
Definition: ccsds.h:3
deg_lambda
Definition: decode_rs.h:228
unsigned char data_t
Definition: ccsds.h:1
#define FCR
Definition: char.h:16
#define INDEX_OF
Definition: char.h:13
data_t omega[NROOTS+1]
Definition: decode_rs.h:77
data_t discr_r
Definition: decode_rs.h:74
data_t reg[NROOTS+1]
Definition: decode_rs.h:78
data_t tmp
Definition: decode_rs.h:74
data_t b[NROOTS+1]
Definition: decode_rs.h:77
#define ALPHA_TO
Definition: char.h:12
#define NROOTS
Definition: ccsds.h:4
#define A0
Definition: decode_rs.h:69
#define MIN(a, b)
Definition: decode_rs.h:67
deg_omega
Definition: decode_rs.h:277
data_t loc[NROOTS]
Definition: decode_rs.h:78
#define MODNN(x)
Definition: char.h:8
data_t den
Definition: decode_rs.h:74
data_t num1
Definition: decode_rs.h:74
#define IPRIM
Definition: char.h:18
#define PRIM
Definition: char.h:17
data_t u
Definition: decode_rs.h:74
int k
Definition: decode_rs.h:71
data_t s[NROOTS]
Definition: decode_rs.h:75
int syn_error
Definition: decode_rs.h:79
el
Definition: decode_rs.h:181