Results 1 to 6 of 6

Thread: OMX_COLOR_FormatYUV420SemiPlanar/YUV420Planar fourcc fmts

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    3

    OMX_COLOR_FormatYUV420SemiPlanar/YUV420Planar fourcc fmts

    Just curious if anyone knows how OMX_COLOR_FormatYUV420SemiPlanar and OMX_COLOR_FormatYUV420Planar map to the fourcc defined formats. The OMX IL spec doesn't explicitly define the ordering for "U" anv "V" components.

    The spec defines OMX_COLOR_FormatYUV420Planar as:

    YUV planar format, organized with three separate planes for each color component, namely Y, U, and V. U and V pixels are subsampled by a factor of two both horizontally and vertically.

    The spec defines OMX_COLOR_FormatYUV420SemiPlanar as:

    YUV planar format, organized with a first plane containing Y pixels, and a second plane containing interleaved U and V pixels. U and V pixels are subsampled by a factor of two both horizontally and vertically

    Assuming U and V are listed in the order in which the components appear in the YUV buffer, then OMX_COLOR_FormatYUV420Planar maps to Fourcc I420 (duplicate of IYUV) and OMX_COLOR_FormatYUV420SemiPlanar maps to Fourcc NV12.

    The reason I ask this is because it seems that some companies have used OMX_COLOR_FormatYUV420SemiPlanar with NV12 and NV21 interchangeably, which is to say that one (or some) of these companies are wrong. And the IL spec isn't 100% clear without making some assumption.

    To make matters even more confusing, StageFright (Android) seems to map PIXEL_FORMAT_YUV420SP to NV21 and PIXEL_FORMAT_YUV420P to YV12 (opposed to I420/IYUV). Obviously, PIXEL_FORMAT_YUV420SP maps to OMX_COLOR_FormatYUV420SemiPlanar, and PIXEL_FORMAT_YUV420P maps to OMX_COLOR_FormatYUV420Planar. Could Google have messed up here?

    Hope that someone can help clarify some of these details.

  2. #2
    Junior Member
    Join Date
    Jun 2012
    Posts
    3

    Re: OMX_COLOR_FormatYUV420SemiPlanar/YUV420Planar fourcc fmt

    I think I can hear crickets

  3. #3
    Administrator khronos's Avatar
    Join Date
    Jun 2002
    Location
    Montreal
    Posts
    55

    Re: OMX_COLOR_FormatYUV420SemiPlanar/YUV420Planar fourcc fmt

    Hi,

    I've pinged the OpenMAX work group to see if they can get to your question soon. Thanks for your patience.

  4. #4
    Junior Member
    Join Date
    Jul 2012
    Posts
    4

    Re: OMX_COLOR_FormatYUV420SemiPlanar/YUV420Planar fourcc fmt

    Hi,

    This color format description seems to come from an old version of specification. The issue of U and V ordering should have been corrected in version 1.1.2 and later, which include the following text:

    OMX_COLOR_FormatYUV420Planar:

    "YUV planar format, organized with three separate planes for each color component, namely Y, U, and V appearing in this order. U and V pixels are sub-sampled by a factor of two both horizontally and vertically."

    OMX_COLOR_FormatYUV420SemiPlanar:

    "YUV planar format, organized with a first plane containing Y pixels, and a second plane containing U and V pixels interleaved with the first U value first. U and V pixels are sub-sampled by a factor of two both horizontally and vertically."

    I hope this new text fully clarify the U and V ordering, and, more generically, the description of the format. If there is still something unclear, please do not hesitate to let us know.

  5. #5
    Junior Member
    Join Date
    Jul 2012
    Posts
    1

    Re: OMX_COLOR_FormatYUV420SemiPlanar/YUV420Planar fourcc fmt

    I agree with tvu. The U and V ordering are clarified in spec version 1.1.2 and later versions.

    In spec 1.2, new color format OMX_COLOR_FormatYVU420SemiPlanar is added
    which is defined as:
    YVU planar format, organized with a first plane containing Y pixels, and a
    second plane containing V and U pixels interleaved with the first V
    value first
    . V and U pixels are subsampled by a factor of two both
    horizontally and vertically.

    OMX_COLOR_FormatYVU420Planar is also added. It is same as OMX_COLOR_FormatYUV420Planar except that the ordering of
    U and V planes are reversed.

    So the mapping of OMX Color formats and fourcc formats w.r.t the YUV data arrangement would be:
    OMX_COLOR_FormatYUV420SemiPlanar --- NV12
    OMX_COLOR_FormatYUV420Planar --- IYUV or I420
    OMX_COLOR_FormatYVU420SemiPlanar --- NV21
    OMX_COLOR_FormatYVU420Planar --- YV12

    In ICS Android (StageFright) this mapping is being followed - PIXEL_FORMAT_YUV420P is being mapped to OMX_COLOR_FormatYUV420Planar
    and PIXEL_FORMAT_YUV420SP is mapped to OMX_COLOR_FormatYUV420SemiPlanar.
    This mapping can be seen in the function getColorFormat() in {$ANDROID_ROOT}/framework/base/media/libstagefright/CameraSource.cpp.

    I understand that the comments in {$ANDROID_ROOT}/framework/base/include/camera/CameraParameters.h may be a bit confusing because here PIXEL_FORMAT_YUV420SP is referred as NV21 and PIXEL_FORMAT_YUV420P as YV12. But as far as the actual mapping in the code is concerned, it is proper.

  6. #6
    Junior Member
    Join Date
    Jun 2012
    Posts
    3

    Re: OMX_COLOR_FormatYUV420SemiPlanar/YUV420Planar fourcc fmt

    Quote Originally Posted by svarier
    I agree with tvu. The U and V ordering are clarified in spec version 1.1.2 and later versions.
    They are. Thanks. I didn't actually know there was a 1.1.2 until now.

    Quote Originally Posted by svarier
    So the mapping of OMX Color formats and fourcc formats w.r.t the YUV data arrangement would be:
    OMX_COLOR_FormatYUV420SemiPlanar --- NV12
    OMX_COLOR_FormatYUV420Planar --- IYUV or I420
    OMX_COLOR_FormatYVU420SemiPlanar --- NV21
    OMX_COLOR_FormatYVU420Planar --- YV12
    Nice to see that 1.1.2 has both NV12 and NV21.

    Quote Originally Posted by svarier
    I understand that the comments in {$ANDROID_ROOT}/framework/base/include/camera/CameraParameters.h may be a bit confusing because here PIXEL_FORMAT_YUV420SP is referred as NV21 and PIXEL_FORMAT_YUV420P as YV12. But as far as the actual mapping in the code is concerned, it is proper.
    I wouldn't consider this proper. The names may match up, but the comment is misleading, or perhaps inaccurate. If PIXEL_FORMAT_YUV420SP is indeed NV21 as the comment says, then the mapping is wrong solely based on intention. At this point it's unclear what Google's intention really is.

    I've worked for two different companies now where there was a good deal of confusion regarding the actual chroma ordering and OMX<-->Android mapping. Hopefully Google will clarify this in upcoming JellyBean updates or future Android releases.

    Thanks for the responses everyone.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •