MCPcopy Create free account
hub / github.com/aff3ct/aff3ct / _is_codeword

Method _is_codeword

src/Module/Encoder/RSC/Encoder_RSC_sys.cpp:158–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156
157template<typename B>
158bool
159Encoder_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
199template<typename B>
200bool

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected