1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-29 05:22:25 -04:00

DATV demod: apply commit 3479085369c2466fb2672f8e529e771c8fa22d1c Control refresh of tracking FIR filter.

This commit is contained in:
f4exb 2020-04-21 01:32:15 +02:00
parent d0f97d0a5c
commit 85bbcd0c68

View File

@ -891,10 +891,11 @@ struct sampler_interface
{ {
} }
virtual complex<T> interp(const complex<T> *pin, float mu, float phase) = 0; virtual complex<T> interp(const complex<T> *pin, float mu, float phase) = 0;
virtual void update_freq(float freqw, int period = 1)
virtual void update_freq(float freqw, int weight = 0)
{ {
(void) freqw; (void) freqw;
(void) period; (void) weight;
} // 65536 = 1 Hz } // 65536 = 1 Hz
virtual int readahead() = 0; virtual int readahead() = 0;
}; };
@ -940,9 +941,9 @@ struct linear_sampler : sampler_interface<T>
return s0 * (1 - mu) + s1 * mu; return s0 * (1 - mu) + s1 * mu;
} }
void update_freq(float _freqw, int period = 1) void update_freq(float _freqw, int weight = 0)
{ {
(void) period; (void) weight;
freqw = _freqw; freqw = _freqw;
} }
@ -998,11 +999,14 @@ struct fir_sampler : sampler_interface<T>
return trig.expi(-phase) * acc; return trig.expi(-phase) * acc;
} }
void update_freq(float freqw, int period) void update_freq(float freqw, int weight = 0)
{ {
if (!weight) {
update_freq_phase = 0; // Force refresh.
}
// Throttling: Update one coeff per 16 processed samples, // Throttling: Update one coeff per 16 processed samples,
// to keep the overhead of freq tracking below about 10%. // to keep the overhead of freq tracking below about 10%.
update_freq_phase -= period; update_freq_phase -= weight;
if (update_freq_phase <= 0) if (update_freq_phase <= 0)
{ {