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

Div_Round

Divides the elements of two vectors with rounding.

Syntax

Case 1. Not-in-place operations on integer data.

IppStatus ippsDiv_Round_8u_Sfs(const Ipp8u* pSrc1, const Ipp8u* pSrc2, Ipp8u* pDst, int len, IppRoundMode rndMode, int scaleFactor);

IppStatus ippsDiv_Round_16u_Sfs(const Ipp16u* pSrc1, const Ipp16u* pSrc2, Ipp16u* pDst, int len, IppRoundMode rndMode, int scaleFactor);

IppStatus ippsDiv_Round_16s_Sfs(const Ipp16s* pSrc1, const Ipp16s* pSrc2, Ipp16s* pDst, int len, IppRoundMode rndMode, int scaleFactor);

Case 2. In-place operations on integer data.

IppStatus ippsDiv_Round_8u_ISfs(const Ipp8u* pSrc, Ipp8u* pSrcDst, int len, IppRoundMode rndMode, int scaleFactor);

IppStatus ippsDiv_Round_16u_ISfs(const Ipp16u* pSrc, Ipp16u* pSrcDst, int len, IppRoundMode rndMode, int scaleFactor);

IppStatus ippsDiv_Round_16s_ISfs(const Ipp16s* pSrc, Ipp16s* pSrcDst, int len, IppRoundMode rndMode, int scaleFactor);

Include Files

ipps.h

Domain Dependencies

Headers: ippcore.h, ippvm.h

Libraries: ippcore.lib, ippvm.lib

Parameters

pSrc1

Pointer to the vector whose elements are used as divisors.

pSrc2

Pointer to the vector whose elements are used as dividends.

pDst

Pointer to the destination vector.

pSrc

Pointer to the source vector whose elements are used as divisors for in-place operations.

pSrcDst

Pointer to the source and destination vector for in-place operations.

len

Number of elements in the vector.

rndMode

Rounding mode, the following values are possible:

ippRndZero - specifies that floating-point values are truncated toward zero,

ippRndNear - specifies that floating-point values are rounded to the nearest even integer when the fractional part equals 0.5; otherwise they are rounded to the nearest integer,

ippRndFinancial - specifies that floating-point values are rounded down to the nearest integer when the fractional part is less than 0.5, or rounded up to the nearest integer if the fractional part is equal or greater than 0.5.

scaleFactor

Scale factor, refer to Integer Scaling.

Description

This function divides the elements of the vector pSrc2 by the elements of the vector pSrc1, the result is rounded using the rounding method specified by the parameter roundMode and stored in the vector pDst.

The in-place flavors of ippsDiv_Round divide the elements of the vector pSrcDst by the elements of the vector pSrc, the result is rounded using the rounding method specified by the parameter roundMode and stored in the vector pSrcDst.

Functions perform scaling of the result value in accordance with the scaleFactor value. If the output value exceeds the data range, the result becomes saturated.

If the function ippsDiv_Round encounters a zero-valued divisor vector element, it returns a warning status and continues execution with the corresponding result value (see appendix A "Handling of Special Cases" for more information).

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

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

ippStsSizeErr

Indicates an error when len is less than or equal to 0.

ippStsDivByZero

Indicates a warning for zero-valued divisor vector element. The function execution is continued.

ippStsRoundModeNotSupportedErr

Indicates an error condition if the roundMode has an illegal value.