annotate vamp-sdk/FFT.h @ 395:96cdf661d538

Merge from branch vh
author Chris Cannam
date Tue, 16 Jun 2015 10:12:36 +0100
parents a69901aa85d2
children e979a9c4ffb6
rev   line source
Chris@337 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@337 2
Chris@337 3 /*
Chris@337 4 Vamp
Chris@337 5
Chris@337 6 An API for audio analysis and feature extraction plugins.
Chris@337 7
Chris@337 8 Centre for Digital Music, Queen Mary, University of London.
Chris@337 9 Copyright 2006-2012 Chris Cannam and QMUL.
Chris@337 10
Chris@337 11 Permission is hereby granted, free of charge, to any person
Chris@337 12 obtaining a copy of this software and associated documentation
Chris@337 13 files (the "Software"), to deal in the Software without
Chris@337 14 restriction, including without limitation the rights to use, copy,
Chris@337 15 modify, merge, publish, distribute, sublicense, and/or sell copies
Chris@337 16 of the Software, and to permit persons to whom the Software is
Chris@337 17 furnished to do so, subject to the following conditions:
Chris@337 18
Chris@337 19 The above copyright notice and this permission notice shall be
Chris@337 20 included in all copies or substantial portions of the Software.
Chris@337 21
Chris@337 22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Chris@337 23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Chris@337 24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Chris@337 25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
Chris@337 26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Chris@337 27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
Chris@337 28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Chris@337 29
Chris@337 30 Except as contained in this notice, the names of the Centre for
Chris@337 31 Digital Music; Queen Mary, University of London; and Chris Cannam
Chris@337 32 shall not be used in advertising or otherwise to promote the sale,
Chris@337 33 use or other dealings in this Software without prior written
Chris@337 34 authorization.
Chris@337 35 */
Chris@337 36
Chris@337 37 #ifndef _VAMP_FFT_H_
Chris@337 38 #define _VAMP_FFT_H_
Chris@337 39
Chris@337 40 #include "plugguard.h"
Chris@337 41 _VAMP_SDK_PLUGSPACE_BEGIN(FFT.h)
Chris@337 42
Chris@337 43 namespace Vamp {
Chris@337 44
Chris@337 45 /**
Chris@337 46 * A simple FFT implementation provided for convenience of plugin
Chris@337 47 * authors.
Chris@337 48 *
Chris@337 49 * This class provides double-precision FFTs in power-of-two sizes
Chris@337 50 * only. It is slower than more sophisticated library
Chris@337 51 * implementations. If these requirements aren't suitable, make other
Chris@337 52 * arrangements.
Chris@337 53 *
Chris@337 54 * The inverse transform is scaled by 1/n.
Chris@337 55 *
Chris@337 56 * The implementation is from Don Cross's public domain FFT code.
Chris@337 57 */
Chris@337 58 class FFT
Chris@337 59 {
Chris@337 60 public:
Chris@337 61 /**
Chris@337 62 * Calculate a forward transform of size n.
Chris@394 63 * n must be a power of 2, greater than 1.
Chris@337 64 *
Chris@337 65 * ri and ii must point to the real and imaginary component arrays
Chris@337 66 * of the input. For real input, ii may be NULL.
Chris@337 67 *
Chris@337 68 * ro and io must point to enough space to receive the real and
Chris@337 69 * imaginary component arrays of the output.
Chris@337 70 *
Chris@337 71 * All input and output arrays are of size n.
Chris@337 72 */
Chris@338 73 static void forward(unsigned int n,
Chris@338 74 const double *ri, const double *ii,
Chris@338 75 double *ro, double *io);
Chris@337 76
Chris@337 77 /**
Chris@337 78 * Calculate an inverse transform of size n.
Chris@394 79 * n must be a power of 2, greater than 1.
Chris@337 80 *
Chris@337 81 * ri and ii must point to the real and imaginary component arrays
Chris@337 82 * of the input. For real input, ii may be NULL.
Chris@337 83 *
Chris@337 84 * ro and io must point to enough space to receive the real and
Chris@337 85 * imaginary component arrays of the output. The output is scaled
Chris@337 86 * by 1/n. The output pointers may not be NULL, even if the output
Chris@337 87 * is expected to be real.
Chris@337 88 *
Chris@337 89 * All input and output arrays are of size n.
Chris@337 90 */
Chris@338 91 static void inverse(unsigned int n,
Chris@338 92 const double *ri, const double *ii,
Chris@338 93 double *ro, double *io);
Chris@337 94 };
Chris@337 95
Chris@337 96 }
Chris@337 97
Chris@337 98 _VAMP_SDK_PLUGSPACE_END(FFT.h)
Chris@337 99
Chris@337 100 #endif