FFTLIB User Guide
FFTLIB_FFT_dftSmall_ixX_cxX_oxX.cpp
Go to the documentation of this file.
1 /******************************************************************************
2 * *
3 * module name :FFTLIB *
4 * *
5 * module descripton :Matrix Multiply Accelerator Library module for C7x+MMA *
6 * *
7 * Copyright (C) 2017-2018 Texas Instruments Incorporated - https://www.ti.com/ *
8 * ALL RIGHTS RESERVED *
9 * *
10 ******************************************************************************/
11 
24 
27 {
28  int32_t privBufSize = sizeof(FFTLIB_FFT_dftSmall_ixX_cxX_oxX_PrivArgs);
29  return privBufSize ;
30 }
31 
33  FFTLIB_kernelHandle handle,
34  const FFTLIB_bufParams1D_t * bufParamsX,
35  const FFTLIB_bufParams1D_t * bufParamsW,
36  const FFTLIB_bufParams1D_t * bufParamsY,
37  const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs)
38 {
39  FFTLIB_STATUS status = FFTLIB_SUCCESS ;
40  FFTLIB_bufParams1D_t bufParamsXLocal, bufParamsYLocal, bufParamsWLocal;
41 
42  if(handle == NULL) {
43  status = FFTLIB_ERR_NULL_POINTER;
44  } else {
45  if (bufParamsX->data_type == FFTLIB_INT16) {
47  &bufParamsXLocal,
48  &bufParamsWLocal,
49  &bufParamsYLocal);
50  } else if (bufParamsX->data_type == FFTLIB_INT32) {
52  &bufParamsXLocal,
53  &bufParamsWLocal,
54  &bufParamsYLocal);
55  } else {
57  }
58  }
59  if (status == FFTLIB_SUCCESS) {
60  if (bufParamsX->dim_x != bufParamsXLocal.dim_x) {
62  } else if (bufParamsY->dim_x != bufParamsYLocal.dim_x) {
64  } else if (bufParamsW->dim_x != bufParamsWLocal.dim_x) {
66  } else if ((bufParamsX->data_type != bufParamsW->data_type) ||
67  (bufParamsX->data_type != bufParamsY->data_type) ) {
68  status = FFTLIB_ERR_INVALID_TYPE;
69  } else {
70  /* Nothing to do here */
71  }
72  }
73 
74  return status;
75 }
76 
78  FFTLIB_kernelHandle handle,
79  const void *restrict pX,
80  const void *restrict pW,
81  const void *restrict pY)
82 {
83  FFTLIB_STATUS status;
84 
85  if ((pX == NULL) || (pW == NULL) || (pY == NULL) ) {
86  status = FFTLIB_ERR_NULL_POINTER;
87  } else {
88  status = FFTLIB_SUCCESS ;
89  }
90 
91  return status;
92 }
93 
95  const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs * pKerInitArgs,
96  FFTLIB_bufParams1D_t * bufParamsX,
97  FFTLIB_bufParams1D_t * bufParamsW,
98  FFTLIB_bufParams1D_t * bufParamsY)
99 {
100  FFTLIB_STATUS status ;
101 
102  if (bufParamsX->data_type == FFTLIB_INT16) {
104  bufParamsX,
105  bufParamsW,
106  bufParamsY);
107  } else if (bufParamsX->data_type == FFTLIB_INT32) {
109  bufParamsX,
110  bufParamsW,
111  bufParamsY);
112  } else {
114  }
115 
116  return status ;
117 }
118 
120  const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs * pKerInitArgs,
121  void *pW,
122  const FFTLIB_bufParams1D_t * bufParamsW)
123 {
124  FFTLIB_STATUS status ;
125 
126  if (bufParamsW->data_type == FFTLIB_INT16) {
127  status = FFTLIB_FFT_dftSmall_ixX_cxX_oxX_twGen<int16_t>(pKerInitArgs,
128  pW,
129  bufParamsW);
130  } else if (bufParamsW->data_type == FFTLIB_INT32) {
131  status = FFTLIB_FFT_dftSmall_ixX_cxX_oxX_twGen<int32_t>(pKerInitArgs,
132  pW,
133  bufParamsW);
134  } else {
136  }
137 
138  return status ;
139 }
140 
142  FFTLIB_kernelHandle handle,
143  FFTLIB_bufParams1D_t * bufParamsX,
144  FFTLIB_bufParams1D_t * bufParamsW,
145  FFTLIB_bufParams1D_t * bufParamsY,
147 {
148  FFTLIB_STATUS status ;
151 
152  pKerPrivArgs->initArgs = *pKerInitArgs ;
153 
154  if(pKerInitArgs->funcStyle == FFTLIB_FUNCTION_NATC)
155  {
157  bufParamsX,
158  bufParamsW,
159  bufParamsY,
160  pKerInitArgs) ;
161  if (bufParamsX->data_type == FFTLIB_INT16) {
162  pKerPrivArgs->execute =
164  int64_t,
166  } else if (bufParamsX->data_type == FFTLIB_INT32) {
167  pKerPrivArgs->execute =
169  FFTLIB_int128_t,
171  } else {
173  }
174  }
175  else
176  {
177  if (bufParamsX->data_type == FFTLIB_INT16) {
178  pKerPrivArgs->execute =
182  bufParamsX,
183  bufParamsW,
184  bufParamsY,
185  pKerInitArgs);
186 
187  } else if (bufParamsX->data_type == FFTLIB_INT32) {
188  pKerPrivArgs->execute =
192  bufParamsX,
193  bufParamsW,
194  bufParamsX,
195  pKerInitArgs);
196 
197  } else {
199  }
200  }
201 
202  return status ;
203 }
204 
206  FFTLIB_kernelHandle handle,
207  void *restrict pX,
208  void *restrict pW,
209  void *restrict pY)
210 {
211  FFTLIB_STATUS status ;
212 
215 
216  status = pKerPrivArgs->execute(handle,
217  pX,
218  pW,
219  pY) ;
220 
221  return status ;
222 }
FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_exec_ci(FFTLIB_kernelHandle handle, const void *restrict pX, const void *restrict pW, void *restrict pY)
This function is the main execution function for the C7x implementation of the kernel....
template FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_getSizes< FFTLIB_INT32 >(const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs, FFTLIB_bufParams1D_t *bufParamsX, FFTLIB_bufParams1D_t *bufParamsW, FFTLIB_bufParams1D_t *bufParamsY)
template FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_getSizes< FFTLIB_INT16 >(const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs, FFTLIB_bufParams1D_t *bufParamsX, FFTLIB_bufParams1D_t *bufParamsW, FFTLIB_bufParams1D_t *bufParamsY)
template FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_twGen< int16_t >(const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs, void *restrict pW, const FFTLIB_bufParams1D_t *bufParamsW)
template FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_init_ci< FFTLIB_INT32 >(FFTLIB_kernelHandle handle, const FFTLIB_bufParams1D_t *bufParamsX, const FFTLIB_bufParams1D_t *bufParamsW, const FFTLIB_bufParams1D_t *bufParamsY, const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs)
template FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_init_ci< FFTLIB_INT16 >(FFTLIB_kernelHandle handle, const FFTLIB_bufParams1D_t *bufParamsX, const FFTLIB_bufParams1D_t *bufParamsW, const FFTLIB_bufParams1D_t *bufParamsY, const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs)
template FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_twGen< int32_t >(const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs, void *restrict pW, const FFTLIB_bufParams1D_t *bufParamsW)
FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_init_cn(FFTLIB_kernelHandle handle, FFTLIB_bufParams1D_t *bufParamsX, FFTLIB_bufParams1D_t *bufParamsW, FFTLIB_bufParams1D_t *bufParamsY, FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs)
This function is the initialization function for the natural C implementation of the kernel....
FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_exec_cn(FFTLIB_kernelHandle handle, const void *restrict pX, const void *restrict pW, void *restrict pY)
This function is the main execution function for the natural C implementation of the kernel....
Header file for kernel's internal use. For the kernel's interface, please see FFTLIB_FFT_dftSmall_ixX...
@ FFTLIB_INT16
@ FFTLIB_INT32
void * FFTLIB_kernelHandle
Handle type for FFTLIB operations.
Definition: FFTLIB_types.h:217
FFTLIB_STATUS_NAME
The enumeration of all status codes.
Definition: FFTLIB_types.h:172
@ FFTLIB_ERR_NOT_IMPLEMENTED
Definition: FFTLIB_types.h:179
@ FFTLIB_ERR_INVALID_TYPE
Definition: FFTLIB_types.h:176
@ FFTLIB_ERR_NULL_POINTER
Definition: FFTLIB_types.h:178
@ FFTLIB_ERR_INVALID_DIMENSION
Definition: FFTLIB_types.h:177
@ FFTLIB_SUCCESS
Definition: FFTLIB_types.h:173
@ FFTLIB_FUNCTION_NATC
Definition: FFTLIB_types.h:221
#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_dftSmall_ixX_cxX_oxX_getSizes(const FFTLIB_FFT_dftSmall_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 DFT computational matrix buf...
FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_init_checkParams(FFTLIB_kernelHandle handle, const FFTLIB_bufParams1D_t *bufParamsX, const FFTLIB_bufParams1D_t *bufParamsW, const FFTLIB_bufParams1D_t *bufParamsY, const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to FFTLIB_FFT_dftSmall_ixX_cxX_oxX_init fu...
FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_exec_checkParams(FFTLIB_kernelHandle handle, const void *restrict pX, const void *restrict pW, const void *restrict pY)
This function checks the validity of the parameters passed to FFTLIB_FFT_dftSmall_ixX_cxX_oxX_exec fu...
int32_t FFTLIB_FFT_dftSmall_ixX_cxX_oxX_getHandleSize(FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs)
This is a query function to calculate the size of internal handle.
FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_init(FFTLIB_kernelHandle handle, FFTLIB_bufParams1D_t *bufParamsX, FFTLIB_bufParams1D_t *bufParamsW, FFTLIB_bufParams1D_t *bufParamsY, FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs)
This function should be called before the FFTLIB_FFT_dftSmall_ixX_cxX_oxX_exec function is called....
FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_twGen(const FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs *pKerInitArgs, void *pW, const FFTLIB_bufParams1D_t *bufParamsW)
This is a utility function that generates the DFT computational matrix into the provided buffer.
FFTLIB_STATUS FFTLIB_FFT_dftSmall_ixX_cxX_oxX_exec(FFTLIB_kernelHandle handle, void *restrict pX, void *restrict pW, void *restrict pY)
This function is the main kernel compute function.
Structure containing the parameters for DFT computation.
int8_t funcStyle
Variant of the function refer to FFTLIB_FUNCTION_STYLE
Structure that is reserved for internal use by the kernel.
pFxnFFTLIB_FFT_dftSmall_ixX_cxX_oxX_exec execute
Function pointer to point to the right execution variant between FFTLIB_FFT_dftSmall_ixX_cxX_oxX_exec...
FFTLIB_FFT_dftSmall_ixX_cxX_oxX_InitArgs initArgs
Structure holding initialization parameters
A structure for a 1 dimensional buffer descriptor.
uint32_t data_type
Values are of type FFTLIB_data_type_e.
uint32_t dim_x
Width of buffer in X dimension in elements.