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 00054 class Turbo_Codec { 00055 public: 00056 00058 Turbo_Codec(void) {} 00059 00061 virtual ~Turbo_Codec(void) {} 00062 00083 void set_parameters(ivec gen1, ivec gen2, int constraint_length, 00084 const ivec &interleaver_sequence, int in_iterations=8, 00085 std::string in_metric="LOGMAX", double in_logmax_scale_factor=1.0, 00086 bool in_adaptive_stop=false, LLR_calc_unit lcalc=LLR_calc_unit()); 00087 00094 void set_interleaver(const ivec &interleaver_sequence); 00095 00108 void set_metric(std::string in_metric="LOGMAX", double in_logmax_scale_factor=1.0, 00109 LLR_calc_unit lcalc=LLR_calc_unit()); 00110 00114 void set_iterations(int in_iterations=8); 00115 00122 void set_adaptive_stop(bool in_adaptive_stop=true); 00123 00130 void set_awgn_channel_parameters(double in_Ec, double in_N0); 00131 00154 void set_scaling_factor(double in_Lc); 00155 00175 void encode(const bvec &input, bvec &output); 00176 00188 virtual void decode(const vec &received_signal, bvec &decoded_bits, const bvec &true_bits="0"); 00189 00202 virtual void decode(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, 00203 const bvec &true_bits="0"); 00204 00221 void encode_block(const bvec &input, bvec &in1, bvec &in2, bmat &parity1, bmat &parity2); 00222 00252 virtual void decode_block(const vec &rec_syst1, const vec &rec_syst2, const mat &rec_parity1, const mat &rec_parity2, 00253 bmat &decoded_bits_i, int &nrof_used_iterations_i, const bvec &true_bits="0"); 00254 00256 int get_Ncoded() const { return Ncoded; } 00257 00259 int get_Nuncoded() const { return Nuncoded; } 00260 00261 private: 00262 00266 void decode_n3(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, 00267 const bvec &true_bits="0"); 00268 00269 //Scalars: 00270 int interleaver_size; 00271 int Ncoded, Nuncoded; 00272 int m_tail, n1, n2, n_tot, iterations; 00273 double Ec, N0, Lc, R, logmax_scale_factor; 00274 bool adaptive_stop; 00275 std::string metric; 00276 00277 //Vectors: 00278 bvec decoded_bits_previous_iteration; 00279 00280 //Classes: 00281 Rec_Syst_Conv_Code rscc1, rscc2; 00282 Sequence_Interleaver<bin> bit_interleaver; 00283 Sequence_Interleaver<double> float_interleaver; 00284 }; 00285 00290 ivec wcdma_turbo_interleaver_sequence(int interleaver_size); 00291 00292 } // namespace itpp 00293 00294 #endif // #ifndef TURBO_H
Generated on Thu Apr 24 13:39:00 2008 for IT++ by Doxygen 1.5.5