DataSpace


class DataSpace


DataSpace identifies three components of colors - standard (primaries), transfer and range. A DataSpace describes how buffer data, such as from an Image or a HardwareBuffer should be interpreted by both applications and typical hardware. As buffer information is not guaranteed to be representative of color information, while DataSpace is typically used to describe three aspects of interpreting colors, some DataSpaces may describe other typical interpretations of buffer data such as depth information. Note that while ColorSpace and DataSpace are similar concepts, they are not equivalent. Not all ColorSpaces, such as ColorSpace.Named.ACES, are able to be understood by typical hardware blocks so they cannot be DataSpaces. Standard aspect Defines the chromaticity coordinates of the source primaries in terms of the CIE 1931 definition of x and y specified in ISO 11664-1. Transfer aspect Transfer characteristics are the opto-electronic transfer characteristic at the source as a function of linear optical intensity (luminance). For digital signals, E corresponds to the recorded value. Normally, the transfer function is applied in RGB space to each of the R, G and B components independently. This may result in color shift that can be minized by applying the transfer function in Lab space only for the L component. Implementation may apply the transfer function in RGB space for all pixel formats if desired. Range aspect Defines the range of values corresponding to the unit range of 0-1.

Summary

Constants

const Int

Adobe RGB

const Int
DATASPACE_BT2020 = 147193856

ITU-R Recommendation 2020 (BT.2020)

const Int

Hybrid Log Gamma encoding.

const Int

ITU-R Recommendation 2020 (BT.2020)

const Int

ITU-R Recommendation 709 (BT.709)

const Int

ITU-R Recommendation 601 (BT.601) - 525-line

const Int
DATASPACE_BT709 = 281083904

ITU-R Recommendation 709 (BT.709)

const Int
DATASPACE_DCI_P3 = 155844608

SMPTE EG 432-1 and SMPTE RP 431-2.

const Int

Depth.

const Int

Display P3

const Int

ISO 16684-1:2011(E) Dynamic Depth.

const Int

High Efficiency Image File Format (HEIF).

const Int
DATASPACE_JFIF = 146931712

JPEG File Interchange Format (JFIF).

const Int

ISO/IEC TBD

const Int
DATASPACE_SCRGB = 411107328

scRGB:

const Int

scRGB linear encoding:

const Int
DATASPACE_SRGB = 142671872

sRGB gamma encoding:

const Int

sRGB linear encoding:

const Int

Default-assumption data space, when not explicitly specified.

const Int

Extended range can be used in combination with FP16 to communicate scRGB or with SurfaceControlCompat.Transaction.setExtendedRangeBrightness to indicate an HDR range.

const Int

Full range uses all values for Y, Cb and Cr from 0 to 2^b-1, where b is the bit depth of the color format.

const Int

Limited range uses values 16/256*2^b to 235/256*2^b for Y, and 1/16*2^b to 15/16*2^b for Cb, Cr, R, G and B, where b is the bit depth of the color format.

const Int

Range characteristics are unknown or are determined by the application.

Constants

DATASPACE_ADOBE_RGB

const val DATASPACE_ADOBE_RGB = 151715840: Int

Adobe RGB

Use full range, gamma 2.2 transfer and Adobe RGB primaries Note: Application is responsible for gamma encoding the data as a 2.2 gamma encoding is not supported in HW.

DATASPACE_BT2020

const val DATASPACE_BT2020 = 147193856: Int

ITU-R Recommendation 2020 (BT.2020)

Ultra High-definition television

Use full range, BT.709 transfer and BT2020 standard

DATASPACE_BT2020_HLG

const val DATASPACE_BT2020_HLG = 168165376: Int

Hybrid Log Gamma encoding.

Composed of the following -

Primaries: STANDARD_BT2020
Transfer: TRANSFER_HLG
Range: RANGE_FULL

DATASPACE_BT2020_PQ

const val DATASPACE_BT2020_PQ = 163971072: Int

ITU-R Recommendation 2020 (BT.2020)

Ultra High-definition television

Use full range, SMPTE 2084 (PQ) transfer and BT2020 standard

DATASPACE_BT601_525

const val DATASPACE_BT601_525 = 281280512: Int

ITU-R Recommendation 709 (BT.709)

High-definition television.

Composed of the following -

Primaries: STANDARD_BT601_525
Transfer: TRANSFER_SMPTE_170M
Range: RANGE_LIMITED

DATASPACE_BT601_625

const val DATASPACE_BT601_625 = 281149440: Int

ITU-R Recommendation 601 (BT.601) - 525-line

Standard-definition television, 525 Lines (NTSC).

Composed of the following -

Primaries: STANDARD_BT601_625
Transfer: TRANSFER_SMPTE_170M
Range: RANGE_LIMITED

DATASPACE_BT709

const val DATASPACE_BT709 = 281083904: Int

ITU-R Recommendation 709 (BT.709)

High-definition television

Use limited range, BT.709 transfer and BT.709 standard.

DATASPACE_DCI_P3

const val DATASPACE_DCI_P3 = 155844608: Int

SMPTE EG 432-1 and SMPTE RP 431-2.

Digital Cinema DCI-P3

Use full range, gamma 2.6 transfer and D65 DCI-P3 standard Note: Application is responsible for gamma encoding the data as a 2.6 gamma encoding is not supported in HW.

DATASPACE_DEPTH

const val DATASPACE_DEPTH = 4096: Int

Depth.

This value is valid with formats HAL_PIXEL_FORMAT_Y16 and HAL_PIXEL_FORMAT_BLOB.

DATASPACE_DISPLAY_P3

const val DATASPACE_DISPLAY_P3 = 143261696: Int

Display P3

Use same primaries and white-point as DCI-P3 but sRGB transfer function.

DATASPACE_DYNAMIC_DEPTH

const val DATASPACE_DYNAMIC_DEPTH = 4098: Int

ISO 16684-1:2011(E) Dynamic Depth.

Embedded depth metadata following the dynamic depth specification.

DATASPACE_HEIF

const val DATASPACE_HEIF = 4100: Int

High Efficiency Image File Format (HEIF).

This value is valid with HardwareBuffer.BLOB format. The combination is an HEIC image encoded by HEIC or HEVC encoder according to ISO/IEC 23008-12.

DATASPACE_JFIF

const val DATASPACE_JFIF = 146931712: Int

JPEG File Interchange Format (JFIF).

Composed of the following -

Primaries: STANDARD_BT601_625
Transfer: TRANSFER_SMPTE_170M
Range: RANGE_FULL

Same model as BT.601-625, but all values (Y, Cb, Cr) range from 0 to 255

DATASPACE_JPEG_R

const val DATASPACE_JPEG_R = 4101: Int

ISO/IEC TBD

JPEG image with embedded recovery map following the Jpeg/R specification.

This value must always remain aligned with the public ImageFormat Jpeg/R definition and is valid with formats: HAL_PIXEL_FORMAT_BLOB: JPEG image encoded by Jpeg/R encoder according to ISO/IEC TBD. The image contains a standard SDR JPEG and a recovery map. Jpeg/R decoders can use the map to recover the input image.

DATASPACE_SCRGB

const val DATASPACE_SCRGB = 411107328: Int

scRGB:

The red, green, and blue components are stored in extended sRGB space, and gamma-encoded using the SRGB transfer function. The RGB primaries and the white point are the same as BT.709.

The values are floating point. A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits. Values beyond the range 0.0 - 1.0 would correspond to other colors spaces and/or HDR content.

DATASPACE_SCRGB_LINEAR

const val DATASPACE_SCRGB_LINEAR = 406913024: Int

scRGB linear encoding:

The red, green, and blue components are stored in extended sRGB space, but are linear, not gamma-encoded. The RGB primaries and the white point are the same as BT.709.

The values are floating point. A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits. Values beyond the range 0.0 - 1.0 would correspond to other colors spaces and/or HDR content.

DATASPACE_SRGB

const val DATASPACE_SRGB = 142671872: Int

sRGB gamma encoding:

The red, green and blue components are stored in sRGB space, and converted to linear space when read, using the SRGB transfer function for each of the R, G and B components. When written, the inverse transformation is performed.

The alpha component, if present, is always stored in linear space and is left unmodified when read or written.

Use full range and BT.709 standard.

DATASPACE_SRGB_LINEAR

const val DATASPACE_SRGB_LINEAR = 138477568: Int

sRGB linear encoding:

The red, green, and blue components are stored in sRGB space, but are linear, not gamma-encoded. The RGB primaries and the white point are the same as BT.709.

The values are encoded using the full range (0,255 for 8-bit) for all components.

DATASPACE_UNKNOWN

const val DATASPACE_UNKNOWN = 0: Int

Default-assumption data space, when not explicitly specified.

It is safest to assume the buffer is an image with sRGB primaries and encoding ranges, but the consumer and/or the producer of the data may simply be using defaults. No automatic gamma transform should be expected, except for a possible display gamma transform when drawn to a screen.

RANGE_EXTENDED

const val RANGE_EXTENDEDInt

Extended range can be used in combination with FP16 to communicate scRGB or with SurfaceControlCompat.Transaction.setExtendedRangeBrightness to indicate an HDR range.

When used with floating point pixel formats and #STANDARD_BT709 then 0.0 - 1.0 is the standard sRGB space and values outside the range 0.0 - 1.0 can encode color outside the sRGB gamut. -0.5, 7.5 is the standard scRGB range. Used to blend/merge multiple dataspaces on a single display.

As of android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE this may be combined with SurfaceControlCompat.Transaction.setExtendedRangeBrightness and other formats such as HardwareBuffer.RGBA_8888 or HardwareBuffer.RGBA_1010102 to communicate a variable HDR brightness range

RANGE_FULL

const val RANGE_FULLInt

Full range uses all values for Y, Cb and Cr from 0 to 2^b-1, where b is the bit depth of the color format.

RANGE_LIMITED

const val RANGE_LIMITEDInt

Limited range uses values 16/256*2^b to 235/256*2^b for Y, and 1/16*2^b to 15/16*2^b for Cb, Cr, R, G and B, where b is the bit depth of the color format.

E.g. For 8-bit-depth formats: Luma (Y) samples should range from 16 to 235, inclusive Chroma (Cb, Cr) samples should range from 16 to 240, inclusive

For 10-bit-depth formats: Luma (Y) samples should range from 64 to 940, inclusive Chroma (Cb, Cr) samples should range from 64 to 960, inclusive.

RANGE_UNSPECIFIED

const val RANGE_UNSPECIFIEDInt

Range characteristics are unknown or are determined by the application.