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

YCbCr422ToYCbCr420

Converts YCbCr image from 4:2:2 sampling format to 4:2:0 format.

Syntax

Case 1: Operation on planar data

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

IppStatus ippiYCbCr422ToYCbCr420_8u_P3P2R(const Ipp8u* pSrc[3], int srcStep[3], Ipp8u* pDstY, int dstYStep, Ipp8u* pDstCbCr, int dstCbCrStep, IppiSize roiSize);

Case 2: Conversion from pixel-order to planar data

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

IppStatus ippiYCbCr422ToYCbCr420_8u_C2P2R(const Ipp8u* pSrc, int srcStep, Ipp8u* pDstY, int dstYStep, Ipp8u* pDstCbCr, int dstCbCrStep, IppiSize roiSize);

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 ROI in the pixel-order source image. Array of pointers to the ROI in each plane of the planar source image.

srcStep

Distance in bytes between starts of consecutive lines in the source image. Array of distance values for the source image planes.

pDst

Array of pointers to the ROI in each plane for a three-plane destination image.

dstStep

Array of distances in bytes between starts of consecutive lines in each plane for a three-plane destination image.

pDstY

Pointer to the ROI in the luminance plane for a two-plane destination image.

dstYStep

Distance in bytes between starts of consecutive lines in the luminance plane of a destination image.

pDstCbCr

Pointer to the ROI in the interleaved chrominance plane for a two-plane destination image.

dstCbCrStep

Distance in bytes between starts of consecutive lines in the chrominance plane of a destination image.

roiSize

Size of the ROI in pixels, height and width should be multiple of 2.

Description

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

This function converts the 4:2:2 image pSrc to the 4:2:0 image. The source image can be two-channel or three-plane , destination image always is planar with two or three planes (see Table “Pixel-Order Image Formats” and Table “Planar Image Formats”). Two-plane image contains luminance samples Y0, Y1, Y2, .. in the first plane pDstY, and interleaved chrominance samples Cb0, Cr0, Cb1, Cr1, ... in the second plane pDstCbCr.

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error.

ippStsNullPtrErr

Indicates an error condition if any of the specified pointers is NULL.

ippStsSizeErr

Indicates an error condition if any field of the roiSize is less than 2.

Example

The code example below shows how to use the function ippiYCbCr422ToYCbCr420_8u_C2P3R.

{
  Ipp8u*   ImageI420[3];
  int      stepI420[3];
  Ipp8u*   ImageYUY2;
  int      stepYUY2;
  IppiSize roiSize = { 1024, 768};
  ImageI420[0] = ippiMalloc_8u_C1( roiSize.width, roiSize.height, &(stepI420[0]));
  ImageI420[1] = ippiMalloc_8u_C1( roiSize.width, roiSize.height, &(stepI420[1]));
  ImageI420[2] = ippiMalloc_8u_C1( roiSize.width, roiSize.height, &(stepI420[2]));
  ImageYUY2    = ippiMalloc_8u_C2( roiSize.width, roiSize.height, &stepYUY2 );
  ippiYCbCr422ToYCbCr420_8u_C2P3R( ImageYUY2, stepYUY2, ImageI420, stepI420, roiSize);

  ippiFree(ImageI420[0]);
  ippiFree(ImageI420[1]);
  ippiFree(ImageI420[2]);
  ippiFree(ImageYUY2);
}