1 /*
2  * Copyright 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /**
18  * @file data_space.h
19  */
20 
21 #ifndef ANDROID_DATA_SPACE_H
22 #define ANDROID_DATA_SPACE_H
23 
24 #include <inttypes.h>
25 
26 #include <sys/cdefs.h>
27 
28 __BEGIN_DECLS
29 
30 /**
31  * ADataSpace.
32  */
33 enum ADataSpace {
34     /**
35      * Default-assumption data space, when not explicitly specified.
36      *
37      * It is safest to assume the buffer is an image with sRGB primaries and
38      * encoding ranges, but the consumer and/or the producer of the data may
39      * simply be using defaults. No automatic gamma transform should be
40      * expected, except for a possible display gamma transform when drawn to a
41      * screen.
42      */
43     ADATASPACE_UNKNOWN = 0,
44 
45     /**
46      * scRGB linear encoding:
47      *
48      * The red, green, and blue components are stored in extended sRGB space,
49      * but are linear, not gamma-encoded.
50      * The RGB primaries and the white point are the same as BT.709.
51      *
52      * The values are floating point.
53      * A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits.
54      * Values beyond the range [0.0 - 1.0] would correspond to other colors
55      * spaces and/or HDR content.
56      */
57     ADATASPACE_SCRGB_LINEAR = 406913024, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_EXTENDED
58 
59     /**
60      * sRGB gamma encoding:
61      *
62      * The red, green and blue components are stored in sRGB space, and
63      * converted to linear space when read, using the SRGB transfer function
64      * for each of the R, G and B components. When written, the inverse
65      * transformation is performed.
66      *
67      * The alpha component, if present, is always stored in linear space and
68      * is left unmodified when read or written.
69      *
70      * Use full range and BT.709 standard.
71      */
72     ADATASPACE_SRGB = 142671872, // STANDARD_BT709 | TRANSFER_SRGB | RANGE_FULL
73 
74     /**
75      * scRGB:
76      *
77      * The red, green, and blue components are stored in extended sRGB space,
78      * but are linear, not gamma-encoded.
79      * The RGB primaries and the white point are the same as BT.709.
80      *
81      * The values are floating point.
82      * A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits.
83      * Values beyond the range [0.0 - 1.0] would correspond to other colors
84      * spaces and/or HDR content.
85      */
86     ADATASPACE_SCRGB = 411107328, // STANDARD_BT709 | TRANSFER_SRGB | RANGE_EXTENDED
87 
88     /**
89      * Display P3
90      *
91      * Use same primaries and white-point as DCI-P3
92      * but sRGB transfer function.
93      */
94     ADATASPACE_DISPLAY_P3 = 143261696, // STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_FULL
95 
96     /**
97      * ITU-R Recommendation 2020 (BT.2020)
98      *
99      * Ultra High-definition television
100      *
101      * Use full range, SMPTE 2084 (PQ) transfer and BT2020 standard
102      */
103     ADATASPACE_BT2020_PQ = 163971072, // STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_FULL
104 };
105 
106 __END_DECLS
107 
108 #endif // ANDROID_DATA_SPACE_H
109