CHP 4 - Real-Time Digital Signal Processing: Implementations and Applications, Second Edition by Sen

源代码在线查看: interpolate.c

软件大小: 2588 K
上传用户: zhoubin2048
关键词: Implementations Applications Processing Real-Time
下载地址: 免注册下载 普通下载 VIP

相关代码

				// 
				//  Project: Experiment 4.5.6 Interpolaiton 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				  {
				    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
				}
				
							

相关资源