mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-24 00:34:44 +01:00
Improved performance of DC correction
This commit is contained in:
parent
b9e35e6558
commit
8290284586
@ -64,7 +64,7 @@ namespace dsp {
|
|||||||
stream<complex_t> out;
|
stream<complex_t> out;
|
||||||
|
|
||||||
// TEMPORARY FOR DEBUG PURPOSES
|
// TEMPORARY FOR DEBUG PURPOSES
|
||||||
bool bypass = true;
|
bool bypass = false;
|
||||||
complex_t offset;
|
complex_t offset;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -108,7 +108,7 @@ namespace displaymenu {
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
|
||||||
if (ImGui::InputInt("##sdrpp_fft_rate", &fftRate, 1, 10)) {
|
if (ImGui::InputInt("##sdrpp_fft_rate", &fftRate, 1, 10)) {
|
||||||
std::clamp<int>(fftRate, 1, 200);
|
fftRate = std::max<int>(1, fftRate);
|
||||||
sigpath::signalPath.setFFTRate(fftRate);
|
sigpath::signalPath.setFFTRate(fftRate);
|
||||||
core::configManager.acquire();
|
core::configManager.acquire();
|
||||||
core::configManager.conf["fftRate"] = fftRate;
|
core::configManager.conf["fftRate"] = fftRate;
|
||||||
|
@ -362,7 +362,7 @@ namespace ImGui {
|
|||||||
|
|
||||||
// If the mouse wheel is moved on the frequency scale
|
// If the mouse wheel is moved on the frequency scale
|
||||||
if (mouseWheel != 0 && mouseInFreq) {
|
if (mouseWheel != 0 && mouseInFreq) {
|
||||||
viewOffset -= (double)mouseWheel * viewBandwidth / 20.0;
|
viewOffset -= (double)mouseWheel * viewBandwidth / 20.0;
|
||||||
|
|
||||||
if (viewOffset + (viewBandwidth / 2.0) > wholeBandwidth / 2.0) {
|
if (viewOffset + (viewBandwidth / 2.0) > wholeBandwidth / 2.0) {
|
||||||
double freqOffset = (viewOffset + (viewBandwidth / 2.0)) - (wholeBandwidth / 2.0);
|
double freqOffset = (viewOffset + (viewBandwidth / 2.0)) - (wholeBandwidth / 2.0);
|
||||||
|
@ -16,8 +16,8 @@ void SignalPath::init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream
|
|||||||
|
|
||||||
// split.init(input);
|
// split.init(input);
|
||||||
inputBuffer.init(input);
|
inputBuffer.init(input);
|
||||||
corrector.init(&inputBuffer.out, 100.0f / sampleRate);
|
corrector.init(&inputBuffer.out, 50.0f / sampleRate);
|
||||||
split.init(&corrector.out);
|
split.init(&inputBuffer.out);
|
||||||
|
|
||||||
reshape.init(&fftStream, fftSize, (sampleRate / fftRate) - fftSize);
|
reshape.init(&fftStream, fftSize, (sampleRate / fftRate) - fftSize);
|
||||||
split.bindStream(&fftStream);
|
split.bindStream(&fftStream);
|
||||||
@ -44,7 +44,7 @@ void SignalPath::setSampleRate(double sampleRate) {
|
|||||||
vfo.vfo->start();
|
vfo.vfo->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
corrector.setCorrectionRate(100.0f / sampleRate);
|
corrector.setCorrectionRate(50.0f / sampleRate);
|
||||||
|
|
||||||
split.start();
|
split.start();
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ void SignalPath::start() {
|
|||||||
decimator->start();
|
decimator->start();
|
||||||
}
|
}
|
||||||
inputBuffer.start();
|
inputBuffer.start();
|
||||||
corrector.start();
|
if (iqCorrection) { corrector.start(); }
|
||||||
split.start();
|
split.start();
|
||||||
reshape.start();
|
reshape.start();
|
||||||
fftHandlerSink.start();
|
fftHandlerSink.start();
|
||||||
@ -70,7 +70,7 @@ void SignalPath::stop() {
|
|||||||
decimator->stop();
|
decimator->stop();
|
||||||
}
|
}
|
||||||
inputBuffer.stop();
|
inputBuffer.stop();
|
||||||
corrector.stop();
|
if (iqCorrection) { corrector.stop(); }
|
||||||
split.stop();
|
split.stop();
|
||||||
reshape.stop();
|
reshape.stop();
|
||||||
fftHandlerSink.stop();
|
fftHandlerSink.stop();
|
||||||
@ -164,7 +164,13 @@ void SignalPath::setDecimation(int dec) {
|
|||||||
|
|
||||||
// If no decimation, reconnect
|
// If no decimation, reconnect
|
||||||
if (!dec) {
|
if (!dec) {
|
||||||
split.setInput(&corrector.out);
|
if (iqCorrection) {
|
||||||
|
split.setInput(&corrector.out);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
split.setInput(&inputBuffer.out);
|
||||||
|
}
|
||||||
|
|
||||||
if (running) { split.start(); }
|
if (running) { split.start(); }
|
||||||
core::setInputSampleRate(sourceSampleRate);
|
core::setInputSampleRate(sourceSampleRate);
|
||||||
return;
|
return;
|
||||||
@ -172,7 +178,17 @@ void SignalPath::setDecimation(int dec) {
|
|||||||
|
|
||||||
// Create new decimators
|
// Create new decimators
|
||||||
for (int i = 0; i < dec; i++) {
|
for (int i = 0; i < dec; i++) {
|
||||||
dsp::HalfDecimator<dsp::complex_t>* decimator = new dsp::HalfDecimator<dsp::complex_t>((i == 0) ? &corrector.out : &decimators[i-1]->out, &halfBandWindow);
|
dsp::HalfDecimator<dsp::complex_t>* decimator;
|
||||||
|
if (iqCorrection && i == 0) {
|
||||||
|
decimator = new dsp::HalfDecimator<dsp::complex_t>(&corrector.out, &halfBandWindow);
|
||||||
|
}
|
||||||
|
else if (i == 0) {
|
||||||
|
decimator = new dsp::HalfDecimator<dsp::complex_t>(&inputBuffer.out, &halfBandWindow);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
decimator = new dsp::HalfDecimator<dsp::complex_t>(&decimators[i-1]->out, &halfBandWindow);
|
||||||
|
}
|
||||||
|
|
||||||
if (running) { decimator->start(); }
|
if (running) { decimator->start(); }
|
||||||
decimators.push_back(decimator);
|
decimators.push_back(decimator);
|
||||||
}
|
}
|
||||||
@ -184,7 +200,28 @@ void SignalPath::setDecimation(int dec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SignalPath::setIQCorrection(bool enabled) {
|
void SignalPath::setIQCorrection(bool enabled) {
|
||||||
corrector.bypass = !enabled;
|
if (iqCorrection == enabled) { return; }
|
||||||
|
|
||||||
|
if (!iqCorrection && enabled) {
|
||||||
|
if (decimation) {
|
||||||
|
decimators[0]->setInput(&corrector.out);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
split.setInput(&corrector.out);
|
||||||
|
}
|
||||||
|
if (running) { corrector.start(); }
|
||||||
|
}
|
||||||
|
else if (iqCorrection && !enabled) {
|
||||||
|
if (running) { corrector.stop(); }
|
||||||
|
if (decimation) {
|
||||||
|
decimators[0]->setInput(&inputBuffer.out);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
split.setInput(&inputBuffer.out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iqCorrection = enabled;
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
corrector.offset.re = 0;
|
corrector.offset.re = 0;
|
||||||
corrector.offset.im = 0;
|
corrector.offset.im = 0;
|
||||||
|
@ -56,4 +56,5 @@ private:
|
|||||||
int inputBlockSize;
|
int inputBlockSize;
|
||||||
bool bufferingEnabled = false;
|
bool bufferingEnabled = false;
|
||||||
bool running = false;
|
bool running = false;
|
||||||
|
bool iqCorrection = false;
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user