Community
cancel
Showing results for 
Search instead for 
Did you mean: 
pechiinu
Beginner
26 Views

Bug with IIR filter functions?

Hello.

Please forgive my English.

I am using ippsIIR_32f for filtering audio stream, and have a trouble with this function. When I pass the non-zero samplesto pSrc, the function works well. but when I pass zero samples, the processing becomes delayed.

Why? and How can I avoid this undesirable phenomenon?
0 Kudos
2 Replies
Chao_Y_Intel
Employee
26 Views


HI,

Do you have any code that can show this problem? That will be helpful.

Thanks,
Chao

pechiinu
Beginner
26 Views

Thank you for your reply, and please excuse me for being late to answer.

I'llgive a samplecode follow:

---
int iir(void)
{
int ret = 1;
int const input_length = 48000 * 24;
int const filter_length = FILTER_COEFFICIENTS_LENGTH;

Ipp32f *input = NULL;
Ipp32f *filter = NULL;
Ipp32f *output = NULL;

//
// zero-padding to input sequence except for the first sample
//
input = ippsMalloc_32f(input_length);
if (input==0) { goto error; }
for (size_t i=1; iinput = 0;
}
input[0] = 1;

//
// set filter coefficients
//
filter = ippsMalloc_32f(filter_length);
if (filter==0) { goto error; }
for (size_t i=0; ifilter = FilterCoefficients;
}

output = ippsMalloc_32f(input_length);
if (output==0) { goto error; }

{
IppsIIRState_32f *ctx;
DWORD start;
DWORD end;
DWORD elapsed;
IppStatus status;
status = ippsIIRInitAlloc_32f(&ctx, filter, (int)(filter_length/2-1), 0);
if (status != ippStsNoErr) {
printf("IIRInitAlloc failure.n");
goto error;
}

//
// start measuring
//
start = GetTickCount();
status = ippsIIR_32f(input, output, (int)input_length, ctx);

//
// stop measuring
//
end = GetTickCount();

elapsed = (end-start);
printf("input : time(ms)=%ld status=%dn"
, elapsed, status);

ippsIIRFree_32f(ctx);
}

ret = 0;
error:
if (input) { ippsFree(input); }
if (filter) { ippsFree(filter); }
if (output) { ippsFree(output); }

return ret;
}
---

Thank you.