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

ResamplePolyphaseFixed_32f crashes

I've been experimenting with using the polyphase resampler in IPP for resampling low sample rates without an integer resampling factor. (As an example, upsampling 400Hz to 480Hz).

I've created a simple test program which upsamples random data, similar to the example code in the documentation for ResamplePolyphaseFixed - however, the executable crashes with a segmentation fault somewhere inside the call to ResamplePolyphaseFixed.

The code, minus some debug output, is as follows:

int inputLength=400;
int outputLength=480;
int idealFilterLength=60;

float* input = new float[inputLength];
float* output = new float[outputLength];

for (int i = 0; i < inputLength; i++)
{
 input = (float)random / (float)RAND_MAX;
}

int pSize, pLen, pHeight;

ippsResamplePolyphaseFixedGetSize_32f(inputLength, outputLength, idealFilterLength, &pSize, &pLen, &pHeight, ippAlgHintFast)

IppsResamplingPolyphaseFixed_32f* spec;
spec = (IppsResamplingPolyphaseFixed_32f*)ippsMalloc_8u(pSize);

double pTime;
int outL;

ippsResamplePolyphaseFixed_32f(input, inputLength, output, 0.98f, &pTime, &outL, spec);

The program completes in gdb and valgrind, though valgrind reports a number of invalid reads inside ResamplePolyphaseFixed.

Any suggestions as to where I'm going wrong with this would be greatly appreciated.

0 Kudos
3 Replies
Zhen_Z_Intel
Employee
64 Views

Dear customer,

You probably need to Initialize the structures for data resampling with the factor equal to inRate/outRate. Please use ippsResamplePolyphaseFixedInit_32f before resampling calculation. Here's a sample about how to use IPP polyphase resampling. You could refer to this link.

Best regards,
Fiona

John_H_
Beginner
64 Views

Hi,

I missed out the line which called that function when I was transcribing the code. This is the line after spec is allocated (at line 19 in the snippet in my original post):

ippsResamplePolyphaseFixedInit_32f(inputLength, outputLength, pLen, 0.95f, 8.0f, spec, ippAlgHintFast)

 

 

Zhen_Z_Intel
Employee
64 Views

Hi John,

We are investigating on it. Thanks.

Best regards,
Fiona

Reply