Mercurial > hg > qm-vamp-plugins
diff plugins/AdaptiveSpectrogram.h @ 114:496e6d6eb413
* Add "coarse" option
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Thu, 21 May 2009 16:40:24 +0000 |
parents | d0920575b48a |
children | dcf5800f0f00 |
line wrap: on
line diff
--- a/plugins/AdaptiveSpectrogram.h Wed May 20 08:52:11 2009 +0000 +++ b/plugins/AdaptiveSpectrogram.h Thu May 21 16:40:24 2009 +0000 @@ -56,6 +56,7 @@ protected: int m_w; int m_n; + bool m_coarse; bool m_threaded; struct Spectrogram @@ -255,12 +256,24 @@ return s.data[x][y]; } + inline double normalize(double vcost, double venergy) const { + return (vcost + (venergy * log(venergy))) / venergy; + } + + inline bool isResolutionWanted(const Spectrograms &s, int res) const { + if (!m_coarse) return true; + if (res == s.minres || res == s.maxres) return true; + int n = 0; + for (int r = res; r > s.minres; r >>= 1) ++n; + return ((n & 0x1) == 0); + } + Cutting *cut(const Spectrograms &, int res, int x, int y, int h, BlockAllocator *allocator) const; void getSubCuts(const Spectrograms &, int res, int x, int y, int h, - Cutting *&top, Cutting *&bottom, - Cutting *&left, Cutting *&right, + Cutting **top, Cutting **bottom, + Cutting **left, Cutting **right, BlockAllocator *allocator) const; void printCutting(Cutting *, std::string) const;