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      * and gamma-encoded using the SRGB transfer function.
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      * Adobe RGB
107      *
108      * Use full range, gamma 2.2 transfer and Adobe RGB primaries
109      * Note: Application is responsible for gamma encoding the data as
110      * a 2.2 gamma encoding is not supported in HW.
111      */
112     ADATASPACE_ADOBE_RGB = 151715840, // STANDARD_ADOBE_RGB | TRANSFER_GAMMA2_2 | RANGE_FULL
113 
114     /**
115      * ITU-R Recommendation 2020 (BT.2020)
116      *
117      * Ultra High-definition television
118      *
119      * Use full range, BT.709 transfer and BT2020 standard
120      */
121     ADATASPACE_BT2020 = 147193856, // STANDARD_BT2020 | TRANSFER_SMPTE_170M | RANGE_FULL
122 
123     /**
124      * ITU-R Recommendation 709 (BT.709)
125      *
126      * High-definition television
127      *
128      * Use limited range, BT.709 transfer and BT.709 standard.
129      */
130     ADATASPACE_BT709 = 281083904, // STANDARD_BT709 | TRANSFER_SMPTE_170M | RANGE_LIMITED
131 
132     /**
133      * SMPTE EG 432-1 and SMPTE RP 431-2.
134      *
135      * Digital Cinema DCI-P3
136      *
137      * Use full range, gamma 2.6 transfer and D65 DCI-P3 standard
138      * Note: Application is responsible for gamma encoding the data as
139      * a 2.6 gamma encoding is not supported in HW.
140      */
141     ADATASPACE_DCI_P3 = 155844608, // STANDARD_DCI_P3 | TRANSFER_GAMMA2_6 | RANGE_FULL
142 
143     /**
144      * sRGB linear encoding:
145      *
146      * The red, green, and blue components are stored in sRGB space, but
147      * are linear, not gamma-encoded.
148      * The RGB primaries and the white point are the same as BT.709.
149      *
150      * The values are encoded using the full range ([0,255] for 8-bit) for all
151      * components.
152      */
153     ADATASPACE_SRGB_LINEAR = 138477568, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_FULL
154 };
155 
156 __END_DECLS
157 
158 #endif // ANDROID_DATA_SPACE_H
159