summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
authoreb2008-08-23 18:46:04 +0000
committereb2008-08-23 18:46:04 +0000
commit0da73b85fc0a8bf49e84c46e29b045d76defa984 (patch)
tree0cc275254f792b0d1c812e352b0ef9dd531e9fc5 /gnuradio-core
parentb38d18d543ab7b3452f456f7f39cc76fa271d8f3 (diff)
downloadgnuradio-0da73b85fc0a8bf49e84c46e29b045d76defa984.tar.gz
gnuradio-0da73b85fc0a8bf49e84c46e29b045d76defa984.tar.bz2
gnuradio-0da73b85fc0a8bf49e84c46e29b045d76defa984.zip
fix for ticket:243
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9381 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/viterbi/metrics.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/gnuradio-core/src/lib/viterbi/metrics.c b/gnuradio-core/src/lib/viterbi/metrics.c
index 2dd4279aa..9f958cab7 100644
--- a/gnuradio-core/src/lib/viterbi/metrics.c
+++ b/gnuradio-core/src/lib/viterbi/metrics.c
@@ -46,10 +46,7 @@
#define normal(x) (0.5 + 0.5*erf((x)/M_SQRT2))
/* Logarithm base 2 */
-double log2(double); /* declaration seems to be missing from some math.h's */
-#if !defined(HAVE_LOG2)
-#define log2(x) (log(x)*M_LOG2E)
-#endif
+#define gr_log2(x) (log(x)*M_LOG2E)
/* Generate log-likelihood metrics for 8-bit soft quantized channel
* assuming AWGN and BPSK
@@ -80,8 +77,8 @@ gen_met(int mettab[2][256], /* Metric table, [sent sym][rx symbol] */
/* Prob of this value occurring for a 0-bit */ /* P(s|0) */
p0 = normal(((0-OFFSET+0.5)/amp + 1)/noise);
- metrics[0][0] = log2(2*p0/(p1+p0)) - bias;
- metrics[1][0] = log2(2*p1/(p1+p0)) - bias;
+ metrics[0][0] = gr_log2(2*p0/(p1+p0)) - bias;
+ metrics[1][0] = gr_log2(2*p1/(p1+p0)) - bias;
for(s=1;s<255;s++){
/* P(s|1), prob of receiving s given 1 transmitted */
@@ -95,8 +92,8 @@ gen_met(int mettab[2][256], /* Metric table, [sent sym][rx symbol] */
#ifdef notdef
printf("P(%d|1) = %lg, P(%d|0) = %lg\n",s,p1,s,p0);
#endif
- metrics[0][s] = log2(2*p0/(p1+p0)) - bias;
- metrics[1][s] = log2(2*p1/(p1+p0)) - bias;
+ metrics[0][s] = gr_log2(2*p0/(p1+p0)) - bias;
+ metrics[1][s] = gr_log2(2*p1/(p1+p0)) - bias;
}
/* 255 is also a special value */
/* P(s|1) */
@@ -104,8 +101,8 @@ gen_met(int mettab[2][256], /* Metric table, [sent sym][rx symbol] */
/* P(s|0) */
p0 = 1 - normal(((255-OFFSET-0.5)/amp + 1)/noise);
- metrics[0][255] = log2(2*p0/(p1+p0)) - bias;
- metrics[1][255] = log2(2*p1/(p1+p0)) - bias;
+ metrics[0][255] = gr_log2(2*p0/(p1+p0)) - bias;
+ metrics[1][255] = gr_log2(2*p1/(p1+p0)) - bias;
#ifdef notdef
/* The probability of a raw symbol error is the probability
* that a 1-bit would be received as a sample with value