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

CopyMirrorBorder

Copies pixels values between two images and adds the mirrored border pixels.

Syntax

Case 1: Not-in-place operation

IppStatus ippiCopyMirrorBorder_<mod>(const Ipp<datatype>* pSrc, int srcStep, IppiSize srcRoiSize, Ipp<datatype>* pDst, int dstStep, IppiSize dstRoiSize, int topBorderHeight, int leftBorderWidth);

Supported values for mod:

8u_C1R 16u_C1R 16s_C1R 32s_C1R 32f_C1R
8u_C3R 16u_C3R 16s_C3R 32s_C3R 32f_C3R
8u_C4R 16u_C4R 16s_C4R 32s_C4R 32f_C4R

Case 2: In-place operation

IppStatus ippiCopyMirrorBorder_<mod>(const Ipp<datatype>* pSrc, int srcDstStep, IppiSize srcRoiSize, IppiSize dstRoiSize, int topBorderHeight, int leftBorderWidth);

Supported values for mod:

8u_C1IR 16u_C1IR 16s_C1IR 32s_C1IR 32f_C1IR
8u_C3IR 16u_C3IR 16s_C3IR 32s_C3IR 32f_C3IR
8u_C4IR 16u_C4IR 16s_C4IR 32s_C4IR 32f_C4IR

Case 3: Not-in-place operation with platform-aware functions

IppStatus ippiCopyMirrorBorder_<mod>(const Ipp<datatype>* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp<datatype>* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth);

Supported values for mod:

8u_C1R_L 16u_C1R_L 16s_C1R_L 32s_C1R_L 32f_C1R_L
8u_C3R_L 16u_C3R_L 16s_C3R_L 32s_C3R_L 32f_C3R_L
8u_C4R_L 16u_C4R_L 16s_C4R_L 32s_C4R_L 32f_C4R_L

Case 4: In-place operation with platform-aware functions

IppStatus ippiCopyMirrorBorder_<mod>(const Ipp<datatype>* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth);

Supported values for mod:

8u_C1IR_L 16u_C1IR_L 16s_C1IR_L 32s_C1IR_L 32f_C1IR_L
8u_C3IR_L 16u_C3IR_L 16s_C3IR_L 32s_C3IR_L 32f_C3IR_L
8u_C4IR_L 16u_C4IR_L 16s_C4IR_L 32s_C4IR_L 32f_C4IR_L

Include Files

ippi.h

Flavors with the _L suffix: ippi_l.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 the starting points of consecutive lines in the source image.

pDst

Pointer to the destination image.

dstStep

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

srcDstStep

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

srcRoiSize

Size of the source ROI, in pixels.

dstRoiSize

Size of the destination ROI, in pixels.

topBorderHeight

Height of the top border, in pixels.

leftBorderWidth

Width of the left border, in pixels.

Description

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

This function copies the source image pSrc to the destination image pDst and fills pixels outside the copied area (border pixels) in the destination image with the values of the source image pixels according to the scheme illustrated in the figure below. Squares marked in red correspond to pixels copied from the source image, that is, the source image ROI.

Creating a Mirrored Border



NOTE:

In-place flavors actually add border pixels to the source image ROI, thus a destination image ROI is larger than the initial image.

The parameters topBorderHeight and leftBorderWidth specify the position of the first pixel of the source ROI in the destination image ROI.

The height (width) of the destination ROI cannot be less than the sum of the height (width) of source ROI and the topBorderHeight (leftBorderWidth) parameter.

NOTE:

If border width is greater than the image size in the corresponding dimension, multiple reflections are obtained for this border.

NOTE:

If you use this function for a tiled image, note that to perform correct mirroring, the size of a tile must be more than the size of the used border. For example, if the image referenced above is divided into two tiles of size 3x3 and 2x3 , the second tile (cells are highlighted in yellow) is extended with top, right, and bottom borders (highlighted in gray). The width of the right border is not less than the second tile width, so the pixels (blue) required for constructing the border of the tiled image are out of the processed tile. Therefore the last column (red) of the border extended image is computed incorrectly:

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 in any of the following cases:

  • srcRoiSize or dstRoiSize has a field with a zero or negative value

  • topBorderHeight or leftBorderWidth is less than zero

  • dstRoiSize.width < srcRoiSize.width + leftBorderWidth

  • dstRoiSize.height < srcRoiSize.height + topBorderHeight

ippStsStepErr

Indicates an error when srcStep or dstStep has a zero or negative value.

Example

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

Ipp8u src[8*4] = { 1,  2,  3,  8,  8,  8,  8,  8,
  10,  9,  8,  8,  8,  8,  8,  8,
  11, 12, 13,  8,  8,  8,  8,  8,
  19, 18, 17,  8,  8,  8,  8,  8};
Ipp8u dst[10*8];
IppiSize srcRoi = { 3,  4 }; IppiSize dstRoi = { 10, 8 };
int topBorderHeight  = 2;
int leftBorderWidth  = 2;

ippiCopyMirrorBorder_8u_C1R(src, 8, srcRoi, dst, 10, dstRoi, topBorderHeight, leftBorderWidth);

Result:

source image:
  1  2  3  8  8  8  8  8
 10  9  8  8  8  8  8  8
 11 12 13  8  8  8  8  8
 19 18 17  8  8  8  8  8

		
destination image:
13 12 11 12 13 12 11 12 13 12
 8  9 10  9  8  9 10  9  8  9
 3  2  1  2  3  2  1  2  3  2
 8  9 10  9  8  9 10  9  8  9
13 12 11 12 13 12 11 12 13 12
17 18 19 18 17 18 19 18 17 18
13 12 11 12 13 12 11 12 13 12
 8  9 10  9  8  9 10  9  8  9