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 VMWARE 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 enum pipe_h264_slice_type
106 PIPE_H264_SLICE_TYPE_P
= 0x0,
107 PIPE_H264_SLICE_TYPE_B
= 0x1,
108 PIPE_H264_SLICE_TYPE_I
= 0x2,
109 PIPE_H264_SLICE_TYPE_SP
= 0x3,
110 PIPE_H264_SLICE_TYPE_SI
= 0x4
113 struct pipe_picture_desc
115 enum pipe_video_profile profile
;
118 struct pipe_quant_matrix
120 enum pipe_video_format codec
;
123 struct pipe_macroblock
125 enum pipe_video_format codec
;
128 struct pipe_mpeg12_picture_desc
130 struct pipe_picture_desc base
;
132 unsigned picture_coding_type
;
133 unsigned picture_structure
;
134 unsigned frame_pred_frame_dct
;
135 unsigned q_scale_type
;
136 unsigned alternate_scan
;
137 unsigned intra_vlc_format
;
138 unsigned concealment_motion_vectors
;
139 unsigned intra_dc_precision
;
140 unsigned f_code
[2][2];
141 unsigned top_field_first
;
142 unsigned full_pel_forward_vector
;
143 unsigned full_pel_backward_vector
;
146 const uint8_t *intra_matrix
;
147 const uint8_t *non_intra_matrix
;
149 struct pipe_video_buffer
*ref
[2];
152 struct pipe_mpeg12_macroblock
154 struct pipe_macroblock base
;
156 /* see section 6.3.17 in the spec */
159 /* see section 6.3.17.1 in the spec */
160 unsigned char macroblock_type
;
164 /* see table 6-17 in the spec */
165 unsigned int frame_motion_type
:2;
167 /* see table 6-18 in the spec */
168 unsigned int field_motion_type
:2;
170 /* see table 6-19 in the spec */
171 unsigned int dct_type
:1;
176 /* see section 6.3.17.2 in the spec */
177 unsigned char motion_vertical_field_select
;
179 /* see Table 7-7 in the spec */
182 /* see figure 6.10-12 in the spec */
183 unsigned short coded_block_pattern
;
185 /* see figure 6.10-12 in the spec */
188 /* Number of skipped macroblocks after this macroblock */
189 unsigned short num_skipped_macroblocks
;
192 struct pipe_mpeg4_picture_desc
194 struct pipe_picture_desc base
;
198 uint16_t vop_time_increment_resolution
;
199 uint8_t vop_coding_type
;
200 uint8_t vop_fcode_forward
;
201 uint8_t vop_fcode_backward
;
202 uint8_t resync_marker_disable
;
205 uint8_t quarter_sample
;
206 uint8_t short_video_header
;
207 uint8_t rounding_control
;
208 uint8_t alternate_vertical_scan_flag
;
209 uint8_t top_field_first
;
211 const uint8_t *intra_matrix
;
212 const uint8_t *non_intra_matrix
;
214 struct pipe_video_buffer
*ref
[2];
217 struct pipe_vc1_picture_desc
219 struct pipe_picture_desc base
;
221 uint32_t slice_count
;
222 uint8_t picture_type
;
223 uint8_t frame_coding_mode
;
224 uint8_t postprocflag
;
231 uint8_t panscan_flag
;
232 uint8_t refdist_flag
;
235 uint8_t extended_dmv
;
240 uint8_t range_mapy_flag
;
242 uint8_t range_mapuv_flag
;
248 uint8_t deblockEnable
;
251 struct pipe_video_buffer
*ref
[2];
256 uint8_t chroma_format_idc
;
257 uint8_t separate_colour_plane_flag
;
258 uint8_t bit_depth_luma_minus8
;
259 uint8_t bit_depth_chroma_minus8
;
260 uint8_t seq_scaling_matrix_present_flag
;
261 uint8_t ScalingList4x4
[6][16];
262 uint8_t ScalingList8x8
[6][64];
263 uint8_t log2_max_frame_num_minus4
;
264 uint8_t pic_order_cnt_type
;
265 uint8_t log2_max_pic_order_cnt_lsb_minus4
;
266 uint8_t delta_pic_order_always_zero_flag
;
267 int32_t offset_for_non_ref_pic
;
268 int32_t offset_for_top_to_bottom_field
;
269 uint8_t num_ref_frames_in_pic_order_cnt_cycle
;
270 int32_t offset_for_ref_frame
[256];
271 uint8_t max_num_ref_frames
;
272 uint8_t frame_mbs_only_flag
;
273 uint8_t mb_adaptive_frame_field_flag
;
274 uint8_t direct_8x8_inference_flag
;
279 struct pipe_h264_sps
*sps
;
281 uint8_t entropy_coding_mode_flag
;
282 uint8_t bottom_field_pic_order_in_frame_present_flag
;
283 uint8_t num_slice_groups_minus1
;
284 uint8_t slice_group_map_type
;
285 uint8_t slice_group_change_rate_minus1
;
286 uint8_t num_ref_idx_l0_default_active_minus1
;
287 uint8_t num_ref_idx_l1_default_active_minus1
;
288 uint8_t weighted_pred_flag
;
289 uint8_t weighted_bipred_idc
;
290 int8_t pic_init_qp_minus26
;
291 int8_t chroma_qp_index_offset
;
292 uint8_t deblocking_filter_control_present_flag
;
293 uint8_t constrained_intra_pred_flag
;
294 uint8_t redundant_pic_cnt_present_flag
;
295 uint8_t ScalingList4x4
[6][16];
296 uint8_t ScalingList8x8
[6][64];
297 uint8_t transform_8x8_mode_flag
;
298 int8_t second_chroma_qp_index_offset
;
301 struct pipe_h264_picture_desc
303 struct pipe_picture_desc base
;
305 struct pipe_h264_pps
*pps
;
309 uint8_t field_pic_flag
;
310 uint8_t bottom_field_flag
;
311 uint8_t num_ref_idx_l0_active_minus1
;
312 uint8_t num_ref_idx_l1_active_minus1
;
314 uint32_t slice_count
;
315 int32_t field_order_cnt
[2];
317 uint8_t num_ref_frames
;
319 bool is_long_term
[16];
320 bool top_is_reference
[16];
321 bool bottom_is_reference
[16];
322 uint32_t field_order_cnt_list
[16][2];
323 uint32_t frame_num_list
[16];
325 struct pipe_video_buffer
*ref
[16];
332 #endif /* PIPE_VIDEO_STATE_H */