00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00027 #ifndef __turbo_h
00028 #define __turbo_h
00029
00030 #include <binary.h>
00031 #include <vector.h>
00032 #include <matrix.h>
00033 #include "rec_syst_conv_code.h"
00034 #include "interleave.h"
00035 namespace SPUC {
00036 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00037
00049 class Turbo_Codec {
00050 public:
00051
00053 Turbo_Codec(void) {}
00054
00065 void set_parameters(ivec gen1, ivec gen2, int constraint_length, const ivec &interleaver_sequence,
00066 int in_iterations=8, string in_metric="LOGMAX");
00067
00074 void set_interleaver(const ivec &interleaver_sequence);
00075
00082 void set_awgn_channel_parameters(double in_Ec, double in_N0);
00083
00106 void set_scaling_factor(double in_Lc);
00107
00126 void encode(const bvec &input, bvec &output);
00127
00133 void decode(const vec &received_signal, bvec &decoded_bits, const bvec &true_bits="0");
00134
00150 void encode_block(const bvec &input, bvec &in1, bvec &in2, bmat &parity1, bmat &parity2);
00151
00175 void decode_block(const vec &rec_syst1, const vec &rec_syst2, const mat &rec_parity1, const mat &rec_parity2,
00176 bmat &decoded_bits_i, const bvec &true_bits="0");
00177
00178 private:
00179
00183 void decode_n2(const vec &received_signal, bvec &decoded_bits);
00184
00185
00186 long interleaver_size;
00187 long Ncoded, Nuncoded;
00188 int m_tail, n1, n2, n_tot, iterations;
00189 double Ec, N0, Lc, R;
00190 string metric;
00191
00192
00193 Rec_Syst_Conv_Code rscc1, rscc2;
00194 Sequence_Interleaver<bin> bit_interleaver;
00195 Sequence_Interleaver<double> float_interleaver;
00196
00197 };
00198
00199
00204 ivec wcdma_turbo_interleaver_sequence(int interleaver_size);
00205 #endif
00206 }
00207 #endif // __turbo_h