void TurboCode::Decoder_term(const itpp::cvec &in1, const itpp::cvec &in2, double n0, int iteration) const { int memory = rsc1_.Constraint() - 1; static itpp::vec llrZeros(0); if (llrZeros.size() != memory){ llrZeros.set_size(memory); llrZeros.zeros(); } // if for (int ite = 0; ite < iteration; ++ite){ itpp::vec llrFromRsc1; rsc1_.Decode(in1, llrToRsc1_, &llrFromRsc1, n0); itpp::vec llrToRsc2 = Interleave(llrFromRsc1.left(interleaver_.size()), interleaver_); llrToRsc2 = itpp::concat(llrToRsc2, llrZeros); itpp::vec llrFromRsc2; rsc2_.Decode(in2, llrToRsc2, &llrFromRsc2, n0); llrToRsc1_ = Deinterleave(llrFromRsc2.left(interleaver_.size()), interleaver_); llrToRsc1_ = itpp::concat(llrToRsc1_, llrZeros); } // for ite }
void TurboCodeWithZP::Decoder_term(const itpp::cvec& in1, const itpp::cvec& in2, double n0, int iterations) const { // std::cout << "## zeroPadding_ = " << zeroPadding_.PadPositions() << std::endl; int memory = rsc1_.Constraint() - 1; static itpp::vec llrZeros(0); if (llrZeros.size() != memory){ llrZeros.set_size(memory); llrZeros.zeros(); } // if for (int ite = 0; ite < iterations; ++ite){ itpp::vec llrToRsc1_mod = zeroPadding_.ModifyLLR(llrToRsc1_); itpp::vec llrFromRsc1; rsc1_.Decode(in1, llrToRsc1_mod, &llrFromRsc1, n0); itpp::vec llrFromRsc1_mod = zeroPadding_.ModifyLLR(llrFromRsc1); itpp::vec llrToRsc2 = Interleave(llrFromRsc1_mod.left(interleaver_.size()), interleaver_); llrToRsc2 = itpp::concat(llrToRsc2, llrZeros); itpp::vec llrFromRsc2; rsc2_.Decode(in2, llrToRsc2, &llrFromRsc2, n0); llrToRsc1_ = Deinterleave(llrFromRsc2.left(interleaver_.size()), interleaver_); llrToRsc1_ = itpp::concat(llrToRsc1_, llrZeros); } // for ite }
itpp::bvec Rsc::HardDecision(const itpp::vec &lambda) { int length = lambda.size(); itpp::bvec outputBits(length); for (int i = 0; i < length; ++i){ if (lambda[i] > 0){ outputBits[i] = 1; } // if else{ outputBits[i] = 0; } // else } // for i return outputBits; }