Logo
MSP DSP Library
DSPLib_transform.h
1 #ifndef __DSPLIB_TRANSFORM_H__
2 #define __DSPLIB_TRANSFORM_H__
3 
4 //******************************************************************************
5 //
33 //
34 //******************************************************************************
35 
36 //******************************************************************************
37 //
38 // If building with a C++ compiler, make all of the definitions in this header
39 // have a C binding.
40 //
41 //******************************************************************************
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46 
47 
48 //******************************************************************************
49 //
54 //
55 //******************************************************************************
56 #define MSP_ALIGN_FFT_Q15(n) (n*2)
57 
58 //******************************************************************************
59 //
64 //
65 //******************************************************************************
66 #define MSP_ALIGN_FFT_IQ31(n) (n*4)
67 
68 //******************************************************************************
69 //
74 //
75 //******************************************************************************
76 #define MSP_ALIGN_CMPLX_FFT_Q15(n) (n*4)
77 
78 //******************************************************************************
79 //
84 //
85 //******************************************************************************
86 #define MSP_ALIGN_CMPLX_FFT_IQ31(n) (n*8)
87 
88 #if defined(MSP_USE_LEA)
89 
90 // Tables located in LEA ROM, define as null pointers
91 #define msp_cmplx_bitrev_table_ui8 0
92 #define msp_cmplx_twiddle_table_16_q15 0
93 #define msp_cmplx_twiddle_table_32_q15 0
94 #define msp_cmplx_twiddle_table_64_q15 0
95 #define msp_cmplx_twiddle_table_128_q15 0
96 #define msp_cmplx_twiddle_table_256_q15 0
97 #define msp_cmplx_twiddle_table_512_q15 0
98 #define msp_cmplx_twiddle_table_1024_q15 0
99 #define msp_cmplx_twiddle_table_2048_q15 0
100 #define msp_cmplx_twiddle_table_4096_q15 0
101 
102 #else //MSP_USE_LEA
103 
104 //******************************************************************************
105 //
109 //
110 //******************************************************************************
111 extern const uint8_t msp_cmplx_bitrev_table_ui8[256];
112 
113 //******************************************************************************
114 //
118 //
119 //******************************************************************************
121 
122 //******************************************************************************
123 //
127 //
128 //******************************************************************************
130 
131 //******************************************************************************
132 //
136 //
137 //******************************************************************************
139 
140 //******************************************************************************
141 //
145 //
146 //******************************************************************************
148 
149 //******************************************************************************
150 //
154 //
155 //******************************************************************************
157 
158 //******************************************************************************
159 //
163 //
164 //******************************************************************************
166 
167 //******************************************************************************
168 //
172 //
173 //******************************************************************************
175 
176 //******************************************************************************
177 //
181 //
182 //******************************************************************************
184 
185 //******************************************************************************
186 //
190 //
191 //******************************************************************************
193 
194 #endif //MSP_USE_LEA
195 
196 //******************************************************************************
197 //
201 //
202 //******************************************************************************
206  uint16_t length;
208 
209 //******************************************************************************
210 //
214 //
215 //******************************************************************************
219  uint16_t length;
221 
222 //******************************************************************************
223 //
227 //
228 //******************************************************************************
229 typedef struct msp_split_q15_params {
232  uint16_t length;
238 
239 //******************************************************************************
240 //
244 //
245 //******************************************************************************
246 typedef struct msp_split_iq31_params {
249  uint16_t length;
255 
256 //******************************************************************************
257 //
261 //
262 //******************************************************************************
263 typedef struct msp_fft_q15_params {
266  uint16_t length;
278 
279 //******************************************************************************
280 //
284 //
285 //******************************************************************************
286 typedef struct msp_fft_iq31_params {
289  uint16_t length;
301 
302 //******************************************************************************
303 //
307 //
308 //******************************************************************************
309 typedef struct msp_cmplx_fft_q15_params {
312  uint16_t length;
324 
325 //******************************************************************************
326 //
330 //
331 //******************************************************************************
335  uint16_t length;
347 
348 //******************************************************************************
349 //
374 //
375 //******************************************************************************
377  const msp_cmplx_bitrev_q15_params *params,
378  int16_t *src);
379 
380 //******************************************************************************
381 //
406 //
407 //******************************************************************************
409  const msp_cmplx_bitrev_iq31_params *params,
410  int32_t *src);
411 
412 //******************************************************************************
413 //
440 //
441 //******************************************************************************
442 extern msp_status msp_split_q15(const msp_split_q15_params *params,
443  int16_t *src);
444 
445 //******************************************************************************
446 //
473 //
474 //******************************************************************************
475 extern msp_status msp_split_iq31(const msp_split_iq31_params *params,
476  int32_t *src);
477 
478 //******************************************************************************
479 //
521 //
522 //******************************************************************************
523 extern msp_status msp_fft_auto_q15(const msp_fft_q15_params *params,
524  int16_t *src,
525  uint16_t *shift);
526 
527 //******************************************************************************
528 //
602 //
603 //******************************************************************************
604 extern msp_status msp_fft_fixed_q15(const msp_fft_q15_params *params,
605  int16_t *src);
606 
607 //******************************************************************************
608 //
639 //
640 //******************************************************************************
641 
642 extern msp_status msp_fft_iq31(const msp_fft_iq31_params *params,
643  int32_t *src);
644 
645 //******************************************************************************
646 //
679 //
680 //******************************************************************************
681 extern msp_status msp_ifft_auto_q15(const msp_fft_q15_params *params,
682  int16_t *src,
683  uint16_t shift);
684 
685 //******************************************************************************
686 //
739 //
740 //******************************************************************************
742  int16_t *src);
743 
744 //******************************************************************************
745 //
777 //
778 //******************************************************************************
779 extern msp_status msp_ifft_iq31(const msp_fft_iq31_params *params,
780  int32_t *src);
781 
782 //******************************************************************************
783 //
819 //
820 //******************************************************************************
822  int16_t *src,
823  uint16_t *shift);
824 
825 //******************************************************************************
826 //
893 //
894 //******************************************************************************
896  const msp_cmplx_fft_q15_params *params,
897  int16_t *src);
898 
899 //******************************************************************************
900 //
925 //
926 //******************************************************************************
928 int32_t *src);
929 
930 //******************************************************************************
931 //
960 //
961 //******************************************************************************
963  const msp_cmplx_fft_q15_params *params,
964  int16_t *src,
965  uint16_t shift);
966 
967 //******************************************************************************
968 //
1014 //
1015 //******************************************************************************
1017  const msp_cmplx_fft_q15_params *params,
1018  int16_t *src);
1019 
1020 //******************************************************************************
1021 //
1047 //
1048 //******************************************************************************
1050  int32_t *src);
1051 
1052 //*****************************************************************************
1053 //
1054 // Mark the end of the C bindings section for C++ compilers.
1055 //
1056 //*****************************************************************************
1057 #ifdef __cplusplus
1058 }
1059 #endif
1060 
1061 #endif //__DSPLIB_TRANSFORM_H__
Parameter structure for Q15 split operation.
Definition: DSPLib_transform.h:229
msp_status msp_cmplx_fft_iq31(const msp_cmplx_fft_iq31_params *params, int32_t *src)
Complex forward FFT function without scaling.
uint16_t length
Definition: DSPLib_transform.h:266
bool bitReverse
Definition: DSPLib_transform.h:341
const _q15 msp_cmplx_twiddle_table_64_q15[DSPLIB_TABLE_OFFSET+64]
Twiddle factor table for FFT of size 64.
bool bitReverse
Definition: DSPLib_transform.h:295
uint16_t length
Definition: DSPLib_transform.h:289
msp_status msp_fft_fixed_q15(const msp_fft_q15_params *params, int16_t *src)
Real forward FFT function with fixed scaling by two at each stage.
msp_status
Enumerated type to return the status of an operation.
Definition: DSPLib_types.h:119
uint16_t length
Definition: DSPLib_transform.h:312
bool bitReverse
Definition: DSPLib_transform.h:272
const _q15 * twiddleTable
Definition: DSPLib_transform.h:322
const _q15 msp_cmplx_twiddle_table_4096_q15[DSPLIB_TABLE_OFFSET+4096]
Twiddle factor table for FFT of size 4096.
const _q15 msp_cmplx_twiddle_table_512_q15[DSPLIB_TABLE_OFFSET+512]
Twiddle factor table for FFT of size 512.
const _q15 * twiddleTable
Definition: DSPLib_transform.h:345
const _q15 * twiddleTable
Definition: DSPLib_transform.h:276
Parameter structure for IQ31 split operation.
Definition: DSPLib_transform.h:246
const _q15 msp_cmplx_twiddle_table_32_q15[DSPLIB_TABLE_OFFSET+32]
Twiddle factor table for FFT of size 32.
Parameter structure for IQ31 real FFT functions.
Definition: DSPLib_transform.h:286
const _q15 * twiddleTable
Definition: DSPLib_transform.h:299
bool bitReverse
Definition: DSPLib_transform.h:318
msp_status msp_ifft_fixed_q15(const msp_fft_q15_params *params, int16_t *src)
Real result inverse FFT function with fixed scaling by two at each stage.
msp_status msp_cmplx_bitrev_iq31(const msp_cmplx_bitrev_iq31_params *params, int32_t *src)
Complex bit-reversal function.
msp_status msp_split_q15(const msp_split_q15_params *params, int16_t *src)
Split operation for performing the final step of a real FFT.
const _q15 msp_cmplx_twiddle_table_256_q15[DSPLIB_TABLE_OFFSET+256]
Twiddle factor table for FFT of size 256.
const _q15 msp_cmplx_twiddle_table_128_q15[DSPLIB_TABLE_OFFSET+128]
Twiddle factor table for FFT of size 128.
int16_t _q15
Signed fixed point data type with 1 integer bit and 15 fractional bits.
Definition: DSPLib_types.h:79
msp_status msp_ifft_iq31(const msp_fft_iq31_params *params, int32_t *src)
Real result inverse FFT function without scaling.
msp_status msp_cmplx_fft_auto_q15(const msp_cmplx_fft_q15_params *params, int16_t *src, uint16_t *shift)
Complex forward FFT function with auto-scaling.
msp_status msp_ifft_auto_q15(const msp_fft_q15_params *params, int16_t *src, uint16_t shift)
Real result inverse FFT function with auto-scaling.
msp_status msp_cmplx_ifft_iq31(const msp_cmplx_fft_iq31_params *params, int32_t *src)
Complex inverse FFT function without scaling.
const _q15 msp_cmplx_twiddle_table_1024_q15[DSPLIB_TABLE_OFFSET+1024]
Twiddle factor table for FFT of size 1024.
Parameter structure for IQ31 complex bit-reversal.
Definition: DSPLib_transform.h:216
msp_status msp_cmplx_ifft_fixed_q15(const msp_cmplx_fft_q15_params *params, int16_t *src)
Complex inverse FFT function with fixed scaling by two at each stage.
const _q15 msp_cmplx_twiddle_table_16_q15[DSPLIB_TABLE_OFFSET+16]
Twiddle factor table for FFT of size 16.
msp_status msp_fft_auto_q15(const msp_fft_q15_params *params, int16_t *src, uint16_t *shift)
Real forward FFT function with auto-scaling.
const _q15 * twiddleTable
Definition: DSPLib_transform.h:236
msp_status msp_cmplx_bitrev_q15(const msp_cmplx_bitrev_q15_params *params, int16_t *src)
Complex bit-reversal function.
msp_status msp_cmplx_ifft_auto_q15(const msp_cmplx_fft_q15_params *params, int16_t *src, uint16_t shift)
Complex inverse FFT function with auto-scaling.
uint16_t length
Definition: DSPLib_transform.h:335
uint16_t length
Definition: DSPLib_transform.h:219
msp_status msp_split_iq31(const msp_split_iq31_params *params, int32_t *src)
Split operation for performing the final step of a real FFT.
Parameter structure for Q15 complex bit-reversal.
Definition: DSPLib_transform.h:203
Parameter structure for Q15 complex FFT functions.
Definition: DSPLib_transform.h:309
msp_status msp_cmplx_fft_fixed_q15(const msp_cmplx_fft_q15_params *params, int16_t *src)
Complex forward FFT function with fixed scaling by two at each stage.
#define DSPLIB_TABLE_OFFSET
Offset used to store table size.
Definition: DSPLib_support.h:39
const uint8_t msp_cmplx_bitrev_table_ui8[256]
Bit reversal lookup table.
msp_status msp_fft_iq31(const msp_fft_iq31_params *params, int32_t *src)
Real forward FFT function without scaling.
const _q15 * twiddleTable
Definition: DSPLib_transform.h:253
uint16_t length
Definition: DSPLib_transform.h:232
uint16_t length
Definition: DSPLib_transform.h:206
Parameter structure for IQ31 complex FFT functions.
Definition: DSPLib_transform.h:332
uint16_t length
Definition: DSPLib_transform.h:249
const _q15 msp_cmplx_twiddle_table_2048_q15[DSPLIB_TABLE_OFFSET+2048]
Twiddle factor table for FFT of size 2048.
Parameter structure for Q15 real FFT functions.
Definition: DSPLib_transform.h:263