HARDT - The Ham Radio DSP Toolkit
Public Member Functions | List of all members
HFft< T > Class Template Reference

#include <hfft.h>

Public Member Functions

 HFft (int size, HWindow< T > *window=nullptr)
 
void FFT (std::complex< T > *src, std::complex< double > *result)
 
void FFT (T *src, std::complex< double > *result, bool window=true)
 
void FFT (T *src, double *spectrum, double *phase=nullptr)
 
void IFFT (std::complex< double > *src, T *result)
 
void HILBERT (T *src, T *dest)
 
void SPECTRUM (T *response, int length, std::complex< double > *spectrum)
 
void IQ2REAL (T *multiplexed, T *real)
 
void IQ2REAL (std::complex< T > *iq, T *real)
 

Detailed Description

template<class T>
class HFft< T >

(D)FFT related functions

Constructor & Destructor Documentation

◆ HFft()

template<class T >
HFft< T >::HFft ( int  size,
HWindow< T > *  window = nullptr 
)
inline

Construct a new FFT class

Parameters: size = fft size window = a window to smoothen the first and last parts of the input samples to avoid high frequency "splatter"

Member Function Documentation

◆ FFT() [1/3]

template<class T >
void HFft< T >::FFT ( std::complex< T > *  src,
std::complex< double > *  result 
)
inline

Calculate the fft for complex samples and place the complex results into a buffer

Parameters: src = Input buffer, must contain 'size' number of complex samples result = The output result array, must have enough room for 'size' values

◆ FFT() [2/3]

template<class T >
void HFft< T >::FFT ( T *  src,
double *  spectrum,
double *  phase = nullptr 
)
inline

Calculate the fft for samples and place the real values spectrum into a buffer

Parameters: src = Input buffer, must contain 'size/2' number of samples spectrum = The output spectrum array, must have enough room for 'size'/2 values

◆ FFT() [3/3]

template<class T >
void HFft< T >::FFT ( T *  src,
std::complex< double > *  result,
bool  window = true 
)
inline

Calculate the fft for samples and place the complex results into a buffer

Parameters: src = Input buffer, must contain 'size' number of samples result = The output result array, must have enough room for 'size' values

◆ HILBERT()

template<class T >
void HFft< T >::HILBERT ( T *  src,
T *  dest 
)
inline

Run the input signal through a hilbert transform (delay 90 degrees)

◆ IFFT()

template<class T >
void HFft< T >::IFFT ( std::complex< double > *  src,
T *  result 
)
inline

Calculate the ifft for complex values and place the samples into a buffer

Parameters: src = Input buffer, must contain 'size/2' number of complex values representing positive frequencies result = The output samples array, must have enough room for 'size' samples

◆ IQ2REAL() [1/2]

template<class T >
void HFft< T >::IQ2REAL ( std::complex< T > *  iq,
T *  real 
)
inline

Convert IQ data to a real valued signal

◆ IQ2REAL() [2/2]

template<class T >
void HFft< T >::IQ2REAL ( T *  multiplexed,
T *  real 
)
inline

Convert IQ data to a real valued signal

The IQ data must be kept in a multiplexed buffer, alternating I and Q samples. The 'multiplexed' buffer must thus be 2 times the size of the FFT object (2048 multiplexed IQ value yields 1024 output samples) so make sure that you input blocksize*2 samples!

◆ SPECTRUM()

template<class T >
void HFft< T >::SPECTRUM ( T *  response,
int  length,
std::complex< double > *  spectrum 
)
inline

Return the spectrum for a frequency response. For use when one needs the spectrum of a filter, for example to do frequency domain filtering.

This would typically be a set of FIR coefficients, but can be any frequency response as long as it is not infinite and has a length <= fft-size/2.

'spectrum' must have enough room for 'fft-size' samples.


The documentation for this class was generated from the following file: