-(void)creatWithMaxP:(int) maxp
{
vDSP_Length log2n = log2f(maxp);
_fftSetup = vDSP_create_fftsetup(log2n, FFT_RADIX2);
}
-(void)FFTMRelease
{
vDSP_destroy_fftsetup(_fftSetup);
}
- (void)test{
COMPLEX_SPLIT jubufferdata;
jubufferdata.realp=(Float32 *)malloc(5*sizeof(Float32));
jubufferdata.imagp=(Float32 *)malloc(5*sizeof(Float32));
jubufferdata.realp[1] =2;
[self creatWithMaxP:32];
vDSP_fft_zrip(_fftSetup, &jubufferdata, 1, 5, FFT_FORWARD);
}
-(void)FFT:(COMPLEX_SPLIT *)inOutData lengnth:(long) numofp
{
vDSP_Length log2n = log2f(numofp*2);
vDSP_fft_zrip(_fftSetup,inOutData,1,log2n, FFT_FORWARD);
}
-(void)IFFT:(COMPLEX_SPLIT *)inOutData lengnth:(long) numofp
{
vDSP_Length log2n = log2f(numofp*2);
vDSP_fft_zrip(_fftSetup,inOutData,1,log2n, FFT_INVERSE);
Float32 normf=1.0/(4*numofp);
vDSP_vsmul(inOutData->realp, 1, &normf,inOutData->realp,1,numofp);
vDSP_vsmul(inOutData->imagp, 1, &normf,inOutData->imagp,1,numofp);
}
-(void)XiangCheng:(Float32 *)indataA B:(Float32 *)indataB OUT:(Float32 *)outData lenght:(long)numofp
{
vDSP_vmul(indataA,1,indataB,1,outData,1,numofp);
}
网友评论