annotate dsp/rateconversion/Decimator.h @ 84:e5907ae6de17

* Add GPL and README; some tidying
author Chris Cannam
date Mon, 13 Dec 2010 14:55:28 +0000
parents 7fe29d8a7eaf
children 23558405a7d1
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.
Chris@84 6 This file 2005-2006 Christian Landone.
Chris@84 7
Chris@84 8 This program is free software; you can redistribute it and/or
Chris@84 9 modify it under the terms of the GNU General Public License as
Chris@84 10 published by the Free Software Foundation; either version 2 of the
Chris@84 11 License, or (at your option) any later version. See the file
Chris@84 12 COPYING included with this distribution for more information.
cannam@0 13 */
cannam@0 14
cannam@0 15 #ifndef DECIMATOR_H
cannam@0 16 #define DECIMATOR_H
cannam@0 17
cannam@0 18 class Decimator
cannam@0 19 {
cannam@0 20 public:
cannam@22 21 void process( const double* src, double* dst );
cannam@55 22 void process( const float* src, float* dst );
cannam@0 23
cannam@54 24 /**
cannam@54 25 * Construct a Decimator to operate on input blocks of length
cannam@54 26 * inLength, with decimation factor decFactor. inLength should be
cannam@54 27 * a multiple of decFactor. Output blocks will be of length
cannam@54 28 * inLength / decFactor.
cannam@54 29 *
cannam@54 30 * decFactor must be a power of two. The highest supported factor
cannam@54 31 * is obtained through getHighestSupportedFactor(); for higher
cannam@54 32 * factors, you will need to chain more than one decimator.
cannam@54 33 */
cannam@0 34 Decimator( unsigned int inLength, unsigned int decFactor );
cannam@0 35 virtual ~Decimator();
cannam@0 36
cannam@22 37 int getFactor() const { return m_decFactor; }
cannam@22 38 static int getHighestSupportedFactor() { return 8; }
cannam@22 39
cannam@0 40 private:
cannam@0 41 void resetFilter();
cannam@0 42 void deInitialise();
cannam@0 43 void initialise( unsigned int inLength, unsigned int decFactor );
cannam@55 44 void doAntiAlias( const double* src, double* dst, unsigned int length );
cannam@55 45 void doAntiAlias( const float* src, double* dst, unsigned int length );
cannam@0 46
cannam@0 47 unsigned int m_inputLength;
cannam@0 48 unsigned int m_outputLength;
cannam@0 49 unsigned int m_decFactor;
cannam@0 50
cannam@0 51 double Input;
cannam@0 52 double Output ;
cannam@0 53
cannam@0 54 double o1,o2,o3,o4,o5,o6,o7;
cannam@0 55
cannam@0 56 double a[ 9 ];
cannam@0 57 double b[ 9 ];
cannam@0 58
cannam@0 59 double* decBuffer;
cannam@0 60 };
cannam@0 61
cannam@0 62 #endif //