diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-09-16 13:03:47 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-09-16 13:03:47 +0200 |
commit | 7f79cf98df18905e0240e271fc8a1df83a2a4031 (patch) | |
tree | 8471e95de8a700294612756da670bba0f0595fb0 /contrib/fec/rs-common.h | |
parent | 2fc4dad6f1cd8c2f7798822d07b6918e639ee200 (diff) | |
download | ODR-AudioEnc-7f79cf98df18905e0240e271fc8a1df83a2a4031.tar.gz ODR-AudioEnc-7f79cf98df18905e0240e271fc8a1df83a2a4031.tar.bz2 ODR-AudioEnc-7f79cf98df18905e0240e271fc8a1df83a2a4031.zip |
Remove libfec dependency
Diffstat (limited to 'contrib/fec/rs-common.h')
-rw-r--r-- | contrib/fec/rs-common.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/fec/rs-common.h b/contrib/fec/rs-common.h new file mode 100644 index 0000000..e64eb39 --- /dev/null +++ b/contrib/fec/rs-common.h @@ -0,0 +1,26 @@ +/* Stuff common to all the general-purpose Reed-Solomon codecs + * Copyright 2004 Phil Karn, KA9Q + * May be used under the terms of the GNU Lesser General Public License (LGPL) + */ + +/* Reed-Solomon codec control block */ +struct rs { + int mm; /* Bits per symbol */ + int nn; /* Symbols per block (= (1<<mm)-1) */ + data_t *alpha_to; /* log lookup table */ + data_t *index_of; /* Antilog lookup table */ + data_t *genpoly; /* Generator polynomial */ + int nroots; /* Number of generator roots = number of parity symbols */ + int fcr; /* First consecutive root, index form */ + int prim; /* Primitive element, index form */ + int iprim; /* prim-th root of 1, index form */ + int pad; /* Padding bytes in shortened block */ +}; + +static inline int modnn(struct rs *rs,int x){ + while (x >= rs->nn) { + x -= rs->nn; + x = (x >> rs->mm) + (x & rs->nn); + } + return x; +} |