FIRSmoothed
Overview
FIR filter
Discussion
The FIRSmoothed module implements a direct convolution N-order Finite Impulse Response filter. The module operates on multiple channels with all channels sharing the same set of filter coefficients. The filter coefficients are stored in the array, coeffs, in normal order. The size of the array is numTaps x 1. The state variable array is of size numTaps*numChannels.
This module smoothes the coefficients on a block-by-block basis. The user writes to the .coeffs variables and internally the module keeps a separate array, .currentCoeffs, of smoothing varying coefficients. This module is functionality equivalent to the FIR module except that it does the smoothing.
The module is optimized in assembly on the SHARC and the Blackfin. The SHARC implementation utilizes SIMD if the length of the filter is even and this reduces the processing load significantly. If you have an odd order filter, you can zero pad the filter with one additional zero coefficient and realize the benefits of SIMD.
This modules suports special FIR HW accelerator on ADI SHARC+ processors, in legacy mode. All the channels are processed in FIR accelerator. On SHARC+ processor, additional memory is allocated for accelerator TCB with size of numAcceleratorChannels*13.
Type Definition
typedef struct _ModuleFIRSmoothed
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 numTaps; // Length of the filter.
FLOAT32 smoothingTime; // Time constant of the smoothing process.
FLOAT32 smoothingCoeff; // Smoothing coefficient. This is computed based on the smoothingTime, sample rate, and block size of the module.
INT32 stateIndex; // Index of the oldest state variable in the array of state variables.
FLOAT32* coeffs; // Filter coefficient array in normal order.
FLOAT32* currentCoeffs; // Smoothly updating filter coefficient array in normal order.
FLOAT32* state; // State variable array. The size of the array equals stateLen * numChannels.
void * hardware_specific_struct_pointer; // This is the internal TCB array used for ADI FIR accelerator
} ModuleFIRSmoothedClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
numTaps | int | const | 0 | 31 | 1:1:5000 | samples |
smoothingTime | float | parameter | 0 | 10 | 0:1000 | msec |
smoothingCoeff | float | derived | 1 | 0.06449 | Unrestricted | |
stateIndex | int | state | 1 | 0 | Unrestricted | |
coeffs | float* | parameter | 0 | [31 x 1] | Unrestricted | |
currentCoeffs | float* | state | 1 | [31 x 1] | Unrestricted | |
state | float* | state | 1 | [66 x 1] | Unrestricted | |
hardware_specific_struct_pointer | void * | state | 1 | Unrestricted |
Pins
Input Pins
Name: in
Description: audio input
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: float
MATLAB Usage
File Name: fir_smoothed_module.m
M=fir_smoothed_module(NAME, L)
FIR filter with built-in coefficient smoothing. Arguments:
NAME - name of the module.
L - length of the filter (number of taps).