aboutsummaryrefslogtreecommitdiffstats
path: root/src/gmr1_rx.c
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2013-03-16 10:08:04 +0100
committerSylvain Munaut <tnt@246tNt.com>2013-07-06 13:14:56 +0200
commit7be04d6567fcaeb46b8f4efce58a35e0e031011a (patch)
tree8ff61b51bb6d0ca4827d0333c7e7157be612baaa /src/gmr1_rx.c
parent0ddd95716576bf897164496e59a829bf9601eee6 (diff)
gmr1_rx: Don't count the borders when computing energy
Since the 'burst' vector often include some margin, the center will be more representative of the real average energy. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/gmr1_rx.c')
-rw-r--r--src/gmr1_rx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gmr1_rx.c b/src/gmr1_rx.c
index 56a3dda..fb138e2 100644
--- a/src/gmr1_rx.c
+++ b/src/gmr1_rx.c
@@ -170,7 +170,8 @@ burst_energy(struct osmo_cxvec *burst)
{
int i;
float e = 0.0f;
- for (i=0; i<burst->len; i++)
+ int b = (burst->len >> 5); /* exclude the borders */
+ for (i=b; i<burst->len-b; i++)
e += osmo_normsqf(burst->data[i]);
e /= burst->len;
return e;