Difference in output of Intel Integrated performance primitives (IPP) fir and convolution functions

Difference in output of Intel Integrated performance primitives (IPP) fir and convolution functions

Imagen de Faheem S.

While working with Intel IPP 7.1 (composer XE 2013) I noticed difference in tail end of output samples between IPP 'fir' and 'convolution' calls. So in the calls below

status = ippsFIR_Direct_64f(pSrc, pDst_f, N+M-1, pTaps,M, pDlyLine,&pDlyLineIndex); status = ippsConv_64f(pSrc, N, pTaps, M, pDst);

with M=7, N=11 and pDlyLine initialized to all zeros, everything else being same:

pDst_f and p_Dst differ in last three indices i.e pDst_f[k]!=pDst[k] for k=14,15,16

I expected them to be exactly equal with third parameter (number of iterations)=N+M-1 in the fir call. Test file is attached. Any ideas?

Thanks in advance!

Faheem

AdjuntoTamaño
Descargar fir-test.cpp1.36 KB
publicaciones de 8 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de Sergey Kostrov

>>... Test file is attached. Any ideas?

Thank you for the test-case! I wish everybody does the same to save time for investigation...

Best regards,
Sergey

Imagen de Sergey Kostrov

Hi everybody,

I'd like to share results of my investigation. There is some issue ( actually very old! ) related to a 'numIters' parameter of 'ippsFIR_Direct_32f' or ippsFIR_Direct_64f, etc, functions.

In the 'ipps.h' header file there is a comment:
...
// numIters number of samples in the input array
...
However, in the documentation there is some additional note ( I marked it with *** ):
...
The function ippsFIR_Direct is declared in the ipps.h file. This function filters an
input array pSrc or pSrcDst containing numIters samples through a single-rate filter,
*** and stores the resulting numIters samples in pDst *** or pSrcDst, respectively...
...

Imagen de Sergey Kostrov

I've done a set of tests and here results:

// Test #0 - No Errors

Taps Position: 0

Calling IPP [ ippsConv_32f ] function
Succesful: Status = 0
Calling IPP [ ippsFIR_Direct_32f ] function
Succesful: Status = 0

Displaying Convolution and FIR results:
Index 0 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 1 [ CONV = 1.000000 FIR = 1.000000 ] DIFF = 0.000000000000000000000000
Index 2 [ CONV = 2.000000 FIR = 2.000000 ] DIFF = 0.000000000000000000000000
Index 3 [ CONV = 3.000000 FIR = 3.000000 ] DIFF = 0.000000000000000000000000
Index 4 [ CONV = 4.000000 FIR = 4.000000 ] DIFF = 0.000000000000000000000000
Index 5 [ CONV = 5.000000 FIR = 5.000000 ] DIFF = 0.000000000000000000000000
Index 6 [ CONV = 6.000000 FIR = 6.000000 ] DIFF = 0.000000000000000000000000
Index 7 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 8 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 9 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 10 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 11 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 12 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 13 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 14 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 15 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 16 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000

Comparison of Convolution and FIR results:

// Test #1 - No Errors

Taps Position: 1

Calling IPP [ ippsConv_32f ] function
Succesful: Status = 0
Calling IPP [ ippsFIR_Direct_32f ] function
Succesful: Status = 0

Displaying Convolution and FIR results:
Index 0 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 1 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 2 [ CONV = 1.000000 FIR = 1.000000 ] DIFF = 0.000000000000000000000000
Index 3 [ CONV = 2.000000 FIR = 2.000000 ] DIFF = 0.000000000000000000000000
Index 4 [ CONV = 3.000000 FIR = 3.000000 ] DIFF = 0.000000000000000000000000
Index 5 [ CONV = 4.000000 FIR = 4.000000 ] DIFF = 0.000000000000000000000000
Index 6 [ CONV = 5.000000 FIR = 5.000000 ] DIFF = 0.000000000000000000000000
Index 7 [ CONV = 6.000000 FIR = 6.000000 ] DIFF = 0.000000000000000000000000
Index 8 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 9 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 10 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 11 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 12 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 13 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 14 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 15 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 16 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000

Comparison of Convolution and FIR results:

// Test #2 - No Errors

Taps Position: 2

Calling IPP [ ippsConv_32f ] function
Succesful: Status = 0
Calling IPP [ ippsFIR_Direct_32f ] function
Succesful: Status = 0

Displaying Convolution and FIR results:
Index 0 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 1 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 2 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 3 [ CONV = 1.000000 FIR = 1.000000 ] DIFF = 0.000000000000000000000000
Index 4 [ CONV = 2.000000 FIR = 2.000000 ] DIFF = 0.000000000000000000000000
Index 5 [ CONV = 3.000000 FIR = 3.000000 ] DIFF = 0.000000000000000000000000
Index 6 [ CONV = 4.000000 FIR = 4.000000 ] DIFF = 0.000000000000000000000000
Index 7 [ CONV = 5.000000 FIR = 5.000000 ] DIFF = 0.000000000000000000000000
Index 8 [ CONV = 6.000000 FIR = 6.000000 ] DIFF = 0.000000000000000000000000
Index 9 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 10 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 11 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 12 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 13 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 14 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 15 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 16 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000

Comparison of Convolution and FIR results:

// Test #3 - No Errors

Taps Position: 3

Calling IPP [ ippsConv_32f ] function
Succesful: Status = 0
Calling IPP [ ippsFIR_Direct_32f ] function
Succesful: Status = 0

Displaying Convolution and FIR results:
Index 0 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 1 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 2 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 3 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 4 [ CONV = 1.000000 FIR = 1.000000 ] DIFF = 0.000000000000000000000000
Index 5 [ CONV = 2.000000 FIR = 2.000000 ] DIFF = 0.000000000000000000000000
Index 6 [ CONV = 3.000000 FIR = 3.000000 ] DIFF = 0.000000000000000000000000
Index 7 [ CONV = 4.000000 FIR = 4.000000 ] DIFF = 0.000000000000000000000000
Index 8 [ CONV = 5.000000 FIR = 5.000000 ] DIFF = 0.000000000000000000000000
Index 9 [ CONV = 6.000000 FIR = 6.000000 ] DIFF = 0.000000000000000000000000
Index 10 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 11 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 12 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 13 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 14 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 15 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 16 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000

Comparison of Convolution and FIR results:

...
// An so on until 'numIters' < than 11 ( M in your case )
...

// Test #9 - No Errors

Taps Position: 9

Calling IPP [ ippsConv_32f ] function
Succesful: Status = 0
Calling IPP [ ippsFIR_Direct_32f ] function
Succesful: Status = 0

Displaying Convolution and FIR results:
Index 0 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 1 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 2 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 3 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 4 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 5 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 6 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 7 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 8 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 9 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 10 [ CONV = 1.000000 FIR = 1.000000 ] DIFF = 0.000000000000000000000000
Index 11 [ CONV = 2.000000 FIR = 2.000000 ] DIFF = 0.000000000000000000000000
Index 12 [ CONV = 3.000000 FIR = 3.000000 ] DIFF = 0.000000000000000000000000
Index 13 [ CONV = 4.000000 FIR = 4.000000 ] DIFF = 0.000000000000000000000000
Index 14 [ CONV = 5.000000 FIR = 5.000000 ] DIFF = 0.000000000000000000000000
Index 15 [ CONV = 6.000000 FIR = 6.000000 ] DIFF = 0.000000000000000000000000
Index 16 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000

Comparison of Convolution and FIR results:

// Test #10 - No Errors

Taps Position: 10

Calling IPP [ ippsConv_32f ] function
Succesful: Status = 0
Calling IPP [ ippsFIR_Direct_32f ] function
Succesful: Status = 0

Displaying Convolution and FIR results:
Index 0 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 1 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 2 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 3 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 4 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 5 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 6 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 7 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 8 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 9 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 10 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 11 [ CONV = 1.000000 FIR = 1.000000 ] DIFF = 0.000000000000000000000000
Index 12 [ CONV = 2.000000 FIR = 2.000000 ] DIFF = 0.000000000000000000000000
Index 13 [ CONV = 3.000000 FIR = 3.000000 ] DIFF = 0.000000000000000000000000
Index 14 [ CONV = 4.000000 FIR = 4.000000 ] DIFF = 0.000000000000000000000000
Index 15 [ CONV = 5.000000 FIR = 5.000000 ] DIFF = 0.000000000000000000000000
Index 16 [ CONV = 6.000000 FIR = 6.000000 ] DIFF = 0.000000000000000000000000

Comparison of Convolution and FIR results:

// Test #11 - Not Calculated and Application Crashes

Taps Position: 11

Calling IPP [ ippsConv_32f ] function
Succesful: Status = 0
Calling IPP [ ippsFIR_Direct_32f ] function
Succesful: Status = 0

Displaying Convolution and FIR results:
Index 0 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 1 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 2 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 3 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 4 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 5 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 6 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 7 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 8 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 9 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 10 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 11 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 12 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 13 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 14 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 15 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000
Index 16 [ CONV = 0.000000 FIR = 0.000000 ] DIFF = 0.000000000000000000000000

Comparison of Convolution and FIR results:

Note for the Test #11: In Debug configuration a message box with an error will be displayed:

Debug Error!
...
Run-Time Check Failure: Stack around the variable 'pDstF' was corrupted
...

Imagen de Sergey Kostrov

Summary:

- There is some issue with 'numIters' ( number of samples in the input array ) parameter ( I think Intel IPP Software Engineers should explain why it works so )
- Source codes of your modified test-case attached
- I tested 'ippsConv_32f' and 'ippsFIR_Direct_32f' IPP functions only ( the Single-Precision Floating-Point type )
- Verification of results based on '!=' is commented out and a new one is based on 'If a difference between CONV-FIR values is greater than an Eplsilon'

Best regards,
Sergey

Adjuntos: 

AdjuntoTamaño
Descargar convfirtest.cpp.txt4.54 KB
Imagen de Sergey Kostrov

>>...Taps Position: nn
>>...

Regarding 'Taps Position' please look at source codes of a new test-case.

Imagen de Faheem S.

Dear Sergey

Thanks a lot for looking into the issue and confirming the problem. Your help is much appreciated. May be Intel can address the issue in next release of IPP.

Thanks again!

Regards
Faheem

Imagen de Sergey Kostrov

>>...May be Intel can address the issue in next release of IPP.

That would be nice.

I'm simply interested to get more details: Are you going to use 'ippsConv_xxf' or 'ippsFIR_Direct_xxf' in your real application?

Inicie sesión para dejar un comentario.