Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

ResamplePolyPhase functions

jimmyliu51
Beginner
436 Views

In ippsResamplePolyphase() function, there is a parameter called "factor" which is defined as "The ratio of output and input frequencies". I wonder if it is actually the ratio of output and input samples? (ref to page 8-212 in ippsman). I've gone through the sample code and it seems like number of samples. Since we are doing 'resample', number of samplesis much easy to specify.

On page 8-203, inRate and outRate parameters are defined as the input/output rate for fixed factor resampling. And it says "The function... with the factor equal to inrate/outRate without calculating the filter coefficients". It seems to me this "factor" is defined differently although on 8-213 I saw 'this ratio is defined during creation of the resampling structure".

I feel these two 'factor" are the same, so may be the definition on 8-203 is not right.

Anyone has any idea regarding this set of functions?

Thank you in advance!

Jimmy

0 Kudos
3 Replies
jimmyliu5
Beginner
436 Views

ok. Looks like only one definition is correct, the factor=output rate/input rate.

After trying to use IPP's sample C++ code, I think I got some simple idea. Meanwhile, there area few questions I like to ask. And hope someone can help:

If I use 2000 data samples as input and down-sample to say 1400, I will get the correct result. However, if I use 3000 or more samples, the down sampled result is not correct.

For example,I have a set of raw data arranged as

100 zeros, 100 1s, ..., 100 29s. I don't add any noise data. If I downsample it by a factor 7/10, I should get 70 for each of0,1,...29 in my output data. However, the sample C++ code only get 70 0s,...70 23s, after that, it gives a series of 23,24,25, 23,24, etc, quite like a random sequence.

I wonder if anyone has tested ippsResample() function with such data.

I used window=1024, then find history=1025, length=2048. Buffer=4000(buffer should not affect result).

In fact, this problem shows up for both fixed resample function and non-fixed version.

Do I miss something?

0 Kudos
Intel_C_Intel
Employee
436 Views

Hi, Jimmy,

The definition of the resampling factorthrough the number of input samples and the number of output samples works if only you take the whole input signal and resample it at once. But for an input stream the number of input samples is unknown and resampling can be done only via the ratio of input and output frequencies.

So inRate/outRate is not the ratio of input and output samples (eg for inRate=3, outRate=1, an input sequence of 2 samples will be converted to the output sequence of length 1). The real number of output samples is the rounded number inLength*factor. To avoid details of rounding (itcould be flooring, to nearest integer or smth else) the calculated number of output sample is returned.

If you resample the long sequence by portions that are not multiple to inRate the "right" number of output samples will be fractional. To enable the correct continuation of resampling the integr part (*pOutlen) and the fractional part (*pTime) are returned.

Thanks,

Alexander

0 Kudos
Intel_C_Intel
Employee
436 Views

Hi,

The reason of "random" results is following:

when you apply a filter to a sample you need history samples before and history samples after. So you have in the example history zeroes before for the first sample and history zeroes after the last sample. history=windows/2*10/7=732 here.

So, forhistory*factor-1=511 first and 511 last samples outside zeroes participate in output sample calculation

Thanks,

Alexander

0 Kudos
Reply