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

IPP RGB24 to YV12 or I420

yann_stephan
Beginner
1,895 Views

Please some can help on this:

My source image is a regular RGB24 (352x288) but the output is a directX so the size is (512x288).

In this case :

m_nInWidth = 352 / m_nInHeight = 288

m_nOutWidth= 512 / m_nOutHeight = 288

I tried the following thing but it does not work:

IppiSize roiSize = {m_nInWidth, m_nInHeight};

pYUV[0] = (Ipp8u *) pVideoBuffer;

pYUV[1] = (Ipp8u *) (pYUV[0] + (m_nOutWidth * m_nOutHeight));

pYUV[2] = (Ipp8u *) (pYUV[1] + ((m_nOutWidth * m_nOutHeight) / 4));

dstStep[0] = m_nOutWidth;

dstStep[1] = m_nOutWidth / 2;

dstStep[2] = m_nOutWidth / 2;

ippiRGBToYCbCr420_8u_C3P3R((const Ipp8u*) pData, m_nInWidth, pYUV, dstStep, roiSize);

The result is up side down picture with one plan cut in 4

Help is welcomed...

Thanks

0 Kudos
5 Replies
Vladimir_Dudnik
Employee
1,895 Views

Sorry, I did not get what is your goal. Do you want to resize image?

Vladimir

0 Kudos
yann_stephan
Beginner
1,895 Views

No, the problem is the following one:

+ If you negociate a CIF size 352x288 when you connect a Window Renderer like VRM9, the filter will align to a boundary of power of 2.

So in my case the original size 352x288 (RGB 24) must be converted to 512x288 (YV12 or I420).

The IPP Library (impressive) is used for:

1st - Convert RGB24 to YV12 or I420 (Plan swapping)

2nd - Resize

But in order to move to a temporary buffer, I though that with the usage of ROI and the raster it should work.

I hope, that my description is clear enough.

Thanks

Yann

0 Kudos
yann_stephan
Beginner
1,895 Views

Problem has been fixed:

ippiRGBToYCbCr420_8u_C3P3R((

const Ipp8u*) pData, m_nInWidth*3, pYUV, dstStep, roiSize);

!!!!! It works but I am up side down !!!!!

0 Kudos
yann_stephan
Beginner
1,895 Views

It seems to be a known problem:

Color conversion from YUV 420 to RGB results in an upside-down image
In some imaging pipelines, the interpretations of YUV images and RGB images are flipped relative to each other. The Intel IPP YUVToRGB function does not flip the image. However, Intel IPP does provide routines to perform the flip operation. One solution is to apply the function ippiMirror to flip the result before or after calling the YUVToRGB color conversion function.

I hope it can help.

0 Kudos
Vladimir_Dudnik
Employee
1,895 Views

Yes, that's correct. The IPP function do only what is stated in their name, there is no hidden side effects (like not expected mirroring of resulting image).

Regards,
Vladimir

0 Kudos
Reply