Multiply the elements of two vectors stored in Pack format.
Case 1: Not-in-place operation
IppStatus ippsMulPack_32f(const Ipp32f* pSrc1, const Ipp32f* pSrc2, Ipp32f* pDst, int len);
IppStatus ippsMulPack_64f(const Ipp64f* pSrc1, const Ipp64f* pSrc2, Ipp64f* pDst, int len);
IppStatus ippsMulPack_16s_Sfs(const Ipp16s* pSrc1, const Ipp16s* pSrc2, Ipp16s* pDst, int len, int scaleFactor);
Case 2: In-place operation
IppStatus ippsMulPack_32f_I(const Ipp32f* pSrc, Ipp32f* pSrcDst, int len);
IppStatus ippsMulPack_64f_I(const Ipp64f* pSrc, Ipp64f* pSrcDst, int len);
IppStatus ippsMulPack_16s_ISfs(const Ipp16s* pSrc, Ipp16s* pSrcDst, int len, int scaleFactor);
pSrc1, pSrc2 |
Pointers to the vectors whose elements are to be multiplied together. |
pDst |
Pointer to the destination vector which stores the result of the multiplication pSrc1 [n] * pSrc2[n]. |
pSrc |
Pointer to the vector whose elements are to be multiplied by the elements of pSrcDst in-place. |
pSrcDst |
Pointer to the source and destination vector (for the in-place operation). |
len |
Number of elements in the vector. |
scaleFactor |
Scale factor, refer to Integer Scaling. |
The function ippsMulPack is declared in the ipps.h file. This function multiplies the elements of the vector pSrc1 by the elements of the vector pSrc2, and stores the result in pDst.
The in-place flavors ippsMulPack multiply the elements of the vector pSrc by the elements of the vector pSrcDst, and store the result in pSrcDst.
The functions multiply the packed data according to their packed format. The data in Pack packed format include several real values, the rest are complex. Thus, the function performs several real multiplication operations on real elements and complex multiplication operations on complex data. Such kind of packed data multiplication is usually used for signals filtering with the FFT transform when the element-wise multiplication is performed in the frequency domain.
For the functions with the Sfs suffixes scaling is performed in accordance with the scaleFactor value. When the output value exceeds the data range, the result may become saturated.
Example below shows how to use the function ippsMulPack_32f_I.
ippStsNoErr |
Indicates no error |
ippStsNullPtrErr |
Indicates an error when the pSrcDst, pDst, pSrc1, pSrc2, or pSrc pointer is NULL. |
ippStsSizeErr |
Indicates an error when len is less than or equal to 0. |
void mulpack( void ) {
Ipp32f x[8], X[8], h[8]={1.0f/3,1.0f/3,1.0f/3,0,0,0,0,0}, H[8];
IppStatus st;
IppsFFTSpec_R_32f* spec;
st = ippsFFTInitAlloc_R_32f(&spec, 3, IPP_FFT_DIV_INV_BY_N, ippAlgHintNone);
ippsSet_32f( 3, x, 8 );
x[3] = 5;
st = ippsFFTFwd_RToPack_32f( x, X, spec, NULL );
st = ippsFFTFwd_RToPack_32f( h, H, spec, NULL );
ippsMulPack_32f_I( H, X, 8 );
st = ippsFFTInv_PackToR_32f( X, x, spec, NULL );
printf_32f("filtered =", x, 8, st );
ippsFFTFree_R_32f( spec );
}
Output: filtered = 3.0 3.0 3.0 3.666667 3.666667 3.666667 3.0 3.0
Matlab* analog: >> x=3*ones(1,8); x(4)=5;h=zeros(1,8); h(1:3)=1/3; real(ifft(fft(x).*fft(h)))
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.