Content preparation with High Dynamic Range (HDR) video involves a lot of processing before the codec (encoder) comes into play. Providing correctly processed inputs to the encoder is essential to preserve the range of colors.
HDTV, UHDTV and Color Spaces
The color spaces supported by TVs and mobile devices have evolved significantly over the years. Support for wider color gamut is one of the key developments in display technology, along with increasing resolutions and frame rates, enabling devices to display colors that are closer to what the eye perceives and is also required for High Dynamic Range (HDR) media.
This section reviews few of the popular SDR and HDR color spaces supported by consumer display devices like TVs, PC monitors, tablets and mobiles.
Figure 1 above depicts various color spaces and their coverage of the CEI 1931 color space.
- Rec 709 Color Space
ITU-R Recommendation BT.709, first approved in 1990 and often referred to as Rec. 709 or BT.709, standardizes the format of High Definition Television (HDTV). This color space is identical to the sRGB color space and covers 35.6% of the CIE 1931 color space. All HD displays should be able to cover 100% of the Rec. 709 color space.
- DCI/P3 Color Space
DCI-P3 is a popular high dynamic range (HDR) RGB color space that was introduced in 2007 by SMPTE and features a color gamut much wider than Rec. 709, covering 45.5% of all colors perceptible to humans as per the CIE 1931 color space. All Digital Cinema Projectors are capable of displaying the entire DCI P3 color space.
DCI/P3 has assumed importance in recent times since this is the reference color gamut for current ‘Ultra HD Premium TV’s, which are expected to support at least 90% of the DCI/P3 color space with a minimum brightness of 0.05nits and maximum brightness of 1000nits.
- The Rec. 2020 color space
ITU-R Recommendation BT.2020, more commonly known by the abbreviations Rec. 2020 or BT.2020 is the de facto standard for HDR10 which defines various aspects of UHDTV such as resolution, frame rates, bit depth, chroma subsampling and color space. The associated color space is also commonly referred to as Rec. 2020. It covers 75.8% of all colors perceptible to humans as per the CIE 1931 xy color space.
In August 2015, the Consumer Electronics Association (CEA) standardized the HDR10 Media Profile format for all HDR compatible display devices. Support for REC.2020 color primaries and ST2084 EOTF transfer characteristics are essential to this format.
Color Space conversion from DCI/P3 to Rec. 2020
Most of existing motion picture film content is produced in the DCI-P3 format, the most commonly used color space for Digital Movie Projection. However, encoding this content in Ultra HD Blu-ray format using HEVC and displaying on a HDR10 compatible media device requires conversion to Rec. 2020 color space.
This can be accomplished through a DCI/P3 to Rec 2020 color space converter. A graphical representation of such a converter with non-constant Luminance Y’Cb’Cr’ output is shown in Figure 2 below.
The EOTF function maps the RGB signals from the electrical domain (non-linear) into the optical domain (linear space) and the OETF does the inverse. The EOTF, OETF and the R’G’B’ to Y’U’V’ conversion matrix are all specified in BT.2020.
The challenges involved in implementing an optimized version of such a compute intensive converter are:
- Fast Matrix multiplications for the color conversion and YUV conversion blocks typically in fixed point arithmetic.
- Non-linear floating point operations in the form of exponents and logarithms for the OETF and EOTF blocks. Floating point operations of this nature are computationally very expensive and require acceleration using fixed point lookup tables.
- The complexity of fixed point implementations require a large number of bits to maintain high precision. This is especially applicable in a linear space where the dynamic range is very high.
Ittiam Color Space converter
Ittiam has developed a fast color space convertor from DCI-P3 to Rec. 2020 with YUV output for x86 devices. The convertor also supports conversion from RGB to YUV and supports both Rec. 709 and Rec. 2020 color spaces.
The convertor is optimized using high precision fixed point operations with accuracy of 99.7% and root mean square (RMS) error less than 0.056. Multi-threaded conversion achieves real time 4k 60 performance with a CPU loading of ~40% on dual Xeon E5-2670. Combined with Ittiam’s HDR video codec portfolio, this enables processing of HDR media with high precision and efficiency.
The convertor is available both as an SDK and as an FFmpeg plugin
*The CEI 1931 chromaticity diagram is a modified version of the original work provided here and is distributed under the Creative Commons License provided in the link.