ax_ivps_api.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. /**********************************************************************************
  2. *
  3. * Copyright (c) 2019-2020 Beijing AXera Technology Co., Ltd. All Rights Reserved.
  4. *
  5. * This source file is the property of Beijing AXera Technology Co., Ltd. and
  6. * may not be copied or distributed in any isomorphic form without the prior
  7. * written consent of Beijing AXera Technology Co., Ltd.
  8. *
  9. **********************************************************************************/
  10. #ifndef _AX_IVPS_API_H_
  11. #define _AX_IVPS_API_H_
  12. #include "ax_base_type.h"
  13. #include "ax_global_type.h"
  14. #include "ax_sys_api.h"
  15. #include "ax_ivps_type.h"
  16. #ifdef __cplusplus
  17. extern "C"
  18. {
  19. #endif
  20. typedef AX_S32 IVPS_GRP;
  21. typedef AX_S32 IVPS_CHN;
  22. typedef AX_S32 IVPS_FILTER;
  23. typedef AX_S32 IVPS_RGN_GRP;
  24. typedef AX_U32 IVPS_RGB;
  25. #define AX_IVPS_MAX_GRP_NUM 20
  26. #define AX_IVPS_MAX_OUTCHN_NUM 5
  27. #define AX_IVPS_MAX_FILTER_NUM_PER_OUTCHN 2
  28. #define AX_IVPS_INVALID_FRMRATE (-1)
  29. typedef enum
  30. {
  31. AX_IVPS_CHN_FLIP_NONE = 0,
  32. AX_IVPS_CHN_FLIP,
  33. AX_IVPS_CHN_MIRROR,
  34. AX_IVPS_CHN_FLIP_AND_MIRROR,
  35. AX_IVPS_CHN_FLIP_BUTT
  36. } AX_IVPS_CHN_FLIP_MODE_E;
  37. typedef struct axIVPS_RECT_S
  38. {
  39. AX_U16 nX;
  40. AX_U16 nY;
  41. AX_U16 nW;
  42. AX_U16 nH;
  43. } AX_IVPS_RECT_S;
  44. typedef struct axIVPS_POINT_S
  45. {
  46. AX_S16 nX;
  47. AX_S16 nY;
  48. } AX_IVPS_POINT_S;
  49. typedef struct axIVPS_SIZE_S
  50. {
  51. AX_U16 nW;
  52. AX_U16 nH;
  53. } AX_IVPS_SIZE_S;
  54. typedef struct axIVPS_BOX_S
  55. {
  56. AX_S16 nX;
  57. AX_S16 nY;
  58. AX_U16 nW;
  59. AX_U16 nH;
  60. } AX_IVPS_BOX_S;
  61. typedef struct axIVPS_ASPECT_RATIO_S
  62. {
  63. AX_IVPS_ASPECT_RATIO_E eMode;
  64. /* Typical RGB color:
  65. 1. WHITE : 0xFFFFFF
  66. 2. BLACK : 0x000000
  67. 3. RED : 0x0000FF
  68. 4. BLUE : 0x00FF00
  69. 5. YELLOW: 0xFF00FF
  70. 31 23 15 7 0
  71. |--------|---R---|---G---|---B---|
  72. */
  73. AX_U32 nBgColor;
  74. AX_IVPS_ASPECT_RATIO_ALIGN_E eAligns[2]; /* IVPS_ASPECT_RATIO_ALIGN: [0]: HORIZONTAL [1]: VERTICAL */
  75. AX_IVPS_RECT_S tRect; /* should be set in ASPECT_RATIO_MANUAL mode */
  76. } AX_IVPS_ASPECT_RATIO_S;
  77. typedef struct axIVPS_FRAME_RATE_CTRL_S
  78. {
  79. /* src frame rate (<= 0: no FRC control) */
  80. AX_S32 nSrcFrameRate;
  81. /* dst frame rate (<= 0, or nSrcFrameRate must be set) */
  82. AX_S32 nDstFrameRate;
  83. } AX_IVPS_FRAME_RATE_CTRL_S;
  84. typedef struct axIVPS_FB_INFO_S
  85. {
  86. AX_POOL PoolId;
  87. AX_BOOL bInPlace;
  88. AX_BLK BlkId;
  89. AX_BLK BlkIdUV;
  90. AX_U64 nPhyAddr;
  91. AX_U64 nPhyAddrUV;
  92. AX_U32 nUvOffset;
  93. } AX_IVPS_FB_INFO_S;
  94. typedef enum
  95. {
  96. AX_IVPS_ENGINE_CPU = 0,
  97. AX_IVPS_ENGINE_TDP,
  98. AX_IVPS_ENGINE_GDC,
  99. // AX_IVPS_ENGINE_VPP, //for future extension
  100. // AX_IVPS_ENGINE_VGP, //for future extension
  101. // AX_IVPS_ENGINE_IVE, //for future extension
  102. AX_IVPS_ENGINE_VO,
  103. AX_IVPS_ENGINE_NPU,
  104. AX_IVPS_ENGINE_DSP,
  105. // AX_IVPS_ENGINE_DPU, //depth processor unit
  106. AX_IVPS_ENGINE_BUTT
  107. } AX_IVPS_ENGINE_E;
  108. /*
  109. * IVPS_PIPELINE_X is the mainstream pipeline we currently support. The mode is as follows:
  110. * => Pipe1Filter0 Pipe1Filter1 (chn 0)
  111. * Pipe0Filter0 Pipe0Filter1 => Pipe2Filter0 Pipe2Filter1 (chn 1)
  112. * => Pipe3Filter0 Pipe3Filter1 (chn 2)
  113. * Note: Filter[n]:
  114. * n: channel filter type(0: RFC/CROP/SCALE/ROTATE; 1:REGION)
  115. */
  116. typedef enum
  117. {
  118. AX_IVPS_PIPELINE_DEFAULT = 0,
  119. AX_IVPS_PIPELINE_BUTT
  120. } AX_IVPS_PIPELINE_E;
  121. /*
  122. * AX_IVPS_TDP_CFG_S
  123. * This configuration is specific to TDP engine.
  124. * This engine can support many functions,
  125. * such as mirror,flip,rotation,scale,mosaic,osd and so on.
  126. * For AX620, if in eCompressMode, stride and width should be 64 pixels aligned.
  127. * If NOT in eCompressMode, stride should be 64 pixels aligned. width should be 2 pixels aligned.
  128. */
  129. typedef struct axIVPS_TDP_CFG_S
  130. {
  131. AX_BOOL bCrop;
  132. AX_IVPS_RECT_S tCropRect;
  133. AX_BOOL bMirror;
  134. AX_BOOL bFlip;
  135. AX_IVPS_ROTATION_E eRotation;
  136. AX_IVPS_ASPECT_RATIO_S tAspectRatio;
  137. AX_BOOL bDither;
  138. AX_COMPRESS_MODE_E eCompressMode;
  139. AX_BOOL bInplace;
  140. } AX_IVPS_TDP_CFG_S;
  141. /*
  142. * AX_IVPS_DEWARP_TYPE_E
  143. * AX_IVPS_DEWARP_MAP_USER: user-defined map.
  144. * AX_IVPS_DEWARP_DISTORTION: distortion correction.
  145. * AX_IVPS_DEWARP_PERSPECTIVE: affine or perspective transformation.
  146. */
  147. typedef enum
  148. {
  149. AX_IVPS_DEWARP_MAP_USER = 0,
  150. AX_IVPS_DEWARP_DISTORTION,
  151. AX_IVPS_DEWARP_PERSPECTIVE,
  152. AX_IVPS_DEWARP_LDC,
  153. AX_IVPS_DEWARP_BUTT
  154. } AX_IVPS_DEWARP_TYPE_E;
  155. /*
  156. * AX_IVPS_DEWARP_DISTORTION_FACTOR_S
  157. * Camera Matrix(internal parameter matrix) =
  158. * [fx, 0, -cx],
  159. * [0, fy, -cy],
  160. * [0, 0, 1 ],
  161. * Distortion Coefficients =
  162. * (k1, k2, p1, p2, k3, k4, k5, k6)
  163. * Note:
  164. * 1. The matrix element has 6 decimal numbers.
  165. * i.e. If the element is 954301, 954301/1000000 = 0.954301,
  166. * the real value is 0.954301.
  167. * 2. fx,fy: [64000000, 8192000000]
  168. * cx,cy: [300000, 700000 ]
  169. * k1,k2,p1,p2,k3: [-16000000, 16000000 ]
  170. * k4,k5,k6: reserved
  171. */
  172. typedef struct
  173. {
  174. AX_S64 nCameraMatrix[9];
  175. AX_S64 nDistortionCoeff[8];
  176. } AX_IVPS_DEWARP_DISTORTION_FACTOR_S;
  177. /*
  178. * AX_IVPS_DEWARP_PERSPECTIVE_FACTOR_S
  179. * Perspective Matrix =
  180. * [m(0,0), m(0,1), m(0,2)],
  181. * [m(1,0), m(1,1), m(1,2)],
  182. * [m(2,0), m(2,1), m(2,2)],
  183. * If [m(2,0), m(2,1), m(2,2)] = [0, 0, 1], the transformation is affine.
  184. * Note:
  185. * 1. m(2,2): [500000, 1500000].
  186. * 2. The matrix element has 6 decimal numbers.
  187. * i.e. If the element is 954301, 954301/1000000 = 0.954301,
  188. * the real value is 0.954301.
  189. */
  190. typedef struct
  191. {
  192. AX_S64 nPerspectiveMatrix[9];
  193. } AX_IVPS_DEWARP_PERSPECTIVE_FACTOR_S;
  194. typedef struct
  195. {
  196. AX_BOOL bAspect; /* Whether aspect ration is keep */
  197. AX_S16 nXRatio; /* Range: [0, 100], field angle ration of horizontal, valid when bAspect=0. */
  198. AX_S16 nYRatio; /* Range: [0, 100], field angle ration of vertical, valid when bAspect=0. */
  199. AX_S16 nXYRatio; /* Range: [0, 100], field angle ration of all,valid when bAspect=1. */
  200. AX_S16 nCenterXOffset; /* Range: [-511, 511], horizontal offset of the image distortion center relative to image center. */
  201. AX_S16 nCenterYOffset; /* Range: [-511, 511], vertical offset of the image distortion center relative to image center. */
  202. AX_S16 nDistortionRatio; /* Range: [0, 1023], LDC distortion ratio. 512 is undistortion center value */
  203. AX_U8 nSpreadCoef; /* Range: [0, 18], strength coefficient of spread correction */
  204. } AX_IVPS_DEWARP_LDC_FACTOR_S;
  205. /*
  206. * AX_IVPS_GDC_CFG_S
  207. * This configuration is specific to GDC engine.
  208. * If bDewarpEnable is AX_TRUE, dewarp function
  209. * (such as user-defined map, distortion correction, affine or perspective transformation) is enabled.
  210. * Otherwise, GDC only performs functions such as crop, rotation, mirror, flip and scaling.
  211. * For user-defined map type, nMeshTableSize is fixed 1188, which means 1188 lines.
  212. * Each line occupies 8 bytes. So you need to malloc 1188x8 bytes of physical memory to store the mesh table.
  213. * If eCompressMode is TILE, stride and width should be 64 pixels aligned.
  214. * If eCompressMode is NONE, only stride should be 64 pixels aligned, while
  215. * input frame width should be 2 pixels aligned, output frame width should be 16 pixels aligned.
  216. */
  217. typedef struct axIVPS_GDC_CFG_S
  218. {
  219. AX_BOOL bDewarpEnable;
  220. AX_BOOL bCrop;
  221. AX_IVPS_RECT_S tCropRect;
  222. AX_IVPS_ROTATION_E eRotation;
  223. AX_BOOL bMirror;
  224. AX_BOOL bFlip;
  225. AX_COMPRESS_MODE_E eCompressMode;
  226. AX_BOOL bEnhanceMode;
  227. AX_IVPS_DEWARP_TYPE_E bDewarpType;
  228. union
  229. {
  230. /* AX_IVPS_DEWARP_DISTORTION */
  231. AX_IVPS_DEWARP_DISTORTION_FACTOR_S tDistortionFactor;
  232. /* AX_IVPS_DEWARP_PERSPECTIVE */
  233. AX_IVPS_DEWARP_PERSPECTIVE_FACTOR_S tPerspectiveFactor;
  234. /* AX_IVPS_DEWARP_LDC */
  235. AX_IVPS_DEWARP_LDC_FACTOR_S tLdcFactor;
  236. };
  237. /* AX_IVPS_DEWARP_MAP_USER */
  238. AX_U16 nInterStartX;
  239. AX_U16 nInterStartY;
  240. AX_U16 nMeshStartX;
  241. AX_U16 nMeshStartY;
  242. AX_U16 nMeshWidth;
  243. AX_U16 nMeshHeight;
  244. AX_U64 nPhyAddr;
  245. AX_U64 nMeshTableVirAddr;
  246. AX_U32 nMeshTableSize;
  247. } AX_IVPS_GDC_CFG_S;
  248. /*
  249. * AX_IVPS_VO_CFG_S
  250. * This configuration is specific to VO engine.
  251. * This engine can only support alpha blending for OSD.
  252. */
  253. typedef struct axIVPS_VO_CFG_S
  254. {
  255. AX_BOOL bCrop;
  256. AX_IVPS_RECT_S tCropRect;
  257. } AX_IVPS_VO_CFG_S;
  258. /*
  259. * AX_IVPS_FILTER_S
  260. * A pipeline consists of a filter or several.
  261. * Each filter can complete specific functions.
  262. * You can choose the engine to do this.
  263. */
  264. typedef struct axIVPS_FILTER_S
  265. {
  266. AX_BOOL bEnable;
  267. AX_IVPS_FRAME_RATE_CTRL_S tFRC;
  268. AX_U32 nDstPicOffsetX0;
  269. AX_U32 nDstPicOffsetY0;
  270. AX_U32 nDstPicWidth;
  271. AX_U32 nDstPicHeight;
  272. AX_U32 nDstPicStride;
  273. AX_U32 nDstFrameWidth;
  274. AX_U32 nDstFrameHeight;
  275. AX_IMG_FORMAT_E eDstPicFormat;
  276. AX_IVPS_ENGINE_E eEngine;
  277. union /* engine specific config data */
  278. {
  279. AX_IVPS_TDP_CFG_S tTdpCfg;
  280. AX_IVPS_GDC_CFG_S tGdcCfg;
  281. AX_IVPS_VO_CFG_S tVoCfg;
  282. };
  283. } AX_IVPS_FILTER_S;
  284. typedef struct axIVPS_PIPELINE_ATTR_S
  285. {
  286. AX_IVPS_FB_INFO_S tFbInfo;
  287. AX_U8 nOutChnNum;
  288. AX_IVPS_FILTER_S tFilter[AX_IVPS_MAX_OUTCHN_NUM + 1][AX_IVPS_MAX_FILTER_NUM_PER_OUTCHN];
  289. AX_U8 nOutFifoDepth[AX_IVPS_MAX_OUTCHN_NUM];
  290. AX_U16 nInDebugFifoDepth;
  291. } AX_IVPS_PIPELINE_ATTR_S;
  292. typedef struct
  293. {
  294. AX_U8 nInFifoDepth;
  295. AX_IVPS_PIPELINE_E ePipeline;
  296. } AX_IVPS_GRP_ATTR_S;
  297. /* ---------------------------- Pipeline APIs ---------------------------- */
  298. AX_S32 AX_IVPS_Init(AX_VOID);
  299. AX_S32 AX_IVPS_Deinit(AX_VOID);
  300. AX_S32 AX_IVPS_CreateGrp(IVPS_GRP IvpsGrp, const AX_IVPS_GRP_ATTR_S *ptGrpAttr);
  301. AX_S32 AX_IVPS_DestoryGrp(IVPS_GRP IvpsGrp);
  302. AX_S32 AX_IVPS_SetPipelineAttr(IVPS_GRP IvpsGrp, const AX_IVPS_PIPELINE_ATTR_S *ptPipelineAttr);
  303. AX_S32 AX_IVPS_GetPipelineAttr(IVPS_GRP IvpsGrp, AX_IVPS_PIPELINE_ATTR_S *ptPipelineAttr);
  304. AX_S32 AX_IVPS_StartGrp(IVPS_GRP IvpsGrp);
  305. AX_S32 AX_IVPS_StopGrp(IVPS_GRP IvpsGrp);
  306. AX_S32 AX_IVPS_EnableChn(IVPS_GRP IvpsGrp, IVPS_CHN IvpsChn);
  307. AX_S32 AX_IVPS_DisableChn(IVPS_GRP IvpsGrp, IVPS_CHN IvpsChn);
  308. AX_S32 AX_IVPS_SendFrame(IVPS_GRP IvpsGrp, const AX_VIDEO_FRAME_S *ptFrame, AX_S32 nMilliSec);
  309. AX_S32 AX_IVPS_GetChnFrame(IVPS_GRP IvpsGrp, IVPS_CHN IvpsChn, AX_VIDEO_FRAME_S *ptFrame, AX_S32 nMilliSec);
  310. AX_S32 AX_IVPS_ReleaseChnFrame(IVPS_GRP IvpsGrp, IVPS_CHN IvpsChn, AX_VIDEO_FRAME_S *ptFrame);
  311. AX_S32 AX_IVPS_GetChnFd(IVPS_GRP IvpsGrp, IVPS_CHN IvpsChn);
  312. AX_S32 AX_IVPS_GetDebugFifoFrame(IVPS_GRP IvpsGrp, AX_VIDEO_FRAME_S *ptFrame);
  313. AX_S32 AX_IVPS_ReleaseDebugFifoFrame(IVPS_GRP IvpsGrp, AX_VIDEO_FRAME_S *ptFrame);
  314. AX_S32 AX_IVPS_CloseAllFd(AX_VOID);
  315. AX_S32 AX_IVPS_GetGrpLDCAttr(IVPS_GRP IvpsGrp, IVPS_FILTER IvpsFilter,
  316. AX_IVPS_DEWARP_LDC_FACTOR_S *ptLDCAttr);
  317. AX_S32 AX_IVPS_SetGrpLDCAttr(IVPS_GRP IvpsGrp, IVPS_FILTER IvpsFilter,
  318. const AX_IVPS_DEWARP_LDC_FACTOR_S *ptLDCAttr);
  319. AX_S32 AX_IVPS_GetChnLDCAttr(IVPS_GRP IvpsGrp, IVPS_CHN IvpsChn, IVPS_FILTER IvpsFilter,
  320. AX_IVPS_DEWARP_LDC_FACTOR_S *ptLDCAttr);
  321. AX_S32 AX_IVPS_SetChnLDCAttr(IVPS_GRP IvpsGrp, IVPS_CHN IvpsChn, IVPS_FILTER IvpsFilter,
  322. const AX_IVPS_DEWARP_LDC_FACTOR_S *ptLDCAttr);
  323. /***************************************************************************************************************/
  324. /* REGION */
  325. /***************************************************************************************************************/
  326. typedef AX_S32 IVPS_RGN_HANDLE;
  327. #define AX_IVPS_MAX_RGN_HANDLE_NUM (64)
  328. #define AX_IVPS_INVALID_REGION_HANDLE (IVPS_RGN_HANDLE)(-1)
  329. #define AX_IVPS_REGION_MAX_DISP_NUM (32)
  330. typedef enum
  331. {
  332. AX_IVPS_RGN_TYPE_LINE = 0,
  333. AX_IVPS_RGN_TYPE_RECT = 1,
  334. AX_IVPS_RGN_TYPE_POLYGON = 2, /* convex quadrilateral */
  335. AX_IVPS_RGN_TYPE_MOSAIC = 3,
  336. AX_IVPS_RGN_TYPE_OSD = 4,
  337. AX_IVPS_RGN_TYPE_BUTT
  338. } AX_IVPS_RGN_TYPE_E;
  339. typedef enum
  340. {
  341. AX_IVPS_RGN_LAYER_OVERLAY = 0,
  342. AX_IVPS_RGN_LAYER_OVERLAY_EXT0,
  343. AX_IVPS_RGN_LAYER_OVERLAY_EXT1,
  344. AX_IVPS_RGN_LAYER_OVERLAY_EXT2,
  345. AX_IVPS_RGN_LAYER_OVERLAY_EXT3,
  346. AX_IVPS_RGN_LAYER_COVER, /*only support mosaic/rectangle(solid or not)*/
  347. AX_IVPS_RGN_LAYER_BUTT
  348. } AX_IVPS_RGN_LAYER_E;
  349. typedef struct axIVPS_COLORKEY_S
  350. {
  351. AX_BOOL bEnable;
  352. AX_BOOL bColorKeyInv; /* 0: winin threshold, 1: outside threshold */
  353. IVPS_RGB nBgColorLo; /* min value of background color */
  354. IVPS_RGB nBgColorHi; /* max value of background color */
  355. } AX_IVPS_COLORKEY_S;
  356. typedef struct axIVPS_BITCOLOR_S
  357. {
  358. AX_BOOL bEnable;
  359. IVPS_RGB nColor;
  360. IVPS_RGB nColorInv;
  361. IVPS_RGB nColorInvThr;
  362. } AX_IVPS_BITCOLOR_S;
  363. typedef struct axIVPS_RGN_CHN_ATTR_S
  364. {
  365. AX_S32 nZindex;
  366. AX_BOOL bSingleCanvas; /* AX_TURE: single canvas; AX_FALSE: double canvas */
  367. AX_U16 nAlpha; /* 0 - 1024, 0: transparent, 1024: opaque*/
  368. AX_IMG_FORMAT_E eFormat;
  369. AX_IVPS_BITCOLOR_S nBitColor; /*only for bitmap*/
  370. AX_IVPS_COLORKEY_S nColorKey; /* only for Overlay 0 */
  371. } AX_IVPS_RGN_CHN_ATTR_S;
  372. typedef struct
  373. {
  374. AX_IVPS_POINT_S tPTs[10];
  375. AX_U8 nPointNum;
  376. AX_U32 nLineWidth; /* [1 - 16] */
  377. IVPS_RGB nColor; /* RGB Color: 0xRRGGBB, eg: red: 0xFF0000 */
  378. AX_U8 nAlpha; /* 0 - 255, 0: transparent, 255: opaque*/
  379. } AX_IVPS_RGN_LINE_S;
  380. typedef struct
  381. {
  382. union
  383. {
  384. AX_IVPS_RECT_S tRect; /* AX_IVPS_OVERLAY_RECT */
  385. AX_IVPS_POINT_S tPTs[10]; /* AX_IVPS_OVERLAY_POLYGON, up to 10*/
  386. };
  387. AX_U8 nPointNum;
  388. AX_U32 nLineWidth; /* [1 - 16] */
  389. IVPS_RGB nColor; /* RGB Color: 0xRRGGBB */
  390. AX_U8 nAlpha; /* 0 - 255, 0: transparent, 255: opaque*/
  391. AX_BOOL bSolid; /* if AX_TRUE, fill the rect with the nColor */
  392. /*
  393. The style of rectangle is like below
  394. [ ]
  395. [ ]
  396. if bCornerRect is AX_TRUE, then bSolid is always AX_FALSE
  397. */
  398. AX_BOOL bCornerRect;
  399. } AX_IVPS_RGN_POLYGON_S;
  400. typedef struct
  401. {
  402. AX_IVPS_RECT_S tRect;
  403. AX_IVPS_MOSAIC_BLK_SIZE_E eBklSize;
  404. } AX_IVPS_RGN_MOSAIC_S;
  405. typedef AX_OSD_BMP_ATTR_S AX_IVPS_RGN_OSD_S;
  406. typedef union
  407. {
  408. AX_IVPS_RGN_LINE_S tLine;
  409. AX_IVPS_RGN_POLYGON_S tPolygon;
  410. AX_IVPS_RGN_MOSAIC_S tMosaic;
  411. AX_IVPS_RGN_OSD_S tOSD;
  412. } AX_IVPS_RGN_DISP_U;
  413. typedef struct
  414. {
  415. AX_BOOL bShow;
  416. AX_IVPS_RGN_TYPE_E eType;
  417. AX_IVPS_RGN_DISP_U uDisp;
  418. } AX_IVPS_RGN_DISP_S;
  419. typedef struct
  420. {
  421. AX_U32 nNum;
  422. AX_IVPS_RGN_CHN_ATTR_S tChnAttr;
  423. AX_IVPS_RGN_DISP_S arrDisp[AX_IVPS_REGION_MAX_DISP_NUM];
  424. } AX_IVPS_RGN_DISP_GROUP_S;
  425. typedef struct axIVPS_GDI_ATTR_S
  426. {
  427. AX_U16 nThick;
  428. AX_U16 nAlpha;
  429. AX_U32 nColor;
  430. AX_BOOL bSolid; /* if AX_TRUE, fill the rect with the nColor */
  431. AX_BOOL bAbsCoo; /*is Absolute Coordinate*/
  432. } AX_IVPS_GDI_ATTR_S;
  433. typedef struct axIVPS_RGN_CANVAS_INFO_S
  434. {
  435. AX_BLK BlkId;
  436. AX_U64 nPhyAddr;
  437. AX_VOID *pVirAddr;
  438. AX_U32 nUVOffset; /* Pixels of Y and UV offset. If YUV420 format, nUVOffset = u64PhyAddr[1] - u64PhyAddr[0] */
  439. AX_U32 nStride;
  440. AX_U16 nW;
  441. AX_U16 nH;
  442. AX_IMG_FORMAT_E eFormat;
  443. } AX_IVPS_RGN_CANVAS_INFO_S;
  444. /*
  445. Create region
  446. @return : return the region handle created
  447. */
  448. IVPS_RGN_HANDLE AX_IVPS_RGN_Create(AX_VOID);
  449. /*
  450. Destroy created region
  451. @param - [IN] hRegion: specifies the region handle created by AX_IVPS_RGN_Create
  452. */
  453. AX_S32 AX_IVPS_RGN_Destroy(IVPS_RGN_HANDLE hRegion);
  454. /*
  455. Attach region to IVPS channel
  456. @param - [IN] hRegion: specifies the region handle created by AX_IVPS_RGN_Create
  457. @param - [IN] IvpsGrp: specifies the group to attach.
  458. @param - [IN] IvpsFilter: specifies the filter of the group to attach.
  459. */
  460. AX_S32 AX_IVPS_RGN_AttachToFilter(IVPS_RGN_HANDLE hRegion, IVPS_GRP IvpsGrp, IVPS_FILTER IvpsFilter);
  461. /*
  462. Detach region from IVPS channel
  463. @param - [IN] hRegion: specifies the region handle created by AX_IVPS_RGN_Create
  464. @param - [IN] IvpsGrp: specifies the group to detach.
  465. @param - [IN] IvpsFilter: specifies the filter of the group to detach.
  466. */
  467. AX_S32 AX_IVPS_RGN_DetachFromFilter(IVPS_RGN_HANDLE hRegion, IVPS_GRP IvpsGrp, IVPS_FILTER IvpsFilter);
  468. AX_S32 AX_IVPS_RGN_Update(IVPS_RGN_HANDLE hRegion, const AX_IVPS_RGN_DISP_GROUP_S *ptDisp);
  469. /***************************************************************************************************************/
  470. /* OFFLINE */
  471. /***************************************************************************************************************/
  472. AX_S32 AX_IVPS_CmmCopy(AX_U64 nSrcPhyAddr, AX_U64 nDstPhyAddr, AX_U64 nMemSize);
  473. AX_S32 AX_IVPS_Rotation(const AX_VIDEO_FRAME_S *ptSrc, AX_IVPS_ROTATION_E eRotation, AX_VIDEO_FRAME_S *ptDst);
  474. AX_S32 AX_IVPS_FlipAndRotation(const AX_VIDEO_FRAME_S *ptSrc, AX_IVPS_CHN_FLIP_MODE_E eFlipMode,
  475. AX_IVPS_ROTATION_E eRotation, AX_VIDEO_FRAME_S *ptDst);
  476. AX_S32 AX_IVPS_CSC(const AX_VIDEO_FRAME_S *ptSrc, AX_VIDEO_FRAME_S *ptDst);
  477. AX_S32 AX_IVPS_CropResize(const AX_VIDEO_FRAME_S *ptSrc, AX_VIDEO_FRAME_S *ptDst, const AX_IVPS_ASPECT_RATIO_S *ptAspectRatio);
  478. AX_S32 AX_IVPS_AlphaBlending(const AX_VIDEO_FRAME_S *ptSrc, const AX_VIDEO_FRAME_S *ptOverlay,
  479. const AX_IVPS_POINT_S tOffset, AX_VIDEO_FRAME_S *ptDst);
  480. AX_S32 AX_IVPS_DrawOsd(AX_IVPS_RGN_CANVAS_INFO_S *ptCanvas, const AX_OSD_BMP_ATTR_S arrBmp[], const AX_U32 nNum);
  481. AX_S32 AX_IVPS_DrawLine(const AX_IVPS_RGN_CANVAS_INFO_S *ptCanvas, AX_IVPS_GDI_ATTR_S tAttr, const AX_IVPS_POINT_S tPoint[], AX_U32 nPointNum);
  482. AX_S32 AX_IVPS_DrawPolygon(const AX_IVPS_RGN_CANVAS_INFO_S *ptCanvas, AX_IVPS_GDI_ATTR_S tAttr, const AX_IVPS_POINT_S tPoint[], AX_U32 nPointNum);
  483. AX_S32 AX_IVPS_DrawRect(const AX_IVPS_RGN_CANVAS_INFO_S *ptCanvas, AX_IVPS_GDI_ATTR_S tAttr, AX_IVPS_RECT_S tRect);
  484. /***************************************************************************************************************/
  485. /* GDC */
  486. /***************************************************************************************************************/
  487. /*
  488. * AX_IVPS_DEWARP_ATTR_S
  489. * GDC only support AX_YUV420_SEMIPLANAR format.
  490. * Note: nDstStride should be 64 bytes aligned,
  491. * nDstWidth should be 16 bytes aligned, nDstHeight should be 2 bytes aligned,
  492. * eCompressMode should be set to NONE.
  493. */
  494. typedef struct axIVPS_DEWARP_ATTR_S
  495. {
  496. AX_U16 nDstWidth;
  497. AX_U16 nDstHeight;
  498. AX_U32 nDstStride;
  499. AX_IMG_FORMAT_E eImgFormat;
  500. AX_IVPS_GDC_CFG_S tGdcCfg;
  501. } AX_IVPS_DEWARP_ATTR_S;
  502. AX_S32 AX_IVPS_Dewarp(const AX_VIDEO_FRAME_S *pSrc, AX_VIDEO_FRAME_S *pDst, const AX_IVPS_DEWARP_ATTR_S *ptAttr);
  503. /***************************************************************************************************************/
  504. /* NPU */
  505. /***************************************************************************************************************/
  506. /*!
  507. * Function Description:
  508. *< br / > Realize crop and scaling operation by NPU, and resize the given image to the same shape.
  509. *< br / > The input/output image size, stripe and box coordinates need to be set to an even number.
  510. *\ warning Support NV12/NV21/RGB888/BGR888/BITMAP, Images in input and output formats must be consistent.
  511. *\ warning Supports processing NV12/NV21 images with y and UV separation; Support 4K resolution;
  512. The horizontal or vertical reduction scale shall not be rounded up more than 32.
  513. *\ warning In scenarios with large I/O resolution, hardware restrictions may be triggered. When an error is reported,
  514. detailed parameter information will be printed.
  515. *\ param ptSrc: Source image pointer. It supports configuring the width direction stripe. If it is 0, the default stride is the width size.
  516. *\ param tBox: each subgraph bounding_ Box pointer array. nW and nH are required to be even numbers.
  517. 'tBox[i]' shall not be empty. If tBox[i] is equal to the original image, it means that no crop operation is performed.
  518. *\ param nCropNum: number of subgraphs, nCropNum: 1~16.
  519. *\ param ptDst: Output image pointer array. Multiple results can be output at the same time, but the image format is the same.
  520. The configuration of width direction stripe is supported. If it is 0, the default stripe is the width size.
  521. *\ param ptAspectRatio:
  522. eMode: Only support AX_IVPS_ASPECT_RATIO_STRETCH and AX_IVPS_ASPECT_RATIO_AUTO.
  523. eAligns[0]: Output image horizontal alignment.
  524. eAligns[1]: Output image vertical alignment.
  525. tcolor: Used to fill the border with the specified color. Configuration is not supported temporarily. The default color is black.
  526. */
  527. AX_S32 AX_IVPS_CropResizeNpu(const AX_VIDEO_FRAME_S *ptSrc,const AX_IVPS_BOX_S tBox[], AX_U32 nCropNum,
  528. AX_VIDEO_FRAME_S *ptDst[], const AX_IVPS_ASPECT_RATIO_S *ptAspectRatio);
  529. #ifdef __cplusplus
  530. }
  531. #endif
  532. #endif /* _AX_IVPS_API_H_ */