Mercurial > hg > qm-dsp
comparison maths/MathUtilities.h @ 54:5bec06ecc88a
* First cut at Matthew's downbeat estimator -- untested so far
| author | cannam |
|---|---|
| date | Tue, 10 Feb 2009 12:52:43 +0000 |
| parents | ad645e404d0c |
| children | 7fe29d8a7eaf |
comparison
equal
deleted
inserted
replaced
| 53:796170a9c8e4 | 54:5bec06ecc88a |
|---|---|
| 19 static double round( double x ); | 19 static double round( double x ); |
| 20 | 20 |
| 21 static void getFrameMinMax( const double* data, unsigned int len, double* min, double* max ); | 21 static void getFrameMinMax( const double* data, unsigned int len, double* min, double* max ); |
| 22 | 22 |
| 23 static double mean( const double* src, unsigned int len ); | 23 static double mean( const double* src, unsigned int len ); |
| 24 static double mean( const std::vector<double> &data, | |
| 25 unsigned int start, unsigned int count ); | |
| 24 static double sum( const double* src, unsigned int len ); | 26 static double sum( const double* src, unsigned int len ); |
| 25 static double median( const double* src, unsigned int len ); | 27 static double median( const double* src, unsigned int len ); |
| 26 | 28 |
| 27 static double princarg( double ang ); | 29 static double princarg( double ang ); |
| 28 static double mod( double x, double y); | 30 static double mod( double x, double y); |
| 30 static void getAlphaNorm(const double *data, unsigned int len, unsigned int alpha, double* ANorm); | 32 static void getAlphaNorm(const double *data, unsigned int len, unsigned int alpha, double* ANorm); |
| 31 static double getAlphaNorm(const std::vector <double> &data, unsigned int alpha ); | 33 static double getAlphaNorm(const std::vector <double> &data, unsigned int alpha ); |
| 32 | 34 |
| 33 static void circShift( double* data, int length, int shift); | 35 static void circShift( double* data, int length, int shift); |
| 34 | 36 |
| 35 static int getMax( double* data, unsigned int length, double* max ); | 37 static int getMax( double* data, unsigned int length, double* max = 0 ); |
| 38 static int getMax( const std::vector<double> &data, double* max = 0 ); | |
| 36 static int compareInt(const void * a, const void * b); | 39 static int compareInt(const void * a, const void * b); |
| 37 | 40 |
| 38 enum NormaliseType { | 41 enum NormaliseType { |
| 39 NormaliseNone, | 42 NormaliseNone, |
| 40 NormaliseUnitSum, | 43 NormaliseUnitSum, |
| 44 static void normalise(double *data, int length, | 47 static void normalise(double *data, int length, |
| 45 NormaliseType n = NormaliseUnitMax); | 48 NormaliseType n = NormaliseUnitMax); |
| 46 | 49 |
| 47 static void normalise(std::vector<double> &data, | 50 static void normalise(std::vector<double> &data, |
| 48 NormaliseType n = NormaliseUnitMax); | 51 NormaliseType n = NormaliseUnitMax); |
| 52 | |
| 53 // moving mean threshholding: | |
| 54 static void adaptiveThreshold(std::vector<double> &data); | |
| 49 }; | 55 }; |
| 50 | 56 |
| 51 #endif | 57 #endif |
