g3dvl: Rework the decoder interface part 3/5
[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 enum pipe_mpeg12_picture_type
47 {
48 PIPE_MPEG12_PICTURE_TYPE_FIELD_TOP,
49 PIPE_MPEG12_PICTURE_TYPE_FIELD_BOTTOM,
50 PIPE_MPEG12_PICTURE_TYPE_FRAME
51 };
52
53 /*
54 * flags for macroblock_type, see section 6.3.17.1 in the spec
55 */
56 enum pipe_mpeg12_macroblock_type
57 {
58 PIPE_MPEG12_MB_TYPE_QUANT = 0x01,
59 PIPE_MPEG12_MB_TYPE_MOTION_FORWARD = 0x02,
60 PIPE_MPEG12_MB_TYPE_MOTION_BACKWARD = 0x04,
61 PIPE_MPEG12_MB_TYPE_PATTERN = 0x08,
62 PIPE_MPEG12_MB_TYPE_INTRA = 0x10
63 };
64
65 /*
66 * flags for motion_type, see table 6-17 and 6-18 in the spec
67 */
68 enum pipe_mpeg12_motion_type
69 {
70 PIPE_MPEG12_MO_TYPE_RESERVED = 0x00,
71 PIPE_MPEG12_MO_TYPE_FIELD = 0x01,
72 PIPE_MPEG12_MO_TYPE_FRAME = 0x02,
73 PIPE_MPEG12_MO_TYPE_16x8 = 0x02,
74 PIPE_MPEG12_MO_TYPE_DUAL_PRIME = 0x03
75 };
76
77 /*
78 * see section 6.3.17.1 and table 6-19 in the spec
79 */
80 enum pipe_mpeg12_dct_type
81 {
82 PIPE_MPEG12_DCT_TYPE_FRAME = 0,
83 PIPE_MPEG12_DCT_TYPE_FIELD = 1
84 };
85
86 enum pipe_mpeg12_field_select
87 {
88 PIPE_MPEG12_FS_FIRST_FORWARD = 0x01,
89 PIPE_MPEG12_FS_FIRST_BACKWARD = 0x02,
90 PIPE_MPEG12_FS_SECOND_FORWARD = 0x04,
91 PIPE_MPEG12_FS_SECOND_BACKWARD = 0x08
92 };
93
94 struct pipe_picture_desc
95 {
96 enum pipe_video_profile profile;
97 };
98
99 struct pipe_macroblock
100 {
101 enum pipe_video_codec codec;
102 };
103
104 struct pipe_mpeg12_picture_desc
105 {
106 struct pipe_picture_desc base;
107
108 unsigned picture_coding_type;
109 unsigned picture_structure;
110 unsigned frame_pred_frame_dct;
111 unsigned q_scale_type;
112 unsigned alternate_scan;
113 unsigned intra_vlc_format;
114 unsigned concealment_motion_vectors;
115 unsigned f_code[2][2];
116 };
117
118 struct pipe_mpeg12_macroblock
119 {
120 struct pipe_macroblock base;
121
122 /* see section 6.3.17 in the spec */
123 unsigned short x, y;
124
125 /* see section 6.3.17.1 in the spec */
126 unsigned char macroblock_type;
127
128 union {
129 struct {
130 /* see table 6-17 in the spec */
131 unsigned int frame_motion_type:2;
132
133 /* see table 6-18 in the spec */
134 unsigned int field_motion_type:2;
135
136 /* see table 6-19 in the spec */
137 unsigned int dct_type:1;
138 } bits;
139 unsigned int value;
140 } macroblock_modes;
141
142 /* see section 6.3.17.2 in the spec */
143 unsigned char motion_vertical_field_select;
144
145 /* see Table 7-7 in the spec */
146 short PMV[2][2][2];
147
148 /* see figure 6.10-12 in the spec */
149 unsigned short coded_block_pattern;
150
151 /* see figure 6.10-12 in the spec */
152 short *blocks;
153
154 /* Number of skipped macroblocks after this macroblock */
155 unsigned short num_skipped_macroblocks;
156 };
157
158 #ifdef __cplusplus
159 }
160 #endif
161
162 #endif /* PIPE_VIDEO_STATE_H */