IT++ Logo
turbo.h
Go to the documentation of this file.
00001 
00029 #ifndef TURBO_H
00030 #define TURBO_H
00031 
00032 #include <itpp/comm/rec_syst_conv_code.h>
00033 #include <itpp/comm/interleave.h>
00034 #include <itpp/comm/llr.h>
00035 
00036 
00037 namespace itpp
00038 {
00039 
00054 class Turbo_Codec
00055 {
00056 public:
00057 
00059   Turbo_Codec(void) {}
00060 
00062   virtual ~Turbo_Codec(void) {}
00063 
00087   void set_parameters(ivec gen1, ivec gen2, int constraint_length,
00088                       const ivec &interleaver_sequence, int in_iterations = 8,
00089                       std::string in_metric = "LOGMAX", double in_logmax_scale_factor = 1.0,
00090                       bool in_adaptive_stop = false, LLR_calc_unit lcalc = LLR_calc_unit());
00091 
00098   void set_interleaver(const ivec &interleaver_sequence);
00099 
00112   void set_metric(std::string in_metric = "LOGMAX", double in_logmax_scale_factor = 1.0,
00113                   LLR_calc_unit lcalc = LLR_calc_unit());
00114 
00118   void set_iterations(int in_iterations = 8);
00119 
00126   void set_adaptive_stop(bool in_adaptive_stop = true);
00127 
00134   void set_awgn_channel_parameters(double in_Ec, double in_N0);
00135 
00158   void set_scaling_factor(double in_Lc);
00159 
00179   void encode(const bvec &input, bvec &output);
00180 
00192   virtual void decode(const vec &received_signal, bvec &decoded_bits, const bvec &true_bits = "0");
00193 
00206   virtual void decode(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations,
00207                       const bvec &true_bits = "0");
00208 
00225   void encode_block(const bvec &input, bvec &in1, bvec &in2, bmat &parity1, bmat &parity2);
00226 
00256   virtual void decode_block(const vec &rec_syst1, const vec &rec_syst2, const mat &rec_parity1, const mat &rec_parity2,
00257                             bmat &decoded_bits_i, int &nrof_used_iterations_i, const bvec &true_bits = "0");
00258 
00260   int get_Ncoded() const { return Ncoded; }
00261 
00263   int get_Nuncoded() const { return Nuncoded; }
00264 
00265 private:
00266 
00270   void decode_n3(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations,
00271                  const bvec &true_bits = "0");
00272 
00273   //Scalars:
00274   int interleaver_size;
00275   int Ncoded, Nuncoded;
00276   int m_tail, n1, n2, n_tot, iterations;
00277   double Ec, N0, Lc, R, logmax_scale_factor;
00278   bool adaptive_stop;
00279   std::string metric;
00280 
00281   //Vectors:
00282   bvec decoded_bits_previous_iteration;
00283 
00284   //Classes:
00285   Rec_Syst_Conv_Code rscc1, rscc2;
00286   Sequence_Interleaver<bin> bit_interleaver;
00287   Sequence_Interleaver<double> float_interleaver;
00288 };
00289 
00294 ivec wcdma_turbo_interleaver_sequence(int interleaver_size);
00295 
00296 } // namespace itpp
00297 
00298 #endif // #ifndef TURBO_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SourceForge Logo

Generated on Wed Jul 27 2011 16:27:05 for IT++ by Doxygen 1.7.4