- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a bitmap(no header)buffer of size 176x144 and want to conver to YUV format before calling H.264 encoding routine.
I did it in the following way
int FrameSize = VideoWidth*VideoHeight*3/2;
IppStatus retValue;
Ipp8u * yuvData[3];
IppiSize srcSize={VideoWidth, VideoHeight};
int srcStep = VideoWidth*3;
//yuvData[0]=cYUVData + VideoWidth*VideoHeight*3/2;
yuvData[0]=cYUVData;
yuvData[1]=yuvData[0] +VideoWidth*VideoHeight;
yuvData[2]=yuvData[1] +VideoWidth*VideoHeight/4;
int pDstStepYVU[3] = {VideoWidth, VideoWidth/2, VideoWidth/2};
retValue = ippiRGBToYCbCr420_8u_C3P3R(cRGB24Data, srcStep, yuvData, pDstStepYVU, srcSize);
and retValue is success.
How can I get the size of the cYUVData aftertheabove function call so that I can validate the YUV data by writing to a file.
Pls help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
It looks the input and output image size is different.
In color conversion functions, the input and out function have the same size. It has no functionality to resize the image.
You need to call IPP resize function (ippiResizeSqrPixel_) first to change the image size to 176x144, then call color conversion function.
Thanks,
Chao
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And size is defined by width and height of your RGB image, meaning for 420 sampling you will have Y plane with the same width and height, and U and V planes with width/2 and height/2.
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for you response.
Are my above RGB to YUV conversion code is correct if the bitmap(RGB24) buffer size is 176x144?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
It looks fine for me. The BMP data in the memory is possilly in BGR order. If this is your case, it need to call ippiBGRToYCrCb420_8u_C3P3R(..) function.
Thanks,
Chao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a raw RGB24 bitmap buffer of size 640x480(921600 bytes) from a web cam callback function that i want to convert to YUV format of size 176x144. I tried it as follows.
int VideoWidth=176,VideoHeight=144,FrameNumber=1;
int nMaxYUVSize = (VideoWidth*VideoHeight + (VideoWidth*VideoHeight)/2);
Ipp8u *cYUVData = ippsMalloc_8u(nMaxYUVSize);
Ipp8u *cRGB24Data = ippsMalloc_8u(921600); and cRGB24Data is filled with raw bitmap from webcam callback function
IppStatus retValue;
Ipp8u * yuvData[3];
IppiSize srcSize={VideoWidth, VideoHeight};
int srcStep = VideoWidth*3;
yuvData[0]=cYUVData;
yuvData[1]=yuvData[0] +VideoWidth*VideoHeight;
yuvData[2]=yuvData[1] +VideoWidth*VideoHeight/4;
int pDstStepYVU[3] = {VideoWidth, VideoWidth/2, VideoWidth/2};
retValue = ippiRGBToYCbCr420_8u_C3P3R(cRGB24Data, srcStep,yuvData, pDstStepYVU, srcSize);
eventhough retValue == ippStsNoErr, the yuvData appears to be wrong.
What is wrong with the above method?
Somebody please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
It looks the input and output image size is different.
In color conversion functions, the input and out function have the same size. It has no functionality to resize the image.
You need to call IPP resize function (ippiResizeSqrPixel_) first to change the image size to 176x144, then call color conversion function.
Thanks,
Chao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the help. WhenI resize the image the issue solved.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page