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

RGBToYUV420

Converts an RGB image to the 4:2:0 YUV image.

Syntax

Case 1: Operation on planar data with ROI

IppStatus ippiRGBToYUV420_8u_P3R(const Ipp8u* pSrc[3], int srcStep, Ipp8u* pDst[3], int dstStep[3], IppiSize roiSize);

Case 2: Operation on planar data without ROI

IppStatus ippiRGBToYUV420_8u_P3(const Ipp8u*pSrc[3], Ipp8u* pDst[3], IppiSize imgSize);

Case 3: Conversion from pixel-order to planar data with ROI

IppStatus ippiRGBToYUV420_8u_C3P3R(const Ipp8u* pSrc, int srcStep, Ipp8u* pDst[3], int dstStep[3], IppiSize roiSize);

Case 4: Conversion from pixel-order to planar data without ROI

IppStatus ippiRGBToYUV420_8u_C3P3(const Ipp8u* pSrc, Ipp8u* pDst[3], IppiSize imgSize);

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 buffer for pixel-order image. An array of pointers to the source image buffers in each color plane for planar image.

srcStep

Distance in bytes between starts of consecutive lines in the source image for operations with ROI.

pDst

An array of pointers to the destination image buffers in each color plane.

dstStep

An array of distances in bytes between starts of consecutive lines in each plane of the destination image for operations with ROI.

roiSize

Size of the source and destination ROI in pixels.

imgSize

Size of the source and destination images in pixels for operations without ROI.

Description

This function converts the gamma-corrected R'G'B' image pSrc to the Y'U'V' image pDst with the 4:2:0 sampling (see Table “Planar Image Formats” for more details). The conversion is performed in the accordance with the same formulas as the function ippiRGBToYUV does.

For digital RGB values in the range [0..255], Y' has the range [0..255], U varies in the range [-112..+112], and V in the range [-157..+157]. To fit in the range of [0..255], a constant value 128 is added to computed U and V values, and V is then saturated.

Some function flavors operates with ROI see Regions of Interest in Intel IPP).

The function flavors that does not use ROI operate on the assumption that both the source and destination images have the same size and occupy a contiguous memory area, which means that image rows are not padded with zeroes. In this case the step parameters are not needed.

roiSize.width (imgSize.width) and roiSize.height (imgSize.height) should be multiples of 2. Otherwise, the function reduces their original values to the nearest multiples of 2, performs operation, and returns warning message.

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error or a warning.

ippStsNullPtrErr

Indicates an error condition if pSrc or pDst is NULL.

ippStsSizeErr

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

ippStsDoubleSize

Indicates a warning if roiSize or imgSize has a field that is not a multiple of 2.