beautypg.com

Texas Instruments TMS320C64X User Manual

Page 121

background image

DSP_radix2

4-93

C64x+ DSPLIB Reference

Complex Forward FFT (radix 2)

DSP_radix2

NOTE: This function is provided for backward compatibility with the C62x
DSPLIB. It has not been optimized for the C64x architecture. You are advised
to use one of the newly added FFT functions which have been optimized for the
C64x.

Function

void DSP_radix2 (int nx, short * restrict x, const short * restrict w)

Arguments

nx

Number of complex elements in vector x. Must be a power of 2
such that 4

nx

65536.

x[2*nx]

Pointer to input and output sequences. Size 2*nx elements.

w[nx]

Pointer to vector of FFT coefficients of size nx elements.

Description

This routine is used to compute FFT of a complex sequence of size nx, a power
of 2, with “decimation-in-frequency decomposition” method. The output is in
bit-reversed order. Each complex value is with interleaved 16-bit real and
imaginary parts.

Algorithm

This is the C equivalent of the assembly code without restrictions. Note that
the assembly code is hand optimized and restrictions may apply.

void DSP_radix2 (short x[ ],short nx,short w[ ])

{

short n1,n2,ie,ia,i,j,k,l;

short xt,yt,c,s;

n2 = nx;

ie = 1;

for (k=nx; k > 1; k = (k >> 1) ) {

n1 = n2;

n2 = n2>>1;

ia = 0;

for (j=0; j < n2; j++) {

c = w[2*ia];

s = w[2*ia+1];

ia = ia + ie;

for (i=j; i < nx; i += n1) {

l = i + n2;