FFTMemoryCache Class Reference

#include <FFTMemoryCache.h>

Inherits FFTCache.

Inheritance diagram for FFTMemoryCache:

Inheritance graph
[legend]
Collaboration diagram for FFTMemoryCache:

Collaboration graph
[legend]
List of all members.

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 42 of file FFTMemoryCache.h.

Public Types

enum  StorageType { Compact, Rectangular, Polar }
enum  Type { MemoryCache, FileCache }

Public Member Functions

 FFTMemoryCache (StorageType storageType)
virtual ~FFTMemoryCache ()
virtual size_t getWidth () const
virtual size_t getHeight () const
virtual void resize (size_t width, size_t height)
virtual void reset ()
virtual float getMagnitudeAt (size_t x, size_t y) const
virtual float getNormalizedMagnitudeAt (size_t x, size_t y) const
virtual float getMaximumMagnitudeAt (size_t x) const
virtual float getPhaseAt (size_t x, size_t y) const
virtual void getValuesAt (size_t x, size_t y, float &real, float &imag) const
virtual bool haveSetColumnAt (size_t x) const
virtual void setColumnAt (size_t x, float *mags, float *phases, float factor)
virtual void setColumnAt (size_t x, float *reals, float *imags)
virtual Type getType ()
virtual void suspend ()

Static Public Member Functions

static size_t getCacheSize (size_t width, size_t height, StorageType type)

Private Member Functions

virtual void setNormalizationFactor (size_t x, float factor)
virtual void setMagnitudeAt (size_t x, size_t y, float mag)
virtual void setNormalizedMagnitudeAt (size_t x, size_t y, float norm)
virtual void setPhaseAt (size_t x, size_t y, float phase)
void resize (uint16_t **&, size_t, size_t)
void resize (float **&, size_t, size_t)

Private Attributes

size_t m_width
size_t 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
StorageType m_storageType
ResizeableBitset m_colset


Member Enumeration Documentation

enum FFTMemoryCache::StorageType

Enumerator:
Compact 
Rectangular 
Polar 

Definition at line 45 of file FFTMemoryCache.h.

enum FFTCache::Type [inherited]

Enumerator:
MemoryCache 
FileCache 

Definition at line 52 of file FFTCache.h.


Constructor & Destructor Documentation

FFTMemoryCache::FFTMemoryCache ( StorageType  storageType  ) 

Definition at line 23 of file FFTMemoryCache.cpp.

References m_storageType.

FFTMemoryCache::~FFTMemoryCache (  )  [virtual]

Definition at line 41 of file FFTMemoryCache.cpp.

References m_factor, m_fimag, m_fmagnitude, m_fphase, m_freal, m_magnitude, m_phase, and m_width.


Member Function Documentation

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

Implements FFTCache.

Definition at line 54 of file FFTMemoryCache.h.

References m_width.

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

Implements FFTCache.

Definition at line 55 of file FFTMemoryCache.h.

References m_height.

void FFTMemoryCache::resize ( size_t  width,
size_t  height 
) [virtual]

Implements FFTCache.

Definition at line 66 of file FFTMemoryCache.cpp.

References Compact, m_colset, m_factor, m_fimag, m_fmagnitude, m_fphase, m_freal, m_height, m_magnitude, m_phase, m_storageType, m_width, Polar, and ResizeableBitset::resize().

void FFTMemoryCache::reset (  )  [virtual]

Implements FFTCache.

Definition at line 146 of file FFTMemoryCache.cpp.

References Compact, m_factor, m_fimag, m_fmagnitude, m_fphase, m_freal, m_height, m_magnitude, m_phase, m_storageType, m_width, Polar, and Rectangular.

virtual float FFTMemoryCache::getMagnitudeAt ( size_t  x,
size_t  y 
) const [inline, virtual]

Implements FFTCache.

Definition at line 60 of file FFTMemoryCache.h.

References getNormalizedMagnitudeAt(), m_factor, m_fimag, m_freal, m_storageType, and Rectangular.

Referenced by getNormalizedMagnitudeAt(), and getValuesAt().

virtual float FFTMemoryCache::getNormalizedMagnitudeAt ( size_t  x,
size_t  y 
) const [inline, virtual]

Implements FFTCache.

Definition at line 69 of file FFTMemoryCache.h.

References getMagnitudeAt(), m_factor, m_fmagnitude, m_magnitude, m_storageType, Polar, and Rectangular.

Referenced by getMagnitudeAt().

virtual float FFTMemoryCache::getMaximumMagnitudeAt ( size_t  x  )  const [inline, virtual]

Implements FFTCache.

Definition at line 75 of file FFTMemoryCache.h.

References m_factor.

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

Implements FFTCache.

Definition at line 79 of file FFTMemoryCache.h.

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

Referenced by getValuesAt().

virtual void FFTMemoryCache::getValuesAt ( size_t  x,
size_t  y,
float &  real,
float &  imag 
) const [inline, virtual]

Implements FFTCache.

Definition at line 90 of file FFTMemoryCache.h.

References getMagnitudeAt(), getPhaseAt(), m_fimag, m_freal, m_storageType, and Rectangular.

virtual bool FFTMemoryCache::haveSetColumnAt ( size_t  x  )  const [inline, virtual]

Implements FFTCache.

Definition at line 102 of file FFTMemoryCache.h.

References ResizeableBitset::get(), and m_colset.

void FFTMemoryCache::setColumnAt ( size_t  x,
float *  mags,
float *  phases,
float  factor 
) [virtual]

Implements FFTCache.

Definition at line 183 of file FFTMemoryCache.cpp.

References m_colset, m_fimag, m_freal, m_height, m_storageType, Rectangular, ResizeableBitset::set(), setMagnitudeAt(), setNormalizationFactor(), and setPhaseAt().

Referenced by setColumnAt().

void FFTMemoryCache::setColumnAt ( size_t  x,
float *  reals,
float *  imags 
) [virtual]

Implements FFTCache.

Definition at line 203 of file FFTMemoryCache.cpp.

References Compact, m_colset, m_factor, m_fimag, m_freal, m_height, m_storageType, Polar, princargf(), Rectangular, ResizeableBitset::set(), and setColumnAt().

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

Definition at line 240 of file FFTMemoryCache.cpp.

References Compact, Polar, and Rectangular.

virtual Type FFTMemoryCache::getType (  )  [inline, virtual]

Implements FFTCache.

Definition at line 112 of file FFTMemoryCache.h.

References FFTCache::MemoryCache.

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

Definition at line 127 of file FFTMemoryCache.h.

References m_factor, and m_width.

Referenced by setColumnAt().

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

Definition at line 131 of file FFTMemoryCache.h.

References m_factor, and setNormalizedMagnitudeAt().

Referenced by setColumnAt().

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

Definition at line 136 of file FFTMemoryCache.h.

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

Referenced by setMagnitudeAt().

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

Definition at line 143 of file FFTMemoryCache.h.

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

Referenced by setColumnAt().

void FFTMemoryCache::resize ( uint16_t **&  ,
size_t  ,
size_t   
) [private]

Definition at line 98 of file FFTMemoryCache.cpp.

References m_width, and MUNLOCK.

void FFTMemoryCache::resize ( float **&  ,
size_t  ,
size_t   
) [private]

Definition at line 122 of file FFTMemoryCache.cpp.

References m_width, and MUNLOCK.

virtual void FFTCache::suspend (  )  [inline, virtual, inherited]

Reimplemented in FFTFileCache.

Definition at line 50 of file FFTCache.h.


Member Data Documentation

size_t FFTMemoryCache::m_width [private]

Definition at line 115 of file FFTMemoryCache.h.

Referenced by getWidth(), reset(), resize(), setNormalizationFactor(), setNormalizedMagnitudeAt(), setPhaseAt(), and ~FFTMemoryCache().

size_t FFTMemoryCache::m_height [private]

Definition at line 116 of file FFTMemoryCache.h.

Referenced by getHeight(), reset(), resize(), setColumnAt(), setNormalizedMagnitudeAt(), and setPhaseAt().

uint16_t** FFTMemoryCache::m_magnitude [private]

Definition at line 117 of file FFTMemoryCache.h.

Referenced by getNormalizedMagnitudeAt(), reset(), resize(), setNormalizedMagnitudeAt(), and ~FFTMemoryCache().

uint16_t** FFTMemoryCache::m_phase [private]

Definition at line 118 of file FFTMemoryCache.h.

Referenced by getPhaseAt(), reset(), resize(), setPhaseAt(), and ~FFTMemoryCache().

float** FFTMemoryCache::m_fmagnitude [private]

Definition at line 119 of file FFTMemoryCache.h.

Referenced by getNormalizedMagnitudeAt(), reset(), resize(), setNormalizedMagnitudeAt(), and ~FFTMemoryCache().

float** FFTMemoryCache::m_fphase [private]

Definition at line 120 of file FFTMemoryCache.h.

Referenced by getPhaseAt(), reset(), resize(), setPhaseAt(), and ~FFTMemoryCache().

float** FFTMemoryCache::m_freal [private]

Definition at line 121 of file FFTMemoryCache.h.

Referenced by getMagnitudeAt(), getPhaseAt(), getValuesAt(), reset(), resize(), setColumnAt(), and ~FFTMemoryCache().

float** FFTMemoryCache::m_fimag [private]

Definition at line 122 of file FFTMemoryCache.h.

Referenced by getMagnitudeAt(), getPhaseAt(), getValuesAt(), reset(), resize(), setColumnAt(), and ~FFTMemoryCache().

float* FFTMemoryCache::m_factor [private]

Definition at line 123 of file FFTMemoryCache.h.

Referenced by getMagnitudeAt(), getMaximumMagnitudeAt(), getNormalizedMagnitudeAt(), reset(), resize(), setColumnAt(), setMagnitudeAt(), setNormalizationFactor(), and ~FFTMemoryCache().

StorageType FFTMemoryCache::m_storageType [private]

Definition at line 124 of file FFTMemoryCache.h.

Referenced by FFTMemoryCache(), getMagnitudeAt(), getNormalizedMagnitudeAt(), getPhaseAt(), getValuesAt(), reset(), resize(), setColumnAt(), setNormalizedMagnitudeAt(), and setPhaseAt().

ResizeableBitset FFTMemoryCache::m_colset [private]

Definition at line 125 of file FFTMemoryCache.h.

Referenced by haveSetColumnAt(), resize(), and setColumnAt().


The documentation for this class was generated from the following files:
Generated on Wed Feb 20 15:45:33 2008 for SonicVisualiser by  doxygen 1.5.1