2

I want to do tone-mapping of HDR10 on Android use OpenGL ES, the first thing is to get the frame data. On Android after video decoded by mediacodec, its data is on an external oes texture, I want to know what the internal format of the texture is when decoding hdr10 video.

Can I get 10bit data from this external oes texture, and if possible, how to handle the 10bit data in OpenGL ES (using float texture?).

I have tried to query the format of the texture, but failed, the value reported seems not correct. And so as the width and height of the texture.

glGetTexLevelParameteriv(GL_TEXTURE_EXTERNAL_OES, 0, GL_TEXTURE_INTERNAL_FORMAT, &format);
wchen61
  • 93
  • 4
  • do you have any update on this? Did you managed to process in any way a hdr10 video using OpenGL ES? – Alexandru Jul 29 '20 at 07:41
  • There are two choice on this, 1. Decode with MediaCodec and handle the data with opengles.(maybe the data is downsample to 8bit, but the color is ok). 2. Decode with MediaCodec and rendering with SurfaceView directlly like @why suggessted. – wchen61 Sep 06 '20 at 08:00

2 Answers2

1

In general for YUV you need to use an external sampler, which will include color conversion to RGB. There is no standard for what the Android memory layout is for YUV surfaces, in particular for 10-bit where there are multiple competing "standards", so anything you do here which touches the raw YUV data is going to be non-portable and device specific.

Does the rgb value I get match the 10 bit value in HDR video?

It should be a color converted representation of the 10-bit value, assuming it's been converted correctly. I obviously have no way to verify it, and there isn't a tight specification here. Could you just be getting an 8-bit equivalent? Yes, that's certainly possible.

solidpixel
  • 10,688
  • 1
  • 20
  • 33
  • Thanks @solidpixel, I want to know if it is possible to use mediacodec decode HDR10 video, and then handle the external oes texture in OpenGL ES for tone-mapping. I mean in my shader program, i can read the pixel like this. ``` uniform samplerExternalOES u_texture; vec3 rgb = texture(u_texture,v_tex_coord_out).rgb; ``` Does the rgb value I get is the 10 bit value in HDR video? – wchen61 Feb 24 '20 at 12:58
  • Sorry for the poor format, as I first use this website. :) I mean the rgb value is already normalized value 0~1, I do not know it's precision is 8bit or 10bit. – wchen61 Feb 24 '20 at 13:11
0

you can't get 10bits data from oes texture. we can not set oes texture format(eg,float texture). You can verify this process by outputting oes texture to fbo. Actually oes is 8bits.

why
  • 9
  • 1
  • You mean Android OES always 8bit texture? I actually want to know to play with 10bit video on Android with mediacodec? – wchen61 Jun 22 '20 at 09:46
  • Yes, so far OES is indeed 8bits. I used 8bits and 10bits data to the meidacodec, but I can only get 8 bits(that is RGBA8). If you want to play 10bits video, you can not use mediacodec + opengl es. Mediacodec decoding and rendering is a good choice. – why Jun 23 '20 at 12:26