summaryrefslogtreecommitdiff
path: root/iep.h
blob: 3a3e7a95b6e31389a0e24a4770c6864558a718af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#ifndef _IEP_H_
#define _IEP_H_

#include <sys/ioctl.h>

/* Capability for current iep version
using by userspace to determine iep features */
struct IEP_CAP {
    uint8_t scaling_supported;
    uint8_t i4_deinterlace_supported;
    uint8_t i2_deinterlace_supported;
    uint8_t compression_noise_reduction_supported;
    uint8_t sampling_noise_reduction_supported;
    uint8_t hsb_enhancement_supported;
    uint8_t cg_enhancement_supported;
    uint8_t direct_path_supported;
    uint16_t max_dynamic_width;
    uint16_t max_dynamic_height;
    uint16_t max_static_width;
    uint16_t max_static_height;
    uint8_t max_enhance_radius;
};

#define IEP_IOC_MAGIC 'i'

#define IEP_SET_PARAMETER_REQ _IOW(IEP_IOC_MAGIC, 1, unsigned long)
#define IEP_SET_PARAMETER_DEINTERLACE _IOW(IEP_IOC_MAGIC, 2, unsigned long)
#define IEP_SET_PARAMETER_ENHANCE _IOW(IEP_IOC_MAGIC, 3, unsigned long)
#define IEP_SET_PARAMETER_CONVERT _IOW(IEP_IOC_MAGIC, 4, unsigned long)
#define IEP_SET_PARAMETER_SCALE _IOW(IEP_IOC_MAGIC, 5, unsigned long)
#define IEP_GET_RESULT_SYNC _IOW(IEP_IOC_MAGIC, 6, unsigned long)
#define IEP_GET_RESULT_ASYNC _IOW(IEP_IOC_MAGIC, 7, unsigned long)
#define IEP_SET_PARAMETER _IOW(IEP_IOC_MAGIC, 8, unsigned long)
#define IEP_RELEASE_CURRENT_TASK _IOW(IEP_IOC_MAGIC, 9, unsigned long)
#define IEP_GET_IOMMU_STATE _IOR(IEP_IOC_MAGIC,10, unsigned long)
#define IEP_QUERY_CAP _IOR(IEP_IOC_MAGIC, 11, struct IEP_CAP)

enum {
    yuv2rgb_BT_601_l            = 0x0,     /* BT.601_1 */
    yuv2rgb_BT_601_f            = 0x1,     /* BT.601_f */
    yuv2rgb_BT_709_l            = 0x2,     /* BT.709_1 */
    yuv2rgb_BT_709_f            = 0x3,     /* BT.709_f */
};

enum
{
    rgb2yuv_BT_601_l            = 0x0,     /* BT.601_1 */
    rgb2yuv_BT_601_f            = 0x1,     /* BT.601_f */
    rgb2yuv_BT_709_l            = 0x2,     /* BT.709_1 */
    rgb2yuv_BT_709_f            = 0x3,     /* BT.709_f */
};

enum {
    dein_mode_bypass_dis         = 0x0,
    dein_mode_I4O2               = 0x1,
    dein_mode_I4O1B              = 0x2,
    dein_mode_I4O1T              = 0x3,
    dein_mode_I2O1B              = 0x4,
    dein_mode_I2O1T              = 0x5,
    dein_mode_bypass             = 0x6,
};

enum {
    rgb_enhance_bypass          = 0x0,
    rgb_enhance_denoise         = 0x1,
    rgb_enhance_detail          = 0x2,
    rgb_enhance_edge            = 0x3,
};//for rgb_enhance_mode

enum
{
    rgb_contrast_CC_P_DDE          = 0x0, //cg prior to dde
    rgb_contrast_DDE_P_CC          = 0x1, //dde prior to cg
}; //for rgb_contrast_enhance_mode

enum {
    black_screen                   = 0x0,
    blue_screen                    = 0x1,
    color_bar                      = 0x2,
    normal_mode                    = 0x3,
}; //for video mode

/*
//          Alpha    Red     Green   Blue
{  4, 32, {{32,24,   24,16,  16, 8,  8, 0 }}, GGL_RGBA },   // IEP_FORMAT_ARGB_8888
{  4, 32, {{32,24,   8, 0,  16, 8,  24,16 }}, GGL_RGB  },   // IEP_FORMAT_ABGR_8888
{  4, 32, {{ 8, 0,  32,24,  24,16,  16, 8 }}, GGL_RGB  },   // IEP_FORMAT_RGBA_8888
{  4, 32, {{ 8, 0,  16, 8,  24,16,  32,24 }}, GGL_BGRA },   // IEP_FORMAT_BGRA_8888
{  2, 16, {{ 0, 0,  16,11,  11, 5,   5, 0 }}, GGL_RGB  },   // IEP_FORMAT_RGB_565
{  2, 16, {{ 0, 0,   5, 0,  11, 5,  16,11 }}, GGL_RGB  },   // IEP_FORMAT_RGB_565
*/
enum {
    IEP_FORMAT_ARGB_8888    = 0x0,
    IEP_FORMAT_ABGR_8888    = 0x1,
    IEP_FORMAT_RGBA_8888    = 0x2,
    IEP_FORMAT_BGRA_8888    = 0x3,
    IEP_FORMAT_RGB_565      = 0x4,
    IEP_FORMAT_BGR_565      = 0x5,

    IEP_FORMAT_YCbCr_422_SP = 0x10,
    IEP_FORMAT_YCbCr_422_P  = 0x11,
    IEP_FORMAT_YCbCr_420_SP = 0x12,
    IEP_FORMAT_YCbCr_420_P  = 0x13,
    IEP_FORMAT_YCrCb_422_SP = 0x14,
    IEP_FORMAT_YCrCb_422_P  = 0x15,//same as IEP_FORMAT_YCbCr_422_P
    IEP_FORMAT_YCrCb_420_SP = 0x16,
    IEP_FORMAT_YCrCb_420_P  = 0x17,//same as IEP_FORMAT_YCbCr_420_P
}; //for format

typedef struct iep_img {
    uint16_t act_w;         // act_width
    uint16_t act_h;         // act_height
    int16_t x_off;         // x offset for the vir,word unit
    int16_t y_off;         // y offset for the vir,word unit

    uint16_t vir_w;         //unit :pix
    uint16_t vir_h;         //unit :pix
    uint32_t format;
    uint32_t mem_addr;
    uint32_t uv_addr;
    uint32_t v_addr;

    uint8_t rb_swap;//not be used
    uint8_t uv_swap;//not be used

    uint8_t alpha_swap;//not be used
} iep_img;


typedef struct IEP_MSG {
    iep_img src;    // src active window
    iep_img dst;    // src virtual window

    iep_img src1;
    iep_img dst1;

    iep_img src_itemp;
    iep_img src_ftemp;

    iep_img dst_itemp;
    iep_img dst_ftemp;

    uint8_t dither_up_en;
    uint8_t dither_down_en;//not to be used

    uint8_t yuv2rgb_mode;
    uint8_t rgb2yuv_mode;

    uint8_t global_alpha_value;

    uint8_t rgb2yuv_clip_en;
    uint8_t yuv2rgb_clip_en;

    uint8_t lcdc_path_en;
    int32_t off_x;
    int32_t off_y;
    int32_t width;
    int32_t height;
    int32_t layer;

    uint8_t yuv_3D_denoise_en;

    /// yuv color enhance
    uint8_t yuv_enhance_en;
    int32_t sat_con_int;
    int32_t contrast_int;
    int32_t cos_hue_int;
    int32_t sin_hue_int;
    int8_t yuv_enh_brightness;//-32<brightness<31
    uint8_t video_mode;//0-3
    uint8_t color_bar_y;//0-127
    uint8_t color_bar_u;//0-127
    uint8_t color_bar_v;//0-127


    uint8_t rgb_enhance_en;//i don't konw what is used

    uint8_t rgb_color_enhance_en;//sw_rgb_color_enh_en
    uint32_t rgb_enh_coe;

    uint8_t rgb_enhance_mode;//sw_rgb_enh_sel,dde sel

    uint8_t rgb_cg_en;//sw_rgb_con_gam_en
    uint32_t cg_tab[192];

    uint8_t rgb_contrast_enhance_mode;//sw_con_gam_order;0 cg prior to dde,1 dde prior to cg

    int32_t enh_threshold;
    int32_t enh_alpha;
    int32_t enh_radius;

    uint8_t scale_up_mode;

    uint8_t field_order;
    uint8_t dein_mode;
    //DIL HF
    uint8_t dein_high_fre_en;
    uint8_t dein_high_fre_fct;
    //DIL EI
    uint8_t dein_ei_mode;
    uint8_t dein_ei_smooth;
    uint8_t dein_ei_sel;
    uint8_t dein_ei_radius;//when dein_ei_sel=0 will be used

    uint8_t vir_addr_enable;

    void *base;
} IEP_MSG;

#endif