- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
What's wrong with this class? Is this the right way to handle the IppsFFTSpec_C_32fc workspace? I don't think so.
using
System;namespace
IPP{
///{
// TODO: Add x-axis label calculation helpers // Defines // private static int PSD_SIZE = 4096; private static int PSD_SIZE = 64; private static int PSD_ORDER = 12; private static int IPP_FFT_NODIV_BY_ANY = 8; // FFT public ipp.Ipp32fc []fftIn = new ipp.Ipp32fc[PSD_SIZE]; private ipp.Ipp32fc []fftOut = new ipp.Ipp32fc[PSD_SIZE]; private byte []fftScratch = new byte[PSD_SIZE]; // Power Spectrum public float []psd = new float[PSD_SIZE]; // FFT Workspace private ipp.IppsFFTSpec_C_32fc fftw = new ipp.IppsFFTSpec_C_32fc(); // Status private ipp.IppStatus status; public FFT(){
}
unsafe public void Init(){
// FFT Workspaceipp.IppsFFTSpec_C_32fc fftws = fftw;
// fftws = new ipp.IppsFFTSpec_C_32fc();ipp.IppsFFTSpec_C_32fc *pfftws = &fftws;
status = ipp.sp.ippsFFTInitAlloc_C_32fc(&pfftws, PSD_ORDER, IPP_FFT_NODIV_BY_ANY, ipp.IppHintAlgorithm.ippAlgHintFast);
Log("ippsFFTInitAlloc_C_32fc status=" + status.ToString());
fftw = fftws;
}
// Read input from fftIn, write output to psd unsafe public void Process(){
// FFT Workspaceipp.IppsFFTSpec_C_32fc fftws = fftw;
// fftws = new ipp.IppsFFTSpec_C_32fc();ipp.IppsFFTSpec_C_32fc *pfftws = &fftws;
fixed(byte *pfftScratch = fftScratch) fixed(float *ppsd = psd){
status = ipp.sp.ippsFFTFwd_CToC_32fc(fftIn, fftOut, pfftws, pfftScratch);
if (status != ipp.IppStatus.ippStsNoErr) Log("ippsFFTFwd_CToC_32fc status=" + status.ToString());status = ipp.sp.ippsPowerSpectr_32fc(fftOut, ppsd, PSD_SIZE);
if (status != ipp.IppStatus.ippStsNoErr) Log("ippsPowerSpectr_32fc status=" + status.ToString());}
for (int i=0; i < PSD_SIZE; i++){
psd = 10.0F * (
float)Math.Log10(psd);}
}
private void Log(string text){
Console.WriteLine(text);
}
}
}
Link Copied
0 Replies
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page