Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
Toggle table of contents sidebar

# mic_array_conf_struct.h

struct mic_array_filter_conf_t

  Configuration for a single decimator stage (e.g., stage 1 or stage 2).

  All memory referenced by this structure is owned by the caller. The caller must allocate and initialize all buffers (coefficients and state) and ensure that all pointers remain valid for the entire lifetime of the decimator.

  Public Members

  int32_t *coef

    Pointer to the filter coefficient array.

    This buffer must be aligned to a 32-bit word boundary.

  int32_t *state

    Pointer to filter state (delay line) buffer for all microphones in int32_t words.

    For multi‑mic use this typically points to a buffer of size `output_mic_count * @ref mic_array_filter_conf_t::num_taps` 32-bit words.

    This buffer must be aligned to a 32-bit word boundary.

  right_shift_t shr

    Final right-shift applied to the filter’s accumulator prior to output.

    See lib_xcore_math xmath/filter.h (filter_fir_s32_t::shift) for details.

  unsigned num_taps

    Number of FIR taps in this filter stage.

  unsigned decimation_factor

    Decimation ratio (downsampling factor) applied by this filter stage.

  unsigned state_words_per_channel

    Per-microphone state buffer size in int32_t words.

    Used to index state for each mic: state[mic * state_words_per_channel … ].

struct mic_array_decimator_conf_t

  Configuration for the full decimator pipeline.

  Contains an array of stage configurations in execution order.

  - filter_conf[0] is the first stage (PDM front‑end).

  - filter_conf[1] is the second stage (PCM FIR decimator).

  Public Members

  mic_array_filter_conf_t *filter_conf

    Array of filter stage configurations (ordered in filter execution order)

  unsigned num_filter_stages

    Number of filter stages in the decimation pipeline.

    Specifies the length of `filter_conf`. For a typical two-stage decimator, set this to 2 with `filter_conf`[0] as stage 1 and `filter_conf`[1] as stage 2. Must be >= 1.

struct pdm_rx_conf_t

  Configuration for the PDM RX service.

  Public Members

  uint32_t *pdm_out_block

    PDM RX output block (input to the decimator) for all microphones.

    Packed PDM samples as 32-bit words. The layout is a contiguous buffer sized `output_mic_count * pdm_out_words_per_channel` 32-bit words, arranged as [output_mic_count][pdm_out_words_per_channel]. In the `pdm_out_words_per_channel` 32-bit words, lower indexed words represent older samples. Within a 32-bit word the less significant bits are older samples. Typically contains enough PDM words to produce one PCM sample per microphone after decimation.

    This buffer must be aligned to a 32-bit word boundary.

  uint32_t *pdm_in_double_buf

    PDM input block (double buffered) for all microphones.

    Packed PDM input samples as 32-bit words. The layout is a contiguous buffer of size `2 * input_mic_count * pdm_out_words_per_channel` 32-bit words, arranged as [2][input_mic_count][pdm_out_words_per_channel]. The buffer is double buffered such that one buffer is processed by the decimator while the other is filled by the PDM RX service.

    This buffer must be aligned to an 8-byte boundary, as required by the deinterleave functions.

  const unsigned *channel_map

    Array mapping `output_mic_count` outputs to input microphone indices.

    Array dimension must be `output_mic_count`. The ith entry gives the input mic index mapped to output mic index `i`.

  unsigned pdm_out_words_per_channel

    Number of 32-pdm_sample subblocks to be captured for each microphone channel by the PDM RX service.

    This is the number of words required to produce one PCM sample at the output of the decimator and is sized depending on the decimator configuration. It is typically equal to the 2nd stage decimation filter’s decimation factor (in case of a 2 stage decimator).

struct mic_array_conf_t

  Top-level configuration passed to mic_array_init_custom_filter().

  Bundles the decimator pipeline configuration and the PDM RX configuration. All buffers referenced by pointers inside these sub-configs must be allocated and owned by the caller and must remain valid for the lifetime of the mic array task (until mic_array_start() returns).

  Note

  - When using mic_array_init_custom_filter(), both members must be populated.

  Public Members

  mic_array_decimator_conf_t decimator_conf

    decimator configuration

  pdm_rx_conf_t pdmrx_conf

    PDM RX service configuration