|
| void | tpt_fir_sparse_f32 (f32_t *aOutData, tpt_fir_sparse_f32_t *aFilter, f32_t *aInData, f32_t *aBuf, uint32_t aCount) |
| | Processing function for the floating-point sparse FIR filter.
|
| void | tpt_fir_sparse_init_f32 (tpt_fir_sparse_f32_t *aFilter, uint16_t aTaps, const f32_t *aCoeffs, f32_t *aState, int32_t *aTapDelay, uint16_t aMaxDelay, uint32_t aCount) |
| | Initialization function for the floating-point sparse FIR filter.
|
| void | tpt_fir_sparse_init_q7 (tpt_fir_sparse_q7_t *aFilter, uint16_t aTaps, const q7_t *aCoeffs, q7_t *aState, int32_t *aTapDelay, uint16_t aMaxDelay, uint32_t aCount) |
| | Initialization function for the Q7 sparse FIR filter.
|
| void | tpt_fir_sparse_init_q15 (tpt_fir_sparse_q15_t *aFilter, uint16_t aTaps, const q15_t *aCoeffs, q15_t *aState, int32_t *aTapDelay, uint16_t aMaxDelay, uint32_t aCount) |
| | Initialization function for the Q15 sparse FIR filter.
|
| void | tpt_fir_sparse_init_q31 (tpt_fir_sparse_q31_t *aFilter, uint16_t aTaps, const q31_t *aCoeffs, q31_t *aState, int32_t *aTapDelay, uint16_t aMaxDelay, uint32_t aCount) |
| | Initialization function for the Q31 sparse FIR filter.
|
| void | tpt_fir_sparse_q7 (q7_t *aOutData, tpt_fir_sparse_q7_t *aFilter, q7_t *aInData, q7_t *aBuf1, q31_t *aBuf2, uint32_t aCount) |
| | Function for the q7 Sparse FIR filter.
|
| void | tpt_fir_sparse_q15 (q15_t *aOutData, tpt_fir_sparse_q15_t *aFilter, q15_t *aInData, q15_t *aBuf1, q31_t *aBuf2, uint32_t aCount) |
| | Function for the q15 Sparse FIR filter.
|
| void | tpt_fir_sparse_q31 (q31_t *aOutData, tpt_fir_sparse_q31_t *aFilter, q31_t *aInData, q31_t *aBuf, uint32_t aCount) |
| | Processing function for the Q31 sparse FIR filter.
|
- Deprecated
- Those functions are no more tested nor maintained and will be removed in a future version.
This group of functions implements sparse FIR filters. Sparse FIR filters are equivalent to standard FIR filters except that most of the coefficients are equal to zero. Sparse filters are used for simulating reflections in communications and audio applications.
There are separate functions for Q7, Q15, Q31, and floating-point data types. The functions operate on blocks of input and output data and each call to the function processes aCount samples through the filter. aInData and aOutData points to input and output arrays respectively containing aCount values.
- Algorithm
- The sparse filter instant structure contains an array of tap indices
pTapDelay which specifies the locations of the non-zero coefficients. This is in addition to the coefficient array b. The implementation essentially skips the multiplications by zero and leads to an efficient realization.
y[n] = b[0] * x[n-pTapDelay[0]] + b[1] * x[n-pTapDelay[1]] + b[2] *
x[n-pTapDelay[2]] + ...+ b[numTaps-1] * x[n-pTapDelay[numTaps-1]]
Sparse FIR filter. b[n]
represents the filter coefficients"
@par
<code>pCoeffs</code> points to a coefficient array of
aCount <code>numTaps</code>; <code>pTapDelay</code> points
to an array of nonzero indices and is also of aCount
<code>numTaps</code>; <code>pState</code> points to a state
array of aCount <code>maxDelay + aCount</code>, where
<code>maxDelay</code> is the largest offset value that is
ever used in the <code>pTapDelay</code> array. Some of the
processing functions also require temporary working
buffers.
@par Instance Structure
The coefficients and state variables for a filter are
stored together in an instance data structure. A separate
instance structure must be defined for each filter.
Coefficient and offset arrays may be shared among several
instances while state variable arrays cannot be shared.
There are separate instance structure declarations for each
of the 4 supported data types.
@par Initialization Functions
There is also an associated initialization function for
each data type. The initialization function performs the
following operations:
- Sets the values of the internal structure fields.
- Zeros out the values in the state buffer.
To do this manually without calling the init function,
assign the follow subfields of the instance structure:
numTaps, pCoeffs, pTapDelay, maxDelay, stateIndex, pState.
Also set all of the values in pState to zero.
@par
Use of the initialization function is optional.
However, if the initialization function is used, then the
instance structure cannot be placed into a const data
section. To place an instance structure into a const data
section, the instance structure must be manually
initialized. Set the values in the state buffer to zeros
before static initialization. The code below statically
initializes each of the 4 different data type filter
instance structures
<pre>
tpt_fir_sparse_f32 aFilter = {numTaps, 0, pState, pCoeffs, maxDelay,
pTapDelay}; tpt_fir_sparse_q31 S = {numTaps, 0, pState,
pCoeffs, maxDelay, pTapDelay}; tpt_fir_sparse_q15 S = {numTaps,
0, pState, pCoeffs, maxDelay, pTapDelay}; tpt_fir_sparse_q7 S =
{numTaps, 0, pState, pCoeffs, maxDelay, pTapDelay};
</pre>
@par Fixed-Point Behavior
Care must be taken when using the fixed-point versions of
the sparse FIR filter functions. In particular, the
overflow and saturation behavior of the accumulator used in
each function must be considered. Refer to the function
specific documentation below for usage guidelines.
\ifile "/home/uranus/project/dsp/include/libdsp/tpt_math_filter.h"
◆ tpt_fir_sparse_f32()
Processing function for the floating-point sparse FIR filter.
- Parameters
-
| [out] | aOutData | points to the block of output data |
| [in] | aFilter | points to an instance of the floating-point sparse FIR structure |
| [in] | aInData | points to the block of input data |
| [in] | aBuf | points to a temporary buffer of aCount aCount |
| [in] | aCount | number of input samples to process |
◆ tpt_fir_sparse_init_f32()
| void tpt_fir_sparse_init_f32 |
( |
tpt_fir_sparse_f32_t * | aFilter, |
|
|
uint16_t | aTaps, |
|
|
const f32_t * | aCoeffs, |
|
|
f32_t * | aState, |
|
|
int32_t * | aTapDelay, |
|
|
uint16_t | aMaxDelay, |
|
|
uint32_t | aCount ) |
Initialization function for the floating-point sparse FIR filter.
- Parameters
-
| [in,out] | aFilter | points to an instance of the floating-point sparse FIR structure |
| [in] | aTaps | number of nonzero coefficients in the filter |
| [in] | aCoeffs | points to the array of filter coefficients |
| [in] | aState | points to the state buffer |
| [in] | aTapDelay | points to the array of offset times |
| [in] | aMaxDelay | maximum offset time supported |
| [in] | aCount | number of samples that will be processed per block |
◆ tpt_fir_sparse_init_q15()
| void tpt_fir_sparse_init_q15 |
( |
tpt_fir_sparse_q15_t * | aFilter, |
|
|
uint16_t | aTaps, |
|
|
const q15_t * | aCoeffs, |
|
|
q15_t * | aState, |
|
|
int32_t * | aTapDelay, |
|
|
uint16_t | aMaxDelay, |
|
|
uint32_t | aCount ) |
Initialization function for the Q15 sparse FIR filter.
- Parameters
-
| [in,out] | aFilter | points to an instance of the floating-point sparse FIR structure |
| [in] | aTaps | number of nonzero coefficients in the filter |
| [in] | aCoeffs | points to the array of filter coefficients |
| [in] | aState | points to the state buffer |
| [in] | aTapDelay | points to the array of offset times |
| [in] | aMaxDelay | maximum offset time supported |
| [in] | aCount | number of samples that will be processed per block |
◆ tpt_fir_sparse_init_q31()
| void tpt_fir_sparse_init_q31 |
( |
tpt_fir_sparse_q31_t * | aFilter, |
|
|
uint16_t | aTaps, |
|
|
const q31_t * | aCoeffs, |
|
|
q31_t * | aState, |
|
|
int32_t * | aTapDelay, |
|
|
uint16_t | aMaxDelay, |
|
|
uint32_t | aCount ) |
Initialization function for the Q31 sparse FIR filter.
- Parameters
-
| [in,out] | aFilter | points to an instance of the floating-point sparse FIR structure |
| [in] | aTaps | number of nonzero coefficients in the filter |
| [in] | aCoeffs | points to the array of filter coefficients |
| [in] | aState | points to the state buffer |
| [in] | aTapDelay | points to the array of offset times |
| [in] | aMaxDelay | maximum offset time supported |
| [in] | aCount | number of samples that will be processed per block |
◆ tpt_fir_sparse_init_q7()
| void tpt_fir_sparse_init_q7 |
( |
tpt_fir_sparse_q7_t * | aFilter, |
|
|
uint16_t | aTaps, |
|
|
const q7_t * | aCoeffs, |
|
|
q7_t * | aState, |
|
|
int32_t * | aTapDelay, |
|
|
uint16_t | aMaxDelay, |
|
|
uint32_t | aCount ) |
Initialization function for the Q7 sparse FIR filter.
- Parameters
-
| [in,out] | aFilter | points to an instance of the floating-point sparse FIR structure |
| [in] | aTaps | number of nonzero coefficients in the filter |
| [in] | aCoeffs | points to the array of filter coefficients |
| [in] | aState | points to the state buffer |
| [in] | aTapDelay | points to the array of offset times |
| [in] | aMaxDelay | maximum offset time supported |
| [in] | aCount | number of samples that will be processed per block |
◆ tpt_fir_sparse_q15()
Function for the q15 Sparse FIR filter.
- Parameters
-
| [out] | aOutData | points to the output block data. |
| [in] | aFilter | points to an instance of the Sparse FIR structure. |
| [in] | aInData | points to the input block data. |
| [in] | aBuf1 | points to a temporary buffer of length aCount. |
| [in] | aBuf2 | points to a temporary buffer of length aCount. |
| [in] | aCount | number of the aCount. |
◆ tpt_fir_sparse_q31()
Processing function for the Q31 sparse FIR filter.
- Parameters
-
| [out] | aOutData | points to the block of output data |
| [in] | aFilter | points to an instance of the floating-point sparse FIR structure |
| [in] | aInData | points to the block of input data |
| [in] | aBuf | points to a temporary buffer of aCount aCount |
| [in] | aCount | number of input samples to process |
◆ tpt_fir_sparse_q7()
Function for the q7 Sparse FIR filter.
- Parameters
-
| [out] | aOutData | points to the output block data. |
| [in] | aFilter | points to an instance of the Sparse FIR structure. |
| [in] | aInData | points to the input block data. |
| [in] | aBuf1 | points to a temporary buffer of length aCount. |
| [in] | aBuf2 | points to a temporary buffer of length aCount. |
| [in] | aCount | number of the aCount. |