1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
5 Centre for Digital Music, Queen Mary, University of London.
6 This file 2005-2006 Christian Landone.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
19 * Decimator carries out a fast downsample by a power-of-two
20 * factor. Only a limited number of factors are supported, from two to
21 * whatever getHighestSupportedFactor() returns. This is much faster
22 * than Resampler but has a worse signal-noise ratio.
28 * Construct a Decimator to operate on input blocks of length
29 * inLength, with decimation factor decFactor. inLength should be
30 * a multiple of decFactor. Output blocks will be of length
31 * inLength / decFactor.
33 * decFactor must be a power of two. The highest supported factor
34 * is obtained through getHighestSupportedFactor(); for higher
35 * factors, you will need to chain more than one decimator.
37 Decimator( unsigned int inLength, unsigned int decFactor );
41 * Process inLength samples (as supplied to constructor) from src
42 * and write inLength / decFactor samples to dst. Note that src
43 * and dst may be the same or overlap (an intermediate buffer is
46 void process( const double* src, double* dst );
49 * Process inLength samples (as supplied to constructor) from src
50 * and write inLength / decFactor samples to dst. Note that src
51 * and dst may be the same or overlap (an intermediate buffer is
54 void process( const float* src, float* dst );
56 int getFactor() const { return m_decFactor; }
57 static int getHighestSupportedFactor() { return 8; }
63 void initialise( unsigned int inLength, unsigned int decFactor );
64 void doAntiAlias( const double* src, double* dst, unsigned int length );
65 void doAntiAlias( const float* src, double* dst, unsigned int length );
67 unsigned int m_inputLength;
68 unsigned int m_outputLength;
69 unsigned int m_decFactor;
74 double o1,o2,o3,o4,o5,o6,o7;