Estimates the cross-correlation of two vectors.
IppStatus ippsCrossCorr_32f(const Ipp32f* pSrc1, int src1Len, const Ipp32f* pSrc2, int src2Len, Ipp32f* pDst, int dstLen, int lowLag);
IppStatus ippsCrossCorr_64f(const Ipp64f* pSrc1, int src1Len, const Ipp64f* pSrc2, int src2Len, Ipp64f* pDst, int dstLen, int lowLag);
IppStatus ippsCrossCorr_32fc(const Ipp32fc* pSrc1, int src1Len, const Ipp32fc* pSrc2, int src2Len, Ipp32fc* pDst, int dstLen, int lowLag);
IppStatus ippsCrossCorr_64fc(const Ipp64fc* pSrc1, int src1Len, const Ipp64fc* pSrc2, int src2Len, Ipp64fc* pDst, int dstLen, int lowLag);
IppStatus ippsCrossCorr_16s_Sfs(const Ipp16s* pSrc1, int src1Len, const Ipp16s* pSrc2, int src2Len, Ipp16s* pDst, int dstLen, int lowLag, int scaleFactor);
IppStatus ippsCrossCorr_16s64s(const Ipp16s* pSrc1, int src1Len, const Ipp16s* pSrc2, int src2Len, Ipp64s* pDst, int dstLen, int lowLag);
pSrc1 |
Pointer to the first source vector. |
src1Len |
Number of elements in the vector pSrc1. |
pSrc2 |
Pointer to the second source vector. |
src2Len |
Number of elements in the vector pSrc2. |
pDst |
Pointer to the vector which stores the results of the estimated cross-correlation of the vectors pSrc1 and pSrc2. |
dstLen |
Number of elements in the vector pDst, which determines the range of lags at which the correlation estimates are computed. |
lowLag |
Lower value of the range of lags at which the correlation estimates are computed. |
scaleFactor |
Scale factor, refer to Integer Scaling. |
The function ippsCrossCorr is declared in the ipps.h file. This function estimates cross-correlation of the src1Len elements of the vector pSrc1 and the src2Len elements of the vector pSrc2, and stores the results in the vector pDst. The resulting vector pDst is defined by the equation:
,
where 0 ≤ n < dstLen, and
The example below shows how to use the function ippsCrossCorr.
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when the pSrc1 or pSrc2 pointer is NULL. |
ippStsSizeErr |
Indicates an error when src1Len or src2Len is less than or equal to 0. |
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)
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.