Transceiver52M: sigproc: Wrap internal phase on frequency shift
The call into table lookup will loop on values outside of the table range. With continuously increasing phase, this leads to an eventual permanent hard spin. Wrap the phase value to prevent that from happening. Signed-off-by: Thomas Tsou <tom@tsou.cc>
This commit is contained in:
parent
2c1f85a10c
commit
34bbef754f
|
@ -613,6 +613,10 @@ signalVector* frequencyShift(signalVector *y,
|
|||
while (xP < xPEnd) {
|
||||
(*yP++) = (*xP++)*expjLookup(phase);
|
||||
phase += freq;
|
||||
if (phase > 2 * M_PI)
|
||||
phase -= 2 * M_PI;
|
||||
else if (phase < -2 * M_PI)
|
||||
phase += 2 * M_PI;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue