Debian Codegraph @

media_common/agnostic/common/codec/shared/codec_def_decode_vc1.h

raw
1 /*
2 * Copyright (c) 2017, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file codec_def_decode_vc1.h
24 //! \brief Defines decode VC1 types and macros shared by CodecHal, MHW, and DDI layer
25 //! \details Applies to JPEG decode only. Should not contain any DDI specific code.
26 //!
27 #ifndef __CODEC_DEF_DECODE_VC1_H__
28 #define __CODEC_DEF_DECODE_VC1_H__
29
30 // VC1 reference flags
31 #define CODECHAL_WMV9_RANGE_ADJUSTMENT 0x00100000
32 #define CODECHAL_VC1_PROGRESSIVE 0x00200000
33 #define CODECHAL_VC1_TOP_FIELD_COMP 0x00010000
34 #define CODECHAL_VC1_TOP_FIELD_COMP_2 0x00020000
35 #define CODECHAL_VC1_BOT_FIELD_COMP 0x00040000
36 #define CODECHAL_VC1_BOT_FIELD_COMP_2 0x00080000
37 #define CODECHAL_VC1_FRAME_COMP (CODECHAL_VC1_TOP_FIELD_COMP | CODECHAL_VC1_BOT_FIELD_COMP)
38 #define CODECHAL_VC1_ALL_COMP 0x000F0000
39
40 //!
41 //! \enum Vc1FramPictureType
42 //! \brief VC1 fram picture Types
43 //!
44 enum Vc1FramPictureType
45 {
46 vc1IFrame = 0,
47 vc1PFrame,
48 vc1BFrame,
49 vc1BIFrame,
50 vc1SkippedFrame
51 };
52
53 //!
54 //! \enum Vc1FieldPictureType
55 //! \brief VC1 field picture Types
56 //!
57 enum Vc1FieldPictureType
58 {
59 vc1IIField = 0,
60 vc1IPField,
61 vc1PIField,
62 vc1PPField,
63 vc1BBField,
64 vc1BBIField,
65 vc1BIBField,
66 vc1BIBIField
67 };
68
69 //!
70 //! \enum Vc1QuantizerType
71 //! \brief VC-1 Spec Table 259: Quantizer Specification
72 //!
73 enum Vc1QuantizerType
74 {
75 vc1QuantizerImplicit = 0, // specified at frame level
76 vc1QuantizerExplicit, // specified at frame level
77 vc1QuantizerNonuniform, // used for all frames
78 vc1QuantizerUniform // used for all frames
79 };
80
81 typedef struct _CODEC_VC1_PIC_PARAMS
82 {
83 CODEC_PICTURE CurrPic;
84 uint16_t DeblockedPicIdx;
85 uint16_t ForwardRefIdx;
86 uint16_t BackwardRefIdx;
87
88 /* sequence layer for AP or meta data for SP and MP */
89 union
90 {
91 struct
92 {
93 uint32_t pulldown : 1; /* SEQUENCE_LAYER::PULLDOWN */
94 uint32_t interlace : 1; /* SEQUENCE_LAYER::INTERLACE */
95 uint32_t tfcntrflag : 1; /* SEQUENCE_LAYER::TFCNTRFLAG */
96 uint32_t finterpflag : 1; /* SEQUENCE_LAYER::FINTERPFLAG */
97 uint32_t psf : 1; /* SEQUENCE_LAYER::PSF */
98 uint32_t multires : 1; /* METADATA::MULTIRES */
99 uint32_t overlap : 1; /* METADATA::OVERLAP */
100 uint32_t syncmarker : 1; /* METADATA::SYNCMARKER */
101 uint32_t rangered : 1; /* METADATA::RANGERED */
102 uint32_t max_b_frames : 3; /* METADATA::MAXBFRAMES */
103 uint32_t AdvancedProfileFlag : 1;
104 };
105 uint32_t value;
106 } sequence_fields;
107
108 uint16_t coded_width; /* ENTRY_POINT_LAYER::CODED_WIDTH */
109 uint16_t coded_height; /* ENTRY_POINT_LAYER::CODED_HEIGHT */
110 union
111 {
112 struct
113 {
114 uint32_t broken_link : 1; /* ENTRY_POINT_LAYER::BROKEN_LINK */
115 uint32_t closed_entry : 1; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */
116 uint32_t panscan_flag : 1; /* ENTRY_POINT_LAYER::PANSCAN_FLAG */
117 uint32_t loopfilter : 1; /* ENTRY_POINT_LAYER::LOOPFILTER */
118 };
119 uint32_t value;
120 } entrypoint_fields;
121 uint8_t conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */
122 uint8_t fast_uvmc_flag; /* ENTRY_POINT_LAYER::FASTUVMC */
123 union
124 {
125 struct
126 {
127 uint32_t luma_flag : 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */
128 uint32_t luma : 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */
129 uint32_t chroma_flag : 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */
130 uint32_t chroma : 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */
131 };
132 uint32_t range_mapping_enabled;
133 } range_mapping_fields;
134
135 uint8_t UpsamplingFlag;
136 uint8_t ScaleFactor; /* derived from BFRACTION*/
137 uint8_t b_picture_fraction; /* PICTURE_LAYER::BFRACTION */
138 uint8_t cbp_table; /* PICTURE_LAYER::CBPTAB/ICBPTAB */
139 uint8_t mb_mode_table; /* PICTURE_LAYER::MBMODETAB */
140 uint8_t range_reduction_frame; /* PICTURE_LAYER::RANGEREDFRM */
141 uint8_t rounding_control; /* PICTURE_LAYER::RNDCTRL */
142 uint8_t post_processing; /* PICTURE_LAYER::POSTPROC */
143 uint8_t picture_resolution_index; /* PICTURE_LAYER::RESPIC */
144 uint16_t luma_scale; /* PICTURE_LAYER::LUMSCALE */
145 uint16_t luma_shift; /* PICTURE_LAYER::LUMSHIFT */
146 union
147 {
148 struct
149 {
150 uint32_t picture_type : 3; /* PICTURE_LAYER::PTYPE */
151 uint32_t frame_coding_mode : 3; /* PICTURE_LAYER::FCM */
152 uint32_t top_field_first : 1; /* PICTURE_LAYER::TFF */
153 uint32_t is_first_field : 1; /* set to 1 if it is the first field */
154 uint32_t intensity_compensation : 1; /* PICTURE_LAYER::INTCOMP */
155 };
156 uint32_t value;
157 } picture_fields;
158 union
159 {
160 struct
161 {
162 uint32_t bitplane_present : 1;
163 uint32_t mv_type_mb : 1; /* PICTURE::MVTYPEMB */
164 uint32_t direct_mb : 1; /* PICTURE::DIRECTMB */
165 uint32_t skip_mb : 1; /* PICTURE::SKIPMB */
166 uint32_t field_tx : 1; /* PICTURE::FIELDTX */
167 uint32_t forward_mb : 1; /* PICTURE::FORWARDMB */
168 uint32_t ac_pred : 1; /* PICTURE::ACPRED */
169 uint32_t overflags : 1; /* PICTURE::OVERFLAGS */
170 };
171 uint32_t value;
172 } raw_coding;
173
174 union
175 {
176 struct
177 {
178 uint32_t reference_distance_flag : 1; /* PICTURE_LAYER::REFDIST_FLAG */
179 uint32_t reference_distance : 5; /* PICTURE_LAYER::REFDIST */
180 uint32_t BwdReferenceDistance : 5;
181 uint32_t num_reference_pictures : 1; /* PICTURE_LAYER::NUMREF */
182 uint32_t reference_field_pic_indicator : 1; /* PICTURE_LAYER::REFFIELD */
183 uint32_t reference_picture_flag : 1; /* set to 1 if it will be used as a reference picture */
184 };
185 uint32_t value;
186 } reference_fields;
187 union
188 {
189 struct
190 {
191 uint32_t MvMode : 4;
192 uint32_t UnifiedMvMode : 3; /* Combination of MVMODE and MVMODE1 */
193 uint32_t mv_table : 3; /* PICTURE_LAYER::MVTAB/IMVTAB */
194 uint32_t two_mv_block_pattern_table : 2; /* PICTURE_LAYER::2MVBPTAB */
195 uint32_t four_mv_switch : 1; /* PICTURE_LAYER::4MVSWITCH */
196 uint32_t four_mv_block_pattern_table : 2; /* PICTURE_LAYER::4MVBPTAB */
197 uint32_t extended_mv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */
198 uint32_t extended_mv_range : 2; /* PICTURE_LAYER::MVRANGE */
199 uint32_t extended_dmv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_DMV */
200 uint32_t extended_dmv_range : 2; /* PICTURE_LAYER::DMVRANGE */
201 uint32_t four_mv_allowed : 1; /* PICTURE_LAYER::4MVSWITCH */
202 };
203 uint32_t value;
204 } mv_fields;
205 union
206 {
207 struct
208 {
209 uint32_t dquant : 2; /* ENTRY_POINT_LAYER::DQUANT */
210 uint32_t quantizer : 2; /* ENTRY_POINT_LAYER::QUANTIZER */
211 uint32_t half_qp : 1; /* PICTURE_LAYER::HALFQP */
212 uint32_t AltPQuantEdgeMask : 4; /* Derived from DQUANT, DQUANTTFRM, DQPROFILE, DDQSBEDGE, DQDBEDGE, DQBILEVEL*/
213 uint32_t AltPQuantConfig : 2; /* Derived from DQUANT, DQUANTTFRM, DQPROFILE, DDQSBEDGE, DQDBEDGE, DQBILEVEL*/
214 uint32_t pic_quantizer_scale : 5; /* PICTURE_LAYER::PQUANT */
215 uint32_t pic_quantizer_type : 1; /* PICTURE_LAYER::PQUANTIZER */
216 uint32_t alt_pic_quantizer : 5; /* VOPDQUANT::ALTPQUANT */
217 };
218 uint32_t value;
219 } pic_quantizer_fields;
220 union
221 {
222 struct
223 {
224 uint32_t variable_sized_transform_flag : 1; /* ENTRY_POINT_LAYER::VSTRANSFORM */
225 uint32_t mb_level_transform_type_flag : 1; /* PICTURE_LAYER::TTMBF */
226 uint32_t frame_level_transform_type : 2; /* PICTURE_LAYER::TTFRM */
227 uint32_t transform_ac_codingset_idx1 : 2; /* PICTURE_LAYER::TRANSACFRM */
228 uint32_t transform_ac_codingset_idx2 : 2; /* PICTURE_LAYER::TRANSACFRM2 */
229 uint32_t intra_transform_dc_table : 1; /* PICTURE_LAYER::TRANSDCTAB */
230 };
231 uint32_t value;
232 } transform_fields;
233
234 uint32_t StatusReportFeedbackNumber;
235 } CODEC_VC1_PIC_PARAMS, *PCODEC_VC1_PIC_PARAMS;
236
237 typedef struct _CODEC_VC1_SLICE_PARAMS
238 {
239 uint32_t slice_data_size; /* number of bytes in the slice data buffer for this slice */
240 uint32_t slice_data_offset; /* the offset to the first byte of slice data */
241 uint32_t macroblock_offset; /* the offset to the first bit of MB from the first byte of slice data */
242 uint32_t slice_vertical_position;
243 uint32_t b_picture_fraction; /* BFRACTION */
244 uint32_t number_macroblocks; /* number of macroblocks in the slice */
245 } CODEC_VC1_SLICE_PARAMS, *PCODEC_VC1_SLICE_PARAMS;
246
247 typedef struct _CODEC_VC1_MB_PARAMS
248 {
249 uint16_t mb_address;
250 uint8_t mb_skips_following; /* the number of skipped macroblocks to be generated following the current macroblock */
251 uint8_t num_coef[CODEC_NUM_BLOCK_PER_MB]; /* the number of coefficients in the residual difference data buffer for each block i of the macroblock */
252 uint32_t data_offset; /* data offset in the residual data buffer, byte offset (32-bit multiple index) */
253 uint32_t data_length; /* length of the residual data for the macroblock */
254 union
255 {
256 struct
257 {
258 uint16_t intra_mb : 1;
259 uint16_t motion_forward : 1;
260 uint16_t motion_backward : 1;
261 uint16_t motion_4mv : 1;
262 uint16_t h261_loopfilter : 1;
263 uint16_t field_residual : 1;
264 uint16_t mb_scan_method : 2;
265 uint16_t motion_type : 2;
266 uint16_t host_resid_diff : 1;
267 uint16_t reserved : 1;
268 uint16_t mvert_field_sel_0 : 1;
269 uint16_t mvert_field_sel_1 : 1;
270 uint16_t mvert_field_sel_2 : 1;
271 uint16_t mvert_field_sel_3 : 1;
272 };
273 uint16_t value;
274 } mb_type;
275 union
276 {
277 struct
278 {
279 uint16_t block_coded_pattern : 6;
280 uint16_t block_luma_intra : 4;
281 uint16_t block_chroma_intra : 1;
282 uint16_t : 5;
283 };
284 uint16_t value;
285 } pattern_code;
286 union
287 {
288 struct
289 {
290 uint16_t mv_x : 16;
291 uint16_t mv_y : 16;
292 };
293 uint32_t value;
294 } motion_vector[4];
295 } CODEC_VC1_MB_PARAMS, *PCODEC_VC1_MB_PARAMS;
296
297 #endif // __CODEC_DEF_DECODE_VC1_H__
298