美文网首页数据结构与算法
FFT快速傅立叶变换

FFT快速傅立叶变换

作者: 小明讲啥故事 | 来源:发表于2019-05-02 20:49 被阅读0次
-(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);
}

相关文章

网友评论

    本文标题:FFT快速傅立叶变换

    本文链接:https://www.haomeiwen.com/subject/yqkonqtx.html