1 /**************************************************************************
3 * Copyright 2009 Younes Manton.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
28 #ifndef PIPE_VIDEO_STATE_H
29 #define PIPE_VIDEO_STATE_H
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"
42 * see table 6-12 in the spec
44 enum pipe_mpeg12_picture_coding_type
46 PIPE_MPEG12_PICTURE_CODING_TYPE_I
= 0x01,
47 PIPE_MPEG12_PICTURE_CODING_TYPE_P
= 0x02,
48 PIPE_MPEG12_PICTURE_CODING_TYPE_B
= 0x03,
49 PIPE_MPEG12_PICTURE_CODING_TYPE_D
= 0x04
53 * see table 6-14 in the spec
55 enum pipe_mpeg12_picture_structure
57 PIPE_MPEG12_PICTURE_STRUCTURE_RESERVED
= 0x00,
58 PIPE_MPEG12_PICTURE_STRUCTURE_FIELD_TOP
= 0x01,
59 PIPE_MPEG12_PICTURE_STRUCTURE_FIELD_BOTTOM
= 0x02,
60 PIPE_MPEG12_PICTURE_STRUCTURE_FRAME
= 0x03
64 * flags for macroblock_type, see section 6.3.17.1 in the spec
66 enum pipe_mpeg12_macroblock_type
68 PIPE_MPEG12_MB_TYPE_QUANT
= 0x01,
69 PIPE_MPEG12_MB_TYPE_MOTION_FORWARD
= 0x02,
70 PIPE_MPEG12_MB_TYPE_MOTION_BACKWARD
= 0x04,
71 PIPE_MPEG12_MB_TYPE_PATTERN
= 0x08,
72 PIPE_MPEG12_MB_TYPE_INTRA
= 0x10
76 * flags for motion_type, see table 6-17 and 6-18 in the spec
78 enum pipe_mpeg12_motion_type
80 PIPE_MPEG12_MO_TYPE_RESERVED
= 0x00,
81 PIPE_MPEG12_MO_TYPE_FIELD
= 0x01,
82 PIPE_MPEG12_MO_TYPE_FRAME
= 0x02,
83 PIPE_MPEG12_MO_TYPE_16x8
= 0x02,
84 PIPE_MPEG12_MO_TYPE_DUAL_PRIME
= 0x03
88 * see section 6.3.17.1 and table 6-19 in the spec
90 enum pipe_mpeg12_dct_type
92 PIPE_MPEG12_DCT_TYPE_FRAME
= 0,
93 PIPE_MPEG12_DCT_TYPE_FIELD
= 1
96 enum pipe_mpeg12_field_select
98 PIPE_MPEG12_FS_FIRST_FORWARD
= 0x01,
99 PIPE_MPEG12_FS_FIRST_BACKWARD
= 0x02,
100 PIPE_MPEG12_FS_SECOND_FORWARD
= 0x04,
101 PIPE_MPEG12_FS_SECOND_BACKWARD
= 0x08
104 struct pipe_picture_desc
106 enum pipe_video_profile profile
;
109 struct pipe_quant_matrix
111 enum pipe_video_format codec
;
114 struct pipe_macroblock
116 enum pipe_video_format codec
;
119 struct pipe_mpeg12_picture_desc
121 struct pipe_picture_desc base
;
123 unsigned picture_coding_type
;
124 unsigned picture_structure
;
125 unsigned frame_pred_frame_dct
;
126 unsigned q_scale_type
;
127 unsigned alternate_scan
;
128 unsigned intra_vlc_format
;
129 unsigned concealment_motion_vectors
;
130 unsigned intra_dc_precision
;
131 unsigned f_code
[2][2];
132 unsigned top_field_first
;
133 unsigned full_pel_forward_vector
;
134 unsigned full_pel_backward_vector
;
137 const uint8_t *intra_matrix
;
138 const uint8_t *non_intra_matrix
;
140 struct pipe_video_buffer
*ref
[2];
143 struct pipe_mpeg12_macroblock
145 struct pipe_macroblock base
;
147 /* see section 6.3.17 in the spec */
150 /* see section 6.3.17.1 in the spec */
151 unsigned char macroblock_type
;
155 /* see table 6-17 in the spec */
156 unsigned int frame_motion_type
:2;
158 /* see table 6-18 in the spec */
159 unsigned int field_motion_type
:2;
161 /* see table 6-19 in the spec */
162 unsigned int dct_type
:1;
167 /* see section 6.3.17.2 in the spec */
168 unsigned char motion_vertical_field_select
;
170 /* see Table 7-7 in the spec */
173 /* see figure 6.10-12 in the spec */
174 unsigned short coded_block_pattern
;
176 /* see figure 6.10-12 in the spec */
179 /* Number of skipped macroblocks after this macroblock */
180 unsigned short num_skipped_macroblocks
;
183 struct pipe_mpeg4_picture_desc
185 struct pipe_picture_desc base
;
189 uint16_t vop_time_increment_resolution
;
190 uint8_t vop_coding_type
;
191 uint8_t vop_fcode_forward
;
192 uint8_t vop_fcode_backward
;
193 uint8_t resync_marker_disable
;
196 uint8_t quarter_sample
;
197 uint8_t short_video_header
;
198 uint8_t rounding_control
;
199 uint8_t alternate_vertical_scan_flag
;
200 uint8_t top_field_first
;
202 const uint8_t *intra_matrix
;
203 const uint8_t *non_intra_matrix
;
205 struct pipe_video_buffer
*ref
[2];
208 struct pipe_vc1_picture_desc
210 struct pipe_picture_desc base
;
212 uint32_t slice_count
;
213 uint8_t picture_type
;
214 uint8_t frame_coding_mode
;
215 uint8_t postprocflag
;
222 uint8_t panscan_flag
;
223 uint8_t refdist_flag
;
226 uint8_t extended_dmv
;
231 uint8_t range_mapy_flag
;
233 uint8_t range_mapuv_flag
;
239 uint8_t deblockEnable
;
242 struct pipe_video_buffer
*ref
[2];
245 struct pipe_h264_picture_desc
247 struct pipe_picture_desc base
;
249 uint32_t slice_count
;
250 int32_t field_order_cnt
[2];
253 uint8_t field_pic_flag
;
254 uint8_t bottom_field_flag
;
255 uint8_t num_ref_frames
;
256 uint8_t mb_adaptive_frame_field_flag
;
257 uint8_t constrained_intra_pred_flag
;
258 uint8_t weighted_pred_flag
;
259 uint8_t weighted_bipred_idc
;
260 uint8_t frame_mbs_only_flag
;
261 uint8_t transform_8x8_mode_flag
;
262 int8_t chroma_qp_index_offset
;
263 int8_t second_chroma_qp_index_offset
;
264 int8_t pic_init_qp_minus26
;
265 uint8_t num_ref_idx_l0_active_minus1
;
266 uint8_t num_ref_idx_l1_active_minus1
;
267 uint8_t log2_max_frame_num_minus4
;
268 uint8_t pic_order_cnt_type
;
269 uint8_t log2_max_pic_order_cnt_lsb_minus4
;
270 uint8_t delta_pic_order_always_zero_flag
;
271 uint8_t direct_8x8_inference_flag
;
272 uint8_t entropy_coding_mode_flag
;
273 uint8_t pic_order_present_flag
;
274 uint8_t deblocking_filter_control_present_flag
;
275 uint8_t redundant_pic_cnt_present_flag
;
276 uint8_t scaling_lists_4x4
[6][16];
277 uint8_t scaling_lists_8x8
[2][64];
279 bool is_long_term
[16];
280 bool top_is_reference
[16];
281 bool bottom_is_reference
[16];
282 uint32_t field_order_cnt_list
[16][2];
283 uint32_t frame_num_list
[16];
285 struct pipe_video_buffer
*ref
[16];
292 #endif /* PIPE_VIDEO_STATE_H */