hi_comm_venc.h 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972
  1. /******************************************************************************
  2. Copyright (C), 2016-2017, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : hi_comm_venc.h
  5. Version : Initial Draft
  6. Author : Hisilicon multimedia software group
  7. Created : 2016/11/15
  8. Last Modified :
  9. Description : common struct definition for VENC
  10. Function List :
  11. ******************************************************************************/
  12. #ifndef __HI_COMM_VENC_H__
  13. #define __HI_COMM_VENC_H__
  14. #ifdef __cplusplus
  15. #if __cplusplus
  16. extern "C" {
  17. #endif
  18. #endif /* __cplusplus */
  19. #include "hi_type.h"
  20. #include "hi_common.h"
  21. #include "hi_errno.h"
  22. #include "hi_comm_video.h"
  23. #include "hi_comm_rc.h"
  24. #include "hi_comm_vb.h"
  25. /* invlalid channel ID */
  26. #define HI_ERR_VENC_INVALID_CHNID HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
  27. /* at lease one parameter is illagal ,eg, an illegal enumeration value */
  28. #define HI_ERR_VENC_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
  29. /* channel exists */
  30. #define HI_ERR_VENC_EXIST HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
  31. /* channel exists */
  32. #define HI_ERR_VENC_UNEXIST HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
  33. /* using a NULL point */
  34. #define HI_ERR_VENC_NULL_PTR HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
  35. /* try to enable or initialize system,device or channel, before configing attribute */
  36. #define HI_ERR_VENC_NOT_CONFIG HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG)
  37. /* operation is not supported by NOW */
  38. #define HI_ERR_VENC_NOT_SUPPORT HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
  39. /* operation is not permitted ,eg, try to change stati attribute */
  40. #define HI_ERR_VENC_NOT_PERM HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
  41. /* failure caused by malloc memory */
  42. #define HI_ERR_VENC_NOMEM HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
  43. /* failure caused by malloc buffer */
  44. #define HI_ERR_VENC_NOBUF HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
  45. /* no data in buffer */
  46. #define HI_ERR_VENC_BUF_EMPTY HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
  47. /* no buffer for new data */
  48. #define HI_ERR_VENC_BUF_FULL HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
  49. /* system is not ready,had not initialed or loaded*/
  50. #define HI_ERR_VENC_SYS_NOTREADY HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
  51. /* system is busy*/
  52. #define HI_ERR_VENC_BUSY HI_DEF_ERR(HI_ID_VENC, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
  53. /*the nalu type of H264E*/
  54. typedef enum hiH264E_NALU_TYPE_E
  55. {
  56. H264E_NALU_BSLICE = 0, /*B SLICE types*/
  57. H264E_NALU_PSLICE = 1, /*P SLICE types*/
  58. H264E_NALU_ISLICE = 2, /*I SLICE types*/
  59. H264E_NALU_IDRSLICE = 5, /*IDR SLICE types*/
  60. H264E_NALU_SEI = 6, /*SEI types*/
  61. H264E_NALU_SPS = 7, /*SPS types*/
  62. H264E_NALU_PPS = 8, /*PPS types*/
  63. H264E_NALU_BUTT
  64. } H264E_NALU_TYPE_E;
  65. /*the nalu type of H265E*/
  66. typedef enum hiH265E_NALU_TYPE_E
  67. {
  68. H265E_NALU_BSLICE = 0, /*B SLICE types*/
  69. H265E_NALU_PSLICE = 1, /*P SLICE types*/
  70. H265E_NALU_ISLICE = 2, /*I SLICE types*/
  71. H265E_NALU_IDRSLICE = 19, /*IDR SLICE types*/
  72. H265E_NALU_VPS = 32, /*VPS types*/
  73. H265E_NALU_SPS = 33, /*SPS types*/
  74. H265E_NALU_PPS = 34, /*PPS types*/
  75. H265E_NALU_SEI = 39, /*SEI types*/
  76. H265E_NALU_BUTT
  77. } H265E_NALU_TYPE_E;
  78. /*the reference type of H264E slice*/
  79. typedef enum hiH264E_REFSLICE_TYPE_E
  80. {
  81. H264E_REFSLICE_FOR_1X = 1, /*Reference slice for H264E_REF_MODE_1X*/
  82. H264E_REFSLICE_FOR_2X = 2, /*Reference slice for H264E_REF_MODE_2X*/
  83. H264E_REFSLICE_FOR_4X = 5, /*Reference slice for H264E_REF_MODE_4X*/
  84. H264E_REFSLICE_FOR_BUTT /* slice not for reference*/
  85. } H264E_REFSLICE_TYPE_E;
  86. /*the pack type of JPEGE*/
  87. typedef enum hiJPEGE_PACK_TYPE_E
  88. {
  89. JPEGE_PACK_ECS = 5, /*ECS types*/
  90. JPEGE_PACK_APP = 6, /*APP types*/
  91. JPEGE_PACK_VDO = 7, /*VDO types*/
  92. JPEGE_PACK_PIC = 8, /*PIC types*/
  93. JPEGE_PACK_BUTT
  94. } JPEGE_PACK_TYPE_E;
  95. /*the pack type of PRORES*/
  96. typedef enum hiPRORES_PACK_TYPE_E
  97. {
  98. PRORES_PACK_PIC = 1, /*PIC types*/
  99. PRORES_PACK_BUTT
  100. } PRORES_PACK_TYPE_E;
  101. /*the data type of VENC*/
  102. typedef union hiVENC_DATA_TYPE_U
  103. {
  104. H264E_NALU_TYPE_E enH264EType; /* R; H264E NALU types*/
  105. JPEGE_PACK_TYPE_E enJPEGEType; /* R; JPEGE pack types*/
  106. H265E_NALU_TYPE_E enH265EType; /* R; H264E NALU types*/
  107. PRORES_PACK_TYPE_E enPRORESType;
  108. } VENC_DATA_TYPE_U;
  109. /*the pack info of VENC*/
  110. typedef struct hiVENC_PACK_INFO_S
  111. {
  112. VENC_DATA_TYPE_U u32PackType; /* R; the pack type*/
  113. HI_U32 u32PackOffset;
  114. HI_U32 u32PackLength;
  115. } VENC_PACK_INFO_S;
  116. /*Defines a stream packet*/
  117. typedef struct hiVENC_PACK_S
  118. {
  119. HI_U64 u64PhyAddr; /* R; the physics address of stream */
  120. HI_U8 ATTRIBUTE* pu8Addr; /* R; the virtual address of stream */
  121. HI_U32 ATTRIBUTE u32Len; /* R; the length of stream */
  122. HI_U64 u64PTS; /* R; PTS */
  123. HI_BOOL bFrameEnd; /* R; frame end */
  124. VENC_DATA_TYPE_U DataType; /* R; the type of stream */
  125. HI_U32 u32Offset; /* R; the offset between the Valid data and the start address */
  126. HI_U32 u32DataNum; /* R; the stream packets num */
  127. VENC_PACK_INFO_S stPackInfo[8]; /* R; the stream packet Information */
  128. } VENC_PACK_S;
  129. /*Defines the frame type and reference attributes of the H.264 frame skipping reference streams*/
  130. typedef enum hiH264E_REF_TYPE_E
  131. {
  132. BASE_IDRSLICE = 0, /* the Idr frame at Base layer*/
  133. BASE_PSLICE_REFTOIDR, /* the P frame at Base layer, referenced by other frames at Base layer and reference to Idr frame*/
  134. BASE_PSLICE_REFBYBASE, /* the P frame at Base layer, referenced by other frames at Base layer*/
  135. BASE_PSLICE_REFBYENHANCE, /* the P frame at Base layer, referenced by other frames at Enhance layer*/
  136. ENHANCE_PSLICE_REFBYENHANCE, /* the P frame at Enhance layer, referenced by other frames at Enhance layer*/
  137. ENHANCE_PSLICE_NOTFORREF, /* the P frame at Enhance layer ,not referenced*/
  138. ENHANCE_PSLICE_BUTT
  139. } H264E_REF_TYPE_E;
  140. typedef enum hiH264E_REF_TYPE_E H265E_REF_TYPE_E;
  141. /*Defines the features of an H.264 stream*/
  142. typedef struct hiVENC_STREAM_INFO_H264_S
  143. {
  144. HI_U32 u32PicBytesNum; /* R; the coded picture stream byte number */
  145. HI_U32 u32Inter16x16MbNum; /* R; the inter16x16 macroblock num */
  146. HI_U32 u32Inter8x8MbNum; /* R; the inter8x8 macroblock num */
  147. HI_U32 u32Intra16MbNum; /* R; the intra16x16 macroblock num */
  148. HI_U32 u32Intra8MbNum; /* R; the intra8x8 macroblock num */
  149. HI_U32 u32Intra4MbNum; /* R; the inter4x4 macroblock num */
  150. H264E_REF_TYPE_E enRefType; /* R; Type of encoded frames in advanced frame skipping reference mode*/
  151. HI_U32 u32UpdateAttrCnt; /* R; Number of times that channel attributes or parameters (including RC parameters) are set*/
  152. HI_U32 u32StartQp; /* R; the start Qp of encoded frames*/
  153. HI_U32 u32MeanQp; /* R; the mean Qp of encoded frames*/
  154. HI_BOOL bPSkip;
  155. } VENC_STREAM_INFO_H264_S;
  156. /*Defines the features of an H.265 stream*/
  157. typedef struct hiVENC_STREAM_INFO_H265_S
  158. {
  159. HI_U32 u32PicBytesNum; /* R; the coded picture stream byte number */
  160. HI_U32 u32Inter64x64CuNum; /* R; the inter64x64 cu num */
  161. HI_U32 u32Inter32x32CuNum; /* R; the inter32x32 cu num */
  162. HI_U32 u32Inter16x16CuNum; /* R; the inter16x16 cu num */
  163. HI_U32 u32Inter8x8CuNum; /* R; the inter8x8 cu num */
  164. HI_U32 u32Intra32x32CuNum; /* R; the Intra32x32 cu num */
  165. HI_U32 u32Intra16x16CuNum; /* R; the Intra16x16 cu num */
  166. HI_U32 u32Intra8x8CuNum; /* R; the Intra8x8 cu num */
  167. HI_U32 u32Intra4x4CuNum; /* R; the Intra4x4 cu num */
  168. H265E_REF_TYPE_E enRefType; /* R; Type of encoded frames in advanced frame skipping reference mode*/
  169. HI_U32 u32UpdateAttrCnt; /* R; Number of times that channel attributes or parameters (including RC parameters) are set*/
  170. HI_U32 u32StartQp; /* R; the start Qp of encoded frames*/
  171. HI_U32 u32MeanQp; /* R; the mean Qp of encoded frames*/
  172. HI_BOOL bPSkip;
  173. } VENC_STREAM_INFO_H265_S;
  174. /* the sse info*/
  175. typedef struct hiVENC_SSE_INFO_S
  176. {
  177. HI_BOOL bSSEEn; /* RW; Range:[0,1]; Region SSE enable */
  178. HI_U32 u32SSEVal; /* R; Region SSE value */
  179. } VENC_SSE_INFO_S;
  180. /* the advance information of the h264e */
  181. typedef struct hiVENC_STREAM_ADVANCE_INFO_H264_S
  182. {
  183. HI_U32 u32ResidualBitNum; /* R; the residual num */
  184. HI_U32 u32HeadBitNum; /* R; the head bit num */
  185. HI_U32 u32MadiVal; /* R; the madi value */
  186. HI_U32 u32MadpVal; /* R; the madp value */
  187. HI_DOUBLE dPSNRVal; /* R; the PSNR value */
  188. HI_U32 u32MseLcuCnt; /* R; the lcu cnt of the mse */
  189. HI_U32 u32MseSum; /* R; the sum of the mse */
  190. VENC_SSE_INFO_S stSSEInfo[8]; /* R; the information of the sse */
  191. HI_U32 u32QpHstgrm[52]; /* R; the Qp histogram value */
  192. HI_U32 u32MoveScene16x16Num; /* R; the 16x16 cu num of the move scene*/
  193. HI_U32 u32MoveSceneBits; /* R; the stream bit num of the move scene */
  194. } VENC_STREAM_ADVANCE_INFO_H264_S;
  195. /* the advance information of the Jpege */
  196. typedef struct hiVENC_STREAM_ADVANCE_INFO_JPEG_S
  197. {
  198. // HI_U32 u32Reserved;
  199. } VENC_STREAM_ADVANCE_INFO_JPEG_S;
  200. /* the advance information of the Prores */
  201. typedef struct hiVENC_STREAM_ADVANCE_INFO_PRORES_S
  202. {
  203. // HI_U32 u32Reserved;
  204. } VENC_STREAM_ADVANCE_INFO_PRORES_S;
  205. /* the advance information of the h265e */
  206. typedef struct hiVENC_STREAM_ADVANCE_INFO_H265_S
  207. {
  208. HI_U32 u32ResidualBitNum; /* R; the residual num */
  209. HI_U32 u32HeadBitNum; /* R; the head bit num */
  210. HI_U32 u32MadiVal; /* R; the madi value */
  211. HI_U32 u32MadpVal; /* R; the madp value */
  212. HI_DOUBLE dPSNRVal; /* R; the PSNR value */
  213. HI_U32 u32MseLcuCnt; /* R; the lcu cnt of the mse */
  214. HI_U32 u32MseSum; /* R; the sum of the mse */
  215. VENC_SSE_INFO_S stSSEInfo[8]; /* R; the information of the sse */
  216. HI_U32 u32QpHstgrm[52]; /* R; the Qp histogram value */
  217. HI_U32 u32MoveScene32x32Num; /* R; the 32x32 cu num of the move scene*/
  218. HI_U32 u32MoveSceneBits; /* R; the stream bit num of the move scene */
  219. } VENC_STREAM_ADVANCE_INFO_H265_S;
  220. /*Defines the features of an jpege stream*/
  221. typedef struct hiVENC_STREAM_INFO_PRORES_S
  222. {
  223. HI_U32 u32PicBytesNum;
  224. HI_U32 u32UpdateAttrCnt;
  225. } VENC_STREAM_INFO_PRORES_S;
  226. /*Defines the features of an jpege stream*/
  227. typedef struct hiVENC_STREAM_INFO_JPEG_S
  228. {
  229. HI_U32 u32PicBytesNum; /* R; the coded picture stream byte number */
  230. HI_U32 u32UpdateAttrCnt; /* R; Number of times that channel attributes or parameters (including RC parameters) are set*/
  231. HI_U32 u32Qfactor; /* R; image quality */
  232. } VENC_STREAM_INFO_JPEG_S;
  233. /*Defines the features of an stream*/
  234. typedef struct hiVENC_STREAM_S
  235. {
  236. VENC_PACK_S ATTRIBUTE* pstPack; /* R; stream pack attribute*/
  237. HI_U32 ATTRIBUTE u32PackCount; /* R; the pack number of one frame stream*/
  238. HI_U32 u32Seq; /* R; the list number of stream*/
  239. union
  240. {
  241. VENC_STREAM_INFO_H264_S stH264Info; /* R; the stream info of h264*/
  242. VENC_STREAM_INFO_JPEG_S stJpegInfo; /* R; the stream info of jpeg*/
  243. VENC_STREAM_INFO_H265_S stH265Info; /* R; the stream info of h265*/
  244. VENC_STREAM_INFO_PRORES_S stProresInfo; /* R; the stream info of prores*/
  245. };
  246. union
  247. {
  248. VENC_STREAM_ADVANCE_INFO_H264_S stAdvanceH264Info; /* R; the stream info of h264*/
  249. VENC_STREAM_ADVANCE_INFO_JPEG_S stAdvanceJpegInfo; /* R; the stream info of jpeg*/
  250. VENC_STREAM_ADVANCE_INFO_H265_S stAdvanceH265Info; /* R; the stream info of h265*/
  251. VENC_STREAM_ADVANCE_INFO_PRORES_S stAdvanceProresInfo; /* R; the stream info of prores*/
  252. };
  253. } VENC_STREAM_S;
  254. /*the size of array is 2,that is the maximum*/
  255. typedef struct hiVENC_MPF_CFG_S
  256. {
  257. HI_U8 u8LargeThumbNailNum; /* RW; Range:[0,2]; the large thumbnail pic num of the MPF */
  258. SIZE_S astLargeThumbNailSize[2]; /* RW; The resolution of large ThumbNail*/
  259. } VENC_MPF_CFG_S;
  260. /*the attribute of jpege*/
  261. typedef struct hiVENC_ATTR_JPEG_S
  262. {
  263. HI_BOOL bSupportDCF; /*RW; Range:[0,1]; support dcf */
  264. VENC_MPF_CFG_S stMPFCfg; /*RW; Range:[0,1]; config of Mpf*/
  265. } VENC_ATTR_JPEG_S;
  266. /*the attribute of mjpege*/
  267. typedef struct hiVENC_ATTR_MJPEG_S
  268. {
  269. //reserved
  270. } VENC_ATTR_MJPEG_S;
  271. /*the attribute of h264e*/
  272. typedef struct hiVENC_ATTR_H264_S
  273. {
  274. HI_BOOL bRcnRefShareBuf; /* RW; Range:[0, 1]; Whether to enable the Share Buf of Rcn and Ref .*/
  275. //reserved
  276. } VENC_ATTR_H264_S;
  277. /*the attribute of h265e*/
  278. typedef struct hiVENC_ATTR_H265_S
  279. {
  280. HI_BOOL bRcnRefShareBuf; /* RW; Range:[0, 1]; Whether to enable the Share Buf of Rcn and Ref .*/
  281. //reserved
  282. } VENC_ATTR_H265_S;
  283. /*the frame rate of PRORES*/
  284. typedef enum hiPRORES_FRAMERATE
  285. {
  286. PRORES_FR_UNKNOWN = 0,
  287. PRORES_FR_23_976,
  288. PRORES_FR_24,
  289. PRORES_FR_25,
  290. PRORES_FR_29_97,
  291. PRORES_FR_30,
  292. PRORES_FR_50,
  293. PRORES_FR_59_94,
  294. PRORES_FR_60,
  295. PRORES_FR_100,
  296. PRORES_FR_119_88,
  297. PRORES_FR_120,
  298. PRORES_FR_BUTT
  299. }PRORES_FRAMERATE;
  300. /*the aspect ratio of PRORES*/
  301. typedef enum hiPRORES_ASPECT_RATIO
  302. {
  303. PRORES_ASPECT_RATIO_UNKNOWN = 0,
  304. PRORES_ASPECT_RATIO_SQUARE,
  305. PRORES_ASPECT_RATIO_4_3,
  306. PRORES_ASPECT_RATIO_16_9,
  307. PRORES_ASPECT_RATIO_BUTT
  308. }PRORES_ASPECT_RATIO;
  309. /*the attribute of PRORES*/
  310. typedef struct hiVENC_ATTR_PRORES_S
  311. {
  312. HI_CHAR cIdentifier[4];
  313. PRORES_FRAMERATE enFrameRateCode;
  314. PRORES_ASPECT_RATIO enAspectRatio;
  315. } VENC_ATTR_PRORES_S;
  316. /* the attribute of the Venc*/
  317. typedef struct hiVENC_ATTR_S
  318. {
  319. PAYLOAD_TYPE_E enType; /* RW; the type of payload*/
  320. HI_U32 u32MaxPicWidth; /* RW; maximum width of a picture to be encoded, in pixel*/
  321. HI_U32 u32MaxPicHeight; /* RW; maximum height of a picture to be encoded, in pixel*/
  322. HI_U32 u32BufSize; /* RW; stream buffer size*/
  323. HI_U32 u32Profile; /* RW; H.264: 0: baseline; 1:MP; 2:HP; 3: SVC-T [0,3];
  324. H.265: 0:MP; 1:Main 10 [0 1];
  325. Jpege/MJpege: 0:Baseline
  326. prores: 0:ProRes Proxy; 1:ProRes 422(LT); 2:ProRes 422; 3:ProRes 422(HQ);*/
  327. HI_BOOL bByFrame; /* RW; Range:[0,1]; get stream mode is slice mode or frame mode*/
  328. HI_U32 u32PicWidth; /* RW; width of a picture to be encoded, in pixel*/
  329. HI_U32 u32PicHeight; /* RW; height of a picture to be encoded, in pixel*/
  330. union
  331. {
  332. VENC_ATTR_H264_S stAttrH264e; /* attributes of H264e */
  333. VENC_ATTR_H265_S stAttrH265e; /* attributes of H265e */
  334. VENC_ATTR_MJPEG_S stAttrMjpege; /* attributes of Mjpeg */
  335. VENC_ATTR_JPEG_S stAttrJpege; /* attributes of jpeg */
  336. VENC_ATTR_PRORES_S stAttrProres; /* attributes of prores */
  337. };
  338. } VENC_ATTR_S;
  339. /* the gop mode */
  340. typedef enum hiVENC_GOP_MODE_E
  341. {
  342. VENC_GOPMODE_NORMALP = 0, /* NORMALP */
  343. VENC_GOPMODE_DUALP = 1, /* DUALP */
  344. VENC_GOPMODE_SMARTP = 2, /* SMARTP */
  345. VENC_GOPMODE_ADVSMARTP = 3, /* ADVSMARTP */
  346. VENC_GOPMODE_BIPREDB = 4, /* BIPREDB */
  347. VENC_GOPMODE_LOWDELAYB = 5, /* LOWDELAYB */
  348. VENC_GOPMODE_BUTT,
  349. } VENC_GOP_MODE_E;
  350. /* the attribute of the normalp*/
  351. typedef struct hiVENC_GOP_NORMALP_S
  352. {
  353. HI_S32 s32IPQpDelta; /* RW; Range:[-10,30]; QP variance between P frame and I frame */
  354. } VENC_GOP_NORMALP_S;
  355. /* the attribute of the dualp*/
  356. typedef struct hiVENC_GOP_DUALP_S
  357. {
  358. HI_U32 u32SPInterval; /* RW; Range:[0, 1)U(1, u32Gop -1]; Interval of the special P frames */
  359. HI_S32 s32SPQpDelta; /* RW; Range:[-10,30]; QP variance between P frame and special P frame */
  360. HI_S32 s32IPQpDelta; /* RW; Range:[-10,30]; QP variance between P frame and I frame */
  361. } VENC_GOP_DUALP_S;
  362. /* the attribute of the smartp*/
  363. typedef struct hiVENC_GOP_SMARTP_S
  364. {
  365. HI_U32 u32BgInterval; /* RW; Range:[u32Gop,4294967295] ;Interval of the long-term reference frame*/
  366. HI_S32 s32BgQpDelta; /* RW; Range:[-10,30]; QP variance between P frame and Bg frame */
  367. HI_S32 s32ViQpDelta; /* RW; Range:[-10,30]; QP variance between P frame and virtual I frame */
  368. } VENC_GOP_SMARTP_S;
  369. /* the attribute of the advsmartp*/
  370. typedef struct hiVENC_GOP_ADVSMARTP_S
  371. {
  372. HI_U32 u32BgInterval; /* RW; Range:[u32Gop,4294967295] ;Interval of the long-term reference frame*/
  373. HI_S32 s32BgQpDelta; /* RW; Range:[-10,30]; QP variance between P frame and Bg frame */
  374. HI_S32 s32ViQpDelta; /* RW; Range:[-10,30]; QP variance between P frame and virtual I frame */
  375. } VENC_GOP_ADVSMARTP_S;
  376. /* the attribute of the bipredb*/
  377. typedef struct hiVENC_GOP_BIPREDB_S
  378. {
  379. HI_U32 u32BFrmNum; /* RW; Range:[1,3]; Number of B frames */
  380. HI_S32 s32BQpDelta; /* RW; Range:[-10,30]; QP variance between P frame and B frame */
  381. HI_S32 s32IPQpDelta; /* RW; Range:[-10,30]; QP variance between P frame and I frame */
  382. } VENC_GOP_BIPREDB_S;
  383. /* the attribute of the gop*/
  384. typedef struct hiVENC_GOP_ATTR_S
  385. {
  386. VENC_GOP_MODE_E enGopMode; /* RW; Encoding GOP type */
  387. union
  388. {
  389. VENC_GOP_NORMALP_S stNormalP; /*attributes of normal P*/
  390. VENC_GOP_DUALP_S stDualP; /*attributes of dual P*/
  391. VENC_GOP_SMARTP_S stSmartP; /*attributes of Smart P*/
  392. VENC_GOP_ADVSMARTP_S stAdvSmartP; /*attributes of AdvSmart P*/
  393. VENC_GOP_BIPREDB_S stBipredB; /*attributes of b */
  394. };
  395. } VENC_GOP_ATTR_S;
  396. /* the attribute of the venc chnl*/
  397. typedef struct hiVENC_CHN_ATTR_S
  398. {
  399. VENC_ATTR_S stVencAttr; /*the attribute of video encoder*/
  400. VENC_RC_ATTR_S stRcAttr; /*the attribute of rate ctrl*/
  401. VENC_GOP_ATTR_S stGopAttr; /*the attribute of gop*/
  402. } VENC_CHN_ATTR_S;
  403. /* the param of receive picture */
  404. typedef struct hiVENC_RECV_PIC_PARAM_S
  405. {
  406. HI_S32 s32RecvPicNum; /* RW; Range:[-1,0)U(0 4294967295]; Number of frames received and encoded by the encoding channel*/
  407. } VENC_RECV_PIC_PARAM_S;
  408. /* the status of the venc chnl*/
  409. typedef struct hiVENC_CHN_STATUS_S
  410. {
  411. HI_U32 u32LeftPics; /* R; left picture number */
  412. HI_U32 u32LeftStreamBytes; /* R; left stream bytes*/
  413. HI_U32 u32LeftStreamFrames; /* R; left stream frames*/
  414. HI_U32 u32CurPacks; /* R; pack number of current frame*/
  415. HI_U32 u32LeftRecvPics; /* R; Number of frames to be received. This member is valid after HI_MPI_VENC_StartRecvPicEx is called.*/
  416. HI_U32 u32LeftEncPics; /* R; Number of frames to be encoded. This member is valid after HI_MPI_VENC_StartRecvPicEx is called.*/
  417. HI_BOOL bJpegSnapEnd; /* R; the end of Snap.*/
  418. } VENC_CHN_STATUS_S;
  419. /* the param of the h264e slice split*/
  420. typedef struct hiVENC_H264_SLICE_SPLIT_S
  421. {
  422. HI_BOOL bSplitEnable; /* RW; Range:[0,1]; slice split enable, HI_TRUE:enable, HI_FALSE:diable, default value:HI_FALSE*/
  423. HI_U32 u32MbLineNum; /* RW; Range:[1,(Picture height + 15)/16]; this value presents the mb line number of one slice*/
  424. } VENC_H264_SLICE_SPLIT_S;
  425. /* the param of the h264e intra pred*/
  426. typedef struct hiVENC_H264_INTRA_PRED_S
  427. {
  428. HI_U32 constrained_intra_pred_flag; /* RW; Range:[0,1];default: HI_FALSE, see the H.264 protocol for the meaning*/
  429. } VENC_H264_INTRA_PRED_S;
  430. /* the param of the h264e trans*/
  431. typedef struct hiVENC_H264_TRANS_S
  432. {
  433. HI_U32 u32IntraTransMode; /* RW; Range:[0,2]; Conversion mode for intra-prediction,0: trans4x4, trans8x8; 1: trans4x4, 2: trans8x8 */
  434. HI_U32 u32InterTransMode; /* RW; Range:[0,2]; Conversion mode for inter-prediction,0: trans4x4, trans8x8; 1: trans4x4, 2: trans8x8 */
  435. HI_BOOL bScalingListValid; /* RW; Range:[0,1]; enable Scaling,default: HI_FALSE */
  436. HI_U8 InterScalingList8X8[64]; /* RW; Range:[1,255]; A quantization table for 8x8 inter-prediction*/
  437. HI_U8 IntraScalingList8X8[64]; /* RW; Range:[1,255]; A quantization table for 8x8 intra-prediction*/
  438. HI_S32 chroma_qp_index_offset; /* RW; Range:[-12,12];default value: 0, see the H.264 protocol for the meaning*/
  439. } VENC_H264_TRANS_S;
  440. /* the param of the h264e entropy*/
  441. typedef struct hiVENC_H264_ENTROPY_S
  442. {
  443. HI_U32 u32EntropyEncModeI; /* RW; Range:[0,1]; Entropy encoding mode for the I frame, 0:cavlc, 1:cabac */
  444. HI_U32 u32EntropyEncModeP; /* RW; Range:[0,1]; Entropy encoding mode for the P frame, 0:cavlc, 1:cabac */
  445. HI_U32 u32EntropyEncModeB; /* RW; Range:[0,1]; Entropy encoding mode for the B frame, 0:cavlc, 1:cabac */
  446. HI_U32 cabac_init_idc; /* RW; Range:[0,2]; see the H.264 protocol for the meaning */
  447. } VENC_H264_ENTROPY_S;
  448. /* the config of the h264e poc*/
  449. typedef struct hiVENC_H264_POC_S
  450. {
  451. HI_U32 pic_order_cnt_type; /* RW; Range:[0,2]; see the H.264 protocol for the meaning */
  452. } VENC_H264_POC_S;
  453. /* the param of the h264e deblocking*/
  454. typedef struct hiVENC_H264_DBLK_S
  455. {
  456. HI_U32 disable_deblocking_filter_idc; /* RW; Range:[0,2]; see the H.264 protocol for the meaning */
  457. HI_S32 slice_alpha_c0_offset_div2; /* RW; Range:[-6,+6]; see the H.264 protocol for the meaning */
  458. HI_S32 slice_beta_offset_div2; /* RW; Range:[-6,+6]; see the H.264 protocol for the meaning */
  459. } VENC_H264_DBLK_S;
  460. /* the param of the h264e vui timing info*/
  461. typedef struct hiVENC_H264_VUI_TIME_INFO_S
  462. {
  463. HI_U8 timing_info_present_flag; /* RW; Range:[0,1]; If 1, timing info belows will be encoded into vui.*/
  464. HI_U8 fixed_frame_rate_flag; /* RW; Range:[0,1]; see the H.264 protocol for the meaning. */
  465. HI_U32 num_units_in_tick; /* RW; Range:(0,4294967295]; see the H.264 protocol for the meaning */
  466. HI_U32 time_scale; /* RW; Range:(0,4294967295]; see the H.264 protocol for the meaning */
  467. } VENC_VUI_H264_TIME_INFO_S;
  468. /* the param of the vui aspct ratio*/
  469. typedef struct hiVENC_VUI_ASPECT_RATIO_S
  470. {
  471. HI_U8 aspect_ratio_info_present_flag; /* RW; Range:[0,1]; If 1, aspectratio info belows will be encoded into vui */
  472. HI_U8 aspect_ratio_idc; /* RW; Range:[0,255]; 17~254 is reserved,see the protocol for the meaning.*/
  473. HI_U8 overscan_info_present_flag; /* RW; Range:[0,1]; If 1, oversacan info belows will be encoded into vui.*/
  474. HI_U8 overscan_appropriate_flag; /* RW; Range:[0,1]; see the protocol for the meaning. */
  475. HI_U16 sar_width; /* RW; Range:(0, 65535]; see the protocol for the meaning. */
  476. HI_U16 sar_height ; /* RW; Range:(0, 65535]; see the protocol for the meaning.
  477. notes: sar_width and sar_height shall be relatively prime.*/
  478. } VENC_VUI_ASPECT_RATIO_S;
  479. /* the param of the vui video signal*/
  480. typedef struct hiVENC_VUI_VIDEO_SIGNAL_S
  481. {
  482. HI_U8 video_signal_type_present_flag ; /* RW; Range:[0,1]; If 1, video singnal info will be encoded into vui. */
  483. HI_U8 video_format ; /* RW; H.264e Range:[0,7], H.265e Range:[0,5]; see the protocol for the meaning. */
  484. HI_U8 video_full_range_flag; /* RW; Range: {0,1}; see the protocol for the meaning.*/
  485. HI_U8 colour_description_present_flag ; /* RO; Range: {0,1}; see the protocol for the meaning.*/
  486. HI_U8 colour_primaries ; /* RO; Range: [0,255]; see the protocol for the meaning. */
  487. HI_U8 transfer_characteristics; /* RO; Range: [0,255]; see the protocol for the meaning. */
  488. HI_U8 matrix_coefficients; /* RO; Range:[0,255]; see the protocol for the meaning. */
  489. } VENC_VUI_VIDEO_SIGNAL_S;
  490. /* the param of the vui video signal*/
  491. typedef struct hiVENC_VUI_BITSTREAM_RESTRIC_S
  492. {
  493. HI_U8 bitstream_restriction_flag ; /* RW; Range: {0,1}; see the protocol for the meaning.*/
  494. } VENC_VUI_BITSTREAM_RESTRIC_S;
  495. /* the param of the h264e vui */
  496. typedef struct hiVENC_H264_VUI_S
  497. {
  498. VENC_VUI_ASPECT_RATIO_S stVuiAspectRatio;
  499. VENC_VUI_H264_TIME_INFO_S stVuiTimeInfo;
  500. VENC_VUI_VIDEO_SIGNAL_S stVuiVideoSignal;
  501. VENC_VUI_BITSTREAM_RESTRIC_S stVuiBitstreamRestric;
  502. } VENC_H264_VUI_S;
  503. /* the param of the h265e vui timing info*/
  504. typedef struct hiVENC_VUI_H265_TIME_INFO_S
  505. {
  506. HI_U32 timing_info_present_flag; /* RW; Range:[0,1]; If 1, timing info belows will be encoded into vui.*/
  507. HI_U32 num_units_in_tick; /* RW; Range:[0,4294967295]; see the H.265 protocol for the meaning. */
  508. HI_U32 time_scale; /* RW; Range:(0,4294967295]; see the H.265 protocol for the meaning */
  509. HI_U32 num_ticks_poc_diff_one_minus1; /* RW; Range:(0,4294967294]; see the H.265 protocol for the meaning */
  510. } VENC_VUI_H265_TIME_INFO_S;
  511. /* the param of the h265e vui */
  512. typedef struct hiVENC_H265_VUI_S
  513. {
  514. VENC_VUI_ASPECT_RATIO_S stVuiAspectRatio;
  515. VENC_VUI_H265_TIME_INFO_S stVuiTimeInfo;
  516. VENC_VUI_VIDEO_SIGNAL_S stVuiVideoSignal;
  517. VENC_VUI_BITSTREAM_RESTRIC_S stVuiBitstreamRestric;
  518. } VENC_H265_VUI_S;
  519. /* the param of the jpege */
  520. typedef struct hiVENC_JPEG_PARAM_S
  521. {
  522. HI_U32 u32Qfactor; /* RW; Range:[1,99]; Qfactor value */
  523. HI_U8 u8YQt[64]; /* RW; Range:[1, 255]; Y quantization table */
  524. HI_U8 u8CbQt[64]; /* RW; Range:[1, 255]; Cb quantization table */
  525. HI_U8 u8CrQt[64]; /* RW; Range:[1, 255]; Cr quantization table */
  526. HI_U32 u32MCUPerECS; /* RW; Range:[0, (picwidth + 15) >> 4 x (picheight +
  527. 15) >> 4 x 2]; MCU number of one ECS*/
  528. } VENC_JPEG_PARAM_S;
  529. /* the param of the mjpege */
  530. typedef struct hiVENC_MJPEG_PARAM_S
  531. {
  532. HI_U8 u8YQt[64]; /* RW; Range:[1, 255]; Y quantization table */
  533. HI_U8 u8CbQt[64]; /* RW; Range:[1, 255]; Cb quantization table */
  534. HI_U8 u8CrQt[64]; /* RW; Range:[1, 255]; Cr quantization table */
  535. HI_U32 u32MCUPerECS; /* RW; Range:[0, (picwidth + 15) >> 4 x (picheight +
  536. 15) >> 4 x 2]; MCU number of one ECS*/
  537. } VENC_MJPEG_PARAM_S;
  538. /* the param of the ProRes */
  539. typedef struct hiVENC_PRORES_PARAM_S
  540. {
  541. HI_U8 u8LumaQt[64]; /* RW; Range:[1, 255]; Luma quantization table */
  542. HI_U8 u8ChromaQt[64]; /* RW; Range:[1, 255]; Chroma quantization table */
  543. HI_CHAR encoder_identifier[4]; /*RW: identifies the encoder vendor or product that generated the compressed frame*/
  544. } VENC_PRORES_PARAM_S;
  545. /* the attribute of the roi */
  546. typedef struct hiVENC_ROI_ATTR_S
  547. {
  548. HI_U32 u32Index; /* RW; Range:[0, 7]; Index of an ROI. The system supports indexes ranging from 0 to 7 */
  549. HI_BOOL bEnable; /* RW; Range:[0, 1]; Whether to enable this ROI */
  550. HI_BOOL bAbsQp; /* RW; Range:[0, 1]; QP mode of an ROI.HI_FALSE: relative QP.HI_TURE: absolute QP.*/
  551. HI_S32 s32Qp; /* RW; Range:[-51, 51]; QP value,only relative mode can QP value less than 0. */
  552. RECT_S stRect; /* RW;Region of an ROI*/
  553. } VENC_ROI_ATTR_S;
  554. /* ROI struct */
  555. typedef struct hiVENC_ROI_ATTR_EX_S
  556. {
  557. HI_U32 u32Index; /* Index of an ROI. The system supports indexes ranging from 0 to 7 */
  558. HI_BOOL bEnable[3]; /* Subscript of array 0: I Frame; 1: P/B Frame; 2: VI Frame; other params are the same. */
  559. HI_BOOL bAbsQp[3]; /* QP mode of an ROI.HI_FALSE: relative QP.HI_TURE: absolute QP.*/
  560. HI_S32 s32Qp[3]; /* QP value. */
  561. RECT_S stRect[3]; /* Region of an ROI*/
  562. }VENC_ROI_ATTR_EX_S;
  563. /* the param of the roibg frame rate */
  564. typedef struct hiVENC_ROIBG_FRAME_RATE_S
  565. {
  566. HI_S32 s32SrcFrmRate; /* RW; Range:[0,4294967295];Source frame rate of a non-ROI*/
  567. HI_S32 s32DstFrmRate; /* RE; Range:[0, s32SrcFrmRate]; Target frame rate of a non-ROI */
  568. } VENC_ROIBG_FRAME_RATE_S;
  569. /* the param of the roibg frame rate */
  570. typedef struct hiVENC_REF_PARAM_S
  571. {
  572. HI_U32 u32Base; /* RW; Range:[0,4294967295]; Base layer period*/
  573. HI_U32 u32Enhance; /* RW; Range:[0,255]; Enhance layer period*/
  574. HI_BOOL bEnablePred; /* RW; Range:[0, 1]; Whether some frames at the base layer are referenced by other frames at the base layer. When bEnablePred is HI_FALSE, all frames at the base layer reference IDR frames.*/
  575. } VENC_REF_PARAM_S;
  576. /* Jpeg snap mode */
  577. typedef enum hiVENC_JPEG_ENCODE_MODE_E
  578. {
  579. JPEG_ENCODE_ALL = 0, /* Jpeg channel snap all the pictures when started. */
  580. JPEG_ENCODE_SNAP = 1, /* Jpeg channel snap the flashed pictures when started. */
  581. JPEG_ENCODE_BUTT,
  582. } VENC_JPEG_ENCODE_MODE_E;
  583. /* the information of the stream */
  584. typedef struct hiVENC_STREAM_BUF_INFO_S
  585. {
  586. HI_U64 u64PhyAddr[MAX_TILE_NUM]; /* R; Start physical address for a stream buffer */
  587. HI_VOID ATTRIBUTE* pUserAddr[MAX_TILE_NUM]; /* R; Start virtual address for a stream buffer */
  588. HI_U64 ATTRIBUTE u64BufSize[MAX_TILE_NUM]; /* R; Stream buffer size */
  589. } VENC_STREAM_BUF_INFO_S;
  590. /* the param of the h265e slice split */
  591. typedef struct hiVENC_H265_SLICE_SPLIT_S
  592. {
  593. HI_BOOL bSplitEnable; /* RW; Range:[0,1]; slice split enable, HI_TRUE:enable, HI_FALSE:diable, default value:HI_FALSE */
  594. HI_U32 u32LcuLineNum; /* RW; Range:(Picture height + 63)/64;this value presents lcu line number */
  595. } VENC_H265_SLICE_SPLIT_S;
  596. /* the param of the h265e pu */
  597. typedef struct hiVENC_H265_PU_S
  598. {
  599. HI_U32 constrained_intra_pred_flag; /* RW; Range:[0,1]; see the H.265 protocol for the meaning. */
  600. HI_U32 strong_intra_smoothing_enabled_flag; /* RW; Range:[0,1]; see the H.265 protocol for the meaning. */
  601. } VENC_H265_PU_S;
  602. /* the param of the h265e trans */
  603. typedef struct hiVENC_H265_TRANS_S
  604. {
  605. HI_S32 cb_qp_offset; /* RW; Range:[-12,12]; see the H.265 protocol for the meaning. */
  606. HI_S32 cr_qp_offset; /* RW; Range:[-12,12]; see the H.265 protocol for the meaning. */
  607. HI_BOOL bScalingListTu4Valid; /* RW; Range:[0,1]; If 1, ScalingList4X4 belows will be encoded.*/
  608. HI_U8 InterScalingList4X4[2][16]; /* RW; Range:[1,255]; Scaling List for inter 4X4 block.*/
  609. HI_U8 IntraScalingList4X4[2][16]; /* RW; Range:[1,255]; Scaling List for intra 4X4 block.*/
  610. HI_BOOL bScalingListTu8Valid; /* RW; Range:[0,1]; If 1, ScalingList8X8 belows will be encoded.*/
  611. HI_U8 InterScalingList8X8[2][64]; /* RW; Range:[1,255]; Scaling List for inter 8X8 block.*/
  612. HI_U8 IntraScalingList8X8[2][64]; /* RW; Range:[1,255]; Scaling List for intra 8X8 block.*/
  613. HI_BOOL bScalingListTu16Valid; /* RW; Range:[0,1]; If 1, ScalingList16X16 belows will be encoded.*/
  614. HI_U8 InterScalingList16X16[2][64]; /* RW; Range:[1,255]; Scaling List for inter 16X16 block..*/
  615. HI_U8 IntraScalingList16X16[2][64]; /* RW; Range:[1,255]; Scaling List for inter 16X16 block.*/
  616. HI_BOOL bScalingListTu32Valid; /* RW; Range:[0,1]; If 1, ScalingList32X32 belows will be encoded.*/
  617. HI_U8 InterScalingList32X32[64]; /* RW; Range:[1,255]; Scaling List for inter 32X32 block..*/
  618. HI_U8 IntraScalingList32X32[64]; /* RW; Range:[1,255]; Scaling List for inter 32X32 block.*/
  619. } VENC_H265_TRANS_S;
  620. /* the param of the h265e entroy */
  621. typedef struct hiVENC_H265_ENTROPY_S
  622. {
  623. HI_U32 cabac_init_flag; /* RW; Range:[0,1]; see the H.265 protocol for the meaning. */
  624. } VENC_H265_ENTROPY_S;
  625. /* the param of the h265e deblocking */
  626. typedef struct hiVENC_H265_DBLK_S
  627. {
  628. HI_U32 slice_deblocking_filter_disabled_flag; /* RW; Range:[0,1]; see the H.265 protocol for the meaning. */
  629. HI_S32 slice_beta_offset_div2; /* RW; Range:[-6,6]; see the H.265 protocol for the meaning. */
  630. HI_S32 slice_tc_offset_div2; /* RW; Range:[-6,6]; see the H.265 protocol for the meaning. */
  631. } VENC_H265_DBLK_S;
  632. /* the param of the h265e sao */
  633. typedef struct hiVENC_H265_SAO_S
  634. {
  635. HI_U32 slice_sao_luma_flag; /*RW; Range:[0,1]; Indicates whether SAO filtering is performed on the luminance component of the current slice. */
  636. HI_U32 slice_sao_chroma_flag; /*RW; Range:[0,1]; Indicates whether SAO filtering is performed on the chrominance component of the current slice*/
  637. } VENC_H265_SAO_S;
  638. /* venc mode type */
  639. typedef enum hiVENC_INTRA_REFRESH_MODE_E
  640. {
  641. INTRA_REFRESH_ROW = 0, /* Line mode */
  642. INTRA_REFRESH_COLUMN, /* Column mode */
  643. INTRA_REFRESH_BUTT
  644. } VENC_INTRA_REFRESH_MODE_E;
  645. /* the param of the intra refresh */
  646. typedef struct hiVENC_INTRA_REFRESH_S
  647. {
  648. HI_BOOL bRefreshEnable; /* RW; Range:[0,1]; intra refresh enable, HI_TRUE:enable, HI_FALSE:diable, default value:HI_FALSE*/
  649. VENC_INTRA_REFRESH_MODE_E enIntraRefreshMode; /*RW;Range:INTRA_REFRESH_ROW or INTRA_REFRESH_COLUMN*/
  650. HI_U32 u32RefreshNum; /* RW; Number of rows/column to be refreshed during each I macroblock refresh*/
  651. HI_U32 u32ReqIQp; /* RW; Range:[0,51]; QP value of the I frame*/
  652. } VENC_INTRA_REFRESH_S;
  653. /* venc mode type */
  654. typedef enum hiVENC_MODTYPE_E
  655. {
  656. MODTYPE_VENC = 1, /* VENC */
  657. MODTYPE_H264E, /* H264e */
  658. MODTYPE_H265E, /* H265e */
  659. MODTYPE_JPEGE, /* Jpege */
  660. MODTYPE_RC, /* Rc */
  661. MODTYPE_BUTT
  662. } VENC_MODTYPE_E;
  663. /* the param of the h264e mod */
  664. typedef struct hiVENC_MOD_H264E_S
  665. {
  666. HI_U32 u32OneStreamBuffer; /* RW; Range:[0,1]; one stream buffer*/
  667. HI_U32 u32H264eMiniBufMode; /* RW; Range:[0,1]; H264e MiniBufMode*/
  668. HI_U32 u32H264ePowerSaveEn; /* RW; Range:[0,1]; H264e PowerSaveEn*/
  669. VB_SOURCE_E enH264eVBSource; /* RW; Range:VB_SOURCE_PRIVATE,VB_SOURCE_USER; H264e VBSource*/
  670. HI_BOOL bQpHstgrmEn; /* RW; Range:[0,1]*/
  671. } VENC_MOD_H264E_S;
  672. /* the param of the h265e mod */
  673. typedef struct hiVENC_MOD_H265E_S
  674. {
  675. HI_U32 u32OneStreamBuffer; /* RW; Range:[0,1]; one stream buffer*/
  676. HI_U32 u32H265eMiniBufMode; /* RW; Range:[0,1]; H265e MiniBufMode*/
  677. HI_U32 u32H265ePowerSaveEn; /* RW; Range:[0,2]; H265e PowerSaveEn*/
  678. VB_SOURCE_E enH265eVBSource; /* RW; Range:VB_SOURCE_PRIVATE,VB_SOURCE_USER; H265e VBSource*/
  679. HI_BOOL bQpHstgrmEn; /* RW; Range:[0,1]*/
  680. } VENC_MOD_H265E_S;
  681. /* the param of the jpege mod */
  682. typedef struct hiVENC_MOD_JPEGE_S
  683. {
  684. HI_U32 u32OneStreamBuffer; /* RW; Range:[0,1]; one stream buffer*/
  685. HI_U32 u32JpegeMiniBufMode; /* RW; Range:[0,1]; Jpege MiniBufMode*/
  686. HI_U32 u32JpegClearStreamBuf; /* RW; Range:[0,1]; JpegClearStreamBuf*/
  687. } VENC_MOD_JPEGE_S;
  688. typedef struct hiVENC_MOD_RC_S
  689. {
  690. HI_U32 u32ClrStatAfterSetBr;
  691. } VENC_MOD_RC_S;
  692. /* the param of the venc mod */
  693. typedef struct hiVENC_MOD_VENC_S
  694. {
  695. HI_U32 u32VencBufferCache; /* RW; Range:[0,1]; VencBufferCache*/
  696. HI_U32 u32FrameBufRecycle; /* RW; Range:[0,1]; FrameBufRecycle*/
  697. } VENC_MOD_VENC_S;
  698. /* the param of the mod */
  699. typedef struct hiVENC_MODPARAM_S
  700. {
  701. VENC_MODTYPE_E enVencModType; /* RW; VencModType*/
  702. union
  703. {
  704. VENC_MOD_VENC_S stVencModParam;
  705. VENC_MOD_H264E_S stH264eModParam;
  706. VENC_MOD_H265E_S stH265eModParam;
  707. VENC_MOD_JPEGE_S stJpegeModParam;
  708. VENC_MOD_RC_S stRcModParam;
  709. };
  710. } VENC_PARAM_MOD_S;
  711. typedef enum hiVENC_FRAME_TYPE_E
  712. {
  713. VENC_FRAME_TYPE_NONE = 1,
  714. VENC_FRAME_TYPE_IDR,
  715. VENC_FRAME_TYPE_BUTT
  716. } VENC_FRAME_TYPE_E;
  717. /* the information of the user rc*/
  718. typedef struct hiUSER_RC_INFO_S
  719. {
  720. HI_BOOL bQpMapValid; /*RW; Range:[0,1]; Indicates whether the QpMap mode is valid for the current frame*/
  721. HI_BOOL bSkipWeightValid; /*RW; Range:[0,1]; Indicates whether the SkipWeight mode is valid for the current frame*/
  722. HI_U32 u32BlkStartQp; /* RW; Range:[0,51];QP value of the first 16 x 16 block in QpMap mode */
  723. HI_U64 u64QpMapPhyAddr; /* RW; Physical address of the QP table in QpMap mode*/
  724. HI_U64 u64SkipWeightPhyAddr; /* RW; Physical address of the SkipWeight table in QpMap mode*/
  725. VENC_FRAME_TYPE_E enFrameType;
  726. } USER_RC_INFO_S;
  727. /* the information of the user frame*/
  728. typedef struct hiUSER_FRAME_INFO_S
  729. {
  730. VIDEO_FRAME_INFO_S stUserFrame;
  731. USER_RC_INFO_S stUserRcInfo;
  732. } USER_FRAME_INFO_S;
  733. /* the config of the sse*/
  734. typedef struct hiVENC_SSE_CFG_S
  735. {
  736. HI_U32 u32Index; /* RW; Range:[0, 7]; Index of an SSE. The system supports indexes ranging from 0 to 7 */
  737. HI_BOOL bEnable; /* RW; Range:[0, 1]; Whether to enable SSE */
  738. RECT_S stRect; /* RW; */
  739. } VENC_SSE_CFG_S;
  740. /* the param of the crop */
  741. typedef struct hiVENC_CROP_INFO_S
  742. {
  743. HI_BOOL bEnable; /* RW; Range:[0, 1]; Crop region enable */
  744. RECT_S stRect; /* RW; Crop region, note: s32X must be multi of 16 */
  745. } VENC_CROP_INFO_S;
  746. /* the param of the venc frame rate */
  747. typedef struct hiVENC_FRAME_RATE_S
  748. {
  749. HI_S32 s32SrcFrmRate; /* RW; Range:[0, 240]; Input frame rate of a channel*/
  750. HI_S32 s32DstFrmRate; /* RW; Range:[0, 240]; Output frame rate of a channel*/
  751. } VENC_FRAME_RATE_S;
  752. /* the param of the venc encode chnl */
  753. typedef struct hiVENC_CHN_PARAM_S
  754. {
  755. HI_BOOL bColor2Grey; /* RW; Range:[0, 1]; Whether to enable Color2Grey.*/
  756. HI_U32 u32Priority; /* RW; Range:[0, 1]; The priority of the coding chnl.*/
  757. HI_U32 u32MaxStrmCnt; /* RW: Range:[0,4294967295]; Maximum number of frames in a stream buffer*/
  758. HI_U32 u32PollWakeUpFrmCnt; /* RW: Range:(0,4294967295]; the frame num needed to wake up obtaining streams */
  759. VENC_CROP_INFO_S stCropCfg;
  760. VENC_FRAME_RATE_S stFrameRate;
  761. } VENC_CHN_PARAM_S;
  762. /*the ground protect of FOREGROUND*/
  763. typedef struct hiVENC_FOREGROUND_PROTECT_S
  764. {
  765. HI_BOOL bForegroundCuRcEn;
  766. HI_U32 u32ForegroundDirectionThresh; /*RW; Range:[0, 16]; The direction for controlling the macroblock-level bit rate*/
  767. HI_U32 u32ForegroundThreshGain; /*RW; Range:[0, 15]; The gain of the thresh*/
  768. HI_U32 u32ForegroundThreshOffset; /*RW; Range:[0, 255]; The offset of the thresh*/
  769. HI_U32 u32ForegroundThreshP[RC_TEXTURE_THR_SIZE];/*RW; Range:[0, 255]; Mad threshold for controlling the foreground macroblock-level bit rate of P frames */
  770. HI_U32 u32ForegroundThreshB[RC_TEXTURE_THR_SIZE];/*RW; Range:[0, 255]; Mad threshold for controlling the foreground macroblock-level bit rate of B frames */
  771. }VENC_FOREGROUND_PROTECT_S;
  772. /* the scene mode of the venc encode chnl */
  773. typedef enum hiVENC_SCENE_MODE_E
  774. {
  775. SCENE_0 = 0, /*RW;A scene in which the camera does not move or periodically moves continuously*/
  776. SCENE_1 = 1, /*RW;Motion scene at high bit rate*/
  777. SCENE_2 = 2, /*RW;It has regular continuous motion at medium bit rate and the encoding pressure is relatively large*/
  778. SCENE_BUTT
  779. }VENC_SCENE_MODE_E;
  780. typedef struct hiVENC_DEBREATHEFFECT_S
  781. {
  782. HI_BOOL bEnable; /*RW; Range:[0,1];default: 0, DeBreathEffect enable */
  783. HI_S32 s32Strength; /*RW; Range:[0,10];The Strength of DeBreathEffect.*/
  784. } VENC_DEBREATHEFFECT_S;
  785. typedef struct hiVENC_CU_PREDICTION_S
  786. {
  787. OPERATION_MODE_E enPredMode;
  788. HI_U32 u32Intra32Cost;
  789. HI_U32 u32Intra16Cost;
  790. HI_U32 u32Intra8Cost;
  791. HI_U32 u32Intra4Cost;
  792. HI_U32 u32Inter64Cost;
  793. HI_U32 u32Inter32Cost;
  794. HI_U32 u32Inter16Cost;
  795. HI_U32 u32Inter8Cost;
  796. } VENC_CU_PREDICTION_S;
  797. typedef struct hiVENC_SKIP_BIAS_S
  798. {
  799. HI_BOOL bSkipBiasEn;
  800. HI_U32 u32SkipThreshGain;
  801. HI_U32 u32SkipThreshOffset;
  802. HI_U32 u32SkipBackgroundCost;
  803. HI_U32 u32SkipForegroundCost;
  804. } VENC_SKIP_BIAS_S;
  805. typedef struct hiVENC_HIERARCHICAL_QP_S
  806. {
  807. HI_BOOL bHierarchicalQpEn;
  808. HI_S32 s32HierarchicalQpDelta[4];
  809. HI_S32 s32HierarchicalFrameNum[4];
  810. }VENC_HIERARCHICAL_QP_S;
  811. typedef struct hiVENC_CHN_POOL_S
  812. {
  813. VB_POOL hPicVbPool; /* RW; vb pool id for pic buffer */
  814. VB_POOL hPicInfoVbPool; /* RW; vb pool id for pic info buffer */
  815. }VENC_CHN_POOL_S;
  816. #ifdef __cplusplus
  817. #if __cplusplus
  818. }
  819. #endif
  820. #endif /* __cplusplus */
  821. #endif /* __HI_COMM_VENC_H__ */