Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Converting from pixel order YCbCr411 to BGR

Anonymous63
Beginner
473 Views

Hi all,

I'm new to using the IPP library and  I'm having trouble converting from pixel order YCbCr411 data to BGR format.  From reading the documentation, I know that I first need to convert the pixel order to planar format first before calling the the library function ippiYCbCr411ToBGR_8u_P3C4R to convert planar YCbCr411 data to BGR format. I see that I can probably use the ippiCopy_8u_C3P3R call to convert my image buffer from pixel order to planar order. 

For example, is this the following the correct approach?

int pDstStep[3];
Ipp8u* pFirst = ippiMalloc_8u_C1(srcCols, srcRows, &pDstStep[0]);
Ipp8u* pSecond = ippiMalloc_8u_C1(srcCols/4, srcRows, &pDstStep[1]);
Ipp8u* pThird = ippiMalloc_8u_C1(srcCols/4, srcRows, &pDstStep[2]);

Ipp8u* pDst[3] = { pFirst, pSecond, pThird };        
        
 ippiCopy_8u_C3P3R((Ipp8u*)pImageBuffer,
            pImageBufferStride,
            pDst,
            srcCols,
            imgSize);

// Convert from 3 plane YCbCr411 source image to BGR 
ippiYCbCr411ToBGR_8u_P3C4R(const unsigned char**)(&pDst),
            pDstStep,
            pDestBuffer,
            destStride,
            imgSize,
            0);

Thanks!

0 Kudos
5 Replies
Chao_Y_Intel
Moderator
473 Views

Hello, 

This way looks fine.  One note here is the ippiYCbCr411ToBGR_8u_P3C4R includes one additional alpha channel for BGR data. If  it does has the alpha channel, it can use C3 format data. 

Thanks,
Chao

0 Kudos
Anonymous63
Beginner
473 Views

Hi,

Thanks for your comments!  I do require two methods for the conversion one to support alpha channel and one without so that's why in the above example i was converting to C4 format.  

However my output image is not correct. I can see repeats on the image which leads me to think perhaps I am not setting the parameters correctly when converting from pixel to planar format using the ippiCopy function. I'm not sure if the step size (forth parameter) is correct.   I've set the step size as width of the source image ... is this still correct when the input image buffer is in the YCbCr 4:1:1 format? 

ippiCopy_8u_C3P3R(Ipp8u*)pImageBuffer,pImageBufferStride,pDst,srcCols,imgSize); 

Thanks for your help!

 

0 Kudos
Chao_Y_Intel
Moderator
473 Views

Hi,

For the YCrCr 4:1:1  pixel format,  could you provide the details on how the data is stored?   

For the Y data is stored in plan: Y0Y1Y2....,  the  chrominance samples are interleaved:  Cb0Cr0Cb1Cr1....Actually, you can check this function:
https://software.intel.com/en-us/node/504046

Thanks,
Chao

0 Kudos
Anonymous63
Beginner
473 Views

Hi,

My pixel order data is stored in the format Y0, Y1, Y2, Y3, Cb0, Cr0, Y4, Y5, Y6, Y7, Cb1, Cr1 ... etc.  Are there any existing functions to convert this into planar format?

Thanks!

0 Kudos
Sergey_P_Intel1
Employee
473 Views

Hi,

Unfortunately,  there is no functions to convert from your format to YCbCr411 format.

Sergey.

0 Kudos
Reply