mirror of
https://github.com/xdsopl/robot36.git
synced 2025-12-06 07:12:07 +01:00
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.
This commit is contained in:
parent
1798a3e25f
commit
35994cdfd9
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue