/* This is a header file for 'C' implemetations */
/* of Fast Fourier Transform */
/* FFT */
/* Jan Kybic */
/* see fft.h */
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include "fft.h"
static complex *work[2],*workbuff;//*w;
static unsigned length,power ;
int initfft(int p)
{ //int k ;
//long o ;//rea[256],imag[256];
power=p ; length=1<<p ;
if(!(workbuff=malloc(length*sizeof(complex))))
return(-1) ;
//if(!(w=malloc(length*sizeof(complex))))
//return(-1) ;
//o=(-4*asin(1)/length)*32*1024 ;
//o=0.5;
//for(k=0;k<length;k++)
//{ (w+k)->r=(cos(o*k))*32*1024 ;
//(w+k)->i=(sin(o*k))*32*1024;}
return(0) ;
}
void closefft()
{ //free(w) ;
free(workbuff) ;
}
/* ---------------------real & Q12------------------- */
static int real[256]={4096,4094,4091,4084,4076,
4065,4051,4035,4017,3996,3973,3947,3919,3889,
3856,3821,3784,3744,3702,3658,3612,3563,3513,
3460,3405,3348,3289,3229,3166,3101,3034,2966,
2896,2824,2750,2675,2598,2519,2439,2358,2275,
2191,2105,2018,1930,1841,1751,1659,1567,1474,
1379,1284,1189,1092,995,897,799,700,601,501,
401,301,200,100,0,-100,-200,-301,-401,-501,
-601,-700,-799,-897,-995,-1092,-1189,-1284,
-1379,-1474,-1567,-1659,-1751,-1841,-1930,
-2018,-2105,-2191,-2275,-2358,-2439,-2519,
-2598,-2675,-2750,-2824,-2896,-2966,-3034,
-3101,-3166,-3229,-3289,-3348,-3405,-3460,
-3513,-3563,-3612,-3658,-3702,-3744,-3784,
-3821,-3856,-3889,-3919,-3947,-3973,-3996,
-4017,-4035,-4051,-4065,-4076,-4084,-4091,
-4094,-4095,-4094,-4091,-4084,-4076,-4065,
-4051,-4035,-4017,-3996,-3973,-3947,-3919,
-3889,-3856,-3821,-3784,-3744,-3702,-3658,
-3612,-3563,-3513,-3460,-3405,-3348,-3289,
-3229,-3166,-3101,-3034,-2966,-2896,-2824,
-2750,-2675,-2598,-2519,-2439,-2358,-2275,
-2191,-2105,-2018,-1930,-1841,-1751,-1659,
-1567,-1474,-1379,-1284,-1189,-1092,-995
-897,-799,-700,-601,-501,-401,-301,-200,
-100,0,100,200,301,401,501,601,700,799,
897,995,1092,1189,1284,1379,1474,1567,1659,
1751,1841,1930,2018,2105,2191,2275,2358,2439,
2519,2598,2675,2750,2824,2896,2966,3034,3101,
3166,3229,3289,3348,3405,3460,3513,3563,3612,
3658,3702,3744,3784,3821,3856,3889,3919,3947,
3973,3996,4017,4035,4051,4065,4076,4084,4091,
4094};/*Q12*/
/* ---------------------imag & Q12------------------- */
static int imag[256]={0,-100,-200,-301,-401,-501,
-601,-700,-799,-897,-995,-1092,-1189,-1284,
-1379,-1474,-1567,-1659,-1751,-1841,-1930,
-2018,-2105,-2191,-2275,-2358,-2439,-2519,
-2598,-2675,-2750,-2824,-2896,-2966,-3034,
-3101,-3166,-3229,-3289,-3348,-3405,-3460,
-3513,-3563,-3612,-3658,-3702,-3744,-3784,
-3821,-3856,-3889,-3919,-3947,-3973,-3996,
-4017,-4035,-4051,-4065,-4076,-4084,-4091,
-4094,-4095,-4094,-4091,-4084,-4076,-4065,
-4051,-4035,-4017,-3996,-3973,-3947,-3919,
-3889,-3856,-3821,-3784,-3744,-3702,-3658,
-3612,-3563,-3513,-3460,-3405,-3348,-3289,
-3229,-3166,-3101,-3034,-2966,-2896,-2824,
-2750,-2675,-2598,-2519,-2439,-2358,-2275,
-2191,-2105,-2018,-1930,-1841,-1751,-1659,
-1567,-1474,-1379,-1284,-1189,-1092,-995
-897,-799,-700,-601,-501,-401,-301,-200,
-100,0,100,200,301,401,501,601,700,799,
897,995,1092,1189,1284,1379,1474,1567,1659,
1751,1841,1930,2018,2105,2191,2275,2358,2439,
2519,2598,2675,2750,2824,2896,2966,3034,3101,
3166,3229,3289,3348,3405,3460,3513,3563,3612,
3658,3702,3744,3784,3821,3856,3889,3919,3947,
3973,3996,4017,4035,4051,4065,4076,4084,4091,
4094,4095,4094,4091,4084,4076,4065,4051,4035,
4017,3996,3973,3947,3919,3889,3856,3821,3784,
3744,3702,3658,3612,3563,3513,3460,3405,3348,
3289,3229,3166,3101,3034,2966,2896,2824,2750,
2675,2598,2519,2439,2358,2275,2191,2105,2018,
1930,1841,1751,1659,1567,1474,1379,1284,1189,
1092,995,897,799,700,601,501,401,301,200,100};/*Q12*/
/* ---------------------------------------- */
/* There are two implementations, the first one uses three nested loops,
while the second uses only one two but uses many bitwise logical
operations. Either may run faster, depending on your machine. */
#define PREFERE_LOOPS
#ifdef PREFERE_LOOPS
/* -------------real & Q15--------------------------- */
//static long real[256]=
//{32768,32758,32679,32610,32521,32413,32285,
//32138,31971,31785,31581,31357,31114,30852,30572,30273,
//29956,29621,29629,28898,28511,28106,27684,27245,26790,
//26319,25832,25330,24812,24279,23732,23170,22594,22005,
//21403,20787,20159,19519,18868,18204,17530,16846,16151,
//15446,14732,14010,13278,12539,11793,11039,10278,9512,
//8739,7961,7179,6392,5602,4808,4011,3211,2410,1607,804,
//0,-804,-1607,-2410,-3211,-4011,-4808,-5602,-6392,-7179,
//-7961,-8739,-9512,-10278,-11039,-11793,-12539,-13278,
// -14010,-14732,-15446,-16151,-16846,-17530,-18204,-18868,
//-19519,-20159,-20787,-21403,-22005,-22594,-23170,-23732,
//-24279,-24812,-25330,-25832,-26319,-26790,-27245,-27684,
//-28106,-28511,-28898,-29269,-29621,-29956,-30273,-30572,
//-30852,-31114,-31357,-31581,-31785,-31791,-32138,-32285,
//-32413,-32521,-32610,-32679,-32728,-32758,-32767,-32758,
//-32728,-32679,-32610,-32521,-32413,-32285,-32138,-31791,
//-31785,-31581,-31357,-31114,-30852,-30572,-30273,-29956,
//-29621,-29269,-28898,-28511,-28106,-27684,-27245,-26790,
//-26319,-25832,-25330,-24812,-24279,-23732,-23170,-22594,
//-22005,-21403,-20787,-20159,-19519,-18868,-18204,-17530,
//-16846,-16151,-15446,-14732,-14010,-13278,-12539,-11793,
//-11039,-10278,-9512,-8739,-7961,-7179,-6392,-5602,-4808,
//-4011,-3211,-2410,-1607,-804,0,804,1607,2410,3211,4011,
//4808,5602,6392,7179,7961,8739,9512,10278,11039,11793,
//12539,13278,14010,14732,15446,16151,16846,17530,18204,
//18868,19519,20159,20787,21403,22005,22594,23170,23732,
//24279,24812,25330,25832,26319,26790,27245,27684,28106,
//28511,28898,29269,29621,29956,30273,30572,30852,31114,
//31357,31581,31785,31971,32138,32285,32413,32521,32610,
//32679,32728,32578}; /*Q15*/
/* -------------------imag & Q15--------------------- */
//static long imag[256]=
//{0,-804,-1607,-2410,-3211,-4011,-4808,
//-5602,-6392,-7179,-7961,-8739,-9512,-10278,-11039,
//-11793,-12539,-13278,-14010,-14732,-15446,-16151,
//-16846,-17530, -18204,-18868,-19519,-20159,-20787,
//-21403,-22005,-22594,-23170,-23732,-24279,-24812,
//-25330,-25832,-26319,-26790,-27245,-27684,-28106,
//-28511,-28898,-29269,-29621,-29956,-30273,
//-30572,-30852,-31114,-31357,-31581,-31785,-31971,
//-32138,-32285,-32413,-32521,-32610,-32679,-32728,
//-32758,-32767,-32758,-32728,-32679,-32610,-32521,
//-32413,-32285,-32138,-31971,-31785,-31581,-31357,
//-31114,-30852,-30572,-30273,-29956,-29621,-29269,
//-28898,-28511,-28106,-27684,-27245,-26790, -26319,
//-25832,-25330,-24812,-24279,-23732,-23170,-22594,
//-22005, -21403,-20787,-20159,-19519,-18868,-18204,
//-17530,-16846,-16151,-15446,-14732,-14010,-13278,
//-12539,-11793,-11039,-10278,-9512,-8739,-7961,-7179,
//-6392,-5602,-4808,-4011,-3211,-2410,-1607,-804,0,
//804,1607,2410,3211,4011,4808,5602,6392,7179,7961,8739,
///9512,10278,11039,11793,12539,13278,14010,14732,15446,
//16151,16846,17530,18204,18868,19519,20159,20787,21403,
//22005,22594,23170,23732,24279,24812,25330,25832,26319,
//26790,27245,27684,28106,28511,28898,29269,29621,29956,
///30273,30572,30852,31114,31357,31581,31785,31971,32138,
//32285,32413,32521,32610,32679,32728,32758,32767,32758,
//32728,32679,32610,32521,32413,32285,32138,31971,31785,
//31581,31357,31114,30852,30572,30273,29956,29621,29269,
//28898,28511,28106,27684,27245
fft.rar_fft_语音FFT
版权申诉
112 浏览量
2022-09-22
18:27:26
上传
评论
收藏 3KB RAR 举报
刘良运
- 粉丝: 71
- 资源: 1万+
最新资源
- ffmpeg-master-latest-win64-gpl-shared
- Ghostscript 10.03.1 for Windows (32 bit)
- 基于 python 实现对电信公司的数据做出分析,特征可视化,建立模型预测未知客户是否为要流失的客户
- Three.js可视化系统课程WebGL(2024年6月最新版49章)
- 微信小程序 MD5 AES SHA 加密解密
- 海光平台兼容性指南-国产化海光平台技术培训系列一
- AMQ28-SR4-M1-V1.0
- 基于STM32单片机的蓝牙小车.doc
- 《PHP网站开发实例教程》源代码.zip
- 2023年甘肃省职业院校技能大赛高职学生组网络系统管理赛项样卷.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈