Hi,
When I read the example file of DSPLIB for C66, gen_twiddle_fft16x32.c, I do not understand the minus sign on line w[k + 3] and w[k + 1] at the big endian part. I only realize that big endian will reverse the access sequence of the elements. Why are there '-' signs at the big endian part?
Thanks,
/* ======================================================================== */
/* GEN_TWIDDLE -- Generate twiddle factors for TI's custom FFTs. */
/* */
/* USAGE */
/* This routine is called as follows: */
/* */
/* int gen_twiddle_fft16x32(short *w, int n) */
/* */
/* short *w Pointer to twiddle-factor array */
/* int n Size of FFT */
/* */
/* The routine will generate the twiddle-factors directly into the */
/* array you specify. The array needs to be approximately 2*N */
/* elements long. (The actual size, which is slightly smaller, is */
/* returned by the function.) */
/* ======================================================================== */
#ifdef _LITTLE_ENDIAN
int gen_twiddle_fft16x32(short *w, int n)
{
int i, j, k;
double M = 32767.5;
for (j = 1, k = 0; j < n >> 2; j = j << 2) {
for (i = 0; i < n >> 2; i += 2*j) {
w[k + 3] = d2s(M * cos(2.0 * PI * (i+j) / n));
w[k + 2] = d2s(M * sin(2.0 * PI * (i+j) / n));
w[k + 1] = d2s(M * cos(2.0 * PI * i / n));
w[k + 0] = d2s(M * sin(2.0 * PI * i / n));
k += 4;
}
}
return k;
}
#else
int gen_twiddle_fft16x32(short *w, int n)
{
int i, j, k;
double M = 32767.5;
for (j = 1, k = 0; j < n >> 2; j = j << 2) {
for (i = 0; i < n >> 2; i += 2*j) {
w[k + 3] =-d2s(M * sin(2.0 * PI * (i+j) / n));
w[k + 2] = d2s(M * cos(2.0 * PI * (i+j) / n));
w[k + 1] =-d2s(M * sin(2.0 * PI * i / n));
w[k + 0] = d2s(M * cos(2.0 * PI * i / n));
k += 4;
}
}
return k;
}
#endif