Posted by John Reck – Software program Engineer
For Android builders, delivering distinctive visible experiences is a steady aim. Excessive Dynamic Vary (HDR) unlocks new prospects, providing the potential for extra vibrant and immersive content material. Applied sciences like UltraHDR on Android are significantly compelling, offering the advantages of HDR shows whereas sustaining essential backwards compatibility with SDR shows. On Android you should utilize HDR for each video and pictures.
Through the years, the time period HDR has been used to indicate quite a lot of associated, however finally distinct visible constancy options. Customers encounter it within the context of digital camera options (publicity fusion), or as a advertising and marketing time period in TV or monitor (“HDR succesful”). This conflates distinct options like wider colour gamuts, elevated bit depth or enhanced distinction with HDR itself.
From an Android Graphics perspective, HDR primarily signifies larger peak brightness functionality that extends past the traditional Commonplace Dynamic Vary. Different perceived advantages usually derive from requirements comparable to HDR10 or Dolby Imaginative and prescient which additionally embrace the utilization of wider colour areas, larger bit depths, and particular switch features.
On this article, we’ll set up the foundational colour rules, then deal with frequent myths, make clear HDR’s position within the rendering pipeline, and study how Android’s show applied sciences and APIs allow HDR expertise.
The elements of colour
Understanding HDR begins with defining the three major elements that type the displayed quantity of colour: bit depth, switch perform, and colour gamut. These describe the precision, scaling, and vary of the colour quantity, respectively.
Whereas a colour mannequin defines the format for encoding pixel values (e.g., RGB, YUV, HSL, CMYK, XYZ), RGB is usually assumed in a graphics context. The mix of a colour mannequin, a colour gamut, and a switch perform constitutes colour area. Examples embrace sRGB, Show P3, Adobe RGB, BT.2020, or BT.2020 HLG. Quite a few combos of colour gamut and switch perform are attainable, resulting in quite a lot of colour areas.

Bit Depth
Bit depth defines the precision of colour illustration. A better bit depth permits for finer gradation between colour values. In trendy graphics, bit depth sometimes refers to bits per channel (e.g., an 8-bit picture makes use of 8 bits for every crimson, inexperienced, blue, and optionally alpha channel).
Crucially, bit depth doesn’t decide the general vary of colours (minimal and most values) a picture can characterize; that is set by the colour gamut and, in HDR, the switch perform. As a substitute, rising bit depth gives extra discrete steps inside that outlined vary, leading to smoother transitions and lowered visible artifacts comparable to banding in gradients.
5-bit

8-bit

Though 8-bit is among the most typical codecs in widespread utilization, it’s not the one choice. RAW photographs may be captured at 10, 12, 14, or 16 bits. PNG helps 16 bits. Video games regularly use 16-bit floating level (FP16) as a substitute of integer area for intermediate render buffers. Trendy GPU APIs like Vulkan even assist 64-bit RGBA codecs in each integer and floating level varieties, offering as much as 256-bits per pixel.
Switch Operate
A switch perform defines the mathematical relationship between a pixel’s saved numerical worth and its closing displayed luminance or colour. In different phrases, the switch perform describes find out how to interpret the increments in values between the minimal and most. This perform is important as a result of the human visible system’s response to gentle depth is non-linear. We’re extra delicate to adjustments in luminance at low gentle ranges than at excessive gentle ranges. Due to this fact, a linear mapping from saved values to show luminance wouldn’t lead to an environment friendly utilization of the obtainable bits. There could be greater than vital precision within the brighter area and too little within the darker area with respect to what’s perceptual. The switch perform compensates for this non-linearity by adjusting the luminance values to match the human visible response.
Whereas some switch features are linear, most make use of advanced curves or piecewise features to optimize picture high quality for particular shows or viewing circumstances. sRGB, Gamma 2.2, HLG, and PQ are frequent examples, every prioritizing bit allocation in a different way throughout the luminance vary.
Shade Gamut
Shade gamut refers back to the whole vary of colours {that a} explicit colour area or gadget can precisely reproduce. It’s sometimes a subset of the seen colour spectrum, which encompasses all the colours that the human eye can understand. Every colour area (e.g., sRGB, Show P3, BT2020) defines its personal distinctive gamut, establishing the boundaries for colour illustration.
A wider gamut signifies that the colour area can show a better number of colours, resulting in richer and extra vibrant photographs. Nevertheless, merely having a bigger gamut would not at all times assure higher colour accuracy or a extra vibrant outcome. The gadget or medium used to show the colours should even be able to reproducing the total vary of the gamut. When a show encounters colours exterior its reproducible gamut, the standard dealing with technique is clipping. That is to make sure that in-gamut colours are correctly preserved for accuracy, as in any other case makes an attempt to scale the colour gamut might produce disagreeable outcomes, significantly in areas through which human imaginative and prescient is especially delicate like pores and skin tones.
HDR myths and realities
With an understanding of what kinds the fundamental working colour rules, it’s now time to guage a few of the frequent claims of HDR and the way they apply in a normal graphics context.
Declare: HDR presents extra vibrant colours
This declare comes from HDR video sometimes utilizing the BT2020 colour area, which is certainly a large colour quantity. Nevertheless, there are a number of issues with this declare as a blanket assertion.
The primary is that photographs and graphics have been ready to make use of wider colour gamuts, comparable to Show P3 or Adobe RGB, for fairly a very long time now. This isn’t a singular development that was coupled to HDR. In JPEGs for instance that is outlined by the ICC profile, which dates again to the early Nineteen Nineties, though wide-spread adoption of ICC profile dealing with is considerably more moderen. Equally on the graphics rendering facet the utilization of wider colour areas is absolutely decoupled from whether or not or not HDR is getting used.
The second is that not all HDR movies even use such a wider gamut in any respect. Though HDR10 specifies the utilization of BT2020, different HDR codecs have since been created that don’t use such a large gamut.
The most important situation, although, is considered one of capturing and displaying. Simply because the format permits for the colour gamut of BT2020 doesn’t imply that your complete gamut is definitely usable in follow. For instance present Dolby Imaginative and prescient mastering pointers solely require a 99% protection of the P3 gamut. Which means that even for high-end skilled content material, it’s not anticipated that the authoring of content material past that of Show P3 is feasible. Equally, the overwhelming majority of shopper shows immediately are solely able to displaying both sRGB or Show P3 colour gamuts. On condition that the standard advice of out-of-gamut colours is to clip them, which means that regardless that HDR10 permits for as much as BT2020 gamut, the widest gamut in follow continues to be going to be P3.
Thus this declare ought to actually be thought of one thing supplied by HDR video profiles when in comparison with SDR video profiles particularly, though SDR movies may use wider gamuts if desired with out utilizing an HDR profile.
Declare: HDR presents extra distinction / higher black element
One of many advantages of HDR typically claimed is darkish blacks (e.g. Dolby Imaginative and prescient Demo #3 – Core Universe – 4K HDR or “Darkish scenes come alive with darker darks” ) or extra element at nighttime areas. That is even mirrored in BT.2390: “HDR additionally permits for decrease black ranges than conventional SDR, which was sometimes within the vary between 0.1 and 1.0 cd/m2 for cathode ray tubes (CRTs) and is now within the vary of 0.1 cd/m2 for most traditional SDR liquid crystal shows (LCDs).” Nevertheless, in actuality no show makes an attempt to indicate something however SDR black because the blackest black the show is bodily able to. Thus there is no such thing as a distinction between HDR or SDR when it comes to how darkish it could possibly attain – each backside out on the similar darkish stage on the identical show.
As for distinction ratio, as that’s the ratio between the brightest white and the darkest black, it’s overwhelmingly influenced by how darkish a show can get. With the prevalence of OLED shows, significantly within the cell area, each SDR and HDR have the identical distinction ratio consequently, as they each have basically excellent black ranges giving them infinite distinction ratios.
The PQ switch perform does allocate extra bits to the darkish area, so in idea it could possibly convey higher black element. Nevertheless, it is a distinctive side of PQ moderately than a characteristic of HDR. HLG is more and more the extra frequent HDR format as it’s most well-liked by cell cameras in addition to a number of excessive finish cameras. And whereas PQ might include this element, that doesn’t imply the HDR show can essentially show it anyway, as mentioned in Show Realities.
Declare: HDR presents larger bit depth
This declare comes from HDR10 and a few, however not all, Dolby Imaginative and prescient profiles utilizing 10 or 12-bits for the video stream. Just like extra vibrant colours, that is actually simply a facet of explicit video profiles moderately than one thing HDR itself inherently gives or is coupled to HDR. The utilization of 10-bits or extra is in any other case not unusual in imaging, significantly within the larger finish images world, with RAW and TIFF picture codecs able to having 10, 12, 14, or 16-bits. Equally, PNG helps 16-bits, though that’s hardly ever used.
Declare: HDR presents larger peak brightness
This then, is all that HDR actually is. However what does “larger peak brightness” actually imply? In any case, SDR shows have been pushing ever rising brightness ranges earlier than HDR was important, significantly for daylight viewing. And even with out that, what’s the distinction between “HDR” and simply “SDR with the brightness slider cranked up”? The reply is that we outline “HDR” as having a brightness vary greater than SDR, and we consider SDR as being the vary pushed by autobrightness to be comfortably readable within the present ambient circumstances. Thus we outline HDR when it comes to issues like “HDR headroom” or “HDR/SDR ratio” to point it’s a floating area relative to SDR. This makes brightness insurance policies simpler to motive about. Nevertheless, it does complicate the interplay with conventional HDR comparable to that utilized in video, particularly HLG and PQ content material.
PQ/HLG switch features
PQ and HLG characterize the 2 most typical approaches to HDR when it comes to video content material. They characterize two switch features that characterize totally different ideas of what’s “HDR.” PQ, revealed as SMPTE ST 2084:2014, is outlined when it comes to absolute nits within the show. The expectation is that it encodes from 0 to 10,000 nits, and expects to be mastered for a selected reference viewing atmosphere. HLG takes a special method, as a substitute opting to take a typical gamma curve for a part of the vary earlier than switching to logarithmic for the brighter portion. This has a claimed nominal peak brightness of 1000 nits within the reference atmosphere, though it’s not outlined in absolute luminance phrases like PQ is.
Trade-wide specs have not too long ago formalized the brightness vary of each PQ- and HLG-encoded content material in relation to SDR. ITU-R BT. 2408-8 defines the reference white stage for graphics to be 203 nits. ISO/TS 22028-5 and ISO/PRF 21496-1 have adopted go well with; 21496-1 particularly defines HDR headroom when it comes to nominal peak luminance, relative to a diffuse white luminance at 203 nits.
The realities of contemporary shows, mentioned under, in addition to typical viewing environments imply that conventional HDR video are almost by no means displayed as supposed. A show’s HDR headroom might evaporate underneath brilliant viewing circumstances, demanding an on-demand tonemapping into SDR. Conventional HDR video encodes a set headroom, whereas trendy shows make use of a dynamic headroom, leading to huge variations in video high quality even on the identical show.
Show Realities
To this point many of the dialogue round HDR has been from the angle of the content material. Nevertheless, customers eat content material on a show, which has its personal capabilities and extra importantly limits. A high-end cell show is prone to have traits comparable to gamma 2.2, P3 gamut, and a peak brightness of round 2000 nits. If we then think about one thing like HDR10 there are mismatches in bit utilization prioritization:
- PQ’s elevated bit allocation on the decrease ranges finally ends up being wasted
- The utilization of BT2020 finally ends up spending bits on components of a gamut that may by no means be displayed
- Encoding as much as 10,000 nits of brightness is equally headroom that’s not utilized
These mismatches will not be inherently an issue, nevertheless, but it surely implies that as 10-bit shows grow to be extra frequent the prevailing 10-bit HDR video profiles are unable to truly benefit from the total show’s capabilities. Thus HDR video profiles are ready of concurrently being ahead wanting whereas additionally already being unable to maximise a present 10-bit show’s capabilities. That is the place know-how comparable to Extremely HDR or gainmaps typically present a compelling different. Regardless of typically utilizing an 8-bit base picture, as a result of the achieve layer that transforms it to HDR is specialised to the content material and its explicit vary wants it’s extra environment friendly with its bit utilization, resulting in outcomes that also look gorgeous. And as that base picture is upgraded to 10-bit with newer picture codecs comparable to AVIF, the efficient bit utilization is even higher than these of typical HDR video codecs. Thus these approaches don’t characterize evolutionary or stepping stones to “true HDR”, however moderately are additionally an enchancment on HDR along with having higher backwards compatibility. Equally Android’s UI toolkit’s utilization of the extendedRangeBrightness API truly nonetheless primarily occurs in 8-bit area. As a result of the rendering is tailor-made to the particular show and present circumstances it’s nonetheless attainable to have an excellent HDR expertise regardless of the utilization of RGBA_8888.
Unlocking HDR on Android: Subsequent steps
Excessive Dynamic Vary (HDR) presents development in visible constancy for Android builders, transferring past the normal constraints of Commonplace Dynamic Vary (SDR) by enabling larger peak brightness.
By understanding the core elements of colour – bit depth, switch perform, and colour gamut – and debunking frequent myths, builders can leverage applied sciences like Extremely HDR to ship actually immersive experiences which are each visually gorgeous and backward suitable.
In our subsequent article, we’ll delve into the nuances of HDR and consumer intent, exploring find out how to optimize your content material for various show capabilities and viewing environments.