XCORE SDK
XCORE Software Development Kit
Classes | Functions
dc_elmination.h

Classes

struct  dcoe_chan_state_t
 DC Offset Elimination (DCOE) State. More...
 

Functions

void dcoe_state_init (dcoe_chan_state_t state[], const unsigned chan_count)
 Initialize DCOE states. More...
 
void dcoe_filter (int32_t new_output[], dcoe_chan_state_t state[], int32_t new_input[], const unsigned chan_count)
 Apply DCOE filter. More...
 

Detailed Description

Function Documentation

◆ dcoe_filter()

void dcoe_filter ( int32_t  new_output[],
dcoe_chan_state_t  state[],
int32_t  new_input[],
const unsigned  chan_count 
)

Apply DCOE filter.

Applies the DC offset elimination filter to get a new output sample and updates the filter state.

For correct behavior, this function should be called once per sample (here "sample" refers to a vector-valued quantity containing one element for each audio channel) of that stream.

The index of each array (state, new_input and new_output) corresponds to the audio channel. The update associated with each audio channel is independent of each other audio channel.

The equation used for each channel is:

y[t] = R * y[t-1] + x[t] - x[t-1]

where t is the current sample time index, y[] is the output signal, x[] is the input signal, and R is (255.0/256).

To filter a sample in-place use the same array for both the new_input and new_output arguments.

Parameters
[out]new_outputArray into which the output sample will be placed.
[in]stateDC offset elimination state vector.
[in]new_inputNew input sample.
[in]chan_countNumber of channels to be processed.

◆ dcoe_state_init()

void dcoe_state_init ( dcoe_chan_state_t  state[],
const unsigned  chan_count 
)

Initialize DCOE states.

The DC offset elimination state needs to be intialized before the filter can be applied. This function initializes it.

For correct behavior, the state vector state must persist between audio samples and is supplied with each call to dcoe_filter().

Parameters
[in]stateArray of dcoe_chan_state_t to be initialized.
[in]chan_countNumber of elements in state.