Line 22... |
Line 22... |
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// for more details.
|
// for more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License along
|
// You should have received a copy of the GNU General Public License along
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
// with this program. (It's in the $(ROOT)/doc directory. Run make with no
|
// target there if the PDF file isn't present.) If not, see
|
// target there if the PDF file isn't present.) If not, see
|
// <http://www.gnu.org/licenses/> for a copy.
|
// <http://www.gnu.org/licenses/> for a copy.
|
//
|
//
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
// http://www.gnu.org/licenses/gpl.html
|
// http://www.gnu.org/licenses/gpl.html
|
Line 118... |
Line 118... |
// For an FFT stage of 2^n elements, we need 2^(n-1) butterfly
|
// For an FFT stage of 2^n elements, we need 2^(n-1) butterfly
|
// coefficients, sometimes called twiddle factors. Stage captures the
|
// coefficients, sometimes called twiddle factors. Stage captures the
|
// width of the FFT at this point. If thiss is a 2x at a time FFT,
|
// width of the FFT at this point. If thiss is a 2x at a time FFT,
|
// nwide will be equal to 2, and offset will be one or two.
|
// nwide will be equal to 2, and offset will be one or two.
|
//
|
//
|
assert(nwide > 0);
|
// assert(nwide > 0);
|
assert(offset < nwide);
|
// assert(offset < nwide);
|
assert(stage / nwide > 1);
|
// assert(stage / nwide > 1);
|
assert(stage % nwide == 0);
|
// assert(stage % nwide == 0);
|
printf("GEN-COEFFS(): stage =%4d, bits =%2d, nwide = %d, offset = %d, nverse = %d\n", stage, cbits, nwide, offset, inv);
|
// printf("GEN-COEFFS(): stage =%4d, bits =%2d, nwide = %d, offset = %d, nverse = %d\n", stage, cbits, nwide, offset, inv);
|
int ncoeffs = stage/nwide/2;
|
int ncoeffs = stage/nwide/2;
|
for(int i=0; i<ncoeffs; i++) {
|
for(int i=0; i<ncoeffs; i++) {
|
int k = nwide*i+offset;
|
int k = nwide*i+offset;
|
double W = ((inv)?1:-1)*2.0*M_PI*k/(double)(stage);
|
double W = ((inv)?1:-1)*2.0*M_PI*k/(double)(stage);
|
double c, s;
|
double c, s;
|