xoreos  0.0.5
fft.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 /* Based on the (I)FFT code in FFmpeg (<https://ffmpeg.org/)>, which
26  * is released under the terms of version 2 or later of the GNU Lesser
27  * General Public License.
28  *
29  * The original copyright note in libavcodec/fft_template.c reads as follows:
30  *
31  * FFT/IFFT transforms
32  * Copyright (c) 2008 Loren Merritt
33  * Copyright (c) 2002 Fabrice Bellard
34  * Partly based on libdjbfft by D. J. Bernstein
35  *
36  * This file is part of FFmpeg.
37  *
38  * FFmpeg is free software; you can redistribute it and/or
39  * modify it under the terms of the GNU Lesser General Public
40  * License as published by the Free Software Foundation; either
41  * version 2.1 of the License, or (at your option) any later version.
42  *
43  * FFmpeg is distributed in the hope that it will be useful,
44  * but WITHOUT ANY WARRANTY; without even the implied warranty of
45  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
46  * Lesser General Public License for more details.
47  *
48  * You should have received a copy of the GNU Lesser General Public
49  * License along with FFmpeg; if not, write to the Free Software
50  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
51  */
52 
53 #ifndef COMMON_FFT_H
54 #define COMMON_FFT_H
55 
56 #include <boost/noncopyable.hpp>
57 
58 #include "src/common/types.h"
59 #include "src/common/scopedptr.h"
60 
61 namespace Common {
62 
63 struct Complex;
64 
66 class FFT : boost::noncopyable {
67 public:
68  FFT(int bits, bool inverse);
69  ~FFT();
70 
71  const uint16 *getRevTab() const;
72 
74  void permute(Complex *z);
75 
81  void calc(Complex *z);
82 
83 private:
84  int _bits;
85  bool _inverse;
86 
88 
91 
92  static int splitRadixPermutation(int i, int n, bool inverse);
93 };
94 
95 } // End of namespace Common
96 
97 #endif // COMMON_FFT_H
~FFT()
Definition: fft.cpp:76
A complex number.
Definition: maths.h:61
Definition: 2dafile.h:39
ScopedArray< Complex > _expTab
Definition: fft.h:89
const uint16 * getRevTab() const
Definition: fft.cpp:79
A simple scoped smart pointer template.
uint16_t uint16
Definition: types.h:202
Low-level type definitions to handle fixed width types portably.
ScopedArray< uint16 > _revTab
Definition: fft.h:87
void permute(Complex *z)
Do the permutation needed BEFORE calling calc().
Definition: fft.cpp:83
void calc(Complex *z)
Do a complex FFT.
Definition: fft.cpp:271
ScopedArray< Complex > _tmpBuf
Definition: fft.h:90
FFT(int bits, bool inverse)
Definition: fft.cpp:63
bool _inverse
Definition: fft.h:85
static glm::mat4 inverse(const glm::mat4 &m)
Definition: graphics.cpp:1363
static int splitRadixPermutation(int i, int n, bool inverse)
Definition: fft.cpp:104
int _bits
Definition: fft.h:84
(Inverse) Fast Fourier Transform.
Definition: fft.h:66