//
// Project: Experiment 4.5.8 Implementation of sample rate convertor in real-time - 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 {
c = h;
w[k] = *x++; // Get the current data to delay line
m = k;
for (n=0; n {
for (sum=0, i=0; i {
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 {
k += order;
}
}
*index = k; // Update circular buffer index
}