📄 interpolate.c
字号:
//
// Project: Experiment 4.5.7 Sample Rate Convertor using FIR filter - Chapter 4
// File name: interpolate.c
//
// Description: This is the implementation of a fixed-point interpolaiton filter
//
// 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
//
// Tools used: CCS v.2.12.07
// TMS320VC5510 DSK Rev-C
//
#include "interpolation.h"
// Define DSP system memory map
#pragma CODE_SECTION(interpolate, ".text:fir");
void interpolate(short *x, short blkSize,
short *h, short order,
short *y,
short *w, short *index,
short intp)
{
short i,j,k,n,m;
long sum;
short *c;
k = *index;
for (j=0; j<blkSize; j++) // Block processing
{
c = h;
w[k] = *x++; // Get the current data to delay line
m = k;
for (n=0; n<intp; n++)
{
for (sum=0, i=0; i<order; i++) // FIR filter processing
{
sum += c[i*intp] * (long)w[k++];
if (k == order) // Simulate circular buffer
{
k = 0;
}
}
*y++ = (short)(sum>>14); // Save filter output
c++;
k = m;
}
k--;
if (k<0) // Update index for next time
{
k += order;
}
}
*index = k; // Update circular buffer index
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -