Skip to content

FIR based Downsampling

David Young edited this page Apr 30, 2025 · 1 revision

Description

This feature implements downsampling (decimation) of complex signal data, primarily used within the receiver_export::exportReceiverBinary function before writing HDF5 output. It reduces the sample rate by the factor specified in params::oversampleRatio(). A Finite Impulse Response (FIR) filter, designed using a Blackman window, is applied before decimation to serve as an anti-aliasing filter. The implementation is noted as functional but inefficient.

Assumptions

  • Assumes the Blackman window FIR filter is a suitable choice for anti-aliasing given the signal characteristics and simulation requirements.
  • Assumes the filter length specified by the parameter params::renderFilterLength() is appropriate for the desired filter performance (e.g., achieving sufficient attenuation in the stopband to prevent aliasing).
  • Assumes downsampling is the desired final step after signal rendering and noise addition within the HDF5 export process.

Limitations

  • Computational Inefficiency: The implementation is explicitly marked as inefficient in source code comments. It performs a full FIR filtering operation on the entire input signal block before discarding samples (decimating). More efficient polyphase or multirate filter structures are recommended in the code comments but not implemented.
  • Fixed Filter Design: The anti-aliasing filter is always a Blackman window-based FIR filter. There is no option to select other filter types (e.g., Parks-McClellan, different window functions) which might offer better performance (e.g., sharper transition band, higher stopband attenuation) for specific requirements.
  • Potential for Aliasing: If the stopband attenuation of the fixed Blackman FIR filter (primarily determined by params::renderFilterLength()) is insufficient to remove signal content above the new Nyquist frequency (after downsampling), aliasing distortion can occur in the output signal. This could incorrectly represent frequency content.
  • Energy Scaling Assumption: The code divides the filtered output samples by the downsampling ratio (params::oversampleRatio()). This assumes the FIR filter approximately preserves the signal energy or power level, which might not be perfectly accurate depending on the filter's specific gain characteristic.

Related Components

  • Code: dsp_filters.cpp::downsample, dsp_filters.cpp::blackmanFir
  • Usage Context: receiver_export.cpp::exportReceiverBinary (HDF5 output generation)
  • Configuration Parameters: params::oversampleRatio(), params::renderFilterLength()
  • Output Generation Effects (Link to related functional area page)

Validation Status

  • Needs Verification: The function is implemented and used, but its efficiency and the quality of the output (potential for aliasing, correct energy scaling) require verification. The code comments explicitly suggest it's suboptimal.
  • Key Areas for Validation:
    • Verify the anti-aliasing performance: Does significant aliasing occur for signals with content near the Nyquist frequency? How does performance vary with params::renderFilterLength()?
    • Confirm the accuracy of energy/power scaling after downsampling. Is the division by params::oversampleRatio() appropriate?
    • Benchmark the computational performance compared to potential standard multirate library implementations.
  • Priority: Medium (Functional, but known issues and inefficiency warrant investigation and potential replacement as suggested in code comments).

Clone this wiki locally