Posted by John Reck – Software program Engineer
For Android builders, delivering distinctive visible experiences is a steady aim. Excessive Dynamic Vary (HDR) unlocks new potentialities, 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 use HDR for each video and pictures.
Over time, the time period HDR has been used to indicate quite a few associated, however finally distinct visible constancy options. Customers encounter it within the context of digicam 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 increased peak brightness functionality that extends past the traditional Normal Dynamic Vary. Different perceived advantages usually derive from requirements reminiscent of HDR10 or Dolby Imaginative and prescient which additionally embrace the utilization of wider colour areas, increased 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 function within the rendering pipeline, and study how Android’s show applied sciences and APIs allow HDR expertise.
The parts of colour
Understanding HDR begins with defining the three major parts that kind 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 mixtures of colour gamut and switch perform are attainable, resulting in a wide range 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 purple, inexperienced, blue, and optionally alpha channel).
Crucially, bit depth doesn’t decide the general vary of colours (minimal and most values) a picture can signify; that is set by the colour gamut and, in HDR, the switch perform. As a substitute, rising bit depth offers extra discrete steps inside that outlined vary, leading to smoother transitions and decreased visible artifacts reminiscent of banding in gradients.
5-bit
8-bit
Though 8-bit is without doubt one of the commonest codecs in widespread utilization, it’s not the one choice. RAW pictures will be captured at 10, 12, 14, or 16 bits. PNG helps 16 bits. Video games continuously use 16-bit floating level (FP16) as an alternative of integer area for intermediate render buffers. Fashionable GPU APIs like Vulkan even help 64-bit RGBA codecs in each integer and floating level varieties, offering as much as 256-bits per pixel.
Switch Perform
A switch perform defines the mathematical relationship between a pixel’s saved numerical worth and its remaining 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 crucial 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. Subsequently, 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 mandatory 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 situations. sRGB, Gamma 2.2, HLG, and PQ are frequent examples, every prioritizing bit allocation in a different way throughout the luminance vary.
Colour Gamut
Colour gamut refers back to the complete vary of colours {that a} specific 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 higher number of colours, resulting in richer and extra vibrant pictures. Nonetheless, 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 everyday dealing with methodology 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 wherein human imaginative and prescient is especially delicate like pores and skin tones.
HDR myths and realities
With an understanding of what varieties the fundamental working colour rules, it’s now time to judge among the frequent claims of HDR and the way they apply in a common graphics context.
Declare: HDR gives extra vibrant colours
This declare comes from HDR video sometimes utilizing the BT2020 colour area, which is certainly a large colour quantity. Nonetheless, there are a number of issues with this declare as a blanket assertion.
The primary is that pictures and graphics have been ready to make use of wider colour gamuts, reminiscent of 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 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 problem, although, is considered one of capturing and displaying. Simply because the format permits for the colour gamut of BT2020 doesn’t imply that all the gamut is definitely usable in follow. For instance present Dolby Imaginative and prescient mastering tips 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 client shows right this moment are solely able to displaying both sRGB or Show P3 colour gamuts. Provided that the everyday suggestion of out-of-gamut colours is to clip them, which means though HDR10 permits for as much as BT2020 gamut, the widest gamut in follow remains to be going to be P3.
Thus this declare ought to actually be thought of one thing provided by HDR video profiles when in comparison with SDR video profiles particularly, though SDR movies might use wider gamuts if desired with out utilizing an HDR profile.
Declare: HDR gives 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).” Nonetheless, in actuality no show makes an attempt to point out something however SDR black because the blackest black the show is bodily able to. Thus there isn’t any distinction between HDR or SDR when it comes to how darkish it will possibly attain – each backside out on the identical 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 cellular area, each SDR and HDR have the identical distinction ratio because of this, as they each have basically good black ranges giving them infinite distinction ratios.
The PQ switch perform does allocate extra bits to the darkish area, so in idea it will possibly convey higher black element. Nonetheless, it is a distinctive facet of PQ relatively than a characteristic of HDR. HLG is more and more the extra frequent HDR format as it’s most well-liked by cellular 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 gives increased 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. Much like extra vibrant colours, that is actually simply a side of specific video profiles relatively than one thing HDR itself inherently offers or is coupled to HDR. The utilization of 10-bits or extra is in any other case not unusual in imaging, significantly within the increased finish pictures 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 gives increased peak brightness
This then, is all that HDR actually is. However what does “increased peak brightness” actually imply? In spite of everything, SDR shows have been pushing ever rising brightness ranges earlier than HDR was vital, 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 larger than SDR, and we consider SDR as being the vary pushed by autobrightness to be comfortably readable within the present ambient situations. 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. Nonetheless, it does complicate the interplay with conventional HDR reminiscent of that utilized in video, particularly HLG and PQ content material.
PQ/HLG switch features
PQ and HLG signify the 2 commonest approaches to HDR when it comes to video content material. They signify two switch features that signify 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 specific reference viewing surroundings. HLG takes a unique method, as an alternative 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 surroundings, though it’s not outlined in absolute luminance phrases like PQ is.
Trade-wide specs have just lately 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 specifically defines HDR headroom when it comes to nominal peak luminance, relative to a diffuse white luminance at 203 nits.
The realities of recent shows, mentioned beneath, 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 below brilliant viewing situations, 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
Thus far many of the dialogue round HDR has been from the angle of the content material. Nonetheless, customers devour content material on a show, which has its personal capabilities and extra importantly limits. A high-end cellular show is more likely to have traits reminiscent of 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 can by no means be displayed
- Encoding as much as 10,000 nits of brightness is equally headroom that’s not utilized
These mismatches should not inherently an issue, nevertheless, but it surely implies that as 10-bit shows develop into extra frequent the prevailing 10-bit HDR video profiles are unable to really reap the benefits of 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 reminiscent of Extremely HDR or gainmaps basically 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 specific 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 reminiscent of AVIF, the efficient bit utilization is even higher than these of typical HDR video codecs. Thus these approaches don’t signify evolutionary or stepping stones to “true HDR”, however relatively 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 situations it’s nonetheless attainable to have a superb HDR expertise regardless of the utilization of RGBA_8888.
Unlocking HDR on Android: Subsequent steps
Excessive Dynamic Vary (HDR) gives development in visible constancy for Android builders, shifting past the normal constraints of Normal Dynamic Vary (SDR) by enabling increased peak brightness.
By understanding the core parts of colour – bit depth, switch perform, and colour gamut – and debunking frequent myths, builders can leverage applied sciences like Extremely HDR to ship really immersive experiences which can be each visually gorgeous and backward suitable.
In our subsequent article, we’ll delve into the nuances of HDR and person intent, exploring find out how to optimize your content material for numerous show capabilities and viewing environments.
No Comment! Be the first one.