| 112 | |
| 113 | template<typename B> |
| 114 | void |
| 115 | Encoder_RSC_sys<B>::__encode(const B* U_K, |
| 116 | B* sys, |
| 117 | B* tail_sys, |
| 118 | B* par, |
| 119 | B* tail_par, |
| 120 | const int stride, |
| 121 | const int stride_tail) |
| 122 | { |
| 123 | auto state = 0; // initial (and final) state 0 0 0 |
| 124 | |
| 125 | if (sys != nullptr) |
| 126 | for (auto i = 0; i < this->K; i++) |
| 127 | sys[i * stride] = U_K[i]; |
| 128 | |
| 129 | // standard frame encoding process |
| 130 | if (par != nullptr) |
| 131 | for (auto i = 0; i < this->K; i++) |
| 132 | par[i * stride] = inner_encode((int)U_K[i], state); // encoding block |
| 133 | else |
| 134 | for (auto i = 0; i < this->K; i++) |
| 135 | inner_encode((int)U_K[i], state); // encoding block |
| 136 | |
| 137 | // tail bits for initialization conditions (state of data "state" have to be 0 0 0) |
| 138 | for (auto i = 0; i < this->n_ff; i++) |
| 139 | { |
| 140 | B bit_sys = tail_bit_sys(state); |
| 141 | |
| 142 | if (tail_sys != nullptr) tail_sys[i * stride_tail] = bit_sys; // systematic transmission of the bit |
| 143 | |
| 144 | auto p = inner_encode((int)bit_sys, state); // encoding block |
| 145 | |
| 146 | if (tail_par != nullptr) tail_par[i * stride_tail] = p; |
| 147 | } |
| 148 | |
| 149 | if (state != 0) |
| 150 | { |
| 151 | std::stringstream message; |
| 152 | message << "'state' should be equal to 0 ('state' = " << state << ")."; |
| 153 | throw spu::tools::runtime_error(__FILE__, __LINE__, __func__, message.str()); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | template<typename B> |
| 158 | bool |
nothing calls this directly
no outgoing calls
no test coverage detected