Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

AddWeighted

Adds weighted pixel values of a source image to floating-point pixel values of an accumulator image.

Syntax

Case 1: In-place operation

IppStatus ippiAddWeighted_<mod>(const Ipp<srcDatatype>* pSrc, int srcStep, Ipp32f* pSrcDst, int srcDstStep, IppiSize roiSize, Ipp32f alpha);

Supported values for mod:

8u32f_C1IR

16u32f_C1IR

32f_C1IR

Case 2: Masked in-place operation

IppStatus ippiAddWeighted_<mod>(const Ipp<srcDatatype>* pSrc, int srcStep, const Ipp8u* pMask, int maskStep, Ipp32f* pSrcDst, int srcDstStep, IppiSize roiSize, Ipp32f alpha);

Supported values for mod:

8u32f_C1IMR

16u32f_C1IMR

32f_C1IMR

Case 3: Not-in-place operation

IppStatus ippiAddWeighted_32f_C1R(const Ipp32f* pSrc1, int src1Step, const Ipp32f* pSrc2, int src2Step, Ipp32f* pDst, int dstStep, IppiSize roiSize, Ipp32f alpha);

Include Files

ippcv.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h, ippi.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib, ippi.lib

Parameters

pSrc

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

pSrc1, pSrc2

Pointers to the ROI in the source images.

srcStep

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

src1Step, src2Step

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

pMask

Pointer to the mask image.

maskStep

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

pSrcDst

Pointer to the destination (accumulator) image ROI for the in-place operation.

srcDstStep

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

pDst

Pointer to the destination image ROI.

dstStep

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

roiSize

Size of the image ROI in pixels.

alpha

Weight a of the source image.

Description

This function operates with ROI (see Regions of Interest in Intel IPP).

This function adds pixel values of the source image pSrc1 multiplied by a weight factor alpha to pixel values of the image pSrc2 multiplied by (1-alpha) and stores result in the pDst as follows:

pDst(x,y) = pSrc1(x,y)* alpha + pSrc2(x,y)*(1- alpha).

The in-place flavors of the function adds pixel values of the source image pSrc multiplied by a weight factor alpha to floating-point pixel values of the accumulator image pSrcDst multiplied by (1-alpha) as follows:

pSrcDst(x,y) = pSrcDst(x,y)* (1-alpha) + pSrc(x,y)*alpha

Addition of the weighted 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.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when any of the specified pointers is NULL.

ippStsSizeErr

Indicates an error when roiSize.width or roiSize.height is equal to 0 or negative.

ippStsStepErr

Indicates an error when one of the step values is equal to zero, or is less than roiSize.width * <pixelSize>.

ippStsNotEvenStepErr

Indicates an error when one of step values for floating-point images cannot be divided by 4.