Wide gamut capture

For devices running Android 14 or higher, Android provides support for Display P3 wide gamut capture. Devices can capture wide gamut color images in JPEG format with the ImageReader class without using 10-bit HDR. This feature lets devices request camera capture in a wide gamut color space to the Camera2 framework through the setColorSpace parameter in SessionConfiguration.

Requirements

To support wide gamut capture, the device must have access to a camera with wide gamut color capabilities.

Implementation

To support Display P3 wide gamut capture requests, do the following:

  • Read the colorSpace field in Stream.aidl and apply it to the output stream.
  • Implement the android.request.availableColorSpaceProfilesMap metadata entry.
  • Report the COLOR_SPACE_PROFILES capability in android.request.availableCapabilities.

For a reference Camera HAL implementation supporting P3 wide gamut capture, see the following in /hardware/google/camera/devices/EmulatedCamera/hwl/ configs/emu_camera_back.json:

For further details on wide gamut capture in the Camera HAL, see the following values in metadata_definitions.xml:

APIs

For devices running Android 14 or higher with support for wide gamut capture, camera clients can use the following public APIs:

The expected values for the ColorSpace parameter are derived from the ColorSpace.Named class. In Android 14, SRGB, DISPLAY_P3, and BT2020_HLG are supported.

Validation

To validate your implementation of Display P3 wide gamut capture support, run the following tests.

CTS

  • android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#test8BitColorSpaceOutputCharacteristics
  • android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#test10BitColorSpaceOutputCharacteristics
  • android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#testColorSpaceProfileMap
  • android.hardware.camera2.cts.ImageReaderTest#testDisplayP3Jpeg
  • android.hardware.camera2.cts.ImageReaderTest#testDisplayP3JpegRepeating
  • android.hardware.camera2.cts.ImageReaderTest#testDisplayP3Heic
  • android.hardware.camera2.cts.ImageReaderTest#testDisplayP3HeicRepeating

ITS

Run the Camera Image Test Suite (ITS) tests to validate the following:

  • Presence of an ICC profile with correct chromaticity coordinates
  • Image contains pixel data outside the sRGB gamut