Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

qam_conv_decoder.h

Go to the documentation of this file.
00001 /*
00002  * SPUC - Signal processing using C++ - A DSP library
00003  * 
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2, or (at your option)
00007  * any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 #ifndef QAMCONVD
00019 #define QAMCONVD
00020 #include <math.h>
00021 #include <complex.h>
00022 #include <viterbi.h>
00023 #include <delay.h>
00024 #include <fir.h>
00025 namespace SPUC {
00028 // uses qam_data_deamp for soft decisions then inputs these into 
00029 // viterbi decoding using puncturing if necessary
00030 // if output of data_decode is true, use get_bit for data bit output
00033 class qam_conv_decoder {
00034  public:
00035         viterbi viterbi_decoder;
00036         long* viterbi_input;
00037         
00038         const long soft_decision_level;
00039         const long Max_bits_per_symbol;
00040         long enc_rate;
00041         long rate_index;
00042         long soft_bit_counter;
00043         long rx_bits_per_symbol;
00044         long raw_bits_this_frame;
00045         long coded_bits_per_frame;
00046         long raw_bits_out;
00047         long sample;
00048         long serial;
00049         
00050         bool frame_ready;
00051         bool viterbi_ready;
00052         bool viterbi_data;
00053         bool output_buffer_empty;
00054         bool no_conv; // Bypass Viterbi when true
00055         
00056  public:
00057         qam_conv_decoder(int index) :   soft_decision_level(64),
00058                 Max_bits_per_symbol(8) {
00059                 no_conv=0;
00060                 rate_index = index;
00061                 reset();
00062                 set_rate(0,1);
00063                 viterbi_input = new long[Max_bits_per_symbol];
00064         }
00065         ~qam_conv_decoder() {   
00066                 delete [] viterbi_input;
00067         }
00068         void reset() {
00069                 sample = 0; //16;
00070                 raw_bits_this_frame=0;
00071                 coded_bits_per_frame=0;
00072                 soft_bit_counter=0;
00073                 raw_bits_out = 0;
00074                 output_buffer_empty = 1;
00075                 viterbi_ready = 0;
00076                 viterbi_data = 0;
00077                 viterbi_decoder.reset();
00078                 frame_ready = 0;
00079         }
00081         void set_rate(int mod, int conv_rate) {
00082                 if (conv_rate == 0) no_conv = 1;
00083                 else no_conv = 0;
00084                 enc_rate = conv_rate;
00085                 if (mod>0) rx_bits_per_symbol = 2*mod;
00086                 else rx_bits_per_symbol = 1;
00087                 rate_index = mod;
00088         }
00090         bool data_decode(complex<long> data_in);
00092         bool get_bit(void) { return(viterbi_data); };
00094         long* clear_soft_decision(long rate);
00095 };
00096 } // namespace SPUC 
00097 #endif

Generated on Fri Sep 16 11:02:20 2005 for spuc by  doxygen 1.4.4