ISVP-SDK  3.12.0
Ingenic Smart Video Platform SDK
imp_common.h
浏览该文件的文档.
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]; /* 私有数据 */
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 
135  PIX_FMT_HSV,
136 
139 
143 typedef struct {
144  int x;
145  int y;
146 } IMPPoint;
147 
162 typedef struct {
165 } IMPRect;
166 
167 static inline int calc_pic_size(int width, int height, IMPPixelFormat imp_pixfmt)
168 {
169  int bpp1 = 0, bpp2 = 1,size;
170 
171 #define BPP(FMT, A, B) case FMT: bpp1 = A;bpp2 = B;break
172  switch (imp_pixfmt) {
173  BPP(PIX_FMT_NV12, 3, 2);
174  BPP(PIX_FMT_YUYV422, 2, 1);
175  BPP(PIX_FMT_UYVY422, 2, 1);
176  BPP(PIX_FMT_RGB565BE, 2, 1);
177  BPP(PIX_FMT_BGR0, 4, 1);
178  BPP(PIX_FMT_BGR24, 3, 1);
179  BPP(PIX_FMT_HSV, 4, 1);
180  BPP(PIX_FMT_BGRA, 4, 1);
181  default: break;
182  }
183 #undef BPP
184  size = width * height * bpp1 / bpp2;
185 
186  return size;
187 }
188 
189 static inline const char *fmt_to_string(IMPPixelFormat imp_pixfmt)
190 {
191  static const char *nv12 = "nv12";
192  static const char *yuyv422 = "yuyv422";
193 
194  switch (imp_pixfmt) {
195  case PIX_FMT_NV12:
196  return nv12;
197  case PIX_FMT_YUYV422:
198  return yuyv422;
199  default:
200  break;
201  }
202  return NULL;
203 }
204 
205 #ifdef __cplusplus
206 #if __cplusplus
207 }
208 #endif
209 #endif /* __cplusplus */
210 
211 #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
时间
Definition: imp_common.h:74
解码器
Definition: imp_common.h:33
int y
纵坐标
Definition: imp_common.h:145
图像叠加
Definition: imp_common.h:35
H264视频协议类型
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
帧的虚拟地址
Definition: imp_common.h:64
uint32_t pixfmt
帧的图像格式
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
编解码协议类型
Definition: imp_common.h:82
IMPDeviceID
IMP 设备ID枚举定义.
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
下限
Definition: imp_common.h:75
IMP帧图像信息定义.
Definition: imp_common.h:54
算法
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
帧序号
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
左上角点坐标信息
Definition: imp_common.h:163
uint32_t width
帧宽
Definition: imp_common.h:58
int outputID
输出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
帧的时间戳
Definition: imp_common.h:66
as above, but U and V bytes are swapped
Definition: imp_common.h:103
uint32_t size
帧所占用空间大小
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图像协议类型
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
右下角点坐标信息
Definition: imp_common.h:164
IMP点坐标信息.
Definition: imp_common.h:143
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
横坐标
Definition: imp_common.h:144
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
视频源
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:137
IMP帧时间参数.
Definition: imp_common.h:73
IMPPixelFormat
IMP图像格式定义.
Definition: imp_common.h:90
bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples
Definition: imp_common.h:128
编码器
Definition: imp_common.h:32
IMPCell枚举定义.
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
组ID
Definition: imp_common.h:47
uint64_t plus
上限
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
帧高
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
设备ID
Definition: imp_common.h:46
int pool_idx
帧所在的Pool的ID
Definition: imp_common.h:56
uint32_t phyAddr
帧的物理地址
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 矩形区域信息.
Definition: imp_common.h:162