ISVP-SDK  3.12.0
Ingenic Smart Video Platform SDK
imp_common.h
Go to the documentation of this file.
1 /*
2  * IMP common data structure header file.
3  *
4  * Copyright (C) 2014 Ingenic Semiconductor Co.,Ltd
5  */
6 
7 #ifndef __IMP_COMMON_H__
8 #define __IMP_COMMON_H__
9 
10 #include <stdint.h>
11 #include <pthread.h>
12 #include <linux/videodev2.h>
13 #include <stdio.h>
14 
15 #ifdef __cplusplus
16 #if __cplusplus
17 extern "C"
18 {
19 #endif
20 #endif /* __cplusplus */
21 
30 typedef enum {
37  DEV_ID_RESERVED_START,
38  DEV_ID_RESERVED_END = 23,
39  NR_MAX_DEVICES,
40 } IMPDeviceID;
41 
45 typedef struct {
47  int groupID;
48  int outputID;
49 } IMPCell;
50 
54 typedef struct {
55  int index;
56  int pool_idx;
58  uint32_t width;
59  uint32_t height;
60  uint32_t pixfmt;
61  uint32_t size;
63  uint32_t phyAddr;
64  uint32_t virAddr;
66  int64_t timeStamp;
67  uint32_t priv[0]; /* private data */
68 } IMPFrameInfo;
69 
73 typedef struct {
74  uint64_t ts;
75  uint64_t minus;
76  uint64_t plus;
78 
82 typedef enum {
86 
90 typedef enum {
133  PIX_FMT_RAW,
134 
137 
141 typedef struct {
142  int x;
143  int y;
144 } IMPPoint;
145 
160 typedef struct {
163 } IMPRect;
164 
165 static inline int calc_pic_size(int width, int height, IMPPixelFormat imp_pixfmt)
166 {
167  int bpp1 = 0, bpp2 = 1,size;
168 
169 #define BPP(FMT, A, B) case FMT: bpp1 = A;bpp2 = B;break
170  switch (imp_pixfmt) {
171  BPP(PIX_FMT_NV12, 3, 2);
172  BPP(PIX_FMT_YUYV422, 2, 1);
173  BPP(PIX_FMT_UYVY422, 2, 1);
174  BPP(PIX_FMT_RGB565BE, 2, 1);
175  BPP(PIX_FMT_BGR0, 4, 1);
176  BPP(PIX_FMT_BGR24, 3, 1);
177  default: break;
178  }
179 #undef BPP
180  size = width * height * bpp1 / bpp2;
181 
182  return size;
183 }
184 
185 static inline const char *fmt_to_string(IMPPixelFormat imp_pixfmt)
186 {
187  static const char *nv12 = "nv12";
188  static const char *yuyv422 = "yuyv422";
189 
190  switch (imp_pixfmt) {
191  case PIX_FMT_NV12:
192  return nv12;
193  case PIX_FMT_YUYV422:
194  return yuyv422;
195  default:
196  break;
197  }
198  return NULL;
199 }
200 
201 #ifdef __cplusplus
202 #if __cplusplus
203 }
204 #endif
205 #endif /* __cplusplus */
206 
207 #endif /* __IMP_COMMON_H__ */
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: imp_common.h:93
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: imp_common.h:108
uint64_t ts
time
Definition: imp_common.h:74
Decoder.
Definition: imp_common.h:33
int y
Y-axis.
Definition: imp_common.h:143
Image Overlay.
Definition: imp_common.h:35
H264 video protocol type.
Definition: imp_common.h:84
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 ...
Definition: imp_common.h:115
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
Definition: imp_common.h:119
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: imp_common.h:111
uint32_t virAddr
frame's virtual address
Definition: imp_common.h:64
uint32_t pixfmt
frame's image format
Definition: imp_common.h:60
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: imp_common.h:105
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: imp_common.h:106
bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples
Definition: imp_common.h:129
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb...
Definition: imp_common.h:100
IMPPayloadType
Encoding and decoding protocol type.
Definition: imp_common.h:82
IMPDeviceID
IMP Device ID enumeration definition.
Definition: imp_common.h:30
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: imp_common.h:91
uint64_t minus
time to min
Definition: imp_common.h:75
IMP frame image information definition.
Definition: imp_common.h:54
Algorithm.
Definition: imp_common.h:34
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
Definition: imp_common.h:113
FB FG1Direct.
Definition: imp_common.h:36
packed BGR 8:8:8, 32bpp, 0BGR0BGR...
Definition: imp_common.h:125
int index
frame index
Definition: imp_common.h:55
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 ...
Definition: imp_common.h:116
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: imp_common.h:96
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: imp_common.h:109
IMPPoint p0
Upper left corner coordinate information.
Definition: imp_common.h:161
uint32_t width
frame's width
Definition: imp_common.h:58
int outputID
output ID
Definition: imp_common.h:48
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: imp_common.h:97
int64_t timeStamp
frame time stamp
Definition: imp_common.h:66
as above, but U and V bytes are swapped
Definition: imp_common.h:103
uint32_t size
frame's occupied space
Definition: imp_common.h:61
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: imp_common.h:110
packed BGR 8:8:8, 32bpp, BGR0BGR0...
Definition: imp_common.h:126
JPEG image protocol type.
Definition: imp_common.h:83
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
Definition: imp_common.h:118
IMPPoint p1
Lower right corner coordinate information.
Definition: imp_common.h:162
IMP point coordinate information.
Definition: imp_common.h:141
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition: imp_common.h:114
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: imp_common.h:92
int x
X-axis.
Definition: imp_common.h:142
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
Definition: imp_common.h:99
Video Source.
Definition: imp_common.h:31
bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples
Definition: imp_common.h:130
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: imp_common.h:94
number of pixel formats.
Definition: imp_common.h:135
IMP Frame time parameter.
Definition: imp_common.h:73
IMPPixelFormat
IMP image format definition.
Definition: imp_common.h:90
bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples
Definition: imp_common.h:128
Encoder.
Definition: imp_common.h:32
IMPCell enumeration definition.
Definition: imp_common.h:45
packed RGB 8:8:8, 32bpp, RGB0RGB0...
Definition: imp_common.h:124
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: imp_common.h:102
int groupID
Group ID.
Definition: imp_common.h:47
uint64_t plus
max to time
Definition: imp_common.h:76
Y , 8bpp.
Definition: imp_common.h:98
packed RGB 8:8:8, 32bpp, 0RGB0RGB...
Definition: imp_common.h:123
uint32_t height
frame's height
Definition: imp_common.h:59
packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 ...
Definition: imp_common.h:121
bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples
Definition: imp_common.h:131
IMPDeviceID deviceID
Device ID.
Definition: imp_common.h:46
int pool_idx
frame Pool's ID
Definition: imp_common.h:56
uint32_t phyAddr
frame's physical address
Definition: imp_common.h:63
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: imp_common.h:95
packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 ...
Definition: imp_common.h:120
IMP Rectangle area information.
Definition: imp_common.h:160