GNU Radio 3.6.5 C++ API
|
00001 /* Include file to configure the RS codec for integer symbols 00002 * 00003 * Copyright 2002, Phil Karn, KA9Q 00004 * May be used under the terms of the GNU General Public License (GPL) 00005 */ 00006 #define DTYPE int 00007 00008 #include <gr_core_api.h> 00009 00010 /* Reed-Solomon codec control block */ 00011 struct GR_CORE_API rs { 00012 unsigned int mm; /* Bits per symbol */ 00013 unsigned int nn; /* Symbols per block (= (1<<mm)-1) */ 00014 int *alpha_to; /* log lookup table */ 00015 int *index_of; /* Antilog lookup table */ 00016 int *genpoly; /* Generator polynomial */ 00017 unsigned int nroots; /* Number of generator roots = number of parity symbols */ 00018 unsigned int fcr; /* First consecutive root, index form */ 00019 unsigned int prim; /* Primitive element, index form */ 00020 unsigned int iprim; /* prim-th root of 1, index form */ 00021 }; 00022 00023 static inline int modnn(struct rs *rs,int x){ 00024 while (x >= rs->nn) { 00025 x -= rs->nn; 00026 x = (x >> rs->mm) + (x & rs->nn); 00027 } 00028 return x; 00029 } 00030 #define MODNN(x) modnn(rs,x) 00031 00032 #define MM (rs->mm) 00033 #define NN (rs->nn) 00034 #define ALPHA_TO (rs->alpha_to) 00035 #define INDEX_OF (rs->index_of) 00036 #define GENPOLY (rs->genpoly) 00037 #define NROOTS (rs->nroots) 00038 #define FCR (rs->fcr) 00039 #define PRIM (rs->prim) 00040 #define IPRIM (rs->iprim) 00041 #define A0 (NN) 00042 00043 #define ENCODE_RS encode_rs_int 00044 #define DECODE_RS decode_rs_int 00045 #define INIT_RS init_rs_int 00046 #define FREE_RS free_rs_int 00047 00048 GR_CORE_API void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity); 00049 GR_CORE_API int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras); 00050 void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, 00051 unsigned int prim,unsigned int nroots); 00052 GR_CORE_API void FREE_RS(void *p); 00053 00054 00055