Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: COLOR_FormatYUV420Flexible transfer to RGB

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2017
    Posts
    1

    COLOR_FormatYUV420Flexible transfer to RGB

    I want to use GLSL to transfer YUV420 to RGB. But there have some problems when I start it. Android MediaCodecInfo.CodecCapabilities one constant is COLOR_FormatYUV420Flexible. This format corresponds to YUV_420_888, and can represent the COLOR_FormatYUV411Planar, COLOR_FormatYUV411PackedPlanar, COLOR_FormatYUV420Planar, COLOR_FormatYUV420PackedPlanar, COLOR_FormatYUV420SemiPlanar and COLOR_FormatYUV420PackedSemiPlanar formats. So different formats have different methods in YUV420 to RGB which writing in fragment shader.
    I want to know the different methods in different formats YUV420 to RGB. Who can help me?

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,124
    Quote Originally Posted by Miss.shi View Post
    I want to use GLSL to transfer YUV420 to RGB. ... corresponds to YUV_420_888
    ... different formats have different methods in YUV420 to RGB which writing in fragment shader.

    I want to know the different methods in different formats YUV420 to RGB. Who can help me?
    It sounds like step 1 is to get to know the Android MediaCodec better (more links: LINK, LINK, LINK), so that you know which texel encodings and orderings you minimally need to support.

    From this, it sounds like all of those other formats you mentioned are deprecated, so you might not even need to support anything but COLOR_FormatYUV420Flexible:

    public static final int COLOR_FormatYUV420Flexible
    Added in API level 21

    Flexible 12 bits per pixel, subsampled YUV color format with 8-bit chroma and luma components.

    Chroma planes are subsampled by 2 both horizontally and vertically. Use this format with Image. This format corresponds to YUV_420_888, and can represent the [deprecated formats] COLOR_FormatYUV411Planar, COLOR_FormatYUV411PackedPlanar, COLOR_FormatYUV420Planar, COLOR_FormatYUV420PackedPlanar, COLOR_FormatYUV420SemiPlanar and COLOR_FormatYUV420PackedSemiPlanar
    Once you determine that, then the GLSL shader logic you need to convert to RGB should be pretty clear, since you'll know exactly how the memory is laid out. The GLSL source code might even be contained in one of the links I posted above.

    By the way, if you don't get the answer you're looking for here, you might try posting on an Android and/or OpenGL ES forum. You're more likely to catch the eyes of devs familiar with MediaCodec there.
    Last edited by Dark Photon; 10-16-2017 at 05:43 AM.

Posting Permissions

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