Developer Reference for Intel® Integrated Performance Primitives 2018

Conv

Performs two-dimensional convolution of two images.

Syntax

Case 1: Operating on integer data

IppStatus ippiConv_<mod>(const Ipp<datatype>* pSrc1, int src1Step, IppiSize src1Size, const Ipp<datatype>* pSrc2, int src2Step, IppiSize src2Size, Ipp<datatype>* pDst, int dstStep, int divisor, IppEnum algType, Ipp8u* pBuffer);

Supported values for mod

8u_C1R 16s_C1R
8u_C3R 16s_C3R
8u_C4R 16s_C4R

Case 2: Operating on floating-point data

IppStatus ippiConv_<mod>(const Ipp32f* pSrc1, int src1Step, IppiSize src1Size, const Ipp32f* pSrc2, int src2Step, IppiSize src2Size, Ipp32f* pDst, int dstStep, IppEnum algType, Ipp8u* pBuffer);

Supported values for mod

32f_C1R
32f_C3R
32f_C4R

Include Files

ippi.h

Domain Dependencies

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 the starting points of consecutive lines in the source images.

src1Size, src2Size

Size in pixels of the source images.

pDst

Pointer to the destination image ROI.

dstStep

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

divisor

The integer value by which the computed result is divided (for operations on integer data only).

algType

Bit-field mask for the algorithm type definition. Possible values are the results of composition of the IppAlgType and IppiROIShape values.

pBuffer

Pointer to the buffer for internal calculations.

Description

Before using this function, you need to compute the size of the work buffer using the ippiConvGetBufferSize function.

The ippiConv function operates with ROI. The type of convolution that function performs is defined by the value of the algType parameter:

  1. If the ippiROIFull flag is set, the function performs full two-dimensional finite linear convolution between two source images pointed by the pSrc1 and pSrc2 parameters. The resulting destination image h[i, j] is computed by the following formula:

    where

    • Mh = Mf + Mg - 1

      where

      • Mf is the number of rows in the first source image matrix f

      • Mg is the number of rows in the second source image matrix g

    • Nh = Nf + Ng - 1

      where

      • Nf is the number of columns in the first source image matrix f

      • Ng is the number of columns in the second source image matrix g

    • 0 i < Mh, 0 i < Nh

  2. If the ippiROIValid flag is set up, the function performs valid two-dimensional finite linear convolution between two source images pointed by the pSrc1 and pSrc2 parameters. The destination image h[i, j] obtained as a result of the function operation is computed by the following formula:

    where

    • Mh = | Mf - Mg| + 1

      where

      • Mf is the number of rows in the first source image matrix f

      • Mg is the number of rows in the second source image matrix g

    • Nh = |Nf - Ng| + 1

      where

      • Nf is the number of columns in the first source image matrix f

      • Ng is the number of columns in the second source image matrix g

    • 0 i < Mh, 0 i < Nh

    This case assumes that MfMg and NfNg. In case when Mf < Mg and Nf < Ng, the subscript index g in this equation must be replaced with the index f. For any other combination of source image sizes, the function performs no operation.

    Note

    The above formula provides the same result as in the case with the ippiROIFull flag, but produces only the part of the convolution image that is computed without zero-padded values.

Function flavors that accept input data of the Ipp32f type use the same summation formula, but without scaling of the result (divisor = 1 is assumed).

The following examples illustrate the function operation. For the source images f, g of size 3 x 5 represented as

with g = f:

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error.

ippStsNullPtrErr

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

ippStsSizeErr

Indicates an error when src1Size or src2Size has a zero or negative value.

ippStsStepErr

Indicates an error when src1Step, src2Step, or dstStep has a zero or negative value.

ippStsDivisorErr

Indicates an error when divisor has a zero value.

ippStsAlgTypeErr

Indicates an error when:

  • the result of the bitwise AND operation between the algType and ippAlgMask differs from the ippAlgAuto, ippAlgDirect, or ippAlgFFT values;
  • the result of the bitwise AND operation between the algType and ippiROIMask differs from the ippiROIFull or ippiROIValid values.

Example

Conv.c

See Also