diff --git a/ldpc_decoder.hh b/ldpc_decoder.hh index f767a7e..75bb055 100644 --- a/ldpc_decoder.hh +++ b/ldpc_decoder.hh @@ -170,12 +170,14 @@ class LDPCDecoder inp[cnt] = vqsub(par[0], bl[cnt]); inp[cnt+1] = vqsub(par[1], bl[cnt+1]); cnp(out, inp, deg); + for (int d = 0; d < deg; ++d) + out[d] = vclamp(out[d], -32, 31); + for (int d = 0; d < deg; ++d) + *bl++ = out[d]; for (int c = 0; c < cnt; ++c) mes[c] = vqadd(inp[c], out[c]); par[0] = vqadd(inp[cnt], out[cnt]); par[1] = vqadd(inp[cnt+1], out[cnt+1]); - for (int d = 0; d < deg; ++d) - *bl++ = vclamp(out[d], -32, 31); if (i) { pty[W*(i-1)+j] = par[0]; } else if (j) { diff --git a/ldpc_decoder2.hh b/ldpc_decoder2.hh index 5a7f6d4..d07498b 100644 --- a/ldpc_decoder2.hh +++ b/ldpc_decoder2.hh @@ -166,12 +166,14 @@ class LDPCDecoder inp[cnt] = vqsub(par[0], bl[cnt]); inp[cnt+1] = vqsub(par[1], bl[cnt+1]); cnp(out, inp, deg); + for (int d = 0; d < deg; ++d) + out[d] = vclamp(out[d], -32, 31); + for (int d = 0; d < deg; ++d) + *bl++ = out[d]; for (int c = 0; c < cnt; ++c) mes[c] = vqadd(inp[c], out[c]); par[0] = vqadd(inp[cnt], out[cnt]); par[1] = vqadd(inp[cnt+1], out[cnt+1]); - for (int d = 0; d < deg; ++d) - *bl++ = vclamp(out[d], -32, 31); if (i) { pty[W*(i-1)+j] = par[0]; } else if (j) {