| 156 | |
| 157 | template<typename B> |
| 158 | bool |
| 159 | Encoder_RSC_sys<B>::_is_codeword(const B* sys, |
| 160 | const B* tail_sys, |
| 161 | const B* par, |
| 162 | const B* tail_par, |
| 163 | const int stride, |
| 164 | const int stride_tail) |
| 165 | { |
| 166 | auto state = 0; // initial (and final) state 0 0 0 |
| 167 | |
| 168 | // standard frame encoding process |
| 169 | if (par != nullptr) |
| 170 | { |
| 171 | for (auto i = 0; i < this->K; i++) |
| 172 | if (par[i * stride] != inner_encode((int)sys[i * stride], state)) // encoding block |
| 173 | return false; |
| 174 | } |
| 175 | else |
| 176 | { |
| 177 | for (auto i = 0; i < this->K; i++) |
| 178 | inner_encode((int)sys[i * stride], state); // encoding block |
| 179 | } |
| 180 | |
| 181 | // tail bits for initialization conditions (state of data "state" have to be 0 0 0) |
| 182 | for (auto i = 0; i < this->n_ff; i++) |
| 183 | { |
| 184 | B bit_sys = tail_bit_sys(state); |
| 185 | |
| 186 | if (tail_sys != nullptr) |
| 187 | if (tail_sys[i * stride_tail] != bit_sys) // systematic transmission of the bit |
| 188 | return false; |
| 189 | |
| 190 | auto p = inner_encode((int)bit_sys, state); // encoding block |
| 191 | |
| 192 | if (tail_par != nullptr) |
| 193 | if (tail_par[i * stride_tail] != p) return false; |
| 194 | } |
| 195 | |
| 196 | return true; |
| 197 | } |
| 198 | |
| 199 | template<typename B> |
| 200 | bool |
nothing calls this directly
no outgoing calls
no test coverage detected