floatpointfir.c

来自「CHP 4 - Real-Time Digital Signal Process」· C语言 代码 · 共 33 行

C
33
字号
// 
//  Project: Example 4.18: floating-point implementation of FIR filter - Chapter 4
//  File name: floatPointFir.c   
//
//  Description: This is a floating-point FIR filter implementation
//
//  For the book "Real Time Digital Signal Processing: 
//                Implementation and Application, 2nd Ed"
//                By Sen M. Kuo, Bob H. Lee, and Wenshun Tian
//                Publisher: John Wiley and Sons, Ltd
//

#include "floatingPointFir.h"

void floatPointFir(float *x, float *h, short order, float *y, float *w)
{
  short i;
  float sum;

  w[0] = *x++;                        // Get the current data to delay line
  for (sum=0, i=0; i<order; i++)      // FIR filter processing
  {
    sum += h[i] * w[i];
  }
  *y++ = sum;                         // Save filter output

  for (i=order-1; i>0; i--)           // Update data delay line
  {
    w[i] = w[i-1];
  }
}

⌨️ 快捷键说明

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