IT++ Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
turbo.h
Go to the documentation of this file.
1 
29 #ifndef TURBO_H
30 #define TURBO_H
31 
33 #include <itpp/comm/interleave.h>
34 #include <itpp/comm/llr.h>
35 
36 
37 namespace itpp
38 {
39 
55 {
56 public:
57 
59  Turbo_Codec(void) {}
60 
62  virtual ~Turbo_Codec(void) {}
63 
87  void set_parameters(ivec gen1, ivec gen2, int constraint_length,
88  const ivec &interleaver_sequence, int in_iterations = 8,
89  std::string in_metric = "LOGMAX", double in_logmax_scale_factor = 1.0,
90  bool in_adaptive_stop = false, LLR_calc_unit lcalc = LLR_calc_unit());
91 
98  void set_interleaver(const ivec &interleaver_sequence);
99 
112  void set_metric(std::string in_metric = "LOGMAX", double in_logmax_scale_factor = 1.0,
113  LLR_calc_unit lcalc = LLR_calc_unit());
114 
118  void set_iterations(int in_iterations = 8);
119 
126  void set_adaptive_stop(bool in_adaptive_stop = true);
127 
134  void set_awgn_channel_parameters(double in_Ec, double in_N0);
135 
158  void set_scaling_factor(double in_Lc);
159 
179  void encode(const bvec &input, bvec &output);
180 
192  virtual void decode(const vec &received_signal, bvec &decoded_bits, const bvec &true_bits = "0");
193 
206  virtual void decode(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations,
207  const bvec &true_bits = "0");
208 
225  void encode_block(const bvec &input, bvec &in1, bvec &in2, bmat &parity1, bmat &parity2);
226 
256  virtual void decode_block(const vec &rec_syst1, const vec &rec_syst2, const mat &rec_parity1, const mat &rec_parity2,
257  bmat &decoded_bits_i, int &nrof_used_iterations_i, const bvec &true_bits = "0");
258 
260  int get_Ncoded() const { return Ncoded; }
261 
263  int get_Nuncoded() const { return Nuncoded; }
264 
265 private:
266 
270  void decode_n3(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations,
271  const bvec &true_bits = "0");
272 
273  //Scalars:
274  int interleaver_size;
275  int Ncoded, Nuncoded;
276  int m_tail, n1, n2, n_tot, iterations;
277  double Ec, N0, Lc, R, logmax_scale_factor;
278  bool adaptive_stop;
279  std::string metric;
280 
281  //Vectors:
282  bvec decoded_bits_previous_iteration;
283 
284  //Classes:
285  Rec_Syst_Conv_Code rscc1, rscc2;
286  Sequence_Interleaver<bin> bit_interleaver;
287  Sequence_Interleaver<double> float_interleaver;
288 };
289 
294 ivec wcdma_turbo_interleaver_sequence(int interleaver_size);
295 
296 } // namespace itpp
297 
298 #endif // #ifndef TURBO_H
SourceForge Logo

Generated on Fri Mar 21 2014 17:14:13 for IT++ by Doxygen 1.8.1.2