skip write disable code if no repeat is necessary

This commit is contained in:
Ahmet Inan 2019-09-30 12:44:13 +02:00
commit 00246f2a69
2 changed files with 44 additions and 28 deletions

View file

@ -161,12 +161,12 @@ class LDPCDecoder
shift[c] = (shift[c] + 1) % M;
}
std::sort(lo, lo + cnt, [](const Loc &a, const Loc &b){ return a.off < b.off; });
bool wd[deg], repeat;
bool wd[deg], repeat = false;
for (int d = 0; d < deg; ++d)
wd[d] = false;
for (int c = 1; c < cnt; ++c)
if (lo[c].off == lo[c-1].off)
wd[c] = true;
wd[c] = repeat = true;
do {
TYPE par[2];
if (i) {
@ -191,9 +191,6 @@ class LDPCDecoder
out[d] = vclamp(out[d], -32, 31);
for (int d = 0; d < deg; ++d)
out[d] = selfcorr(bl[d], out[d]);
for (int d = 0; d < deg; ++d)
if (!wd[d])
bl[d] = out[d];
for (int c = 0; c < cnt; ++c)
mes[c] = vqadd(inp[c], out[c]);
par[0] = vqadd(inp[cnt], out[cnt]);
@ -207,16 +204,27 @@ class LDPCDecoder
pty[PTY-1] = rotate(par[0], -1);
}
pty[W*i+j] = par[1];
for (int c = 0; c < cnt; ++c)
if (!wd[c])
msg[lo[c].off] = rotate(mes[c], lo[c].shi);
repeat = false;
for (int c = 1; c < cnt; ++c)
if (wd[c] && !wd[c-1]) {
wd[c] = false;
repeat = true;
++c;
if (repeat) {
for (int c = 0; c < cnt; ++c)
if (!wd[c])
msg[lo[c].off] = rotate(mes[c], lo[c].shi);
for (int d = 0; d < deg; ++d)
if (!wd[d])
bl[d] = out[d];
repeat = false;
for (int c = 1; c < cnt; ++c) {
if (wd[c] && !wd[c-1]) {
wd[c] = false;
repeat = true;
++c;
}
}
} else {
for (int c = 0; c < cnt; ++c)
msg[lo[c].off] = rotate(mes[c], lo[c].shi);
for (int d = 0; d < deg; ++d)
bl[d] = out[d];
}
} while (repeat);
bl += deg;
}