2018-01-29 15:14:50 +00:00
|
|
|
// fft.h
|
|
|
|
//
|
|
|
|
// Author: J.A. de Jong - ASCEE
|
|
|
|
//
|
|
|
|
// Description:
|
|
|
|
// Interface to the FFT library, multiple channel FFT's
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#ifndef FFT_H
|
|
|
|
#define FFT_H
|
|
|
|
#include "types.h"
|
|
|
|
#include "ascee_math.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Perform forward FFT's on real time data.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct Fft_s Fft;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct an Fft object
|
|
|
|
*
|
|
|
|
* @param nfft Nfft size
|
|
|
|
*
|
|
|
|
* @return Pointer to Fft handle, NULL on error
|
|
|
|
*/
|
2018-02-10 20:14:17 +00:00
|
|
|
Fft* Fft_alloc(const us nfft);
|
2018-01-29 15:14:50 +00:00
|
|
|
/**
|
|
|
|
* Returns the nfft for this Fft instance
|
|
|
|
*
|
|
|
|
* @return nfft
|
|
|
|
*/
|
|
|
|
us Fft_nfft(const Fft*);
|
|
|
|
|
2018-02-10 20:14:17 +00:00
|
|
|
/**
|
|
|
|
* Compute the fft of a single channel.
|
|
|
|
*
|
|
|
|
* @param[in] fft Fft handle.
|
|
|
|
*
|
|
|
|
* @param[in] timedata Input time data pointer, should have size nfft
|
|
|
|
* @param[out] result Pointer to result vector should have size
|
|
|
|
* nfft/2+1
|
|
|
|
*/
|
|
|
|
void Fft_fft_single(const Fft* fft,const vd* timedata,vc* result);
|
2018-01-29 15:14:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Compute the fft of the data matrix, first axis is assumed to be
|
|
|
|
* the time axis.
|
|
|
|
*
|
2018-02-10 20:14:17 +00:00
|
|
|
* @param[in] fft Fft handle.
|
|
|
|
|
|
|
|
* @param[in] timedata Input time data. First axis is assumed to be
|
|
|
|
* the time, second the channel number.
|
2018-01-29 15:14:50 +00:00
|
|
|
*
|
2018-02-10 20:14:17 +00:00
|
|
|
* @param[out] result: Fft't data, should have size (nfft/2+1) *
|
|
|
|
* nchannels
|
2018-01-29 15:14:50 +00:00
|
|
|
*/
|
2018-02-10 20:14:17 +00:00
|
|
|
void Fft_fft(const Fft* fft,const dmat* timedata,cmat* result);
|
2018-01-29 15:14:50 +00:00
|
|
|
|
2018-02-12 18:32:23 +00:00
|
|
|
/**
|
|
|
|
* Perform inverse FFT
|
|
|
|
*
|
|
|
|
* @param[in] fft Fft handle
|
|
|
|
* @param[in] freqdata Frequency domain data
|
|
|
|
* @param[out] timedata
|
|
|
|
*/
|
|
|
|
void Fft_ifft(const Fft* fft,const cmat* freqdata,dmat* timedata);
|
|
|
|
|
2018-02-10 20:14:17 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param fft
|
|
|
|
*/
|
2018-01-29 15:14:50 +00:00
|
|
|
void Fft_free(Fft* fft);
|
|
|
|
|
|
|
|
#endif // FFT_H
|
|
|
|
//////////////////////////////////////////////////////////////////////
|