diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-01 17:10:16 -0500 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-01 17:10:16 -0500 |
commit | 731747140e5064a5157835e9f8c1251a69bb1e89 (patch) | |
tree | 07e4610932dcb18fb5312dea99eb6428a027346e /gr-fec/include | |
parent | 968ccc37450f6ef0f49eb8a4adc75b86c8d19ec3 (diff) |
fec: moving rs.h and viterbi.h to be installed in the public include directory.
Diffstat (limited to 'gr-fec/include')
-rw-r--r-- | gr-fec/include/fec/CMakeLists.txt | 2 | ||||
-rw-r--r-- | gr-fec/include/fec/rs.h | 30 | ||||
-rw-r--r-- | gr-fec/include/fec/viterbi.h | 53 |
3 files changed, 85 insertions, 0 deletions
diff --git a/gr-fec/include/fec/CMakeLists.txt b/gr-fec/include/fec/CMakeLists.txt index 5ef1ab01b5..2d49dbe301 100644 --- a/gr-fec/include/fec/CMakeLists.txt +++ b/gr-fec/include/fec/CMakeLists.txt @@ -78,6 +78,8 @@ install(FILES api.h decode_ccsds_27_fb.h encode_ccsds_27_bb.h + rs.h + viterbi.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fec COMPONENT "fec_devel" ) diff --git a/gr-fec/include/fec/rs.h b/gr-fec/include/fec/rs.h new file mode 100644 index 0000000000..27551f5407 --- /dev/null +++ b/gr-fec/include/fec/rs.h @@ -0,0 +1,30 @@ +#include <fec/api.h> +/* User include file for the Reed-Solomon codec + * Copyright 2002, Phil Karn KA9Q + * May be used under the terms of the GNU General Public License (GPL) + */ + +/* General purpose RS codec, 8-bit symbols */ +FEC_API void encode_rs_char(void *rs,unsigned char *data,unsigned char *parity); +FEC_API int decode_rs_char(void *rs,unsigned char *data,int *eras_pos, int no_eras); +FEC_API void *init_rs_char(unsigned int symsize,unsigned int gfpoly, + unsigned int fcr,unsigned int prim,unsigned int nroots); +FEC_API void free_rs_char(void *rs); + +/* General purpose RS codec, integer symbols */ +FEC_API void encode_rs_int(void *rs,int *data,int *parity); +FEC_API int decode_rs_int(void *rs,int *data,int *eras_pos,int no_eras); +FEC_API void *init_rs_int(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, + unsigned int prim,unsigned int nroots); +FEC_API void free_rs_int(void *rs); + +/* CCSDS standard (255,223) RS codec with conventional (*not* dual-basis) + * symbol representation + */ +FEC_API void encode_rs_8(unsigned char *data,unsigned char *parity); +FEC_API int decode_rs_8(unsigned char *data,int *eras_pos,int no_eras); + +/* Tables to map from conventional->dual (Taltab) and + * dual->conventional (Tal1tab) bases + */ +extern unsigned char Taltab[],Tal1tab[]; diff --git a/gr-fec/include/fec/viterbi.h b/gr-fec/include/fec/viterbi.h new file mode 100644 index 0000000000..97e09d4a8d --- /dev/null +++ b/gr-fec/include/fec/viterbi.h @@ -0,0 +1,53 @@ +/* + * Copyright 2008 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* The path memory for each state is 32 bits. This is slightly shorter + * than we'd like for K=7, especially since we chain back every 8 bits. + * But it fits so nicely into a 32-bit machine word... + */ + +#include <fec/api.h> + +struct viterbi_state { + unsigned long path; /* Decoded path to this state */ + long metric; /* Cumulative metric to this state */ +}; + +FEC_API +int gen_met(int mettab[2][256], /* Metric table */ + int amp, /* Signal amplitude */ + double esn0, /* Es/N0 ratio in dB */ + double bias, /* Metric bias */ + int scale); /* Scale factor */ + +FEC_API unsigned char +encode(unsigned char *symbols, unsigned char *data, + unsigned int nbytes,unsigned char encstate); + +FEC_API void +viterbi_chunks_init(struct viterbi_state* state); + + FEC_API void +viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], + struct viterbi_state *state0, struct viterbi_state *state1); + +FEC_API unsigned char +viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf); |