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

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

Mirror

Mirrors an image about the specified axis (axes).

Syntax

Case 1: Not-in-place operation

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

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

Case 2: In-place operation

IppStatus ippiMirror_<mod>(Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize, IppiAxis flip);

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

8u_AC4IR

16u_AC4IR

16s_AC4IR

32s_AC4IR

32f_AC4IR

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 buffer.

srcStep

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

pDst

Pointer to the destination buffer.

dstStep

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

pSrcDst

Pointer to the source and destination buffer for the in-place operation.

srcDstStep

Distance, in bytes, between the starting points of consecutive lines in the source and destination image buffer for the in-place operation.

roiSize

Size of the destination ROI in pixels.

flip

Specifies the axis to mirror the image about. Use the following values to specify the axes:

ippAxsHorizontal

for the horizontal axis.

ippAxsVertical

for the vertical axis.

ippAxsBoth

for both horizontal and vertical axes.

ippAxs45

for the 45-degree rotated axis.

ippAxs135

for the 135-degree rotated axis.

Description

The ippiMirror function operates with ROI (see Regions of Interest in Intel IPP). This function mirrors the source image pSrc about the axis (axes) specified by the value of the flip parameter and writes the result to the destination image pDst. Each function flavor can mirror an image about the horizontal or vertical axis or both.

The ippiMirror_8u_C1R, ippiMirror_16u_C1R, ippiMirror_16s_C1R, and ippiMirror_32f_C1R function flavors can also use the ippAxs45 or ippAxs135 value of the flip parameter to mirror the source image about an axis rotated counterclockwise by 45 degrees or 135 degrees, respectively. For mirroring with each of these values of the flip parameter, the sizes of the source and destination ROI are different, and

roiSize.height = srcRoiSize.width

roiSize.width = srcRoiSize.height

Return Values

ippStsNoErr

Indicates 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 roiSize has a field with zero or negative value, or when one of the dimensions is equal to 1.

ippStsMirrorFlipErr

Indicates an error condition if flip has an illegal value.

ippStsNotSupportedModeErr

Indicates an error condition if intersection of the source and destination ROI is detected.

ippStsStepErr

Indicates an error condition if srcStep or dstStep has a zero or negative value or is not a multiple of the image data size (4 for floating-point images or 2 for short-integer images)

Examples

Mirror1:

/*******************************************************************************
* Copyright 2015 Intel Corporation.
*
*
* This software and the related documents are Intel copyrighted materials, and your use of them is governed by
* the express license under which they were provided to you ('License'). Unless the License provides otherwise,
* you may not use, modify, copy, publish, distribute, disclose or transmit this software or the related
* documents without Intel's prior written permission.
* This software and the related documents are provided as is, with no express or implied warranties, other than
* those that are expressly stated in the License.
*******************************************************************************/

// A simple example of mirroring an image about
// a horizontal and vertical axis using Intel(R) Integrated Performance Primitives (Intel(R) IPP) functions:
//     ippiMirror_8u_C1R


#include <stdio.h>
#include "ipp.h"

/* Next two defines are created to simplify code reading and understanding */
#define EXIT_MAIN exitLine:                                  /* Label for Exit */
#define check_sts(st) if((st) != ippStsNoErr) goto exitLine; /* Go to Exit if Intel(R) IPP function returned status different from ippStsNoErr */

int main(void)
{
    IppStatus status = ippStsNoErr;
    Ipp8u pSrc[8 * 4] = {/* Pointer to source images */
        1, 2, 3, 4, 8, 8, 8, 8,
        1, 2, 3, 4, 8, 8, 8, 8,
        1, 2, 3, 4, 8, 8, 8, 8,
        1, 2, 3, 4, 8, 8, 8, 8 };
    Ipp8u pDst[4*4];              /* Pointer to destination images */
    int srcStep = 8, dstStep = 4; /* Steps, in bytes, through the source/destination images */
    IppiSize roiSize = { 4, 4 };  /* Size of source/destination ROI in pixels */
    IppiAxis flip = ippAxsBoth;   /* Specifies the axis to mirror the image about */

    check_sts( status = ippiMirror_8u_C1R(pSrc, srcStep, pDst, dstStep, roiSize, flip) )

EXIT_MAIN
    printf("Exit status %d (%s)\n", (int)status, ippGetStatusString(status));
    return (int)status;
}

Mirror2:

/*******************************************************************************
* Copyright 2015 Intel Corporation.
*
*
* This software and the related documents are Intel copyrighted materials, and your use of them is governed by
* the express license under which they were provided to you ('License'). Unless the License provides otherwise,
* you may not use, modify, copy, publish, distribute, disclose or transmit this software or the related
* documents without Intel's prior written permission.
* This software and the related documents are provided as is, with no express or implied warranties, other than
* those that are expressly stated in the License.
*******************************************************************************/

// A simple example of mirroring an image about
// the ippAxs45 and ippAxs135 axis using Intel(R) Integrated Performance Primitives (Intel(R) IPP) functions:
//     ippiMirror_8u_C1R


#include <stdio.h>
#include "ipp.h"

/* Next two defines are created to simplify code reading and understanding */
#define EXIT_MAIN exitLine:                                  /* Label for Exit */
#define check_sts(st) if((st) != ippStsNoErr) goto exitLine; /* Go to Exit if Intel(R) IPP function returned status different from ippStsNoErr */

int main(void)
{
    IppStatus status = ippStsNoErr;
    Ipp8u pSrc[8 * 4] = {/* Pointer to source images */
        1, 2, 3, 4, 8, 8, 8, 8,
        1, 2, 3, 4, 8, 8, 8, 8,
        1, 2, 3, 4, 8, 8, 8, 8,
        1, 2, 3, 4, 8, 8, 8, 8 };
    Ipp8u pDst[8 * 8] = {/* Pointer to destination images */
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0};
    int srcStep = 8, dstStep = 8; /* Steps, in bytes, through the source/destination images */
    IppiSize roiSize = { 3, 4 };  /* Size of source/destination ROI in pixels */
    IppiAxis flip1 = ippAxs45;    /* The axis to mirror the image about */
    IppiAxis flip2 = ippAxs135;   /* The axis to mirror the image about */

    check_sts( status = ippiMirror_8u_C1R(pSrc, srcStep, pDst, dstStep, roiSize, flip1) )
    check_sts( status = ippiMirror_8u_C1R(pSrc, srcStep, pDst, dstStep, roiSize, flip2) )

EXIT_MAIN
    printf("Exit status %d (%s)\n", (int)status, ippGetStatusString(status));
    return (int)status;
}