How do i use ippiYCbCr420ToRGB565_8u16u_P3C3R?

How do i use ippiYCbCr420ToRGB565_8u16u_P3C3R?

I see ippiqr.pdf and ippcc.h

IPPAPI(IppStatus, ippiYCbCr420ToBGR565_8u16u_P3C3R,(const Ipp8u* pSrc[3], int srcStep[3],Ipp16u* pDst, int dstStep, IppiSize roiSize))

m_pRgb = new unsigned char[ 640 * 480 * 3 ];

vm_byte *( lpSrc[3] ) = //
m_pUc + 640 * 480 * 5 / 4,
m_pUc + 640 * 480

size_t iPitchSrc[ 3 ] =

IppiSize pitchDst;
pitchDst.width = 640;
pitchDst.height = 480;

ippiYCbCr420ToBGR565_8u16u_P3C3R( lpSrc, ( int* )iPitchSrc, ( Ipp16u* )m_pRgb, 1920, pitchDst );

it error.error C2664: ippiYCbCr420ToBGR565_8u16u_P3C3R : can't convert parameter 1from vm_byte *[3]toconst Ipp8u *[].

while i use ippiYCbCr420ToBGR_8u_P3C3R( lpSrc, ( int* )iPitchSrc, m_pRgb, 1920, pitchDst) is right.

when i use IPPAPI(IppStatus, ippiYCbCr420ToBGR565_8u16u_P3C3R,(const Ipp8u* const pSrc[3], int srcStep[3],Ipp16u* pDst, int dstStep, IppiSize roiSize)) instead of

IPPAPI(IppStatus, ippiYCbCr420ToBGR565_8u16u_P3C3R,(const Ipp8u* pSrc[3], int srcStep[3],Ipp16u* pDst, int dstStep, IppiSize roiSize)) can compile .but zhe image is wrong.

How do i use?

Thanks in advance!

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


if you'll look attentively you can see that there is a difference in those API:

1: IPPAPI(IppStatus, ippiYCbCr420ToBGR565_8u16u_P3C3R,(const Ipp8u* pSrc[3],...


2: IPPAPI(IppStatus, ippiYCbCr420ToBGR_8u_P3C3R,(const Ipp8u* const pSrc[3],

I think you should be able to compile if you write something like this:

Ipp8u* p1,p2,p3;

const Ipp8u* src[3];

int srcStep[3] = {10, 10, 10 };

IppiSize roi = { 2, 4 };

src[0] = (const Ipp8u*)p1; src[1] = (const Ipp8u*)p2; src[2] = (const Ipp8u*)p3;



I think a Bmp of RGB565( resolution 640*480) is 640*480*2 Bytes.

But i use ippiYCbCr420ToBGR565_8u16u_P3C3R the return pDst use more than 640*480*2 Bytes.

I use ippiYCbCr420ToBGR_8u_P3C3R the return pDst use is 640 *480*3 Bytes.

I use the media sample's myYV12toRGB555 function is right.But myYV12toRGB555 is too slow.( it's ingdi_video_render.cpp )


Well,I'm a bit disappointed. Initially I thought you had a compilation issue (because of double const modifier in one of IPP function). Was that issue resolved?

Now you raise two new issues:
1. ippiYCbCr420ToBGR565_8u_16u_P3C3R overwrites memory. Did I understand you correctly?

2. myYV12toRGB555 function (from gdi_video_render.cpp) is too slow.

Regarding yourfirst issue, please double check that you used step parameters correctly. In IPP image step is number of bytes between two adjacent image lines. ForBGR565 640x480case it is not 1920, it should be 640*2 (if you don't align image lines).

Regarding second issue, yes, it is just C implementation. Please submit request for optimization ofthis function throught Intel Premier Support.


FirstIhad a compilation issue (because of double const modifier in one of IPP function). That issue hasresolved.

ForBGR565 640x480 my parameters is wrong(1920 is wrong,640*2 is right ). It is all that i don't align image lines.

All issue have resolved.

Thank you very much!

That's great, I'm glad that issue is solved. Feel free to contact with us in case of any throubles.


I see Simple_player sample.It can decode mpeg4 to YV12, YUY2, RGB565.

I foundthe data decode mpeg4 to RGB565, is different fromthe data i decode mpeg4 to YV12, then use ippiYCbCr420ToRGB565_8u16u_P3C3Rconvert .

Is there anything wrong?


Hello, I'm not sure I really got your question. What the issue you have? The difference between RGB565 data and YUV240 data? They should be different, that's ok.


I am sorry! My English is poor.

I Can Get RGB565 data from the ways.

1. Mpeg4->(Mpeg4VideoDecode)YV12->(useippiYCbCr420ToRGB565_8u16u_P3C3R)RGB565


the two data is different.

Thank you, got it. How different is data? Is it absolutely wrong color? Basically, ippiYCbCr420ToRGB565_8u16u_P3C3R function work, you can check it with any simple test. Probably you need to pay attention to the parameters with which you do call it (especially step parameter, it is usual source of mistakes for those who just start to use IPP functions). The step should by distance, in bytes, between two adjacent image lines.


the mpeg4 is 640*480

1. Mpeg4->YV12


ColorInit.FormatDest= YV12;//; YV12
VDecParams.cformat = YV12;//dest YV12

VDecParams.lpConvertInit = &ColorInit;
VDecParams.uiLimitThreads = 0;

umcRes = MPEG4VideoDecoder->Init( &VDecParams );

out_data.SetPitch( 640);

MPEG4VideoDecoder->GetFrame( pInData, &out_data );


ippiYCbCr420ToRGB565_8u16u_P3C3R ( pitch = 1280)

2. Mpeg4->RGB565


ColorInit.FormatDest= RGB565;

VDecParams.cformat = RGB565;

VDecParams.lpConvertInit = &ColorInit;
umcRes = MPEG4VideoDecoder->Init( &VDecParams );

out_data.SetPitch( 2048);(I change 2048to 1280 is right.but simple_player use BltRender renderthe pitch = 2048,why?)

MPEG4VideoDecoder->GetFrame( pInData, &out_data );



Do not know why simple_player use 2048, but did you solve your issue by using correct pitch value?


I don't know why simple_player use 2048.I use correct pitch value solve my issue.

Can you tell me the sequence of640*480Image (rgb565) in pitch 2048 ?

I find image rgb565 ( use 32bitsDISPLAY PROPERTY->SETTING ), the pitch is 2048.

rgb565( use 16bits DISPLAY PROPERTY->SETTING ), the pitch is 1280,the sequence is |rrrrrggg|gggbbbbb|......

{the count is640}


it might be done so because of alignment of memeory buffers in simple_player. And it might be just a bug. If you feel it is incorrect behaviuor please submit your report to Intel Premier Support, we will consider that and might be fix in the next version.

Anyway, I'm glad that you find solution which is working for you


Leave a Comment

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