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

📄 floatpointblockfir.c

📁 CHP 4 - Real-Time Digital Signal Processing: Implementations and Applications, Second Edition by Sen
💻 C
字号:
// 
//  Project: Example 4.19: floating-point implementation of block FIR filter - Chapter 4
//  File name: floatPointFir.c   
//
//  Description: This is the floating-point block 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 floatPointBlockFir(float *x, short blkSize, 
                        float *h, short order, 
                        float *y, 
                        float *w, short *index)
{
  short i,j,k;
  float sum;
  float *c;

  k = *index;
  for (j=0; j<blkSize; j++)             // Block processing
  {
    w[k] = *x++;                        // Get the current data to delay line
    c = h;
    for (sum=0, i=0; i<order; i++)      // FIR filter processing
    {
      sum += *c++ * w[k++];
      k %= order;                       // Simulate circular buffer
    }
    *y++ = sum;                         // Save filter output

    k=(order + k-1)%order;              // Update index for next time
        
  }
  *index = k;                           // Update circular buffer index
}

⌨️ 快捷键说明

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