From 96d6da4e252b06dcfdc041e7df23e86161c33007 Mon Sep 17 00:00:00 2001 From: rihab kouki Date: Tue, 28 Jul 2020 11:24:49 +0100 Subject: Official ARM version: v5.6.0 --- docs/DSP/html/group__FIR__Interpolate.html | 223 ++++++++++++++--------------- 1 file changed, 110 insertions(+), 113 deletions(-) (limited to 'docs/DSP/html/group__FIR__Interpolate.html') diff --git a/docs/DSP/html/group__FIR__Interpolate.html b/docs/DSP/html/group__FIR__Interpolate.html index fb61687..d9f068a 100644 --- a/docs/DSP/html/group__FIR__Interpolate.html +++ b/docs/DSP/html/group__FIR__Interpolate.html @@ -32,7 +32,7 @@ Logo
CMSIS-DSP -  Version 1.5.2 +  Version 1.7.0
CMSIS DSP Software Library
@@ -116,24 +116,24 @@ $(document).ready(function(){initNavTree('group__FIR__Interpolate.html','');}); - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +

Functions

void arm_fir_interpolate_f32 (const arm_fir_interpolate_instance_f32 *S, float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
 Processing function for the floating-point FIR interpolator. More...
 
arm_status arm_fir_interpolate_init_f32 (arm_fir_interpolate_instance_f32 *S, uint8_t L, uint16_t numTaps, float32_t *pCoeffs, float32_t *pState, uint32_t blockSize)
 Initialization function for the floating-point FIR interpolator. More...
 
arm_status arm_fir_interpolate_init_q15 (arm_fir_interpolate_instance_q15 *S, uint8_t L, uint16_t numTaps, q15_t *pCoeffs, q15_t *pState, uint32_t blockSize)
 Initialization function for the Q15 FIR interpolator. More...
 
arm_status arm_fir_interpolate_init_q31 (arm_fir_interpolate_instance_q31 *S, uint8_t L, uint16_t numTaps, q31_t *pCoeffs, q31_t *pState, uint32_t blockSize)
 Initialization function for the Q31 FIR interpolator. More...
 
void arm_fir_interpolate_q15 (const arm_fir_interpolate_instance_q15 *S, q15_t *pSrc, q15_t *pDst, uint32_t blockSize)
 Processing function for the Q15 FIR interpolator. More...
 
void arm_fir_interpolate_q31 (const arm_fir_interpolate_instance_q31 *S, q31_t *pSrc, q31_t *pDst, uint32_t blockSize)
 Processing function for the Q31 FIR interpolator. More...
 
void arm_fir_interpolate_f32 (const arm_fir_interpolate_instance_f32 *S, const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
 Processing function for floating-point FIR interpolator. More...
 
arm_status arm_fir_interpolate_init_f32 (arm_fir_interpolate_instance_f32 *S, uint8_t L, uint16_t numTaps, const float32_t *pCoeffs, float32_t *pState, uint32_t blockSize)
 Initialization function for the floating-point FIR interpolator. More...
 
arm_status arm_fir_interpolate_init_q15 (arm_fir_interpolate_instance_q15 *S, uint8_t L, uint16_t numTaps, const q15_t *pCoeffs, q15_t *pState, uint32_t blockSize)
 Initialization function for the Q15 FIR interpolator. More...
 
arm_status arm_fir_interpolate_init_q31 (arm_fir_interpolate_instance_q31 *S, uint8_t L, uint16_t numTaps, const q31_t *pCoeffs, q31_t *pState, uint32_t blockSize)
 Initialization function for the Q31 FIR interpolator. More...
 
void arm_fir_interpolate_q15 (const arm_fir_interpolate_instance_q15 *S, const q15_t *pSrc, q15_t *pDst, uint32_t blockSize)
 Processing function for the Q15 FIR interpolator. More...
 
void arm_fir_interpolate_q31 (const arm_fir_interpolate_instance_q31 *S, const q31_t *pSrc, q31_t *pDst, uint32_t blockSize)
 Processing function for the Q31 FIR interpolator. More...
 

Description

These functions combine an upsampler (zero stuffer) and an FIR filter. They are used in multirate systems for increasing the sample rate of a signal without introducing high frequency images. Conceptually, the functions are equivalent to the block diagram below:

@@ -144,35 +144,35 @@ Components included in the FIR Interpolator functions

After upsampling by a factor of L, the signal should be filtered by a lowpass filter with a normalized cutoff frequency of 1/L in order to eliminate high frequency copies of the spectrum. The user of the function is responsible for providing the filter coefficients.

The FIR interpolator functions provided in the CMSIS DSP Library combine the upsampler and FIR filter in an efficient manner. The upsampler inserts L-1 zeros between each sample. Instead of multiplying by these zero values, the FIR filter is designed to skip them. This leads to an efficient implementation without any wasted effort. 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*L output values.

The library provides separate functions for Q15, Q31, and floating-point data types.

-
Algorithm:
The functions use a polyphase filter structure:
-   y[n] = b[0] * x[n] + b[L]   * x[n-1] + ... + b[L*(phaseLength-1)] * x[n-phaseLength+1]
-   y[n+1] = b[1] * x[n] + b[L+1] * x[n-1] + ... + b[L*(phaseLength-1)+1] * x[n-phaseLength+1]
-   ...
-   y[n+(L-1)] = b[L-1] * x[n] + b[2*L-1] * x[n-1] + ....+ b[L*(phaseLength-1)+(L-1)] * x[n-phaseLength+1]
+
Algorithm
The functions use a polyphase filter structure:
+    y[n] = b[0] * x[n] + b[L]   * x[n-1] + ... + b[L*(phaseLength-1)] * x[n-phaseLength+1]
+    y[n+1] = b[1] * x[n] + b[L+1] * x[n-1] + ... + b[L*(phaseLength-1)+1] * x[n-phaseLength+1]
+    ...
+    y[n+(L-1)] = b[L-1] * x[n] + b[2*L-1] * x[n-1] + ....+ b[L*(phaseLength-1)+(L-1)] * x[n-phaseLength+1]
 
This approach is more efficient than straightforward upsample-then-filter algorithms. With this method the computation is reduced by a factor of 1/L when compared to using a standard FIR filter.
-
pCoeffs points to a coefficient array of size numTaps. numTaps must be a multiple of the interpolation factor L and this is checked by the initialization functions. Internally, the function divides the FIR filter's impulse response into shorter filters of length phaseLength=numTaps/L. Coefficients are stored in time reversed order.
-
-   {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
+
pCoeffs points to a coefficient array of size numTaps. numTaps must be a multiple of the interpolation factor L and this is checked by the initialization functions. Internally, the function divides the FIR filter's impulse response into shorter filters of length phaseLength=numTaps/L. 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 blockSize + phaseLength - 1. Samples in the state buffer are stored in the order:
-
+
pState points to a state array of size blockSize + phaseLength - 1. Samples in the state buffer are stored in the order:
    {x[n-phaseLength+1], x[n-phaseLength], x[n-phaseLength-1], x[n-phaseLength-2]....x[0], x[1], ..., x[blockSize-1]}
-
The state variables are updated after each block of data is processed, the coefficients are untouched.
+
+
The state variables are updated after each block of data is processed, the coefficients are untouched.
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 arrays may be shared among several instances while state variable array should be allocated separately. There are separate instance structure declarations for each of the 3 supported data types.
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.
  • -
  • Checks to make sure that the length of the filter is a multiple of the interpolation factor. To do this manually without calling the init function, assign the follow subfields of the instance structure: L (interpolation factor), pCoeffs, phaseLength (numTaps / L), pState. Also set all of the values in pState to zero.
  • +
  • Checks to make sure that the length of the filter is a multiple of the interpolation factor. To do this manually without calling the init function, assign the follow subfields of the instance structure: L (interpolation factor), pCoeffs, phaseLength (numTaps / L), pState. Also set all of the values in pState to zero.
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. The code below statically initializes each of the 3 different data type filter instance structures
-arm_fir_interpolate_instance_f32 S = {L, phaseLength, pCoeffs, pState};
-arm_fir_interpolate_instance_q31 S = {L, phaseLength, pCoeffs, pState};
-arm_fir_interpolate_instance_q15 S = {L, phaseLength, pCoeffs, pState};
-
where L is the interpolation factor; phaseLength=numTaps/L is the length of each of the shorter FIR filters used internally, 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.
+ arm_fir_interpolate_instance_f32 S = {L, phaseLength, pCoeffs, pState}; + arm_fir_interpolate_instance_q31 S = {L, phaseLength, pCoeffs, pState}; + arm_fir_interpolate_instance_q15 S = {L, phaseLength, pCoeffs, pState}; +
+
where L is the interpolation factor; phaseLength=numTaps/L is the length of each of the shorter FIR filters used internally, 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.
Fixed-Point Behavior
Care must be taken when using the fixed-point versions of the FIR interpolate 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.

Function Documentation

- +
@@ -185,7 +185,7 @@ Components included in the FIR Interpolator functions - + @@ -207,22 +207,21 @@ Components included in the FIR Interpolator functions
float32_tconst float32_t pSrc,
+

Processing function for the floating-point FIR interpolator.

Parameters
- - - - + + + +
[in]*Spoints to an instance of the floating-point FIR interpolator structure.
[in]*pSrcpoints to the block of input data.
[out]*pDstpoints to the block of output data.
[in]blockSizenumber of input samples to process per call.
[in]Spoints to an instance of the floating-point FIR interpolator structure
[in]pSrcpoints to the block of input data
[out]pDstpoints to the block of output data
[in]blockSizenumber of samples to process
-
Returns
none.
- -

References blockSize, arm_fir_interpolate_instance_f32::L, arm_fir_interpolate_instance_f32::pCoeffs, arm_fir_interpolate_instance_f32::phaseLength, and arm_fir_interpolate_instance_f32::pState.

+
Returns
none
- +
@@ -247,7 +246,7 @@ Components included in the FIR Interpolator functions - + @@ -271,27 +270,29 @@ Components included in the FIR Interpolator functions
Parameters
float32_tconst float32_t pCoeffs,
- - - - - - + + + + + +
[in,out]*Spoints to an instance of the floating-point FIR interpolator structure.
[in]Lupsample factor.
[in]numTapsnumber of filter coefficients in the filter.
[in]*pCoeffspoints to the filter coefficient buffer.
[in]*pStatepoints to the state buffer.
[in]blockSizenumber of input samples to process per call.
[in,out]Spoints to an instance of the floating-point FIR interpolator structure
[in]Lupsample factor
[in]numTapsnumber of filter coefficients in the filter
[in]pCoeffspoints to the filter coefficient buffer
[in]pStatepoints to the state buffer
[in]blockSizenumber of input samples to process per call
-
Returns
The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_LENGTH_ERROR if the filter length numTaps is not a multiple of the interpolation factor L.
-

Description:

-
pCoeffs points to the array of filter coefficients stored in time reversed order:
-   {b[numTaps-1], b[numTaps-2], b[numTaps-2], ..., b[1], b[0]}
-
The length of the filter numTaps must be a multiple of the interpolation factor L.
-
pState points to the array of state variables. pState is of length (numTaps/L)+blockSize-1 words where blockSize is the number of input samples processed by each call to arm_fir_interpolate_f32().
- -

References ARM_MATH_LENGTH_ERROR, ARM_MATH_SUCCESS, arm_fir_interpolate_instance_f32::L, arm_fir_interpolate_instance_f32::pCoeffs, arm_fir_interpolate_instance_f32::phaseLength, arm_fir_interpolate_instance_f32::pState, and status.

+
Returns
execution status +
+
Details
pCoeffs points to the array of filter coefficients stored in time reversed order:
+    {b[numTaps-1], b[numTaps-2], b[numTaps-2], ..., b[1], b[0]}
+
+
The length of the filter numTaps must be a multiple of the interpolation factor L.
+
pState points to the array of state variables. pState is of length (numTaps/L)+blockSize-1 words where blockSize is the number of input samples processed by each call to arm_fir_interpolate_f32().
- +
@@ -316,7 +317,7 @@ Components included in the FIR Interpolator functions - + @@ -340,27 +341,28 @@ Components included in the FIR Interpolator functions
Parameters
q15_tconst q15_t pCoeffs,
- - - - - - + + + + + +
[in,out]*Spoints to an instance of the Q15 FIR interpolator structure.
[in]Lupsample factor.
[in]numTapsnumber of filter coefficients in the filter.
[in]*pCoeffspoints to the filter coefficient buffer.
[in]*pStatepoints to the state buffer.
[in]blockSizenumber of input samples to process per call.
[in,out]Spoints to an instance of the Q15 FIR interpolator structure
[in]Lupsample factor
[in]numTapsnumber of filter coefficients in the filter
[in]pCoeffspoints to the filter coefficient buffer
[in]pStatepoints to the state buffer
[in]blockSizenumber of input samples to process per call
-
Returns
The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_LENGTH_ERROR if the filter length numTaps is not a multiple of the interpolation factor L.
-

Description:

-
pCoeffs points to the array of filter coefficients stored in time reversed order:
-   {b[numTaps-1], b[numTaps-2], b[numTaps-2], ..., b[1], b[0]}
+
Returns
execution status +
+
Details
pCoeffs points to the array of filter coefficients stored in time reversed order:
+    {b[numTaps-1], b[numTaps-2], b[numTaps-2], ..., b[1], b[0]}
 
The length of the filter numTaps must be a multiple of the interpolation factor L.
-
pState points to the array of state variables. pState is of length (numTaps/L)+blockSize-1 words where blockSize is the number of input samples processed by each call to arm_fir_interpolate_q15().
- -

References ARM_MATH_LENGTH_ERROR, ARM_MATH_SUCCESS, arm_fir_interpolate_instance_q15::L, arm_fir_interpolate_instance_q15::pCoeffs, arm_fir_interpolate_instance_q15::phaseLength, arm_fir_interpolate_instance_q15::pState, and status.

+
pState points to the array of state variables. pState is of length (numTaps/L)+blockSize-1 words where blockSize is the number of input samples processed by each call to arm_fir_interpolate_q15().
- +
@@ -385,7 +387,7 @@ Components included in the FIR Interpolator functions - + @@ -409,27 +411,28 @@ Components included in the FIR Interpolator functions
Parameters
q31_tconst q31_t pCoeffs,
- - - - - - + + + + + +
[in,out]*Spoints to an instance of the Q31 FIR interpolator structure.
[in]Lupsample factor.
[in]numTapsnumber of filter coefficients in the filter.
[in]*pCoeffspoints to the filter coefficient buffer.
[in]*pStatepoints to the state buffer.
[in]blockSizenumber of input samples to process per call.
[in,out]Spoints to an instance of the Q31 FIR interpolator structure
[in]Lupsample factor
[in]numTapsnumber of filter coefficients in the filter
[in]pCoeffspoints to the filter coefficient buffer
[in]pStatepoints to the state buffer
[in]blockSizenumber of input samples to process per call
-
Returns
The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_LENGTH_ERROR if the filter length numTaps is not a multiple of the interpolation factor L.
-

Description:

-
pCoeffs points to the array of filter coefficients stored in time reversed order:
-   {b[numTaps-1], b[numTaps-2], b[numTaps-2], ..., b[1], b[0]}
+
Returns
execution status +
+
Details
pCoeffs points to the array of filter coefficients stored in time reversed order:
+    {b[numTaps-1], b[numTaps-2], b[numTaps-2], ..., b[1], b[0]}
 
The length of the filter numTaps must be a multiple of the interpolation factor L.
-
pState points to the array of state variables. pState is of length (numTaps/L)+blockSize-1 words where blockSize is the number of input samples processed by each call to arm_fir_interpolate_q31().
- -

References ARM_MATH_LENGTH_ERROR, ARM_MATH_SUCCESS, arm_fir_interpolate_instance_q31::L, arm_fir_interpolate_instance_q31::pCoeffs, arm_fir_interpolate_instance_q31::phaseLength, arm_fir_interpolate_instance_q31::pState, and status.

+
pState points to the array of state variables. pState is of length (numTaps/L)+blockSize-1 words where blockSize is the number of input samples processed by each call to arm_fir_interpolate_q31().
- +
@@ -442,7 +445,7 @@ Components included in the FIR Interpolator functions - + @@ -466,22 +469,19 @@ Components included in the FIR Interpolator functions
Parameters
q15_tconst q15_t pSrc,
- - - - + + + +
[in]*Spoints to an instance of the Q15 FIR interpolator structure.
[in]*pSrcpoints to the block of input data.
[out]*pDstpoints to the block of output data.
[in]blockSizenumber of input samples to process per call.
[in]Spoints to an instance of the Q15 FIR interpolator structure
[in]pSrcpoints to the block of input data
[out]pDstpoints to the block of output data
[in]blockSizenumber of samples to process
-
Returns
none.
-

Scaling and Overflow Behavior:

-
The function is implemented using a 64-bit internal accumulator. Both coefficients and state variables are represented in 1.15 format and multiplications yield a 2.30 result. The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. Lastly, the accumulator is saturated to yield a result in 1.15 format.
- -

References blockSize, arm_fir_interpolate_instance_q15::L, arm_fir_interpolate_instance_q15::pCoeffs, arm_fir_interpolate_instance_q15::phaseLength, and arm_fir_interpolate_instance_q15::pState.

+
Returns
none
+
Scaling and Overflow Behavior
The function is implemented using a 64-bit internal accumulator. Both coefficients and state variables are represented in 1.15 format and multiplications yield a 2.30 result. The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. Lastly, the accumulator is saturated to yield a result in 1.15 format.
- +
@@ -494,7 +494,7 @@ Components included in the FIR Interpolator functions - + @@ -518,18 +518,15 @@ Components included in the FIR Interpolator functions
Parameters
q31_tconst q31_t pSrc,
- - - - + + + +
[in]*Spoints to an instance of the Q31 FIR interpolator structure.
[in]*pSrcpoints to the block of input data.
[out]*pDstpoints to the block of output data.
[in]blockSizenumber of input samples to process per call.
[in]Spoints to an instance of the Q31 FIR interpolator structure
[in]pSrcpoints to the block of input data
[out]pDstpoints to the block of output data
[in]blockSizenumber of samples to process
-
Returns
none.
-

Scaling and Overflow Behavior:

-
The function is implemented using an internal 64-bit accumulator. The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. Thus, if the accumulator result overflows it wraps around rather than clip. In order to avoid overflows completely the input signal must be scaled down by 1/(numTaps/L). since numTaps/L additions occur per output sample. After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
- -

References blockSize, arm_fir_interpolate_instance_q31::L, arm_fir_interpolate_instance_q31::pCoeffs, arm_fir_interpolate_instance_q31::phaseLength, and arm_fir_interpolate_instance_q31::pState.

+
Returns
none
+
Scaling and Overflow Behavior
The function is implemented using an internal 64-bit accumulator. The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. Thus, if the accumulator result overflows it wraps around rather than clip. In order to avoid overflows completely the input signal must be scaled down by 1/(numTaps/L). since numTaps/L additions occur per output sample. After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
@@ -538,7 +535,7 @@ Components included in the FIR Interpolator functions