From c87344a7145a21efec3ae8c938f0c269c83d75a4 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 16 Dec 2013 08:43:08 -0500 Subject: [PATCH] digital: if pre_diff_code is not used, use [0, M-1] as the code in soft decison calculation. --- gr-digital/lib/constellation.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gr-digital/lib/constellation.cc b/gr-digital/lib/constellation.cc index aab00f0..7d2c170 100644 --- a/gr-digital/lib/constellation.cc +++ b/gr-digital/lib/constellation.cc @@ -273,6 +273,7 @@ namespace gr { std::vector s(k, 0); float scale = d_scalefactor*d_scalefactor; + int v; for(int i = 0; i < M; i++) { // Calculate the distance between the sample and the current @@ -283,10 +284,15 @@ namespace gr { // the scaled noise power. float d = expf(-dist / (2.0*npwr*scale)); + if(d_apply_pre_diff_code) + v = d_pre_diff_code[i]; + else + v = i; + for(int j = 0; j < k; j++) { // Get the bit at the jth index int mask = 1 << j; - int bit = (d_pre_diff_code[i] & mask) >> j; + int bit = (v & mask) >> j; // If the bit is a 0, add to the probability of a zero if(bit == 0) -- 1.8.3.2