| 96 | |
| 97 | template<typename B> |
| 98 | void |
| 99 | Encoder_LDPC_QC<B>::_encode(const B* U_K, B* X_N, const size_t frame_id) |
| 100 | { |
| 101 | std::memcpy(X_N, U_K, sizeof(B) * this->K); |
| 102 | const int n_zeros_pad = this->K_LDPC - this->K; |
| 103 | std::memset(X_N + this->K, 0, sizeof(B) * n_zeros_pad); |
| 104 | |
| 105 | std::vector<B> vect(this->N - this->K_LDPC, 0); |
| 106 | std::vector<B> res(this->N - this->K_LDPC, 0); |
| 107 | for (int i = 0; i < this->K_LDPC / this->Zc; i++) |
| 108 | { |
| 109 | res = this->_CSRAA(this->Zc, this->G[i], X_N + i * this->Zc, this->K_LDPC, this->N); |
| 110 | std::transform(vect.begin(), vect.end(), res.begin(), vect.begin(), [](B& c, B& b) { return (c + b) % 2; }); |
| 111 | } |
| 112 | |
| 113 | for (int i = this->K_LDPC; i < this->N; i++) |
| 114 | { |
| 115 | X_N[i] = vect[i - this->K_LDPC]; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | // ==================================================================================== explicit template instantiation |
| 120 | #include "Module/Encoder/LDPC/QC/Encoder_LDPC_QC.hpp" |