Mercurial > hg > svgui
comparison layer/SpectrogramLayer.h @ 484:a926fca1f280
* Make use of peak cache in spectrogram
author | Chris Cannam |
---|---|
date | Wed, 04 Feb 2009 15:03:42 +0000 |
parents | 74a7729e3653 |
children | c860cab85904 |
comparison
equal
deleted
inserted
replaced
483:18f38f564d7c | 484:a926fca1f280 |
---|---|
34 class QPainter; | 34 class QPainter; |
35 class QImage; | 35 class QImage; |
36 class QPixmap; | 36 class QPixmap; |
37 class QTimer; | 37 class QTimer; |
38 class FFTModel; | 38 class FFTModel; |
39 class Dense3DModelPeakCache; | |
39 | 40 |
40 | 41 |
41 /** | 42 /** |
42 * SpectrogramLayer represents waveform data (obtained from a | 43 * SpectrogramLayer represents waveform data (obtained from a |
43 * DenseTimeValueModel) in spectrogram form. | 44 * DenseTimeValueModel) in spectrogram form. |
233 | 234 |
234 void fillTimerTimedOut(); | 235 void fillTimerTimedOut(); |
235 | 236 |
236 protected: | 237 protected: |
237 const DenseTimeValueModel *m_model; // I do not own this | 238 const DenseTimeValueModel *m_model; // I do not own this |
238 | 239 |
239 int m_channel; | 240 int m_channel; |
240 size_t m_windowSize; | 241 size_t m_windowSize; |
241 WindowType m_windowType; | 242 WindowType m_windowType; |
242 size_t m_windowHopLevel; | 243 size_t m_windowHopLevel; |
243 size_t m_zeroPadLevel; | 244 size_t m_zeroPadLevel; |
350 } | 351 } |
351 | 352 |
352 size_t getZeroPadLevel(const View *v) const; | 353 size_t getZeroPadLevel(const View *v) const; |
353 size_t getFFTSize(const View *v) const; | 354 size_t getFFTSize(const View *v) const; |
354 FFTModel *getFFTModel(const View *v) const; | 355 FFTModel *getFFTModel(const View *v) const; |
356 Dense3DModelPeakCache *getPeakCache(const View *v) const; | |
355 void invalidateFFTModels(); | 357 void invalidateFFTModels(); |
356 | 358 |
357 typedef std::pair<FFTModel *, int> FFTFillPair; // model, last fill | 359 typedef std::pair<FFTModel *, int> FFTFillPair; // model, last fill |
358 typedef std::map<const View *, FFTFillPair> ViewFFTMap; | 360 typedef std::map<const View *, FFTFillPair> ViewFFTMap; |
359 typedef std::vector<float> FloatVector; | 361 typedef std::map<const View *, Dense3DModelPeakCache *> PeakCacheMap; |
360 mutable ViewFFTMap m_fftModels; | 362 mutable ViewFFTMap m_fftModels; |
363 mutable PeakCacheMap m_peakCaches; | |
361 mutable Model *m_sliceableModel; | 364 mutable Model *m_sliceableModel; |
362 | 365 |
363 class MagnitudeRange { | 366 class MagnitudeRange { |
364 public: | 367 public: |
365 MagnitudeRange() : m_min(0), m_max(0) { } | 368 MagnitudeRange() : m_min(0), m_max(0) { } |
411 typedef std::map<const View *, MagnitudeRange> ViewMagMap; | 414 typedef std::map<const View *, MagnitudeRange> ViewMagMap; |
412 mutable ViewMagMap m_viewMags; | 415 mutable ViewMagMap m_viewMags; |
413 mutable std::vector<MagnitudeRange> m_columnMags; | 416 mutable std::vector<MagnitudeRange> m_columnMags; |
414 void invalidateMagnitudes(); | 417 void invalidateMagnitudes(); |
415 bool updateViewMagnitudes(View *v) const; | 418 bool updateViewMagnitudes(View *v) const; |
416 bool paintDrawBuffer(View *v, FFTModel *fft, int w, int h, | 419 bool paintDrawBuffer(View *v, int w, int h, |
417 int *binforx, int *binfory) const; | 420 int *binforx, int *binfory, |
421 bool usePeaksCache) const; | |
418 //!!! phasing this one out: | 422 //!!! phasing this one out: |
419 bool paintColumnValues(View *v, FFTModel *fft, int x0, int x, | 423 bool paintColumnValues(View *v, FFTModel *fft, int x0, int x, |
420 int minbin, int maxbin, | 424 int minbin, int maxbin, |
421 float displayMinFreq, float displayMaxFreq, | 425 float displayMinFreq, float displayMaxFreq, |
422 float xPixelRatio, | 426 float xPixelRatio, |