Developer Reference

  • 2020
  • 07/15/2020
  • Public Content
Contents

Add

Adds pixel values of two images.

Syntax

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
8u_C3RSfs
16u_C3RSfs
16s_C3RSfs
8u_C4RSfs
16u_C4RSfs
16s_C4RSfs
8u_AC4RSfs
16u_AC4RSfs
16s_AC4RSfs
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
32f_C3R
32f_C4R
IppStatus ippiAdd_32f_AC4R
(
const Ipp32f*
pSrc1
,
int
src1Step
,
const Ipp32f*
pSrc2
,
int
src2Step
,
Ipp32f*
pDst
,
int
dstStep
,
IppiSize
roiSize
);
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
8u_C3IRSfs
16u_C3IRSfs
16s_C3IRSfs
8u_AC4IRSfs
16u_AC4IRSfs
16s_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
32f_C3IR
32f_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
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
16u32f_C1IMR
32f_C1IMR
Case 7: Not-in-place operation on integer data with platform-aware functions
IppStatus ippiAdd_<mod>
(
const Ipp<datatype>*
pSrc1
,
IppSizeL
src1Step
,
const Ipp<datatype>*
pSrc2
,
IppSizeL
src2Step
,
Ipp<datatype>*
pDst
,
IppSizeL
dstStep
,
IppiSizeL
roiSize
,
int
scaleFactor
);
Supported values for
mod
:
8u_C1RSfs_L
16u_C1RSfs_L
16s_C1RSfs_L
8u_C3RSfs_L
16u_C3RSfs_L
16s_C3RSfs_L
8u_C4RSfs_L
16u_C4RSfs_L
16s_C4RSfs_L
8u_AC4RSfs_L
16u_AC4RSfs_L
16s_AC4RSfs_L
Case 8: Not-in-place operation on floating point data with platform-aware functions
IppStatus ippiAdd_<mod>
(
const Ipp<datatype>*
pSrc1
,
IppSizeL
src1Step
,
const Ipp<datatype>*
pSrc2
,
IppSizeL
src2Step
,
Ipp<datatype>*
pDst
,
IppSizeL
dstStep
,
IppiSizeL
roiSize
);
Supported values for
mod
:
32f_C1R_L
32f_C3R_L
32f_C4R_L
32f_AC4R_L
Case 9: In-place operation on integer data with platform-aware functions
IppStatus ippiAdd_<mod>
(
const Ipp<datatype>*
pSrc
,
IppSizeL
srcStep
,
Ipp<datatype>*
pSrcDst
,
IppSizeL
srcDstStep
,
IppiSizeL
roiSize
,
int
scaleFactor
);
Supported values for
mod
:
8u_C1IRSfs_L
16u_C1IRSfs_L
16s_C1IRSfs_L
8u_C3IRSfs_L
16u_C3IRSfs_L
16s_C3IRSfs_L
8u_C4IRSfs_L
16u_C4IRSfs_L
16s_C4IRSfs_L
8u_AC4IRSfs_L
16u_AC4IRSfs_L
16s_AC4IRSfs_L
Case 10: In-place operation on floating point data with platform-aware functions
IppStatus ippiAdd_<mod>
(
const Ipp<datatype>*
pSrc1
,
IppSizeL
src1Step
,
Ipp<datatype>*
pDst
,
IppSizeL
dstStep
,
IppiSizeL
roiSize
);
Supported values for
mod
:
32f_C1IR_L
32f_C3IR_L
32f_C4IR_L
32f_AC4IR_L
Case 11: Not-in-place operation on integer data with threading layer (TL) functions
IppStatus ippiAdd_<mod>
(
const Ipp<datatype>*
pSrc1
,
IppSizeL
src1Step
,
const Ipp<datatype>*
pSrc2
,
IppSizeL
src2Step
,
Ipp<datatype>*
pDst
,
IppSizeL
dstStep
,
IppiSizeL
roiSize
,
int
scaleFactor
);
Supported values for
mod
:
8u_C1RSfs_LT
16u_C1RSfs_LT
16s_C1RSfs_LT
8u_C3RSfs_LT
16u_C3RSfs_LT
16s_C3RSfs_LT
8u_C4RSfs_LT
16u_C4RSfs_LT
16s_C4RSfs_LT
8u_AC4RSfs_LT
16u_AC4RSfs_LT
16s_AC4RSfs_LT
Case 12: Not-in-place operation on floating point data with TL functions
IppStatus ippiAdd_<mod>
(
const Ipp<datatype>*
pSrc1
,
IppSizeL
src1Step
,
const Ipp<datatype>*
pSrc2
,
IppSizeL
src2Step
,
Ipp<datatype>*
pDst
,
IppSizeL
dstStep
,
IppiSizeL
roiSize
);
Supported values for
mod
:
32f_C1R_LT
32f_C3R_LT
32f_C4R_LT
32f_AC4R_LT
Case 13: In-place operation on integer data with TL functions
IppStatus ippiAdd_<mod>
(
const Ipp<datatype>*
pSrc
,
IppSizeL
srcStep
,
Ipp<datatype>*
pSrcDst
,
IppSizeL
srcDstStep
,
IppiSizeL
roiSize
,
int
scaleFactor
);
Supported values for
mod
:
8u_C1IRSfs_LT
16u_C1IRSfs_LT
16s_C1IRSfs_LT
8u_C3IRSfs_LT
16u_C3IRSfs_LT
16s_C3IRSfs_LT
8u_C4IRSfs_LT
16u_C4IRSfs_LT
16s_C4IRSfs_LT
8u_AC4IRSfs_LT
16u_AC4IRSfs_LT
16s_AC4IRSfs_LT
Case 14: In-place operation on floating point data with TL functions
IppStatus ippiAdd_<mod>
(
const Ipp<datatype>*
pSrc1
,
IppSizeL
src1Step
,
Ipp<datatype>*
pDst
,
IppSizeL
dstStep
,
IppiSizeL
roiSize
);
Supported values for
mod
:
32f_C1IR_LT
32f_C3IR_LT
32f_C4IR_LT
32f_AC4IR_LT
Case 15: In-place operation on integer data with TL functions based on classic API
IppStatus ippiAdd_<mod>
(
const Ipp<datatype>*
pSrc
,
IppSize
srcStep
,
Ipp<datatype>*
pSrcDst
,
IppSize
srcDstStep
,
IppiSize
roiSize
,
int
scaleFactor
);
Supported values for
mod
:
16s_C1IRSfs_T
32s_C1IRSfs_T
16s_C3IRSfs_T
16s_C4IRSfs_T
Include Files
ippcv.h
ippi.h
ippi_l.h
ippi_tl.h
Domain Dependencies
Flavors declared in
ippi.h
:
Headers:
ippcore.h
,
ippvm.h
,
ipps.h
Libraries:
ippcore.lib
,
ippvm.lib
,
ipps.lib
Flavors declared in
ippcv.h
:
Headers:
ippcore.h
,
ippvm.h
,
ipps.h
,
ippi.h
Libraries:
ippcore.lib
,
ippvm.lib
,
ipps.lib
,
ippi.lib
Flavors declared in
ippi64x.h
:
Libraries:
ippcore.lib
,
ippvm.lib
,
ipps.lib
,
ippi.lib
,
ippcore_tl.lib
,
ippi_tl.lib
Parameters
pSrc
,
pSrc1
,
pSrc2
Pointer to the ROI in the source images.
srcStep
,
src1Step
,
src2Step
Distance, in bytes, between the starting points of consecutive lines in the source images.
pDst
Pointer to the destination image ROI.
dstStep
Distance, in bytes, between the starting points 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 the starting points 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 the starting points 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 the starting points 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).
Description
This function operates with ROI.
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 non-zero; otherwise, the accumulator pixel value remains unchanged.
For the functions that operate on complex data, step values must be positive. For the functions that use an accumulator image, step values must be no less than
roiSize.width*<pixelSize>
.
Functions with
AC4
descriptor do not process alpha channels.
Function flavors described in Case 5 and Case 6 are declared in the
ippcv.h
.
Return Values
ippStsNoErr
Indicates no error. Any other value indicates an error or a warning.
ippStsNullPtrErr
Indicates an error condition when any of the specified pointers is
NULL
.
ippStsSizeErr
Indicates an error condition when
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 when one of step values for floating-point images cannot be divided by 4.

Example

The code example below shows how to use the function
ippiAdd_8u_C1RSfs
.
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

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804