1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * These are the MPEG2 state controls for use with stateless MPEG-2
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 _MPEG2_CTRLS_H_
12 #define _MPEG2_CTRLS_H_
13 
14 #define V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS		(V4L2_CID_CODEC_BASE+250)
15 #define V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION		(V4L2_CID_CODEC_BASE+251)
16 
17 /* enum v4l2_ctrl_type type values */
18 #define V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS 0x0103
19 #define	V4L2_CTRL_TYPE_MPEG2_QUANTIZATION 0x0104
20 
21 #define V4L2_MPEG2_PICTURE_CODING_TYPE_I	1
22 #define V4L2_MPEG2_PICTURE_CODING_TYPE_P	2
23 #define V4L2_MPEG2_PICTURE_CODING_TYPE_B	3
24 #define V4L2_MPEG2_PICTURE_CODING_TYPE_D	4
25 
26 struct v4l2_mpeg2_sequence {
27 	/* ISO/IEC 13818-2, ITU-T Rec. H.262: Sequence header */
28 	__u16	horizontal_size;
29 	__u16	vertical_size;
30 	__u32	vbv_buffer_size;
31 
32 	/* ISO/IEC 13818-2, ITU-T Rec. H.262: Sequence extension */
33 	__u16	profile_and_level_indication;
34 	__u8	progressive_sequence;
35 	__u8	chroma_format;
36 };
37 
38 struct v4l2_mpeg2_picture {
39 	/* ISO/IEC 13818-2, ITU-T Rec. H.262: Picture header */
40 	__u8	picture_coding_type;
41 
42 	/* ISO/IEC 13818-2, ITU-T Rec. H.262: Picture coding extension */
43 	__u8	f_code[2][2];
44 	__u8	intra_dc_precision;
45 	__u8	picture_structure;
46 	__u8	top_field_first;
47 	__u8	frame_pred_frame_dct;
48 	__u8	concealment_motion_vectors;
49 	__u8	q_scale_type;
50 	__u8	intra_vlc_format;
51 	__u8	alternate_scan;
52 	__u8	repeat_first_field;
53 	__u16	progressive_frame;
54 };
55 
56 struct v4l2_ctrl_mpeg2_slice_params {
57 	__u32	bit_size;
58 	__u32	data_bit_offset;
59 	__u64	backward_ref_ts;
60 	__u64	forward_ref_ts;
61 
62 	struct v4l2_mpeg2_sequence sequence;
63 	struct v4l2_mpeg2_picture picture;
64 
65 	/* ISO/IEC 13818-2, ITU-T Rec. H.262: Slice */
66 	__u32	quantiser_scale_code;
67 };
68 
69 struct v4l2_ctrl_mpeg2_quantization {
70 	/* ISO/IEC 13818-2, ITU-T Rec. H.262: Quant matrix extension */
71 	__u8	load_intra_quantiser_matrix;
72 	__u8	load_non_intra_quantiser_matrix;
73 	__u8	load_chroma_intra_quantiser_matrix;
74 	__u8	load_chroma_non_intra_quantiser_matrix;
75 
76 	__u8	intra_quantiser_matrix[64];
77 	__u8	non_intra_quantiser_matrix[64];
78 	__u8	chroma_intra_quantiser_matrix[64];
79 	__u8	chroma_non_intra_quantiser_matrix[64];
80 };
81 
82 #endif
83