Community
cancel
Showing results for 
Search instead for 
Did you mean: 
jenni80
Beginner
63 Views

Problem with ippsCrossCorr

Hi,

I'm using the trial version of the Ipps libraries and i have difficulties with the result of the function IppsCrossCorr_32f()

in the FAQ sheet the Usage is explained as follows :

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

void crossCorr(void) {
#undef LEN
#define LEN 11
Ipp32f win[LEN], y[LEN];
IppStatus st;
ippsSet_32f (1, win, LEN);
ippsWinHamming_32f_I (win, LEN);
st = ippsCrossCorr_32f (win, LEN, win, LEN, y, LEN, -(LEN-1));
printf_32f(cross corr =, y,7,st);
}
Output:
cross corr = 0.006400 0.026856 0.091831 0.242704 0.533230
1.009000 1.672774
Matlab* analog:
>> x = hamming(11)'; y = xcorr(x,x); y(1:7)

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

so i wrote a code (snippet) as follows:

const int SIZE = 100;

Ipp32f *temp = new Ipp32f[SIZE];

// Then i load some data from disc to "temp"
Ipp32f *temp1 = new Ipp32f[SIZE];
Ipp32f *temp2 = new Ipp32f[1];

IppStatus st;
ippsWinHamming_32f(temp,temp1,SIZE); // I don't want to manipulate my original signal
st = ippsCrossCorr_32f(temp1,30,temp1+40,30,temp2,1,30);

// i just want one cross correlation on a certain part of the same signal
cout << temp2[0] << "-" << st <

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

But the output of temp2[0] is always -0.00132704 no matter what data i load into temp. the value of "st" is -6 which tells me just nothing, but maybe you.

In my real code i use the cross_corr() function on one signal more than once, going step by step over a very long signal seqence checking every time a small part of the signal to find a maximum value. So the real code is a bit more complex than this .. but i checked many parts of my code. The input signal changes every loop , i used different sources for the temp array. No matter what i do the output is always -0.00132704.

I suppose the fault is made by me but i don't know where i did something wrong, so please can you give me some advice ?

Thanks in advance ...

0 Kudos
2 Replies
Vladimir_Dudnik
Employee
63 Views

Hello,
there is special function in IPP (ippGetStatusString) which translate IppStatus value to textual string (of course you can do the same just looking at ippdefs.h file forenumerator value.
I would recommend youto look at function description in IPP manual, it might help to understand function behavior.
Regards,
Vladimir

jenni80
Beginner
63 Views

Quoting - vdudnik
Hello,
there is special function in IPP (ippGetStatusString) which translate IppStatus value to textual string (of course you can do the same just looking at ippdefs.h file forenumerator value.
I would recommend youto look at function description in IPP manual, it might help to understand function behavior.
Regards,
Vladimir

Hi.

thanks that did it, i had forgotten some brackets and the function got some wrong parameters. Now it doeas what is says .. :-)