beautypg.com

Texas Instruments TMS320C64X User Manual

Page 132

background image

DSP_fft

4-104

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

/* Offset to next subtable of twiddle factors. With each iteration */

/* of the above block, six twiddle factors get read, s times, */

/* hence the offset into the twiddle factor array is advanced by */

/* this amount. */

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

t += 6 * s;

}

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

/* Get the magnitude of ”n”, so we know how many digits to reverse. */

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

for (i = 31, m = 1; (n & (1 << i)) == 0; i−−, m++) ;

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

/* Perform final stage with digit reversal. */

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

s = n >> 2;

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

/* One of the nice features, of this last stage are that, no multiplies */

/* are required. In addition, the data always strides by a fixed amount */

/* namely 8 elements. Since the data is stored as interleaved pairs, of */

/* real and imaginary data, the first eight elements contain the data */

/* for the first four complex inputs. These are the inputs to the first */

/* radix4 butterfly. */

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

#ifndef NOASSUME

#pragma MUST_ITERATE(4,,4);

#endif

for (i = 0; i < n; i += 4)

{

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 butterfly. */

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