lib_ic API State Structure

struct ic_config_params_t
#include <ic_state.h>

IC configuration structure.

This structure contains configuration settings that can be changed to alter the behaviour of the IC instance. An instance of this structure is is automatically included as part of the IC state.

It controls the behaviour of the main filter and normalisation thereof. The initial values for these configuration parameters are defined in ic_defines.h and are initialised by ic_init().

Public Members

uint8_t bypass

Boolean to control bypassing of filter stage and adaption stage. When set the delayed y audio samples are passed unprocessed to the output. It is recommended to perform an initialisation of the instance after bypass is set as the room transfer function may have changed during that time.

int32_t gamma_log2

Up scaling factor for X energy calculation used for normalisation.

uint32_t sigma_xx_shift

Down scaling factor for X energy for used for normalisation.

fixed_s32_t ema_alpha_q30

Alpha used for calculating error_ema_energy in adapt.

float_s32_t delta

Delta value used in denominator to avoid large values when calculating inverse X energy.

struct ic_adaption_controller_config_t
#include <ic_state.h>

IC adaption controller configuration structure.

This structure contains configuration settings that can be changed to alter the behaviour of the adaption controller. This includes processing of the raw VAD probability input and optional stability controller logic. It is automatically included as part of the IC state and initialised by ic_init().

The initial values for these configuration parameters are defined in ic_defines.h.

Public Members

float_s32_t leakage_alpha

Alpha used for leaking away H_hat, allowing filter to slowly forget adaption.

float_s32_t voice_chance_alpha

Alpha used for low pass filtering the voice chance estimate based on VAD input.

fixed_s32_t energy_alpha_slow_q30

Slow alpha used filtering input and output energies of IC.

fixed_s32_t energy_alpha_fast_q30

Fast alpha used filtering input and output energies of IC.

float_s32_t out_to_in_ratio_limit

Ratio of the output to input at which the filter will reset. Setting it to 2.0 is a good rule of thumb.

float_s32_t instability_recovery_leakage_alpha

Setting of H_hat leakage which gets set if fast ratio exceeds a threshold.

uint8_t enable_adaption

Boolean which controls whether the IC adapts when ic_adapt() is called.

uint8_t enable_adaption_controller

Boolean which controls whether Mu is automatically adjusted from the VAD input.

uint8_t enable_filter_instability_recovery

Boolean which controls whether to enable detection and recovery from instability in the case when the adaption controller is enabled.

struct ic_adaption_controller_state_t
#include <ic_state.h>

IC adaption controller state structure.

This structure contains state used for the instance of the adaption controller logic. It is automatically included as part of the IC state and initialised by ic_init().

Public Members

float_s32_t smoothed_voice_chance

Post processed VAD value.

float_s32_t input_energy_slow

Slow filtered value of IC input energy.

float_s32_t output_energy_slow

Slow filtered value of IC output energy.

float_s32_t input_energy_fast

Fast filtered value of IC input energy.

float_s32_t output_energy_fast

Fast filtered value of IC output energy.

ic_adaption_controller_config_t adaption_controller_config

Configuration parameters for the adaption controller.

struct ic_state_t
#include <ic_state.h>

IC state structure.

This is the main state structure for an instance of the Interference Canceller. Before use it must be initialised using the ic_init() function. It contains everything needed for the IC instance including configuration and internal state of both the filter, adaption logic and adaption controller.

Public Members

bfp_s32_t y_bfp[IC_Y_CHANNELS]

BFP array pointing to the time domain y input signal.

bfp_complex_s32_t Y_bfp[IC_Y_CHANNELS]

BFP array pointing to the frequency domain Y input signal.

int32_t y[IC_Y_CHANNELS][IC_FRAME_LENGTH + FFT_PADDING]

Storage for y and Y mantissas. Note FFT is done in-place so the y storage is reused for Y.

bfp_s32_t x_bfp[IC_X_CHANNELS]

BFP array pointing to the time domain x input signal.

bfp_complex_s32_t X_bfp[IC_X_CHANNELS]

BFP array pointing to the frequency domain X input signal.

int32_t x[IC_X_CHANNELS][IC_FRAME_LENGTH + FFT_PADDING]

Storage for x and X mantissas. Note FFT is done in-place so the x storage is reused for X.

bfp_s32_t prev_y_bfp[IC_Y_CHANNELS]

BFP array pointing to previous y samples which are used for framing.

int32_t y_prev_samples[IC_Y_CHANNELS][IC_FRAME_LENGTH - IC_FRAME_ADVANCE]

Storage for previous y mantissas.

bfp_s32_t prev_x_bfp[IC_X_CHANNELS]

BFP array pointing to previous x samples which are used for framing.

int32_t x_prev_samples[IC_X_CHANNELS][IC_FRAME_LENGTH - IC_FRAME_ADVANCE]

Storage for previous x mantissas.

bfp_complex_s32_t Y_hat_bfp[IC_Y_CHANNELS]

BFP array pointing to the estimated frequency domain Y signal.

complex_s32_t Y_hat[IC_Y_CHANNELS][IC_FD_FRAME_LENGTH]

Storage for Y_hat mantissas.

bfp_complex_s32_t Error_bfp[IC_Y_CHANNELS]

BFP array pointing to the frequency domain Error output.

bfp_s32_t error_bfp[IC_Y_CHANNELS]

BFP array pointing to the time domain Error output.

complex_s32_t Error[IC_Y_CHANNELS][IC_FD_FRAME_LENGTH]

Storage for Error and error mantissas. Note IFFT is done in-place so the Error storage is reused for error.

bfp_complex_s32_t H_hat_bfp[IC_Y_CHANNELS][IC_X_CHANNELS * IC_FILTER_PHASES]

BFP array pointing to the frequency domain estimate of transfer function.

complex_s32_t H_hat[IC_Y_CHANNELS][IC_FILTER_PHASES * IC_X_CHANNELS][IC_FD_FRAME_LENGTH]

Storage for H_hat mantissas.

bfp_complex_s32_t X_fifo_bfp[IC_X_CHANNELS][IC_FILTER_PHASES]

BFP array pointing to the frequency domain X input history used for calculating normalisation.

bfp_complex_s32_t X_fifo_1d_bfp[IC_X_CHANNELS * IC_FILTER_PHASES]

1D alias of the frequency domain X input history used for calculating normalisation.

complex_s32_t X_fifo[IC_X_CHANNELS][IC_FILTER_PHASES][IC_FD_FRAME_LENGTH]

Storage for X_fifo mantissas.

bfp_complex_s32_t T_bfp[IC_X_CHANNELS]

BFP array pointing to the frequency domain T used for adapting the filter coefficients (H). Note there is no associated storage because we re-use the x input array as a memory optimisation.

bfp_s32_t inv_X_energy_bfp[IC_X_CHANNELS]

BFP array pointing to the inverse X energies used for normalisation.

int32_t inv_X_energy[IC_X_CHANNELS][IC_FD_FRAME_LENGTH]

Storage for inv_X_energy mantissas.

bfp_s32_t X_energy_bfp[IC_X_CHANNELS]

BFP array pointing to the X energies.

int32_t X_energy[IC_X_CHANNELS][IC_FD_FRAME_LENGTH]

Storage for X_energy mantissas.

unsigned X_energy_recalc_bin

Index state used for calculating energy across all X bins.

bfp_s32_t overlap_bfp[IC_Y_CHANNELS]

BFP array pointing to the overlap array used for windowing and overlap operations.

int32_t overlap[IC_Y_CHANNELS][IC_FRAME_OVERLAP]

Storage for overlap mantissas.

int32_t y_input_delay[IC_Y_CHANNELS][IC_Y_CHANNEL_DELAY_SAMPS]

FIFO for delaying y channel (w.r.t x) to enable adaptive filter to be effective.

uint32_t y_delay_idx[IC_Y_CHANNELS]

Index state used for keeping track of y delay FIFO.

float_s32_t mu[IC_Y_CHANNELS][IC_X_CHANNELS]

Mu value used for controlling adaption rate.

float_s32_t error_ema_energy[IC_Y_CHANNELS]

Filtered error energy.

float_s32_t max_X_energy[IC_X_CHANNELS]

Used to keep track of peak X energy.

bfp_s32_t sigma_XX_bfp[IC_X_CHANNELS]

BFP array pointing to the EMA filtered X input energy.

int32_t sigma_XX[IC_X_CHANNELS][IC_FD_FRAME_LENGTH]

Storage for sigma_XX mantissas.

float_s32_t sum_X_energy[IC_X_CHANNELS]

X energy sum used for maintaining the X FIFO.

ic_config_params_t config_params

Configuration parameters for the IC.

ic_adaption_controller_state_t ic_adaption_controller_state

State and configuration parameters for the IC adaption controller.