Community
cancel
Showing results for 
Search instead for 
Did you mean: 
yanfeng_gong
Beginner
64 Views

trouble with using ippsFIRMR** to upsample signal

Hi,

I am trying to use ippsFIRMR_ function to interpolate a signal from 1k sampling rate to 8k. It turns out that the plot of output signal is not even close to the original signal. The IPPS demo upsampling shows the similar phenomena as I observed. Maybe I misunderstood the principle of interpolation. All I want is to achieve the similar functionality as Matlab Interp does. I really appreciate your insights or suggestions.

-Yanfeng

#include

#include

#include

using

namespace std;

const

double PI = 4.0*atan(1.0);

int

main() {

int fs = 1000;

int fup = 8000;

int upfactor = int(fup/fs+0.5); //8 times

double cutofffreq = 0.25; //cut off frequency is 2K = 2/8;

int numiter = 1000; //number of samples

Ipp64f* sdata = ippsMalloc_64f(numiter*

sizeof(Ipp64f));

IppStatus ipstat;

IppsFIRState_64f* pstate;

int tapsLen = 8*upfactor+1; //65 taps

Ipp64f* ddata = ippsMalloc_64f(numiter*upfactor*

sizeof(Ipp64f));

Ipp64f* taps = ippsMalloc_64f(tapsLen*

sizeof(Ipp64f));

Ipp64f *pDlyLine = NULL;

ippStaticInit();

for(int i=0; i<1000; i++)

{

sdata = 120*cos(2*PI*60.0*i/fs); //source data is 120*cos(2*pi*60*t)

}

ipstat = ippsFIRGenLowpass_64f(cutofffreq, taps, tapsLen, ippWinHamming, ippTrue); //generate the 65-taps low pass filter coeff

ipstat = ippsFIRMRInitAlloc_64f(&pstate, taps, tapsLen, upfactor, 0, 1, 0, pDlyLine); //initilize the FIRMR

ipstat = ippsFIR_64f(sdata, ddata, numiter, pstate);

ipstat = ippsFIRFree_64f(pstate);

< P>ofstream fileout2("UpSampleResult.txt", ios::out);

for(int i=0; i<1000; i++)

{

fileout2<<

}

}

0 Kudos
0 Replies
Reply