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?

[QUOTE=Miss.shi;1288955]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?[/QUOTE]

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.