annotate dsp/rateconversion/Decimator.h @ 209:ccd2019190bf msvc

Some MSVC fixes, including (temporarily, probably) renaming the FFT source file to avoid getting it mixed up with the Vamp SDK one in our object dir
author Chris Cannam
date Thu, 01 Feb 2018 16:34:08 +0000
parents 4f092806782b
children fdaa63607c15
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
Chris@150 18 /**
Chris@150 19 * Decimator carries out a fast downsample by a power-of-two
Chris@150 20 * factor. Only a limited number of factors are supported, from two to
Chris@150 21 * whatever getHighestSupportedFactor() returns. This is much faster
Chris@150 22 * than Resampler but has a worse signal-noise ratio.
Chris@150 23 */
cannam@0 24 class Decimator
cannam@0 25 {
cannam@0 26 public:
cannam@54 27 /**
cannam@54 28 * Construct a Decimator to operate on input blocks of length
cannam@54 29 * inLength, with decimation factor decFactor. inLength should be
cannam@54 30 * a multiple of decFactor. Output blocks will be of length
cannam@54 31 * inLength / decFactor.
cannam@54 32 *
cannam@54 33 * decFactor must be a power of two. The highest supported factor
cannam@54 34 * is obtained through getHighestSupportedFactor(); for higher
cannam@54 35 * factors, you will need to chain more than one decimator.
cannam@54 36 */
cannam@0 37 Decimator( unsigned int inLength, unsigned int decFactor );
cannam@0 38 virtual ~Decimator();
cannam@0 39
Chris@163 40 /**
Chris@163 41 * Process inLength samples (as supplied to constructor) from src
Chris@163 42 * and write inLength / decFactor samples to dst. Note that src
Chris@163 43 * and dst may be the same or overlap (an intermediate buffer is
Chris@163 44 * used).
Chris@163 45 */
Chris@163 46 void process( const double* src, double* dst );
Chris@163 47
Chris@163 48 /**
Chris@163 49 * Process inLength samples (as supplied to constructor) from src
Chris@163 50 * and write inLength / decFactor samples to dst. Note that src
Chris@163 51 * and dst may be the same or overlap (an intermediate buffer is
Chris@163 52 * used).
Chris@163 53 */
Chris@163 54 void process( const float* src, float* dst );
Chris@163 55
cannam@22 56 int getFactor() const { return m_decFactor; }
cannam@22 57 static int getHighestSupportedFactor() { return 8; }
cannam@22 58
Chris@163 59 void resetFilter();
Chris@163 60
cannam@0 61 private:
cannam@0 62 void deInitialise();
cannam@0 63 void initialise( unsigned int inLength, unsigned int decFactor );
cannam@55 64 void doAntiAlias( const double* src, double* dst, unsigned int length );
cannam@55 65 void doAntiAlias( const float* src, double* dst, unsigned int length );
cannam@0 66
cannam@0 67 unsigned int m_inputLength;
cannam@0 68 unsigned int m_outputLength;
cannam@0 69 unsigned int m_decFactor;
cannam@0 70
cannam@0 71 double Input;
cannam@0 72 double Output ;
cannam@0 73
cannam@0 74 double o1,o2,o3,o4,o5,o6,o7;
cannam@0 75
cannam@0 76 double a[ 9 ];
cannam@0 77 double b[ 9 ];
cannam@0 78
cannam@0 79 double* decBuffer;
cannam@0 80 };
cannam@0 81
cannam@0 82 #endif //