XCORE SDK
XCORE Software Development Kit
Functions
lib_xs3_math Filter Functions

Functions

void xs3_filter_fir_s32_init (xs3_filter_fir_s32_t *filter, int32_t *sample_buffer, const unsigned tap_count, const int32_t *coefficients, const right_shift_t shift)
 Initialize a 32-bit FIR filter. More...
 
void xs3_filter_fir_s32_add_sample (xs3_filter_fir_s32_t *filter, const int32_t new_sample)
 Add a new input sample to a 32-bit FIR filter without processing an output sample. More...
 
int32_t xs3_filter_fir_s32 (xs3_filter_fir_s32_t *filter, const int32_t new_sample)
 
void xs3_filter_fir_s16_init (xs3_filter_fir_s16_t *filter, int16_t *sample_buffer, const unsigned tap_count, const int16_t *coefficients, const right_shift_t shift)
 Initialize a 16-bit FIR filter. More...
 
void xs3_filter_fir_s16_add_sample (xs3_filter_fir_s16_t *filter, const int16_t new_sample)
 Add a new input sample to a 16-bit FIR filter without processing an output sample. More...
 
int16_t xs3_filter_fir_s16 (xs3_filter_fir_s16_t *filter, const int16_t new_sample)
 
int32_t xs3_filter_biquad_s32 (xs3_biquad_filter_s32_t *filter, const int32_t new_sample)
 
int32_t xs3_filter_biquads_s32 (xs3_biquad_filter_s32_t biquads[], const unsigned block_count, const int32_t new_sample)
 

Detailed Description

Function Documentation

◆ xs3_filter_biquad_s32()

int32_t xs3_filter_biquad_s32 ( xs3_biquad_filter_s32_t filter,
const int32_t  new_sample 
)

This function implements a 32-bit Biquad filter.

The new input sample new_sample is added to this filter's state, and a new output sample is computed and returned as specified in xs3_biquad_filter_s32_t.

This function processes a single filter block containing (up to) 8 biquad filter sections. For biquad filters containing 2 or more filter blocks (more than 8 biquad filter sections), see xs3_filter_biquads_s32().

Parameters
[in,out]filterFilter to be processed
[in]new_sampleNew input sample to be processed by filter
Returns
Next filtered output sample
See also
xs3_biquad_filter_s32_t, xs3_filter_biquads_s32

◆ xs3_filter_biquads_s32()

int32_t xs3_filter_biquads_s32 ( xs3_biquad_filter_s32_t  biquads[],
const unsigned  block_count,
const int32_t  new_sample 
)

This function implements a 32-bit Biquad filter.

The new input sample new_sample is added to this filter's state, and a new output sample is computed and returned as specified in xs3_biquad_filter_s32_t.

This function processes one or more filter blocks, with each block containing up to 8 biquad filter sections.

Parameters
[in,out]biquadsFilter blocks to be processed
[in]block_countNumber of filter blocks in biquads
[in]new_sampleNew input sample to be processed by filter
Returns
Next filtered output sample
See also
xs3_biquad_filter_s32_t, xs3_filter_biquad_s32

◆ xs3_filter_fir_s16()

int16_t xs3_filter_fir_s16 ( xs3_filter_fir_s16_t filter,
const int16_t  new_sample 
)

This function implements a Finite Impulse Response (FIR) filter.

The new input sample new_sample is added to this filter's state, and a new output sample is computed and returned as specified in xs3_filter_fir_s16_t.

With a large number of filter taps, this function takes approximately 3 thread cycles per 16 filter taps.

Parameters
[in,out]filterFilter to be processed
[in]new_sampleNew input sample to be processed by filter
Returns
Next filtered output sample
See also
xs3_filter_fir_s16_t

◆ xs3_filter_fir_s16_add_sample()

void xs3_filter_fir_s16_add_sample ( xs3_filter_fir_s16_t filter,
const int16_t  new_sample 
)

Add a new input sample to a 16-bit FIR filter without processing an output sample.

This function adds a new input sample to filter's state without computing a new output sample.

See xs3_filter_fir_s16_t for more information about FIR filters and their operation.

Parameters
[in,out]filterFilter struct to have the sample added
[in]new_sampleSample to be added to filter's history
See also
xs3_filter_fir_s16_t

◆ xs3_filter_fir_s16_init()

void xs3_filter_fir_s16_init ( xs3_filter_fir_s16_t filter,
int16_t *  sample_buffer,
const unsigned  tap_count,
const int16_t *  coefficients,
const right_shift_t  shift 
)

Initialize a 16-bit FIR filter.

Before xs3_filter_fir_s16() or xs3_filter_fir_s16_add_sample() can be used on a filter it must be initialized with a call to this function.

sample_buffer and coefficients must be at least 2 * tap_count bytes long, and aligned to a 4-byte (word) boundary.

See xs3_filter_fir_s16_t for more information about 16-bit FIR filters and their operation.

Parameters
[out]filterFilter struct to be initialized
[in]sample_bufferBuffer used by the filter to contain state information. Must be at least tap_count elements long
[in]tap_countOrder of the FIR filter; number of filter taps
[in]coefficientsArray containing filter coefficients
[in]shiftUnsigned arithmetic right-shift applied to accumulator to get filter output sample
See also
xs3_filter_fir_s16_t

◆ xs3_filter_fir_s32()

int32_t xs3_filter_fir_s32 ( xs3_filter_fir_s32_t filter,
const int32_t  new_sample 
)

This function implements a Finite Impulse Response (FIR) filter.

The new input sample new_sample is added to this filter's state, and a new output sample is computed and returned as specified in xs3_filter_fir_s32_t.

With a large number of filter taps, this function takes approximately 3 thread cycles per 8 filter taps.

Parameters
[in,out]filterFilter to be processed
[in]new_sampleNew input sample to be processed by filter
Returns
Next filtered output sample
See also
xs3_filter_fir_s32_t

◆ xs3_filter_fir_s32_add_sample()

void xs3_filter_fir_s32_add_sample ( xs3_filter_fir_s32_t filter,
const int32_t  new_sample 
)

Add a new input sample to a 32-bit FIR filter without processing an output sample.

This function adds a new input sample to filter's state without computing a new output sample. This is a constant- time operation and can be used to quickly pre-load a filter with sample data.

See xs3_filter_fir_s32_t for more information about FIR filters and their operation.

Parameters
[in,out]filterFilter struct to have the sample added
[in]new_sampleSample to be added to filter's history
See also
xs3_filter_fir_s32_t

◆ xs3_filter_fir_s32_init()

void xs3_filter_fir_s32_init ( xs3_filter_fir_s32_t filter,
int32_t *  sample_buffer,
const unsigned  tap_count,
const int32_t *  coefficients,
const right_shift_t  shift 
)

Initialize a 32-bit FIR filter.

Before xs3_filter_fir_s32() or xs3_filter_fir_s32_add_sample() can be used on a filter it must be initialized with a call to this function.

sample_buffer and coefficients must be at least 4 * tap_count bytes long, and aligned to a 4-byte (word) boundary.

See xs3_filter_fir_s32_t for more information about 32-bit FIR filters and their operation.

Parameters
[out]filterFilter struct to be initialized
[in]sample_bufferBuffer used by the filter to contain state information. Must be at least tap_count elements long
[in]tap_countOrder of the FIR filter; number of filter taps
[in]coefficientsArray containing filter coefficients.
[in]shiftUnsigned arithmetic right-shift applied to accumulator to get filter output sample
See also
xs3_filter_fir_s32_t