Adds pixel values of two images.
Case 1: Not-in-place operation on integer or complex data
IppStatus ippiAdd_<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:
8u_C1RSfs |
16u_C1RSfs |
16s_C1RSfs |
16sc_C1RSfs |
32sc_C1RSfs |
8u_C3RSfs |
16u_C3RSfs |
16s_C3RSfs |
16sc_C3RSfs |
32sc_C3RSfs |
8u_AC4RSfs |
16u_AC4RSfs |
16s_AC4RSfs |
16sc_AC4RSfs |
32sc_AC4RSfs |
8u_C4RSfs |
16u_C4RSfs |
16s_C4RSfs |
Case 2: Not-in-place operation on floating-point or complex data
IppStatus ippiAdd_<mod>(const Ipp<datatype>* pSrc1, int src1Step, const Ipp<datatype>* pSrc2, int src2Step, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize);
Supported values for mod:
32f_C1R |
32fc_C1R |
32f_C3R |
32fc_C3R |
32f_AC4R |
32fc_AC4R |
32f_C4R |
Case 3: In-place operation on integer or complex data
IppStatus ippiAdd_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize, int scaleFactor);
Supported values for mod:
8u_C1IRSfs |
16u_C1IRSfs |
16s_C1IRSfs |
16sc_C1IRSfs |
32sc_C1IRSfs |
8u_C3IRSfs |
16u_C3IRSfs |
16s_C3IRSfs |
16sc_C3IRSfs |
32sc_C3IRSfs |
8u_AC4IRSfs |
16u_AC4IRSfs |
16s_AC4IRSfs |
16sc_AC4IRSfs |
32sc_AC4IRSfs |
8u_C4IRsfs |
16u_C4IRSfs |
16s_C4IRSfs |
Case 4: In-place operation on floating-point or complex data
IppStatus ippiAdd_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize);
Supported values for mod:
32f_C1IR |
32fc_C1IR |
32f_C3IR |
32fc_C3IR |
32f_AC4IR |
32fc_AC4IR |
32f_C4IR |
|
Case 5: In-place operation using a floating-point accumulator image
IppStatus ippiAdd_<mod>(const Ipp<srcDatatype>* pSrc, int srcStep, Ipp32f* pSrcDst, int srcDstStep, IppiSize roiSize);
Supported values for mod:
8u32f_C1IR |
8s32f_C1IR |
16u32f_C1IR |
Case 6: Masked in-place operation using a floating-point accumulator image
IppStatus ippiAdd_<mod>(const Ipp<srcDatatype>* pSrc, int srcStep, const Ipp8u* pMask, int maskStep, Ipp32f* pSrcDst, int srcDstStep, IppiSize roiSize);
Supported values for mod:
8u32f_C1IMR |
8s32f_C1IMR |
16u32f_C1IMR |
32f_C1IMR |
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. |
pMask |
Pointer to the mask image ROI for the masked operation. |
maskStep |
Distance in bytes between starts of consecutive lines in the mask image for the masked operation. |
roiSize |
Size of the source and destination ROI in pixels. |
scaleFactor |
Scale factor (see Integer Result Scaling). |
The function ippiAdd is declared in the ippi.h file with the exception of the function flavors in Case 5 and Case 6, which are declared in the ippcv.h file. It operates with ROI (see Regions of Interest in Intel IPP).
This function adds corresponding pixel values of two source image buffers and places the results in a destination buffer. In case of operations on integer data, the resulting values are scaled by scaleFactor. For complex data, the function processes both real and imaginary parts of pixel values. Some function flavors add 8u, 8s, 16u, or 32f source image pixel values to a floating point accumulator image in-place. Addition of pixel values in case of a masked operation is performed only if the respective mask value is nonzero; otherwise, the accumulator pixel value remains unchanged.
Step values must be positive for functions that operate on complex data, and no less than roiSize.width*<pixelSize> for functions using an accumulator image.
Note that the functions with AC4 descriptor do not process alpha channels.
Example “Using the Function ippiAdd” shows how to use the function ippiAdd_8u_C1RSfs.
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 in the following cases: for functions that operate on complex data, if any of the specified step values is zero or negative; for functions using an accumulator image, if any of the specified step values is less than roiSize.width * <pixelSize>. |
ippStsNotEvenStepErr |
Indicates an error condition if one of step values for floating-point images cannot be divided by 4. |
Ipp8u src1[8*4] = {8, 4, 2, 1, 0, 0, 0, 0,
8, 4, 2, 1, 0, 0, 0, 0,
8, 4, 2, 1, 0, 0, 0, 0,
8, 4, 2, 1, 0, 0, 0, 0};
Ipp8u src2[8*4] = {4, 3, 2, 1, 0, 0, 0, 0,
4, 3, 2, 1, 0, 0, 0, 0,
4, 3, 2, 1, 0, 0, 0, 0,
4, 3, 2, 1, 0, 0, 0, 0};
Ipp8u dst[8*4];
IppiSize srcRoi = { 4, 4 };
Int scaleFactor = 1; // later examples for 2 and -2 values
ippiAdd_8u_C1RSfs (src1, 8, src2, 8, dst, 4, srcRoi, scaleFactor );
Result:
src1 src2
8 4 2 1 0 0 0 0 4 3 2 1 0 0 0 0
8 4 2 1 0 0 0 0 4 3 2 1 0 0 0 0
8 4 2 1 0 0 0 0 4 3 2 1 0 0 0 0
8 4 2 1 0 0 0 0 4 3 2 1 0 0 0 0
dst >> scaleFactor = 1 scaleFactor = 2 ScaleFactor = -2
6 4 2 1 3 2 1 0 48 28 16 8
6 4 2 1 3 2 1 0 48 28 16 8
6 4 2 1 3 2 1 0 48 28 16 8
6 4 2 1 3 2 1 0 48 28 16 8
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.