11bd4fe43Sopenharmony_ci/*
21bd4fe43Sopenharmony_ci * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
31bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
41bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License.
51bd4fe43Sopenharmony_ci * You may obtain a copy of the License at
61bd4fe43Sopenharmony_ci *
71bd4fe43Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
81bd4fe43Sopenharmony_ci *
91bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
101bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
111bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
121bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and
131bd4fe43Sopenharmony_ci * limitations under the License.
141bd4fe43Sopenharmony_ci */
151bd4fe43Sopenharmony_ci#ifndef __HI_COMM_DIS_H__
161bd4fe43Sopenharmony_ci#define __HI_COMM_DIS_H__
171bd4fe43Sopenharmony_ci
181bd4fe43Sopenharmony_ci#include "hi_type.h"
191bd4fe43Sopenharmony_ci#include "hi_common.h"
201bd4fe43Sopenharmony_ci#include "hi_errno.h"
211bd4fe43Sopenharmony_ci#include "hi_comm_video.h"
221bd4fe43Sopenharmony_ci
231bd4fe43Sopenharmony_ci#ifdef __cplusplus
241bd4fe43Sopenharmony_ci#if __cplusplus
251bd4fe43Sopenharmony_ciextern "C" {
261bd4fe43Sopenharmony_ci#endif
271bd4fe43Sopenharmony_ci#endif /* __cplusplus */
281bd4fe43Sopenharmony_ci
291bd4fe43Sopenharmony_ci/* failure caused by malloc buffer */
301bd4fe43Sopenharmony_ci#define HI_ERR_DIS_NOBUF         HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
311bd4fe43Sopenharmony_ci#define HI_ERR_DIS_BUF_EMPTY     HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
321bd4fe43Sopenharmony_ci#define HI_ERR_DIS_NULL_PTR      HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
331bd4fe43Sopenharmony_ci#define HI_ERR_DIS_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
341bd4fe43Sopenharmony_ci#define HI_ERR_DIS_BUF_FULL      HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
351bd4fe43Sopenharmony_ci#define HI_ERR_DIS_SYS_NOTREADY  HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
361bd4fe43Sopenharmony_ci#define HI_ERR_DIS_NOT_SUPPORT   HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
371bd4fe43Sopenharmony_ci#define HI_ERR_DIS_NOT_PERMITTED HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
381bd4fe43Sopenharmony_ci#define HI_ERR_DIS_BUSY          HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
391bd4fe43Sopenharmony_ci#define HI_ERR_DIS_INVALID_CHNID HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
401bd4fe43Sopenharmony_ci#define HI_ERR_DIS_CHN_UNEXIST   HI_DEF_ERR(HI_ID_DIS, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
411bd4fe43Sopenharmony_ci
421bd4fe43Sopenharmony_ci/* Different mode of DIS */
431bd4fe43Sopenharmony_citypedef enum hiDIS_MODE_E {
441bd4fe43Sopenharmony_ci    DIS_MODE_4_DOF_GME = 0, /* Only use with GME in 4 dof  */
451bd4fe43Sopenharmony_ci    DIS_MODE_6_DOF_GME,     /* Only use with GME in 6 dof  */
461bd4fe43Sopenharmony_ci    DIS_MODE_GYRO,          /* Only use with gryo in 6 dof  */
471bd4fe43Sopenharmony_ci    DIS_MODE_DOF_BUTT,
481bd4fe43Sopenharmony_ci} DIS_MODE_E;
491bd4fe43Sopenharmony_ci
501bd4fe43Sopenharmony_ci/* The motion level of camera */
511bd4fe43Sopenharmony_citypedef enum hiDIS_MOTION_LEVEL_E {
521bd4fe43Sopenharmony_ci    DIS_MOTION_LEVEL_LOW = 0,   /* Low motion level */
531bd4fe43Sopenharmony_ci    DIS_MOTION_LEVEL_NORMAL,    /* Normal motion level */
541bd4fe43Sopenharmony_ci    DIS_MOTION_LEVEL_HIGH,      /* High motion level */
551bd4fe43Sopenharmony_ci    DIS_MOTION_LEVEL_BUTT
561bd4fe43Sopenharmony_ci} DIS_MOTION_LEVEL_E;
571bd4fe43Sopenharmony_ci
581bd4fe43Sopenharmony_ci/* Different product type used DIS */
591bd4fe43Sopenharmony_citypedef enum hiDIS_PDT_TYPE_E {
601bd4fe43Sopenharmony_ci    DIS_PDT_TYPE_IPC = 0,   /* IPC product type */
611bd4fe43Sopenharmony_ci    DIS_PDT_TYPE_DV,        /* DV product type */
621bd4fe43Sopenharmony_ci    DIS_PDT_TYPE_DRONE,     /* DRONE product type */
631bd4fe43Sopenharmony_ci    DIS_PDT_TYPE_BUTT
641bd4fe43Sopenharmony_ci} DIS_PDT_TYPE_E;
651bd4fe43Sopenharmony_ci
661bd4fe43Sopenharmony_ci/* The Attribute of DIS */
671bd4fe43Sopenharmony_citypedef struct hiDIS_ATTR_S {
681bd4fe43Sopenharmony_ci    HI_BOOL bEnable;    /* RW; DIS enable */
691bd4fe43Sopenharmony_ci    HI_BOOL bGdcBypass; /* RW; gdc correction process , DIS = GME&GDC correction */
701bd4fe43Sopenharmony_ci    HI_U32 u32MovingSubjectLevel; /* RW; Range:[0,6]; Moving Subject level */
711bd4fe43Sopenharmony_ci    HI_S32 s32RollingShutterCoef; /* RW; Range:[0,1000]; Rolling shutter coefficients */
721bd4fe43Sopenharmony_ci    HI_S32 s32Timelag;      /* RW; Range:[-2000000,2000000]; Timestamp delay between Gyro and Frame PTS */
731bd4fe43Sopenharmony_ci    HI_U32 u32ViewAngle;    /* Reserved */
741bd4fe43Sopenharmony_ci    HI_U32 u32HorizontalLimit;  /* RW; Range:[0,1000]; Parameter to limit horizontal drift by large foreground */
751bd4fe43Sopenharmony_ci    HI_U32 u32VerticalLimit;    /* RW; Range:[0,1000]; Parameter to limit vertical drift by large foreground */
761bd4fe43Sopenharmony_ci    HI_BOOL bStillCrop;         /* RW; The stabilization will be not working ,but the output image still be cropped */
771bd4fe43Sopenharmony_ci    HI_U32  u32Strength;        /* RW. Range:[0,1024]; The DIS strength for different light, Only valid for MODE_GYRO */
781bd4fe43Sopenharmony_ci} DIS_ATTR_S;
791bd4fe43Sopenharmony_ci
801bd4fe43Sopenharmony_ci/* The Config of DIS */
811bd4fe43Sopenharmony_citypedef struct hiDIS_CONFIG_S {
821bd4fe43Sopenharmony_ci    DIS_MODE_E enMode;                /* RW; DIS Mode */
831bd4fe43Sopenharmony_ci    DIS_MOTION_LEVEL_E enMotionLevel; /* RW; DIS Motion level of the camera */
841bd4fe43Sopenharmony_ci    DIS_PDT_TYPE_E enPdtType;         /* RW; DIS product type */
851bd4fe43Sopenharmony_ci    HI_U32 u32BufNum;                 /* RW; Range:[5,10]; Buf num for DIS */
861bd4fe43Sopenharmony_ci    HI_U32 u32CropRatio;              /* RW; Range:[50,98]; Crop ratio of output image */
871bd4fe43Sopenharmony_ci    HI_U32 u32FrameRate;       /* RW; Range: Hi3559AV100 = (0, 120] | Hi3519AV100 = (0, 120] | Hi3516CV500 = (0, 60] |
881bd4fe43Sopenharmony_ci                                  Hi3516DV300 = (0, 60] | Hi3559V200 = (0, 60] | Hi3556V200 = (0, 60] . */
891bd4fe43Sopenharmony_ci    HI_U32 u32GyroOutputRange; /* Reserved */
901bd4fe43Sopenharmony_ci    HI_U32 u32GyroDataBitWidth; /* Reserved */
911bd4fe43Sopenharmony_ci    HI_BOOL bCameraSteady;      /* RW; The camera is steady or not */
921bd4fe43Sopenharmony_ci    HI_BOOL bScale;             /* RW; Scale output image or not */
931bd4fe43Sopenharmony_ci} DIS_CONFIG_S;
941bd4fe43Sopenharmony_ci
951bd4fe43Sopenharmony_citypedef struct hiDIS_PARAM_S {
961bd4fe43Sopenharmony_ci    /*
971bd4fe43Sopenharmony_ci     * RW; [0,100],
981bd4fe43Sopenharmony_ci     * 0: attenuate large motion most in advance,
991bd4fe43Sopenharmony_ci     * 100: never attenuate large motion;
1001bd4fe43Sopenharmony_ci     * larger value -> better stability but more likely to crop to the border with large motion
1011bd4fe43Sopenharmony_ci     */
1021bd4fe43Sopenharmony_ci    HI_U32 u32LargeMotionStableCoef;
1031bd4fe43Sopenharmony_ci    /*
1041bd4fe43Sopenharmony_ci     * RW; [0,100],
1051bd4fe43Sopenharmony_ci     * 0: never preserve the low frequency motion,
1061bd4fe43Sopenharmony_ci     * 100: keep all the low frequency motion;
1071bd4fe43Sopenharmony_ci     * small value -> better stability but more likely to crop to the border even with low level motion
1081bd4fe43Sopenharmony_ci     */
1091bd4fe43Sopenharmony_ci    HI_U32 u32LowFreqMotionPreserve;
1101bd4fe43Sopenharmony_ci    /*
1111bd4fe43Sopenharmony_ci     * RW; [0,100],
1121bd4fe43Sopenharmony_ci     * 0: lowest cut frequency,
1131bd4fe43Sopenharmony_ci     * 100: highest cut frequency;
1141bd4fe43Sopenharmony_ci     * small value -> better stability but more likely to crop to the border even with large motion
1151bd4fe43Sopenharmony_ci     */
1161bd4fe43Sopenharmony_ci    HI_U32 u32LowFreqMotionFreq;
1171bd4fe43Sopenharmony_ci} DIS_PARAM_S;
1181bd4fe43Sopenharmony_ci
1191bd4fe43Sopenharmony_ci#ifdef __cplusplus
1201bd4fe43Sopenharmony_ci#if __cplusplus
1211bd4fe43Sopenharmony_ci}
1221bd4fe43Sopenharmony_ci#endif
1231bd4fe43Sopenharmony_ci#endif /* __cplusplus */
1241bd4fe43Sopenharmony_ci
1251bd4fe43Sopenharmony_ci#endif /* __HI_COMM_DIS_H__ */
126