IT++ Logo

turbo.h

Go to the documentation of this file.
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 
00085   void set_parameters(ivec gen1, ivec gen2, int constraint_length,
00086                       const ivec &interleaver_sequence, int in_iterations = 8,
00087                       std::string in_metric = "LOGMAX", double in_logmax_scale_factor = 1.0,
00088                       bool in_adaptive_stop = false, LLR_calc_unit lcalc = LLR_calc_unit());
00089 
00096   void set_interleaver(const ivec &interleaver_sequence);
00097 
00110   void set_metric(std::string in_metric = "LOGMAX", double in_logmax_scale_factor = 1.0,
00111                   LLR_calc_unit lcalc = LLR_calc_unit());
00112 
00116   void set_iterations(int in_iterations = 8);
00117 
00124   void set_adaptive_stop(bool in_adaptive_stop = true);
00125 
00132   void set_awgn_channel_parameters(double in_Ec, double in_N0);
00133 
00156   void set_scaling_factor(double in_Lc);
00157 
00177   void encode(const bvec &input, bvec &output);
00178 
00190   virtual void decode(const vec &received_signal, bvec &decoded_bits, const bvec &true_bits = "0");
00191 
00204   virtual void decode(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations,
00205                       const bvec &true_bits = "0");
00206 
00223   void encode_block(const bvec &input, bvec &in1, bvec &in2, bmat &parity1, bmat &parity2);
00224 
00254   virtual void decode_block(const vec &rec_syst1, const vec &rec_syst2, const mat &rec_parity1, const mat &rec_parity2,
00255                             bmat &decoded_bits_i, int &nrof_used_iterations_i, const bvec &true_bits = "0");
00256 
00258   int get_Ncoded() const { return Ncoded; }
00259 
00261   int get_Nuncoded() const { return Nuncoded; }
00262 
00263 private:
00264 
00268   void decode_n3(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations,
00269                  const bvec &true_bits = "0");
00270 
00271   //Scalars:
00272   int interleaver_size;
00273   int Ncoded, Nuncoded;
00274   int m_tail, n1, n2, n_tot, iterations;
00275   double Ec, N0, Lc, R, logmax_scale_factor;
00276   bool adaptive_stop;
00277   std::string metric;
00278 
00279   //Vectors:
00280   bvec decoded_bits_previous_iteration;
00281 
00282   //Classes:
00283   Rec_Syst_Conv_Code rscc1, rscc2;
00284   Sequence_Interleaver<bin> bit_interleaver;
00285   Sequence_Interleaver<double> float_interleaver;
00286 };
00287 
00292 ivec wcdma_turbo_interleaver_sequence(int interleaver_size);
00293 
00294 } // namespace itpp
00295 
00296 #endif // #ifndef TURBO_H
SourceForge Logo

Generated on Fri Jul 25 12:42:59 2008 for IT++ by Doxygen 1.5.4