FFTLIB User Guide
FFTLIB_FFT_fft_ixX_cxX_oxX_ci.cpp
Go to the documentation of this file.
1 /******************************************************************************/
5 /* Copyright (C) 2017 Texas Instruments Incorporated - https://www.ti.com/
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the
17  * distribution.
18  *
19  * Neither the name of Texas Instruments Incorporated nor the names of
20  * its contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35  ******************************************************************************/
36 
37 
38 /*******************************************************************************
39  *
40  * INCLUDES
41  *
42  ******************************************************************************/
43 
44 #include "../FFTLIB_FFT_fft_ixX_cxX_oxX_priv.h"
45 #include "../../../common/c71/FFTLIB_inlines.h"
46 
47 
48 /*******************************************************************************
49  *
50  * DEFINES
51  *
52  ******************************************************************************/
53 template <uint32_t dataType>
55  const FFTLIB_FFT_fft_ixX_cxX_oxX_InitArgs * pKerInitArgs,
56  FFTLIB_bufParams1D_t * bufParamsX,
57  FFTLIB_bufParams1D_t * bufParamsW,
58  FFTLIB_bufParams1D_t * bufParamsY)
59 {
61  int32_t MMA_SIZE;
62  int32_t dftSmall, dftLarge, highRadixDecompositions;
63 
64 #if FFTLIB_DEBUGPRINT
65  printf("In FFTLIB_FFT_fft_ixX_cxX_oxX_getSizes()..\n");
66 #endif
67  if (dataType == FFTLIB_INT32) {
68  MMA_SIZE = FFTLIB_MMA_SIZE_32_BIT;
69  } else if (dataType == FFTLIB_INT16) {
70  MMA_SIZE = FFTLIB_MMA_SIZE_16_BIT;
71  } else {
73  }
74 
75  if (status == FFTLIB_SUCCESS) {
77  MMA_SIZE,
78  &dftSmall,
79  &dftLarge,
80  &highRadixDecompositions);
81 
82  if (dftSmall) {
83  #if FFTLIB_DEBUGPRINT
84  printf("About to call FFTLIB_FFT_dftSmall_ixX_cxX_oxX_getSizes()..\n");
85  #endif
86  status = FFTLIB_FFT_dftSmall_ixX_cxX_oxX_getSizes<dataType>(
87  (const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *)pKerInitArgs,
88  bufParamsX,
89  bufParamsW,
90  bufParamsY);
91  }
92 
93  if (dftLarge) {
94  #if FFTLIB_DEBUGPRINT
95  printf("About to call FFTLIB_FFT_dftLarge_ixX_cxX_oxX_getSizes()..\n");
96  #endif
97  status = FFTLIB_FFT_dftLarge_ixX_cxX_oxX_getSizes<dataType>(
98  (const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *)pKerInitArgs,
99  bufParamsX,
100  bufParamsW,
101  bufParamsY);
102  }
103 
104  if (highRadixDecompositions) {
105  #if FFTLIB_DEBUGPRINT
106  printf("About to call FFTLIB_FFT_highRadixDecompositions_ixX_cxX_oxX_getSizes()..\n");
107  #endif
108  status = FFTLIB_FFT_highRadixDecompositions_ixX_cxX_oxX_getSizes<dataType>(
110  bufParamsX,
111  bufParamsW,
112  bufParamsY);
113  }
114  }
115 
116  return status;
117 }
118 
120  FFTLIB_INT16>(
121  const FFTLIB_FFT_fft_ixX_cxX_oxX_InitArgs * pKerInitArgs,
122  FFTLIB_bufParams1D_t * bufParamsX,
123  FFTLIB_bufParams1D_t * bufParamsW,
124  FFTLIB_bufParams1D_t * bufParamsY);
126  FFTLIB_INT32>(
127  const FFTLIB_FFT_fft_ixX_cxX_oxX_InitArgs * pKerInitArgs,
128  FFTLIB_bufParams1D_t * bufParamsX,
129  FFTLIB_bufParams1D_t * bufParamsW,
130  FFTLIB_bufParams1D_t * bufParamsY);
131 
132 template <typename dataType>
134  const FFTLIB_FFT_fft_ixX_cxX_oxX_InitArgs * pKerInitArgs,
135  void *restrict pW,
136  const FFTLIB_bufParams1D_t * bufParamsW)
137 {
138  FFTLIB_STATUS status = FFTLIB_SUCCESS;
139  int32_t MMA_SIZE;
140  int32_t dftSmall, dftLarge, highRadixDecompositions;
141 
142 #if FFTLIB_DEBUGPRINT
143  printf("In FFTLIB_FFT_fft_ixX_cxX_oxX_twGen()..\n");
144 #endif
145  if (sizeof(dataType) == 4) {
146  MMA_SIZE = FFTLIB_MMA_SIZE_32_BIT;
147  } else if (sizeof(dataType) == 2) {
148  MMA_SIZE = FFTLIB_MMA_SIZE_16_BIT;
149  } else {
151  }
152 
153  if (status == FFTLIB_SUCCESS) {
155  MMA_SIZE,
156  &dftSmall,
157  &dftLarge,
158  &highRadixDecompositions);
159 
160  if (dftSmall) {
161  #if FFTLIB_DEBUGPRINT
162  printf("About to call FFTLIB_FFT_dftSmall_ixX_cxX_oxX_twGen()..\n");
163  #endif
164  status = FFTLIB_FFT_dftSmall_ixX_cxX_oxX_twGen<dataType>(
165  (const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *)pKerInitArgs,
166  pW,
167  bufParamsW);
168  }
169 
170  if (dftLarge) {
171  #if FFTLIB_DEBUGPRINT
172  printf("About to call FFTLIB_FFT_dftLarge_ixX_cxX_oxX_twGen()..\n");
173  #endif
174  status = FFTLIB_FFT_dftLarge_ixX_cxX_oxX_twGen<dataType>(
175  (const FFTLIB_FFT_dftLarge_ixX_cxX_oxX_InitArgs *)pKerInitArgs,
176  pW,
177  bufParamsW);
178  }
179 
180  if (highRadixDecompositions) {
181  #if FFTLIB_DEBUGPRINT
182  printf("About to call FFTLIB_FFT_highRadixDecompositions_ixX_cxX_oxX_twGen()..\n");
183  #endif
184  status = FFTLIB_FFT_highRadixDecompositions_ixX_cxX_oxX_twGen<dataType>(
186  pW,
187  bufParamsW);
188  }
189  }
190  return status;
191 }
192 
194  const FFTLIB_FFT_fft_ixX_cxX_oxX_InitArgs * pKerInitArgs,
195  void *restrict pW,
196  const FFTLIB_bufParams1D_t * bufParamsW);
197 
199  const FFTLIB_FFT_fft_ixX_cxX_oxX_InitArgs * pKerInitArgs,
200  void *restrict pW,
201  const FFTLIB_bufParams1D_t * bufParamsW);
202 
void FFTLIB_FFT_fft_ixX_cxX_oxX_determineKernelVariant(const FFTLIB_FFT_fft_ixX_cxX_oxX_InitArgs *pKerInitArgs, int32_t MMA_SIZE, int32_t *dftSmall, int32_t *dftLarge, int32_t *highRadixDecompositions)
This is an internal function that is used to determine which FFT kernel variant to call for optimal D...
template FFTLIB_STATUS FFTLIB_FFT_fft_ixX_cxX_oxX_twGen< int32_t >(const FFTLIB_FFT_fft_ixX_cxX_oxX_InitArgs *pKerInitArgs, void *restrict pW, const FFTLIB_bufParams1D_t *bufParamsW)
FFTLIB_STATUS FFTLIB_FFT_fft_ixX_cxX_oxX_twGen(const FFTLIB_FFT_fft_ixX_cxX_oxX_InitArgs *pKerInitArgs, void *restrict pW, const FFTLIB_bufParams1D_t *bufParamsW)
This is a utility function that generates the computational matrices into the provided buffer.
template FFTLIB_STATUS FFTLIB_FFT_fft_ixX_cxX_oxX_twGen< int16_t >(const FFTLIB_FFT_fft_ixX_cxX_oxX_InitArgs *pKerInitArgs, void *restrict pW, const FFTLIB_bufParams1D_t *bufParamsW)
@ FFTLIB_INT16
@ FFTLIB_INT32
FFTLIB_STATUS_NAME
The enumeration of all status codes.
Definition: FFTLIB_types.h:172
@ FFTLIB_ERR_NOT_IMPLEMENTED
Definition: FFTLIB_types.h:179
@ FFTLIB_SUCCESS
Definition: FFTLIB_types.h:173
#define FFTLIB_MMA_SIZE_16_BIT
type is 16-bit integers
#define FFTLIB_MMA_SIZE_32_BIT
type is 32-bit integers
FFTLIB_STATUS FFTLIB_FFT_fft_ixX_cxX_oxX_getSizes(const FFTLIB_FFT_fft_ixX_cxX_oxX_InitArgs *pKerInitArgs, FFTLIB_bufParams1D_t *bufParamsX, FFTLIB_bufParams1D_t *bufParamsW, FFTLIB_bufParams1D_t *bufParamsY)
This is a query function to calculate the sizes of input, output and the computational matrix buffers...
Structure containing the parameters for DFT computation.
Structure containing the parameters for DFT computation.
Structure containing the parameters for DFT computation.
A structure for a 1 dimensional buffer descriptor.