beautypg.com

Texas Instruments TMS320C64X User Manual

Page 123

background image

DSP_r4fft

4-95

C64x+ DSPLIB Reference

Complex Forward FFT (radix 4)

DSP_r4fft

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_r4fft (int nx, short * restrict x, const short * restrict w)

Arguments

nx

Number of complex elements in vector x. Must be a power of 4
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 size nx, a power
of 4, with “decimation-in-frequency decomposition” method. The output is in
digit-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_r4fft (int nx, short x[ ], short w[ ])

{

int

n1, n2, ie, ia1, ia2, ia3, i0, i1, i2, i3,

j, k;

short

t, r1, r2, s1, s2, co1, co2, co3, si1,

si2, si3;

n2 = nx;

ie = 1;

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

n1 = n2;

n2 >>= 2;

ia1 = 0;

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

ia2 = ia1 + ia1;

ia3 = ia2 + ia1;

co1 = w[ia1 * 2 + 1];