Visible to Intel only — GUID: GUID-FA4401DD-4B49-47F6-A184-D8FB748E75C2
Visible to Intel only — GUID: GUID-FA4401DD-4B49-47F6-A184-D8FB748E75C2
Convolve
Performs a finite linear convolution of two vectors.
Syntax
IppStatus ippsConvolve_32f (const Ipp32f* pSrc1, int src1Len, const Ipp32f* pSrc2, int src2Len, Ipp32f* pDst, IppEnum algType, Ipp8u* pBuffer);
IppStatus ippsConvolve_64f (const Ipp64f* pSrc1, int src1Len, const Ipp64f* pSrc2, int src2Len, Ipp64f* pDst, IppEnum algType, Ipp8u* pBuffer);
Include Files
ipps.h
Parameters
pSrc1 |
Pointer to the first source vector. |
src1Len |
Number of elements in the first source vector. |
pSrc2 |
Pointer to the second source vector. |
src2Len |
Number of elements in the second source vector. |
pDst |
Pointer to the destination vector. This vector stores the result of the convolution of the pSrc1 and pSrc2 vectors. |
algType |
Bit-field mask for the algorithm type definition. Possible values are listed in the IppAlgType enumerator. |
pBuffer |
Pointer to the buffer for internal calculations. |
Description
These functions perform the finite linear convolution of the pSrc1 and pSrc2 vectors. The src1Len elements of the pSrc1 vector are convolved with the src2Len elements of the pSrc2 vector. The result of the convolution is stored in the pDst vector with the length equal to src1Len+src2Len-1. The result vector pDst is calculated by the following equations:
where
- pSrc1[i]=0, if i ≥ src1Len
- pSrc2[j]=0, if j ≥ src2Len
Before using this function, you need to compute the size of the work buffer using the ippsConvolveGetBufferSize function.
Return Values
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when any of the specified pointers is NULL. |
ippStsSizeErr |
Indicates an error when the length of a vector is less than, or equal to zero. |
ippStsAlgTypeErr |
Indicates an error when the result of the bitwise AND operation between algType and ippAlgMask differs from the ippAlgAuto, ippAlgDirect, or ippAlgFFT values. |
Example
The code example below demonstrates how to use the ippsConvolveGetBufferSize and ippsConvolve_32f functions.
IppStatus ConvolveExample (void) { IppStatus status; const int src1Len = 5, src2Len = 2, dstLen = src1Len+src2Len-1; Ipp32f pSrc1[src1Len] = {-2.f,0.f,1.f,-1.f,3.f}, pSrc2[src2Len]={0.f,1.f}, pDst[dstLen]; IppEnum funCfg = (IppEnum)(ippAlgAuto); int bufSize = 0; Ipp8u *pBuffer; status = ippsConvolveGetBufferSize(src1Len, src2Len, ipp32f, funCfg, &bufSize); if ( status != ippStsNoErr ) return status; pBuffer = ippsMalloc_8u( bufSize ); status = ippsConvolve_32f(pSrc1, src1Len, pSrc2, src2Len, pDst, funCfg, pBuffer); printf_32f("pDst", pDst, dstLen); ippsFree( pBuffer ); return status; }
The result is as follows:
pDst -> 0.0 -2.0 0.0 1.0 -1.0 3.0