71 static int OptimizedLength(
int,
fcomplex* );
72 static int OptimizedLength(
int,
dcomplex* );
73 static int OptimizedLength(
int,
float* );
74 static int OptimizedLength(
int,
double* );
76 static void* Create(
int,
fcomplex* );
77 static void* Create(
int,
dcomplex* );
78 static void* Create(
int,
float* );
79 static void* Create(
int,
double* );
81 static void* CreateInv(
int,
fcomplex* );
82 static void* CreateInv(
int,
dcomplex* );
83 static void* CreateInv(
int,
float* );
84 static void* CreateInv(
int,
double* );
92 static void Transform(
void*,
fcomplex*,
const float* );
93 static void Transform(
void*,
dcomplex*,
const double* );
94 static void InverseTransform(
void*,
float*,
const fcomplex* );
95 static void InverseTransform(
void*,
double*,
const dcomplex* );
109 #define PCL_FFT_FORWARD -1
116 #define PCL_FFT_BACKWARD +1
129 template <
typename T>
255 if ( m_handle !=
nullptr )
256 this->
Destroy( m_handle ), m_handle =
nullptr;
257 if ( m_handleInv !=
nullptr )
258 this->
Destroy( m_handleInv ), m_handleInv =
nullptr;
268 mutable void* m_handle =
nullptr;
269 mutable void* m_handleInv =
nullptr;
275 #define m_handle this->m_handle
276 #define m_handleInv this->m_handleInv
277 #define m_dft this->m_dft
278 #define m_length this->Length()
294 template <
typename T>
367 if ( m_dft.IsEmpty() )
369 if ( m_handle ==
nullptr )
370 m_handle = this->Create( m_length,
static_cast<complex*
>(
nullptr ) );
371 this->Transform( m_handle, *m_dft, x );
389 if ( m_dft.IsEmpty() )
390 throw Error(
"Invalid out-of-place inverse FFT: No FFT has been performed." );
391 if ( m_handleInv ==
nullptr )
392 m_handleInv = this->CreateInv( m_length,
static_cast<complex*
>(
nullptr ) );
393 this->InverseTransform( m_handleInv, y, *m_dft );
407 PCL_PRECONDITION( x.
Length() >= m_length )
408 if ( x.
Length() < m_length )
409 throw Error(
"Invalid FFT input vector length." );
427 if ( y.
Length() < m_length )
428 throw Error(
"Invalid FFT output vector length." );
466 if ( m_handleInv ==
nullptr )
467 m_handleInv = this->CreateInv( m_length,
static_cast<complex*
>(
nullptr ) );
468 this->InverseTransform( m_handleInv, y, x );
472 if ( m_handle ==
nullptr )
473 m_handle = this->Create( m_length,
static_cast<complex*
>(
nullptr ) );
474 this->Transform( m_handle, y, x );
488 return FFT1DBase::OptimizedLength( n,
static_cast<complex*
>(
nullptr ) );
508 template <
typename T>
565 PCL_PRECONDITION( (length & 1) == 0 )
586 if ( m_dft.IsEmpty() )
588 if ( m_handle ==
nullptr )
589 m_handle = this->Create( m_length,
static_cast<scalar*
>(
nullptr ) );
590 this->Transform( m_handle, *m_dft, x );
608 if ( m_dft.IsEmpty() )
609 throw Error(
"Invalid out-of-place inverse FFT: No FFT has been performed." );
610 if ( m_handleInv ==
nullptr )
611 m_handleInv = this->CreateInv( m_length,
static_cast<scalar*
>(
nullptr ) );
612 this->InverseTransform( m_handleInv, y, *m_dft );
626 if ( x.
Length() < m_length )
627 throw Error(
"Invalid FFT input vector length." );
645 if ( y.
Length() < m_length )
646 throw Error(
"Invalid FFT output vector length." );
672 if ( m_handle ==
nullptr )
673 m_handle = this->Create( m_length,
static_cast<scalar*
>(
nullptr ) );
674 this->Transform( m_handle, y, x );
703 if ( m_handleInv ==
nullptr )
704 m_handleInv = this->CreateInv( m_length,
static_cast<scalar*
>(
nullptr ) );
705 this->InverseTransform( m_handleInv, y, x );
718 return FFT1DBase::OptimizedLength( n,
static_cast<scalar*
>(
nullptr ) );
731 #ifndef __PCL_NO_FFT1D_INSTANTIATE
744 using FFFT = GenericFFT<float>;
753 using DFFT = GenericFFT<double>;
762 using FRealFFT = GenericRealFFT<float>;
771 using DRealFFT = GenericRealFFT<double>;
Abstract base class of all fast Fourier transform classes.
Fast Fourier transform of 64-bit floating point complex data.
Fast Fourier transform of 64-bit floating point real data.
A simple exception with an associated error message.
Fast Fourier transform of 32-bit floating point complex data.
Fast Fourier transform of 32-bit floating point complex data.
Fast Fourier transform of 32-bit floating point real data.
Generic fast Fourier transform of complex data.
GenericFFT & operator()(complex *y, const complex *x, int dir=PCL_FFT_FORWARD) const
static int OptimizedLength(int n)
Generic fast Fourier transform of real data.
static int OptimizedLength(int n)
GenericRealFFT(int length)
GenericRealFFT & operator()(complex *y, const scalar *x) const
GenericRealFFT & operator()(scalar *y, const complex *x) const
~GenericRealFFT() override
int Length() const noexcept
Fast Fourier transform of 32-bit floating point real data.
A complex number whose components are 64-bit floating point real numbers.
A complex number whose components are 32-bit floating point real numbers.
Array< T, A > & operator<<(Array< T, A > &x, const V &v)
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
Console & operator>>(Console &o, char &c)
#define PCL_FFT_BACKWARD
Indicates an inverse Fourier transform.
#define PCL_FFT_FORWARD
Indicates a Fourier transform.