Forums - Extract Y data from decoded buffer which is QOMX_COLOR_FormatYUV420PackedSemiPlanar format

2 posts / 0 new
Last post
Extract Y data from decoded buffer which is QOMX_COLOR_FormatYUV420PackedSemiPlanar format
vinit.adkar
Join Date: 22 Oct 12
Posts: 1
Posted: Thu, 2012-10-25 19:40

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 

 

  • Up0
  • Down0
Ganster41
Join Date: 29 Jul 11
Posts: 3
Posted: Fri, 2012-10-26 06:58

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.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.