Intel® Integrated Performance Primitives Developer Guide and Reference

ID 790148
Date 11/07/2023
Public

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

Document Table of Contents

Set

Sets pixels of an array to a constant value.

Syntax

Case 1: Setting one-channel data to a value

IppStatus ippiSet_<mod>(Ipp<datatype> value, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize);

Supported values for mod:

8u_C1R 16u_C1R 16s_C1R 32s_C1R 32f_C1R

Case 2: Setting each color channel to a specified value

IppStatus ippiSet_<mod>(const Ipp<datatype> value[3], Ipp<datatype>* pDst, int dstStep, IppiSize roiSize);

Supported values for mod:

8u_C3R 16u_C3R 16s_C3R 32s_C3R 32f_C3R
8u_AC4R 16u_AC4R 16s_AC4R 32s_AC4R 32f_AC4R

Case 3: Setting color channels and alpha channel to specified values

IppStatus ippiSet_<mod>(const Ipp<datatype> value[4], Ipp<datatype>* pDst, int dstStep, IppiSize roiSize);

Supported values for mod:

8u_C4R 16u_C4R 16s_C4R 32s_C4R 32f_C4R

Case 4: Setting masked one-channel data to a value

IppStatus ippiSet_<mod>(Ipp<datatype> value, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, const Ipp8u* pMask, int maskStep);

Supported values for mod:

8u_C1MR 16u_C1MR 16s_C1MR 32s_C1MR 32f_C1MR

Case 5: Setting color channels of masked multi-channel data to specified values

IppStatus ippiSet_<mod>(const Ipp<datatype> value[3], Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, const Ipp8u* pMask, int maskStep);

Supported values for mod:

8u_C3MR 16u_C3MR 16s_C3MR 32s_C3MR 32f_C3MR
8u_AC4MR 16u_AC4MR 16s_AC4MR 32s_AC4MR 32f_AC4MR

Case 6: Setting all channels of masked multi-channel data to specified values

IppStatus ippiSet_<mod>(const Ipp<datatype> value[4], Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, const Ipp8u* pMask, int maskStep);

Supported values for mod:

8u_C4MR 16u_C4MR 16s_C4MR 32s_C4MR 32f_C4MR

Case 7: Setting selected channel of multi-channel data to a value

IppStatus ippiSet_<mod>(Ipp<datatype> value, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize);

Supported values for mod:

8u_C3CR 16u_C3CR 16s_C3CR 32s_C3CR 32f_C3CR
8u_C4CR 16u_C4CR 16s_C4CR 32s_C4CR 32f_C4CR

Include Files

ippi.h

Domain Dependencies

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

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

Parameters

value

Constant value to assign to each pixel in the destination image ROI.

pDst

Pointer to the destination image ROI.

dstStep

Distance, in bytes, between the starting points of consecutive lines in the destination image.

roiSize

Size of the image ROI in pixels.

pMask

Pointer to the mask image buffer.

maskStep

Distance, in bytes, between the starting points of consecutive lines in the mask image buffer.

Description

This function operates with ROI.

This function sets pixels in the destination image ROI pDst to the value constant. Either all pixels in a rectangular ROI, or only those selected by the specified mask pMask, can be set to a value. In case of masked operation, the function sets pixel values in the destination buffer only if the spatially corresponding mask array value is non-zero. When a channel of interest is selected, that is only one channel of a multi-channel image must be set (see Case 7), the pDst pointer points to the start of ROI buffer in the required channel. If alpha channel is present in the source image data, the alpha components may be either skipped, or set to a value, depending on the chosen ippiSet function flavor.

This function supports negative step value.

Return Values

ippStsNoErr

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

ippStsNullPtrErr

Indicates an error when 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 dstStep or maskStep has a zero value.

Example

The code example below shows how to use the function ippiSet_8u_C1R.

void func_set()
{    
    IppiSize roi = {5,4};
    Ipp8u x[8*4] = {0};
		
    ippiSet_8u_C1R(1, x, 8, roi);
}

Result:

01 01 01 01 01 00 00 00
01 01 01 01 01 00 00 00
01 01 01 01 01 00 00 00
01 01 01 01 01 00 00 00