void spx_drft_init(struct drft_lookup *l,int n) { l->n=n; l->trigcache=(float*)speex_alloc(3*n*sizeof(*l->trigcache)); l->splitcache=(int*)speex_alloc(32*sizeof(*l->splitcache)); fdrffti(n, l->trigcache, l->splitcache); }
void fft_forward(int n, float *buf,float *trigcache,int *splitcache){ int flag=0; if(!trigcache || !splitcache){ trigcache=calloc(3*n,sizeof(float)); splitcache=calloc(32,sizeof(int)); fdrffti(n, trigcache, splitcache); flag=1; } fdrfftf(n, buf, trigcache, splitcache); if(flag){ free(trigcache); free(splitcache); } }
void fft_backward(int n, float *buf, float *trigcache,int *splitcache){ int i; int flag=0; if(!trigcache || !splitcache){ trigcache=calloc(3*n,sizeof(float)); splitcache=calloc(32,sizeof(int)); fdrffti(n, trigcache, splitcache); flag=1; } fdrfftb(n, buf, trigcache, splitcache); for(i=0;i<n;i++)buf[i]/=n; if(flag){ free(trigcache); free(splitcache); } }
void fft_i(int n, float **trigcache, int **splitcache){ *trigcache=calloc(3*n,sizeof(float)); *splitcache=calloc(32,sizeof(int)); fdrffti(n, *trigcache, *splitcache); }
void drft_init(drft_lookup *l,int n){ l->n=n; l->trigcache=_ogg_calloc(3*n,sizeof(*l->trigcache)); l->splitcache=_ogg_calloc(32,sizeof(*l->splitcache)); fdrffti(n, l->trigcache, l->splitcache); }
void mumble_drft_init(drft_lookup *l,int n) { l->n=n; l->trigcache=reinterpret_cast<float *>(calloc(3*n,sizeof(*l->trigcache))); l->splitcache=reinterpret_cast<int *>(calloc(32,sizeof(*l->splitcache))); fdrffti(n, l->trigcache, l->splitcache); }