00001
00029 #ifndef REC_SYST_CONV_CODE_H
00030 #define REC_SYST_CONV_CODE_H
00031
00032 #include <itpp/base/vec.h>
00033 #include <itpp/base/mat.h>
00034 #include <itpp/comm/convcode.h>
00035 #include <itpp/comm/llr.h>
00036
00037
00038 namespace itpp
00039 {
00040
00051 class Rec_Syst_Conv_Code
00052 {
00053 public:
00054
00056 Rec_Syst_Conv_Code(): infinity(1e30) {}
00057
00059 virtual ~Rec_Syst_Conv_Code() {}
00060
00069 void set_generator_polynomials(const ivec &gen, int constraint_length);
00070
00077 void set_awgn_channel_parameters(double Ec, double N0);
00078
00084 void set_scaling_factor(double in_Lc);
00085
00089 void set_llrcalc(LLR_calc_unit in_llrcalc);
00090
00098 void encode_tail(const bvec &input, bvec &tail, bmat &parity_bits);
00099
00103 void encode(const bvec &input, bmat &parity_bits);
00104
00120 virtual void map_decode(const vec &rec_systematic, const mat &rec_parity, const vec &extrinsic_input, vec &extrinsic_output,
00121 bool set_terminated = false);
00122
00141 virtual void log_decode(const vec &rec_systematic, const mat &rec_parity, const vec &extrinsic_input,
00142 vec &extrinsic_output, bool set_terminated = false, std::string metric = "LOGMAX");
00143
00158 virtual void log_decode_n2(const vec &rec_systematic,
00159 const vec &rec_parity,
00160 const vec &extrinsic_input,
00161 vec &extrinsic_output,
00162 bool set_terminated = false,
00163 std::string metric = "LOGMAX");
00164
00165
00166
00179 virtual void log_decode(const QLLRvec &rec_systematic,
00180 const QLLRmat &rec_parity,
00181 const QLLRvec &extrinsic_input,
00182 QLLRvec &extrinsic_output,
00183 bool set_terminated = false);
00184
00197 virtual void log_decode_n2(const QLLRvec &rec_systematic,
00198 const QLLRvec &rec_parity,
00199 const QLLRvec &extrinsic_input,
00200 QLLRvec &extrinsic_output,
00201 bool set_terminated = false);
00202
00203
00204
00206 Rec_Syst_Conv_Code & operator=(const Rec_Syst_Conv_Code &) { return *this; }
00207
00208 private:
00210 int calc_state_transition(const int instate, const int input, ivec &parity);
00211
00212 int n, K, m;
00213 ivec gen_pol, gen_pol_rev;
00214 int encoder_state, Nstates;
00215 double rate, Lc;
00216 imat state_trans, output_parity, rev_state_trans, rev_output_parity;
00217 bool terminated;
00218 mat gamma, alpha, beta;
00219 QLLRmat gamma_q, alpha_q, beta_q;
00220 vec denom;
00221 QLLRvec denom_q;
00222 double ln2;
00223
00228 LLR_calc_unit llrcalc;
00229
00230
00231 const double infinity;
00232 };
00233
00234 }
00235
00236 #endif // #ifndef REC_SYST_CONV_CODE_H