IT++ Logo Newcom Logo

turbo.h

Go to the documentation of this file.
00001 
00033 #ifndef TURBO_H
00034 #define TURBO_H
00035 
00036 #include <itpp/comm/rec_syst_conv_code.h>
00037 #include <itpp/comm/interleave.h>
00038 #include <itpp/comm/llr.h>
00039 
00040 
00041 namespace itpp {
00042 
00057   class Turbo_Codec {
00058   public:
00059   
00061     Turbo_Codec(void) {}
00062 
00064     virtual ~Turbo_Codec(void) {}
00065 
00086     void set_parameters(ivec gen1, ivec gen2, int constraint_length, 
00087                         const ivec &interleaver_sequence, int in_iterations=8, 
00088                         std::string in_metric="LOGMAX", double in_logmax_scale_factor=1.0, 
00089                         bool in_adaptive_stop=false, LLR_calc_unit lcalc=LLR_calc_unit());
00090 
00097     void set_interleaver(const ivec &interleaver_sequence);
00098   
00111     void set_metric(std::string in_metric="LOGMAX", double in_logmax_scale_factor=1.0,
00112                     LLR_calc_unit lcalc=LLR_calc_unit());
00113 
00117     void set_iterations(int in_iterations=8);
00118 
00125     void set_adaptive_stop(bool in_adaptive_stop=true);
00126 
00133     void set_awgn_channel_parameters(double in_Ec, double in_N0);
00134   
00157     void set_scaling_factor(double in_Lc);
00158 
00178     void encode(const bvec &input, bvec &output);
00179 
00191     virtual void decode(const vec &received_signal, bvec &decoded_bits, const bvec &true_bits="0");
00192 
00205     virtual void decode(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, 
00206                         const bvec &true_bits="0");
00207 
00224     void encode_block(const bvec &input, bvec &in1, bvec &in2, bmat &parity1, bmat &parity2);
00225 
00255     virtual void decode_block(const vec &rec_syst1, const vec &rec_syst2, const mat &rec_parity1, const mat &rec_parity2, 
00256                               bmat &decoded_bits_i, int &nrof_used_iterations_i, const bvec &true_bits="0");
00257 
00259     long get_Ncoded() { return Ncoded; }
00260     
00262     long get_Nuncoded() { return Nuncoded; }
00263 
00264   protected:   
00265 
00269     void decode_n3(const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, 
00270                    const bvec &true_bits="0");
00271 
00272     //Scalars:
00273     long interleaver_size;
00274     long Ncoded, Nuncoded;
00275     int m_tail, n1, n2, n_tot, iterations;
00276     double Ec, N0, Lc, R, logmax_scale_factor;
00277     bool adaptive_stop;
00278     std::string metric;
00279 
00280     //Vectors:
00281     bvec decoded_bits_previous_iteration;
00282 
00283     //Classes:
00284     Rec_Syst_Conv_Code rscc1, rscc2;
00285     Sequence_Interleaver<bin> bit_interleaver;
00286     Sequence_Interleaver<double> float_interleaver;
00287   };
00288 
00293   ivec wcdma_turbo_interleaver_sequence(int interleaver_size);
00294 
00295 } // namespace itpp
00296 
00297 #endif // #ifndef TURBO_H
SourceForge Logo

Generated on Fri Jan 11 08:51:38 2008 for IT++ by Doxygen 1.3.9.1