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_VO_H__
17#define __HI_COMM_VO_H__
18
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_vo_dev.h"
24
25#ifdef __cplusplus
26#if __cplusplus
27extern "C" {
28#endif
29#endif /* End of #ifdef __cplusplus */
30
31typedef enum hiVO_ZOOM_IN_E {
32    VO_ZOOM_IN_RECT = 0, /* Zoom in by rect */
33    VO_ZOOM_IN_RATIO, /* Zoom in by ratio */
34    VO_ZOOM_IN_BUTT
35} VO_ZOOM_IN_E;
36
37typedef struct hiVO_CHN_ATTR_S {
38    HI_U32 u32Priority; /* Video out overlay pri sd */
39    RECT_S stRect; /* Rectangle of video output channel */
40    HI_BOOL bDeflicker; /* Deflicker or not sd */
41} VO_CHN_ATTR_S;
42
43typedef struct hiVO_CHN_PARAM_S {
44    ASPECT_RATIO_S stAspectRatio; /* RW; aspect ratio */
45} VO_CHN_PARAM_S;
46
47typedef struct hiVO_BORDER_S {
48    HI_BOOL bBorderEn; /* RW; Do frame or not */
49    BORDER_S stBorder; /* RW; frame's top, bottom, left, right width and color */
50} VO_BORDER_S;
51
52typedef struct hiVO_QUERY_STATUS_S {
53    HI_U32 u32ChnBufUsed; /* Channel buffer that been occupied */
54} VO_QUERY_STATUS_S;
55
56typedef struct hiVO_WBC_ATTR_S {
57    SIZE_S stTargetSize; /* RW; WBC Zoom target size */
58    PIXEL_FORMAT_E enPixelFormat; /* RW; the pixel format of WBC output */
59    HI_U32 u32FrameRate; /* RW; frame rate control */
60    DYNAMIC_RANGE_E enDynamicRange; /* RW; Write back dynamic range type */
61    COMPRESS_MODE_E enCompressMode; /* RW; Write back Compressing mode */
62} VO_WBC_ATTR_S;
63
64typedef enum hiVO_WBC_MODE_E {
65    VO_WBC_MODE_NORMAL = 0, /* In this mode, wbc will capture frames according to dev frame rate
66                                and wbc frame rate */
67    VO_WBC_MODE_DROP_REPEAT, /* In this mode, wbc will drop dev repeat frame, and capture the real frame
68                                according to video layer's display rate and wbc frame rate */
69    VO_WBC_MODE_PROG_TO_INTL, /* In this mode, wbc will drop dev repeat frame which repeats more than 3 times,
70                                and change two progressive frames to one interlace frame */
71    VO_WBC_MODE_BUTT,
72} VO_WBC_MODE_E;
73
74typedef enum hiVO_WBC_SOURCE_TYPE_E {
75    VO_WBC_SOURCE_DEV = 0x0, /* WBC source is device */
76    VO_WBC_SOURCE_VIDEO = 0x1, /* WBC source is video layer */
77    VO_WBC_SOURCE_GRAPHIC = 0x2, /* WBC source is graphic layer. Warning: not supported */
78    VO_WBC_SOURCE_BUTT
79} VO_WBC_SOURCE_TYPE_E;
80
81typedef struct hiVO_WBC_SOURCE_S {
82    VO_WBC_SOURCE_TYPE_E enSourceType; /* RW; WBC source's type */
83    HI_U32 u32SourceId; /* RW; WBC source's ID */
84} VO_WBC_SOURCE_S;
85
86typedef enum hiVO_PART_MODE_E {
87    VO_PART_MODE_SINGLE = 0, /* single partition, which use software to make multi-picture in one hardware cell */
88    VO_PART_MODE_MULTI = 1, /* muliti partition, each partition is a hardware cell */
89    VO_PART_MODE_BUTT
90} VO_PART_MODE_E;
91
92typedef struct hiVO_VIDEO_LAYER_ATTR_S {
93    RECT_S stDispRect; /* RW; Display resolution */
94    SIZE_S stImageSize; /* RW; Canvas size of the video layer */
95    HI_U32 u32DispFrmRt; /* RW; Display frame rate */
96    PIXEL_FORMAT_E enPixFormat; /* RW; Pixel format of the video layer */
97    HI_BOOL bDoubleFrame; /* RW; Whether to double frames */
98    HI_BOOL bClusterMode; /* RW; Whether to take Cluster way to use memory */
99    DYNAMIC_RANGE_E enDstDynamicRange; /* RW; Video Layer output dynamic range type */
100} VO_VIDEO_LAYER_ATTR_S;
101
102typedef struct hiVO_LAYER_PARAM_S {
103    ASPECT_RATIO_S stAspectRatio; /* RW; aspect ratio */
104} VO_LAYER_PARAM_S;
105
106typedef struct hiVO_ZOOM_RATIO_S {
107    HI_U32 u32XRatio; /* RW; Range: [0, 1000]; XRatio = x * 1000 / W,
108                              x means the start point to be zoomed, W means displaying channel's width. */
109    HI_U32 u32YRatio; /* RW; Range: [0, 1000]; YRatio = y * 1000 / H,
110                              y means the start point to be zoomed, H means displaying channel's height. */
111    HI_U32 u32WRatio; /* RW; Range: [0, 1000]; WRatio = w * 1000 / W,
112                              w means the width to be zoomed, W means displaying channel's width. */
113    HI_U32 u32HRatio; /* RW; Range: [0, 1000]; HRatio = h * 1000 / H,
114                              h means the height to be zoomed, H means displaying channel's height. */
115} VO_ZOOM_RATIO_S;
116
117typedef struct hiVO_ZOOM_ATTR_S {
118    VO_ZOOM_IN_E enZoomType; /* choose the type of zoom in */
119    union {
120        RECT_S stZoomRect; /* zoom in by rect */
121        VO_ZOOM_RATIO_S stZoomRatio; /* zoom in by ratio */
122    };
123} VO_ZOOM_ATTR_S;
124
125typedef struct hiVO_REGION_INFO_S {
126    HI_U32 u32RegionNum; /* count of the region */
127    RECT_S *ATTRIBUTE pstRegion; /* region attribute */
128} VO_REGION_INFO_S;
129
130typedef struct hiVO_LAYER_BOUNDARY_S {
131    HI_U32 u32Width;
132    HI_U32 u32Color[2]; /* RW; 2 color indexes */
133} VO_LAYER_BOUNDARY_S;
134
135typedef struct hiVO_CHN_BOUNDARY_S {
136    HI_BOOL bBoundaryEn; /* RW; do Frame or not */
137    HI_U32 u32ColorIndex; /* RW; the index of Frame color,{0,1} */
138} VO_CHN_BOUNDARY_S;
139
140typedef enum hiVO_MIRROR_MODE_E {
141    VO_MIRROR_NONE = 0, /* Mirror mode is none */
142    VO_MIRROR_HOR,      /* Mirror mode is horizontal mirror */
143    VO_MIRROR_BUTT
144} VO_MIRROR_MODE_E;
145
146#ifdef __cplusplus
147#if __cplusplus
148}
149#endif
150#endif /* End of #ifdef __cplusplus */
151
152#endif /* End of #ifndef __HI_COMM_VO_H__ */
153