xref: /rockchip-linux_mpp/mpp/vproc/inc/iep2_api.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
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 __IEP2_API_H__
18 #define __IEP2_API_H__
19 
20 #include <stdint.h>
21 #include <stdbool.h>
22 
23 #include "iep_common.h"
24 
25 enum IEP2_FIELD_ORDER {
26     IEP2_FIELD_ORDER_TFF,
27     IEP2_FIELD_ORDER_BFF,
28     IEP2_FIELD_ORDER_UND
29 };
30 
31 enum IEP2_FF_MODE {
32     IEP2_FF_MODE_FRAME,
33     IEP2_FF_MODE_FIELD,
34     IEP2_FF_MODE_UND
35 };
36 
37 enum IEP2_FMT {
38     IEP2_FMT_YUV422 = 2,
39     IEP2_FMT_YUV420
40 };
41 
42 enum IEP2_YUV_SWAP {
43     IEP2_YUV_SWAP_SP_UV,
44     IEP2_YUV_SWAP_SP_VU,
45     IEP2_YUV_SWAP_P0,
46     IEP2_YUV_SWAP_P
47 };
48 
49 enum IEP2_DIL_MODE {
50     IEP2_DIL_MODE_DISABLE,
51     IEP2_DIL_MODE_I5O2,
52     IEP2_DIL_MODE_I5O1T,
53     IEP2_DIL_MODE_I5O1B,
54     IEP2_DIL_MODE_I2O2,
55     IEP2_DIL_MODE_I1O1T,
56     IEP2_DIL_MODE_I1O1B,
57     IEP2_DIL_MODE_PD,
58     IEP2_DIL_MODE_BYPASS,
59     IEP2_DIL_MODE_DECT
60 };
61 
62 enum IEP2_OUT_MODE {
63     IEP2_OUT_MODE_LINE,
64     IEP2_OUT_MODE_TILE
65 };
66 
67 enum IEP2_PARAM_TYPE {
68     IEP2_PARAM_TYPE_COM,
69     IEP2_PARAM_TYPE_MODE,
70     IEP2_PARAM_TYPE_MD,
71     IEP2_PARAM_TYPE_DECT,
72     IEP2_PARAM_TYPE_OSD,
73     IEP2_PARAM_TYPE_ME,
74     IEP2_PARAM_TYPE_EEDI,
75     IEP2_PARAM_TYPE_BLE,
76     IEP2_PARAM_TYPE_COMB,
77     IEP2_PARAM_TYPE_ROI
78 };
79 
80 // Pulldown compose flag
81 enum PD_COMP_FLAG {
82     PD_COMP_FLAG_CC,
83     PD_COMP_FLAG_CN,
84     PD_COMP_FLAG_NC,
85     PD_COMP_FLAG_NON
86 };
87 
88 enum PD_TYPES {
89     PD_TYPES_3_2_3_2,
90     PD_TYPES_2_3_2_3,
91     PD_TYPES_2_3_3_2,
92     PD_TYPES_3_2_2_3,
93     PD_TYPES_UNKNOWN
94 };
95 
96 union iep2_api_content {
97     struct {
98         enum IEP2_FMT sfmt;
99         enum IEP2_YUV_SWAP sswap;
100         enum IEP2_FMT dfmt;
101         enum IEP2_YUV_SWAP dswap;
102         int width;
103         int height;
104         int hor_stride;
105     } com;
106 
107     struct {
108         enum IEP2_DIL_MODE dil_mode;
109         enum IEP2_OUT_MODE out_mode;
110         enum IEP2_FIELD_ORDER dil_order;
111         enum IEP2_FF_MODE ff_mode;
112     } mode;
113 
114     struct {
115         uint32_t md_theta;
116         uint32_t md_r;
117         uint32_t md_lambda;
118     } md;
119 
120     struct {
121         uint32_t roi_en;
122     } roi;
123 };
124 
125 struct iep2_api_params {
126     enum IEP2_PARAM_TYPE ptype;
127     union iep2_api_content param;
128 };
129 
130 struct iep2_api_info {
131     enum IEP2_FIELD_ORDER dil_order;
132     enum IEP2_FF_MODE frm_mode;
133     enum PD_TYPES pd_types;
134     enum PD_COMP_FLAG pd_flag;
135     RK_U32 dil_order_confidence_ratio;
136 };
137 
138 struct mv_list {
139     int mv[8];
140     int vld[8];
141     int idx;
142 };
143 
144 #ifdef __cplusplus
145 extern "C" {
146 #endif
147 
148 iep_com_ctx* rockchip_iep2_api_alloc_ctx(void);
149 void rockchip_iep2_api_release_ctx(iep_com_ctx *com_ctx);
150 
151 #ifdef __cplusplus
152 }
153 #endif
154 
155 #endif
156