Mercurial > hg > aimc
annotate trunk/src/Modules/Output/Graphics/Scale/ScaleLog.h @ 706:f8e90b5d85fd tip
Delete CARFAC code from this repository.
It has been moved to https://github.com/google/carfac
Please email me with your github username to get access.
I've also created a new mailing list to discuss CARFAC development:
https://groups.google.com/forum/#!forum/carfac-dev
author | ronw@google.com |
---|---|
date | Thu, 18 Jul 2013 20:56:51 +0000 |
parents | dd13c9834ceb |
children |
rev | line source |
---|---|
tomwalters@397 | 1 /*! |
tomwalters@397 | 2 * \file |
tomwalters@397 | 3 * \brief Logarithmic frequency scale for generating filter banks and their frequencies |
tomwalters@397 | 4 * |
tomwalters@397 | 5 * \author Willem van Engen <cnbh@willem.engen.nl> |
tomwalters@397 | 6 * \date created 2006/09/28 |
tomwalters@397 | 7 * \version \$Id: ScaleLog.h 459 2007-11-08 11:50:04Z tom $ |
tomwalters@397 | 8 */ |
tomwalters@397 | 9 /* (c) 2006, University of Cambridge, Medical Research Council |
tomwalters@397 | 10 * http://www.pdn.cam.ac.uk/groups/cnbh/aimmanual |
tomwalters@397 | 11 */ |
tomwalters@397 | 12 #ifndef __MODULE_SCALE_LOG_H__ |
tomwalters@397 | 13 #define __MODULE_SCALE_LOG_H__ |
tomwalters@397 | 14 |
tomwalters@397 | 15 #include <math.h> |
tomwalters@397 | 16 |
tom@400 | 17 #include "Modules/Output/Graphics/Scale/Scale.h" |
tom@400 | 18 |
tom@400 | 19 namespace aimc { |
tomwalters@397 | 20 |
tomwalters@397 | 21 /*! |
tomwalters@397 | 22 * \class ScaleLog "Modules/Scale/ScaleLog.h" |
tomwalters@397 | 23 * \brief Logarithmic frequency scale for generating filter banks and their frequencies |
tomwalters@397 | 24 * |
tomwalters@397 | 25 * It is very advisable to use Scale::Create() to an instance of this scale. |
tomwalters@397 | 26 */ |
tomwalters@397 | 27 class ScaleLog : public Scale { |
tomwalters@397 | 28 public: |
tomwalters@398 | 29 ScaleLog(unsigned int min, unsigned int max, float density) |
tomwalters@398 | 30 : Scale(min, max, density) { m_iType = SCALE_LOG; m_sName="log"; }; |
tomwalters@397 | 31 |
tomwalters@398 | 32 /*! The log scale has a problem, because log(0)=inf, so all values below |
tomwalters@398 | 33 * 1e-5 are truncated to 1e-5. */ |
tomwalters@398 | 34 float FromLinear(float fFreq) { |
tomwalters@398 | 35 if (fFreq<1e-5f) fFreq=1e-5f; |
tomwalters@398 | 36 return log(fFreq); |
tomwalters@398 | 37 }; |
tomwalters@397 | 38 |
tomwalters@398 | 39 float ToLinear(float fFreq) { |
tomwalters@398 | 40 return exp(fFreq); |
tomwalters@398 | 41 }; |
tomwalters@397 | 42 }; |
tom@400 | 43 } // namespace aimc |
tomwalters@397 | 44 #endif /* __MODULE_SCALE_LOG_H__ */ |