[MUSIC PLAYING]
RAY TIONG: Hi, I'm Ray Tiong, developer relations engineer
for Android Camera.
In this talk, we'll walk through how
to implement HDR 10-bit video.
High Dynamic Range, or HDR, allows
for higher contrast and more colors
over today's standard dynamic range.
Here we compare two images.
Notice that the HDR photo represents
more of the tones of the scene and has a sharper contrast.
On devices that support HDR, you'll also
notice that the sun is noticeably brighter,
and the shadows are noticeably darker.
This is due to the ability to have wider range of nits,
or brightness data, per pixel.
In this comparison, you'll notice
that the 10-bit photo is smoother and more
realistic than the 8-bit photo.
This is because we have additional bits that we can now
use to capture and represent more of the natural colors that
actually exists.
In SDR, these out-of-range colors
are mapped to the closest 8-bit color that is in range.
This can, in many cases, create artifacts, such as banding,
as you see here.
HDR allows you to capture media with more color and contrast
accuracy due to the fact that more data can be represented.
In the remainder of this Tech Talk,
we'll go through how to capture, play back, and share 10-bit HDR
video on Android.
Let's talk about capture.
First, we need to check for HDR support.
Note that in-app capture is only available on supported devices,
and these devices must be running Android [? T ?]
or later.
Here we check to see if 10-bit range is supported.
We also check to see if the profile that we want
is available.
For instance, we check for HLG.
Now, let's set up the capture session.
We set the output configuration to the profile that we want.
Again, in this example, we set the profile to HLG.
If we're using media codec, we'll
want to correctly configure the API to avoid any color issues.
We'll set the transfer, profile, color, format,
and other properties, as shown here.
Great.
Now let's look at playback.
Please know that TextureView will only
be displayed in 8-bit.
Any HDR content you give to TextureView
will be shown in 8-bit.
The quality of the final results will
depend on the device's underlying transcoding
implementation.
For this reason, we recommend that you either
migrate to a view that supports 10-bit,
such as SurfaceView or ExoPlayer.
Or if you wish to continue to support TextureView,
explicitly transcode your 10-bit content to 8-bit SDR.
We'll review how to treat your 10-bit content so that it's
available for 8-bit use, such as TextureView,
later in this talk.
Also note that ExoPlayer supports
HDR playback by default. If you are using SurfaceView,
we recommend using MediaCodec.
OK, let's get back to coding.
First, let's check the device's display capability.
Here we check that the display can support HLG.
Then we'll need to configure the MediaCodec.
Here we set the decoder to HEVC, which supports HLG.
And that's it.
As mentioned, you may want to share your content,
for example, to devices that do not support 10-bit.
We'll walk through just how to do that.
To ensure you retain the highest quality media in 8-bit,
you'll want to transcode them properly.
Luckily, Transformer makes us easy.
We do this by passing the media through Transformer
and enabling SDR tone mapping.
The library will take care of the rest for you.
Also, stay tuned for HDR support in CameraX,
coming in a next alpha releases of the API.
There you have it-- from capturing,
playback, to sharing.
We hope you enjoyed this walkthrough.
Give it a try, and let us know what you think.
Thank you.
[MUSIC PLAYING]