GNU Radio 3.4.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 struct viterbi_state {
00027   unsigned long path;   /* Decoded path to this state */
00028   long metric;          /* Cumulative metric to this state */
00029 };
00030 
00031 int gen_met(int mettab[2][256], /* Metric table */
00032             int amp,            /* Signal amplitude */
00033             double esn0,        /* Es/N0 ratio in dB */
00034             double bias,        /* Metric bias */
00035             int scale);         /* Scale factor */
00036 
00037 unsigned char
00038 encode(unsigned char *symbols, unsigned char *data,
00039        unsigned int nbytes,unsigned char encstate);
00040 
00041 void 
00042 viterbi_chunks_init(struct viterbi_state* state);
00043 
00044 void 
00045 viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], 
00046                    struct viterbi_state *state0, struct viterbi_state *state1);
00047 
00048 unsigned char
00049 viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf);