Skip to content

File resample_core.h

FileList > inc > resample > resample_core.h

Go to the source code of this file

Resample module — public C API.

  • #include "clib_common.h"

Public Functions

Type Name
void ciccompmf (double * out, uint32_t N, uint32_t R, uint32_t M)
Design a CIC passband-droop compensator FIR filter. Implements the closed-form Bernoulli-series maximally-flat-error method from Molnar & Vucic (IEEE TCAS-II 58(12):926-930, 2011, DOI 10.1109/TCSII.2011.2172522). The compensator runs at the decimated (output) rate and should be applied after the CIC stage. DC gain is exactly 1.0. Odd M gives symmetric linear-phase taps; even M gives half-sample-shifted linear-phase taps.
double kaiser_beta (double atten)
Compute the Kaiser window beta parameter from stopband attenuation. Uses the standard Kaiser-Hamming formulae: atten > 50 dB: beta = 0.1102 * (atten - 8.7) 21 <= atten <= 50 dB: beta = 0.5842*(atten-21)^0.4 + 0.07886*(atten-21) atten < 21 dB: beta = 0.0 (rectangular window)
int kaiser_num_taps (int num_phases, double atten, double pb, double sb)
Estimate the taps-per-phase count for a polyphase Kaiser FIR bank. Applies the Kaiser length formula to the per-phase normalised prototype (pb/num_phases, sb/num_phases), rounds up to the next odd symmetrical length, then divides by num_phases to give taps per branch. The result is the minimum num_taps argument to pass to Resampler_create_custom() .

Public Functions Documentation

function ciccompmf

Design a CIC passband-droop compensator FIR filter. Implements the closed-form Bernoulli-series maximally-flat-error method from Molnar & Vucic (IEEE TCAS-II 58(12):926-930, 2011, DOI 10.1109/TCSII.2011.2172522). The compensator runs at the decimated (output) rate and should be applied after the CIC stage. DC gain is exactly 1.0. Odd M gives symmetric linear-phase taps; even M gives half-sample-shifted linear-phase taps.

void ciccompmf (
    double * out,
    uint32_t N,
    uint32_t R,
    uint32_t M
) 

Parameters:

  • out Output buffer; must hold at least M doubles. M outside the Bernoulli table range leaves out unmodified.
  • N CIC filter order (number of integrator/comb stages, >= 1).
  • R CIC decimation factor (>= 2).
  • M Number of compensator taps in [1, 19] (odd or even).
>>> from doppler.resample import ciccompmf
>>> import numpy as np
>>> h = ciccompmf(4, 16, 5)
>>> h.shape, h.dtype
((5,), dtype('float64'))
>>> [round(float(v), 4) for v in h]
[0.029, -0.282, 1.5061, -0.282, 0.029]

function kaiser_beta

Compute the Kaiser window beta parameter from stopband attenuation. Uses the standard Kaiser-Hamming formulae: atten > 50 dB: beta = 0.1102 * (atten - 8.7) 21 <= atten <= 50 dB: beta = 0.5842*(atten-21)^0.4 + 0.07886*(atten-21) atten < 21 dB: beta = 0.0 (rectangular window)

double kaiser_beta (
    double atten
) 

Parameters:

  • atten Desired stopband attenuation in dB (positive value).

Returns:

Kaiser beta parameter (>= 0.0).

>>> from doppler.resample import kaiser_beta
>>> round(kaiser_beta(60.0), 4)
5.6533
>>> kaiser_beta(20.0)
0.0

function kaiser_num_taps

Estimate the taps-per-phase count for a polyphase Kaiser FIR bank. Applies the Kaiser length formula to the per-phase normalised prototype (pb/num_phases, sb/num_phases), rounds up to the next odd symmetrical length, then divides by num_phases to give taps per branch. The result is the minimum num_taps argument to pass to Resampler_create_custom() .

int kaiser_num_taps (
    int num_phases,
    double atten,
    double pb,
    double sb
) 

Parameters:

  • num_phases Number of polyphase branches (power of two).
  • atten Desired stopband attenuation in dB.
  • pb Normalised passband edge (0 < pb < sb < 1).
  • sb Normalised stopband edge.

Returns:

Taps per polyphase branch (>= 1).

>>> from doppler.resample import kaiser_num_taps
>>> kaiser_num_taps(4096, 60.0, 0.4, 0.6)
19


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