CMSIS-DSP
Verison 1.1.0
CMSIS DSP Software Library
|
Functions | |
void | arm_fir_decimate_f32 (const arm_fir_decimate_instance_f32 *S, float32_t *pSrc, float32_t *pDst, uint32_t blockSize) |
Processing function for the floating-point FIR decimator. | |
void | arm_fir_decimate_fast_q15 (const arm_fir_decimate_instance_q15 *S, q15_t *pSrc, q15_t *pDst, uint32_t blockSize) |
Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. | |
void | arm_fir_decimate_fast_q31 (arm_fir_decimate_instance_q31 *S, q31_t *pSrc, q31_t *pDst, uint32_t blockSize) |
Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. | |
arm_status | arm_fir_decimate_init_f32 (arm_fir_decimate_instance_f32 *S, uint16_t numTaps, uint8_t M, float32_t *pCoeffs, float32_t *pState, uint32_t blockSize) |
Initialization function for the floating-point FIR decimator. | |
arm_status | arm_fir_decimate_init_q15 (arm_fir_decimate_instance_q15 *S, uint16_t numTaps, uint8_t M, q15_t *pCoeffs, q15_t *pState, uint32_t blockSize) |
Initialization function for the Q15 FIR decimator. | |
arm_status | arm_fir_decimate_init_q31 (arm_fir_decimate_instance_q31 *S, uint16_t numTaps, uint8_t M, q31_t *pCoeffs, q31_t *pState, uint32_t blockSize) |
Initialization function for the Q31 FIR decimator. | |
void | arm_fir_decimate_q15 (const arm_fir_decimate_instance_q15 *S, q15_t *pSrc, q15_t *pDst, uint32_t blockSize) |
Processing function for the Q15 FIR decimator. | |
void | arm_fir_decimate_q31 (const arm_fir_decimate_instance_q31 *S, q31_t *pSrc, q31_t *pDst, uint32_t blockSize) |
Processing function for the Q31 FIR decimator. |
These functions combine an FIR filter together with a decimator. They are used in multirate systems for reducing the sample rate of a signal without introducing aliasing distortion. Conceptually, the functions are equivalent to the block diagram below:
When decimating by a factor of M
, the signal should be prefiltered by a lowpass filter with a normalized cutoff frequency of 1/M
in order to prevent aliasing distortion. The user of the function is responsible for providing the filter coefficients.
The FIR decimator functions provided in the CMSIS DSP Library combine the FIR filter and the decimator in an efficient manner. Instead of calculating all of the FIR filter outputs and discarding M-1
out of every M
, only the samples output by the decimator are computed. The functions operate on blocks of input and output data. pSrc
points to an array of blockSize
input values and pDst
points to an array of blockSize/M
output values. In order to have an integer number of output samples blockSize
must always be a multiple of the decimation factor M
.
The library provides separate functions for Q15, Q31 and floating-point data types.
y[n] = b[0] * x[n] + b[1] * x[n-1] + b[2] * x[n-2] + ...+ b[numTaps-1] * x[n-numTaps+1]where,
b[n]
are the filter coefficients. pCoeffs
points to a coefficient array of size numTaps
. Coefficients are stored in time reversed order. {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
pState
points to a state array of size numTaps + blockSize - 1
. Samples in the state buffer are stored in the order: {x[n-numTaps+1], x[n-numTaps], x[n-numTaps-1], x[n-numTaps-2]....x[0], x[1], ..., x[blockSize-1]}The state variables are updated after each block of data is processed, the coefficients are untouched.
arm_fir_decimate_instance_f32 S = {M, numTaps, pCoeffs, pState}; arm_fir_decimate_instance_q31 S = {M, numTaps, pCoeffs, pState}; arm_fir_decimate_instance_q15 S = {M, numTaps, pCoeffs, pState};where
M
is the decimation factor; numTaps
is the number of filter coefficients in the filter; pCoeffs
is the address of the coefficient buffer; pState
is the address of the state buffer. Be sure to set the values in the state buffer to zeros when doing static initialization.void arm_fir_decimate_f32 | ( | const arm_fir_decimate_instance_f32 * | S, |
float32_t * | pSrc, | ||
float32_t * | pDst, | ||
uint32_t | blockSize | ||
) |
[in] | *S | points to an instance of the floating-point FIR decimator structure. |
[in] | *pSrc | points to the block of input data. |
[out] | *pDst | points to the block of output data. |
[in] | blockSize | number of input samples to process per call. |
References arm_fir_decimate_instance_f32::M, arm_fir_decimate_instance_f32::numTaps, arm_fir_decimate_instance_f32::pCoeffs, and arm_fir_decimate_instance_f32::pState.
void arm_fir_decimate_fast_q15 | ( | const arm_fir_decimate_instance_q15 * | S, |
q15_t * | pSrc, | ||
q15_t * | pDst, | ||
uint32_t | blockSize | ||
) |
[in] | *S | points to an instance of the Q15 FIR decimator structure. |
[in] | *pSrc | points to the block of input data. |
[out] | *pDst | points to the block of output data |
[in] | blockSize | number of input samples to process per call. |
Scaling and Overflow Behavior:
arm_fir_decimate_q15()
for a slower implementation of this function which uses 64-bit accumulation to avoid wrap around distortion. Both the slow and the fast versions use the same instance structure. Use the function arm_fir_decimate_init_q15()
to initialize the filter structure. References __SIMD32, arm_fir_decimate_instance_q15::M, arm_fir_decimate_instance_q15::numTaps, arm_fir_decimate_instance_q15::pCoeffs, and arm_fir_decimate_instance_q15::pState.
void arm_fir_decimate_fast_q31 | ( | arm_fir_decimate_instance_q31 * | S, |
q31_t * | pSrc, | ||
q31_t * | pDst, | ||
uint32_t | blockSize | ||
) |
[in] | *S | points to an instance of the Q31 FIR decimator structure. |
[in] | *pSrc | points to the block of input data. |
[out] | *pDst | points to the block of output data |
[in] | blockSize | number of input samples to process per call. |
Scaling and Overflow Behavior:
arm_fir_decimate_q31()
for a slower implementation of this function which uses a 64-bit accumulator to provide higher precision. Both the slow and the fast versions use the same instance structure. Use the function arm_fir_decimate_init_q31()
to initialize the filter structure. References arm_fir_decimate_instance_q31::M, arm_fir_decimate_instance_q31::numTaps, arm_fir_decimate_instance_q31::pCoeffs, and arm_fir_decimate_instance_q31::pState.
arm_status arm_fir_decimate_init_f32 | ( | arm_fir_decimate_instance_f32 * | S, |
uint16_t | numTaps, | ||
uint8_t | M, | ||
float32_t * | pCoeffs, | ||
float32_t * | pState, | ||
uint32_t | blockSize | ||
) |
[in,out] | *S | points to an instance of the floating-point FIR decimator structure. |
[in] | numTaps | number of coefficients in the filter. |
[in] | M | decimation factor. |
[in] | *pCoeffs | points to the filter coefficients. |
[in] | *pState | points to the state buffer. |
[in] | blockSize | number of input samples to process per call. |
blockSize
is not a multiple of M
.Description:
pCoeffs
points to the array of filter coefficients stored in time reversed order: {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
pState
points to the array of state variables. pState
is of length numTaps+blockSize-1
words where blockSize
is the number of input samples passed to arm_fir_decimate_f32()
. M
is the decimation factor. References ARM_MATH_LENGTH_ERROR, ARM_MATH_SUCCESS, arm_fir_decimate_instance_f32::M, arm_fir_decimate_instance_f32::numTaps, arm_fir_decimate_instance_f32::pCoeffs, arm_fir_decimate_instance_f32::pState, and status.
arm_status arm_fir_decimate_init_q15 | ( | arm_fir_decimate_instance_q15 * | S, |
uint16_t | numTaps, | ||
uint8_t | M, | ||
q15_t * | pCoeffs, | ||
q15_t * | pState, | ||
uint32_t | blockSize | ||
) |
[in,out] | *S | points to an instance of the Q15 FIR decimator structure. |
[in] | numTaps | number of coefficients in the filter. |
[in] | M | decimation factor. |
[in] | *pCoeffs | points to the filter coefficients. |
[in] | *pState | points to the state buffer. |
[in] | blockSize | number of input samples to process per call. |
blockSize
is not a multiple of M
.Description:
pCoeffs
points to the array of filter coefficients stored in time reversed order: {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
pState
points to the array of state variables. pState
is of length numTaps+blockSize-1
words where blockSize
is the number of input samples to the call arm_fir_decimate_q15()
. M
is the decimation factor. References ARM_MATH_LENGTH_ERROR, ARM_MATH_SUCCESS, arm_fir_decimate_instance_q15::M, arm_fir_decimate_instance_q15::numTaps, arm_fir_decimate_instance_q15::pCoeffs, arm_fir_decimate_instance_q15::pState, and status.
arm_status arm_fir_decimate_init_q31 | ( | arm_fir_decimate_instance_q31 * | S, |
uint16_t | numTaps, | ||
uint8_t | M, | ||
q31_t * | pCoeffs, | ||
q31_t * | pState, | ||
uint32_t | blockSize | ||
) |
[in,out] | *S | points to an instance of the Q31 FIR decimator structure. |
[in] | numTaps | number of coefficients in the filter. |
[in] | M | decimation factor. |
[in] | *pCoeffs | points to the filter coefficients. |
[in] | *pState | points to the state buffer. |
[in] | blockSize | number of input samples to process per call. |
blockSize
is not a multiple of M
.Description:
pCoeffs
points to the array of filter coefficients stored in time reversed order: {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
pState
points to the array of state variables. pState
is of length numTaps+blockSize-1
words where blockSize
is the number of input samples passed to arm_fir_decimate_q31()
. M
is the decimation factor. References ARM_MATH_LENGTH_ERROR, ARM_MATH_SUCCESS, arm_fir_decimate_instance_q31::M, arm_fir_decimate_instance_q31::numTaps, arm_fir_decimate_instance_q31::pCoeffs, arm_fir_decimate_instance_q31::pState, and status.
void arm_fir_decimate_q15 | ( | const arm_fir_decimate_instance_q15 * | S, |
q15_t * | pSrc, | ||
q15_t * | pDst, | ||
uint32_t | blockSize | ||
) |
[in] | *S | points to an instance of the Q15 FIR decimator structure. |
[in] | *pSrc | points to the block of input data. |
[out] | *pDst | points to the location where the output result is written. |
[in] | blockSize | number of input samples to process per call. |
Scaling and Overflow Behavior:
arm_fir_decimate_fast_q15()
for a faster but less precise implementation of this function for Cortex-M3 and Cortex-M4. References __SIMD32, arm_fir_decimate_instance_q15::M, arm_fir_decimate_instance_q15::numTaps, arm_fir_decimate_instance_q15::pCoeffs, and arm_fir_decimate_instance_q15::pState.
void arm_fir_decimate_q31 | ( | const arm_fir_decimate_instance_q31 * | S, |
q31_t * | pSrc, | ||
q31_t * | pDst, | ||
uint32_t | blockSize | ||
) |
[in] | *S | points to an instance of the Q31 FIR decimator structure. |
[in] | *pSrc | points to the block of input data. |
[out] | *pDst | points to the block of output data |
[in] | blockSize | number of input samples to process per call. |
Scaling and Overflow Behavior:
arm_fir_decimate_fast_q31()
for a faster but less precise implementation of this function for Cortex-M3 and Cortex-M4. References arm_fir_decimate_instance_q31::M, arm_fir_decimate_instance_q31::numTaps, arm_fir_decimate_instance_q31::pCoeffs, and arm_fir_decimate_instance_q31::pState.