00001 00030 #ifndef TURBO_H 00031 #define TURBO_H 00032 00033 #include <itpp/comm/rec_syst_conv_code.h> 00034 #include <itpp/comm/interleave.h> 00035 #include <itpp/comm/llr.h> 00036 00037 00038 namespace itpp 00039 { 00040 00055 class Turbo_Codec 00056 { 00057 public: 00058 00060 Turbo_Codec(void) {} 00061 00063 virtual ~Turbo_Codec(void) {} 00064 00088 void set_parameters(ivec gen1, ivec gen2, int constraint_length, 00089 const ivec &interleaver_sequence, int in_iterations = 8, 00090 std::string in_metric = "LOGMAX", double in_logmax_scale_factor = 1.0, 00091 bool in_adaptive_stop = false, LLR_calc_unit lcalc = LLR_calc_unit()); 00092 00099 void set_interleaver(const ivec &interleaver_sequence); 00100 00113 void set_metric(std::string in_metric = "LOGMAX", double in_logmax_scale_factor = 1.0, 00114 LLR_calc_unit lcalc = LLR_calc_unit()); 00115 00119 void set_iterations(int in_iterations = 8); 00120 00127 void set_adaptive_stop(bool in_adaptive_stop = true); 00128 00135 void set_awgn_channel_parameters(double in_Ec, double in_N0); 00136 00159 void set_scaling_factor(double in_Lc); 00160 00180 void encode(const bvec &input, bvec &output); 00181 00193 virtual void decode(const vec &received_signal, bvec &decoded_bits, const bvec &true_bits = "0"); 00194 00207 virtual void decode(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, 00208 const bvec &true_bits = "0"); 00209 00226 void encode_block(const bvec &input, bvec &in1, bvec &in2, bmat &parity1, bmat &parity2); 00227 00257 virtual void decode_block(const vec &rec_syst1, const vec &rec_syst2, const mat &rec_parity1, const mat &rec_parity2, 00258 bmat &decoded_bits_i, int &nrof_used_iterations_i, const bvec &true_bits = "0"); 00259 00261 int get_Ncoded() const { return Ncoded; } 00262 00264 int get_Nuncoded() const { return Nuncoded; } 00265 00266 private: 00267 00271 void decode_n3(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, 00272 const bvec &true_bits = "0"); 00273 00274 //Scalars: 00275 int interleaver_size; 00276 int Ncoded, Nuncoded; 00277 int m_tail, n1, n2, n_tot, iterations; 00278 double Ec, N0, Lc, R, logmax_scale_factor; 00279 bool adaptive_stop; 00280 std::string metric; 00281 00282 //Vectors: 00283 bvec decoded_bits_previous_iteration; 00284 00285 //Classes: 00286 Rec_Syst_Conv_Code rscc1, rscc2; 00287 Sequence_Interleaver<bin> bit_interleaver; 00288 Sequence_Interleaver<double> float_interleaver; 00289 }; 00290 00295 ivec wcdma_turbo_interleaver_sequence(int interleaver_size); 00296 00297 } // namespace itpp 00298 00299 #endif // #ifndef TURBO_H
Generated on Tue Feb 2 09:33:31 2010 for IT++ by Doxygen 1.6.2