Commit 46807398 authored by Kevin JOLY's avatar Kevin JOLY

Update MS flooded decoder

Remove computation of degrees at runtime. Use preprocessor macros instead.
parent 6d055324
......@@ -98,21 +98,17 @@ void CDecoder_MS_fixed_flooded::decode(
* For each check node, send a message containing a new estimate
* to each of its neighbouring variable node.
*/
for(size_t cn_idx = 0; cn_idx < nb_cn; cn_idx++) {
for(size_t cn_idx = 0; cn_idx < DEG_1_COMPUTATIONS; cn_idx++) {
int cn_offset = cn_idx*cn_deg_max;
/* FIXME : in DVB-S2, the H matrix has one row with different degree:
* the last one. */
cn_deg = cn_idx == (nb_cn-1) ? DEG_2 : cn_deg_max; /* TODO JKI Move this out of loops */
/* We compute a different estimate (the message sent), for each
* neighbouring VN */
for(size_t edge_idx = 0; edge_idx < cn_deg; edge_idx++) {
for(size_t edge_idx = 0; edge_idx < DEG_1; edge_idx++) {
char sign = -1;
char minLLR = 127;
/* TODO JKI : compute global sign and minLLR */
for(size_t other_edge_idx = 0; other_edge_idx < cn_deg; other_edge_idx++) {
for(size_t other_edge_idx = 0; other_edge_idx < DEG_1; other_edge_idx++) {
if(other_edge_idx == edge_idx) continue;
char msg = *p_vn_addr[cn_offset + other_edge_idx];
char abs_msg = (msg >= 0 ? msg : -msg);
......@@ -124,6 +120,33 @@ void CDecoder_MS_fixed_flooded::decode(
}
}
#if (NB_DEGRES <= 2)
for(size_t cn_idx = DEG_1_COMPUTATIONS;
cn_idx < DEG_1_COMPUTATIONS + DEG_2_COMPUTATIONS;
cn_idx++) {
int cn_offset = cn_idx*cn_deg_max;
/* We compute a different estimate (the message sent), for each
* neighbouring VN */
for(size_t edge_idx = 0; edge_idx < DEG_2; edge_idx++) {
char sign = -1;
char minLLR = 127;
/* TODO JKI : compute global sign and minLLR */
for(size_t other_edge_idx = 0; other_edge_idx < DEG_2; other_edge_idx++) {
if(other_edge_idx == edge_idx) continue;
char msg = *p_vn_addr[cn_offset + other_edge_idx];
char abs_msg = (msg >= 0 ? msg : -msg);
sign *= (msg >= 0) ? -1 : 1;
minLLR = minLLR > abs_msg ? abs_msg : minLLR;
}
_cn_msgs[cn_offset + edge_idx] = (sign * minLLR);
}
}
#else
#error "Code should be adapted to handle more degrees"
#endif
/* Bit node updates.
* For each variable node, compute two things :
* 1) A new message to be sent to each of its neighbouring CNs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment