00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _FFT_FUZZY_ADAPTER_H_
00017 #define _FFT_FUZZY_ADAPTER_H_
00018
00019 #include "FFTDataServer.h"
00020
00021 class FFTFuzzyAdapter
00022 {
00023 public:
00024 FFTFuzzyAdapter(const DenseTimeValueModel *model,
00025 int channel,
00026 WindowType windowType,
00027 size_t windowSize,
00028 size_t windowIncrement,
00029 size_t fftSize,
00030 bool polar,
00031 size_t fillFromColumn = 0);
00032 ~FFTFuzzyAdapter();
00033
00034 size_t getWidth() const {
00035 return m_server->getWidth() >> m_xshift;
00036 }
00037 size_t getHeight() const {
00038 return m_server->getHeight() >> m_yshift;
00039 }
00040 float getMagnitudeAt(size_t x, size_t y) {
00041 return m_server->getMagnitudeAt(x << m_xshift, y << m_yshift);
00042 }
00043 float getNormalizedMagnitudeAt(size_t x, size_t y) {
00044 return m_server->getNormalizedMagnitudeAt(x << m_xshift, y << m_yshift);
00045 }
00046 float getMaximumMagnitudeAt(size_t x) {
00047 return m_server->getMaximumMagnitudeAt(x << m_xshift);
00048 }
00049 float getPhaseAt(size_t x, size_t y) {
00050 return m_server->getPhaseAt(x << m_xshift, y << m_yshift);
00051 }
00052 void getValuesAt(size_t x, size_t y, float &real, float &imaginary) {
00053 m_server->getValuesAt(x << m_xshift, y << m_yshift, real, imaginary);
00054 }
00055 bool isColumnReady(size_t x) {
00056 return m_server->isColumnReady(x << m_xshift);
00057 }
00058 bool isLocalPeak(size_t x, size_t y) {
00059 float mag = getMagnitudeAt(x, y);
00060 if (y > 0 && mag < getMagnitudeAt(x, y - 1)) return false;
00061 if (y < getHeight() - 1 && mag < getMagnitudeAt(x, y + 1)) return false;
00062 return true;
00063 }
00064 bool isOverThreshold(size_t x, size_t y, float threshold) {
00065 return getMagnitudeAt(x, y) > threshold;
00066 }
00067
00068 size_t getFillCompletion() const { return m_server->getFillCompletion(); }
00069 size_t getFillExtent() const { return m_server->getFillExtent(); }
00070
00071 private:
00072 FFTFuzzyAdapter(const FFTFuzzyAdapter &);
00073 FFTFuzzyAdapter &operator=(const FFTFuzzyAdapter &);
00074
00075 FFTDataServer *m_server;
00076 int m_xshift;
00077 int m_yshift;
00078 };
00079
00080 #endif