DSP_fft

{

#ifndef NOASSUME

_nassert(i % 4 == 0);

_nassert(s >= 4); #pragma MUST_ITERATE(2,,2); #endif

for (j = 0; j < s; j += 2)

{

for (k = 0; k < 2; k++)

{

shortw1c, w1s, w2c, w2s, w3c, w3s;

short x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; short y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i;

/* −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− */

/*

Read the four samples that are the input to this

*/

/*

particular butterfly.

*/

/* −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− */

x0r = x[2*(i+j+k

) + 0]; x0i = x[2*(i+j+k

 

) + 1];

x1r = x[2*(i+j+k + s) + 0]; x1i = x[2*(i+j+k

+

s) + 1];

x2r = x[2*(i+j+k + 2*s)

+ 0]; x2i = x[2*(i+j+k

+ 2*s)

+ 1];

x3r = x[2*(i+j+k + 3*s)

+ 0]; x3i = x[2*(i+j+k

+

3*s)

+ 1];

/* −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− */

/*

Read the six twiddle

factors that are needed for 3 */

/*

of the four outputs.

(The first output has no mpys.) */

/* −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−*/

w1s = w[t + 2*k

+ 6*j

+ 0];

w1c = w[t + 2*k

+ 6*j

+ 1];

w2s = w[t +

2*k

+

6*j

+ 4];

w2c = w[t +

2*k

+

6*j

+ 5];

w3s = w[t +

2*k

+

6*j

+ 8];

w3c = w[t +

2*k

+

6*j

+ 9];

/* −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− */

/*

Calculate the four outputs, remembering that radix4

*/

/*

FFT accepts 4 inputs and produces 4 outputs. If we

*/

/*

imagine the inputs as being complex, and look at the */

/*

first stage as an example:

*/

/*

 

*/

/*

Four inputs are x(n) x(n+N/4) x(n+N/2) x(n+3N/4)

*/

/*

In general the four inputs can be generalized using

*/

C64x+ DSPLIB Reference

4-101

Page 129
Image 129
Texas Instruments TMS320C64X manual C64x+ Dsplib Reference 101