Skip to content

File fft_core.h

FileList > fft > fft_core.h

Go to the source code of this file

Per-instance 1-D FFT using pocketfft directly. More...

  • #include "clib_common.h"
  • #include "dp/pocketfft.h"

Classes

Type Name
struct fft_state_t

Public Functions

Type Name
fft_state_t * fft_create (size_t n, int sign, int nthreads)
Create a 1-D FFT instance.
void fft_destroy (fft_state_t * state)
Destroy and free an fft instance.
size_t fft_execute_cf32 (fft_state_t * state, const float complex * in, size_t n_in, float complex * out)
Out-of-place 1-D CF32 FFT.
size_t fft_execute_cf32_max_out (fft_state_t * state)
Maximum output samples for CF32 execute (always == n).
size_t fft_execute_cf64 (fft_state_t * state, const double complex * in, size_t n_in, double complex * out)
Out-of-place 1-D CF64 FFT.
size_t fft_execute_cf64_max_out (fft_state_t * state)
Maximum output samples per execute call (always == n).
size_t fft_execute_inplace_cf32 (fft_state_t * state, const float complex * in, size_t n_in, float complex * out)
In-place 1-D CF32 FFT (copies in→out, then transforms in out).
size_t fft_execute_inplace_cf32_max_out (fft_state_t * state)
Maximum output samples for inplace CF32 (always == n).
size_t fft_execute_inplace_cf64 (fft_state_t * state, const double complex * in, size_t n_in, double complex * out)
In-place 1-D CF64 FFT (copies in→out, then transforms in out).
size_t fft_execute_inplace_cf64_max_out (fft_state_t * state)
Maximum output samples for inplace CF64 (always == n).
void fft_reset (fft_state_t * state)
No-op reset (plans are immutable after creation).

Detailed Description

Holds two pocketfft plans — one for CF64, one for CF32 — allocated at create time for the requested transform length and sign. nthreads is accepted for API compatibility but ignored; pocketfft is single-threaded.

Lifecycle:

fft_state_t *fft = fft_create(1024, -1, 1);
double complex out[1024];
fft_execute_cf64(fft, in, 1024, out);
fft_destroy(fft);

Public Functions Documentation

function fft_create

Create a 1-D FFT instance.

fft_state_t * fft_create (
    size_t n,
    int sign,
    int nthreads
) 

Allocates one CF64 and one CF32 pocketfft plan for length n. nthreads is accepted for API compatibility but ignored.

Parameters:

  • n Transform length in samples.
  • sign -1 for forward DFT, +1 for inverse.
  • nthreads Ignored (pocketfft is single-threaded).

Returns:

Heap-allocated state, or NULL on allocation failure.


function fft_destroy

Destroy and free an fft instance.

void fft_destroy (
    fft_state_t * state
) 

Parameters:

  • state May be NULL.

function fft_execute_cf32

Out-of-place 1-D CF32 FFT.

size_t fft_execute_cf32 (
    fft_state_t * state,
    const float complex * in,
    size_t n_in,
    float complex * out
) 

Parameters:

  • state Must be non-NULL.
  • in Input buffer of length n_in.
  • n_in Number of input samples.
  • out Output buffer of length >= n.

Returns:

n (samples written).


function fft_execute_cf32_max_out

Maximum output samples for CF32 execute (always == n).

size_t fft_execute_cf32_max_out (
    fft_state_t * state
) 


function fft_execute_cf64

Out-of-place 1-D CF64 FFT.

size_t fft_execute_cf64 (
    fft_state_t * state,
    const double complex * in,
    size_t n_in,
    double complex * out
) 

Parameters:

  • state Must be non-NULL.
  • in Input buffer of length n_in (must equal state->n).
  • n_in Number of input samples.
  • out Output buffer of length >= n.

Returns:

n (samples written).


function fft_execute_cf64_max_out

Maximum output samples per execute call (always == n).

size_t fft_execute_cf64_max_out (
    fft_state_t * state
) 


function fft_execute_inplace_cf32

In-place 1-D CF32 FFT (copies in→out, then transforms in out).

size_t fft_execute_inplace_cf32 (
    fft_state_t * state,
    const float complex * in,
    size_t n_in,
    float complex * out
) 

Parameters:

  • state Must be non-NULL.
  • in Source; copied into out before the transform.
  • n_in Number of input samples.
  • out Buffer of length >= n; must not alias in.

Returns:

n (samples written).


function fft_execute_inplace_cf32_max_out

Maximum output samples for inplace CF32 (always == n).

size_t fft_execute_inplace_cf32_max_out (
    fft_state_t * state
) 


function fft_execute_inplace_cf64

In-place 1-D CF64 FFT (copies in→out, then transforms in out).

size_t fft_execute_inplace_cf64 (
    fft_state_t * state,
    const double complex * in,
    size_t n_in,
    double complex * out
) 

Parameters:

  • state Must be non-NULL.
  • in Source; copied into out before the transform.
  • n_in Number of input samples.
  • out Buffer of length >= n; must not alias in.

Returns:

n (samples written).


function fft_execute_inplace_cf64_max_out

Maximum output samples for inplace CF64 (always == n).

size_t fft_execute_inplace_cf64_max_out (
    fft_state_t * state
) 


function fft_reset

No-op reset (plans are immutable after creation).

void fft_reset (
    fft_state_t * state
) 



The documentation for this class was generated from the following file native/inc/fft/fft_core.h