Skip to content

File resamp_dpmfs_core.h

FileList > inc > resamp_dpmfs > resamp_dpmfs_core.h

Go to the source code of this file

DPMFS polyphase resampler for cf32 IQ — self-contained core. More...

  • #include "clib_common.h"

Classes

Type Name
struct resamp_dpmfs_state_t
Full DPMFS resampler state (not opaque — allocated by _create).

Public Functions

Type Name
resamp_dpmfs_state_t * resamp_dpmfs_create (size_t poly_order, size_t n_taps, const float * c0, const float * c1, double rate)
Create a DPMFS polyphase resampler.
void resamp_dpmfs_destroy (resamp_dpmfs_state_t * state)
Free a DPMFS resampler.
size_t resamp_dpmfs_execute (resamp_dpmfs_state_t * state, const float complex * in, size_t n_in, float complex * out)
Resample a block of cf32 IQ samples.
size_t resamp_dpmfs_execute_max_out (resamp_dpmfs_state_t * state)
Maximum output samples per execute call.
size_t resamp_dpmfs_get_num_taps (const resamp_dpmfs_state_t * state)
Return the taps per phase (N).
size_t resamp_dpmfs_get_poly_order (const resamp_dpmfs_state_t * state)
Return the polynomial order (M).
double resamp_dpmfs_get_rate (const resamp_dpmfs_state_t * state)
Return the rate (fs_out / fs_in).
void resamp_dpmfs_reset (resamp_dpmfs_state_t * state)
Zero sample history and reset the phase accumulator.

Macros

Type Name
define RESAMP_DPMFS_DEFAULT_BLOCK 4096u

Detailed Description

The Dual Phase Modified Farrow Structure (DPMFS) replaces the large polyphase coefficient table with a compact polynomial bank (M+1)*N*2 float32 values. Both interpolation and decimation paths share the same 32-bit NCO.

The Python extension passes c0/c1 as 2-D arrays of shape (M+1, N), where M = poly_order and N = taps per branch. The extension extracts M+1 = dim[0] and N = dim[1], then calls resamp_dpmfs_create(M, N, ...). Coefficient arrays are copied internally; the caller may free them after create returns.

execute_max_out() assumes a default input block of 4096 samples and returns ceil(4096 * rate) + M + 8. Process in <= 4096-sample chunks.

Lifecycle:

// c0, c1: (M+1)*N float arrays from doppler.polyphase.fit_dpmfs
resamp_dpmfs_state_t *r =
    resamp_dpmfs_create(3, 19, c0, c1, 2.0);
size_t n = resamp_dpmfs_execute(r, in, 4096, out);
resamp_dpmfs_destroy(r);

Public Functions Documentation

function resamp_dpmfs_create

Create a DPMFS polyphase resampler.

resamp_dpmfs_state_t * resamp_dpmfs_create (
    size_t poly_order,
    size_t n_taps,
    const float * c0,
    const float * c1,
    double rate
) 

Parameters:

  • poly_order Polynomial order M (typically 3; must be in [1,3]).
  • n_taps Taps per phase N.
  • c0 (M+1)*N float32 coefficients for j=0, row-major.
  • c1 (M+1)*N float32 coefficients for j=1, row-major.
  • rate fs_out / fs_in. Must be > 0.

Returns:

Heap-allocated state, or NULL on failure.


function resamp_dpmfs_destroy

Free a DPMFS resampler.

void resamp_dpmfs_destroy (
    resamp_dpmfs_state_t * state
) 

Parameters:

  • state May be NULL.

function resamp_dpmfs_execute

Resample a block of cf32 IQ samples.

size_t resamp_dpmfs_execute (
    resamp_dpmfs_state_t * state,
    const float complex * in,
    size_t n_in,
    float complex * out
) 

Parameters:

  • state Must be non-NULL.
  • in Input array of length n_in.
  • n_in Number of input samples (keep <= 4096 per call).
  • out Output buffer (must hold >= execute_max_out() samples).

Returns:

Number of output samples written.


function resamp_dpmfs_execute_max_out

Maximum output samples per execute call.

size_t resamp_dpmfs_execute_max_out (
    resamp_dpmfs_state_t * state
) 

Returns ceil(RESAMP_DPMFS_DEFAULT_BLOCK * rate) + poly_order + 8. Allocate at least this many samples for the output buffer.


function resamp_dpmfs_get_num_taps

Return the taps per phase (N).

size_t resamp_dpmfs_get_num_taps (
    const resamp_dpmfs_state_t * state
) 


function resamp_dpmfs_get_poly_order

Return the polynomial order (M).

size_t resamp_dpmfs_get_poly_order (
    const resamp_dpmfs_state_t * state
) 


function resamp_dpmfs_get_rate

Return the rate (fs_out / fs_in).

double resamp_dpmfs_get_rate (
    const resamp_dpmfs_state_t * state
) 


function resamp_dpmfs_reset

Zero sample history and reset the phase accumulator.

void resamp_dpmfs_reset (
    resamp_dpmfs_state_t * state
) 

Parameters:

  • state Must be non-NULL.

Macro Definition Documentation

define RESAMP_DPMFS_DEFAULT_BLOCK

#define RESAMP_DPMFS_DEFAULT_BLOCK `4096u`

Default input block size for pre-allocated output buffer.



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