From 7fd931ae5f6f5b35ad0c090d6f5b4a1757af7c54 Mon Sep 17 00:00:00 2001 From: Zilog80 Date: Fri, 1 May 2020 14:27:47 +0200 Subject: [PATCH] Hamming [8,4] 2-bit-errors -> soft decision --- demod/mod/dfm09mod.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/demod/mod/dfm09mod.c b/demod/mod/dfm09mod.c index f101a37..a5216eb 100644 --- a/demod/mod/dfm09mod.c +++ b/demod/mod/dfm09mod.c @@ -195,9 +195,12 @@ static int check(int opt_ecc, hsbit_t code[8]) { int d = 0; float sum = 0.0; float maxsum = 0.0; - for (i = 0; i < 8; i++) { - sum += (2*code[i].hb-1) * code[i].sb; - } + /* + sum = 0.0; // s<0: h=0 , s>0: h=1 + for (i = 0; i < 8; i++) { // s\in[-1,+1] , h\in{0,1} -> 2h-1\in{-1,+1} + sum += (2*code[i].hb-1)*code[i].sb; // i.e. sum_i |sb_i| + } // original score + */ for (n = 0; n < 16; n++) { d = 0; sum = 0.0; @@ -211,7 +214,7 @@ static int check(int opt_ecc, hsbit_t code[8]) { for (i = 0; i < 8; i++) { sum += (2*codewords[n][i]-1) * code[i].sb; } - if (sum*sum >= maxsum*maxsum) { + if (sum >= maxsum) { // best match maxsum = sum; maxn = n; }