00001 #ifndef DCONVE 00002 #define DCONVE 00003 #include <math.h> 00004 #include <complex.h> 00005 #include <max_pn.h> 00006 namespace SPUC { 00007 // Copyright(c) 2004 Tony Kirke 00008 /* 00009 * SPUC - Signal processing using C++ - A DSP library 00010 * 00011 * This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2, or (at your option) 00014 * any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 */ 00029 // 00033 class data_conv_encoder 00034 { 00035 public: 00036 max_pn test_pn; 00037 const long g1; 00038 const long g2; 00039 bool conv_enc_phase; 00040 int conv_enc_get_bit; 00041 long conv_enc_u; 00042 long conv_bit_number; 00043 long rate_index; 00044 long enc_rate; 00045 long total_bits; 00046 long number_symbols; 00047 long frame; 00048 long serial; 00049 long sample; 00050 long data_index; 00051 bool raw_bit; // current input data bit 00052 bool* raw_data; 00053 long* pre_mod; 00054 00055 public: 00056 int raw_bits_this_frame; 00057 bool no_conv; 00058 00059 // Constructor (with default data rate) 00060 data_conv_encoder(int index, int T_fft) : 00061 g1(0x6d), g2(0x4f), 00062 test_pn(0x0013,32767,-1) 00063 { 00064 rate_index = index; 00065 raw_data = new bool[T_fft*16]; 00066 pre_mod = new long[T_fft]; 00067 reset(); 00068 } 00069 void reset() { // clear variables for next burst 00070 conv_enc_u = 0; 00071 conv_enc_phase = 1; 00072 conv_enc_get_bit = 1; 00073 conv_bit_number = 0; 00074 serial = 0; 00075 sample = 0; 00076 frame = 0; 00077 raw_bit=0; 00078 raw_bits_this_frame=0; 00079 test_pn.reset(); 00080 data_index = 0; 00081 } 00082 ~data_conv_encoder() { 00083 delete [] raw_data; 00084 delete [] pre_mod; 00085 } 00086 void set_rate(int mod, int conv_rate) { 00087 if (conv_rate == 0) no_conv = 1; 00088 else no_conv = 0; 00089 enc_rate = conv_rate; 00090 } 00091 bool conv_encoder(const long enc_rate); 00092 // bool get_data(void); 00093 void serial_to_word_input(bool in); 00094 long serial_to_word_output(void); 00095 bool get_data(void); 00096 }; 00097 } 00098 #endif 00099 00100