Using system tone mapping on video content
Use EDR metadata to apply the default system tone mapping to a layer.
Overview
When processing video content, you usually want to work in a linear color space. You also want to display content that’s consistent with how playback would appear in AVFoundation or other playback mechanisms. To create content in your app that is consistent with the system behavior, create a Metal layer with a linear color space and attach an CAEDRMetadata object defining how the system should tone map the video content.
The code below creates a Metal layer with an extended linear BT.2020 color space and metadata that applies an HDR10 tone mapping based on the reference display.
Your rendering code needs to generate pixel values consistent with the EDR metadata object. For example, in the above code, the opticalOutputScale was set to 100, so a pixel value of 1.0 corresponds to 100 nits. For more information, see CAEDRMetadata.