include/pipe: Fix include style
[mesa.git] / src / gallium / include / pipe / p_video_state.h
1 /**************************************************************************
2 *
3 * Copyright 2009 Younes Manton.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #ifndef PIPE_VIDEO_STATE_H
29 #define PIPE_VIDEO_STATE_H
30
31 #include "pipe/p_defines.h"
32 #include "pipe/p_format.h"
33 #include "pipe/p_state.h"
34 #include "pipe/p_screen.h"
35 #include "util/u_inlines.h"
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 struct pipe_video_rect
42 {
43 unsigned x, y, w, h;
44 };
45
46 /*
47 * see table 6-12 in the spec
48 */
49 enum pipe_mpeg12_picture_coding_type
50 {
51 PIPE_MPEG12_PICTURE_CODING_TYPE_I = 0x01,
52 PIPE_MPEG12_PICTURE_CODING_TYPE_P = 0x02,
53 PIPE_MPEG12_PICTURE_CODING_TYPE_B = 0x03,
54 PIPE_MPEG12_PICTURE_CODING_TYPE_D = 0x04
55 };
56
57 /*
58 * see table 6-14 in the spec
59 */
60 enum pipe_mpeg12_picture_structure
61 {
62 PIPE_MPEG12_PICTURE_STRUCTURE_RESERVED = 0x00,
63 PIPE_MPEG12_PICTURE_STRUCTURE_FIELD_TOP = 0x01,
64 PIPE_MPEG12_PICTURE_STRUCTURE_FIELD_BOTTOM = 0x02,
65 PIPE_MPEG12_PICTURE_STRUCTURE_FRAME = 0x03
66 };
67
68 /*
69 * flags for macroblock_type, see section 6.3.17.1 in the spec
70 */
71 enum pipe_mpeg12_macroblock_type
72 {
73 PIPE_MPEG12_MB_TYPE_QUANT = 0x01,
74 PIPE_MPEG12_MB_TYPE_MOTION_FORWARD = 0x02,
75 PIPE_MPEG12_MB_TYPE_MOTION_BACKWARD = 0x04,
76 PIPE_MPEG12_MB_TYPE_PATTERN = 0x08,
77 PIPE_MPEG12_MB_TYPE_INTRA = 0x10
78 };
79
80 /*
81 * flags for motion_type, see table 6-17 and 6-18 in the spec
82 */
83 enum pipe_mpeg12_motion_type
84 {
85 PIPE_MPEG12_MO_TYPE_RESERVED = 0x00,
86 PIPE_MPEG12_MO_TYPE_FIELD = 0x01,
87 PIPE_MPEG12_MO_TYPE_FRAME = 0x02,
88 PIPE_MPEG12_MO_TYPE_16x8 = 0x02,
89 PIPE_MPEG12_MO_TYPE_DUAL_PRIME = 0x03
90 };
91
92 /*
93 * see section 6.3.17.1 and table 6-19 in the spec
94 */
95 enum pipe_mpeg12_dct_type
96 {
97 PIPE_MPEG12_DCT_TYPE_FRAME = 0,
98 PIPE_MPEG12_DCT_TYPE_FIELD = 1
99 };
100
101 enum pipe_mpeg12_field_select
102 {
103 PIPE_MPEG12_FS_FIRST_FORWARD = 0x01,
104 PIPE_MPEG12_FS_FIRST_BACKWARD = 0x02,
105 PIPE_MPEG12_FS_SECOND_FORWARD = 0x04,
106 PIPE_MPEG12_FS_SECOND_BACKWARD = 0x08
107 };
108
109 struct pipe_picture_desc
110 {
111 enum pipe_video_profile profile;
112 };
113
114 struct pipe_quant_matrix
115 {
116 enum pipe_video_codec codec;
117 };
118
119 struct pipe_macroblock
120 {
121 enum pipe_video_codec codec;
122 };
123
124 struct pipe_mpeg12_picture_desc
125 {
126 struct pipe_picture_desc base;
127
128 unsigned picture_coding_type;
129 unsigned picture_structure;
130 unsigned frame_pred_frame_dct;
131 unsigned q_scale_type;
132 unsigned alternate_scan;
133 unsigned intra_vlc_format;
134 unsigned concealment_motion_vectors;
135 unsigned intra_dc_precision;
136 unsigned f_code[2][2];
137 };
138
139 struct pipe_mpeg12_quant_matrix
140 {
141 struct pipe_quant_matrix base;
142
143 const uint8_t *intra_matrix;
144 const uint8_t *non_intra_matrix;
145 };
146
147 struct pipe_mpeg12_macroblock
148 {
149 struct pipe_macroblock base;
150
151 /* see section 6.3.17 in the spec */
152 unsigned short x, y;
153
154 /* see section 6.3.17.1 in the spec */
155 unsigned char macroblock_type;
156
157 union {
158 struct {
159 /* see table 6-17 in the spec */
160 unsigned int frame_motion_type:2;
161
162 /* see table 6-18 in the spec */
163 unsigned int field_motion_type:2;
164
165 /* see table 6-19 in the spec */
166 unsigned int dct_type:1;
167 } bits;
168 unsigned int value;
169 } macroblock_modes;
170
171 /* see section 6.3.17.2 in the spec */
172 unsigned char motion_vertical_field_select;
173
174 /* see Table 7-7 in the spec */
175 short PMV[2][2][2];
176
177 /* see figure 6.10-12 in the spec */
178 unsigned short coded_block_pattern;
179
180 /* see figure 6.10-12 in the spec */
181 short *blocks;
182
183 /* Number of skipped macroblocks after this macroblock */
184 unsigned short num_skipped_macroblocks;
185 };
186
187 #ifdef __cplusplus
188 }
189 #endif
190
191 #endif /* PIPE_VIDEO_STATE_H */