Fixed FFT factory new plan allocation and effectively grab fftw-file option in the main parser

pull/489/head
f4exb 2020-03-14 06:40:38 +01:00
rodzic 30694b4be7
commit 606d4fd756
3 zmienionych plików z 26 dodań i 5 usunięć

Wyświetl plik

@ -82,7 +82,7 @@ unsigned int FFTFactory::getEngine(unsigned int fftSize, bool inverse, FFTEngine
engines.back().m_inUse = true;
engines.back().m_engine = FFTEngine::create(m_fftwWisdomFileName);
engines.back().m_engine->setReuse(false);
engines.back().m_engine->configure(fftSize, true);
engines.back().m_engine->configure(fftSize, inverse);
*engine = engines.back().m_engine;
return 0;
}
@ -112,7 +112,7 @@ unsigned int FFTFactory::getEngine(unsigned int fftSize, bool inverse, FFTEngine
engines.back().m_inUse = true;
engines.back().m_engine = FFTEngine::create(m_fftwWisdomFileName);
engines.back().m_engine->setReuse(false);
engines.back().m_engine->configure(fftSize, true);
engines.back().m_engine->configure(fftSize, inverse);
*engine = engines.back().m_engine;
return engines.size() - 1;
}

Wyświetl plik

@ -49,8 +49,25 @@ void FFTWEngine::configure(int n, bool inverse)
QTime t;
t.start();
m_globalPlanMutex.lock();
if (m_fftWisdomFileName.size() > 0)
{
int rc = fftwf_import_wisdom_from_filename(m_fftWisdomFileName.toStdString().c_str());
if (rc == 0) { // that's an error (undocumented)
qInfo("FFTWEngine::configure: importing from FFTW wisdom file: '%s' failed", qPrintable(m_fftWisdomFileName));
} else {
qDebug("FFTWEngine::configure: successfully imported from FFTW wisdom file: '%s'", qPrintable(m_fftWisdomFileName));
}
}
else
{
qDebug("FFTWEngine::configure: no FFTW wisdom file");
}
m_currentPlan->plan = fftwf_plan_dft_1d(n, m_currentPlan->in, m_currentPlan->out, inverse ? FFTW_BACKWARD : FFTW_FORWARD, FFTW_PATIENT);
m_globalPlanMutex.unlock();
qDebug("FFT: creating FFTW plan (n=%d,%s) took %dms", n, inverse ? "inverse" : "forward", t.elapsed());
m_plans.push_back(m_currentPlan);
}

Wyświetl plik

@ -88,6 +88,10 @@ void MainParser::parse(const QCoreApplication& app)
qWarning() << "MainParser::parse: server port invalid. Defaulting to " << m_serverPort;
}
// FFTWF wisdom file
m_fftwfWindowFileName = m_parser.value(m_fftwfWisdomOption);
// MIMO - from version
QStringList versionParts = app.applicationVersion().split(".");