| 32 | |
| 33 | template<typename B> |
| 34 | void |
| 35 | Encoder_BCH_inter<B>::__encode(const B* U_K, B* par) |
| 36 | { |
| 37 | constexpr int n_frames = mipp::N<B>(); |
| 38 | std::vector<const B*> frames_in(n_frames); |
| 39 | for (auto f = 0; f < n_frames; f++) |
| 40 | frames_in[f] = U_K + f * this->K; |
| 41 | |
| 42 | tools::Reorderer_static<B, n_frames>::apply(frames_in, this->U_K_reordered.data(), this->K); |
| 43 | |
| 44 | std::fill(this->par_reordered.begin(), this->par_reordered.end(), (B)0); |
| 45 | |
| 46 | mipp::Reg<B> reg_g_0 = this->g[0]; |
| 47 | mipp::Reg<B> reg_zero = (B)0; |
| 48 | |
| 49 | for (auto i = this->K - 1; i >= 0; i--) |
| 50 | { |
| 51 | mipp::Reg<B> reg_par_n = &this->par_reordered[(this->n_rdncy - 1) * mipp::N<B>()]; |
| 52 | const auto reg_feedback = reg_par_n ^ &this->U_K_reordered[i * mipp::N<B>()]; |
| 53 | for (auto j = this->n_rdncy - 1; j > 0; j--) |
| 54 | { |
| 55 | mipp::Reg<B> reg_par_j_1 = &this->par_reordered[(j - 1) * mipp::N<B>()]; |
| 56 | auto reg_par_j = this->g[j] ? reg_par_j_1 ^ reg_feedback : reg_par_j_1; |
| 57 | reg_par_j.store(&this->par_reordered[j * mipp::N<B>()]); |
| 58 | } |
| 59 | |
| 60 | auto reg_par_0 = mipp::blend(reg_g_0 & reg_feedback, reg_zero, reg_feedback == 1); |
| 61 | reg_par_0.store(&this->par_reordered[0 * mipp::N<B>()]); |
| 62 | } |
| 63 | |
| 64 | std::vector<B*> frames_out(n_frames); |
| 65 | for (auto f = 0; f < n_frames; f++) |
| 66 | frames_out[f] = par + f * this->N; |
| 67 | tools::Reorderer_static<B, n_frames>::apply_rev(this->par_reordered.data(), frames_out, this->n_rdncy); |
| 68 | } |
| 69 | |
| 70 | template<typename B> |
| 71 | void |