Fix ASAN build error
[platform/adaptation/broadcom/libomxil-vc4.git] / interface / vctypes / vc_image_types.h
1 /*
2 Copyright (c) 2012, Broadcom Europe Ltd
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7     * Redistributions of source code must retain the above copyright
8       notice, this list of conditions and the following disclaimer.
9     * Redistributions in binary form must reproduce the above copyright
10       notice, this list of conditions and the following disclaimer in the
11       documentation and/or other materials provided with the distribution.
12     * Neither the name of the copyright holder nor the
13       names of its contributors may be used to endorse or promote products
14       derived from this software without specific prior written permission.
15
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 // Common image types used by the vc_image library
29
30 #ifndef INTERFACE_VC_IMAGE_TYPES_H
31 #define INTERFACE_VC_IMAGE_TYPES_H
32
33 /* This file gets included by the VCE compiler, which gets confused
34  * easily by the VCOS headers. So cannot include vcos.h here.
35  */
36 #include "interface/vcos/vcos_stdint.h"
37
38 /* We have so many rectangle types; let's try to introduce a common one. */
39 typedef struct tag_VC_RECT_T {
40    int32_t x;
41    int32_t y;
42    int32_t width;
43    int32_t height;
44 } VC_RECT_T;
45
46 struct VC_IMAGE_T;
47 typedef struct VC_IMAGE_T VC_IMAGE_T;
48
49 /* Types of image supported. */
50 /* Please add any new types to the *end* of this list.  Also update
51  * case_VC_IMAGE_ANY_xxx macros (below), and the vc_image_type_info table in
52  * vc_image/vc_image_helper.c.
53  */
54 typedef enum
55 {
56    VC_IMAGE_MIN = 0, //bounds for error checking
57
58    VC_IMAGE_RGB565 = 1,
59    VC_IMAGE_1BPP,
60    VC_IMAGE_YUV420,
61    VC_IMAGE_48BPP,
62    VC_IMAGE_RGB888,
63    VC_IMAGE_8BPP,
64    VC_IMAGE_4BPP,    // 4bpp palettised image
65    VC_IMAGE_3D32,    /* A separated format of 16 colour/light shorts followed by 16 z values */
66    VC_IMAGE_3D32B,   /* 16 colours followed by 16 z values */
67    VC_IMAGE_3D32MAT, /* A separated format of 16 material/colour/light shorts followed by 16 z values */
68    VC_IMAGE_RGB2X9,   /* 32 bit format containing 18 bits of 6.6.6 RGB, 9 bits per short */
69    VC_IMAGE_RGB666,   /* 32-bit format holding 18 bits of 6.6.6 RGB */
70    VC_IMAGE_PAL4_OBSOLETE,     // 4bpp palettised image with embedded palette
71    VC_IMAGE_PAL8_OBSOLETE,     // 8bpp palettised image with embedded palette
72    VC_IMAGE_RGBA32,   /* RGB888 with an alpha byte after each pixel */ /* xxx: isn't it BEFORE each pixel? */
73    VC_IMAGE_YUV422,   /* a line of Y (32-byte padded), a line of U (16-byte padded), and a line of V (16-byte padded) */
74    VC_IMAGE_RGBA565,  /* RGB565 with a transparent patch */
75    VC_IMAGE_RGBA16,   /* Compressed (4444) version of RGBA32 */
76    VC_IMAGE_YUV_UV,   /* VCIII codec format */
77    VC_IMAGE_TF_RGBA32, /* VCIII T-format RGBA8888 */
78    VC_IMAGE_TF_RGBX32,  /* VCIII T-format RGBx8888 */
79    VC_IMAGE_TF_FLOAT, /* VCIII T-format float */
80    VC_IMAGE_TF_RGBA16, /* VCIII T-format RGBA4444 */
81    VC_IMAGE_TF_RGBA5551, /* VCIII T-format RGB5551 */
82    VC_IMAGE_TF_RGB565, /* VCIII T-format RGB565 */
83    VC_IMAGE_TF_YA88, /* VCIII T-format 8-bit luma and 8-bit alpha */
84    VC_IMAGE_TF_BYTE, /* VCIII T-format 8 bit generic sample */
85    VC_IMAGE_TF_PAL8, /* VCIII T-format 8-bit palette */
86    VC_IMAGE_TF_PAL4, /* VCIII T-format 4-bit palette */
87    VC_IMAGE_TF_ETC1, /* VCIII T-format Ericsson Texture Compressed */
88    VC_IMAGE_BGR888,  /* RGB888 with R & B swapped */
89    VC_IMAGE_BGR888_NP,  /* RGB888 with R & B swapped, but with no pitch, i.e. no padding after each row of pixels */
90    VC_IMAGE_BAYER,  /* Bayer image, extra defines which variant is being used */
91    VC_IMAGE_CODEC,  /* General wrapper for codec images e.g. JPEG from camera */
92    VC_IMAGE_YUV_UV32,   /* VCIII codec format */
93    VC_IMAGE_TF_Y8,   /* VCIII T-format 8-bit luma */
94    VC_IMAGE_TF_A8,   /* VCIII T-format 8-bit alpha */
95    VC_IMAGE_TF_SHORT,/* VCIII T-format 16-bit generic sample */
96    VC_IMAGE_TF_1BPP, /* VCIII T-format 1bpp black/white */
97    VC_IMAGE_OPENGL,
98    VC_IMAGE_YUV444I, /* VCIII-B0 HVS YUV 4:4:4 interleaved samples */
99    VC_IMAGE_YUV422PLANAR,  /* Y, U, & V planes separately (VC_IMAGE_YUV422 has them interleaved on a per line basis) */
100    VC_IMAGE_ARGB8888,   /* 32bpp with 8bit alpha at MS byte, with R, G, B (LS byte) */
101    VC_IMAGE_XRGB8888,   /* 32bpp with 8bit unused at MS byte, with R, G, B (LS byte) */
102
103    VC_IMAGE_YUV422YUYV,  /* interleaved 8 bit samples of Y, U, Y, V */
104    VC_IMAGE_YUV422YVYU,  /* interleaved 8 bit samples of Y, V, Y, U */
105    VC_IMAGE_YUV422UYVY,  /* interleaved 8 bit samples of U, Y, V, Y */
106    VC_IMAGE_YUV422VYUY,  /* interleaved 8 bit samples of V, Y, U, Y */
107
108    VC_IMAGE_RGBX32,      /* 32bpp like RGBA32 but with unused alpha */
109    VC_IMAGE_RGBX8888,    /* 32bpp, corresponding to RGBA with unused alpha */
110    VC_IMAGE_BGRX8888,    /* 32bpp, corresponding to BGRA with unused alpha */
111
112    VC_IMAGE_YUV420SP,    /* Y as a plane, then UV byte interleaved in plane with with same pitch, half height */
113    
114    VC_IMAGE_YUV444PLANAR,  /* Y, U, & V planes separately 4:4:4 */
115
116    VC_IMAGE_TF_U8,   /* T-format 8-bit U - same as TF_Y8 buf from U plane */
117    VC_IMAGE_TF_V8,   /* T-format 8-bit U - same as TF_Y8 buf from V plane */
118    
119    VC_IMAGE_YUV420_16,  /* YUV4:2:0 planar, 16bit values */
120    VC_IMAGE_YUV_UV_16,  /* YUV4:2:0 codec format, 16bit values */
121
122    VC_IMAGE_MAX,     //bounds for error checking
123    VC_IMAGE_FORCE_ENUM_16BIT = 0xffff,
124 } VC_IMAGE_TYPE_T;
125
126 /* Image transformations (flips and 90 degree rotations).
127    These are made out of 3 primitives (transpose is done first).
128    These must match the DISPMAN and Media Player definitions. */
129
130 #define TRANSFORM_HFLIP     (1<<0)
131 #define TRANSFORM_VFLIP     (1<<1)
132 #define TRANSFORM_TRANSPOSE (1<<2)
133
134 typedef enum {
135    VC_IMAGE_ROT0           = 0,
136    VC_IMAGE_MIRROR_ROT0    = TRANSFORM_HFLIP,
137    VC_IMAGE_MIRROR_ROT180  = TRANSFORM_VFLIP,
138    VC_IMAGE_ROT180         = TRANSFORM_HFLIP|TRANSFORM_VFLIP,
139    VC_IMAGE_MIRROR_ROT90   = TRANSFORM_TRANSPOSE,
140    VC_IMAGE_ROT270         = TRANSFORM_TRANSPOSE|TRANSFORM_HFLIP,
141    VC_IMAGE_ROT90          = TRANSFORM_TRANSPOSE|TRANSFORM_VFLIP,
142    VC_IMAGE_MIRROR_ROT270  = TRANSFORM_TRANSPOSE|TRANSFORM_HFLIP|TRANSFORM_VFLIP,
143 } VC_IMAGE_TRANSFORM_T;
144
145 typedef enum
146 { //defined to be identical to register bits
147    VC_IMAGE_BAYER_RGGB     = 0,
148    VC_IMAGE_BAYER_GBRG     = 1,
149    VC_IMAGE_BAYER_BGGR     = 2,
150    VC_IMAGE_BAYER_GRBG     = 3
151 } VC_IMAGE_BAYER_ORDER_T;
152
153 typedef enum
154 { //defined to be identical to register bits
155    VC_IMAGE_BAYER_RAW6     = 0,
156    VC_IMAGE_BAYER_RAW7     = 1,
157    VC_IMAGE_BAYER_RAW8     = 2,
158    VC_IMAGE_BAYER_RAW10    = 3,
159    VC_IMAGE_BAYER_RAW12    = 4,
160    VC_IMAGE_BAYER_RAW14    = 5,
161    VC_IMAGE_BAYER_RAW16    = 6,
162    VC_IMAGE_BAYER_RAW10_8  = 7,
163    VC_IMAGE_BAYER_RAW12_8  = 8,
164    VC_IMAGE_BAYER_RAW14_8  = 9,
165    VC_IMAGE_BAYER_RAW10L   = 11,
166    VC_IMAGE_BAYER_RAW12L   = 12,
167    VC_IMAGE_BAYER_RAW14L   = 13,
168    VC_IMAGE_BAYER_RAW16_BIG_ENDIAN = 14, 
169    VC_IMAGE_BAYER_RAW4    = 15,
170 } VC_IMAGE_BAYER_FORMAT_T;
171
172 #endif /* __VC_INCLUDE_IMAGE_TYPES_H__ */
173