From 35994cdfd973414831a6f25f4557fc62277ba4f7 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Mon, 2 Feb 2015 16:21:26 +0100 Subject: [PATCH] use an modified baseband delay demodulator we are working at sampling rate, so we can use a faster approximation and avoid trigonometric functions altogether. we still have to normalize the output though. --- app/src/main/rs/fmd.rsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/rs/fmd.rsh b/app/src/main/rs/fmd.rsh index d4351db..17cf7ac 100644 --- a/app/src/main/rs/fmd.rsh +++ b/app/src/main/rs/fmd.rsh @@ -31,7 +31,12 @@ static fmd_t fmd(float bandwidth, float rate) static float demodulate(fmd_t *fmd, complex_t baseband) { +#if 0 float phase = carg(cdiv(baseband, fmd->prev)); +#else + // good enough, as we are working at the sampling rate + float phase = (fmd->prev[0] * baseband[1] - baseband[0] * fmd->prev[1]) / dot(baseband, baseband); +#endif fmd->prev = baseband; return clamp(fmd->scale * phase, -1.0f, 1.0f); }