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

ID 790148
Date 3/22/2024
Public
Document Table of Contents

MulCScale

Multiplies pixel values of an image by a constant and scales the products.

Syntax

Case 1: Not-in-place operation on one-channel data

IppStatus ippiMulCScale_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype> value, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize);

Supported values for mod:

8u_C1R

16u_C1R

Case 2: Not-in-place operation on multi-channel data

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

Supported values for mod:

8u_C3R

16u_C3R

8u_AC4R

16u_AC4R

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

Supported values for mod:

8u_C4R

16u_C4R

Case 3: In-place operation on one-channel data

IppStatus ippiMulCScale_<mod>(Ipp<datatype> value, Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize);

Supported values for mod:

8u_C1IR

16u_C1IR

Case 4: In-place operation on multi-channel data

IppStatus ippiMulCScale_<mod>(const Ipp<datatype> value[3], const Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize);

Supported values for mod:

8u_C3IR

16u_C3IR

8u_AC4IR

16u_AC4IR

IppStatus ippiMulCScale_<mod>(const Ipp<datatype> value[4], Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize);

Supported values for mod:

8u_C4IR

16u_C4IR

Include Files

ippi.h

Domain Dependencies

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

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

Parameters

pSrc

Pointer to the source image ROI.

srcStep

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

value

The constant value to multiply each pixel value in a source image (constant vector in case of 3- or four-channel images).

pDst

Pointer to the destination image ROI.

dstStep

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

pSrcDst

Pointer to the 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.

Description

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

This function multiplies pixel values in the input buffer by a constant value and scales the products using the following formula:

dst_pixel = src_pixel * value / max_val,

where src_pixel is a pixel values of the source buffer, dst_pixel is the resultant pixel value, and max_val is the maximum value of the pixel data range (see Table “Image Data Types and Ranges” for details).

The function is implemented for 8-bit and 16-bit unsigned data types only. It can be used to multiply pixel values by a number between 0 and 1.

Note that the functions with AC4 descriptor do not process alpha channelss.

Return Values

ippStsNoErr

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

ippStsNullPtrErr

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

ippStsSizeErr

Indicates an error condition if the 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.

Example

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

void func_mulcscale()
{    
    IppiSize ROI = {8,4};
    IppiSize ROI2 = {5,4};
    Ipp8u src[8*4];
    Ipp8u dst[8*4];
    Ipp8u v = 100;

    ippiSet_8u_C1R(100,src,8,ROI);
    ippiSet_8u_C1R(0,dst,8,ROI);
    ippiMulCScale_8u_C1R(src,8,v,dst,8,ROI2);
}

Result:

            src1                                 dst
100 100 100 100 100 100 100 100         39 39 39 39 39 0 0 0
100 100 100 100 100 100 100 100         39 39 39 39 39 0 0 0
100 100 100 100 100 100 100 100         39 39 39 39 39 0 0 0
100 100 100 100 100 100 100 100         39 39 39 39 39 0 0 0