Hi Guys,
I need help in extracting Y data and UV data from output decoded buffer which in QOMX_COLOR_FormatYUV420PackedSemiPlanar format for my application in Android 4.0 ( ICS)
I am using qcom_video_codec_sample_1_3_1 as reference in my application.
I have implemented an optmized rendering framework for my application since OpenMAx doesnt support in ICS.
I am successfully able to render video from a sample yuv file.
But when i try to extract YUV data from output buffer that i get from OMX in FillBufferDone callback i get erroneous render output.
My Video details are
Width : 1280
Height : 720
OMX allocates output buffers of size 1433600 bytes.
How do extract Y data and UV data from this 1433600 bytes.
In output callback(info->mFrameData, info->mFrameSize, info->mBuffer),
I tried extracting the first (width * height) bytes as luminance from (info->mFrameData) but i get wrong output.
Can someone please give me details on QOMX_COLOR_FormatYUV420PackedSemiPlanar format.
Thanks
QOMX_COLOR_FormatYUV420PackedSemiPlanar is not exactly YUV420. It's NV21 or YV12 in new OMX IL versions.
It's two different formats, but you can view how to work with it in frameworks/base/media/libstagefright/colorconversion/ColorConverter.cpp This file contains color conversion functions from this formats to RGB565.
Shortly, NV21 has Width * Height Y buffer, and Width * Height / 2 UV buffer parts. UV are interlaced(one line from UV used for two Y lines).
YV12 are more difficult. It has same buffer parts sizes, but U and V buffers are following each other. One line from UV buffers contains Width / 2 bytes of V component, than same size of U component data. Color components are interlaxed too.