From e0423da5097ad9e7b45995bb66762ea965f45887 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Tue, 9 Jun 2020 14:47:01 +0200 Subject: [PATCH] moved ML method to bottom --- short_bch_code_decoder.hh | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/short_bch_code_decoder.hh b/short_bch_code_decoder.hh index 775f25d..2177c0b 100644 --- a/short_bch_code_decoder.hh +++ b/short_bch_code_decoder.hh @@ -60,24 +60,6 @@ public: } int operator()(const int8_t *code) { - // maximum likelihood - if (0) { - int word = 0, best = -1, next = -1; - for (int msg = 0; msg < W; ++msg) { - int enc = (msg << P) | par[msg]; - int met = metric(code, enc); - if (met > best) { - next = best; - best = met; - word = enc; - } else if (met > next) { - next = met; - } - } - if (best == next) - return -1; - return word; - } int cw = 0; for (int i = 0; i < N; ++i) cw |= (code[i] < 0) << i; @@ -139,6 +121,20 @@ public: } } } + // maximum likelihood + if (0) { + for (int msg = 0; msg < W; ++msg) { + int enc = (msg << P) | par[msg]; + int met = metric(code, enc); + if (met > best) { + next = best; + best = met; + word = enc; + } else if (word != enc && met > next) { + next = met; + } + } + } if (best == next) return -1; return word;