-
Notifications
You must be signed in to change notification settings - Fork 3
/
vc_image_types.lua
142 lines (123 loc) · 5.84 KB
/
vc_image_types.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
-- Common image types used by the vc_image library
local ffi = require "ffi"
--[[
This file gets included by the VCE compiler, which gets confused
easily by the VCOS headers. So cannot include vcos.h here.
--]]
ffi.cdef[[
/* We have so many rectangle types; let's try to introduce a common one. */
typedef struct tag_VC_RECT_T {
int32_t x;
int32_t y;
int32_t width;
int32_t height;
} VC_RECT_T;
struct VC_IMAGE_T;
typedef struct VC_IMAGE_T VC_IMAGE_T;
/* Types of image supported. */
/* Please add any new types to the *end* of this list. Also update
* case_VC_IMAGE_ANY_xxx macros (below), and the vc_image_type_info table in
* vc_image/vc_image_helper.c.
*/
typedef enum
{
VC_IMAGE_MIN = 0, //bounds for error checking
VC_IMAGE_RGB565 = 1,
VC_IMAGE_1BPP,
VC_IMAGE_YUV420,
VC_IMAGE_48BPP,
VC_IMAGE_RGB888,
VC_IMAGE_8BPP,
VC_IMAGE_4BPP, // 4bpp palettised image
VC_IMAGE_3D32, /* A separated format of 16 colour/light shorts followed by 16 z values */
VC_IMAGE_3D32B, /* 16 colours followed by 16 z values */
VC_IMAGE_3D32MAT, /* A separated format of 16 material/colour/light shorts followed by 16 z values */
VC_IMAGE_RGB2X9, /* 32 bit format containing 18 bits of 6.6.6 RGB, 9 bits per short */
VC_IMAGE_RGB666, /* 32-bit format holding 18 bits of 6.6.6 RGB */
VC_IMAGE_PAL4_OBSOLETE, // 4bpp palettised image with embedded palette
VC_IMAGE_PAL8_OBSOLETE, // 8bpp palettised image with embedded palette
VC_IMAGE_RGBA32, /* RGB888 with an alpha byte after each pixel */ /* xxx: isn't it BEFORE each pixel? */
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) */
VC_IMAGE_RGBA565, /* RGB565 with a transparent patch */
VC_IMAGE_RGBA16, /* Compressed (4444) version of RGBA32 */
VC_IMAGE_YUV_UV, /* VCIII codec format */
VC_IMAGE_TF_RGBA32, /* VCIII T-format RGBA8888 */
VC_IMAGE_TF_RGBX32, /* VCIII T-format RGBx8888 */
VC_IMAGE_TF_FLOAT, /* VCIII T-format float */
VC_IMAGE_TF_RGBA16, /* VCIII T-format RGBA4444 */
VC_IMAGE_TF_RGBA5551, /* VCIII T-format RGB5551 */
VC_IMAGE_TF_RGB565, /* VCIII T-format RGB565 */
VC_IMAGE_TF_YA88, /* VCIII T-format 8-bit luma and 8-bit alpha */
VC_IMAGE_TF_BYTE, /* VCIII T-format 8 bit generic sample */
VC_IMAGE_TF_PAL8, /* VCIII T-format 8-bit palette */
VC_IMAGE_TF_PAL4, /* VCIII T-format 4-bit palette */
VC_IMAGE_TF_ETC1, /* VCIII T-format Ericsson Texture Compressed */
VC_IMAGE_BGR888, /* RGB888 with R & B swapped */
VC_IMAGE_BGR888_NP, /* RGB888 with R & B swapped, but with no pitch, i.e. no padding after each row of pixels */
VC_IMAGE_BAYER, /* Bayer image, extra defines which variant is being used */
VC_IMAGE_CODEC, /* General wrapper for codec images e.g. JPEG from camera */
VC_IMAGE_YUV_UV32, /* VCIII codec format */
VC_IMAGE_TF_Y8, /* VCIII T-format 8-bit luma */
VC_IMAGE_TF_A8, /* VCIII T-format 8-bit alpha */
VC_IMAGE_TF_SHORT,/* VCIII T-format 16-bit generic sample */
VC_IMAGE_TF_1BPP, /* VCIII T-format 1bpp black/white */
VC_IMAGE_OPENGL,
VC_IMAGE_YUV444I, /* VCIII-B0 HVS YUV 4:4:4 interleaved samples */
VC_IMAGE_YUV422PLANAR, /* Y, U, & V planes separately (VC_IMAGE_YUV422 has them interleaved on a per line basis) */
VC_IMAGE_ARGB8888, /* 32bpp with 8bit alpha at MS byte, with R, G, B (LS byte) */
VC_IMAGE_XRGB8888, /* 32bpp with 8bit unused at MS byte, with R, G, B (LS byte) */
VC_IMAGE_YUV422YUYV, /* interleaved 8 bit samples of Y, U, Y, V */
VC_IMAGE_YUV422YVYU, /* interleaved 8 bit samples of Y, V, Y, U */
VC_IMAGE_YUV422UYVY, /* interleaved 8 bit samples of U, Y, V, Y */
VC_IMAGE_YUV422VYUY, /* interleaved 8 bit samples of V, Y, U, Y */
VC_IMAGE_RGBX32, /* 32bpp like RGBA32 but with unused alpha */
VC_IMAGE_RGBX8888, /* 32bpp, corresponding to RGBA with unused alpha */
VC_IMAGE_BGRX8888, /* 32bpp, corresponding to BGRA with unused alpha */
VC_IMAGE_YUV420SP, /* Y as a plane, then UV byte interleaved in plane with with same pitch, half height */
VC_IMAGE_YUV444PLANAR, /* Y, U, & V planes separately 4:4:4 */
VC_IMAGE_MAX, //bounds for error checking
VC_IMAGE_FORCE_ENUM_16BIT = 0xffff,
} VC_IMAGE_TYPE_T;
/* Image transformations (flips and 90 degree rotations).
These are made out of 3 primitives (transpose is done first).
These must match the DISPMAN and Media Player definitions. */
static const int TRANSFORM_HFLIP = (1<<0);
static const int TRANSFORM_VFLIP = (1<<1);
static const int TRANSFORM_TRANSPOSE = (1<<2);
typedef enum {
VC_IMAGE_ROT0 = 0,
VC_IMAGE_MIRROR_ROT0 = TRANSFORM_HFLIP,
VC_IMAGE_MIRROR_ROT180 = TRANSFORM_VFLIP,
VC_IMAGE_ROT180 = TRANSFORM_HFLIP|TRANSFORM_VFLIP,
VC_IMAGE_MIRROR_ROT90 = TRANSFORM_TRANSPOSE,
VC_IMAGE_ROT270 = TRANSFORM_TRANSPOSE|TRANSFORM_HFLIP,
VC_IMAGE_ROT90 = TRANSFORM_TRANSPOSE|TRANSFORM_VFLIP,
VC_IMAGE_MIRROR_ROT270 = TRANSFORM_TRANSPOSE|TRANSFORM_HFLIP|TRANSFORM_VFLIP,
} VC_IMAGE_TRANSFORM_T;
typedef enum
{ //defined to be identical to register bits
VC_IMAGE_BAYER_RGGB = 0,
VC_IMAGE_BAYER_GBRG = 1,
VC_IMAGE_BAYER_BGGR = 2,
VC_IMAGE_BAYER_GRBG = 3
} VC_IMAGE_BAYER_ORDER_T;
typedef enum
{ //defined to be identical to register bits
VC_IMAGE_BAYER_RAW6 = 0,
VC_IMAGE_BAYER_RAW7 = 1,
VC_IMAGE_BAYER_RAW8 = 2,
VC_IMAGE_BAYER_RAW10 = 3,
VC_IMAGE_BAYER_RAW12 = 4,
VC_IMAGE_BAYER_RAW14 = 5,
VC_IMAGE_BAYER_RAW16 = 6,
VC_IMAGE_BAYER_RAW10_8 = 7,
VC_IMAGE_BAYER_RAW12_8 = 8,
VC_IMAGE_BAYER_RAW14_8 = 9,
VC_IMAGE_BAYER_RAW10L = 11,
VC_IMAGE_BAYER_RAW12L = 12,
VC_IMAGE_BAYER_RAW14L = 13,
VC_IMAGE_BAYER_RAW16_BIG_ENDIAN = 14,
VC_IMAGE_BAYER_RAW4 = 15,
} VC_IMAGE_BAYER_FORMAT_T;
]]
VC_RECT_T = ffi.typeof("VC_RECT_T");