Real-valued FFT transform class. More...
#include <CDSPRealFFT.h>
Public Member Functions | |
| void | convertToZP (realfft_t *const p) const |
| Converts the specified forward-transformed FFT block into "zero-phase" form, suitable for use with the multiplyBlocksZP() function. | |
| realfft_t * | forward (double *const p) const |
| Performs in-place forward FFT. | |
| double | getInvMulConst () const |
| Return a multiplication constant that should be used after inverse transform to obtain a correct value scale. | |
| int | getLen () const |
| Returns the length (the number of real values in a transform) of this FFT object. | |
| int | getLenBits () const |
| Returns the length (the number of real values in a transform) of this FFT object, expressed as Nth power of 2. | |
| realfft_t * | getWorkBuf () const |
| Returns pointer to the internal work buffer. | |
| void | inverse (realfft_t *const p) const |
| Performs in-place inverse FFT. | |
| void | multiplyBlocks (const realfft_t *const ip, realfft_t *const op) const |
| Multiplies two complex-valued FFT blocks in-place. | |
| void | multiplyBlocks (const realfft_t *const ip1, const realfft_t *const ip2, realfft_t *const op) const |
| Multiplies two complex-valued data blocks and places result in a new data block. | |
| void | multiplyBlocksZP (const realfft_t *ip, realfft_t *op) const |
Multiplies two complex-valued FFT blocks in-place, considering that the ip block contains "zero-phase" response. | |
| realfft_t * | reorderForward (realfft_t *const p, realfft_t *const op) const |
| Reorders FFT bins from native ordering (after the forward transform) to sequential ordering. | |
| realfft_t * | reorderInverse (const realfft_t *const ip, double *const op) const |
| Reorders FFT bins from sequential ordering (before the inverse transform) to native ordering. | |
Static Public Member Functions | |
| static void | setBinNyquist (realfft_t *const p, const realfft_t v) |
| Replaces the Nyquist FFT bin in the specified block. | |
Friends | |
| class | CDSPRealFFTKeeper |
| class | CPtrKeeper< CDSPRealFFT > |
| class | CSinglyLinkedListItem< CDSPRealFFT > |
Real-valued FFT transform class.
Class implements a wrapper for real-valued discrete fast Fourier transform functions. The object of this class can only be obtained via the CDSPRealFFTKeeper class.
As a general pre-condition, the buffers passed to the functions of this class should be aligned to 32 bytes.
Uses functions from the FFT package: http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html
Also uses functions from the PFFFT and PFFFT DOUBLE packages.
Also uses Intel IPP library functions if available (if the R8B_IPP=1 macro was defined). Note that IPP library's FFT functions are 2-3 times more efficient on the modern Intel Core i7-3770K processor than Ooura's functions. It may be worthwhile investing in IPP. Note, that FFT functions take less than 20% of the overall sample rate conversion time. However, when the "power of 2" resampling is used the performance of FFT functions dominates.
| void r8b::CDSPRealFFT::convertToZP | ( | realfft_t *const | p | ) | const |
Converts the specified forward-transformed FFT block into "zero-phase" form, suitable for use with the multiplyBlocksZP() function.
| [in,out] | p | Block to transform. |
| realfft_t * r8b::CDSPRealFFT::forward | ( | double *const | p | ) | const |
Performs in-place forward FFT.
If FFT's native type differs from double, the result will be placed to p using values of the native type.
| [in,out] | p | Pointer to data block to transform, length should be equal to this object's getLen(). |
p casted to transform's native type. | realfft_t * r8b::CDSPRealFFT::getWorkBuf | ( | ) | const |
Returns pointer to the internal work buffer.
This buffer can be used for FFT bin reordering.
nullptr if FFT produces sequential-ordered FFT bins. This pointer should not be used beyond the calling context. | void r8b::CDSPRealFFT::inverse | ( | realfft_t *const | p | ) | const |
Performs in-place inverse FFT.
If FFT's native type differs from double, the result will be placed to p using double values.
| [in,out] | p | Pointer to data block to transform, length should be equal to this object's getLen(). |
Multiplies two complex-valued FFT blocks in-place.
Length of both blocks should be equal to this object's block length. Blocks should have been produced with the forward() function of this object.
| ip | Input FFT block 1. | |
| [in,out] | op | Output/input FFT block 2. |
| void r8b::CDSPRealFFT::multiplyBlocks | ( | const realfft_t *const | ip1, |
| const realfft_t *const | ip2, | ||
| realfft_t *const | op ) const |
Multiplies two complex-valued data blocks and places result in a new data block.
Length of all data blocks should be equal to this object's block length. Input blocks should have been produced with the forward() function of this object.
| ip1 | Input FFT block 1. | |
| ip2 | Input FFT block 2. | |
| [out] | op | Output FFT block, should not be equal to ip1 nor ip2. |
Multiplies two complex-valued FFT blocks in-place, considering that the ip block contains "zero-phase" response.
Length of both blocks should be equal to this object's block length. Blocks should have been produced with the forward() function of this object.
| ip | Input FFT block 1, "zero-phase" response. This block should be first transformed via the convertToZP() function. | |
| [in,out] | op | Output/input FFT block 2. |
Reorders FFT bins from native ordering (after the forward transform) to sequential ordering.
| p | Input FFT block. |
| op | Output FFT block. |
p if the transform has sequential ordering already. Reorders FFT bins from sequential ordering (before the inverse transform) to native ordering.
| ip | Pointer to FFT block (previously returned by the reorderForward() function). |
| op | Output FFT block (may equal ip). |
op casted to the realfft_t type).