svcore  1.9
FFTMemoryCache Class Reference

In-memory FFT cache. More...

#include <FFTMemoryCache.h>

Inheritance diagram for FFTMemoryCache:
Collaboration diagram for FFTMemoryCache:

List of all members.

Public Member Functions

 FFTMemoryCache (FFTCache::StorageType storageType, int width, int height)
 ~FFTMemoryCache ()
int getWidth () const
int getHeight () const
float getMagnitudeAt (int x, int y) const
float getNormalizedMagnitudeAt (int x, int y) const
float getMaximumMagnitudeAt (int x) const
float getPhaseAt (int x, int y) const
void getValuesAt (int x, int y, float &real, float &imag) const
void getMagnitudesAt (int x, float *values, int minbin, int count, int step) const
bool haveSetColumnAt (int x) const
void setColumnAt (int x, float *mags, float *phases, float factor)
void setColumnAt (int x, float *reals, float *imags)
void allColumnsWritten ()
FFTCache::StorageType getStorageType () const

Static Public Member Functions

static int getCacheSize (int width, int height, FFTCache::StorageType type)

Private Member Functions

void initialise ()
void setNormalizationFactor (int x, float factor)
void setMagnitudeAt (int x, int y, float mag)
void setNormalizedMagnitudeAt (int x, int y, float norm)
void setPhaseAt (int x, int y, float phase)
void initialise (uint16_t **&)
void initialise (float **&)

Private Attributes

int m_width
int m_height
uint16_t ** m_magnitude
uint16_t ** m_phase
float ** m_fmagnitude
float ** m_fphase
float ** m_freal
float ** m_fimag
float * m_factor
FFTCache::StorageType m_storageType
ResizeableBitset m_colset
QReadWriteLock m_colsetLock

Detailed Description

In-memory FFT cache.

For this we want to cache magnitude with enough resolution to have gain applied afterwards and determine whether something is a peak or not, and also cache phase rather than only phase-adjusted frequency so that we don't have to recalculate if switching between phase and magnitude displays. At the same time, we don't want to take up too much memory. It's not expected to be accurate enough to be used as input for DSP or resynthesis code.

This implies probably 16 bits for a normalized magnitude and at most 16 bits for phase.

Each column's magnitudes are expected to be stored normalized to [0,1] with respect to the column, so the normalization factor should be calculated before all values in a column, and set appropriately.

Definition at line 46 of file FFTMemoryCache.h.


Constructor & Destructor Documentation

FFTMemoryCache::FFTMemoryCache ( FFTCache::StorageType  storageType,
int  width,
int  height 
)

Definition at line 24 of file FFTMemoryCache.cpp.

References initialise(), m_height, m_storageType, and m_width.


Member Function Documentation

int FFTMemoryCache::getWidth ( ) const [inline, virtual]

Implements FFTCacheReader.

Definition at line 53 of file FFTMemoryCache.h.

References m_width.

int FFTMemoryCache::getHeight ( ) const [inline, virtual]

Implements FFTCacheReader.

Definition at line 54 of file FFTMemoryCache.h.

References m_height.

float FFTMemoryCache::getMagnitudeAt ( int  x,
int  y 
) const [inline, virtual]
float FFTMemoryCache::getNormalizedMagnitudeAt ( int  x,
int  y 
) const [inline, virtual]
float FFTMemoryCache::getMaximumMagnitudeAt ( int  x) const [inline, virtual]

Implements FFTCacheReader.

Definition at line 72 of file FFTMemoryCache.h.

References m_factor.

float FFTMemoryCache::getPhaseAt ( int  x,
int  y 
) const [inline, virtual]

Implements FFTCacheReader.

Definition at line 76 of file FFTMemoryCache.h.

References m_fimag, m_fphase, m_freal, m_phase, m_storageType, FFTCache::Polar, and FFTCache::Rectangular.

Referenced by getValuesAt().

void FFTMemoryCache::getValuesAt ( int  x,
int  y,
float &  real,
float &  imag 
) const [inline, virtual]
void FFTMemoryCache::getMagnitudesAt ( int  x,
float *  values,
int  minbin,
int  count,
int  step 
) const [inline, virtual]
bool FFTMemoryCache::haveSetColumnAt ( int  x) const [inline, virtual]

Implements FFTCacheReader.

Definition at line 122 of file FFTMemoryCache.h.

References ResizeableBitset::get(), m_colset, and m_colsetLock.

void FFTMemoryCache::setColumnAt ( int  x,
float *  mags,
float *  phases,
float  factor 
) [virtual]
void FFTMemoryCache::setColumnAt ( int  x,
float *  reals,
float *  imags 
) [virtual]
void FFTMemoryCache::allColumnsWritten ( ) [inline, virtual]

Implements FFTCacheWriter.

Definition at line 133 of file FFTMemoryCache.h.

int FFTMemoryCache::getCacheSize ( int  width,
int  height,
FFTCache::StorageType  type 
) [static]

Definition at line 200 of file FFTMemoryCache.cpp.

References FFTCache::Compact, FFTCache::Polar, and FFTCache::Rectangular.

Implements FFTCacheReader.

Definition at line 138 of file FFTMemoryCache.h.

References m_storageType.

void FFTMemoryCache::setNormalizationFactor ( int  x,
float  factor 
) [inline, private]

Definition at line 156 of file FFTMemoryCache.h.

References m_factor, and m_width.

Referenced by setColumnAt().

void FFTMemoryCache::setMagnitudeAt ( int  x,
int  y,
float  mag 
) [inline, private]

Definition at line 160 of file FFTMemoryCache.h.

References m_factor, and setNormalizedMagnitudeAt().

Referenced by setColumnAt().

void FFTMemoryCache::setNormalizedMagnitudeAt ( int  x,
int  y,
float  norm 
) [inline, private]

Definition at line 165 of file FFTMemoryCache.h.

References m_fmagnitude, m_height, m_magnitude, m_storageType, m_width, and FFTCache::Polar.

Referenced by setMagnitudeAt().

void FFTMemoryCache::setPhaseAt ( int  x,
int  y,
float  phase 
) [inline, private]

Definition at line 172 of file FFTMemoryCache.h.

References m_fphase, m_height, m_phase, m_storageType, m_width, and FFTCache::Polar.

Referenced by setColumnAt().

void FFTMemoryCache::initialise ( uint16_t **&  array) [private]

Definition at line 104 of file FFTMemoryCache.cpp.

References m_height, m_width, and MUNLOCK.

void FFTMemoryCache::initialise ( float **&  array) [private]

Definition at line 118 of file FFTMemoryCache.cpp.

References m_height, m_width, and MUNLOCK.


Member Data Documentation

uint16_t** FFTMemoryCache::m_phase [private]

Definition at line 144 of file FFTMemoryCache.h.

Referenced by getPhaseAt(), initialise(), setPhaseAt(), and ~FFTMemoryCache().

float** FFTMemoryCache::m_fphase [private]

Definition at line 146 of file FFTMemoryCache.h.

Referenced by getPhaseAt(), initialise(), setPhaseAt(), and ~FFTMemoryCache().

QReadWriteLock FFTMemoryCache::m_colsetLock [mutable, private]

Definition at line 152 of file FFTMemoryCache.h.

Referenced by haveSetColumnAt(), and setColumnAt().


The documentation for this class was generated from the following files: