1 /* 2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef __HI_COMM_VGS_H__ 17 #define __HI_COMM_VGS_H__ 18 19 #include "hi_type.h" 20 #include "hi_common.h" 21 #include "hi_errno.h" 22 #include "hi_comm_video.h" 23 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif 28 #endif /* __cplusplus */ 29 30 /* failure caused by malloc buffer */ 31 #define HI_ERR_VGS_NOBUF HI_DEF_ERR(HI_ID_VGS, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF) 32 #define HI_ERR_VGS_BUF_EMPTY HI_DEF_ERR(HI_ID_VGS, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY) 33 #define HI_ERR_VGS_NULL_PTR HI_DEF_ERR(HI_ID_VGS, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR) 34 #define HI_ERR_VGS_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_VGS, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM) 35 #define HI_ERR_VGS_BUF_FULL HI_DEF_ERR(HI_ID_VGS, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL) 36 #define HI_ERR_VGS_SYS_NOTREADY HI_DEF_ERR(HI_ID_VGS, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY) 37 #define HI_ERR_VGS_NOT_SUPPORT HI_DEF_ERR(HI_ID_VGS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT) 38 #define HI_ERR_VGS_NOT_PERMITTED HI_DEF_ERR(HI_ID_VGS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM) 39 40 #define VGS_PRIVATE_DATA_LEN 6 41 42 typedef HI_S32 VGS_HANDLE; 43 44 typedef enum hiVGS_COLOR_REVERT_MODE_E { 45 VGS_COLOR_REVERT_NONE = 0, /* Not revert */ 46 VGS_COLOR_REVERT_RGB, /* Revert RGB */ 47 VGS_COLOR_REVERT_ALPHA, /* Revert alpha */ 48 VGS_COLOR_REVERT_BOTH, /* Revert RGB and alpha */ 49 VGS_COLOR_REVERT_BUTT 50 } VGS_COLOR_REVERT_MODE_E; 51 52 typedef struct hiVGS_OSD_REVERT_S { 53 RECT_S stSrcRect; /* OSD color revert area */ 54 VGS_COLOR_REVERT_MODE_E enColorRevertMode; /* OSD color revert mode */ 55 } VGS_OSD_REVERT_S; 56 57 typedef struct hiVGS_TASK_ATTR_S { 58 VIDEO_FRAME_INFO_S stImgIn; /* Input picture */ 59 VIDEO_FRAME_INFO_S stImgOut; /* Output picture */ 60 HI_U64 au64PrivateData[4]; /* RW; Private data of task */ 61 HI_U32 reserved; /* RW; Debug information,state of current picture */ 62 } VGS_TASK_ATTR_S; 63 64 typedef struct hiVGS_DRAW_LINE_S { 65 POINT_S stStartPoint; /* Line start point */ 66 POINT_S stEndPoint; /* Line end point */ 67 HI_U32 u32Thick; /* RW; Width of line */ 68 HI_U32 u32Color; /* RW; Range: [0,0xFFFFFF]; Color of line */ 69 } VGS_DRAW_LINE_S; 70 71 typedef enum hiVGS_COVER_TYPE_E { 72 COVER_RECT = 0, /* Retangle cover */ 73 COVER_QUAD_RANGLE, /* Quadrangle cover */ 74 COVER_BUTT 75 } VGS_COVER_TYPE_E; 76 77 typedef struct hiVGS_QUADRANGLE_COVER_S { 78 HI_BOOL bSolid; /* Solid or hollow cover */ 79 HI_U32 u32Thick; /* RW; Range: [2,8]; Thick of the hollow quadrangle */ 80 POINT_S stPoint[4]; /* Four points of the quadrangle */ 81 } VGS_QUADRANGLE_COVER_S; 82 83 typedef struct hiVGS_ADD_COVER_S { 84 VGS_COVER_TYPE_E enCoverType; /* Cover type */ 85 union { 86 RECT_S stDstRect; /* The rectangle area */ 87 VGS_QUADRANGLE_COVER_S stQuadRangle; /* The quadrangle area */ 88 }; 89 90 HI_U32 u32Color; /* RW; Range: [0,0xFFFFFF]; Color of cover */ 91 } VGS_ADD_COVER_S; 92 93 typedef struct hiVGS_ADD_OSD_S { 94 RECT_S stRect; /* Osd area */ 95 HI_U32 u32BgColor; /* RW; Background color of osd, depends on pixel format of osd, 96 ARGB8888:[0,0xFFFFFFFF], ARGB4444:[0,0xFFFF], ARGB1555:[0,0x1FFF] */ 97 PIXEL_FORMAT_E enPixelFmt; /* Pixel format of osd */ 98 HI_U64 u64PhyAddr; /* RW; Physical address of osd */ 99 HI_U32 u32Stride; /* RW; Range: [32,8192]; Stride of osd */ 100 HI_U32 u32BgAlpha; /* RW; Range: [0,255]; Background alpha of osd */ 101 HI_U32 u32FgAlpha; /* RW; Range: [0,255]; Foreground alpha of osd */ 102 HI_BOOL bOsdRevert; /* RW; Enable osd color revert */ 103 VGS_OSD_REVERT_S stOsdRevert; /* Osd color revert information */ 104 HI_U16 u16ColorLUT[2]; 105 } VGS_ADD_OSD_S; 106 107 typedef enum hiVGS_SCLCOEF_MODE_E { 108 VGS_SCLCOEF_NORMAL = 0, /* normal scale coefficient */ 109 VGS_SCLCOEF_TAP2 = 1, /* scale coefficient of 2 tap */ 110 VGS_SCLCOEF_TAP4 = 2, /* scale coefficient of 4 tap */ 111 VGS_SCLCOEF_TAP6 = 3, /* scale coefficient of 6 tap */ 112 VGS_SCLCOEF_TAP8 = 4, /* scale coefficient of 8 tap */ 113 VGS_SCLCOEF_BUTT 114 } VGS_SCLCOEF_MODE_E; 115 116 typedef struct hiVGS_ADD_ONLINE_S { 117 HI_BOOL bCrop; 118 RECT_S stCropOpt; 119 HI_BOOL bCover; 120 VGS_ADD_COVER_S stCoverOpt[VGS_MAX_COVER_NUM]; 121 HI_BOOL bOsd; 122 VGS_ADD_OSD_S stOsdOpt[VGS_MAX_OSD_NUM]; 123 HI_BOOL bMirror; 124 HI_BOOL bFlip; 125 VGS_SCLCOEF_MODE_E enSclCoef; 126 } VGS_ADD_ONLINE_S; 127 128 129 #ifdef __cplusplus 130 #if __cplusplus 131 } 132 #endif 133 #endif /* __cplusplus */ 134 135 #endif /* __HI_COMM_VGS_H__ */ 136