GNU Radio 3.7.0 C++ API
viterbi.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2008 Free Software Foundation, Inc.
00003  *
00004  * This file is part of GNU Radio
00005  *
00006  * GNU Radio is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3, or (at your option)
00009  * any later version.
00010  *
00011  * GNU Radio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with GNU Radio; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 /* The path memory for each state is 32 bits. This is slightly shorter
00023  * than we'd like for K=7, especially since we chain back every 8 bits.
00024  * But it fits so nicely into a 32-bit machine word...
00025  */
00026 
00027 #include <gnuradio/fec/api.h>
00028 
00029 struct viterbi_state {
00030   unsigned long path;   /* Decoded path to this state */
00031   long metric;          /* Cumulative metric to this state */
00032 };
00033 
00034 FEC_API
00035 int gen_met(int mettab[2][256], /* Metric table */
00036             int amp,            /* Signal amplitude */
00037             double esn0,        /* Es/N0 ratio in dB */
00038             double bias,        /* Metric bias */
00039             int scale);         /* Scale factor */
00040 
00041 FEC_API unsigned char
00042 encode(unsigned char *symbols, unsigned char *data,
00043        unsigned int nbytes,unsigned char encstate);
00044 
00045 FEC_API void
00046 viterbi_chunks_init(struct viterbi_state* state);
00047 
00048  FEC_API void
00049 viterbi_butterfly2(unsigned char *symbols, int mettab[2][256],
00050                    struct viterbi_state *state0, struct viterbi_state *state1);
00051 
00052 FEC_API unsigned char
00053 viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf);