• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef __HI_COMM_DIS_H__
16 #define __HI_COMM_DIS_H__
17 
18 #include "hi_type.h"
19 #include "hi_common.h"
20 #include "hi_errno.h"
21 #include "hi_comm_video.h"
22 
23 #ifdef __cplusplus
24 #if __cplusplus
25 extern "C" {
26 #endif
27 #endif /* __cplusplus */
28 
29 /* failure caused by malloc buffer */
30 #define HI_ERR_DIS_NOBUF         HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
31 #define HI_ERR_DIS_BUF_EMPTY     HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
32 #define HI_ERR_DIS_NULL_PTR      HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
33 #define HI_ERR_DIS_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
34 #define HI_ERR_DIS_BUF_FULL      HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
35 #define HI_ERR_DIS_SYS_NOTREADY  HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
36 #define HI_ERR_DIS_NOT_SUPPORT   HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
37 #define HI_ERR_DIS_NOT_PERMITTED HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
38 #define HI_ERR_DIS_BUSY          HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
39 #define HI_ERR_DIS_INVALID_CHNID HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
40 #define HI_ERR_DIS_CHN_UNEXIST   HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
41 
42 /* Different mode of DIS */
43 typedef enum hiDIS_MODE_E {
44     DIS_MODE_4_DOF_GME = 0, /* Only use with GME in 4 dof  */
45     DIS_MODE_6_DOF_GME,     /* Only use with GME in 6 dof  */
46     DIS_MODE_GYRO,          /* Only use with gryo in 6 dof  */
47     DIS_MODE_DOF_BUTT,
48 } DIS_MODE_E;
49 
50 /* The motion level of camera */
51 typedef enum hiDIS_MOTION_LEVEL_E {
52     DIS_MOTION_LEVEL_LOW = 0,   /* Low motion level */
53     DIS_MOTION_LEVEL_NORMAL,    /* Normal motion level */
54     DIS_MOTION_LEVEL_HIGH,      /* High motion level */
55     DIS_MOTION_LEVEL_BUTT
56 } DIS_MOTION_LEVEL_E;
57 
58 /* Different product type used DIS */
59 typedef enum hiDIS_PDT_TYPE_E {
60     DIS_PDT_TYPE_IPC = 0,   /* IPC product type */
61     DIS_PDT_TYPE_DV,        /* DV product type */
62     DIS_PDT_TYPE_DRONE,     /* DRONE product type */
63     DIS_PDT_TYPE_BUTT
64 } DIS_PDT_TYPE_E;
65 
66 /* The Attribute of DIS */
67 typedef struct hiDIS_ATTR_S {
68     HI_BOOL bEnable;    /* RW; DIS enable */
69     HI_BOOL bGdcBypass; /* RW; gdc correction process , DIS = GME&GDC correction */
70     HI_U32 u32MovingSubjectLevel; /* RW; Range:[0,6]; Moving Subject level */
71     HI_S32 s32RollingShutterCoef; /* RW; Range:[0,1000]; Rolling shutter coefficients */
72     HI_S32 s32Timelag;      /* RW; Range:[-2000000,2000000]; Timestamp delay between Gyro and Frame PTS */
73     HI_U32 u32ViewAngle;    /* Reserved */
74     HI_U32 u32HorizontalLimit;  /* RW; Range:[0,1000]; Parameter to limit horizontal drift by large foreground */
75     HI_U32 u32VerticalLimit;    /* RW; Range:[0,1000]; Parameter to limit vertical drift by large foreground */
76     HI_BOOL bStillCrop;         /* RW; The stabilization will be not working ,but the output image still be cropped */
77     HI_U32  u32Strength;        /* RW. Range:[0,1024]; The DIS strength for different light, Only valid for MODE_GYRO */
78 } DIS_ATTR_S;
79 
80 /* The Config of DIS */
81 typedef struct hiDIS_CONFIG_S {
82     DIS_MODE_E enMode;                /* RW; DIS Mode */
83     DIS_MOTION_LEVEL_E enMotionLevel; /* RW; DIS Motion level of the camera */
84     DIS_PDT_TYPE_E enPdtType;         /* RW; DIS product type */
85     HI_U32 u32BufNum;                 /* RW; Range:[5,10]; Buf num for DIS */
86     HI_U32 u32CropRatio;              /* RW; Range:[50,98]; Crop ratio of output image */
87     HI_U32 u32FrameRate;       /* RW; Range: Hi3559AV100 = (0, 120] | Hi3519AV100 = (0, 120] | Hi3516CV500 = (0, 60] |
88                                   Hi3516DV300 = (0, 60] | Hi3559V200 = (0, 60] | Hi3556V200 = (0, 60] . */
89     HI_U32 u32GyroOutputRange; /* Reserved */
90     HI_U32 u32GyroDataBitWidth; /* Reserved */
91     HI_BOOL bCameraSteady;      /* RW; The camera is steady or not */
92     HI_BOOL bScale;             /* RW; Scale output image or not */
93 } DIS_CONFIG_S;
94 
95 typedef struct hiDIS_PARAM_S {
96     /*
97      * RW; [0,100],
98      * 0: attenuate large motion most in advance,
99      * 100: never attenuate large motion;
100      * larger value -> better stability but more likely to crop to the border with large motion
101      */
102     HI_U32 u32LargeMotionStableCoef;
103     /*
104      * RW; [0,100],
105      * 0: never preserve the low frequency motion,
106      * 100: keep all the low frequency motion;
107      * small value -> better stability but more likely to crop to the border even with low level motion
108      */
109     HI_U32 u32LowFreqMotionPreserve;
110     /*
111      * RW; [0,100],
112      * 0: lowest cut frequency,
113      * 100: highest cut frequency;
114      * small value -> better stability but more likely to crop to the border even with large motion
115      */
116     HI_U32 u32LowFreqMotionFreq;
117 } DIS_PARAM_S;
118 
119 #ifdef __cplusplus
120 #if __cplusplus
121 }
122 #endif
123 #endif /* __cplusplus */
124 
125 #endif /* __HI_COMM_DIS_H__ */
126