Code cleanup, bugfix and optimisation

This commit is contained in:
AlexandreRouma
2022-06-21 19:54:03 +02:00
parent f7c566f652
commit b943e6e869
13 changed files with 78 additions and 85 deletions

View File

@ -31,8 +31,8 @@ namespace dsp::demod {
_bandwidth = bandwidth;
_samplerate = samplerate;
carrierAgc.init(NULL, 1.0, agcAttack, agcDecay, 10e6, 10.0);
audioAgc.init(NULL, 1.0, agcAttack, agcDecay, 10e6, 10.0);
carrierAgc.init(NULL, 1.0, agcAttack, agcDecay, 10e6, 10.0, INFINITY);
audioAgc.init(NULL, 1.0, agcAttack, agcDecay, 10e6, 10.0, INFINITY);
dcBlock.init(NULL, dcBlockRate);
lpfTaps = taps::lowPass(bandwidth / 2.0, (bandwidth / 2.0) * 0.1, samplerate);
lpf.init(NULL, lpfTaps);

View File

@ -16,9 +16,10 @@ namespace dsp::demod {
void init(stream<complex_t>* in, double tone, double agcAttack, double agcDecay, double samplerate) {
_tone = tone;
_samplerate = samplerate;
xlator.init(NULL, tone, samplerate);
agc.init(NULL, 1.0, agcAttack, agcDecay, 10e6, 10.0);
agc.init(NULL, 1.0, agcAttack, agcDecay, 10e6, 10.0, INFINITY);
if constexpr (std::is_same_v<T, float>) {
agc.out.free();
@ -31,7 +32,7 @@ namespace dsp::demod {
assert(base_type::_block_init);
std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx);
_tone = tone;
xlator.setOffset(_tone);
xlator.setOffset(_tone, _samplerate);
}
void setAGCAttack(double attack) {
@ -49,7 +50,8 @@ namespace dsp::demod {
void setSamplerate(double samplerate) {
assert(base_type::_block_init);
std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx);
xlator.setOffset(_tone, samplerate);
_samplerate = samplerate;
xlator.setOffset(_tone, _samplerate);
}
inline int process(int count, const complex_t* in, T* out) {
@ -79,6 +81,7 @@ namespace dsp::demod {
private:
double _tone;
double _samplerate;
dsp::channel::FrequencyXlator xlator;
dsp::loop::AGC<float> agc;

View File

@ -26,7 +26,7 @@ namespace dsp::demod {
_samplerate = samplerate;
xlator.init(NULL, getTranslation(), _samplerate);
agc.init(NULL, 1.0, agcAttack, agcDecay, 10e6, 10.0);
agc.init(NULL, 1.0, agcAttack, agcDecay, 10e6, 10.0, INFINITY);
if constexpr (std::is_same_v<T, float>) {
agc.out.free();