HDR color space conversion – DCI/P3 to Rec. 2020
by Jay Shingala (Principal Engineer, Media Server Technologies) & Ashwin Natesan (Senior Engineer, Media Server Technologies)
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.
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.
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:
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.