⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 k60-keil

📁 K60-Keil版本(下载安装MDK4.23)
💻
📖 第 1 页 / 共 2 页
字号:
      acc += mult32x64(Yn1, a1);
      /* acc +=  a2 * y[n-2] */
      acc += mult32x64(Yn2, a2);

      /* The result is converted to 1.63 , Yn2 variable is reused */
      Yn2 = acc << shift;

      /* Store the output in the destination buffer in 1.31 format. */
      *pOut++ = (q31_t) (acc >> (32 - shift));

      /* Read the second input into Xn2, to reuse the value */
      Xn2 = *pIn++;

      /* The value is shifted to the MSB to perform 32x64 multiplication */
      Xn2 = Xn2 << 32;

      /* acc =  b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] + a1 * y[n-1] + a2 * y[n-2] */

      /* acc =  b0 * x[n] */
      acc = mult32x64(Xn2, b0);
      /* acc +=  b1 * x[n-1] */
      acc += mult32x64(Xn, b1);
      /* acc +=  b[2] * x[n-2] */
      acc += mult32x64(Xn1, b2);
      /* acc +=  a1 * y[n-1] */
      acc += mult32x64(Yn2, a1);
      /* acc +=  a2 * y[n-2] */
      acc += mult32x64(Yn1, a2);

      /* The result is converted to 1.63, Yn1 variable is reused */
      Yn1 = acc << shift;

      /* The result is converted to 1.31 */
      /* Store the output in the destination buffer. */
      *pOut++ = (q31_t) (acc >> (32 - shift));

      /* Read the third input into Xn1, to reuse the value */
      Xn1 = *pIn++;

      /* The value is shifted to the MSB to perform 32x64 multiplication */
      Xn1 = Xn1 << 32;

      /* acc =  b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] + a1 * y[n-1] + a2 * y[n-2] */
      /* acc =  b0 * x[n] */
      acc = mult32x64(Xn1, b0);
      /* acc +=  b1 * x[n-1] */
      acc += mult32x64(Xn2, b1);
      /* acc +=  b[2] * x[n-2] */
      acc += mult32x64(Xn, b2);
      /* acc +=  a1 * y[n-1] */
      acc += mult32x64(Yn1, a1);
      /* acc +=  a2 * y[n-2] */
      acc += mult32x64(Yn2, a2);

      /* The result is converted to 1.63, Yn2 variable is reused  */
      Yn2 = acc << shift;

      /* Store the output in the destination buffer in 1.31 format. */
      *pOut++ = (q31_t) (acc >> (32 - shift));

      /* Read the fourth input into Xn, to reuse the value */
      Xn = *pIn++;

      /* The value is shifted to the MSB to perform 32x64 multiplication */
      Xn = Xn << 32;

      /* acc =  b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] + a1 * y[n-1] + a2 * y[n-2] */
      /* acc =  b0 * x[n] */
      acc = mult32x64(Xn, b0);
      /* acc +=  b1 * x[n-1] */
      acc += mult32x64(Xn1, b1);
      /* acc +=  b[2] * x[n-2] */
      acc += mult32x64(Xn2, b2);
      /* acc +=  a1 * y[n-1] */
      acc += mult32x64(Yn2, a1);
      /* acc +=  a2 * y[n-2] */
      acc += mult32x64(Yn1, a2);

      /* The result is converted to 1.63, Yn1 variable is reused  */
      Yn1 = acc << shift;

      /* Every time after the output is computed state should be updated. */
      /* The states should be updated as:  */
      /* Xn2 = Xn1    */
      /* Xn1 = Xn     */
      /* Yn2 = Yn1    */
      /* Yn1 = acc    */
      Xn2 = Xn1;
      Xn1 = Xn;

      /* Store the output in the destination buffer in 1.31 format. */
      *pOut++ = (q31_t) (acc >> (32 - shift));

      /* decrement the loop counter */
      sample--;
    }

    /* If the blockSize is not a multiple of 4, compute any remaining output samples here.   
     ** No loop unrolling is used. */
    sample = (blockSize & 0x3u);

    while(sample > 0u)
    {
      /* Read the input */
      Xn = *pIn++;

      /* The value is shifted to the MSB to perform 32x64 multiplication */
      Xn = Xn << 32;

      /* acc =  b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] + a1 * y[n-1] + a2 * y[n-2] */
      /* acc =  b0 * x[n] */
      acc = mult32x64(Xn, b0);
      /* acc +=  b1 * x[n-1] */
      acc += mult32x64(Xn1, b1);
      /* acc +=  b[2] * x[n-2] */
      acc += mult32x64(Xn2, b2);
      /* acc +=  a1 * y[n-1] */
      acc += mult32x64(Yn1, a1);
      /* acc +=  a2 * y[n-2] */
      acc += mult32x64(Yn2, a2);

      /* Every time after the output is computed state should be updated. */
      /* The states should be updated as:  */
      /* Xn2 = Xn1    */
      /* Xn1 = Xn     */
      /* Yn2 = Yn1    */
      /* Yn1 = acc    */
      Xn2 = Xn1;
      Xn1 = Xn;
      Yn2 = Yn1;
      Yn1 = acc << shift;

      /* Store the output in the destination buffer in 1.31 format. */
      *pOut++ = (q31_t) (acc >> (32 - shift));

      /* decrement the loop counter */
      sample--;
    }

    /*  The first stage output is given as input to the second stage. */
    pIn = pDst;

    /* Reset to destination buffer working pointer */
    pOut = pDst;

    /*  Store the updated state variables back into the pState array */
    *pState++ = Xn1;
    *pState++ = Xn2;
    *pState++ = Yn1;
    *pState++ = Yn2;

  } while(--stage);

#else

  /* Run the below code for Cortex-M0 */

  do
  {
    /* Reading the coefficients */
    b0 = *pCoeffs++;
    b1 = *pCoeffs++;
    b2 = *pCoeffs++;
    a1 = *pCoeffs++;
    a2 = *pCoeffs++;

    /* Reading the state values */
    Xn1 = pState[0];
    Xn2 = pState[1];
    Yn1 = pState[2];
    Yn2 = pState[3];

    /* The variable acc hold output value that is being computed and       
     * stored in the destination buffer           
     * acc =  b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] + a1 * y[n-1] + a2 * y[n-2]           
     */

    sample = blockSize;

    while(sample > 0u)
    {
      /* Read the input */
      Xn = *pIn++;

      /* The value is shifted to the MSB to perform 32x64 multiplication */
      Xn = Xn << 32;

      /* acc =  b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] + a1 * y[n-1] + a2 * y[n-2] */
      /* acc =  b0 * x[n] */
      acc = mult32x64(Xn, b0);
      /* acc +=  b1 * x[n-1] */
      acc += mult32x64(Xn1, b1);
      /* acc +=  b[2] * x[n-2] */
      acc += mult32x64(Xn2, b2);
      /* acc +=  a1 * y[n-1] */
      acc += mult32x64(Yn1, a1);
      /* acc +=  a2 * y[n-2] */
      acc += mult32x64(Yn2, a2);

      /* Every time after the output is computed state should be updated. */
      /* The states should be updated as:  */
      /* Xn2 = Xn1    */
      /* Xn1 = Xn     */
      /* Yn2 = Yn1    */
      /* Yn1 = acc    */
      Xn2 = Xn1;
      Xn1 = Xn;
      Yn2 = Yn1;
      Yn1 = acc << shift;

      /* Store the output in the destination buffer in 1.31 format. */
      *pOut++ = (q31_t) (acc >> (32 - shift));

      /* decrement the loop counter */
      sample--;
    }

    /*  The first stage output is given as input to the second stage. */
    pIn = pDst;

    /* Reset to destination buffer working pointer */
    pOut = pDst;

    /*  Store the updated state variables back into the pState array */
    *pState++ = Xn1;
    *pState++ = Xn2;
    *pState++ = Yn1;
    *pState++ = Yn2;

  } while(--stage);

#endif /*    #ifndef ARM_MATH_CM0     */
}

  /**   
   * @} end of BiquadCascadeDF1_32x64 group   
   */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -