Part Number: AM5728
Hello,I try to add some FFT codes on my IPC program.The codes are shown below:
define FFTSZ 64
unsigned char brev[64] = {
0x0, 0x20, 0x10, 0x30, 0x8, 0x28, 0x18, 0x38,
0x4, 0x24, 0x14, 0x34, 0xc, 0x2c, 0x1c, 0x3c,
0x2, 0x22, 0x12, 0x32, 0xa, 0x2a, 0x1a, 0x3a,
0x6, 0x26, 0x16, 0x36, 0xe, 0x2e, 0x1e, 0x3e,
0x1, 0x21, 0x11, 0x31, 0x9, 0x29, 0x19, 0x39,
0x5, 0x25, 0x15, 0x35, 0xd, 0x2d, 0x1d, 0x3d,
0x3, 0x23, 0x13, 0x33, 0xb, 0x2b, 0x1b, 0x3b,
0x7, 0x27, 0x17, 0x37, 0xf, 0x2f, 0x1f, 0x3f
};
float x[2*FFTSZ];
float y[2*FFTSZ];
float w[2*FFTSZ];
float w1[2*FFTSZ];
float z[2*FFTSZ];
void tw_gen(float *w, int n)
{
int i, j, k;
const double PI = 3.141592654;
for (j = 1, k = 0; j <= n>> 2; j = j << 2)
{
for (i = 0; i < n>> 2; i += j)
{
w[k] = (float) sin ( 2 * PI * i / n);
w[k + 1] = (float) cos ( 2 * PI * i / n);
w[k + 2] = (float) sin ( 4 * PI * i / n);
w[k + 3] = (float) cos ( 4 * PI * i / n);
w[k + 4] = (float) sin (6 * PI * i / n);
w[k + 5] = (float) cos (6 * PI * i / n);
k += 6;
}
}
}
for (i = 0; i < FFTSZ; i++) {
x[PAD + 2*i] = 2*i;
x[PAD + 2*i + 1] = 0;
}
tw_gen (w, FFTSZ);
DSPF_sp_fftSPxSP (FFTSZ, x, w, y, brev, 4, 0, FFTSZ);
I debug the codes in CCS,and the result is the same as that in MATLAB.
But when I add the codes in my original IPC program,the result of FFT is not right.It is very confused,It seems like that same codes run in different program and we get the different result.
the real part of FFT from MATLAB as shown below:
4032 -64 -64 -64.0000000000000 -64 -64 -64 -64.0000000000000 -64 -64 -64.0000000000000 -64.0000000000000 -64-64 -64.0000000000000 -64.0000000000000 -64 -64.0000000000000 -64.0000000000000 -64 -64 -64.0000000000000-64.0000000000000 -64.0000000000000 -64.0000000000000 -64.0000000000000 -64.0000000000000-64.0000000000000 -64 -64.0000000000000 -64.0000000000000 -64.0000000000000 -64 -64.0000000000000-64.0000000000000 -64.0000000000000 -64 -64.0000000000000 -64.0000000000000 -64.0000000000000-64.0000000000000 -64.0000000000000 -64.0000000000000 -64.0000000000000 -64 -64 -64.0000000000000-64.0000000000000 -64 -64.0000000000000 -64.0000000000000 -64 -64 -64.0000000000000 -64.0000000000000 -64-64 -64.0000000000000 -64 -64 -64 -64.0000000000000 -64 -64 ···
the real part of FFT from IPC program as shown below:
4032 2642440192.00000 -162695266304.000 -504451629056.000 347320320 -2.38915960232005e+18-3.94232585743550e+20 7.58157212632291e+20 -220194242560.000 -5.97797962912975e+19-4.86599865988547e+17 4.56920300019245e+20 76240519168.0000 4.76261923412662e+20 ···
Can someone tells why?