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

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

Copy

Copies pixel values between two buffers.

Syntax

Case 1: Copying all pixels of all color channels

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

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
8u_AC4R 16u_AC4R 16s_AC4R 32s_AC4R 32f_AC4R
8u_C3AC4R 16u_C3AC4R 16s_C3AC4R 32s_C3AC4R 32f_C3AC4R
8u_AC4C3R 16u_AC4C3R 16s_AC4C3R 32s_AC4C3R 32f_AC4C3R

Case 2: Copying masked pixels only

IppStatus ippiCopy_<mod>(const Ipp<datatype>* pSrc, int srcStep, 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
8u_C3MR 16u_C3MR 16s_C3MR 32s_C3MR 32f_C3MR
8u_C4MR 16u_C4MR 16s_C4MR 32s_C4MR 32f_C4MR
8u_AC4MR 16u_AC4MR 16s_AC4MR 32s_AC4MR 32f_AC4MR

Case 3: Copying a selected channel in a multi-channel image

IppStatus ippiCopy_<mod>(const Ipp<datatype>* pSrc, int srcStep, 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

Case 4: Copying a selected channel to a one-channel image

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

Supported values for mod:

8u_C3C1R 16u_C3C1R 16s_C3C1R 32s_C3C1R 32f_C3C1R
8u_C4C1R 16u_C4C1R 16s_C4C1R 32s_C4C1R 32f_C4C1R

Case 5: Copying a one-channel image to a multi-channel image

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

Supported values for mod:

8u_C1C3R 16u_C1C3R 16s_C1C3R 32s_C1C3R 32f_C1C3R
8u_C1C4R 16u_C1C4R 16s_C1C4R 32s_C1C4R 32f_C1C4R

Case 6: Splitting color image into separate planes

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

Supported values for mod:

8u_C3P3R 16u_C3P3R 16s_C3P3R 32s_C3P3R 32f_C3P3R

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

Supported values for mod:

8u_C4P4R 16u_C4P4R 16s_C4P4R 32s_C4P4R 32f_C4P4R

Case 7: Composing color image from separate planes

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

Supported values for mod:

8u_P3C3R 16u_P3C3R 16s_P3C3R 32s_P3C3R 32f_P3C3R

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

Supported values for mod:

8u_P4C4R 16u_P4C4R 16s_P4C4R 32s_P4C4R 32f_P4C4R

Case 8: Copying all pixels of all color channels with platform-aware functions

IppStatus ippiCopy_<mod>(const Ipp<datatype>* pSrc, IppSizeL srcStep, Ipp<datatype>* pDst, IppSizeL dstStep, IppiSizeL roiSize);

Supported values for mod:

8u_C1R_L 16s_C1R_L 16u_C1R_L 32s_C1R_L 32f_C1R_L
8u_C3R_L 16s_C3R_L 16u_C3R_L 32s_C3R_L 32f_C3R_L
8u_C4R_L 16s_C4R_L 16u_C4R_L 32s_C4R_L 32f_C4R_L
8u_AC4R_L 16s_AC4R_L 16u_AC4R_L 32s_AC4R_L 32f_AC4R_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. The array storing pointers to the color planes of the source planar image.

srcStep

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

pDst

Pointer to the destination image ROI. The array storing pointers to the color planes of the destination planar image.

dstStep

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

roiSize

Size of the source and destination 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 copies data from the source image pSrc to the destination image pDst. Copying pixels selected by a mask pMask is supported as well.

For masked operation (Case 2), the function writes pixel values in the destination buffer only if the spatially corresponding mask array value is non-zero (as illustrated in the code example below).

Function flavors operating with the channel of interest (descriptor C) copy only one specified channel of a source multi-channel image to the channel of another multi-channel image (see Case 3). For these functions, the pSrc and pDst pointers point to the starts of ROI buffers in the specified channels of source and destination images, respectively.

Some function flavors add alpha channel to the 3-channel source image (flavors with the _C3AC4R descriptor), or discard alpha channel from the source image (flavors with the _AC4C3R descriptor) - see Case 1.

Special function flavors copy data from only one specified channel pSrc of a multi-channel image to a one-channel image pDst (see Case 4), as well as to copy data from a one-channel image pSrc to only one specified channel of a multi-channel image pDst (see Case 5).

You can also use the ippiCopy function to convert the interleaved color image into separate planes and vice versa (see Case 6 and Case 7).

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, with the exception of second mode in Case 4.

ippStsSizeErr

Indicates an error condition if roiSize has a field with a zero or negative value.

ippStsStepErr

Indicates an error condition if srcStep or dstStep is less than roiSize.width * <pixelSize> for Cases 4 and 5.

Example

The code example below shows how to copy masked data.

      IppStatus copyWithMask( void ) {
      Ipp8u mask[3*3], x[5*4], y[5*4]={0};
      IppiSize imgroi={5,4}, mskroi={3,3};
      ippiSet_8u_C1R( 3, x, 5, imgroi );
      /// set mask with a hole in upper left corner
      ippiSet_8u_C1R( 1, mask, 3, mskroi );
      mask[0] = 0;
      /// copy roi with mask
      return ippiCopy_8u_C1MR( x, 5, y, 5, mskroi, mask, 3 );
   }

The destination image y contains:

   00 03 03 00 00
   03 03 03 00 00
   03 03 03 00 00
   00 00 00 00 00