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

ID 790148
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

ColorTwist32f

Applies a color twist matrix to an image with integer pixel values.

Syntax

Case 1: Not-in-place operation on pixel-order data

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

Supported values for mod:

8u_C3R 16u_C3R 16s_C3R
8u_AC4R 16u_AC4R 16s_AC4R

Case 2: Not-in-place operation on planar data

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

Supported values for mod :

8u_P3R 16u_P3R 16s_P3R

Case 3: In-place operation on pixel-order data

IppStatus ippiColorTwist32f_<mod>(Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize, const Ipp32f twist[3][4]);

Supported values for mod :

8u_C3IR 16u_C3IR 16s_C3IR
8u_AC4IR 16u_AC4IR 16s_AC4IR

Case 4: In-place operation on planar data

IppStatus ippiColorTwist32f_<mod>(Ipp<datatype>* pSrcDst[3], int srcDstStep, IppiSize roiSize, const Ipp32f twist[3][4]);

Supported values for mod :

8u_IP3R 16u_IP3R 16s_IP3R

Include Files

ippcc.h

Domain Dependencies

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

Libraries: ippcore.lib, ippvm.lib, ipps.lib, ippi.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 ROI.

dstStep

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

pSrcDst

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

srcDstStep

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

roiSize

Size of the source and destination ROI in pixels.

twist

The array containing color-twist matrix elements.

Description

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

This function applies the color-twist matrix to all three color channel values in the integer source image to obtain the resulting data in the destination image. For example, the conversion from the RGB to the YCbCr format can be done as

Y = 0.299*R + 0.587*G + 0.114*B

Cb = - 0.16874*R - 0.33126*G + 0.5*B + 0.5

Cr = 0.5*R - 0.41869*G - 0.08131*B + 0.5

which can be described in terms of the following color twist matrix:

0.29900f	   0.58700f 	  0.11400f	 0.000f
-0.16874f 	 -0.33126f  	 0.50000f	 128.0f
 0.50000f	  -0.41869f	  -0.08131f	 128.0f

Color-twist matrices may also be used to perform many other color conversions.

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error.

ippStsNullPtrErr

Indicates an error condition if pSrc, pDst, or pSrcDst is NULL.

ippStsSizeErr

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