hi_comm_region.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. /******************************************************************************
  2. *
  3. * Copyright (C), 2001-2011, Huawei Tech. Co., Ltd.
  4. *
  5. *******************************************************************************
  6. * File Name : hi_comm_region.h
  7. * Version : Initial Draft
  8. * Author : j00169368
  9. * Created : 2010/12/13
  10. * Last Modified :
  11. * Description : include RGN struct , Marco and Error information
  12. * Function List :
  13. *
  14. *
  15. * History:
  16. *
  17. * 1. Date : 2010/12/13
  18. * Author : j00169368
  19. * Modification : Created file
  20. *
  21. ******************************************************************************/
  22. #ifndef __HI_COMM_REGION_H__
  23. #define __HI_COMM_REGION_H__
  24. #include "hi_common.h"
  25. #include "hi_comm_video.h"
  26. #include "hi_errno.h"
  27. #include "hi_defines.h"
  28. #ifdef __cplusplus
  29. #if __cplusplus
  30. extern "C"{
  31. #endif
  32. #endif /* End of #ifdef __cplusplus */
  33. #define RGN_COLOR_LUT_NUM 2
  34. typedef HI_U32 RGN_HANDLE;
  35. typedef HI_U32 RGN_HANDLEGROUP;
  36. /* type of video regions */
  37. typedef enum hiRGN_TYPE_E
  38. {
  39. OVERLAY_RGN = 0, /* video overlay region */
  40. COVER_RGN,
  41. COVEREX_RGN,
  42. OVERLAYEX_RGN,
  43. MOSAIC_RGN,
  44. RGN_BUTT
  45. } RGN_TYPE_E;
  46. typedef enum hiINVERT_COLOR_MODE_E
  47. {
  48. LESSTHAN_LUM_THRESH = 0, /* the lum of the video is less than the lum threshold which is set by u32LumThresh */
  49. MORETHAN_LUM_THRESH, /* the lum of the video is more than the lum threshold which is set by u32LumThresh */
  50. INVERT_COLOR_BUTT
  51. }INVERT_COLOR_MODE_E;
  52. typedef struct hiOVERLAY_QP_INFO_S
  53. {
  54. HI_BOOL bAbsQp;
  55. HI_S32 s32Qp;
  56. HI_BOOL bQpDisable;
  57. }OVERLAY_QP_INFO_S;
  58. typedef struct hiOVERLAY_INVERT_COLOR_S
  59. {
  60. SIZE_S stInvColArea; //It must be multipe of 16 but not more than 64.
  61. HI_U32 u32LumThresh; //The threshold to decide whether invert the OSD's color or not.
  62. INVERT_COLOR_MODE_E enChgMod;
  63. HI_BOOL bInvColEn; //The switch of inverting color.
  64. }OVERLAY_INVERT_COLOR_S;
  65. typedef enum hiATTACH_DEST_E
  66. {
  67. ATTACH_JPEG_MAIN =0,
  68. ATTACH_JPEG_MPF0,
  69. ATTACH_JPEG_MPF1,
  70. ATTACH_JPEG_BUFF
  71. }ATTACH_DEST_E;
  72. typedef struct hiOVERLAY_ATTR_S
  73. {
  74. /* bitmap pixel format,now only support ARGB1555 or ARGB4444 */
  75. PIXEL_FORMAT_E enPixelFmt;
  76. /* background color, pixel format depends on "enPixelFmt" */
  77. HI_U32 u32BgColor;
  78. /* region size,W:[2,RGN_OVERLAY_MAX_WIDTH],align:2,H:[2,RGN_OVERLAY_MAX_HEIGHT],align:2 */
  79. SIZE_S stSize;
  80. HI_U32 u32CanvasNum;
  81. }OVERLAY_ATTR_S;
  82. typedef struct hiOVERLAY_CHN_ATTR_S
  83. {
  84. /* X:[0,OVERLAY_MAX_X_VENC],align:2,Y:[0,OVERLAY_MAX_Y_VENC],align:2 */
  85. POINT_S stPoint;
  86. /* background an foreground transparence when pixel format is ARGB1555
  87. * the pixel format is ARGB1555,when the alpha bit is 1 this alpha is value!
  88. * range:[0,128]
  89. */
  90. HI_U32 u32FgAlpha;
  91. /* background an foreground transparence when pixel format is ARGB1555
  92. * the pixel format is ARGB1555,when the alpha bit is 0 this alpha is value!
  93. * range:[0,128]
  94. */
  95. HI_U32 u32BgAlpha;
  96. HI_U32 u32Layer; /* OVERLAY region layer range:[0,7]*/
  97. OVERLAY_QP_INFO_S stQpInfo;
  98. OVERLAY_INVERT_COLOR_S stInvertColor;
  99. ATTACH_DEST_E enAttachDest;
  100. HI_U16 u16ColorLUT[RGN_COLOR_LUT_NUM];
  101. }OVERLAY_CHN_ATTR_S;
  102. typedef enum hiRGN_AREA_TYPE_E
  103. {
  104. AREA_RECT = 0,
  105. AREA_QUAD_RANGLE,
  106. AREA_BUTT
  107. } RGN_AREA_TYPE_E;
  108. typedef enum hiRGN_COORDINATE_E
  109. {
  110. RGN_ABS_COOR = 0, /*Absolute coordinate*/
  111. RGN_RATIO_COOR /*Ratio coordinate*/
  112. }RGN_COORDINATE_E;
  113. typedef struct hiRGN_QUADRANGLE_S
  114. {
  115. HI_BOOL bSolid; /* whether solid or dashed quadrangle */
  116. HI_U32 u32Thick; /* Line Width of quadrangle, valid when dashed quadrangle */
  117. POINT_S stPoint[4]; /* points of quadrilateral */
  118. } RGN_QUADRANGLE_S;
  119. typedef struct hiCOVER_CHN_ATTR_S
  120. {
  121. RGN_AREA_TYPE_E enCoverType; /* rect or arbitary quadrilateral COVER */
  122. union
  123. {
  124. RECT_S stRect; /* config of rect */
  125. RGN_QUADRANGLE_S stQuadRangle; /* config of arbitary quadrilateral COVER */
  126. };
  127. HI_U32 u32Color;
  128. HI_U32 u32Layer; /* COVER region layer */
  129. RGN_COORDINATE_E enCoordinate; /*ratio coordiante or abs coordinate*/
  130. }COVER_CHN_ATTR_S;
  131. typedef struct hiCOVEREX_CHN_ATTR_S
  132. {
  133. RGN_AREA_TYPE_E enCoverType; /* rect or arbitary quadrilateral COVER */
  134. union
  135. {
  136. RECT_S stRect; /* config of rect */
  137. RGN_QUADRANGLE_S stQuadRangle; /* config of arbitary quadrilateral COVER */
  138. };
  139. HI_U32 u32Color;
  140. HI_U32 u32Layer; /* COVEREX region layer range */
  141. }COVEREX_CHN_ATTR_S;
  142. typedef enum hiMOSAIC_BLK_SIZE_E
  143. {
  144. MOSAIC_BLK_SIZE_8 = 0, /*block size 8*8 of MOSAIC*/
  145. MOSAIC_BLK_SIZE_16, /*block size 16*16 of MOSAIC*/
  146. MOSAIC_BLK_SIZE_32, /*block size 32*32 of MOSAIC*/
  147. MOSAIC_BLK_SIZE_64, /*block size 64*64 of MOSAIC*/
  148. MOSAIC_BLK_SIZE_BUTT
  149. }MOSAIC_BLK_SIZE_E;
  150. typedef struct hiMOSAIC_CHN_ATTR_S
  151. {
  152. RECT_S stRect; /*location of MOSAIC*/
  153. MOSAIC_BLK_SIZE_E enBlkSize; /*block size of MOSAIC*/
  154. HI_U32 u32Layer; /*MOSAIC region layer range:[0,3] */
  155. }MOSAIC_CHN_ATTR_S;
  156. typedef struct hiOVERLAYEX_COMM_ATTR_S
  157. {
  158. PIXEL_FORMAT_E enPixelFmt;
  159. /* background color, pixel format depends on "enPixelFmt" */
  160. HI_U32 u32BgColor;
  161. /* region size,W:[2,RGN_OVERLAY_MAX_WIDTH],align:2,H:[2,RGN_OVERLAY_MAX_HEIGHT],align:2 */
  162. SIZE_S stSize;
  163. HI_U32 u32CanvasNum;
  164. }OVERLAYEX_ATTR_S;
  165. typedef struct hiOVERLAYEX_CHN_ATTR_S
  166. {
  167. /* X:[0,RGN_OVERLAY_MAX_X],align:2,Y:[0,RGN_OVERLAY_MAX_Y],align:2 */
  168. POINT_S stPoint;
  169. /* background an foreground transparence when pixel format is ARGB1555
  170. * the pixel format is ARGB1555,when the alpha bit is 1 this alpha is value!
  171. * range:[0,255]
  172. */
  173. HI_U32 u32FgAlpha;
  174. /* background an foreground transparence when pixel format is ARGB1555
  175. * the pixel format is ARGB1555,when the alpha bit is 0 this alpha is value!
  176. * range:[0,255]
  177. */
  178. HI_U32 u32BgAlpha;
  179. HI_U32 u32Layer; /* OVERLAYEX region layer range:[0,15]*/
  180. }OVERLAYEX_CHN_ATTR_S;
  181. typedef union hiRGN_ATTR_U
  182. {
  183. OVERLAY_ATTR_S stOverlay; /* attribute of overlay region */
  184. OVERLAYEX_ATTR_S stOverlayEx; /* attribute of overlayex region */
  185. } RGN_ATTR_U;
  186. typedef union hiRGN_CHN_ATTR_U
  187. {
  188. OVERLAY_CHN_ATTR_S stOverlayChn; /* attribute of overlay region */
  189. COVER_CHN_ATTR_S stCoverChn; /* attribute of cover region */
  190. COVEREX_CHN_ATTR_S stCoverExChn; /* attribute of coverex region */
  191. OVERLAYEX_CHN_ATTR_S stOverlayExChn; /* attribute of overlayex region */
  192. MOSAIC_CHN_ATTR_S stMosaicChn; /* attribute of mosic region */
  193. } RGN_CHN_ATTR_U;
  194. /* attribute of a region */
  195. typedef struct hiRGN_ATTR_S
  196. {
  197. RGN_TYPE_E enType; /* region type */
  198. RGN_ATTR_U unAttr; /* region attribute */
  199. } RGN_ATTR_S;
  200. /* attribute of a region */
  201. typedef struct hiRGN_CHN_ATTR_S
  202. {
  203. HI_BOOL bShow;
  204. RGN_TYPE_E enType; /* region type */
  205. RGN_CHN_ATTR_U unChnAttr; /* region attribute */
  206. } RGN_CHN_ATTR_S;
  207. #define RGN_MAX_BMP_UPDATE_NUM 16
  208. #define RGN_BATCHHANDLE_MAX 24
  209. typedef struct hiRGN_BMP_UPDATE_S
  210. {
  211. POINT_S stPoint;
  212. BITMAP_S stBmp;
  213. HI_U32 u32Stride;
  214. } RGN_BMP_UPDATE_S;
  215. typedef struct hiRGN_BMP_UPDATE_CFG_S
  216. {
  217. HI_U32 u32BmpCnt;
  218. RGN_BMP_UPDATE_S astBmpUpdate[RGN_MAX_BMP_UPDATE_NUM];
  219. } RGN_BMP_UPDATE_CFG_S;
  220. typedef struct hiRGN_CANVAS_INFO_S
  221. {
  222. HI_U64 u64PhyAddr;
  223. HI_U64 u64VirtAddr;
  224. SIZE_S stSize;
  225. HI_U32 u32Stride;
  226. PIXEL_FORMAT_E enPixelFmt;
  227. } RGN_CANVAS_INFO_S;
  228. /* PingPong buffer change when set attr, it needs to remap memory in mpi interface */
  229. #define HI_NOTICE_RGN_BUFFER_CHANGE HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_NOTICE, HI_SUCCESS)
  230. /* invlalid device ID */
  231. #define HI_ERR_RGN_INVALID_DEVID HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
  232. /* invlalid channel ID */
  233. #define HI_ERR_RGN_INVALID_CHNID HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
  234. /* at lease one parameter is illagal ,eg, an illegal enumeration value */
  235. #define HI_ERR_RGN_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
  236. /* channel exists */
  237. #define HI_ERR_RGN_EXIST HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
  238. /*UN exist*/
  239. #define HI_ERR_RGN_UNEXIST HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
  240. /* using a NULL point */
  241. #define HI_ERR_RGN_NULL_PTR HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
  242. /* try to enable or initialize system,device or channel, before configing attribute */
  243. #define HI_ERR_RGN_NOT_CONFIG HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG)
  244. /* operation is not supported by NOW */
  245. #define HI_ERR_RGN_NOT_SUPPORT HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
  246. /* operation is not permitted ,eg, try to change stati attribute */
  247. #define HI_ERR_RGN_NOT_PERM HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
  248. /* failure caused by malloc memory */
  249. #define HI_ERR_RGN_NOMEM HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
  250. /* failure caused by malloc buffer */
  251. #define HI_ERR_RGN_NOBUF HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
  252. /* no data in buffer */
  253. #define HI_ERR_RGN_BUF_EMPTY HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
  254. /* no buffer for new data */
  255. #define HI_ERR_RGN_BUF_FULL HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
  256. /* bad address, eg. used for copy_from_user & copy_to_user */
  257. #define HI_ERR_RGN_BADADDR HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_BADADDR)
  258. /* resource is busy, eg. destroy a venc chn without unregistering it */
  259. #define HI_ERR_RGN_BUSY HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
  260. /* System is not ready,maybe not initialed or loaded.
  261. * Returning the error code when opening a device file failed.
  262. */
  263. #define HI_ERR_RGN_NOTREADY HI_DEF_ERR(HI_ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
  264. #ifdef __cplusplus
  265. #if __cplusplus
  266. }
  267. #endif
  268. #endif /* __cplusplus */
  269. #endif /* __HI_COMM_REGION_H__ */