beautypg.com

Texas Instruments TMS320C64X User Manual

Page 138

background image

DSP_fft16x16t

4-110

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

/* Set up offsets to access ”N/4”, ”N/2”, ”3N/4” complex point or */

/* ”N/2”, ”N”, ”3N/2” half word */

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

h2 = stride>>1;

l1 = stride;

l2 = stride + (stride >> 1);

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

/* Reset ”x” to point to the start of the input data array. */

/* ”tw_offset” starts off at 0, and increments by ”6 * stride” */

/* The stride quarters with every iteration of the outer loop */

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

x = ptr_x;

w = ptr_w + tw_offset;

tw_offset += fft_jmp;

stride >>= 2;

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

/* The following loop iterates through the different butterflies, */

/* within a given stage. Recall that there are logN to base 4 */

/* stages. Certain butterflies share the twiddle factors. These */

/* are grouped together. On the very first stage there are no */

/* butterflies that share the twiddle factor, all N/4 butter− */

/* flies have different factors. On the next stage two sets of */

/* N/8 butterflies share the same twiddle factor. Hence, after */

/* half the butterflies are performed, j the index into the */

/* factor array resets to 0, and the twiddle factors are reused. */

/* When this happens, the data pointer ’x’ is incremented by the */

/* fft_jmp amount. In addition, the following code is unrolled to */

/* perform ”2” radix4 butterflies in parallel. */

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

for (i = 0; i < npoints; i += 8)

{

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

/* Read the first 12 twiddle factors, six of which are used */

/* for one radix 4 butterfly and six of which are used for */

/* next one. */