blob: c9f5950409a0fbd2065239137c93dc019c2b9d29 [file] [log] [blame]
Iliyan Malchev66ea3572011-05-01 14:05:30 -07001/*
2 * Copyright (C) 2011 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#ifndef SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H
18#define SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H
19
Alex Raye13f15a2013-03-19 01:41:32 -070020#include <stdint.h>
21
Mathias Agopianc9b06952011-08-11 22:35:31 -070022#ifdef __cplusplus
23extern "C" {
24#endif
Iliyan Malchev66ea3572011-05-01 14:05:30 -070025
Mathias Agopian5c9be402011-08-09 18:55:44 -070026/*
27 * If the HAL needs to create service threads to handle graphics related
28 * tasks, these threads need to run at HAL_PRIORITY_URGENT_DISPLAY priority
29 * if they can block the main rendering thread in any way.
30 *
31 * the priority of the current thread can be set with:
32 *
33 * #include <sys/resource.h>
34 * setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);
35 *
36 */
37
38#define HAL_PRIORITY_URGENT_DISPLAY (-8)
39
Iliyan Malchev66ea3572011-05-01 14:05:30 -070040/**
41 * pixel format definitions
42 */
43
44enum {
Mathias Agopian8d9da282013-07-25 17:07:11 -070045 /*
46 * "linear" color pixel formats:
47 *
Eino-Ville Talvala03743412015-02-17 15:34:44 -080048 * When used with ANativeWindow, the dataSpace field describes the color
49 * space of the buffer.
50 *
51 * The color space determines, for example, if the formats are linear or
52 * gamma-corrected; or whether any special operations are performed when
53 * reading or writing into a buffer in one of these formats.
Mathias Agopian8d9da282013-07-25 17:07:11 -070054 */
Iliyan Malchev66ea3572011-05-01 14:05:30 -070055 HAL_PIXEL_FORMAT_RGBA_8888 = 1,
56 HAL_PIXEL_FORMAT_RGBX_8888 = 2,
57 HAL_PIXEL_FORMAT_RGB_888 = 3,
58 HAL_PIXEL_FORMAT_RGB_565 = 4,
59 HAL_PIXEL_FORMAT_BGRA_8888 = 5,
Iliyan Malchev66ea3572011-05-01 14:05:30 -070060
Mathias Agopian8d9da282013-07-25 17:07:11 -070061 /*
Iliyan Malchev66ea3572011-05-01 14:05:30 -070062 * 0x100 - 0x1FF
63 *
64 * This range is reserved for pixel formats that are specific to the HAL
65 * implementation. Implementations can use any value in this range to
66 * communicate video pixel formats between their HAL modules. These formats
67 * must not have an alpha channel. Additionally, an EGLimage created from a
68 * gralloc buffer of one of these formats must be supported for use with the
69 * GL_OES_EGL_image_external OpenGL ES extension.
70 */
71
72 /*
73 * Android YUV format:
74 *
Jamie Gennisda1a1f62011-05-18 14:42:46 -070075 * This format is exposed outside of the HAL to software decoders and
76 * applications. EGLImageKHR must support it in conjunction with the
Iliyan Malchev66ea3572011-05-01 14:05:30 -070077 * OES_EGL_image_external extension.
78 *
Jamie Gennisda1a1f62011-05-18 14:42:46 -070079 * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
Iliyan Malchev66ea3572011-05-01 14:05:30 -070080 * by (W/2) x (H/2) Cr and Cb planes.
81 *
82 * This format assumes
83 * - an even width
84 * - an even height
85 * - a horizontal stride multiple of 16 pixels
86 * - a vertical stride equal to the height
87 *
88 * y_size = stride * height
Jamie Gennis185b3002012-04-30 12:50:38 -070089 * c_stride = ALIGN(stride/2, 16)
90 * c_size = c_stride * height/2
Iliyan Malchev66ea3572011-05-01 14:05:30 -070091 * size = y_size + c_size * 2
92 * cr_offset = y_size
93 * cb_offset = y_size + c_size
94 *
Eino-Ville Talvala03743412015-02-17 15:34:44 -080095 * When used with ANativeWindow, the dataSpace field describes the color
96 * space of the buffer.
Iliyan Malchev66ea3572011-05-01 14:05:30 -070097 */
98 HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar
99
Igor Murashkin9e00e662013-01-31 17:17:43 -0800100
101 /*
102 * Android Y8 format:
103 *
104 * This format is exposed outside of the HAL to the framework.
105 * The expected gralloc usage flags are SW_* and HW_CAMERA_*,
106 * and no other HW_ flags will be used.
107 *
108 * Y8 is a YUV planar format comprised of a WxH Y plane,
109 * with each pixel being represented by 8 bits.
110 *
111 * It is equivalent to just the Y plane from YV12.
112 *
113 * This format assumes
114 * - an even width
115 * - an even height
116 * - a horizontal stride multiple of 16 pixels
117 * - a vertical stride equal to the height
118 *
Igor Murashkind755b522013-02-11 11:34:53 -0800119 * size = stride * height
Igor Murashkin9e00e662013-01-31 17:17:43 -0800120 *
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800121 * When used with ANativeWindow, the dataSpace field describes the color
122 * space of the buffer.
Igor Murashkin9e00e662013-01-31 17:17:43 -0800123 */
124 HAL_PIXEL_FORMAT_Y8 = 0x20203859,
125
126 /*
127 * Android Y16 format:
128 *
129 * This format is exposed outside of the HAL to the framework.
130 * The expected gralloc usage flags are SW_* and HW_CAMERA_*,
131 * and no other HW_ flags will be used.
132 *
133 * Y16 is a YUV planar format comprised of a WxH Y plane,
134 * with each pixel being represented by 16 bits.
135 *
136 * It is just like Y8, but has double the bits per pixel (little endian).
137 *
138 * This format assumes
139 * - an even width
140 * - an even height
141 * - a horizontal stride multiple of 16 pixels
142 * - a vertical stride equal to the height
143 * - strides are specified in pixels, not in bytes
144 *
Igor Murashkind755b522013-02-11 11:34:53 -0800145 * size = stride * height * 2
Igor Murashkin9e00e662013-01-31 17:17:43 -0800146 *
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800147 * When used with ANativeWindow, the dataSpace field describes the color
148 * space of the buffer, except that dataSpace field
149 * HAL_DATASPACE_DEPTH indicates that this buffer contains a depth
150 * image where each sample is a distance value measured by a depth camera.
Igor Murashkin9e00e662013-01-31 17:17:43 -0800151 */
152 HAL_PIXEL_FORMAT_Y16 = 0x20363159,
153
Eino-Ville Talvala0a851542012-04-10 15:10:50 -0700154 /*
155 * Android RAW sensor format:
156 *
Ruben Brunk535253e2014-02-04 18:13:34 -0800157 * This format is exposed outside of the camera HAL to applications.
Eino-Ville Talvala0a851542012-04-10 15:10:50 -0700158 *
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800159 * RAW16 is a single-channel, 16-bit, little endian format, typically
Ruben Brunk535253e2014-02-04 18:13:34 -0800160 * representing raw Bayer-pattern images from an image sensor, with minimal
161 * processing.
Eino-Ville Talvala0a851542012-04-10 15:10:50 -0700162 *
163 * The exact pixel layout of the data in the buffer is sensor-dependent, and
164 * needs to be queried from the camera device.
165 *
166 * Generally, not all 16 bits are used; more common values are 10 or 12
Ruben Brunk535253e2014-02-04 18:13:34 -0800167 * bits. If not all bits are used, the lower-order bits are filled first.
168 * All parameters to interpret the raw data (black and white points,
Eino-Ville Talvala0a851542012-04-10 15:10:50 -0700169 * color space, etc) must be queried from the camera device.
170 *
171 * This format assumes
172 * - an even width
173 * - an even height
Ruben Brunk535253e2014-02-04 18:13:34 -0800174 * - a horizontal stride multiple of 16 pixels
175 * - a vertical stride equal to the height
176 * - strides are specified in pixels, not in bytes
177 *
178 * size = stride * height * 2
179 *
180 * This format must be accepted by the gralloc module when used with the
181 * following usage flags:
182 * - GRALLOC_USAGE_HW_CAMERA_*
183 * - GRALLOC_USAGE_SW_*
184 * - GRALLOC_USAGE_RENDERSCRIPT
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800185 *
186 * When used with ANativeWindow, the dataSpace should be
187 * HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial
188 * extra metadata to define.
Eino-Ville Talvala0a851542012-04-10 15:10:50 -0700189 */
Ruben Brunk535253e2014-02-04 18:13:34 -0800190 HAL_PIXEL_FORMAT_RAW16 = 0x20,
Ruben Brunk535253e2014-02-04 18:13:34 -0800191
192 /*
Zhijun He72fce302014-06-23 17:14:42 -0700193 * Android RAW10 format:
194 *
195 * This format is exposed outside of the camera HAL to applications.
196 *
Zhijun Hec73b73a2014-07-25 08:07:48 -0700197 * RAW10 is a single-channel, 10-bit per pixel, densely packed in each row,
198 * unprocessed format, usually representing raw Bayer-pattern images coming from
199 * an image sensor.
Zhijun He72fce302014-06-23 17:14:42 -0700200 *
Zhijun Hec73b73a2014-07-25 08:07:48 -0700201 * In an image buffer with this format, starting from the first pixel of each
202 * row, each 4 consecutive pixels are packed into 5 bytes (40 bits). Each one
203 * of the first 4 bytes contains the top 8 bits of each pixel, The fifth byte
204 * contains the 2 least significant bits of the 4 pixels, the exact layout data
205 * for each 4 consecutive pixels is illustrated below (Pi[j] stands for the jth
206 * bit of the ith pixel):
Zhijun He72fce302014-06-23 17:14:42 -0700207 *
208 * bit 7 bit 0
209 * =====|=====|=====|=====|=====|=====|=====|=====|
210 * Byte 0: |P0[9]|P0[8]|P0[7]|P0[6]|P0[5]|P0[4]|P0[3]|P0[2]|
211 * |-----|-----|-----|-----|-----|-----|-----|-----|
212 * Byte 1: |P1[9]|P1[8]|P1[7]|P1[6]|P1[5]|P1[4]|P1[3]|P1[2]|
213 * |-----|-----|-----|-----|-----|-----|-----|-----|
214 * Byte 2: |P2[9]|P2[8]|P2[7]|P2[6]|P2[5]|P2[4]|P2[3]|P2[2]|
215 * |-----|-----|-----|-----|-----|-----|-----|-----|
216 * Byte 3: |P3[9]|P3[8]|P3[7]|P3[6]|P3[5]|P3[4]|P3[3]|P3[2]|
217 * |-----|-----|-----|-----|-----|-----|-----|-----|
218 * Byte 4: |P3[1]|P3[0]|P2[1]|P2[0]|P1[1]|P1[0]|P0[1]|P0[0]|
219 * ===============================================
220 *
221 * This format assumes
222 * - a width multiple of 4 pixels
223 * - an even height
Zhijun He72fce302014-06-23 17:14:42 -0700224 * - a vertical stride equal to the height
Zhijun Hec73b73a2014-07-25 08:07:48 -0700225 * - strides are specified in bytes, not in pixels
Zhijun He72fce302014-06-23 17:14:42 -0700226 *
Zhijun Hec73b73a2014-07-25 08:07:48 -0700227 * size = stride * height
228 *
229 * When stride is equal to width * (10 / 8), there will be no padding bytes at
230 * the end of each row, the entire image data is densely packed. When stride is
231 * larger than width * (10 / 8), padding bytes will be present at the end of each
232 * row (including the last row).
Zhijun He72fce302014-06-23 17:14:42 -0700233 *
234 * This format must be accepted by the gralloc module when used with the
235 * following usage flags:
236 * - GRALLOC_USAGE_HW_CAMERA_*
237 * - GRALLOC_USAGE_SW_*
238 * - GRALLOC_USAGE_RENDERSCRIPT
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800239 *
240 * When used with ANativeWindow, the dataSpace field should be
241 * HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial
242 * extra metadata to define.
Zhijun He72fce302014-06-23 17:14:42 -0700243 */
244 HAL_PIXEL_FORMAT_RAW10 = 0x25,
245
246 /*
Ruben Brunk535253e2014-02-04 18:13:34 -0800247 * Android opaque RAW format:
248 *
249 * This format is exposed outside of the camera HAL to applications.
250 *
251 * RAW_OPAQUE is a format for unprocessed raw image buffers coming from an
252 * image sensor. The actual structure of buffers of this format is
253 * implementation-dependent.
254 *
255 * This format must be accepted by the gralloc module when used with the
256 * following usage flags:
257 * - GRALLOC_USAGE_HW_CAMERA_*
258 * - GRALLOC_USAGE_SW_*
259 * - GRALLOC_USAGE_RENDERSCRIPT
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800260 *
261 * When used with ANativeWindow, the dataSpace field should be
262 * HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial
263 * extra metadata to define.
Ruben Brunk535253e2014-02-04 18:13:34 -0800264 */
265 HAL_PIXEL_FORMAT_RAW_OPAQUE = 0x24,
Iliyan Malchev66ea3572011-05-01 14:05:30 -0700266
Eino-Ville Talvala0a052482012-06-07 17:52:15 -0700267 /*
268 * Android binary blob graphics buffer format:
269 *
270 * This format is used to carry task-specific data which does not have a
271 * standard image structure. The details of the format are left to the two
272 * endpoints.
273 *
274 * A typical use case is for transporting JPEG-compressed images from the
275 * Camera HAL to the framework or to applications.
276 *
277 * Buffers of this format must have a height of 1, and width equal to their
278 * size in bytes.
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800279 *
280 * When used with ANativeWindow, the mapping of the dataSpace field to
281 * buffer contents for BLOB is as follows:
282 *
283 * dataSpace value | Buffer contents
284 * -------------------------------+-----------------------------------------
285 * HAL_DATASPACE_JFIF | An encoded JPEG image
286 * HAL_DATASPACE_DEPTH | An android_depth_points buffer
287 * Other | Unsupported
288 *
Eino-Ville Talvala0a052482012-06-07 17:52:15 -0700289 */
290 HAL_PIXEL_FORMAT_BLOB = 0x21,
291
Jamie Gennisfebe9d92012-08-22 14:44:51 -0700292 /*
293 * Android format indicating that the choice of format is entirely up to the
294 * device-specific Gralloc implementation.
295 *
296 * The Gralloc implementation should examine the usage bits passed in when
297 * allocating a buffer with this format, and it should derive the pixel
298 * format from those usage flags. This format will never be used with any
299 * of the GRALLOC_USAGE_SW_* usage flags.
300 *
301 * If a buffer of this format is to be used as an OpenGL ES texture, the
302 * framework will assume that sampling the texture will always return an
303 * alpha value of 1.0 (i.e. the buffer contains only opaque pixel values).
304 *
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800305 * When used with ANativeWindow, the dataSpace field describes the color
306 * space of the buffer.
Jamie Gennisfebe9d92012-08-22 14:44:51 -0700307 */
308 HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 0x22,
309
Alex Raye13f15a2013-03-19 01:41:32 -0700310 /*
311 * Android flexible YCbCr formats
312 *
313 * This format allows platforms to use an efficient YCbCr/YCrCb buffer
314 * layout, while still describing the buffer layout in a way accessible to
315 * the CPU in a device-independent manner. While called YCbCr, it can be
316 * used to describe formats with either chromatic ordering, as well as
317 * whole planar or semiplanar layouts.
318 *
319 * struct android_ycbcr (below) is the the struct used to describe it.
320 *
321 * This format must be accepted by the gralloc module when
322 * USAGE_HW_CAMERA_WRITE and USAGE_SW_READ_* are set.
323 *
324 * This format is locked for use by gralloc's (*lock_ycbcr) method, and
325 * locking with the (*lock) method will return an error.
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800326 *
327 * When used with ANativeWindow, the dataSpace field describes the color
328 * space of the buffer.
Alex Raye13f15a2013-03-19 01:41:32 -0700329 */
330 HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23,
331
Iliyan Malchev66ea3572011-05-01 14:05:30 -0700332 /* Legacy formats (deprecated), used by ImageFormat.java */
333 HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16
334 HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
335 HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2
336};
337
Alex Raye13f15a2013-03-19 01:41:32 -0700338/*
339 * Structure for describing YCbCr formats for consumption by applications.
340 * This is used with HAL_PIXEL_FORMAT_YCbCr_*_888.
341 *
342 * Buffer chroma subsampling is defined in the format.
343 * e.g. HAL_PIXEL_FORMAT_YCbCr_420_888 has subsampling 4:2:0.
344 *
345 * Buffers must have a 8 bit depth.
346 *
347 * @y, @cb, and @cr point to the first byte of their respective planes.
348 *
349 * Stride describes the distance in bytes from the first value of one row of
350 * the image to the first value of the next row. It includes the width of the
351 * image plus padding.
352 * @ystride is the stride of the luma plane.
353 * @cstride is the stride of the chroma planes.
354 *
355 * @chroma_step is the distance in bytes from one chroma pixel value to the
356 * next. This is 2 bytes for semiplanar (because chroma values are interleaved
357 * and each chroma value is one byte) and 1 for planar.
358 */
359
360struct android_ycbcr {
361 void *y;
362 void *cb;
363 void *cr;
364 size_t ystride;
365 size_t cstride;
366 size_t chroma_step;
367
368 /** reserved for future use, set to 0 by gralloc's (*lock_ycbcr)() */
369 uint32_t reserved[8];
370};
Iliyan Malchev66ea3572011-05-01 14:05:30 -0700371
372/**
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800373 * Structure used to define depth point clouds for format HAL_PIXEL_FORMAT_BLOB
374 * with dataSpace value of HAL_DATASPACE_DEPTH.
375 * When locking a native buffer of the above format and dataSpace value,
376 * the vaddr pointer can be cast to this structure.
377 *
378 * A variable-length list of (x,y,z) 3D points, as floats.
379 *
380 * @num_points is the number of points in the list
381 *
382 * @xyz_points is the flexible array of floating-point values.
383 * It contains (num_points) * 3 floats.
384 *
385 * For example:
386 * android_depth_points d = get_depth_buffer();
387 * struct {
388 * float x; float y; float z;
389 * } firstPoint, lastPoint;
390 *
391 * firstPoint.x = d.xyz_points[0];
392 * firstPoint.y = d.xyz_points[1];
393 * firstPoint.z = d.xyz_points[2];
394 * lastPoint.x = d.xyz_points[(d.num_points - 1) * 3 + 0];
395 * lastPoint.y = d.xyz_points[(d.num_points - 1) * 3 + 1];
396 * lastPoint.z = d.xyz_points[(d.num_points - 1) * 3 + 2];
397 */
398
399struct android_depth_points {
400 uint32_t num_points;
401
402 /** reserved for future use, set to 0 by gralloc's (*lock)() */
403 uint32_t reserved[8];
404
405 float xyz_points[];
406};
407
408/**
Iliyan Malchev66ea3572011-05-01 14:05:30 -0700409 * Transformation definitions
410 *
411 * IMPORTANT NOTE:
412 * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}.
413 *
414 */
415
416enum {
417 /* flip source image horizontally (around the vertical axis) */
418 HAL_TRANSFORM_FLIP_H = 0x01,
419 /* flip source image vertically (around the horizontal axis)*/
420 HAL_TRANSFORM_FLIP_V = 0x02,
421 /* rotate source image 90 degrees clockwise */
422 HAL_TRANSFORM_ROT_90 = 0x04,
423 /* rotate source image 180 degrees */
424 HAL_TRANSFORM_ROT_180 = 0x03,
425 /* rotate source image 270 degrees clockwise */
426 HAL_TRANSFORM_ROT_270 = 0x07,
Mathias Agopian96675ed2013-09-17 23:48:54 -0700427 /* don't use. see system/window.h */
428 HAL_TRANSFORM_RESERVED = 0x08,
Iliyan Malchev66ea3572011-05-01 14:05:30 -0700429};
430
Alex Rayc9f3bcf2013-11-26 16:50:46 -0800431/**
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800432 * Dataspace Definitions
Alex Rayc9f3bcf2013-11-26 16:50:46 -0800433 * ======================
434 *
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800435 * Dataspace is the definition of how pixel values should be interpreted.
436 *
437 * For many formats, this is the colorspace of the image data, which includes
438 * primaries (including white point) and the transfer characteristic function,
439 * which describes both gamma curve and numeric range (within the bit depth).
440 *
441 * Other dataspaces include depth measurement data from a depth camera.
Alex Rayc9f3bcf2013-11-26 16:50:46 -0800442 */
443
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800444typedef enum android_dataspace {
Alex Rayc9f3bcf2013-11-26 16:50:46 -0800445 /*
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800446 * Default-assumption data space, when not explicitly specified.
447 *
448 * It is safest to assume the buffer is an image with sRGB primaries and
449 * encoding ranges, but the consumer and/or the producer of the data may
450 * simply be using defaults. No automatic gamma transform should be
451 * expected, except for a possible display gamma transform when drawn to a
452 * screen.
453 */
454 HAL_DATASPACE_UNKNOWN = 0x0,
455
456 /*
457 * Arbitrary dataspace with manually defined characteristics. Definition
458 * for colorspaces or other meaning must be communicated separately.
Alex Rayc9f3bcf2013-11-26 16:50:46 -0800459 *
460 * This is used when specifying primaries, transfer characteristics,
461 * etc. separately.
462 *
463 * A typical use case is in video encoding parameters (e.g. for H.264),
464 * where a colorspace can have separately defined primaries, transfer
465 * characteristics, etc.
466 */
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800467 HAL_DATASPACE_ARBITRARY = 0x1,
468
469 /*
470 * RGB Colorspaces
471 * -----------------
472 *
473 * Primaries are given using (x,y) coordinates in the CIE 1931 definition
474 * of x and y specified by ISO 11664-1.
475 *
476 * Transfer characteristics are the opto-electronic transfer characteristic
477 * at the source as a function of linear optical intensity (luminance).
478 */
479
480 /*
481 * sRGB linear encoding:
482 *
483 * The red, green, and blue components are stored in sRGB space, but
484 * are linear, not gamma-encoded.
485 * The RGB primaries and the white point are the same as BT.709.
486 *
487 * The values are encoded using the full range ([0,255] for 8-bit) for all
488 * components.
489 */
490 HAL_DATASPACE_SRGB_LINEAR = 0x200,
491
492 /*
493 * sRGB gamma encoding:
494 *
495 * The red, green and blue components are stored in sRGB space, and
496 * converted to linear space when read, using the standard sRGB to linear
497 * equation:
498 *
499 * Clinear = Csrgb / 12.92 for Csrgb <= 0.04045
500 * = (Csrgb + 0.055 / 1.055)^2.4 for Csrgb > 0.04045
501 *
502 * When written the inverse transformation is performed:
503 *
504 * Csrgb = 12.92 * Clinear for Clinear <= 0.0031308
505 * = 1.055 * Clinear^(1/2.4) - 0.055 for Clinear > 0.0031308
506 *
507 *
508 * The alpha component, if present, is always stored in linear space and
509 * is left unmodified when read or written.
510 *
511 * The RGB primaries and the white point are the same as BT.709.
512 *
513 * The values are encoded using the full range ([0,255] for 8-bit) for all
514 * components.
515 *
516 */
517 HAL_DATASPACE_SRGB = 0x201,
Alex Rayc9f3bcf2013-11-26 16:50:46 -0800518
519 /*
520 * YCbCr Colorspaces
521 * -----------------
522 *
523 * Primaries are given using (x,y) coordinates in the CIE 1931 definition
524 * of x and y specified by ISO 11664-1.
525 *
526 * Transfer characteristics are the opto-electronic transfer characteristic
527 * at the source as a function of linear optical intensity (luminance).
528 */
529
530 /*
531 * JPEG File Interchange Format (JFIF)
532 *
533 * Same model as BT.601-625, but all values (Y, Cb, Cr) range from 0 to 255
534 *
535 * Transfer characteristic curve:
536 * E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018
537 * E = 4.500 L, 0.018 > L >= 0
538 * L - luminance of image 0 <= L <= 1 for conventional colorimetry
539 * E - corresponding electrical signal
540 *
541 * Primaries: x y
542 * green 0.290 0.600
543 * blue 0.150 0.060
544 * red 0.640 0.330
545 * white (D65) 0.3127 0.3290
546 */
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800547 HAL_DATASPACE_JFIF = 0x101,
Alex Rayc9f3bcf2013-11-26 16:50:46 -0800548
549 /*
550 * ITU-R Recommendation 601 (BT.601) - 625-line
551 *
552 * Standard-definition television, 625 Lines (PAL)
553 *
554 * For 8-bit-depth formats:
555 * Luma (Y) samples should range from 16 to 235, inclusive
556 * Chroma (Cb, Cr) samples should range from 16 to 240, inclusive
557 *
558 * For 10-bit-depth formats:
559 * Luma (Y) samples should range from 64 to 940, inclusive
560 * Chroma (Cb, Cr) samples should range from 64 to 960, inclusive
561 *
562 * Transfer characteristic curve:
563 * E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018
564 * E = 4.500 L, 0.018 > L >= 0
565 * L - luminance of image 0 <= L <= 1 for conventional colorimetry
566 * E - corresponding electrical signal
567 *
568 * Primaries: x y
569 * green 0.290 0.600
570 * blue 0.150 0.060
571 * red 0.640 0.330
572 * white (D65) 0.3127 0.3290
573 */
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800574 HAL_DATASPACE_BT601_625 = 0x102,
Alex Rayc9f3bcf2013-11-26 16:50:46 -0800575
576 /*
577 * ITU-R Recommendation 601 (BT.601) - 525-line
578 *
579 * Standard-definition television, 525 Lines (NTSC)
580 *
581 * For 8-bit-depth formats:
582 * Luma (Y) samples should range from 16 to 235, inclusive
583 * Chroma (Cb, Cr) samples should range from 16 to 240, inclusive
584 *
585 * For 10-bit-depth formats:
586 * Luma (Y) samples should range from 64 to 940, inclusive
587 * Chroma (Cb, Cr) samples should range from 64 to 960, inclusive
588 *
589 * Transfer characteristic curve:
590 * E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018
591 * E = 4.500 L, 0.018 > L >= 0
592 * L - luminance of image 0 <= L <= 1 for conventional colorimetry
593 * E - corresponding electrical signal
594 *
595 * Primaries: x y
596 * green 0.310 0.595
597 * blue 0.155 0.070
598 * red 0.630 0.340
599 * white (D65) 0.3127 0.3290
600 */
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800601 HAL_DATASPACE_BT601_525 = 0x103,
Alex Rayc9f3bcf2013-11-26 16:50:46 -0800602
603 /*
604 * ITU-R Recommendation 709 (BT.709)
605 *
606 * High-definition television
607 *
608 * For 8-bit-depth formats:
609 * Luma (Y) samples should range from 16 to 235, inclusive
610 * Chroma (Cb, Cr) samples should range from 16 to 240, inclusive
611 *
612 * For 10-bit-depth formats:
613 * Luma (Y) samples should range from 64 to 940, inclusive
614 * Chroma (Cb, Cr) samples should range from 64 to 960, inclusive
615 *
616 * Primaries: x y
617 * green 0.300 0.600
618 * blue 0.150 0.060
619 * red 0.640 0.330
620 * white (D65) 0.3127 0.3290
621 */
Eino-Ville Talvala03743412015-02-17 15:34:44 -0800622 HAL_DATASPACE_BT709 = 0x104,
623
624 /*
625 * The buffer contains depth ranging measurements from a depth camera.
626 * This value is valid with formats:
627 * HAL_PIXEL_FORMAT_Y16: 16-bit single channel depth image.
628 * HAL_PIXEL_FORMAT_BLOB: A depth point cloud, as
629 * a variable-length float (x,y,z) coordinate point list.
630 * The point cloud will be represented with the android_depth_points
631 * structure.
632 */
633 HAL_DATASPACE_DEPTH = 0x1000
634
635} android_dataspace_t;
Alex Rayc9f3bcf2013-11-26 16:50:46 -0800636
Mathias Agopianc9b06952011-08-11 22:35:31 -0700637#ifdef __cplusplus
638}
639#endif
Iliyan Malchev66ea3572011-05-01 14:05:30 -0700640
641#endif /* SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H */