Merge branch 'dmi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvar...
[platform/kernel/linux-starfive.git] / include / media / vp8-ctrls.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * These are the VP8 state controls for use with stateless VP8
4  * codec drivers.
5  *
6  * It turns out that these structs are not stable yet and will undergo
7  * more changes. So keep them private until they are stable and ready to
8  * become part of the official public API.
9  */
10
11 #ifndef _VP8_CTRLS_H_
12 #define _VP8_CTRLS_H_
13
14 #include <linux/types.h>
15
16 #define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F')
17
18 #define V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER (V4L2_CID_MPEG_BASE + 2000)
19 #define V4L2_CTRL_TYPE_VP8_FRAME_HEADER 0x301
20
21 #define V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED              0x01
22 #define V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_MAP           0x02
23 #define V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_FEATURE_DATA  0x04
24 #define V4L2_VP8_SEGMENT_HEADER_FLAG_DELTA_VALUE_MODE     0x08
25
26 struct v4l2_vp8_segment_header {
27         __s8 quant_update[4];
28         __s8 lf_update[4];
29         __u8 segment_probs[3];
30         __u8 padding;
31         __u32 flags;
32 };
33
34 #define V4L2_VP8_LF_HEADER_ADJ_ENABLE   0x01
35 #define V4L2_VP8_LF_HEADER_DELTA_UPDATE 0x02
36 #define V4L2_VP8_LF_FILTER_TYPE_SIMPLE  0x04
37 struct v4l2_vp8_loopfilter_header {
38         __s8 ref_frm_delta[4];
39         __s8 mb_mode_delta[4];
40         __u8 sharpness_level;
41         __u8 level;
42         __u16 padding;
43         __u32 flags;
44 };
45
46 struct v4l2_vp8_quantization_header {
47         __u8 y_ac_qi;
48         __s8 y_dc_delta;
49         __s8 y2_dc_delta;
50         __s8 y2_ac_delta;
51         __s8 uv_dc_delta;
52         __s8 uv_ac_delta;
53         __u16 padding;
54 };
55
56 struct v4l2_vp8_entropy_header {
57         __u8 coeff_probs[4][8][3][11];
58         __u8 y_mode_probs[4];
59         __u8 uv_mode_probs[3];
60         __u8 mv_probs[2][19];
61         __u8 padding[3];
62 };
63
64 struct v4l2_vp8_entropy_coder_state {
65         __u8 range;
66         __u8 value;
67         __u8 bit_count;
68         __u8 padding;
69 };
70
71 #define V4L2_VP8_FRAME_HEADER_FLAG_KEY_FRAME            0x01
72 #define V4L2_VP8_FRAME_HEADER_FLAG_EXPERIMENTAL         0x02
73 #define V4L2_VP8_FRAME_HEADER_FLAG_SHOW_FRAME           0x04
74 #define V4L2_VP8_FRAME_HEADER_FLAG_MB_NO_SKIP_COEFF     0x08
75 #define V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_GOLDEN     0x10
76 #define V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_ALT        0x20
77
78 #define VP8_FRAME_IS_KEY_FRAME(hdr) \
79         (!!((hdr)->flags & V4L2_VP8_FRAME_HEADER_FLAG_KEY_FRAME))
80
81 struct v4l2_ctrl_vp8_frame_header {
82         struct v4l2_vp8_segment_header segment_header;
83         struct v4l2_vp8_loopfilter_header lf_header;
84         struct v4l2_vp8_quantization_header quant_header;
85         struct v4l2_vp8_entropy_header entropy_header;
86         struct v4l2_vp8_entropy_coder_state coder_state;
87
88         __u16 width;
89         __u16 height;
90
91         __u8 horizontal_scale;
92         __u8 vertical_scale;
93
94         __u8 version;
95         __u8 prob_skip_false;
96         __u8 prob_intra;
97         __u8 prob_last;
98         __u8 prob_gf;
99         __u8 num_dct_parts;
100
101         __u32 first_part_size;
102         __u32 first_part_header_bits;
103         __u32 dct_part_sizes[8];
104
105         __u64 last_frame_ts;
106         __u64 golden_frame_ts;
107         __u64 alt_frame_ts;
108
109         __u64 flags;
110 };
111
112 #endif