Back to C-ASPT Contents Page

# Linear transformations module

### API Summary

Initialization Routines

In place transform calculation functions

### Description

Implements functions to perform in place Fast Fourier, Discrete Sign, and Discrete Cosine transformations. The functions in this module require data length that is power of 2 and uses radix-2 and radix-4 decimation in frequency Fast Fourier Transform algorithms. The input data are replaced by the transformation output, and therefore is lost.

### cplxFft32f

void cplxFft32f(DT32S n, DT32S isgn, DT32F *srcdst, DT32S *ip, DT32F *w);

Calculates the Fast Fourier Transform in place of the complex data stored in the array srcdst of length n.
• Input Parameters :
• n : length of FFT, must be power of 2
• isgn : Transform direction, must be FORWARD or INVERSE
• srcdst : data array to be replaced by its FFT
• ip : pointer to an integer bit-reversal array
• w : pointer to twiddle factor table
• Returns :
• Void
• Output Parameters :
• srcdst is replaced by its Fourier transformation.
• Error Conditions
None
• Remarks :
• 1 . the tables ip and w can be generated using the mktable tool. mktable writes those tables as static arrays in a .h file to be included with the application. The tables can also be generated by calling initCplxFft32f(n, ip, w).
• 2 . The FFT output is not scaled. To obtain the same vector after forward followed by inverse transformation, the inverse transformation result should be scaled by 1.0/n.
• 3 . Data is stored in the follows order: R I R I ... R[n-1] I[n-1]

### realFft32f

void realFft32f(DT32S n, DT32S isgn, DT32F *srcdst, DT32S *ip, DT32F *w);

Calculates the Fast Fourier Transform in place of the real array srcdst of length n.
• Input Parameters :
• n : length of FFT, must be power of 2
• isgn : Transform direction, must be FORWARD or INVERSE
• srcdst : data array to be replaced by its FFT
• ip : pointer to an integer bit-reversal array
• w : pointer to twiddle factor table
• Returns :
• Void
• Output Parameters :
• srcdst is replaced by its Fourier transformation.
• Error Conditions
None
• Remarks :
• 1 . The tables ip and w can be generated using the mktable tool. mktable writes those tables as static arrays in a .h file to be included with the application. The tables can also be generated by calling initRealFft32f(n, ip, w).
• 2 . The FFT output is not scaled. To obtain the same vector after forward followed by inverse transformation, the inverse transformation result should be scaled by 2.0/n.
• 3 . Since the FFT of a real vector is conjugate symmetric, only one half of the data need to be stored. The output data of the forward transformation and the input data to the inverse transformation is stored in a compact form as follows: R R[n/2] R I ... R[n/2-1] I[n/2-1]

### ddct32f

void ddct32f(DT32S n, DT32S isgn, DT32F *srcdst, DT32S *ip, DT32F *w);

Calculates the Discrete Cosine Transform in place of the real array srcdst of length n.
• Input Parameters :
• n : length of DCT transform, must be power of 2
• isgn : Transform direction, must be FORWARD or INVERSE
• srcdst : data array to be replaced by its DCT
• ip : pointer to an integer bit-reversal array
• w : pointer to twiddle factor table
• Returns :
• Void
• Output Parameters :
• srcdst is replaced by its discrete cosine transformation.
• Error Conditions
None
• Remarks :
• 1 . The tables ip and w can be generated using the mktable tool. mktable writes those tables as static arrays in a .h file to be included with the application. The tables can also be generated by calling initDdsct(n, ip, w).
• 2 . The DCT output is not scaled. To obtain the same vector after forward followed by inverse transformation, the first element (srcdst) must be multiplied by 0.5 before inverse transforming, the inverse transformation result should be scaled by 2.0/n.

### ddst32f

void ddst32f(DT32S n, DT32S isgn, DT32F *srcdst, DT32S *ip, DT32F *w);

Calculates the Discrete Sine Transform in place of the real array srcdst of length n.
• Input Parameters :
• n : length of DST transform, must be power of 2
• isgn : Transform direction, must be FORWARD or INVERSE
• srcdst : data array to be replaced by its DST
• ip : pointer to an integer bit-reversal array
• w : pointer to twiddle factor table
• Returns :
• Void
• Output Parameters :
• srcdst is replaced by its discrete sine transformation.
• Error Conditions
None
• Remarks :
• 1 . The tables ip and w can be generated using the mktable tool. mktable writes those tables as static arrays in a .h file to be included with the application. The tables can also be generated by calling initDdsct(n, ip, w).
• 2 . The DST output is not scaled. To obtain the same vector after forward followed by inverse transformation, the first element (srcdst) must be multiplied by 0.5 before inverse transforming, the inverse transformation result should be scaled by 2.0/n.

### dfct32f

void dfct32f(DT32S n, DT32F *srcdst, DT32F *t, DT32S *ip, DT32F *w);

Calculates the Discrete Cosine Transform in place of the real symmetric data in the array srcdst of length n.
• Input Parameters :
• n : length of DST transform, must be power of 2
• isgn : Transform direction, must be FORWARD or INVERSE
• srcdst : data array to be replaced by its DST
• ip : pointer to an integer bit-reversal array
• w : pointer to twiddle factor table
• Returns :
• Void
• Output Parameters :
• srcdst is replaced by its discrete sine transformation.
• Error Conditions
None
• Remarks :
• 1 . The tables ip and w can be generated using the mktable tool. mktable writes those tables as static arrays in a .h file to be included with the application. The tables can also be generated by calling initDfsct32f(n, ip, w).
• 2 . The DST output is not scaled. To obtain the same vector after forward followed by inverse transformation, the inverse transformation result should be scaled by 2.0/n.

### dfst32f

void dfst32f(DT32S n, DT32F *srcdst, DT32F *t, DT32S *ip, DT32F *w);

Calculates the Discrete Sine Transform in place of the real anti-symmetric data in the array srcdst of length n.
• Input Parameters :
• n : length of DST transform, must be power of 2
• isgn : Transform direction, must be FORWARD or INVERSE
• srcdst : data array to be replaced by its DST
• ip : pointer to an integer bit-reversal array
• w : pointer to twiddle factor table
• Returns :
• Void
• Output Parameters :
• srcdst is replaced by its discrete sine transformation.
• Error Conditions
None
• Remarks :
• 1 . The tables ip and w can be generated using the mktable tool. mktable writes those tables as static arrays in a .h file to be included with the application. The tables can also be generated by calling initDfsct32f(n, ip, w).
• 2 . The DST output is not scaled. To obtain the same vector after forward followed by inverse transformation, the inverse transformation result should be scaled by 2.0/n.

### initRealFft32f

void initRealFft32f(DT32S n, DT32S *ip, DT32F *w);

Populates the twiddle factor and bit reversal working area needed for the realFFT routine.
• Input Parameters :
• n : length of FFT transform, must be power of 2
• Returns :
• Void
• Output Parameters :
• ip : bit-reversal array is populated
• w : twiddle factor table is populated
• Error Conditions
None
• Remarks :
ip must be at least [sqrt(n/2)+2] long and w must be at least [n/2] long.

### initCplxFft32f

void initCplxFft32f(DT32S n, DT32S *ip, DT32F *w);

Populates the twiddle factor and bit reversal working area needed for the cplxFFT routine.
• Input Parameters :
• n : length of FFT transform (number of complex elements), must be power of 2
• Returns :
• Void
• Output Parameters :
• ip : bit-reversal array is populated
• w : twiddle factor table is populated
• Error Conditions
None
• Remarks :
ip must be at least [sqrt(n)+2] long and w must be at least [n/2] long.

### initDdsct32f

void initDdsct32f(DT32S n, DT32S *ip, DT32F *w);

Populates the twiddle factor and bit reversal working area needed for the ddst and ddct routines.
• Input Parameters :
• n : length of FFT transform, must be power of 2
• Returns :
• Void
• Output Parameters :
• ip : bit-reversal array is populated
• w : twiddle factor table is populated
• Error Conditions
None
• Remarks :
ip must be at least [sqrt(n/2)+2] long and w must be at least [n*5/4] long.

### initDfsct32f

void initDfsct32f(DT32S n, DT32S *ip, DT32F *w);

Populates the twiddle factor and bit reversal working area needed for the ddst and ddct routines.
• Input Parameters :
• n : length of FFT transform, must be power of 2
• Returns :
• Void
• Output Parameters :
• ip : bit-reversal array is populated
• w : twiddle factor table is populated
• Error Conditions
None
• Remarks :
ip must be at least [sqrt(n/4)+2] long and w must be at least [n*5/8] long.