GNU Radio's SATELLITES Package
rs-common.h
Go to the documentation of this file.
1/* Stuff common to all the general-purpose Reed-Solomon codecs
2 * Copyright 2004 Phil Karn, KA9Q
3 * May be used under the terms of the GNU Lesser General Public License (LGPL)
4 */
5
6/* Reed-Solomon codec control block */
7struct rs {
8 int mm; /* Bits per symbol */
9 int nn; /* Symbols per block (= (1<<mm)-1) */
10 data_t* alpha_to; /* log lookup table */
11 data_t* index_of; /* Antilog lookup table */
12 data_t* genpoly; /* Generator polynomial */
13 int nroots; /* Number of generator roots = number of parity symbols */
14 int fcr; /* First consecutive root, index form */
15 int prim; /* Primitive element, index form */
16 int iprim; /* prim-th root of 1, index form */
17 int pad; /* Padding bytes in shortened block */
18};
19
20static inline int modnn(struct rs* rs, int x)
21{
22 while (x >= rs->nn) {
23 x -= rs->nn;
24 x = (x >> rs->mm) + (x & rs->nn);
25 }
26 return x;
27}
unsigned char data_t
Definition: ccsds.h:1
static int modnn(struct rs *rs, int x)
Definition: rs-common.h:20
Definition: rs-common.h:7
int nn
Definition: rs-common.h:9
int nroots
Definition: rs-common.h:13
int iprim
Definition: rs-common.h:16
data_t * genpoly
Definition: rs-common.h:12
data_t * index_of
Definition: rs-common.h:11
int fcr
Definition: rs-common.h:14
int mm
Definition: rs-common.h:8
int pad
Definition: rs-common.h:17
int prim
Definition: rs-common.h:15
data_t * alpha_to
Definition: rs-common.h:10