Thread View: comp.dsp
1 messages
1 total messages
Started by chris perkins
Tue, 13 Oct 1992 08:23
fft/dft progs wanted.
Author: chris perkins
Date: Tue, 13 Oct 1992 08:23
Date: Tue, 13 Oct 1992 08:23
59 lines
1994 bytes
1994 bytes
(Continued from the previous message)
}
}
}
/* Inverse FFT */
void
c_ifft( float *buffer, int n )
{
int step;
int step2;
int index;
bit_reverse( buffer, n );
for( step = 2, step2 = 2*PI_2; step < 2*n; step *= 2, step2 /= 2 ) {
for( kk = 0, index = 0; kk < 2*PI_2; kk += step2, index++ ) {
for(ii = index, jj = index+step/2; ii < n; ii += step, jj += step) {
buffer[jj*2] = buffer[jj*2]*sines[kk+PI_2]
- buffer[jj*2+1]*sines[kk];
buffer[jj*2+1] = buffer[jj*2+1]*sines[kk+PI_2]
+ buffer[jj*2]*sines[kk];
buffer[ii*2] = buffer[ii*2] + buffer[jj*2];
buffer[jj*2] = buffer[ii*2] - 2*buffer[jj*2];
buffer[ii*2+1] = buffer[ii*2+1] + buffer[jj*2+1];
buffer[jj*2+1] = buffer[ii*2+1] - 2*buffer[jj*2+1];
}
}
}
}
/* Bit-reversed indexing */
void
bit_reverse( float *buffer, int n )
{
for( kk = 0, jj = 1; jj < n; jj++ ) {
ii = 2;
while( kk >= n/ii ) {
kk -= n/ii;
ii <<= 1;
}
kk += n/ii;
if( kk > jj ) {
temp = buffer[jj*2];
buffer[jj*2] = buffer[kk*2];
buffer[kk*2] = temp;
temp = buffer[jj*2+1];
buffer[jj*2+1] = buffer[kk*2+1];
buffer[kk*2+1] = temp;
}
}
}
---
þ DeLuxeý/386 1.25 #9629 þ Best wishes, Chris Perkins
--
Canada Remote Systems - Toronto, Ontario
World's Largest PCBOARD System - 416-629-7000/629-7044
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads