xref: /OK3568_Linux_fs/external/mpp/mpp/inc/mpp_dec_cfg.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2020 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __MPP_DEC_CFG_H__
18 #define __MPP_DEC_CFG_H__
19 
20 #include "mpp_frame.h"
21 #include "rk_vdec_cmd.h"
22 
23 typedef enum MppDecCfgChange_e {
24     MPP_DEC_CFG_CHANGE_TYPE             = (1 << 0),
25     MPP_DEC_CFG_CHANGE_CODING           = (1 << 1),
26     MPP_DEC_CFG_CHANGE_HW_TYPE          = (1 << 2),
27     MPP_DEC_CFG_CHANGE_BATCH_MODE       = (1 << 3),
28 
29     MPP_DEC_CFG_CHANGE_OUTPUT_FORMAT    = (1 << 8),
30     MPP_DEC_CFG_CHANGE_FAST_OUT         = (1 << 9),
31     MPP_DEC_CFG_CHANGE_FAST_PARSE       = (1 << 10),
32     MPP_DEC_CFG_CHANGE_SPLIT_PARSE      = (1 << 11),
33     MPP_DEC_CFG_CHANGE_INTERNAL_PTS     = (1 << 12),
34     MPP_DEC_CFG_CHANGE_SORT_PTS         = (1 << 13),
35     MPP_DEC_CFG_CHANGE_DISABLE_ERROR    = (1 << 14),
36     MPP_DEC_CFG_CHANGE_ENABLE_VPROC     = (1 << 15),
37     MPP_DEC_CFG_CHANGE_ENABLE_FAST_PLAY = (1 << 16),
38     MPP_DEC_CFG_CHANGE_ENABLE_HDR_META  = (1 << 17),
39     MPP_DEC_CFG_CHANGE_ENABLE_THUMBNAIL = (1 << 18),
40     MPP_DEC_CFG_CHANGE_ENABLE_MVC       = (1 << 19),
41     /* reserve high bit for global config */
42     MPP_DEC_CFG_CHANGE_DISABLE_THREAD   = (1 << 28),
43 
44     MPP_DEC_CFG_CHANGE_ALL              = (0xFFFFFFFF),
45 } MppDecCfgChange;
46 
47 typedef enum MppVprocMode_e {
48     MPP_VPROC_MODE_DEINTELACE           = (1 << 0),
49     MPP_VPROC_MODE_DETECTION            = (1 << 1),
50     MPP_VPROC_MODE_ALL                  = (0xFFFFFFFF),
51 } MppVprocMode;
52 
53 typedef enum FastPlayMode_e {
54     MPP_DISABLE_FAST_PLAY,
55     MPP_ENABLE_FAST_PLAY,
56     // first gop fast play when poc include negative value, otherwise enable fast play all time
57     MPP_ENABLE_FAST_PLAY_ONCE,
58 } FastPlayMode;
59 
60 typedef struct MppDecBaseCfg_t {
61     RK_U64              change;
62 
63     MppCtxType          type;
64     MppCodingType       coding;
65     RK_S32              hw_type;
66     RK_U32              batch_mode;
67 
68     MppFrameFormat      out_fmt;
69     RK_U32              fast_out;
70     RK_U32              fast_parse;
71     RK_U32              split_parse;
72     RK_U32              internal_pts;
73     RK_U32              sort_pts;
74     RK_U32              disable_error;
75     RK_U32              enable_vproc;   /* MppVprocMode */
76     RK_U32              enable_fast_play;
77     RK_U32              enable_hdr_meta;
78     RK_U32              enable_thumbnail;
79     RK_U32              enable_mvc;
80     RK_U32              disable_thread;
81 } MppDecBaseCfg;
82 
83 typedef enum MppDecCbCfgChange_e {
84     MPP_DEC_CB_CFG_CHANGE_PKT_RDY       = (1 << 0),
85     MPP_DEC_CB_CFG_CHANGE_FRM_RDY       = (1 << 1),
86 
87     MPP_DEC_CB_CFG_CHANGE_ALL           = (0xFFFFFFFF),
88 } MppDecCbCfgChange;
89 
90 typedef struct MppDecCbCfg_t {
91     RK_U64              change;
92 
93     /* notify packet process done and can accept new packet */
94     MppExtCbFunc        pkt_rdy_cb;
95     MppExtCbCtx         pkt_rdy_ctx;
96     RK_S32              pkt_rdy_cmd;
97 
98     /* notify frame ready for output */
99     MppExtCbFunc        frm_rdy_cb;
100     MppExtCbCtx         frm_rdy_ctx;
101     RK_S32              frm_rdy_cmd;
102 } MppDecCbCfg;
103 
104 typedef struct MppDecStatusCfg_t {
105     RK_U32              hal_support_fast_mode;
106     RK_U32              hal_task_count;
107     RK_U32              vproc_task_count;
108 } MppDecStatusCfg;
109 
110 typedef struct MppDecCfgSet_t {
111     MppDecBaseCfg       base;
112     MppDecStatusCfg     status;
113     MppDecCbCfg         cb;
114 } MppDecCfgSet;
115 
116 #endif /* __MPP_DEC_CFG_H__ */
117