1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - MATH - include
3   File:     math/fft.h
4 
5   Copyright 2003-2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date::            $
14   $Rev:$
15   $Author:$
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NITRO_MATH_FFT_H_
19 #define NITRO_MATH_FFT_H_
20 
21 #include <nitro/types.h>
22 #include <nitro/fx/fx.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 //----------------------------------------------------------------------------
29 // Type Definitions
30 //----------------------------------------------------------------------------
31 
32 //----------------------------------------------------------------------------
33 // Function Declarations
34 //----------------------------------------------------------------------------
35 
36 /*---------------------------------------------------------------------------*
37   Name:         MATH_MakeFFTSinTable
38 
39   Description:  Creates sine table used in fast Fourier transform.
40 
41   Arguments:    sinTable - Pointer to location storing 2^nShift * 3/4  sine table
42                 nShift - log2 of the number of data
43 
44   Returns:      None.
45  *---------------------------------------------------------------------------*/
46 void    MATH_MakeFFTSinTable(fx16 *sinTable, u32 nShift);
47 
48 /*---------------------------------------------------------------------------*
49   Name:         MATHi_FFT
50 
51   Description:  Internal function that performs fast Fourier transform.
52 
53   Arguments:    data - Data to transform, with even-numbered data elements being real and odd-numbered data elements being imaginary.
54                        The transformation result will be returned overwritten.
55                 nShift - log2 of the number of data
56                 sinTable - Sine value table based on a circle divided into equal sections; the number of sections is the number of data elements
57 
58   Returns:      None.
59  *---------------------------------------------------------------------------*/
60 void    MATHi_FFT(fx32 *data, u32 nShift, const fx16 *sinTable);
61 
62 /*---------------------------------------------------------------------------*
63   Name:         MATHi_IFFT
64 
65   Description:  Internal function that reverses the fast Fourier transform.
66 
67   Arguments:    data - Data to transform, with even-numbered data elements being real and odd-numbered data elements being imaginary.
68                        The transformation result will be returned overwritten.
69                 nShift - log2 of the number of data
70                 sinTable - Sine value table based on a circle divided into equal sections; the number of sections is the number of data elements
71 
72   Returns:      None.
73  *---------------------------------------------------------------------------*/
74 void    MATHi_IFFT(fx32 *data, u32 nShift, const fx16 *sinTable);
75 
76 /*---------------------------------------------------------------------------*
77   Name:         MATH_FFT
78 
79   Description:  Performs fast Fourier transform.
80 
81   Arguments:    data - Data to transform, with even-numbered data elements being real and odd-numbered data elements being imaginary.
82                        The transformation result will be returned overwritten.
83                 nShift - log2 of the number of data
84                 sinTable - Sine value table based on a circle divided into equal sections; the number of sections is the number of data elements
85 
86   Returns:      None.
87  *---------------------------------------------------------------------------*/
88 void    MATH_FFT(fx32 *data, u32 nShift, const fx16 *sinTable);
89 
90 /*---------------------------------------------------------------------------*
91   Name:         MATH_IFFT
92 
93   Description:  Performs the inverse transformation of fast Fourier transform.
94 
95   Arguments:    data - Data to transform, with even-numbered data elements being real and odd-numbered data elements being imaginary.
96                        The transformation result will be returned overwritten.
97                 nShift - log2 of the number of data
98                 sinTable - Sine value table based on a circle divided into equal sections; the number of sections is the number of data elements
99 
100   Returns:      None.
101  *---------------------------------------------------------------------------*/
102 void    MATH_IFFT(fx32 *data, u32 nShift, const fx16 *sinTable);
103 
104 /*---------------------------------------------------------------------------*
105   Name:         MATH_FFTReal
106 
107   Description:  Performs fast Fourier transform.
108 
109   Arguments:    data - Data that includes only real number data.
110                        The transformation result will be returned overwritten.
111                 nShift - log2 of the number of data
112                 sinTable - Sine value table based on a circle divided into equal sections; the number of sections is the number of data elements
113 
114   Returns:      None.
115  *---------------------------------------------------------------------------*/
116 void    MATH_FFTReal(fx32 *data, u32 nShift, const fx16 *sinTable, const fx16 *sinTable2);
117 
118 /*---------------------------------------------------------------------------*
119   Name:         MATH_IFFTReal
120 
121   Description:  Performs the inverse transformation of fast Fourier transform.
122 
123   Arguments:    data - Data that includes only real number data.
124                        The transformation result will be returned overwritten.
125                 nShift - log2 of the number of data
126                 sinTable - Sine value table based on a circle divided into equal sections; the number of sections is the number of data elements
127 
128   Returns:      None.
129  *---------------------------------------------------------------------------*/
130 void    MATH_IFFTReal(fx32 *data, u32 nShift, const fx16 *sinTable, const fx16 *sinTable2);
131 
132 
133 #ifdef __cplusplus
134 }/* extern "C" */
135 #endif
136 
137 /* NITRO_MATH_FFT_H_ */
138 #endif
139