YUV 4:2:2 single-channel to multi-channel

YUV 4:2:2 single-channel to multi-channel

Hi,
I have a 4:2:2 YUV single plane image (YUYV....) and I want to convert itinto a 4:2:2 YUV separated planes(Y,U,V) image.
How to do so? Using a masked copy?
Thanks for your help,
Regards,
Andrea

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi,

take a look on these functions:

/* ////////////////////////////////////////////////////////////////////////////
// Name: ippiJoin422_8u_P3C2R, ippiSplit422_8u_C2P3R
//
// Purpose: Convert form 422 plane image format to 2-channal pixel
// image format and vice versa.
//
// Return:
// ippStsNoErr Ok
// ippStsNullPtrErr One or more pointers are NULL
// ippStsStepErr One or more steps is less or equal zero
// ippStsSizeErr Width of first plain 422-image less then 2(4)
// or height equal zero
// ippStsStrideErr Step is less then width of image
//
// Arguments:
// pSrc[3] It is three pointers to source images
// srcStep[3] It is three steps for previous three images
// pDst[3] It is three pointers to destination images
// dstStep[3] It is three steps for previous three images
// pSrc The pointer to source image
// srcStep The step for source image
// pDst The pointer to destination image
// dstStep The step for destination image
// roiSize Size of ROI
*/
IPPAPI (IppStatus, ippiJoin422_8u_P3C2R, ( const Ipp8u* pSrc[3], int srcStep[3], Ipp8u* pDst, int dstStep, IppiSize roiSize))
IPPAPI (IppStatus, ippiSplit422_8u_C2P3R, ( const Ipp8u* pSrc, int srcStep, Ipp8u* pDst[3], int dstStep[3], IppiSize roiSize))

I think, it is what you are looking for

Regards,
Vladimir

Hi Vladimir, I saw them: I'm using Split() but I getaippStsStrideErr error.

Ithink the reasonis thatmy U and V buffers have dimension of W/2 x H (and so the "step" parameters is less than the width Wof the image).

Do I have to change the dimensions to W x H for all the three planes?

Thanks,

Andrea

There is piece of code to check the error conditions in this function

/* test consistency */
IPP_BADARG_RET( ( roiSize.width > Step_Y), ippStsStrideErr);
IPP_BADARG_RET( ((roiSize.width >> 1) > Step_cB), ippStsStrideErr);
IPP_BADARG_RET( ((roiSize.width >> 1) > Step_cR), ippStsStrideErr);
IPP_BADARG_RET( ((roiSize.width << 1) > srcStep), ippStsStrideErr);

So, you can see, ippStsStrideErr returned when roi.with is not in allowed range.

Step is number of bytes between two adjacent raster lines. Note, source image here has twice more bytes than width (if you have no padding bytes).

Vladimir

Hi Vladimir, I solved the problem: the srcstep parameter has to be W * 2, where W is input image width.

Thanks for your help.

Andrea

Hi Andrea,

Right, it is exactly what I was trying to say:)

Regards,
Vladimir

Leave a Comment

Please sign in to add a comment. Not a member? Join today