ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Max brightness is not achieved in Sony Xperia 1 IV

Open Shrihari1428 opened this issue 3 years ago • 2 comments

Hi All,

Currently I render the video frames using extensions(OpenGL to render the frames) with exoplayer. I have noticed that when playing videos natively the max brightness achieved is around 1000 nits. But when I render the frames using extensions I get only around 600 nits. Any help is appreciated

Thanking you in prior!

Shrihari1428 avatar Aug 29 '22 18:08 Shrihari1428

I'm assuming the input media is HDR (probably HLG given this is a Sony device), but please let me know if that's wrong. I think what's going on is:

  • When rendering from MediaCodec to a SurfaceView the data space (color space, transfer function and range) gets propagated to the surface flinger automatically, so the media gets displayed in high dynamic range.
  • When rendering via OpenGL using the decoder extensions this signaling doesn't happen automatically. It should be possible to signal the color space to the EGLSurface wrapping the output Surface using EGL_EXT_gl_colorspace_bt2020_pq for example. It's also necessary to make sure the decoder is actually outputting 10-bit color buffers, and then convert to the right transfer function for display (in this case PQ). Caveat: I haven't tried this so not 100% sure it will work.

I'll mark this as an enhancement but it's unlikely we'll get round to it soon.

andrewlewis avatar Aug 31 '22 14:08 andrewlewis

Hi andrew,

Thanks for the reply. I tried wrapping up the EGL Surface with the EGL_EXT_gl_colorspace_bt2020_pq colorspace. But the brightness still seems to be low. Is there any other fix for this?

Shrihari1428 avatar Sep 10 '22 14:09 Shrihari1428

Sorry for the delay. When configuring the HDR color space on the EGLSurface did you also scale the output values to match the PQ transfer function? Also, side note, it's necessary to use a SurfaceView (not TextureView) to get HDR output.

andrewlewis avatar Nov 07 '22 14:11 andrewlewis

Hi Lewis, could I get a sample code on how we scale the output values?

Shrihari1428 avatar Nov 07 '22 14:11 Shrihari1428

We don't have sample code for this yet, but we will almost certainly add similar code using that GL extension probably in early 2023 (we are planning to support applying GL-based effects to MediaCodec output, initially for SDR and then HDR).

andrewlewis avatar Nov 07 '22 18:11 andrewlewis