mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-04 16:01:14 -05:00
FFT factory: corrected sequence type and added debug message
This commit is contained in:
parent
47b8dc199b
commit
2764fd6083
@ -73,6 +73,7 @@ unsigned int FFTFactory::getEngine(unsigned int fftSize, bool inverse, FFTEngine
|
|||||||
|
|
||||||
if (enginesBySize.find(fftSize) == enginesBySize.end())
|
if (enginesBySize.find(fftSize) == enginesBySize.end())
|
||||||
{
|
{
|
||||||
|
qDebug("FFTFactory::getEngine: new FFT %s size: %u", (inverse ? "inv" : "fwd"), fftSize);
|
||||||
enginesBySize.insert(std::pair<unsigned int, std::vector<AllocatedEngine>>(fftSize, std::vector<AllocatedEngine>()));
|
enginesBySize.insert(std::pair<unsigned int, std::vector<AllocatedEngine>>(fftSize, std::vector<AllocatedEngine>()));
|
||||||
std::vector<AllocatedEngine>& engines = enginesBySize[fftSize];
|
std::vector<AllocatedEngine>& engines = enginesBySize[fftSize];
|
||||||
engines.push_back(AllocatedEngine());
|
engines.push_back(AllocatedEngine());
|
||||||
@ -95,6 +96,7 @@ unsigned int FFTFactory::getEngine(unsigned int fftSize, bool inverse, FFTEngine
|
|||||||
|
|
||||||
if (i < enginesBySize[fftSize].size())
|
if (i < enginesBySize[fftSize].size())
|
||||||
{
|
{
|
||||||
|
qDebug("FFTFactory::getEngine: reuse engine: %u FFT %s size: %u", i, (inverse ? "inv" : "fwd"), fftSize);
|
||||||
enginesBySize[fftSize][i].m_inUse = true;
|
enginesBySize[fftSize][i].m_inUse = true;
|
||||||
*engine = enginesBySize[fftSize][i].m_engine;
|
*engine = enginesBySize[fftSize][i].m_engine;
|
||||||
return i;
|
return i;
|
||||||
@ -102,6 +104,7 @@ unsigned int FFTFactory::getEngine(unsigned int fftSize, bool inverse, FFTEngine
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<AllocatedEngine>& engines = enginesBySize[fftSize];
|
std::vector<AllocatedEngine>& engines = enginesBySize[fftSize];
|
||||||
|
qDebug("FFTFactory::getEngine: create engine: %lu FFT %s size: %u", engines.size(), (inverse ? "inv" : "fwd"), fftSize);
|
||||||
engines.push_back(AllocatedEngine());
|
engines.push_back(AllocatedEngine());
|
||||||
engines.back().m_inUse = true;
|
engines.back().m_inUse = true;
|
||||||
engines.back().m_engine = FFTEngine::create(m_fftwWisdomFileName);
|
engines.back().m_engine = FFTEngine::create(m_fftwWisdomFileName);
|
||||||
@ -112,7 +115,7 @@ unsigned int FFTFactory::getEngine(unsigned int fftSize, bool inverse, FFTEngine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FFTFactory::releaseEngine(unsigned int fftSize, bool inverse, int engineSequence)
|
void FFTFactory::releaseEngine(unsigned int fftSize, bool inverse, unsigned int engineSequence)
|
||||||
{
|
{
|
||||||
std::map<unsigned int, std::vector<AllocatedEngine>>& enginesBySize = inverse ?
|
std::map<unsigned int, std::vector<AllocatedEngine>>& enginesBySize = inverse ?
|
||||||
m_invFFTEngineBySize : m_fftEngineBySize;
|
m_invFFTEngineBySize : m_fftEngineBySize;
|
||||||
@ -121,7 +124,10 @@ void FFTFactory::releaseEngine(unsigned int fftSize, bool inverse, int engineSeq
|
|||||||
{
|
{
|
||||||
std::vector<AllocatedEngine>& engines = enginesBySize[fftSize];
|
std::vector<AllocatedEngine>& engines = enginesBySize[fftSize];
|
||||||
|
|
||||||
if (engineSequence < engines.size()) {
|
if (engineSequence < engines.size())
|
||||||
|
{
|
||||||
|
qDebug("FFTFactory::releaseEngine: engineSequence: %u FFT %s size: %u",
|
||||||
|
engineSequence, (inverse ? "inv" : "fwd"), fftSize);
|
||||||
engines[engineSequence].m_inUse = false;
|
engines[engineSequence].m_inUse = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
void preallocate(unsigned int minLog2Size, unsigned int maxLog2Size, unsigned int numberFFT, unsigned int numberInvFFT);
|
void preallocate(unsigned int minLog2Size, unsigned int maxLog2Size, unsigned int numberFFT, unsigned int numberInvFFT);
|
||||||
unsigned int getEngine(unsigned int fftSize, bool inverse, FFTEngine **engine); //!< returns an engine sequence
|
unsigned int getEngine(unsigned int fftSize, bool inverse, FFTEngine **engine); //!< returns an engine sequence
|
||||||
void releaseEngine(unsigned int fftSize, bool inverse, int engineSequence);
|
void releaseEngine(unsigned int fftSize, bool inverse, unsigned int engineSequence);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct AllocatedEngine
|
struct AllocatedEngine
|
||||||
|
Loading…
Reference in New Issue
Block a user