MulPack

Multiplies two source images in packed format.

Syntax

Case 1: Not-in-place operation on integer data

IppStatus ippiMulPack_<mod>(const Ipp<datatype>* pSrc1, int src1Step, const Ipp<datatype>* pSrc2, int src2Step, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, int scaleFactor);

Supported values for mod:

16s_C1RSfs

32s_C1RSfs

16s_C3RSfs

32s_C3RSfs

16s_C4RSfs

32s_C4RSfs

16s_AC4RSfs

32s_AC4RSfs

Case 2: Not-in-place operation on floating-point data

IppStatus ippiMulPack_<mod>(const Ipp32f* pSrc1, int src1Step, const Ipp32f* pSrc2, int src2Step, Ipp32f* pDst, int dstStep, IppiSize roiSize);

Supported values for mod:

32f_C1R

32f_C3R

32f_C4R

32f_AC4R

Case 3: In-place operation on integer data

IppStatus ippiMulPack_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pSrcDst, int dstSrcStep, IppiSize roiSize, int scaleFactor);

Supported values for mod:

16s_C1IRSfs

32s_C1IRSfs

16s_C3IRSfs

32s_C3IRSfs

16s_C4IRSfs

32s_C4IRSfs

16s_AC4IRSfs

32s_AC4IRSfs

Case 4: In-place operation on floating-point data

IppStatus ippiMulPack_<mod>(const Ipp32f* pSrc, int srcStep, Ipp32f* pSrcDst, int dstSrcStep, IppiSize roiSize);

Supported values for mod:

32f_C1IR

32f_C3IR

32f_C4IR

32f_AC4IR

Parameters

pSrc1, pSrc2

Pointer to the ROI in the source images.

src1Step, src2Step

Distance in bytes between starts of consecutive lines in the source images.

pDst

Pointer to the destination image ROI.

dstStep

Distance in bytes between starts of consecutive lines in the destination image.

pSrc

Pointer to the first source image ROI for the in-place operation.

srcStep

Distance in bytes between starts of consecutive lines in the first source image for the in-place operation.

pSrcDst

Pointer to the second source and destination image ROI for the in-place operation.

srcDstStep

Distance in bytes between starts of consecutive lines in the source and destination image for the in-place operation.

roiSize

Size of the source and destination ROI in pixels.

scaleFactor

Scale factor (see Integer Result Scaling).

Description

The function ippiMulPack is declared in the ippi.h file. It operates with ROI (see Regions of Interest in Intel IPP).

This function multiplies corresponding pixel values of two source images, A and B represented in RCPack2D format and stores the result into the destination image C in packed format also. The multiplying is performed according to the following formulas:

ReC = ReA*ReB - ImA*ImB;

ImC = ImA*ReB + ImB*ReA.

Not-in-place flavors multiply pixel values of ROI in the source images pSrc1 and pSrc2, and store result in the pDst.

In-place flavors multiply pixel values of ROI in the source images pSrc and pSrcDst, and store result in the pSrcDst.

In case of operations on integer data, the resulting values are scaled by scaleFactor (see Integer Result Scaling). Note that the functions with AC4 descriptor do not process the alpha channel.

This function can be used in image filtering operations that include FFT transforms. The Example “Using ippiMulPack Function in Image Filtering” illustrates how the horizontal edges of an image can be detected. First, both the source image and the filter are transformed into the frequency domain by applying the forward FFT function which yields results in packed format. Then, actual filtering is performed through multiplying these packed data on a point by point basis using the function ippiMulPack. Finally, filtered data is transformed to the time domain by means of the inverse FFT function.

Using ippiMulPack Function in Image Filtering

IppStatus mulpack( void ) {
   Ipp32f tsrc[64], tflt[64], tdst[64];
   Ipp32f fsrc[64], fflt[64], fdst[64];
   IppiFFTSpec_R_32f *spec;
   const IppiSize roiSize8x8 = { 8, 8 }, roiSize3x3 = { 3, 3 };
   const Ipp32f filter[3*3] = {-1,-1,-1, 0,0,0, 1,1,1};
   ippiSet_32f_C1R( 0, tsrc, 8*sizeof(Ipp32f), roiSize8x8 );
   ippiAddC_32f_C1IR( 1, tsrc+8+1, 8*sizeof(Ipp32f), roiSize3x3 );
   ippiSet_32f_C1R( 0, tflt, 8*sizeof(Ipp32f), roiSize8x8 );
   ippiCopy_32f_C1R( filter, 3*sizeof(Ipp32f), tflt, 8*sizeof(Ipp32f), roiSize3x3 );
   ippiFFTInitAlloc_R_32f( &spec, 3, 3, IPP_FFT_DIV_INV_BY_N, ippAlgHintAccurate );
   ippiFFTFwd_RToPack_32f_C1R( tsrc, 8*sizeof(Ipp32f), fsrc, 8*sizeof(Ipp32f), spec, 0 );
   ippiFFTFwd_RToPack_32f_C1R( tflt, 8*sizeof(Ipp32f), fflt, 8*sizeof(Ipp32f), spec, 0 );
   ippiMulPack_32f_C1R( fsrc, 8*sizeof(Ipp32f), fflt, 8*sizeof(Ipp32f), fdst, 8*4, roiSize8x8);
   ippiFFTInv_PackToR_32f_C1R( fdst, 8*sizeof(Ipp32f), tdst, 8*sizeof(Ipp32f), spec, 0 );
   ippiFFTFree_R_32f( spec );
   return 0;
}
 

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error or a warning.

ippStsNullPtrErr

Indicates an error condition if any of the specified pointers is NULL.

ippStsSizeErr

Indicates an error condition if roiSize has a field with zero or negative value.

ippStsStepErr

Indicates an error condition if any of the specified buffer step values is zero or negative.

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.