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

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

NormDiff_L1

Computes the L1- norm of differences between pixel values of two images.

Syntax

Case 1: Operation on one-channel integer data

IppStatus ippiNormDiff_L1_<mod>(const Ipp<datatype>* pSrc1, int src1Step, const Ipp<datatype>* pSrc2, int src2Step, IppiSize roiSize, Ipp64f* pValue);

Supported values for mod:

8u_C1R

16u_C1R

16s_C1R

Case 2: Operation on one-channel floating-point data

IppStatus ippiNormDiff_L1_32f_C1R(const Ipp32f* pSrc1, int src1Step, const Ipp32f* pSrc2, int src2Step, IppiSize roiSize, Ipp64f* pValue, IppHintAlgorithm hint);

Case 3: Masked operation on one-channel data

IppStatus ippiNormDiff_L1_<mod>(const Ipp<datatype>* pSrc1, int src1Step, const Ipp<datatype>* pSrc2, int src2Step, const Ipp8u* pMask, int maskStep, IppiSize roiSize, Ipp64f* pNorm);

Supported values for mod:

8u_C1MR

16u_C1MR

32f_C1MR

Case 4: Operation on multi-channel integer data

IppStatus ippiNormDiff_L1_<mod>(const Ipp<datatype>* pSrc1, int src1Step, const Ipp<datatype>* pSrc2, int src2Step, IppiSize roiSize, Ipp64f value[3]);

Supported values for mod:

8u_C3R

16u_C3R

16s_C3R

IppStatus ippiNormDiff_L1_<mod>(const Ipp<datatype>* pSrc1, int src1Step, const Ipp<datatype>* pSrc2, int src2Step, IppiSize roiSize, Ipp64f value[4]);

Supported values for mod:

8u_C4R

16u_C4R

16s_C4R

Case 5: Operation on multi-channel floating-point data

IppStatus ippiNormDiff_L1_32f_C3R(const Ipp32f* pSrc1, int src1Step, const Ipp32f* pSrc2, int src2Step, IppiSize roiSize, Ipp64f value[3], IppHintAlgorithm hint);

IppStatus ippiNormDiff_L1_32f_C4R(const Ipp32f* pSrc1, int src1Step, const Ipp32f* pSrc2, int src2Step, IppiSize roiSize, Ipp64f value[4], IppHintAlgorithm hint);

Case 6: Masked operation on multi-channel data

IppStatus ippiNormDiff_L1_<mod>(const Ipp<datatype>* pSrc1, int src1Step, const Ipp32f* pSrc2, int src2Step, const Ipp8u* pMask, int maskStep, IppiSize roiSize, int coi, Ipp64f* pNorm);

Supported values for mod:

8u_C3CMR

16u_C3CMR

32f_C3CMR

Include Files

ippcv.h

ippi.h

Domain Dependencies

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 ippi.h:

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

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

Parameters

pSrc1, pSrc2

Pointers to the source images ROI.

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.

roiSize

Size of the source ROI in pixels.

coi

Channel of interest (for color images only); can be 1, 2, or 3.

pValue

Pointer to the computed L1- norm of difference between pixel values.

value

An array containing the computed L1- norms of difference between channel values in case of multi-channel data.

pNorm

Pointer to the computed norm value in the mask mode.

hint

Option to select the algorithmic implementation of the function.

Description

The flavors of the function ippiNormDiff_L1 that perform masked operation are declared in the ippcv.h file. All other function flavors are declared in the ippi.h file. The function operates with ROI (see Regions of Interest in Intel IPP). It computes the L1-norm pValue (pNorm in the mask mode) of differences between pixel values of the two source image buffers pSrc1 and pSrc2. This norm is defined as the sum of absolute values of differences:

norm = Σ |pSrc1-pSrc2|

Computation algorithm is specified by the hint argument (see Table “Hint Arguments for Image Moment Functions”). In the mask mode, the computation is done over pixels selected by nonzero mask values.

For non-masked operations on multi-channel images (Case 4,5), the norm is computed separately for each pair of the corresponding channels and stored in the array value .

In the mask multi-channel mode (Case 6), the norm is computed for a single channel of interest specified by coi.

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 in mask mode, if src1Step, src2Step, or maskStep is less than roiSize.width * <pixelSize>.

ippStsNotEvenStepErr

Indicates an error condition in mask mode if steps for floating-point images cannot be divided by 4.

ippStsCOIErr

Indicates an error when coi is not 1, 2, or 3.

Example

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

void func_normdiff_l1() {
	Ipp8u pSrc1[8*4];
	Ipp8u pSrc2[8*4];
	Ipp64f Value;
	int src1Step = 8;
	int src2Step = 8;
	IppiSize roi = {8,4};
	IppiSize roiSize = {5,4};
	
	ippiSet_8u_C1R(1, pSrc1, src1Step, roi);
	ippiSet_8u_C1R(2, pSrc2, src2Step, roi);
	
	ippiNormDiff_L1_8u_C1R( pSrc1, src1Step, pSrc2, src2Step, roiSize, &Value);
}

Result:

-> 20.0