annotate dsp/rateconversion/Decimator.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 f7edcd9138bd
children 7fe29d8a7eaf
rev   line source
cannam@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@0 2 /*
cannam@0 3 QM DSP Library
cannam@0 4
cannam@0 5 Centre for Digital Music, Queen Mary, University of London.
cannam@0 6 This file copyright 2005-2006 Christian Landone.
cannam@0 7 All rights reserved.
cannam@0 8 */
cannam@0 9
cannam@0 10 #ifndef DECIMATOR_H
cannam@0 11 #define DECIMATOR_H
cannam@0 12
cannam@0 13 class Decimator
cannam@0 14 {
cannam@0 15 public:
cannam@22 16 void process( const double* src, double* dst );
cannam@22 17 void doAntiAlias( const double* src, double* dst, unsigned int length );
cannam@0 18
cannam@54 19 /**
cannam@54 20 * Construct a Decimator to operate on input blocks of length
cannam@54 21 * inLength, with decimation factor decFactor. inLength should be
cannam@54 22 * a multiple of decFactor. Output blocks will be of length
cannam@54 23 * inLength / decFactor.
cannam@54 24 *
cannam@54 25 * decFactor must be a power of two. The highest supported factor
cannam@54 26 * is obtained through getHighestSupportedFactor(); for higher
cannam@54 27 * factors, you will need to chain more than one decimator.
cannam@54 28 */
cannam@0 29 Decimator( unsigned int inLength, unsigned int decFactor );
cannam@0 30 virtual ~Decimator();
cannam@0 31
cannam@22 32 int getFactor() const { return m_decFactor; }
cannam@22 33 static int getHighestSupportedFactor() { return 8; }
cannam@22 34
cannam@0 35 private:
cannam@0 36 void resetFilter();
cannam@0 37 void deInitialise();
cannam@0 38 void initialise( unsigned int inLength, unsigned int decFactor );
cannam@0 39
cannam@0 40 unsigned int m_inputLength;
cannam@0 41 unsigned int m_outputLength;
cannam@0 42 unsigned int m_decFactor;
cannam@0 43
cannam@0 44 double Input;
cannam@0 45 double Output ;
cannam@0 46
cannam@0 47 double o1,o2,o3,o4,o5,o6,o7;
cannam@0 48
cannam@0 49 double a[ 9 ];
cannam@0 50 double b[ 9 ];
cannam@0 51
cannam@0 52 double* decBuffer;
cannam@0 53 };
cannam@0 54
cannam@0 55 #endif //