1/* The Khronos Data Format Specification (version 1.3) */
2/*
3** Copyright 2015-2020 The Khronos Group Inc.
4** SPDX-License-Identifier: Apache-2.0
5*/
6
7/* This header defines a structure that can describe the layout of image
8 formats in memory. This means that the data format is transparent to
9 the application, and the expectation is that this should be used when
10 the layout is defined external to the API. Many Khronos APIs deliberately
11 keep the internal layout of images opaque, to allow proprietary layouts
12 and optimisations. This structure is not appropriate for describing
13 opaque layouts. */
14
15/* We stick to standard C89 constructs for simplicity and portability. */
16
17#ifndef _KHR_DATA_FORMAT_H_
18#define _KHR_DATA_FORMAT_H_
19
20/* Accessors */
21typedef enum _khr_word_e {
22 KHR_DF_WORD_VENDORID = 0U,
23 KHR_DF_WORD_DESCRIPTORTYPE = 0U,
24 KHR_DF_WORD_VERSIONNUMBER = 1U,
25 KHR_DF_WORD_DESCRIPTORBLOCKSIZE = 1U,
26 KHR_DF_WORD_MODEL = 2U,
27 KHR_DF_WORD_PRIMARIES = 2U,
28 KHR_DF_WORD_TRANSFER = 2U,
29 KHR_DF_WORD_FLAGS = 2U,
30 KHR_DF_WORD_TEXELBLOCKDIMENSION0 = 3U,
31 KHR_DF_WORD_TEXELBLOCKDIMENSION1 = 3U,
32 KHR_DF_WORD_TEXELBLOCKDIMENSION2 = 3U,
33 KHR_DF_WORD_TEXELBLOCKDIMENSION3 = 3U,
34 KHR_DF_WORD_BYTESPLANE0 = 4U,
35 KHR_DF_WORD_BYTESPLANE1 = 4U,
36 KHR_DF_WORD_BYTESPLANE2 = 4U,
37 KHR_DF_WORD_BYTESPLANE3 = 4U,
38 KHR_DF_WORD_BYTESPLANE4 = 5U,
39 KHR_DF_WORD_BYTESPLANE5 = 5U,
40 KHR_DF_WORD_BYTESPLANE6 = 5U,
41 KHR_DF_WORD_BYTESPLANE7 = 5U,
42 KHR_DF_WORD_SAMPLESTART = 6U,
43 KHR_DF_WORD_SAMPLEWORDS = 4U
44} khr_df_word_e;
45
46typedef enum _khr_df_shift_e {
47 KHR_DF_SHIFT_VENDORID = 0U,
48 KHR_DF_SHIFT_DESCRIPTORTYPE = 17U,
49 KHR_DF_SHIFT_VERSIONNUMBER = 0U,
50 KHR_DF_SHIFT_DESCRIPTORBLOCKSIZE = 16U,
51 KHR_DF_SHIFT_MODEL = 0U,
52 KHR_DF_SHIFT_PRIMARIES = 8U,
53 KHR_DF_SHIFT_TRANSFER = 16U,
54 KHR_DF_SHIFT_FLAGS = 24U,
55 KHR_DF_SHIFT_TEXELBLOCKDIMENSION0 = 0U,
56 KHR_DF_SHIFT_TEXELBLOCKDIMENSION1 = 8U,
57 KHR_DF_SHIFT_TEXELBLOCKDIMENSION2 = 16U,
58 KHR_DF_SHIFT_TEXELBLOCKDIMENSION3 = 24U,
59 KHR_DF_SHIFT_BYTESPLANE0 = 0U,
60 KHR_DF_SHIFT_BYTESPLANE1 = 8U,
61 KHR_DF_SHIFT_BYTESPLANE2 = 16U,
62 KHR_DF_SHIFT_BYTESPLANE3 = 24U,
63 KHR_DF_SHIFT_BYTESPLANE4 = 0U,
64 KHR_DF_SHIFT_BYTESPLANE5 = 8U,
65 KHR_DF_SHIFT_BYTESPLANE6 = 16U,
66 KHR_DF_SHIFT_BYTESPLANE7 = 24U
67} khr_df_shift_e;
68
69typedef enum _khr_df_mask_e {
70 KHR_DF_MASK_VENDORID = 0x1FFFFU,
71 KHR_DF_MASK_DESCRIPTORTYPE = 0x7FFFU,
72 KHR_DF_MASK_VERSIONNUMBER = 0xFFFFU,
73 KHR_DF_MASK_DESCRIPTORBLOCKSIZE = 0xFFFFU,
74 KHR_DF_MASK_MODEL = 0xFFU,
75 KHR_DF_MASK_PRIMARIES = 0xFFU,
76 KHR_DF_MASK_TRANSFER = 0xFFU,
77 KHR_DF_MASK_FLAGS = 0xFFU,
78 KHR_DF_MASK_TEXELBLOCKDIMENSION0 = 0xFFU,
79 KHR_DF_MASK_TEXELBLOCKDIMENSION1 = 0xFFU,
80 KHR_DF_MASK_TEXELBLOCKDIMENSION2 = 0xFFU,
81 KHR_DF_MASK_TEXELBLOCKDIMENSION3 = 0xFFU,
82 KHR_DF_MASK_BYTESPLANE0 = 0xFFU,
83 KHR_DF_MASK_BYTESPLANE1 = 0xFFU,
84 KHR_DF_MASK_BYTESPLANE2 = 0xFFU,
85 KHR_DF_MASK_BYTESPLANE3 = 0xFFU,
86 KHR_DF_MASK_BYTESPLANE4 = 0xFFU,
87 KHR_DF_MASK_BYTESPLANE5 = 0xFFU,
88 KHR_DF_MASK_BYTESPLANE6 = 0xFFU,
89 KHR_DF_MASK_BYTESPLANE7 = 0xFFU
90} khr_df_mask_e;
91
92/* Helper macro:
93 Extract field X from basic descriptor block BDB */
94#define KHR_DFDVAL(BDB, X) \
95 (((BDB)[KHR_DF_WORD_ ## X] >> (KHR_DF_SHIFT_ ## X)) \
96 & (KHR_DF_MASK_ ## X))
97
98/* Helper macro:
99 Set field X of basic descriptor block BDB */
100#define KHR_DFDSETVAL(BDB, X, val) \
101 ((BDB)[KHR_DF_WORD_ ## X] = \
102 ((BDB)[KHR_DF_WORD_ ## X] & \
103 ~((KHR_DF_MASK_ ## X) << (KHR_DF_SHIFT_ ## X))) | \
104 (((val) & (KHR_DF_MASK_ ## X)) << (KHR_DF_SHIFT_ ## X)))
105
106/* Offsets relative to the start of a sample */
107typedef enum _khr_df_sampleword_e {
108 KHR_DF_SAMPLEWORD_BITOFFSET = 0U,
109 KHR_DF_SAMPLEWORD_BITLENGTH = 0U,
110 KHR_DF_SAMPLEWORD_CHANNELID = 0U,
111 KHR_DF_SAMPLEWORD_QUALIFIERS = 0U,
112 KHR_DF_SAMPLEWORD_SAMPLEPOSITION0 = 1U,
113 KHR_DF_SAMPLEWORD_SAMPLEPOSITION1 = 1U,
114 KHR_DF_SAMPLEWORD_SAMPLEPOSITION2 = 1U,
115 KHR_DF_SAMPLEWORD_SAMPLEPOSITION3 = 1U,
116 KHR_DF_SAMPLEWORD_SAMPLEPOSITION_ALL = 1U,
117 KHR_DF_SAMPLEWORD_SAMPLELOWER = 2U,
118 KHR_DF_SAMPLEWORD_SAMPLEUPPER = 3U
119} khr_df_sampleword_e;
120
121typedef enum _khr_df_sampleshift_e {
122 KHR_DF_SAMPLESHIFT_BITOFFSET = 0U,
123 KHR_DF_SAMPLESHIFT_BITLENGTH = 16U,
124 KHR_DF_SAMPLESHIFT_CHANNELID = 24U,
125 /* N.B. Qualifiers are defined as an offset into a byte */
126 KHR_DF_SAMPLESHIFT_QUALIFIERS = 24U,
127 KHR_DF_SAMPLESHIFT_SAMPLEPOSITION0 = 0U,
128 KHR_DF_SAMPLESHIFT_SAMPLEPOSITION1 = 8U,
129 KHR_DF_SAMPLESHIFT_SAMPLEPOSITION2 = 16U,
130 KHR_DF_SAMPLESHIFT_SAMPLEPOSITION3 = 24U,
131 KHR_DF_SAMPLESHIFT_SAMPLEPOSITION_ALL = 0U,
132 KHR_DF_SAMPLESHIFT_SAMPLELOWER = 0U,
133 KHR_DF_SAMPLESHIFT_SAMPLEUPPER = 0U
134} khr_df_sampleshift_e;
135
136typedef enum _khr_df_samplemask_e {
137 KHR_DF_SAMPLEMASK_BITOFFSET = 0xFFFFU,
138 KHR_DF_SAMPLEMASK_BITLENGTH = 0xFF,
139 KHR_DF_SAMPLEMASK_CHANNELID = 0xF,
140 /* N.B. Qualifiers are defined as an offset into a byte */
141 KHR_DF_SAMPLEMASK_QUALIFIERS = 0xF0,
142 KHR_DF_SAMPLEMASK_SAMPLEPOSITION0 = 0xFF,
143 KHR_DF_SAMPLEMASK_SAMPLEPOSITION1 = 0xFF,
144 KHR_DF_SAMPLEMASK_SAMPLEPOSITION2 = 0xFF,
145 KHR_DF_SAMPLEMASK_SAMPLEPOSITION3 = 0xFF,
146 /* ISO C restricts enum values to range of int hence the
147 cast. We do it verbosely instead of using -1 to ensure
148 it is a 32-bit value even if int is 64 bits. */
149 KHR_DF_SAMPLEMASK_SAMPLEPOSITION_ALL = (int) 0xFFFFFFFFU,
150 KHR_DF_SAMPLEMASK_SAMPLELOWER = (int) 0xFFFFFFFFU,
151 KHR_DF_SAMPLEMASK_SAMPLEUPPER = (int) 0xFFFFFFFFU
152} khr_df_samplemask_e;
153
154/* Helper macro:
155 Extract field X of sample S from basic descriptor block BDB */
156#define KHR_DFDSVAL(BDB, S, X) \
157 (((BDB)[KHR_DF_WORD_SAMPLESTART + \
158 ((S) * KHR_DF_WORD_SAMPLEWORDS) + \
159 KHR_DF_SAMPLEWORD_ ## X] >> (KHR_DF_SAMPLESHIFT_ ## X)) \
160 & (KHR_DF_SAMPLEMASK_ ## X))
161
162/* Helper macro:
163 Set field X of sample S of basic descriptor block BDB */
164#define KHR_DFDSETSVAL(BDB, S, X, val) \
165 ((BDB)[KHR_DF_WORD_SAMPLESTART + \
166 ((S) * KHR_DF_WORD_SAMPLEWORDS) + \
167 KHR_DF_SAMPLEWORD_ ## X] = \
168 ((BDB)[KHR_DF_WORD_SAMPLESTART + \
169 ((S) * KHR_DF_WORD_SAMPLEWORDS) + \
170 KHR_DF_SAMPLEWORD_ ## X] & \
171 ~((uint32_t)(KHR_DF_SAMPLEMASK_ ## X) << (KHR_DF_SAMPLESHIFT_ ## X))) | \
172 (((val) & (uint32_t)(KHR_DF_SAMPLEMASK_ ## X)) << (KHR_DF_SAMPLESHIFT_ ## X)))
173
174/* Helper macro:
175 Number of samples in basic descriptor block BDB */
176#define KHR_DFDSAMPLECOUNT(BDB) \
177 (((KHR_DFDVAL(BDB, DESCRIPTORBLOCKSIZE) >> 2) - \
178 KHR_DF_WORD_SAMPLESTART) \
179 / KHR_DF_WORD_SAMPLEWORDS)
180
181/* Helper macro:
182 Size in words of basic descriptor block for S samples */
183#define KHR_DFDSIZEWORDS(S) \
184 (KHR_DF_WORD_SAMPLESTART + \
185 (S) * KHR_DF_WORD_SAMPLEWORDS)
186
187/* Vendor ids */
188typedef enum _khr_df_vendorid_e {
189 /* Standard Khronos descriptor */
190 KHR_DF_VENDORID_KHRONOS = 0U,
191 KHR_DF_VENDORID_MAX = 0x1FFFFU
192} khr_df_vendorid_e;
193
194/* Descriptor types */
195typedef enum _khr_df_khr_descriptortype_e {
196 /* Default Khronos basic descriptor block */
197 KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT = 0U,
198 /* Extension descriptor block for additional planes */
199 KHR_DF_KHR_DESCRIPTORTYPE_ADDITIONAL_PLANES = 0x6001U,
200 /* Extension descriptor block for additional dimensions */
201 KHR_DF_KHR_DESCRIPTORTYPE_ADDITIONAL_DIMENSIONS = 0x6002U,
202 /* Bit indicates modifying requires understanding this extension */
203 KHR_DF_KHR_DESCRIPTORTYPE_NEEDED_FOR_WRITE_BIT = 0x2000U,
204 /* Bit indicates processing requires understanding this extension */
205 KHR_DF_KHR_DESCRIPTORTYPE_NEEDED_FOR_DECODE_BIT = 0x4000U,
206 KHR_DF_KHR_DESCRIPTORTYPE_MAX = 0x7FFFU
207} khr_df_khr_descriptortype_e;
208
209/* Descriptor block version */
210typedef enum _khr_df_versionnumber_e {
211 /* Standard Khronos descriptor */
212 KHR_DF_VERSIONNUMBER_1_0 = 0U, /* Version 1.0 of the specification */
213 KHR_DF_VERSIONNUMBER_1_1 = 0U, /* Version 1.1 did not bump the version number */
214 KHR_DF_VERSIONNUMBER_1_2 = 1U, /* Version 1.2 increased the version number */
215 KHR_DF_VERSIONNUMBER_1_3 = 2U, /* Version 1.3 increased the version number */
216 KHR_DF_VERSIONNUMBER_LATEST = KHR_DF_VERSIONNUMBER_1_3,
217 KHR_DF_VERSIONNUMBER_MAX = 0xFFFFU
218} khr_df_versionnumber_e;
219
220/* Model in which the color coordinate space is defined.
221 There is no requirement that a color format use all the
222 channel types that are defined in the color model. */
223typedef enum _khr_df_model_e {
224 /* No interpretation of color channels defined */
225 KHR_DF_MODEL_UNSPECIFIED = 0U,
226 /* Color primaries (red, green, blue) + alpha, depth and stencil */
227 KHR_DF_MODEL_RGBSDA = 1U,
228 /* Color differences (Y', Cb, Cr) + alpha, depth and stencil */
229 KHR_DF_MODEL_YUVSDA = 2U,
230 /* Color differences (Y', I, Q) + alpha, depth and stencil */
231 KHR_DF_MODEL_YIQSDA = 3U,
232 /* Perceptual color (CIE L*a*b*) + alpha, depth and stencil */
233 KHR_DF_MODEL_LABSDA = 4U,
234 /* Subtractive colors (cyan, magenta, yellow, black) + alpha */
235 KHR_DF_MODEL_CMYKA = 5U,
236 /* Non-color coordinate data (X, Y, Z, W) */
237 KHR_DF_MODEL_XYZW = 6U,
238 /* Hue, saturation, value, hue angle on color circle, plus alpha */
239 KHR_DF_MODEL_HSVA_ANG = 7U,
240 /* Hue, saturation, lightness, hue angle on color circle, plus alpha */
241 KHR_DF_MODEL_HSLA_ANG = 8U,
242 /* Hue, saturation, value, hue on color hexagon, plus alpha */
243 KHR_DF_MODEL_HSVA_HEX = 9U,
244 /* Hue, saturation, lightness, hue on color hexagon, plus alpha */
245 KHR_DF_MODEL_HSLA_HEX = 10U,
246 /* Lightweight approximate color difference (luma, orange, green) */
247 KHR_DF_MODEL_YCGCOA = 11U,
248 /* ITU BT.2020 constant luminance YcCbcCrc */
249 KHR_DF_MODEL_YCCBCCRC = 12U,
250 /* ITU BT.2100 constant intensity ICtCp */
251 KHR_DF_MODEL_ICTCP = 13U,
252 /* CIE 1931 XYZ color coordinates (X, Y, Z) */
253 KHR_DF_MODEL_CIEXYZ = 14U,
254 /* CIE 1931 xyY color coordinates (X, Y, Y) */
255 KHR_DF_MODEL_CIEXYY = 15U,
256
257 /* Compressed formats start at 128. */
258 /* These compressed formats should generally have a single sample,
259 sited at the 0,0 position of the texel block. Where multiple
260 channels are used to distinguish formats, these should be cosited. */
261 /* Direct3D (and S3) compressed formats */
262 /* Note that premultiplied status is recorded separately */
263 /* DXT1 "channels" are RGB (0), Alpha (1) */
264 /* DXT1/BC1 with one channel is opaque */
265 /* DXT1/BC1 with a cosited alpha sample is transparent */
266 KHR_DF_MODEL_DXT1A = 128U,
267 KHR_DF_MODEL_BC1A = 128U,
268 /* DXT2/DXT3/BC2, with explicit 4-bit alpha */
269 KHR_DF_MODEL_DXT2 = 129U,
270 KHR_DF_MODEL_DXT3 = 129U,
271 KHR_DF_MODEL_BC2 = 129U,
272 /* DXT4/DXT5/BC3, with interpolated alpha */
273 KHR_DF_MODEL_DXT4 = 130U,
274 KHR_DF_MODEL_DXT5 = 130U,
275 KHR_DF_MODEL_BC3 = 130U,
276 /* BC4 - single channel interpolated 8-bit data */
277 /* (The UNORM/SNORM variation is recorded in the channel data) */
278 KHR_DF_MODEL_BC4 = 131U,
279 /* BC5 - two channel interpolated 8-bit data */
280 /* (The UNORM/SNORM variation is recorded in the channel data) */
281 KHR_DF_MODEL_BC5 = 132U,
282 /* BC6H - DX11 format for 16-bit float channels */
283 KHR_DF_MODEL_BC6H = 133U,
284 /* BC7 - DX11 format */
285 KHR_DF_MODEL_BC7 = 134U,
286 /* Gap left for future desktop expansion */
287
288 /* Mobile compressed formats follow */
289 /* A format of ETC1 indicates that the format shall be decodable
290 by an ETC1-compliant decoder and not rely on ETC2 features */
291 KHR_DF_MODEL_ETC1 = 160U,
292 /* A format of ETC2 is permitted to use ETC2 encodings on top of
293 the baseline ETC1 specification */
294 /* The ETC2 format has channels "red", "green", "RGB" and "alpha",
295 which should be cosited samples */
296 /* Punch-through alpha can be distinguished from full alpha by
297 the plane size in bytes required for the texel block */
298 KHR_DF_MODEL_ETC2 = 161U,
299 /* Adaptive Scalable Texture Compression */
300 /* ASTC HDR vs LDR is determined by the float flag in the channel */
301 /* ASTC block size can be distinguished by texel block size */
302 KHR_DF_MODEL_ASTC = 162U,
303 /* ETC1S is a simplified subset of ETC1 */
304 KHR_DF_MODEL_ETC1S = 163U,
305 /* PowerVR Texture Compression */
306 KHR_DF_MODEL_PVRTC = 164U,
307 KHR_DF_MODEL_PVRTC2 = 165U,
308 KHR_DF_MODEL_UASTC = 166U,
309 /* Proprietary formats (ATITC, etc.) should follow */
310 KHR_DF_MODEL_MAX = 0xFFU
311} khr_df_model_e;
312
313/* Definition of channel names for each color model */
314typedef enum _khr_df_model_channels_e {
315 /* Unspecified format with nominal channel numbering */
316 KHR_DF_CHANNEL_UNSPECIFIED_0 = 0U,
317 KHR_DF_CHANNEL_UNSPECIFIED_1 = 1U,
318 KHR_DF_CHANNEL_UNSPECIFIED_2 = 2U,
319 KHR_DF_CHANNEL_UNSPECIFIED_3 = 3U,
320 KHR_DF_CHANNEL_UNSPECIFIED_4 = 4U,
321 KHR_DF_CHANNEL_UNSPECIFIED_5 = 5U,
322 KHR_DF_CHANNEL_UNSPECIFIED_6 = 6U,
323 KHR_DF_CHANNEL_UNSPECIFIED_7 = 7U,
324 KHR_DF_CHANNEL_UNSPECIFIED_8 = 8U,
325 KHR_DF_CHANNEL_UNSPECIFIED_9 = 9U,
326 KHR_DF_CHANNEL_UNSPECIFIED_10 = 10U,
327 KHR_DF_CHANNEL_UNSPECIFIED_11 = 11U,
328 KHR_DF_CHANNEL_UNSPECIFIED_12 = 12U,
329 KHR_DF_CHANNEL_UNSPECIFIED_13 = 13U,
330 KHR_DF_CHANNEL_UNSPECIFIED_14 = 14U,
331 KHR_DF_CHANNEL_UNSPECIFIED_15 = 15U,
332 /* MODEL_RGBSDA - red, green, blue, stencil, depth, alpha */
333 KHR_DF_CHANNEL_RGBSDA_RED = 0U,
334 KHR_DF_CHANNEL_RGBSDA_R = 0U,
335 KHR_DF_CHANNEL_RGBSDA_GREEN = 1U,
336 KHR_DF_CHANNEL_RGBSDA_G = 1U,
337 KHR_DF_CHANNEL_RGBSDA_BLUE = 2U,
338 KHR_DF_CHANNEL_RGBSDA_B = 2U,
339 KHR_DF_CHANNEL_RGBSDA_STENCIL = 13U,
340 KHR_DF_CHANNEL_RGBSDA_S = 13U,
341 KHR_DF_CHANNEL_RGBSDA_DEPTH = 14U,
342 KHR_DF_CHANNEL_RGBSDA_D = 14U,
343 KHR_DF_CHANNEL_RGBSDA_ALPHA = 15U,
344 KHR_DF_CHANNEL_RGBSDA_A = 15U,
345 /* MODEL_YUVSDA - luma, Cb, Cr, stencil, depth, alpha */
346 KHR_DF_CHANNEL_YUVSDA_Y = 0U,
347 KHR_DF_CHANNEL_YUVSDA_CB = 1U,
348 KHR_DF_CHANNEL_YUVSDA_U = 1U,
349 KHR_DF_CHANNEL_YUVSDA_CR = 2U,
350 KHR_DF_CHANNEL_YUVSDA_V = 2U,
351 KHR_DF_CHANNEL_YUVSDA_STENCIL = 13U,
352 KHR_DF_CHANNEL_YUVSDA_S = 13U,
353 KHR_DF_CHANNEL_YUVSDA_DEPTH = 14U,
354 KHR_DF_CHANNEL_YUVSDA_D = 14U,
355 KHR_DF_CHANNEL_YUVSDA_ALPHA = 15U,
356 KHR_DF_CHANNEL_YUVSDA_A = 15U,
357 /* MODEL_YIQSDA - luma, in-phase, quadrature, stencil, depth, alpha */
358 KHR_DF_CHANNEL_YIQSDA_Y = 0U,
359 KHR_DF_CHANNEL_YIQSDA_I = 1U,
360 KHR_DF_CHANNEL_YIQSDA_Q = 2U,
361 KHR_DF_CHANNEL_YIQSDA_STENCIL = 13U,
362 KHR_DF_CHANNEL_YIQSDA_S = 13U,
363 KHR_DF_CHANNEL_YIQSDA_DEPTH = 14U,
364 KHR_DF_CHANNEL_YIQSDA_D = 14U,
365 KHR_DF_CHANNEL_YIQSDA_ALPHA = 15U,
366 KHR_DF_CHANNEL_YIQSDA_A = 15U,
367 /* MODEL_LABSDA - CIELAB/L*a*b* luma, red-green, blue-yellow, stencil, depth, alpha */
368 KHR_DF_CHANNEL_LABSDA_L = 0U,
369 KHR_DF_CHANNEL_LABSDA_A = 1U,
370 KHR_DF_CHANNEL_LABSDA_B = 2U,
371 KHR_DF_CHANNEL_LABSDA_STENCIL = 13U,
372 KHR_DF_CHANNEL_LABSDA_S = 13U,
373 KHR_DF_CHANNEL_LABSDA_DEPTH = 14U,
374 KHR_DF_CHANNEL_LABSDA_D = 14U,
375 KHR_DF_CHANNEL_LABSDA_ALPHA = 15U,
376 /* NOTE: KHR_DF_CHANNEL_LABSDA_A is not a synonym for alpha! */
377 /* MODEL_CMYKA - cyan, magenta, yellow, key/blacK, alpha */
378 KHR_DF_CHANNEL_CMYKSDA_CYAN = 0U,
379 KHR_DF_CHANNEL_CMYKSDA_C = 0U,
380 KHR_DF_CHANNEL_CMYKSDA_MAGENTA = 1U,
381 KHR_DF_CHANNEL_CMYKSDA_M = 1U,
382 KHR_DF_CHANNEL_CMYKSDA_YELLOW = 2U,
383 KHR_DF_CHANNEL_CMYKSDA_Y = 2U,
384 KHR_DF_CHANNEL_CMYKSDA_KEY = 3U,
385 KHR_DF_CHANNEL_CMYKSDA_BLACK = 3U,
386 KHR_DF_CHANNEL_CMYKSDA_K = 3U,
387 KHR_DF_CHANNEL_CMYKSDA_ALPHA = 15U,
388 KHR_DF_CHANNEL_CMYKSDA_A = 15U,
389 /* MODEL_XYZW - coordinates x, y, z, w */
390 KHR_DF_CHANNEL_XYZW_X = 0U,
391 KHR_DF_CHANNEL_XYZW_Y = 1U,
392 KHR_DF_CHANNEL_XYZW_Z = 2U,
393 KHR_DF_CHANNEL_XYZW_W = 3U,
394 /* MODEL_HSVA_ANG - value (luma), saturation, hue, alpha, angular projection, conical space */
395 KHR_DF_CHANNEL_HSVA_ANG_VALUE = 0U,
396 KHR_DF_CHANNEL_HSVA_ANG_V = 0U,
397 KHR_DF_CHANNEL_HSVA_ANG_SATURATION = 1U,
398 KHR_DF_CHANNEL_HSVA_ANG_S = 1U,
399 KHR_DF_CHANNEL_HSVA_ANG_HUE = 2U,
400 KHR_DF_CHANNEL_HSVA_ANG_H = 2U,
401 KHR_DF_CHANNEL_HSVA_ANG_ALPHA = 15U,
402 KHR_DF_CHANNEL_HSVA_ANG_A = 15U,
403 /* MODEL_HSLA_ANG - lightness (luma), saturation, hue, alpha, angular projection, double conical space */
404 KHR_DF_CHANNEL_HSLA_ANG_LIGHTNESS = 0U,
405 KHR_DF_CHANNEL_HSLA_ANG_L = 0U,
406 KHR_DF_CHANNEL_HSLA_ANG_SATURATION = 1U,
407 KHR_DF_CHANNEL_HSLA_ANG_S = 1U,
408 KHR_DF_CHANNEL_HSLA_ANG_HUE = 2U,
409 KHR_DF_CHANNEL_HSLA_ANG_H = 2U,
410 KHR_DF_CHANNEL_HSLA_ANG_ALPHA = 15U,
411 KHR_DF_CHANNEL_HSLA_ANG_A = 15U,
412 /* MODEL_HSVA_HEX - value (luma), saturation, hue, alpha, hexagonal projection, conical space */
413 KHR_DF_CHANNEL_HSVA_HEX_VALUE = 0U,
414 KHR_DF_CHANNEL_HSVA_HEX_V = 0U,
415 KHR_DF_CHANNEL_HSVA_HEX_SATURATION = 1U,
416 KHR_DF_CHANNEL_HSVA_HEX_S = 1U,
417 KHR_DF_CHANNEL_HSVA_HEX_HUE = 2U,
418 KHR_DF_CHANNEL_HSVA_HEX_H = 2U,
419 KHR_DF_CHANNEL_HSVA_HEX_ALPHA = 15U,
420 KHR_DF_CHANNEL_HSVA_HEX_A = 15U,
421 /* MODEL_HSLA_HEX - lightness (luma), saturation, hue, alpha, hexagonal projection, double conical space */
422 KHR_DF_CHANNEL_HSLA_HEX_LIGHTNESS = 0U,
423 KHR_DF_CHANNEL_HSLA_HEX_L = 0U,
424 KHR_DF_CHANNEL_HSLA_HEX_SATURATION = 1U,
425 KHR_DF_CHANNEL_HSLA_HEX_S = 1U,
426 KHR_DF_CHANNEL_HSLA_HEX_HUE = 2U,
427 KHR_DF_CHANNEL_HSLA_HEX_H = 2U,
428 KHR_DF_CHANNEL_HSLA_HEX_ALPHA = 15U,
429 KHR_DF_CHANNEL_HSLA_HEX_A = 15U,
430 /* MODEL_YCGCOA - luma, green delta, orange delta, alpha */
431 KHR_DF_CHANNEL_YCGCOA_Y = 0U,
432 KHR_DF_CHANNEL_YCGCOA_CG = 1U,
433 KHR_DF_CHANNEL_YCGCOA_CO = 2U,
434 KHR_DF_CHANNEL_YCGCOA_ALPHA = 15U,
435 KHR_DF_CHANNEL_YCGCOA_A = 15U,
436 /* MODEL_CIEXYZ - CIE 1931 X, Y, Z */
437 KHR_DF_CHANNEL_CIEXYZ_X = 0U,
438 KHR_DF_CHANNEL_CIEXYZ_Y = 1U,
439 KHR_DF_CHANNEL_CIEXYZ_Z = 2U,
440 /* MODEL_CIEXYY - CIE 1931 x, y, Y */
441 KHR_DF_CHANNEL_CIEXYY_X = 0U,
442 KHR_DF_CHANNEL_CIEXYY_YCHROMA = 1U,
443 KHR_DF_CHANNEL_CIEXYY_YLUMA = 2U,
444
445 /* Compressed formats */
446 /* MODEL_DXT1A/MODEL_BC1A */
447 KHR_DF_CHANNEL_DXT1A_COLOR = 0U,
448 KHR_DF_CHANNEL_BC1A_COLOR = 0U,
449 KHR_DF_CHANNEL_DXT1A_ALPHAPRESENT = 1U,
450 KHR_DF_CHANNEL_DXT1A_ALPHA = 1U,
451 KHR_DF_CHANNEL_BC1A_ALPHAPRESENT = 1U,
452 KHR_DF_CHANNEL_BC1A_ALPHA = 1U,
453 /* MODEL_DXT2/3/MODEL_BC2 */
454 KHR_DF_CHANNEL_DXT2_COLOR = 0U,
455 KHR_DF_CHANNEL_DXT3_COLOR = 0U,
456 KHR_DF_CHANNEL_BC2_COLOR = 0U,
457 KHR_DF_CHANNEL_DXT2_ALPHA = 15U,
458 KHR_DF_CHANNEL_DXT3_ALPHA = 15U,
459 KHR_DF_CHANNEL_BC2_ALPHA = 15U,
460 /* MODEL_DXT4/5/MODEL_BC3 */
461 KHR_DF_CHANNEL_DXT4_COLOR = 0U,
462 KHR_DF_CHANNEL_DXT5_COLOR = 0U,
463 KHR_DF_CHANNEL_BC3_COLOR = 0U,
464 KHR_DF_CHANNEL_DXT4_ALPHA = 15U,
465 KHR_DF_CHANNEL_DXT5_ALPHA = 15U,
466 KHR_DF_CHANNEL_BC3_ALPHA = 15U,
467 /* MODEL_BC4 */
468 KHR_DF_CHANNEL_BC4_DATA = 0U,
469 /* MODEL_BC5 */
470 KHR_DF_CHANNEL_BC5_RED = 0U,
471 KHR_DF_CHANNEL_BC5_R = 0U,
472 KHR_DF_CHANNEL_BC5_GREEN = 1U,
473 KHR_DF_CHANNEL_BC5_G = 1U,
474 /* MODEL_BC6H */
475 KHR_DF_CHANNEL_BC6H_COLOR = 0U,
476 KHR_DF_CHANNEL_BC6H_DATA = 0U,
477 /* MODEL_BC7 */
478 KHR_DF_CHANNEL_BC7_DATA = 0U,
479 KHR_DF_CHANNEL_BC7_COLOR = 0U,
480 /* MODEL_ETC1 */
481 KHR_DF_CHANNEL_ETC1_DATA = 0U,
482 KHR_DF_CHANNEL_ETC1_COLOR = 0U,
483 /* MODEL_ETC2 */
484 KHR_DF_CHANNEL_ETC2_RED = 0U,
485 KHR_DF_CHANNEL_ETC2_R = 0U,
486 KHR_DF_CHANNEL_ETC2_GREEN = 1U,
487 KHR_DF_CHANNEL_ETC2_G = 1U,
488 KHR_DF_CHANNEL_ETC2_COLOR = 2U,
489 KHR_DF_CHANNEL_ETC2_ALPHA = 15U,
490 KHR_DF_CHANNEL_ETC2_A = 15U,
491 /* MODEL_ASTC */
492 KHR_DF_CHANNEL_ASTC_DATA = 0U,
493 /* MODEL_ETC1S */
494 KHR_DF_CHANNEL_ETC1S_RGB = 0U,
495 KHR_DF_CHANNEL_ETC1S_RRR = 3U,
496 KHR_DF_CHANNEL_ETC1S_GGG = 4U,
497 KHR_DF_CHANNEL_ETC1S_AAA = 15U,
498 /* MODEL_PVRTC */
499 KHR_DF_CHANNEL_PVRTC_DATA = 0U,
500 KHR_DF_CHANNEL_PVRTC_COLOR = 0U,
501 /* MODEL_PVRTC2 */
502 KHR_DF_CHANNEL_PVRTC2_DATA = 0U,
503 KHR_DF_CHANNEL_PVRTC2_COLOR = 0U,
504 /* MODEL UASTC */
505 KHR_DF_CHANNEL_UASTC_DATA = 0U,
506 KHR_DF_CHANNEL_UASTC_RGB = 0U,
507 KHR_DF_CHANNEL_UASTC_RGBA = 3U,
508 KHR_DF_CHANNEL_UASTC_RRR = 4U,
509 KHR_DF_CHANNEL_UASTC_RRRG = 5U,
510 KHR_DF_CHANNEL_UASTC_RG = 6U,
511
512 /* Common channel names shared by multiple formats */
513 KHR_DF_CHANNEL_COMMON_LUMA = 0U,
514 KHR_DF_CHANNEL_COMMON_L = 0U,
515 KHR_DF_CHANNEL_COMMON_STENCIL = 13U,
516 KHR_DF_CHANNEL_COMMON_S = 13U,
517 KHR_DF_CHANNEL_COMMON_DEPTH = 14U,
518 KHR_DF_CHANNEL_COMMON_D = 14U,
519 KHR_DF_CHANNEL_COMMON_ALPHA = 15U,
520 KHR_DF_CHANNEL_COMMON_A = 15U
521} khr_df_model_channels_e;
522
523/* Definition of the primary colors in color coordinates.
524 This is implicitly responsible for defining the conversion
525 between RGB an YUV color spaces.
526 LAB and related absolute color models should use
527 KHR_DF_PRIMARIES_CIEXYZ. */
528typedef enum _khr_df_primaries_e {
529 /* No color primaries defined */
530 KHR_DF_PRIMARIES_UNSPECIFIED = 0U,
531 /* Color primaries of ITU-R BT.709 and sRGB */
532 KHR_DF_PRIMARIES_BT709 = 1U,
533 /* Synonym for KHR_DF_PRIMARIES_BT709 */
534 KHR_DF_PRIMARIES_SRGB = 1U,
535 /* Color primaries of ITU-R BT.601 (625-line EBU variant) */
536 KHR_DF_PRIMARIES_BT601_EBU = 2U,
537 /* Color primaries of ITU-R BT.601 (525-line SMPTE C variant) */
538 KHR_DF_PRIMARIES_BT601_SMPTE = 3U,
539 /* Color primaries of ITU-R BT.2020 */
540 KHR_DF_PRIMARIES_BT2020 = 4U,
541 /* CIE theoretical color coordinate space */
542 KHR_DF_PRIMARIES_CIEXYZ = 5U,
543 /* Academy Color Encoding System primaries */
544 KHR_DF_PRIMARIES_ACES = 6U,
545 /* Color primaries of ACEScc */
546 KHR_DF_PRIMARIES_ACESCC = 7U,
547 /* Legacy NTSC 1953 primaries */
548 KHR_DF_PRIMARIES_NTSC1953 = 8U,
549 /* Legacy PAL 525-line primaries */
550 KHR_DF_PRIMARIES_PAL525 = 9U,
551 /* Color primaries of Display P3 */
552 KHR_DF_PRIMARIES_DISPLAYP3 = 10U,
553 /* Color primaries of Adobe RGB (1998) */
554 KHR_DF_PRIMARIES_ADOBERGB = 11U,
555 KHR_DF_PRIMARIES_MAX = 0xFFU
556} khr_df_primaries_e;
557
558/* Definition of the optical to digital transfer function
559 ("gamma correction"). Most transfer functions are not a pure
560 power function and also include a linear element.
561 LAB and related absolute color representations should use
562 KHR_DF_TRANSFER_UNSPECIFIED. */
563typedef enum _khr_df_transfer_e {
564 /* No transfer function defined */
565 KHR_DF_TRANSFER_UNSPECIFIED = 0U,
566 /* Linear transfer function (value proportional to intensity) */
567 KHR_DF_TRANSFER_LINEAR = 1U,
568 /* Perceptually-linear transfer function of sRGH (~2.4) */
569 KHR_DF_TRANSFER_SRGB = 2U,
570 /* Perceptually-linear transfer function of ITU BT.601, BT.709 and BT.2020 (~1/.45) */
571 KHR_DF_TRANSFER_ITU = 3U,
572 /* SMTPE170M (digital NTSC) defines an alias for the ITU transfer function (~1/.45) */
573 KHR_DF_TRANSFER_SMTPE170M = 3U,
574 /* Perceptually-linear gamma function of original NTSC (simple 2.2 gamma) */
575 KHR_DF_TRANSFER_NTSC = 4U,
576 /* Sony S-log used by Sony video cameras */
577 KHR_DF_TRANSFER_SLOG = 5U,
578 /* Sony S-log 2 used by Sony video cameras */
579 KHR_DF_TRANSFER_SLOG2 = 6U,
580 /* ITU BT.1886 EOTF */
581 KHR_DF_TRANSFER_BT1886 = 7U,
582 /* ITU BT.2100 HLG OETF */
583 KHR_DF_TRANSFER_HLG_OETF = 8U,
584 /* ITU BT.2100 HLG EOTF */
585 KHR_DF_TRANSFER_HLG_EOTF = 9U,
586 /* ITU BT.2100 PQ EOTF */
587 KHR_DF_TRANSFER_PQ_EOTF = 10U,
588 /* ITU BT.2100 PQ OETF */
589 KHR_DF_TRANSFER_PQ_OETF = 11U,
590 /* DCI P3 transfer function */
591 KHR_DF_TRANSFER_DCIP3 = 12U,
592 /* Legacy PAL OETF */
593 KHR_DF_TRANSFER_PAL_OETF = 13U,
594 /* Legacy PAL 625-line EOTF */
595 KHR_DF_TRANSFER_PAL625_EOTF = 14U,
596 /* Legacy ST240 transfer function */
597 KHR_DF_TRANSFER_ST240 = 15U,
598 /* ACEScc transfer function */
599 KHR_DF_TRANSFER_ACESCC = 16U,
600 /* ACEScct transfer function */
601 KHR_DF_TRANSFER_ACESCCT = 17U,
602 /* Adobe RGB (1998) transfer function */
603 KHR_DF_TRANSFER_ADOBERGB = 18U,
604 KHR_DF_TRANSFER_MAX = 0xFFU
605} khr_df_transfer_e;
606
607typedef enum _khr_df_flags_e {
608 KHR_DF_FLAG_ALPHA_STRAIGHT = 0U,
609 KHR_DF_FLAG_ALPHA_PREMULTIPLIED = 1U
610} khr_df_flags_e;
611
612typedef enum _khr_df_sample_datatype_qualifiers_e {
613 KHR_DF_SAMPLE_DATATYPE_LINEAR = 1U << 4U,
614 KHR_DF_SAMPLE_DATATYPE_EXPONENT = 1U << 5U,
615 KHR_DF_SAMPLE_DATATYPE_SIGNED = 1U << 6U,
616 KHR_DF_SAMPLE_DATATYPE_FLOAT = 1U << 7U
617} khr_df_sample_datatype_qualifiers_e;
618
619#endif
620