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__BiquadCascadeDF1__32x64.html | 73 +++++++++++------------ 1 file changed, 35 insertions(+), 38 deletions(-) (limited to 'docs/DSP/html/group__BiquadCascadeDF1__32x64.html') diff --git a/docs/DSP/html/group__BiquadCascadeDF1__32x64.html b/docs/DSP/html/group__BiquadCascadeDF1__32x64.html index 4e73dce..7e43bf9 100644 --- a/docs/DSP/html/group__BiquadCascadeDF1__32x64.html +++ b/docs/DSP/html/group__BiquadCascadeDF1__32x64.html @@ -32,7 +32,7 @@ Logo
CMSIS-DSP -  Version 1.5.2 +  Version 1.7.0
CMSIS DSP Software Library
@@ -116,9 +116,11 @@ $(document).ready(function(){initNavTree('group__BiquadCascadeDF1__32x64.html',' - - + + + +

Functions

void arm_biquad_cas_df1_32x64_init_q31 (arm_biquad_cas_df1_32x64_ins_q31 *S, uint8_t numStages, q31_t *pCoeffs, q63_t *pState, uint8_t postShift)
 
void arm_biquad_cas_df1_32x64_init_q31 (arm_biquad_cas_df1_32x64_ins_q31 *S, uint8_t numStages, const q31_t *pCoeffs, q63_t *pState, uint8_t postShift)
 Initialization function for the Q31 Biquad cascade 32x64 filter. More...
 
void arm_biquad_cas_df1_32x64_q31 (const arm_biquad_cas_df1_32x64_ins_q31 *S, q31_t *pSrc, q31_t *pDst, uint32_t blockSize)
 Processing function for the Q31 Biquad cascade 32x64 filter. More...
 

Description

@@ -130,18 +132,18 @@ Functions Biquad.gif
Single Biquad filter stage
-Coefficients b0, b1, and b2 multiply the input signal x[n] and are referred to as the feedforward coefficients. Coefficients a1 and a2 multiply the output signal y[n] and are referred to as the feedback coefficients. Pay careful attention to the sign of the feedback coefficients. Some design tools use the difference equation
+ Coefficients b0, b1 and b2  multiply the input signal x[n] and are referred to as the feedforward coefficients. Coefficients a1 and a2 multiply the output signal y[n] and are referred to as the feedback coefficients. Pay careful attention to the sign of the feedback coefficients. Some design tools use the difference equation 
     y[n] = b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] - a1 * y[n-1] - a2 * y[n-2]
-
In this case the feedback coefficients a1 and a2 must be negated when used with the CMSIS DSP Library. +
In this case the feedback coefficients a1 and a2 must be negated when used with the CMSIS DSP Library.
Higher order filters are realized as a cascade of second order sections. numStages refers to the number of second order stages used. For example, an 8th order filter would be realized with numStages=4 second order stages.
BiquadCascade.gif
8th order filter using a cascade of Biquad stages
-A 9th order filter would be realized with numStages=5 second order stages with the coefficients for one of the stages configured as a first order filter (b2=0 and a2=0).
-
The pState points to state variables array . Each Biquad stage has 4 state variables x[n-1], x[n-2], y[n-1], and y[n-2] and each state variable in 1.63 format to improve precision. The state variables are arranged in the array as:
+ A 9th order filter would be realized with numStages=5 second order stages with the coefficients for one of the stages configured as a first order filter (b2=0 and a2=0). 
+
The pState points to state variables array. Each Biquad stage has 4 state variables x[n-1], x[n-2], y[n-1], and y[n-2] and each state variable in 1.63 format to improve precision. The state variables are arranged in the array as:
     {x[n-1], x[n-2], y[n-1], y[n-2]}
-
-
The 4 state variables for stage 1 are first, then the 4 state variables for stage 2, and so on. The state array has a total length of 4*numStages values of data in 1.63 format. The state variables are updated after each block of data is processed; the coefficients are untouched.
+ +
The 4 state variables for stage 1 are first, then the 4 state variables for stage 2, and so on. The state array has a total length of 4*numStages values of data in 1.63 format. 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 arrays cannot be shared.
Init Function
There is also an associated initialization function which performs the following operations:
  • Sets the values of the internal structure fields.
  • @@ -161,15 +163,15 @@ A 9th order filter would be realized with numStages=5 second order BiquadPostshift.gif
    Fixed-point Biquad with shift by postShift bits after accumulator
    -This essentially scales the filter coefficients by 2^postShift. For example, to realize the coefficients
    + This essentially scales the filter coefficients by 2^postShift. For example, to realize the coefficients 
        {1.5, -0.8, 1.2, 1.6, -0.9}
     
    set the Coefficient array to:
        {0.75, -0.4, 0.6, 0.8, -0.45}
    -
    and set postShift=1
-
The second thing to keep in mind is the gain through the filter. The frequency response of a Biquad filter is a function of its coefficients. It is possible for the gain through the filter to exceed 1.0 meaning that the filter increases the amplitude of certain frequencies. This means that an input signal with amplitude < 1.0 may result in an output > 1.0 and these are saturated or overflowed based on the implementation of the filter. To avoid this behavior the filter needs to be scaled down such that its peak gain < 1.0 or the input signal must be scaled down so that the combination of input and filter are never overflowed.
+ and set postShift=1 +
The second thing to keep in mind is the gain through the filter. The frequency response of a Biquad filter is a function of its coefficients. It is possible for the gain through the filter to exceed 1.0 meaning that the filter increases the amplitude of certain frequencies. This means that an input signal with amplitude < 1.0 may result in an output > 1.0 and these are saturated or overflowed based on the implementation of the filter. To avoid this behavior the filter needs to be scaled down such that its peak gain < 1.0 or the input signal must be scaled down so that the combination of input and filter are never overflowed.
The third item to consider is the overflow and saturation behavior of the fixed-point Q31 version. This is described in the function specific documentation below.

Function Documentation

- +
@@ -188,7 +190,7 @@ This essentially scales the filter coefficients by 2^postShift. For - + @@ -212,27 +214,22 @@ This essentially scales the filter coefficients by 2^postShift. For
Parameters
q31_tconst q31_t pCoeffs,
- - - - - + + + + +
[in,out]*Spoints to an instance of the high precision Q31 Biquad cascade filter structure.
[in]numStagesnumber of 2nd order stages in the filter.
[in]*pCoeffspoints to the filter coefficients.
[in]*pStatepoints to the state buffer.
[in]postShiftShift to be applied after the accumulator. Varies according to the coefficients format.
[in,out]Spoints to an instance of the high precision Q31 Biquad cascade filter structure
[in]numStagesnumber of 2nd order stages in the filter
[in]pCoeffspoints to the filter coefficients
[in]pStatepoints to the state buffer
[in]postShiftShift to be applied after the accumulator. Varies according to the coefficients format
Returns
none
-

Coefficient and State Ordering:

-
The coefficients are stored in the array pCoeffs in the following order:
+
Coefficient and State Ordering
The coefficients are stored in the array pCoeffs in the following order:
     {b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ...}
-
where b1x and a1x are the coefficients for the first stage, b2x and a2x are the coefficients for the second stage, and so on. The pCoeffs array contains a total of 5*numStages values.
+
where b1x and a1x are the coefficients for the first stage, b2x and a2x are the coefficients for the second stage, and so on. The pCoeffs array contains a total of 5*numStages values.
The pState points to state variables array and size of each state variable is 1.63 format. Each Biquad stage has 4 state variables x[n-1], x[n-2], y[n-1], and y[n-2]. The state variables are arranged in the state array as:
     {x[n-1], x[n-2], y[n-1], y[n-2]}
 
The 4 state variables for stage 1 are first, then the 4 state variables for stage 2, and so on. The state array has a total length of 4*numStages values. The state variables are updated after each block of data is processed; the coefficients are untouched.
-

References arm_biquad_cas_df1_32x64_ins_q31::numStages, arm_biquad_cas_df1_32x64_ins_q31::pCoeffs, arm_biquad_cas_df1_32x64_ins_q31::postShift, and arm_biquad_cas_df1_32x64_ins_q31::pState.

- -

Referenced by main().

-
@@ -272,20 +269,20 @@ This essentially scales the filter coefficients by 2^postShift. For
Parameters
- - - - + + + +
[in]*Spoints to an instance of the high precision Q31 Biquad cascade filter.
[in]*pSrcpoints to the block of input data.
[out]*pDstpoints to the block of output data.
[in]blockSizenumber of samples to process.
[in]Spoints to an instance of the high precision Q31 Biquad cascade filter
[in]pSrcpoints to the block of input data
[out]pDstpoints to the block of output data
[in]blockSizenumber of samples to process
-
Returns
none.
-
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 2 bits and lie in the range [-0.25 +0.25). After all 5 multiply-accumulates are performed, the 2.62 accumulator is shifted by postShift bits and the result truncated to 1.31 format by discarding the low 32 bits.
-
Two related functions are provided in the CMSIS DSP library. arm_biquad_cascade_df1_q31() implements a Biquad cascade with 32-bit coefficients and state variables with a Q63 accumulator. arm_biquad_cascade_df1_fast_q31() implements a Biquad cascade with 32-bit coefficients and state variables with a Q31 accumulator.
- -

References blockSize, mult32x64(), arm_biquad_cas_df1_32x64_ins_q31::numStages, arm_biquad_cas_df1_32x64_ins_q31::pCoeffs, arm_biquad_cas_df1_32x64_ins_q31::postShift, and arm_biquad_cas_df1_32x64_ins_q31::pState.

- -

Referenced by main().

+
Returns
none
+
Details
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 2 bits and lie in the range [-0.25 +0.25). After all 5 multiply-accumulates are performed, the 2.62 accumulator is shifted by postShift bits and the result truncated to 1.31 format by discarding the low 32 bits.
+
Two related functions are provided in the CMSIS DSP library. +
@@ -294,7 +291,7 @@ This essentially scales the filter coefficients by 2^postShift. For