xref: /OK3568_Linux_fs/external/rockit/mpi/sdk/include/rk_comm_vpss.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* GPL-2.0 WITH Linux-syscall-note OR Apache 2.0 */
2 /* Copyright (c) 2021 Fuzhou Rockchip Electronics Co., Ltd */
3 
4 #ifndef INCLUDE_RT_MPI_RK_COMMON_VPSS_H_
5 #define INCLUDE_RT_MPI_RK_COMMON_VPSS_H_
6 
7 
8 #include "rk_type.h"
9 #include "rk_common.h"
10 #include "rk_errno.h"
11 #include "rk_comm_video.h"
12 
13 #ifdef __cplusplus
14 #if __cplusplus
15 extern "C" {
16 #endif
17 #endif /* __cplusplus */
18 
19 #define RK_VPSS_OK                   RK_SUCCESS
20 #define RK_ERR_VPSS_NULL_PTR         RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_NULL_PTR)
21 #define RK_ERR_VPSS_NOTREADY         RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_NOTREADY)
22 #define RK_ERR_VPSS_INVALID_DEVID    RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_INVALID_DEVID)
23 #define RK_ERR_VPSS_INVALID_CHNID    RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_INVALID_CHNID)
24 #define RK_ERR_VPSS_EXIST            RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_EXIST)
25 #define RK_ERR_VPSS_UNEXIST          RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_UNEXIST)
26 #define RK_ERR_VPSS_NOT_SUPPORT      RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_NOT_SUPPORT)
27 #define RK_ERR_VPSS_NOT_PERM         RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_NOT_PERM)
28 #define RK_ERR_VPSS_NOMEM            RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_NOMEM)
29 #define RK_ERR_VPSS_NOBUF            RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_NOBUF)
30 #define RK_ERR_VPSS_SIZE_NOT_ENOUGH  RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_SIZE_NOT_ENOUGH)
31 #define RK_ERR_VPSS_ILLEGAL_PARAM    RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_ILLEGAL_PARAM)
32 #define RK_ERR_VPSS_BUSY             RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_BUSY)
33 #define RK_ERR_VPSS_BUF_EMPTY        RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_BUF_EMPTY)
34 #define RK_ERR_VPSS_BUF_FULL         RK_DEF_ERR(RK_ID_VPSS, RK_ERR_LEVEL_ERROR, RK_ERR_BUF_FULL)
35 
36 #define VPSS_INVALID_FRMRATE         -1
37 #define VPSS_CHN0                    0
38 #define VPSS_CHN1                    1
39 #define VPSS_CHN2                    2
40 #define VPSS_CHN3                    3
41 #define VPSS_INVALID_CHN             -1
42 
43 typedef struct rkVPSS_MOD_PARAM_S {
44     MB_SOURCE_E enVpssMBSource;
45 } VPSS_MOD_PARAM_S;
46 
47 typedef struct rkVPSS_GRP_ATTR_S {
48     RK_U32                     u32MaxW;           /* RW; Range: [64, 16384]; Width of source image. */
49     RK_U32                     u32MaxH;           /* RW; Range: [64, 16384]; Height of source image. */
50     PIXEL_FORMAT_E             enPixelFormat;     /* RW; Pixel format of source image. */
51     DYNAMIC_RANGE_E            enDynamicRange;    /* RW; DynamicRange of source image. */
52     FRAME_RATE_CTRL_S          stFrameRate;       /* Grp frame rate contrl. */
53     COMPRESS_MODE_E            enCompressMode;    /* RW; Reference frame compress mode */
54     RK_U32                     u32MaxQueue;       /* RW; Grp Max input queue length */
55 } VPSS_GRP_ATTR_S;
56 
57 typedef enum rkVPSS_CHN_MODE_E {
58     VPSS_CHN_MODE_USER  = 0,       /* User mode. */
59     VPSS_CHN_MODE_AUTO  = 1,       /* Auto mode. */
60     VPSS_CHN_MODE_PASSTHROUGH = 2, /* Pass through mode */
61     VPSS_CHN_MODE_BUTT
62 } VPSS_CHN_MODE_E;
63 
64 typedef struct rkVPSS_CHN_ATTR_S {
65     VPSS_CHN_MODE_E     enChnMode;          /* RW; Vpss channel's work mode. */
66     RK_U32              u32Width;           /* RW; Range: [64, 16384]; Width of target image. */
67     RK_U32              u32Height;          /* RW; Range: [64, 16384]; Height of target image. */
68     VIDEO_FORMAT_E      enVideoFormat;      /* RW; Video format of target image. */
69     PIXEL_FORMAT_E      enPixelFormat;      /* RW; Pixel format of target image. */
70     DYNAMIC_RANGE_E     enDynamicRange;     /* RW; DynamicRange of target image. */
71     COMPRESS_MODE_E     enCompressMode;     /* RW; Compression mode of the output. */
72     FRAME_RATE_CTRL_S   stFrameRate;        /* Frame rate control info */
73     RK_BOOL             bMirror;            /* RW; Mirror enable. */
74     RK_BOOL             bFlip;              /* RW; Flip enable. */
75     RK_U32              u32Depth;           /* RW; Range: [0, 8]; User get list depth. */
76     ASPECT_RATIO_S      stAspectRatio;      /* Aspect Ratio info. */
77     RK_U32              u32FrameBufCnt;     /* RW; frame buffer cnt only used by MB_SOURCE_PRIVATE */
78 } VPSS_CHN_ATTR_S;
79 
80 typedef enum rkVPSS_CROP_COORDINATE_E {
81     VPSS_CROP_RATIO_COOR = 0,   /* Ratio coordinate. */
82     VPSS_CROP_ABS_COOR          /* Absolute coordinate. */
83 } VPSS_CROP_COORDINATE_E;
84 
85 typedef struct rkVPSS_CROP_INFO_S {
86     RK_BOOL                 bEnable;            /* RW; Range: [0, 1];  CROP enable. */
87     VPSS_CROP_COORDINATE_E  enCropCoordinate;   /* RW; Range: [0, 1]; Coordinate mode of the crop start point. */
88     RECT_S                  stCropRect;         /* CROP rectangular. */
89 } VPSS_CROP_INFO_S;
90 
91 typedef struct rkVPSS_ROTATION_EX_ATTR_S {
92     RK_BOOL       bEnable;                      /* Whether ROTATE_EX_S is enbale */
93     ROTATION_EX_S stRotationEx;                 /* Rotate Attribute */
94 } VPSS_ROTATION_EX_ATTR_S;
95 
96 #ifdef __cplusplus
97 #if __cplusplus
98 }
99 #endif
100 #endif /* __cplusplus */
101 
102 #endif /* INCLUDE_RT_MPI_RK_COMMON_VPSS_H_ */
103 
104 
105