Debian Codegraph @

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

raw
1 /*
2 * Copyright (c) 2017-2024, 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_encode_avc.h
24 //! \brief Defines encode AVC types and macros shared by CodecHal, MHW, and DDI layer
25 //! \details Applies to AVC encode only. Should not contain any DDI specific code.
26 //!
27 #ifndef __CODEC_DEF_ENCODE_AVC_H__
28 #define __CODEC_DEF_ENCODE_AVC_H__
29
30 #include "codec_def_common_avc.h"
31 #include "codec_def_common_encode.h"
32 #include "codec_def_common.h"
33 #include "codec_def_encode.h"
34
35 #define CODEC_AVC_NUM_MAX_DIRTY_RECT 4
36 #define CODEC_AVC_NUM_QP 52
37
38 #define CODEC_AVC_MAX_QP 51
39 #define CODEC_AVC_MIN_QP_LP 10
40 #define CODEC_AVC_MIN_QP1 1
41 #define CODEC_AVC_MIN_QP5 5
42 // Minimum QP value for base/default platforms
43 #define CODEC_AVC_MIN_QP10 10
44
45 #define CODEC_AVC_NUM_WP_FRAME 8
46 #define CODEC_AVC_MAX_FORWARD_WP_FRAME 6
47 #define CODEC_AVC_MAX_BACKWARD_WP_FRAME 2
48 #define CODEC_AVC_WP_OUTPUT_L0_START 0
49 #define CODEC_AVC_WP_OUTPUT_L1_START 6
50
51 #define ENCODE_VDENC_AVC_MAX_ROI_NUMBER_G9 3 // Max 4 regions including non-ROI - used from DDI
52 #define ENCODE_VDENC_AVC_MAX_ROI_NUMBER_ADV 16 // Max 16 regions including non-ROI - used from DDI
53 #define ENCODE_VDENC_AVC_MIN_ROI_DELTA_QP_G9 -8 // Min delta QP for VDEnc ROI
54 #define ENCODE_VDENC_AVC_MAX_ROI_DELTA_QP_G9 7 // Max delta QP for VDEnc ROI
55
56 #define ENCODE_DP_AVC_MAX_ROI_NUMBER 4
57 #define ENCODE_DP_AVC_MAX_ROI_NUM_BRC 8
58
59 #define ENCODE_VDENC_AVC_MAX_ROI_NUMBER 3
60
61 #define ENCODE_AVC_MAX_SLICES_SUPPORTED 256 // Limted to 256 due to memory constraints.
62
63 //AVC
64 #define CODECHAL_ENCODE_AVC_ROI_WIDTH_SCALE_FACTOR 16
65 #define CODECHAL_ENCODE_AVC_ROI_FRAME_HEIGHT_SCALE_FACTOR 16
66 #define CODECHAL_ENCODE_AVC_ROI_FIELD_HEIGHT_SCALE_FACTOR 32
67 #define CODECHAL_ENCODE_AVC_MAX_ROI_NUMBER 4
68 #define CODECHAL_ENCODE_AVC_MAX_SLICE_QP (CODEC_AVC_NUM_QP - 1) // 0 - 51 inclusive
69 #define CODECHAL_ENCODE_AVC_MAX_ICQ_QUALITYFACTOR 51
70 #define CODECHAL_ENCODE_AVC_MIN_ICQ_QUALITYFACTOR 1
71 #define CODECHAL_ENCODE_AVC_MAX_SLICES_SUPPORTED 256
72 #define CODECHAL_ENCODE_AVC_MIN_STREAM_BUFFER_ALIGNMENT 4096
73 #define CODECHAL_DEBUG_ENCODE_AVC_NAL_START_CODE_SEI 0x00000106
74 #define CODECHAL_DEBUG_ENCODE_AVC_NAL_START_CODE_PPS 0x00000128
75 #define CODECHAL_ENCODE_AVC_MI_COPY_MEM_MEM_CMD_ALIGNMENT 4
76
77 typedef struct _CODECHAL_ENCODE_AVC_ROUNDING_PARAMS
78 {
79 bool bEnableCustomRoudingIntra;
80 bool bEnableCustomRoudingInter;
81 uint32_t dwRoundingIntra;
82 uint32_t dwRoundingInter;
83 } CODECHAL_ENCODE_AVC_ROUNDING_PARAMS, *PCODECHAL_ENCODE_AVC_ROUNDING_PARAMS;
84
85 // video quality control parameters
86 typedef struct _CODECHAL_ENCODE_AVC_QUALITY_CTRL_PARAMS
87 {
88 union
89 {
90 struct
91 {
92 // Disables skip check for ENC.
93 unsigned int skipCheckDisable : 1;
94 // Indicates app will override default driver FTQ settings using FTQEnable.
95 unsigned int FTQOverride : 1;
96 // Enables/disables FTQ.
97 unsigned int FTQEnable : 1;
98 // Indicates the app will provide the Skip Threshold LUT to use when FTQ is
99 // enabled (FTQSkipThresholdLUT), else default driver thresholds will be used.
100 unsigned int FTQSkipThresholdLUTInput : 1;
101 // Indicates the app will provide the Skip Threshold LUT to use when FTQ is
102 // disabled (NonFTQSkipThresholdLUT), else default driver thresholds will be used.
103 unsigned int NonFTQSkipThresholdLUTInput : 1;
104 // Control to enable the ENC mode decision algorithm to bias to fewer B Direct/Skip types.
105 // Applies only to B frames, all other frames will ignore this setting.
106 unsigned int directBiasAdjustmentEnable : 1;
107 // Enables global motion bias.
108 unsigned int globalMotionBiasAdjustmentEnable : 1;
109 // MV cost scaling ratio for HME predictors. It is used when
110 // globalMotionBiasAdjustmentEnable == 1, else it is ignored. Values are:
111 // 0: set MV cost to be 0 for HME predictor.
112 // 1: scale MV cost to be ? of the default value for HME predictor.
113 // 2: scale MV cost to be ? of the default value for HME predictor.
114 // 3: scale MV cost to be 1/8 of the default value for HME predictor.
115 unsigned int HMEMVCostScalingFactor : 2;
116 //disable HME
117 unsigned int HMEDisable : 1;
118 //disable Super HME
119 unsigned int SuperHMEDisable : 1;
120 //disable Ultra HME
121 unsigned int UltraHMEDisable : 1;
122 // Force RepartitionCheck
123 unsigned int ForceRepartitionCheck : 2;
124
125 };
126 unsigned int encControls;
127 };
128
129 // Maps QP to skip thresholds when FTQ is enabled. Valid range is 0-255.
130 unsigned char FTQSkipThresholdLUT[CODEC_AVC_NUM_QP];
131 // Maps QP to skip thresholds when FTQ is disabled. Valid range is 0-65535.
132 unsigned short NonFTQSkipThresholdLUT[CODEC_AVC_NUM_QP];
133 // Reserved for future use.
134 unsigned int reserved[8];
135 } CODECHAL_ENCODE_AVC_QUALITY_CTRL_PARAMS, *PCODECHAL_ENCODE_AVC_QUALITY_CTRL_PARAMS;
136
137 // AVC VUI Parameters
138 typedef struct _CODECHAL_ENCODE_AVC_VUI_PARAMS
139 {
140 uint32_t aspect_ratio_info_present_flag : 1;
141 uint32_t overscan_info_present_flag : 1;
142 uint32_t overscan_appropriate_flag : 1;
143 uint32_t video_signal_type_present_flag : 1;
144 uint32_t video_full_range_flag : 1;
145 uint32_t colour_description_present_flag : 1;
146 uint32_t chroma_loc_info_present_flag : 1;
147 uint32_t timing_info_present_flag : 1;
148 uint32_t fixed_frame_rate_flag : 1;
149 uint32_t nal_hrd_parameters_present_flag : 1;
150 uint32_t vcl_hrd_parameters_present_flag : 1;
151 uint32_t low_delay_hrd_flag : 1;
152 uint32_t pic_struct_present_flag : 1;
153 uint32_t bitstream_restriction_flag : 1;
154 uint32_t motion_vectors_over_pic_boundaries_flag : 1;
155 uint32_t : 17;
156 uint16_t sar_width;
157 uint16_t sar_height;
158 uint8_t aspect_ratio_idc;
159 uint8_t video_format;
160 uint8_t colour_primaries;
161 uint8_t transfer_characteristics;
162 uint8_t matrix_coefficients;
163 uint8_t chroma_sample_loc_type_top_field;
164 uint8_t chroma_sample_loc_type_bottom_field;
165 uint8_t max_bytes_per_pic_denom;
166 uint8_t max_bits_per_mb_denom;
167 uint8_t log2_max_mv_length_horizontal;
168 uint8_t log2_max_mv_length_vertical;
169 uint8_t num_reorder_frames;
170 uint32_t num_units_in_tick;
171 uint32_t time_scale;
172 uint8_t max_dec_frame_buffering;
173
174 //HRD parameters
175 uint8_t cpb_cnt_minus1;
176 uint8_t bit_rate_scale;
177 uint8_t cpb_size_scale;
178 uint32_t bit_rate_value_minus1[32];
179 uint32_t cpb_size_value_minus1[32];
180 uint32_t cbr_flag; // bit 0 represent SchedSelIdx 0 and so on
181 uint8_t initial_cpb_removal_delay_length_minus1;
182 uint8_t cpb_removal_delay_length_minus1;
183 uint8_t dpb_output_delay_length_minus1;
184 uint8_t time_offset_length;
185 } CODECHAL_ENCODE_AVC_VUI_PARAMS, *PCODECHAL_ENCODE_AVC_VUI_PARAMS;
186
187 typedef enum
188 {
189 CODECHAL_ENCODE_AVC_NAL_UT_RESERVED = 0x00, // Unspecified
190 CODECHAL_ENCODE_AVC_NAL_UT_SLICE = 0x01, // Coded Slice - slice_layer_no_partioning_rbsp
191 CODECHAL_ENCODE_AVC_NAL_UT_DPA = 0x02, // Coded Data partition A - dpa_layer_rbsp
192 CODECHAL_ENCODE_AVC_NAL_UT_DPB = 0x03, // Coded Data partition B - dpa_layer_rbsp
193 CODECHAL_ENCODE_AVC_NAL_UT_DPC = 0x04, // Coded Data partition C - dpa_layer_rbsp
194 CODECHAL_ENCODE_AVC_NAL_UT_IDR_SLICE = 0x05, // Coded Slice of a IDR Picture - slice_layer_no_partioning_rbsp
195 CODECHAL_ENCODE_AVC_NAL_UT_SEI = 0x06, // Supplemental Enhancement Information - sei_rbsp
196 CODECHAL_ENCODE_AVC_NAL_UT_SPS = 0x07, // Sequence Parameter Set - seq_parameter_set_rbsp
197 CODECHAL_ENCODE_AVC_NAL_UT_PPS = 0x08, // Picture Parameter Set - pic_parameter_set_rbsp
198 CODECHAL_ENCODE_AVC_NAL_UT_AUD = 0x09, // Access Unit Delimiter - access_unit_delimiter_rbsp
199 CODECHAL_ENCODE_AVC_NAL_UT_EOSEQ = 0x0a, // End of sequence - end_of_seq_rbsp
200 CODECHAL_ENCODE_AVC_NAL_UT_EOSTREAM = 0x0b, // End of stream - end_of_stream_rbsp
201 CODECHAL_ENCODE_AVC_NAL_UT_FILL = 0x0c, // Filler data - filler_data_rbsp
202 CODECHAL_ENCODE_AVC_NAL_UT_SEQEXT = 0x0d, // Sequence parameter set extension - seq_parameter_set_extension_rbsp
203 CODECHAL_ENCODE_AVC_NAL_UT_PREFIX = 0x0e, // Prefix NAL unit in scalable extension - prefix_nal_unit_rbsp
204 CODECHAL_ENCODE_AVC_NAL_UT_SUBSEQ = 0x0f, // Subset sequence parameter set - subset_seq_parameter_set_rbsp
205 /* 0x10..0x12 - Reserved */
206 CODECHAL_ENCODE_AVC_NAL_UT_LAYERNOPART = 0x13, // Coded slice of an auxiliary coded picture without paritioning - slice_layer_without_partitioning_rbsp
207 CODECHAL_ENCODE_AVC_NAL_UT_LAYERSCALEEXT = 0x14, // Coded slice in scalable extension - slice_layer_in_scalable_extension_rbsp
208 /* 0x15..0x17 - Reserved */
209 /* 0x18..0x1f - Unspcified */
210
211 //this should be the last element of this enum
212 //chagne this value if NAL unit type increased
213 CODECHAL_ENCODE_AVC_MAX_NAL_TYPE = 0x1f,
214 } CODECHAL_ENCODE_AVC_NAL_UNIT_TYPE;
215
216 // Range 0...4: all slices of the current picture can have differing slice type
217 enum
218 {
219 SLICE_P = 0,
220 SLICE_B = 1,
221 SLICE_I = 2,
222 SLICE_SP = 3,
223 SLICE_SI = 4
224 };
225 // Range 5...9: all slices of the current picture have the same slice type
226 enum
227 {
228 FRAME_P = SLICE_P + 5,
229 FRAME_B = SLICE_B + 5,
230 FRAME_I = SLICE_I + 5,
231 FRAME_SP = SLICE_SP + 5,
232 FRAME_SI = SLICE_SI + 5
233 };
234 typedef enum
235 {
236 CODECHAL_ENCODE_AVC_SINGLE_PASS = 0,
237 CODECHAL_ENCODE_AVC_ICHAT = 1,
238 CODECHAL_ENCODE_AVC_CAPTURE = 4,
239 CODECHAL_ENCODE_AVC_APM = 20
240 } CODECHAL_ENCODE_AVC_ENCODER_USAGE;
241
242 const uint8_t Slice_Type[10] = { SLICE_P, SLICE_B, SLICE_I, SLICE_SP, SLICE_SI, SLICE_P, SLICE_B, SLICE_I, SLICE_SP, SLICE_SI };
243
244 typedef struct _CODEC_ROI_MAP
245 {
246 char PriorityLevelOrDQp; // [-3..3] or [-51..51]
247 uint8_t NumRect;
248 CODEC_ROI Rect[16]; // disconnected areas which have same PriorityLevelOrDQp
249 } CODEC_ROI_MAP, *PCODEC_ROI_MAP;
250
251 typedef struct _CODEC_PIC_REORDER
252 {
253 uint32_t PicNum;
254 uint32_t POC;
255 uint8_t ReorderPicNumIDC;
256 uint8_t DiffPicNumMinus1;
257 uint32_t LongTermPicNum;
258 CODEC_PICTURE Picture;
259 } CODEC_PIC_REORDER, *PCODEC_PIC_REORDER;
260
261 typedef struct _CODEC_SLICE_MMCO
262 {
263 uint8_t MmcoIDC;
264 uint32_t DiffPicNumMinus1;
265 uint32_t LongTermPicNum;
266 uint32_t LongTermFrameIdx;
267 uint32_t MaxLongTermFrameIdxPlus1;
268 } CODEC_SLICE_MMCO, *PCODEC_SLICE_MMCO;
269
270 /*! \brief Provides the sequence-level parameters of a compressed picture for AVC encoding.
271 *
272 * The framework is expected to only send a sequence parameter compressed buffer for the first picture(first Execute() call) in a sequence, associated with a RAP(IDR, CRA, BLA) picture.
273 */
274 typedef struct _CODEC_AVC_ENCODE_SEQUENCE_PARAMS
275 {
276 uint16_t FrameWidth; //!< Width of the frame in pixels.
277 uint16_t FrameHeight; //!< Height of the frame in pixels.
278 uint8_t Profile; //!< Same as AVC syntax parameter profile_idc.
279 uint8_t Level; //!< Same as AVC syntax parameter level_idc.
280
281 uint16_t GopPicSize; //!< Distance between IRAP pictures.
282 /*! \brief Distance between anchor frames (I or P).
283 *
284 * Here, P may also means low delay B (GPB) frames.
285 * Programming Note: GopPicSize > GopRefDist should be ensured by application. It is required by BRC.
286 */
287 uint16_t GopRefDist;
288 uint16_t GopOptFlag : 2;
289 uint16_t : 6;
290
291 uint8_t TargetUsage;
292 /*! \brief Specifies rate control method.
293 *
294 * \n 0: CQP, if set, internal BRC, multi-pass and panic mode will be disabled
295 * \n 1: CBR
296 * \n 2: VBR
297 * \n 3: CQP, see above
298 * \n 4: AVBR, if set, HRD compliance is not guaranteed. Buffering period SEI and picture timing SEI messages are not necessary for AVBR.
299 * \n 5: Reserved
300 * \n 6: Reserved
301 * \n 7: Reserved
302 * \n 8: LA, look ahead
303 * \n 9: ICQ (Intelligent Constant Quality)
304 * \n 10: VCM, defined for video converencing
305 * \n 11: LA_ICQ
306 * \n 12: LA_EXT, defined for server transcoding usage, 1 input video sequence generates several sequences with different bitrate
307 * \n 13: LA_HRD, defined for server and client usage, lookahead with HRD and strict handling of maximum bitrate window
308 * \n 14: QVBR (Quality Regulated VBR)
309 * \n Programming note: Define the minimum value as indicated above for AVBR accuracy & convergence, clamp any value that is less than the minimum value to the minimum value. Define the maximum value for AVBR accuracy as 100 (10%) and for AVBR convergence as 500, clamp any value that is greater than the maximum value to the maximum value. The maximum & minimum value may be adjusted when necessary. If bResetBRC is set to 1 for a non-I picture, driver shall not insert SPS into bitstream. Driver needs to calculate the maximum allowed frame size per profile/level for all RateControlMethod except CQP, and use the calculated value to program kernel for non AVBR modes; for AVBR mode, driver needs to clamp the upper bound of UserMaxFrameSize to the calculated value and use the clamped UserMaxFrameSize to program kernel. If IWD_VBR is set, driver programs it the same as VBR except not to enable panic mode.
310 */
311 uint8_t RateControlMethod;
312 uint32_t TargetBitRate; //!< Target bit rate in bit per second
313 uint32_t MaxBitRate; //!< Maximum bit rate in bit per second
314 /*! \brief Minimun bit rate in bit per second.
315 *
316 * This is used in VBR control. For CBR control, this field is ignored.
317 */
318 uint32_t MinBitRate;
319 uint16_t FramesPer100Sec; //!< Total frames per 100 second (frame rate fps * 100).
320 uint32_t InitVBVBufferFullnessInBit; //!< Initial VBV buffer fullness in bits.
321 /*! \brief VBV buffer size in bit unit.
322 *
323 * The AVC spec defines a max coded picture buffer size for each level.
324 */
325 uint32_t VBVBufferSizeInBit;
326 /*! \brief Specifies number of reference frames.
327 *
328 * Should not be greater than driver reported max number of references.
329 */
330 uint8_t NumRefFrames;
331
332 /*! \brief Same as AVC syntax element.
333 *
334 * Should not be greater than max SPS set reported by driver.
335 */
336 uint8_t seq_parameter_set_id;
337 uint8_t chroma_format_idc; //!< Same as AVC syntax element.
338 uint8_t bit_depth_luma_minus8; //!< Same as AVC syntax element.
339 uint8_t bit_depth_chroma_minus8; //!< Same as AVC syntax element.
340 uint8_t log2_max_frame_num_minus4; //!< Same as AVC syntax element.
341 uint8_t pic_order_cnt_type; //!< Same as AVC syntax element.
342 uint8_t log2_max_pic_order_cnt_lsb_minus4; //!< Same as AVC syntax element.
343 uint8_t num_ref_frames_in_pic_order_cnt_cycle; //!< Same as AVC syntax element.
344 int32_t offset_for_non_ref_pic; //!< Same as AVC syntax element.
345 int32_t offset_for_top_to_bottom_field; //!< Same as AVC syntax element.
346 int32_t offset_for_ref_frame[256]; //!< Same as AVC syntax element.
347 uint16_t frame_crop_left_offset; //!< Same as AVC syntax element.
348 uint16_t frame_crop_right_offset; //!< Same as AVC syntax element.
349 uint16_t frame_crop_top_offset; //!< Same as AVC syntax element.
350 uint16_t frame_crop_bottom_offset; //!< Same as AVC syntax element.
351
352 uint16_t seq_scaling_list_present_flag[12]; //!< Same as AVC syntax element.
353 uint16_t seq_scaling_matrix_present_flag : 1; //!< Same as AVC syntax element.
354 uint16_t delta_pic_order_always_zero_flag : 1; //!< Same as AVC syntax element.
355 uint16_t frame_mbs_only_flag : 1; //!< Same as AVC syntax element.
356 uint16_t direct_8x8_inference_flag : 1; //!< Same as AVC syntax element.
357 uint16_t vui_parameters_present_flag : 1; //!< Same as AVC syntax element.
358 uint16_t frame_cropping_flag : 1; //!< Same as AVC syntax element.
359 /*! \brief Specifies that encoded slices returned fit within the slice size specified in the picture parameter set for AVC.
360 *
361 * When enabled, this overrides the slice structures specified by the application using slice level parameters.
362 */
363 uint16_t EnableSliceLevelRateCtrl : 1;
364 uint16_t : 8;
365 union
366 {
367 struct
368 {
369 uint32_t bInitBRC : 1;
370 /*! \brief Indicate if a BRC reset is desired to set a new bit rate or frame rate.
371 *
372 * This setting is only valid if RateControlMethod is AVBR, VBR, CBR, VCM, ICQ, CQL or QVBR and the current picture is an I picture. If the frame resolution is changed, it should be set with IDR picture. It should not be set when RateControlMethod is CBR or CQP. The following table indicates which BRC parameters can be changed via a BRC reset.
373 *
374 * \n BRC Parameters Changes allowed via reset
375 * \n Profile & Level Yes
376 * \n UserMaxFrameSize Yes
377 * \n InitVBVBufferFullnessInBit No
378 * \n TargetBitRate Yes
379 * \n VBVBufferSizeInBit No
380 * \n MaxBitRate Yes
381 * \n FramesPer100Sec * No
382 * \n RateControlMethod No
383 * \n GopPicSize No
384 * \n GopRefDist No
385 * \n GopOptFlag Yes
386 * \n FrameWidth No
387 * \n FrameHeight No
388 * \n Note: when resolution (FrameWidth and/or FrameHeight) changes, framework should re-start a new bit stream and not using BRC reset.
389 */
390 uint32_t bResetBRC : 1;
391 /*! \brief Indicates that current SPS is just a BRC parameter update, not a SPS change to be inserted into the bitstream.
392 *
393 * When set to 1, current SPS will not be packed and inserted into bitstream by the driver.
394 */
395 uint32_t bNoAcceleratorSPSInsertion : 1;
396 /*! \brief Indicates the global search options.
397 *
398 * It is only valid if EnhancedEncInput is reported during capability checking:
399 * \n - 0: Default - option internally selected based on target usage
400 * \n - 1: Long - SHME enabled
401 * \n - 2: Medium - HME only enabled, SHME disabled
402 * \n - 3: Short - SHME/HME disabled
403 */
404 uint32_t GlobalSearch : 2;
405 /*! \brief Indicates the local search options.
406 *
407 * It is only valid if EnhancedEncInput is reported during capability checking:
408 * \n - 0: Default - option internally selected based on target usage
409 * \n - 1: Tiny – MaxLenSP = 4, Reference Window = 24x24 SP = Spiral
410 * \n - 2: Small – MaxLenSP = 9, Reference Window = 28x28 SP = Spiral
411 * \n - 3: Square – MaxLenSP = 16, Reference Window = 32x32 SP = Spiral
412 * \n - 4: Diamond – MaxLenSP = 16, Reference Window = 48x40 SP = Diamond
413 * \n - 5: Large Diamond – MaxLenSP = 30, Reference Window = 48x40 SP = Diamond
414 * \n - 6: Exhaustive – MaxLenSP = 57, Reference Window = 48x40 SP = Spiral
415 * \n - 7: Heavy Horizontal – MaxLenSP = 57, Reference Window = 64x32 SP = Spiral
416 * \n - 8: Heavy Vertical – MaxLenSP = 57, Reference Window = 32x64 SP = Spiral
417 */
418 uint32_t LocalSearch : 4;
419 /*! \brief Indicates early skip control.
420 *
421 * It is only valid if EnhancedEncInput is reported during capability checking:
422 * \n - 0: Default, decided internally
423 * \n - 1: EarlySkip enabled
424 * \n - 2: EarlySkip disabled
425 */
426 uint32_t EarlySkip : 2;
427 uint32_t Reserved0 : 1;
428 /*! \brief Indicates that MB BRC is enabled.
429 *
430 * It is only valid if MBBRCSupport is reported during capability checking:
431 * \n - 0: Default, decided internally based on target usage.
432 * \n - 1: MB BRC enabled.
433 * \n - 2: MB BRC disabled.
434 * \n - Other values are Reserved.
435 * \n Currently MB BRC can be applied to all bit rate control methods except CQP.
436 */
437 uint32_t MBBRC : 4;
438 /*! \brief Indicates trellis control.
439 *
440 * The Trellis_I, Trellis_P and Trellis_B settings may be combined using bitwise OR like "Trellis_I | Trellis_P" to enable Trellis for I & P. If Trellis_Disabled is set with any combination, Trellis will be disabled.
441 * \n - 0: Trellis_Default – Trellis decided internally.
442 * \n - 1: Trellis_Disabled – Trellis disabled for all frames/fields.
443 * \n - 2: Trellis_I – Trellis enabled for I frames/fields.
444 * \n - 4: Trellis_P – Trellis enabled for P frames/fields.
445 * \n - 8: Trellis_B – Trellis enabled for B frames/fields.
446 */
447 uint32_t Trellis : 4;
448 /*! \brief Indicates current sequence is encoded for Temporal Scalability.
449 * The driver may or may not use this flag. For example, for VME+PAK AVC encoder MSDK handles all header insertion to indicate a temporal id in the SVC ext slice header and this flag is not used. However, for VDEnc AVC encoder in certain cases BRC is required to know if the current frames are being encoded for temporal scalability and therefore will have extra SVC ext added in the slice header.
450 * \n - 0: Default, current sequence is not encoded for Temporal Scalability.
451 * \n - 1: current sequence is encoded is encoded for Temporal Scalability.
452 */
453 uint32_t bTemporalScalability : 1;
454 /*! \brief Indicates ROI[] value is in delta QP or priority.
455 *
456 * It is valid only when parameter NumROI is greater than 0 and either ROIDeltaQPSupport or ROIBRCPriorityLevelSupport equals to 1.
457 * \n - 0: Default, ROI[] value is in priority.
458 * \n - 1: ROI[] value is in delta QP.
459 * \n Currently only ROIValueInDeltaQP equal 1 is validated for CQP
460 */
461 uint32_t ROIValueInDeltaQP : 1;
462 /*! \brief Indicates larger P/B frame size than UserMaxPBFrameSize may be used.
463 *
464 * if enabled, BRC may decide a larger P or B frame size than what UserMaxPBFrameSize dictates when the scene change is detected.
465 * \n - 0: Default, normal BRC.
466 * \n - 1: BRC may decide larger P/B frame size.
467 */
468 uint32_t bAutoMaxPBFrameSizeForSceneChange : 1;
469 /* Control the force panic mode through DDI other than user feature key */
470 uint32_t bForcePanicModeControl : 1;
471 uint32_t bPanicModeDisable : 1;
472
473 /*! \brief Enables streaming buffer in LLC
474 *
475 * \n - 0 : streaming buffer by LLC is disabled.
476 * \n - 1 : streaming buffer by LLC is enabled.
477 */
478 uint32_t EnableStreamingBufferLLC : 1;
479 /*! \brief Enables streaming buffer in DDR
480 *
481 * \n - 0 : streaming buffer by DDR is disabled.
482 * \n - 1 : streaming buffer by DDR is enabled.
483 */
484 uint32_t EnableStreamingBufferDDR : 1;
485 /*! \brief Indicates whether or not the encoding is in hierarchical GOP structure, for both RA B and LD B frame types
486 *
487 * \n - 0 : BRC would treat it as flat structure.
488 * \n - 1 : hierarchical structure.
489 * \n In another word, this flag is equivalent to Qp Modulation enabling flag. If HierarchicalFlag == 1, app would enable Qp modulation for either random access or low delay hierarchical structure.
490 */
491 uint32_t HierarchicalFlag : 1;
492 /*! \brief Indicates whether or not the encoding is in low delay mode.
493 *
494 * \n - 0 : the non-base temporal layers should be coded as random access B frames.
495 * \n - 1 : no random access B will be coded. And the coding type could be only I or P.
496 * \n Note: this flag only indicates the frame coding type, and is not related to BRC low delay mode.
497 */
498 uint32_t LowDelayMode : 1;
499 /*! \brief Indicates if current encodin gis lookahead pass.
500 *
501 * \n - 0 : the current encoding is in the actual encoding pass, and one of the BRC modes (CBR, VBR, etc.) should be selected.
502 * \n - 1 : the current encoding is in the lookahead pass.
503 * \n Valid only when LookAheadAnalysisSupport in CAP is on and LookAheadDepth > 0.
504 */
505 uint32_t bLookAheadPhase : 1;
506 uint32_t Reserved1 : 2;
507 };
508 uint32_t sFlags;
509 };
510 /*! \brief Framework defined maximum frame size in bytes for I frames.
511 *
512 * Applicable for all RateControlMethod values except CQP; guarantees that the compressed frame size will be less than this value. If UserMaxPBFrameSize equals 0, UserMaxIFrameSize will be used for all frame types. Maximum allowed frame size per profile/level will be calculated in driver and be used when UserMaxIFrameSize and UserMaxPBFrameSize are both set to 0.
513 */
514 uint32_t UserMaxFrameSize;
515 /*! \brief Framework defined maximum frame size in bytes for P & B frames.
516 *
517 * Applicable for all RateControlMethod values except CQP; guarantees that the compressed frame size will be less than this value. If UserMaxPBFrameSize equals 0, UserMaxIFrameSize will be used for all frame types. Maximum allowed frame size per profile/level will be calculated in driver and be used when UserMaxIFrameSize and UserMaxPBFrameSize are both set to 0.
518 */
519 uint32_t UserMaxPBFrameSize;
520 /*! \brief Indicates the measure of quality for ICQ and QVBR
521 *
522 * The range is from 1 – 51, with 1 being the best quality.
523 */
524 uint16_t ICQQualityFactor;
525 /*! \brief Indicates the bitrate accuracy for AVBR
526 *
527 * The range is [1, 100], 1 means one percent, and so on.
528 */
529 uint32_t AVBRAccuracy;
530 /*! \brief Indicates the bitrate convergence period for AVBR
531 *
532 * The unit is frame.
533 */
534 uint32_t AVBRConvergence;
535
536 /*! \brief Indicates the uncompressed input color space
537 *
538 * Valid only when input is ARGB format.
539 */
540 ENCODE_INPUT_COLORSPACE InputColorSpace;
541 /*! \brief Provides a hint to encoder about the scenario for the encoding session.
542 *
543 * BRC algorithm may tune differently based on this info.
544 */
545 ENCODE_SCENARIO ScenarioInfo;
546 ENCODE_CONTENT ContentInfo; //!< Provides a hint to encoder about the content for the encoding session.
547
548 /*! \brief Indicates the tolerance the application has to variations in the frame size.
549 *
550 * It affects the BRC algorithm used, but may or may not have an effect based on the combination of other BRC parameters. Only valid when the driver reports support for FrameSizeToleranceSupport.
551 */
552 ENCODE_FRAMESIZE_TOLERANCE FrameSizeTolerance;
553
554 /*! \brief Indicates BRC Sliding window size in terms of number of frames.
555 *
556 * Defined for CBR and VBR. For other BRC modes or CQP, values are ignored.
557 */
558 uint16_t SlidingWindowSize;
559
560 /*! \brief Indicates maximun bit rate Kbit per second within the sliding window during.
561 *
562 * Defined for CBR and VBR. For other BRC modes or CQP, values are ignored.
563 */
564 uint32_t MaxBitRatePerSlidingWindow;
565
566 /*! \brief Indicates minimun bit rate Kbit per second within the sliding window during.
567 *
568 * Defined for CBR and VBR. For other BRC modes or CQP, values are ignored.
569 */
570 uint32_t MinBitRatePerSlidingWindow;
571
572 /*! \brief Indicates number of frames to lookahead.
573 *
574 * Range is [0~127]. Default is 0 which means lookahead disabled. Valid only when LookaheadBRCSupport is 1. When not 0, application should send LOOKAHEADDATA buffer to driver.
575 */
576 uint8_t LookaheadDepth;
577
578 uint8_t constraint_set0_flag : 1; //!< Same as AVC syntax element.
579 uint8_t constraint_set1_flag : 1; //!< Same as AVC syntax element.
580 uint8_t constraint_set2_flag : 1; //!< Same as AVC syntax element.
581 uint8_t constraint_set3_flag : 1; //!< Same as AVC syntax element.
582 uint8_t : 4;
583 uint8_t separate_colour_plane_flag; //!< Same as AVC syntax element.
584 bool qpprime_y_zero_transform_bypass_flag; //!< Same as AVC syntax element.
585 bool gaps_in_frame_num_value_allowed_flag; //!< Same as AVC syntax element.
586 uint16_t pic_width_in_mbs_minus1; //!< Same as AVC syntax element.
587 uint16_t pic_height_in_map_units_minus1; //!< Same as AVC syntax element.
588 bool mb_adaptive_frame_field_flag; //!< Same as AVC syntax element.
589 } CODEC_AVC_ENCODE_SEQUENCE_PARAMS, *PCODEC_AVC_ENCODE_SEQUENCE_PARAMS;
590
591 typedef struct _CODEC_AVC_ENCODE_USER_FLAGS
592 {
593 union
594 {
595 struct
596 {
597 /*! \brief Indicates that raw pictures should be used as references instead of recon pictures.
598 *
599 * Setting to 1 may improve performance at the cost of image quality. The accelerator may or may not support toggling this value on a per frame basis.
600 */
601 uint32_t bUseRawPicForRef : 1;
602 /*! \brief Indicates whether or not the driver will pack non-slice headers.
603 *
604 * Applies to ENC + PAK mode only. This flag is only valid only when AcceleratorHeaderPacking = 1, and driver does the header packing.
605 * \n - 0: Accelerator will pack AU delimiter, SPS (including VUI if present), PPS, SEI messages if present, end of sequence if indicated, and end of stream if indicated, along with coded slice to form a complete bitstream.
606 * \n - 1: Accelerator will just pack coded slice (slice header + data), like in PAK only mode, and the application will pack the rest of the headers.
607 */
608 uint32_t bDisableAcceleratorHeaderPacking : 1;
609 /*! \brief Indicates whether or not the driver will try to introduce reordering.
610 *
611 * Applies to ENC + PAK mode only. This flag is only valid only when AcceleratorHeaderPacking = 1, and driver does the header packing.
612 * \n - 0: Accelerator will try to optimize the order of reference frames in the lists and generate ref_pic_list_modification part of slice header if necessary.
613 * \n - 1: Accelerator will use reference picture list as is (e.g. it can be prepared by the app) to generate ref_pic_list_modification part of slice header if necessary.
614 */
615 uint32_t bDisableAcceleratorRefPicListReordering : 1;
616 uint32_t : 4;
617 uint32_t bDisableSubMBPartition : 1; //!< Indicates that sub MB partitioning should be disabled.
618 /*! \brief Inidicates whether or not emulation byte are inserted.
619 *
620 * If 1, accelerator will perform start code prefix (0x 00 00 01/02/03/00) search and emulation byte (0x 03) insertion on packed header data. This doesn’t apply to packed slice header data. Packed slice header data must not have emulation byte inserted, accelerator will always perform start code prefix search and emulation byte (0x 03) insertion on packed slice header data.
621 * Note: If cabac_zero_word insertion compliance is required, this value should be set to 0. This means the application must perform emulation prevention byte insertion in the frame header. This is due to the restriction in MFX_PAK_INSERT_OBJECT HeaderLengthExcludeFrmSize cannot allow EmulationFlag to be true.
622 */
623 uint32_t bEmulationByteInsertion : 1;
624 /*! \brief Specifies the type of intra refresh used.
625 *
626 * Effective only when RollingINtraRefresh capability in use. Applies to P pictures only (not valid with IBP). When used field encoding, B frames, and multiple references are not allowed.
627 * \n - 0 : disabled
628 * \n - 1 : enabled in colum
629 * \n - 2 : enabled in row
630 * \n - 3 : enabled in region
631 */
632 uint32_t bEnableRollingIntraRefresh : 2;
633
634 /*! \brief Specifies if Slice Level Reporitng may be requested for this frame
635 *
636 * If this flag is set, then slice level parameter reporting will be set up for this frame. Only valid if SliceLevelReportSupport is reported in ENCODE_CAPS, else this flag is ignored.
637 *
638 */
639 uint32_t bEnableSliceLevelReport : 1;
640
641 /*! \brief Specifies if integer mode searching is performed
642 *
643 * when set to 1, integer mode searching is performed
644 *
645 */
646 uint32_t bDisableSubpixel : 1;
647
648 /*! \brief Specifies if the overlapped operation of intra refresh is disabled
649 *
650 * It is valid only when bEnableRollingIntraRefresh is on.
651 * \n - 0 : default, overlapped Intra refresh is applied
652 * \n - 1 : intra refresh without overlap operation
653 *
654 */
655 uint32_t bDisableRollingIntraRefreshOverlap : 1;
656
657 /*! \brief Specifies whether extra partition decision refinement is done after the initial partition decision candidate is determined.
658 *
659 * It has performance tradeoff for better quality.
660 * \n - 0 : DEFAULT - Follow driver default settings.
661 * \n - 1 : FORCE_ENABLE - Enable this feature totally for all cases.
662 * \n - 2 : FORCE_DISABLE - Disable this feature totally for all cases.
663 */
664 uint32_t ForceRepartitionCheck : 2;
665 uint32_t bReserved : 16;
666 };
667 uint32_t Value;
668 };
669 } CODEC_AVC_ENCODE_USER_FLAGS, *PCODEC_AVC_ENCODE_USER_FLAGS;
670
671 typedef struct _CODEC_AVC_ENCODE_FORCE_SKIP_PARAMS
672 {
673 uint32_t Enable;
674 uint32_t Xpos;
675 uint32_t Ypos;
676 uint32_t Width;
677 uint32_t Height;
678
679 } CODEC_AVC_ENCODE_FORCE_SKIP_PARAMS, *PCODEC_AVC_ENCODE_FORCE_SKIP_PARAMS;
680
681 /*! \brief Provides the picture-level parameters of a compressed picture for AVC encoding.
682 */
683 typedef struct _CODEC_AVC_ENCODE_PIC_PARAMS
684 {
685 /*! \brief Specifies the uncompressed source surface of the frame for the current picture to be encode.
686 *
687 * The PicFlags regarding reference usage are expected to be valid at this time.
688 */
689 CODEC_PICTURE CurrOriginalPic;
690 /*! \brief Specifies the uncompressed surface of the reconstructed frame for the current encoded picture.
691 *
692 * The PicFlags regarding reference usage are expected to be valid at this time.
693 * The recon surface may be of different format and different bit depth from that of source.
694 * The framework needs to specify it through chroma_format_idc and bit_depth_luma_minus8 and
695 * bit_depth_chroma_minus8 in SPS data structure.
696 */
697 CODEC_PICTURE CurrReconstructedPic;
698 /*! \brief Specifies picture coding type.
699 *
700 * \n 1: I picture
701 * \n 2: P picture
702 * \n 3: B picture
703 */
704 uint8_t CodingType;
705 /*! \brief Specifies that field mode coding is in use.
706 *
707 * Top or bottom field indicated by CurrOriginalPic.PicFlags.
708 */
709 uint8_t FieldCodingFlag : 1;
710 /*! \brief Specifies that MBAFF coding mode is in use.
711 *
712 * It shall not be set if NoFieldFrame flag is reported in CodingLimit during capability checking.
713 */
714 uint8_t FieldFrameCodingFlag : 1;
715 uint8_t : 6;
716 /*! \brief Specifies the number of slices per frame or per field in field coding.
717 *
718 * Note the restriction on slice based on the SliceStructure reported during capability checking.
719 */
720 uint32_t NumSlice;
721
722 /*! \brief Quantization parameter for Y.
723 *
724 * Valid range is 0 - 51. If QpY is set to -1, driver will use an internal default value when CQP is not set, otherwise, driver will return error. Please note that, QpY is a frame level QP. QP for each slice is determined by QpY + slice_qp_delta. And QpY + slice_qp_delta should be also in the range of 0 – 51, inclusive.
725 */
726 char QpY;
727 /*! \brief Each entry of the list specifies the frame index of the reference pictures.
728 *
729 * The value of FrameIdx specifies the index of RefFrameList structure. And valid value range is [0..14, 0x7F]. Invalid entries are indicated by setting PicFlags to PICTURE_INVALID.
730 * RefFrameList[] should include all the reference pictures in DPB, which means either the picture is referred by current picture or future pictures, it should have a valid entry in it.
731 */
732 CODEC_PICTURE RefFrameList[CODEC_AVC_MAX_NUM_REF_FRAME];
733
734
735 /*! \brief Each entry of the list specifies the frame resource of the reference pictures.
736 *
737 * The value of FrameIdx is the same as the reference frame index saved in RefList. And valid value range is [0..14, 0x7F].
738 * RefFrameList[] should include all the reference pictures in DPB, which means either the picture is referred by current picture or future pictures, it should have a valid entry in it.
739 * currently only for Vulkan encode
740 */
741 MOS_SURFACE RefFrameListSurface[CODEC_AVC_MAX_NUM_REF_FRAME];
742
743 /*! \brief Denotes "used for reference" frames as defined in the AVC specification.
744 *
745 * The flag is accessed by:
746 * \n - FlagTop(i) = (UsedForReferenceFlags >> (2 * i)) & 1
747 * \n - FlagBottom(i) = (UsedForReferenceFlags >> (2 * i + 1)) & 1
748 * \n If FlagTop(i) is 1, the top field or frame numger i is marked as "used for reference"; if FlagBottom(i) is 1 then then bottom field of frame i is marked as "used for reference". If either is 0 then the frame is not marked as "used for reference".
749 */
750 uint32_t UsedForReferenceFlags;
751 /*! \brief Contains the picture order counts (POC) for the current frame
752 *
753 * If field_pic_flag is 0:
754 * \n - CurrFieldOrderCnt[0] contains the top field order count for the current picture
755 * \n - CurrFieldOrderCnt[1] contains the bottom field order count for the current picture
756 * \n If field_pic_flag is 1 and CurrPic.PicFlags indicates that this is a top field:
757 * \n - CurrFieldOrderCnt[0] contains the top field order count for the current picture
758 * \n - CurrFieldOrderCnt[1]
759 * \n If field_pic_flag is 1 and CurrPic.PicFlags indicates that this is a bottom field:
760 * \n - CurrFieldOrderCnt[0] should be 0 or ignored
761 * \n - CurrFieldOrderCnt[1] contains the bottom field order count for the current picture
762 */
763 int32_t CurrFieldOrderCnt[2];
764 /*! \brief Contains the POCs for the reference frames in RefFrameList.
765 *
766 * For each entry FieldOrderCntList[i][j]:
767 * \n - i: the picture index
768 * \n - j: 0 specifies the top field order count and 1 specifies the bottom field order count
769 * \n If a entry i in RefFrameList is not relevant (it is not used for reference) or valid, the entry FieldOrderCount[i][0 and 1] should be 0.
770 */
771 int32_t FieldOrderCntList[16][2];
772 uint16_t frame_num; //!< Same as AVC syntax element.
773 bool bLastPicInSeq; //!< Indicate whether to insert sequence closing NAL unit.
774 bool bLastPicInStream; //!< Indicate whether to insert stream closing NAL unit.
775
776 CODEC_AVC_ENCODE_USER_FLAGS UserFlags;
777 CODEC_AVC_ENCODE_FORCE_SKIP_PARAMS ForceSkip;
778 bool bStreamOutEnbleSinglePassvdenc;
779 bool bHMEActiveCtrlFrmApp;
780 bool bHMEActive;
781
782 /*! \brief Arbitrary number set by the host decoder to use as a tag in the status report feedback data.
783 *
784 * The value should not equal 0, and should be different in each call to Execute.
785 */
786 uint32_t StatusReportFeedbackNumber;
787
788 uint8_t bIdrPic; //!< Indicates that the current picture is IDR.
789 uint8_t pic_parameter_set_id; //!< Same as AVC syntax element.
790 uint8_t seq_parameter_set_id; //!< Same as AVC syntax element.
791 uint8_t num_ref_idx_l0_active_minus1; //!< Same as AVC syntax element.
792 uint8_t num_ref_idx_l1_active_minus1; //!< Same as AVC syntax element.
793 char chroma_qp_index_offset; //!< Same as AVC syntax element.
794 char second_chroma_qp_index_offset; //!< Same as AVC syntax element.
795
796 uint16_t pic_scaling_list_present_flag[12]; //!< Same as AVC syntax element.
797 uint16_t entropy_coding_mode_flag : 1; //!< Same as AVC syntax element.
798 uint16_t pic_order_present_flag : 1; //!< Same as AVC syntax element.
799 uint16_t weighted_pred_flag : 1; //!< Same as AVC syntax element.
800 uint16_t weighted_bipred_idc : 2; //!< Same as AVC syntax element.
801 uint16_t constrained_intra_pred_flag : 1; //!< Same as AVC syntax element.
802 uint16_t transform_8x8_mode_flag : 1; //!< Same as AVC syntax element.
803 uint16_t pic_scaling_matrix_present_flag : 1; //!< Same as AVC syntax element.
804 uint16_t RefPicFlag : 1; //!< Indicates that the current picture (raw or recon) may be used as a reference for encoding other pictures.
805 /*! \brief Indicates how precise the framework would like BRC to be to reach the ideal requested framesize.
806 *
807 * The driver will internally make programming decisions based on this parameter, it will be a tradeoff between performance and precision. This flag is ignored if BRC is not enabled (CQP mode).
808 * \n - 0: default precision (normal)
809 * \n - 1: lowest precision
810 * \n - 2: normal precision
811 * \n - 3: highest precision
812 */
813 uint16_t BRCPrecision : 2;
814 /*! \brief Indicates that the allocated source buffer format is a swizzle format from display.
815 *
816 * Framework still allocates the buffer as a standard FOURCC format. The swizzled format will be reported as supported for the encoder configuration during capability reporting.
817 * \n Source/Raw Allocated Buffer Format, DisplayFormatSwizzle, Layout Format in Buffer
818 * \n - YUY2, 0, YUY2
819 * \n - YUY2, 1, 2YUY (Y0U0Y1V0)
820 * \n - AYUV, 0, AYUV
821 * \n - AYUV, 1, YUXV
822 */
823 uint16_t bDisplayFormatSwizzle : 1;
824 uint16_t : 3;
825
826 uint8_t num_slice_groups_minus1; //!< Same as AVC syntax element.
827 char pic_init_qp_minus26; //!< Same as AVC syntax element.
828 char pic_init_qs_minus26; //!< Same as AVC syntax element.
829 bool deblocking_filter_control_present_flag; //!< Same as AVC syntax element.
830 bool redundant_pic_cnt_present_flag; //!< Same as AVC syntax element.
831
832 // Parameters for RollingI feature
833 bool bDisableRollingIntraRefreshOverlap;
834 uint8_t EnableRollingIntraRefresh;
835 uint8_t IntraRefreshMBNum;
836 uint8_t IntraRefreshMBx;
837 uint8_t IntraRefreshMBy;
838 uint8_t IntraRefreshUnitinMB;
839 char IntraRefreshQPDelta;
840 uint32_t FirstPFrameIntraInsertionSize;
841
842 /*! \brief Indicates the maximum size of each slice in Bytes.
843 *
844 * This is valid only when EnableSliceLevelRateCtrl is enabled in the sequence level.
845 */
846 uint32_t SliceSizeInBytes;
847
848 /*! \brief Number of Region Of Interest (ROI).
849 *
850 * Value range is 0 to 16 inclusively. If no ROI to be set, this value shall be set to 0.
851 */
852 uint8_t NumROI;
853 uint8_t NumDirtyROI; //!< Number of dirty ROIs [0...4]
854 uint8_t NumDeltaQpForNonRectROI; //!< Number of DeltaQP for non-rectangular ROIs [0...16]
855 /*! \brief Dictates the value of delta QP for any ROI should be within [MinDeltaQp..MaxDeltaQp]
856 *
857 * Applies only to BRC case.
858 */
859 char MaxDeltaQp;
860 /*! \brief Dictates the value of delta QP for any ROI should be within [MinDeltaQp..MaxDeltaQp]
861 *
862 * Applies only to BRC case.
863 */
864 char MinDeltaQp;
865 /*! \brief Determine possible DeltaQP values for NonRectROI. For BRC case values should be within [MinDeltaQp..MaxDeltaQp]
866 *
867 * QP value for the MB is represented by NonRectROIDeltaQpList[QpData - 1],
868 * where QpData - UCHAR in ENCODE_MBQPDATA structure.
869 * if QpData == 0, the block is in the background, and slice QP (QpY + slice_qp_delta) is applied on this MB.
870 */
871 char NonRectROIDeltaQpList[16];
872 /*! \brief Defines ROI settings.
873 *
874 * Value entries are ROI[0] up to ROI[NumROI – 1], inclusively, if NumROI > 0. And it can be ignored otherwise.
875 */
876 CODEC_ROI ROI[16];
877 /*! \brief Distinct delta QP values assigned to the ROI
878 *
879 * Value entries are distinct and within [MinDeltaQp..MaxDeltaQp].
880 */
881 int8_t ROIDistinctDeltaQp[16];
882 /*! \brief Number of distinct delta QP values assigned to the ROI
883 */
884 int8_t NumROIDistinctDeltaQp;
885 /*! \brief indicate native ROI / force QP ROI to be used.
886 */
887 bool bNativeROI;
888 /*! \brief Defines dirty ROI settings.
889 *
890 * Value entries are DirtyROI[0] up DirtyROI ROI[NumROI – 1], inclusively, if NumDirtyROI > 0. And it can be ignored otherwise.
891 */
892 CODEC_ROI DirtyROI[CODEC_AVC_NUM_MAX_DIRTY_RECT];
893
894 CODEC_ROI_MAP ROIMapArray[16];
895
896 /*! \brief Specifies skip frames.
897 *
898 * 0: Encode as normal, no skip.
899 * 1: One or more frames were skipped prior to the current frame, encode the current frame as normal. The driver will pass the NumSkipFrames and SizeSkipFrames to BRC for adjustment.
900 */
901 uint8_t SkipFrameFlag;
902 /*! \brief The number of frames skipped prior to the current frame.
903 *
904 * Valid when SkipFlag = 1.
905 */
906 uint8_t NumSkipFrames;
907 /*! \brief Differs in meaning based on value of SkipFrameFlag
908 *
909 * SkipFrameFlag = 1, the size of the skipped frames in bits.
910 * Note: Currently kernel only supports 16 bits for SizeSkipFrames.
911 */
912 uint32_t SizeSkipFrames;
913
914 /*! \brief Specifies the minimum Qp to be used for BRC.
915 *
916 * BRCMaxQp and BRCMinQp may be set at a per frame type (I, P, B) granularity.
917 * BRCMaxQp and BRCMinQp should be set to zero if Qp control is not desired.
918 * If non-zero min/max QP is passed for I-frame, it will be used for I, P and B frames.
919 * If non-zero min/max QP is passed for P-frame also, then P and B frame will be updated to this. I-frame remains unchanged.
920 * If non-zero min/max QP is passed for B-frame also, then B-frame will be updated to this. I and P frame remains unchanged.
921 * If new QP values are passed in between the sequence, then it will be updated for that frame-type and any other frame types that are not explicitly set. Eg. if min/max QP for P-frame was passed separately, and an update for I-frame is received, then only I-frame values are updated. P and B will continue to use old values. But, if P-frame and B-frame were never explicitly set then updating I-frame will also update P and B.
922 * If the application wants to keep the current non-zero min/max QP settings, then min/max QP should be set to zero, so the driver will not change previously set values and continue to use them.
923 * Min QP is expected to be less than or equal to Max QP. Driver clamps max QP to [1, 51] and min QP to [1, max QP]. Zero QP is not used.
924 * Only single PAK pass is supported plus the IPCM pass. Panic mode is disabled. This is because min/maxQP requirement conflicts with the HRD compliancy requirement, so the HRD compliancy restriction is relaxed.
925 */
926 uint8_t ucMinimumQP;
927 uint8_t ucMaximumQP; //!< Specifies the maximum Qp to be used for BRC.
928
929 uint32_t dwZMvThreshold; //!< Used for static frame detection.
930
931 /*! \brief Indicates that an HMEOffset will be sent by the application in HMEOffset for each reference.
932 *
933 * This offset will be added to the co-located (0, 0) location before HME search is performed. This is only valid if HMEOffsetSupport is reported as supported as a capability, else this flag is ignored.
934 */
935 bool bEnableHMEOffset;
936 /*! \brief Specifies the HME offsets.
937 *
938 * Curently the supported range is -128 to +127, programmed in 4x downscaled HME precision, not the original size. HMEOffset[i][j] where:
939 * \n - i – RefFrameList Index
940 * \n - j – 0 = x, 1 = y Coordinates
941 * \n So for example, HMEOffset[i] specifies the (x, y) offset corresponding to the ith entry in RefFrameList.
942 * Programming Note: The HME offset must be a multiple of 4x4 to align to the 4x4 HME block, so the driver must align the application supplied value.
943 */
944 int16_t HMEOffset[16][2][2];
945
946 /*! \brief Specifies Inter MB partition modes that will be disabled.
947 *
948 * SubMbPartMask is only valid when bEnableSubMbPartMask is true. Bit0~6 indicate inter 16x16, 16x8, 8x16, 8x8, 8x4, 4x8, 4x4.
949 */
950 bool bEnableSubMbPartMask;
951 uint8_t SubMbPartMask;
952
953 /*! \brief Specifies motion search modes that will be used.
954 *
955 * SubPelMode is only valid when bEnableSubPelMode is true. Following are valid values of SubPelMode:
956 * 0:Integer mode searching
957 * 1:Half-pel mode searching
958 * 2:Reserved
959 * 3:Quarter-pel mode searching
960 */
961 bool bEnableSubPelMode;
962 uint8_t SubPelMode;
963
964 /*! \brief Specifies whether extra partition decision refinement is done after the initial partition decision candidate is determined.
965 *
966 * It has performance tradeoff for better quality.
967 * \n - 0 : DEFAULT - Follow driver default settings.
968 * \n - 1 : FORCE_ENABLE - Enable this feature totally for all cases.
969 * \n - 2 : FORCE_DISABLE - Disable this feature totally for all cases.
970 */
971 uint32_t ForceRepartitionCheck;
972
973 /*! \brief Specifies force-to-skip for HRD compliance in BRC kernel that will be disabled.
974 *
975 * bDisableFrameSkip is only valid for P/B frames
976 * 0: force-to-skip will be enabled as required in BRC kernel. Default value.
977 * 1: force-to-skip will be disabled in BRC kernel.
978 */
979 bool bDisableFrameSkip;
980
981 /*! \brief Maximum frame size for all frame types in bytes.
982 *
983 * Applicable for CQP and multi PAK. If dwMaxFrameSize > 0, driver will do multiple PAK and adjust QP
984 * (frame level QP + slice_qp_delta) to make the compressed frame size to be less than this value.
985 * If dwMaxFrameSize equals 0, driver will not do multiple PAK and do not adjust QP.
986 */
987 uint32_t dwMaxFrameSize;
988
989 /*! \brief Total pass number for multiple PAK.
990 *
991 * Valid range is 0 - 4. If dwNumPasses is set to 0, driver will not do multiple PAK and do not adjust
992 * QP (frame level QP + slice_qp_delta), otherwise, driver will do multiple times PAK and in each time
993 * the QP will be adjust according deltaQp parameters.
994 */
995 uint32_t dwNumPasses;
996
997 /*! \brief Delta QP array for each PAK pass.
998 *
999 * This pointer points to an array of deltaQp, the max array size for AVC encoder is 4. The valid range
1000 * for each deltaQp is 0 - 51. If the value is out of this valid range, driver will return error.
1001 * Otherwise, driver will adjust QP (frame level QP + slice_qp_delta) by adding this value in each PAK pass.
1002 */
1003 uint8_t *pDeltaQp;
1004
1005 /*! \brief Specifies target frame size in TCBRC mode.
1006 *
1007 * If TCBRCSupport == 1, this parameter enables "Transport Controlled BRC mode" and indicates the desired frame size in bytes.
1008 * - If the value equals 0, the BRC mode defined in RateControlMethod will take control for that certain frame.
1009 * If TCBRCSupport == 0, this parameter will be ignored and should be set to 0. The BRC mode defined in RateControlMethod will be applied.
1010 */
1011 uint32_t TargetFrameSize;
1012
1013 /*! \brief Indicates if GPU polling based sync is enabled.
1014 *
1015 * Applicaiton sets to 1 to enable GPU polling based sync in driver.
1016 */
1017 bool bEnableSync;
1018
1019 /*! \brief Indicates if the current frame is repeat frame.
1020 *
1021 * Applicaiton sets to 1 if current frame is repeat frame.
1022 */
1023 bool bRepeatFrame;
1024
1025 /*! \brief Indicates if enable QP adjustment for current frame.
1026 *
1027 * Applicaiton sets to 1 to enable QP adjustment for current frame in CQP mode.
1028 * When QP adjustment is enabled, driver calls MBBRC kernel to adjust per MB QP for perceptual quality in CQP mode.
1029 */
1030 bool bEnableQpAdjustment;
1031
1032 /*! \brief Indicates marker coordinates in raw surface for GPU polling based sync.
1033 *
1034 * In unite of bytes. Valid for encoders which report SyncSupport capability as true.
1035 */
1036 uint16_t SyncMarkerX;
1037 uint16_t SyncMarkerY;
1038
1039 /*! \brief Point to marker value for GPU polling based sync.
1040 *
1041 * Valid for encoders which report SyncSupport capability as true.
1042 */
1043 uint8_t *pSyncMarkerValue;
1044
1045 /*! \brief Indicates marker value for GPU polling based sync.
1046 *
1047 * In unit of bytes. Should be larger than or equal to 4. Valid for encoders which report SyncSupport capability as true.
1048 */
1049 uint32_t SyncMarkerSize;
1050
1051 /*! \brief hierarchical level plus one for pyramid encoding.
1052 *
1053 * When HierarchLevelPlus1 > 0, HierarchLevelPlus1 – 1 indicates the current frame’s hierarchical level.
1054 * And it is for both random access and low delay hierarchical structure.
1055 * HierarchLevelPlus1 == 0 can be treated as meaningless. It is defined as a legacy reason for HEVC.
1056 */
1057 uint8_t HierarchLevelPlus1;
1058
1059 /*! \brief QP modulation strength for BRC
1060 *
1061 * Suggestion of the strength of applying Qp delta for the frame specified when Qp modulation is enabled (HierarchicalFlag == 1).
1062 * This is a relative number. BRC could use it to infer final delta Qp values for hierarchical frames in mini Gop structure.
1063 * Default value 0 means no suggestion for Qp modulation
1064 */
1065 uint8_t QpModulationStrength;
1066
1067 uint8_t AdaptiveTUEnabled;
1068
1069 /*! \brief StatusReportEnable
1070 *
1071 * Request features to be enabled at status report.
1072 * FrameStats: FRAME_STATS_INFO enabled in ENCODE_QUERY_STATUS_PARAMS.
1073 * BlockStats: BLOCK_STATS_INFO enabled in ENCODE_QUERY_STATUS_PARAMS.
1074 */
1075 union
1076 {
1077 struct
1078 {
1079 uint16_t FrameStats : 1;
1080 uint16_t BlockStats : 1;
1081 uint16_t reserved : 14;
1082 } fields;
1083 uint16_t value;
1084 } StatusReportEnable;
1085
1086 /*! \brief quality information report enable flags.
1087 */
1088 union
1089 {
1090 struct
1091 {
1092 uint8_t enable_frame : 1;
1093 uint8_t reserved : 7;
1094 } fields;
1095 uint8_t value;
1096 } QualityInfoSupportFlags;
1097 } CODEC_AVC_ENCODE_PIC_PARAMS, *PCODEC_AVC_ENCODE_PIC_PARAMS;
1098
1099 /*! \brief Slice-level parameters of a compressed picture for AVC encoding.
1100 */
1101 typedef struct _CODEC_AVC_ENCODE_SLICE_PARAMS
1102 {
1103 /*! \brief Specifies the number of macroblocks for this slice.
1104 *
1105 * Note the slice height restriction in picture parameter structure.
1106 */
1107 uint32_t NumMbsForSlice;
1108 /*! \brief Specifies the reference picture lists 0 and 1
1109 *
1110 * Contains field/frame information concerning the reference in PicFlags. RefPicList[i][j]:
1111 * \n - i: the reference picture list (0 or 1)
1112 * \n - j: if the PicFlags are not PICTURE_INVALID, the index variable j is a reference to entry j in the reference picture list.
1113 */
1114 CODEC_PICTURE RefPicList[CODEC_AVC_NUM_REF_LISTS][CODEC_MAX_NUM_REF_FIELD];
1115 /*! \brief Specifies the weights and offsets used for explicit mode weighted prediction.
1116 *
1117 * Weigths[i][j][k][m]:
1118 * \n - i: the reference picture list (0 or 1)
1119 * \n - j: reference to entry j in RefPicList (has range [0...31])
1120 * \n - k: the YUV component (0 = luma, 1 = Cb chroma, 2 = Cr chroma)
1121 * \n - m: the weight or offset used in the weighted prediction process (0 = weight, 1 = offset)
1122 */
1123 int16_t Weights[2][32][3][2];
1124
1125 uint32_t first_mb_in_slice; //!< Same as AVC syntax element.
1126 uint8_t slice_type; //!< Same as AVC syntax element.
1127 uint8_t pic_parameter_set_id; //!< Same as AVC syntax element.
1128 uint16_t direct_spatial_mv_pred_flag : 1; //!< Same as AVC syntax element.
1129 uint16_t num_ref_idx_active_override_flag : 1; //!< Same as AVC syntax element.
1130 uint16_t long_term_reference_flag : 1; //!< Same as AVC syntax element.
1131 uint16_t : 13;
1132 uint16_t idr_pic_id; //!< Same as AVC syntax element.
1133 uint16_t pic_order_cnt_lsb; //!< Same as AVC syntax element.
1134 int32_t delta_pic_order_cnt_bottom; //!< Same as AVC syntax element.
1135 int32_t delta_pic_order_cnt[2]; //!< Same as AVC syntax element.
1136 uint8_t num_ref_idx_l0_active_minus1; //!< Same as AVC syntax element.
1137 uint8_t num_ref_idx_l1_active_minus1; //!< Same as AVC syntax element.
1138 uint8_t num_ref_idx_l0_active_minus1_from_DDI;
1139 uint8_t num_ref_idx_l1_active_minus1_from_DDI;
1140 uint8_t luma_log2_weight_denom; //!< Same as AVC syntax element.
1141 uint8_t chroma_log2_weight_denom; //!< Same as AVC syntax element.
1142 uint8_t cabac_init_idc; //!< Same as AVC syntax element.
1143 char slice_qp_delta; //!< Same as AVC syntax element.
1144 uint8_t disable_deblocking_filter_idc; //!< Same as AVC syntax element.
1145 char slice_alpha_c0_offset_div2; //!< Same as AVC syntax element.
1146 char slice_beta_offset_div2; //!< Same as AVC syntax element.
1147 uint32_t slice_id; //!< Same as AVC syntax element.
1148 /*! \brief Indicates that the weighting factors for the luma component are present.
1149 *
1150 * luma_weight_flag[i] is interpreted as corresponding to L0 when i=0 and L1 when i=1. Each bit n of luma_weight_flag[i] corresponds to the nth entry in reference list i. The framework must obey the caps the driver reported in MaxNum_WeightedPredL0/L1.
1151 */
1152 uint32_t luma_weight_flag[2];
1153 /*! \brief Indicates that the weighting factors for the chroma component are present.
1154 *
1155 * chroma_weight_flag[i] is interpreted as corresponding to L0 when i=0 and L1 when i=1. Each bit n of chroma_weight_flag[i] corresponds to the nth entry in reference list i. The framework must obey the caps the driver reported in MaxNum_WeightedPredL0/L1.
1156 */
1157 uint32_t chroma_weight_flag[2];
1158
1159 CODEC_PIC_REORDER PicOrder[2][32]; //!< Set by the driver
1160
1161 uint8_t colour_plane_id; //!< Same as AVC syntax element.
1162 uint32_t frame_num; //!< Same as AVC syntax element.
1163 bool field_pic_flag; //!< Same as AVC syntax element.
1164 bool bottom_field_flag; //!< Same as AVC syntax element.
1165 uint8_t redundant_pic_cnt; //!< Same as AVC syntax element.
1166 char sp_for_switch_flag; //!< Same as AVC syntax element.
1167 char slice_qs_delta; //!< Same as AVC syntax element.
1168 uint8_t ref_pic_list_reordering_flag_l0 : 1; //!< Same as AVC syntax element.
1169 uint8_t ref_pic_list_reordering_flag_l1 : 1; //!< Same as AVC syntax element.
1170 uint8_t no_output_of_prior_pics_flag : 1; //!< Same as AVC syntax element.
1171 uint8_t adaptive_ref_pic_marking_mode_flag : 1; //!< Same as AVC syntax element.
1172 uint8_t : 3;
1173 uint32_t MaxFrameNum; //!< Set by the driver: 1 << (pSeqParams[pPicParams->seq_parameter_set_id].log2_max_frame_num_minus4 + 4);
1174 uint8_t NumReorder; //!< Set by the driver
1175
1176 /*! \brief MMCO can be used when AcceleratorHeaderPacking = 1 i.e. driver does slice header packing.
1177 *
1178 * Driver does not generate memory_management_control_operation commands itself but they can be provided by the app.
1179 * If adaptive_ref_pic_marking_mode_flag = 1 these commands will be packed into slice header
1180 */
1181 CODEC_SLICE_MMCO MMCO[32];
1182
1183 } CODEC_AVC_ENCODE_SLICE_PARAMS, *PCODEC_AVC_ENCODE_SLICE_PARAMS;
1184
1185 // H.264 Inverse Quantization Weight Scale
1186 typedef struct _CODEC_AVC_ENCODE_IQ_WEIGTHSCALE_LISTS
1187 {
1188 uint8_t WeightScale4x4[6][16];
1189 uint8_t WeightScale8x8[2][64];
1190 } CODEC_AVC_ENCODE_IQ_WEIGTHSCALE_LISTS, *PCODEC_AVC_ENCODE_IQ_WEIGTHSCALE_LISTS;
1191
1192 // used for PAFF case, 0: frame, 1: tff field, 2: invalid, 3: bff field
1193 typedef enum _CODEC_AVC_PIC_CODING_TYPE_VALUE
1194 {
1195 CODEC_AVC_PIC_CODING_TYPE_FRAME = 0x0,
1196 CODEC_AVC_PIC_CODING_TYPE_TFF_FIELD = 0x1,
1197 CODEC_AVC_PIC_CODING_TYPE_INVALID = 0x2,
1198 CODEC_AVC_PIC_CODING_TYPE_BFF_FIELD = 0x3
1199 } CODEC_AVC_PIC_CODING_TYPE_VALUE;
1200
1201 //!
1202 //! \struct CodecEncodeAvcFeiPicParams
1203 //! \brief Codec encode AVC FEI pic params
1204 //!
1205 struct CodecEncodeAvcFeiPicParams
1206 {
1207 MOS_RESOURCE resMBCtrl; // input MB control buffer
1208 MOS_RESOURCE resMVData; // ENC MV output buffer or PAK MV input buffer
1209 MOS_RESOURCE resMBCode; // ENC MBCode output buffer or PAK MBCode input buffer
1210 MOS_RESOURCE resMVPredictor; // input MV predictor surface
1211 MOS_RESOURCE resMBQp; // input QP per MB surface
1212 MOS_RESOURCE resDistortion; // ENC or ENC_PAK Distortion output surface
1213 uint32_t NumMVPredictorsL0;
1214 uint32_t NumMVPredictorsL1;
1215
1216 bool MbCodeMvEnable;
1217 bool DistortionEnable;
1218
1219 /** \brief control parameters */
1220 uint32_t SearchPath;
1221 uint32_t LenSP;
1222
1223 uint32_t SubMBPartMask;
1224 uint32_t IntraPartMask;
1225 bool MultiPredL0;
1226 bool MultiPredL1;
1227 uint32_t SubPelMode;
1228 uint32_t InterSAD;
1229 uint32_t IntraSAD;
1230 uint32_t DistortionType;
1231 bool RepartitionCheckEnable;
1232 bool AdaptiveSearch;
1233 bool MVPredictorEnable;
1234 bool bMBQp;
1235 bool bPerMBInput;
1236 bool bMBSizeCtrl;
1237 uint32_t RefWidth;
1238 uint32_t RefHeight;
1239 uint32_t SearchWindow;
1240
1241 //add for mutlple pass pak
1242 uint32_t dwMaxFrameSize;
1243 uint32_t dwNumPasses; //number of QPs
1244 uint8_t *pDeltaQp; //list of detla QPs
1245 };
1246
1247 typedef struct _CODECHAL_ENCODE_AVC_PACK_PIC_HEADER_PARAMS
1248 {
1249 PBSBuffer pBsBuffer;
1250 PCODEC_AVC_ENCODE_PIC_PARAMS pPicParams; // pAvcPicParams[ucPPSIdx]
1251 PCODEC_AVC_ENCODE_SEQUENCE_PARAMS pSeqParams; // pAvcSeqParams[ucSPSIdx]
1252 PCODECHAL_ENCODE_AVC_VUI_PARAMS pAvcVuiParams;
1253 PCODEC_AVC_IQ_MATRIX_PARAMS pAvcIQMatrixParams;
1254 PCODECHAL_NAL_UNIT_PARAMS *ppNALUnitParams;
1255 CodechalEncodeSeiData* pSeiData;
1256 uint32_t dwFrameHeight;
1257 uint32_t dwOriFrameHeight;
1258 uint16_t wPictureCodingType;
1259 bool bNewSeq;
1260 bool *pbNewPPSHeader;
1261 bool *pbNewSeqHeader;
1262 } CODECHAL_ENCODE_AVC_PACK_PIC_HEADER_PARAMS, *PCODECHAL_ENCODE_AVC_PACK_PIC_HEADER_PARAMS;
1263
1264 typedef struct _CODECHAL_ENCODE_AVC_VALIDATE_NUM_REFS_PARAMS
1265 {
1266 PCODEC_AVC_ENCODE_SEQUENCE_PARAMS pSeqParams; // pAvcSeqParams[ucSPSIdx]
1267 PCODEC_AVC_ENCODE_PIC_PARAMS pPicParams;
1268 PCODEC_AVC_ENCODE_SLICE_PARAMS pAvcSliceParams;
1269 uint16_t wPictureCodingType;
1270 uint16_t wPicHeightInMB;
1271 uint16_t wFrameFieldHeightInMB;
1272 bool bFirstFieldIPic;
1273 bool bVDEncEnabled;
1274 bool bPAKonly;
1275 } CODECHAL_ENCODE_AVC_VALIDATE_NUM_REFS_PARAMS, *PCODECHAL_ENCODE_AVC_VALIDATE_NUM_REFS_PARAMS;
1276
1277 typedef struct _CODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS
1278 {
1279 uint16_t wPictureCodingType;
1280 uint8_t ucTargetUsage;
1281 uint8_t ucQP;
1282 bool bBrcEnabled;
1283 bool bVdEncEnabled;
1284 } CODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS, *PCODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS;
1285
1286 typedef struct _CODECHAL_ENCODE_AVC_TQ_PARAMS
1287 {
1288 uint32_t dwTqEnabled;
1289 uint32_t dwTqRounding;
1290 } CODECHAL_ENCODE_AVC_TQ_PARAMS, *PCODECHAL_ENCODE_AVC_TQ_PARAMS;
1291
1292 //!
1293 //! \enum TrellisSetting
1294 //! \brief Indicate the different Trellis Settings
1295 //!
1296 enum TrellisSetting
1297 {
1298 trellisInternal = 0,
1299 trellisDisabled = 1,
1300 trellisEnabledI = 2,
1301 trellisEnabledP = 4,
1302 trellisEnabledB = 8
1303 };
1304
1305 typedef struct _CODECHAL_ENCODE_AVC_PACK_SLC_HEADER_PARAMS
1306 {
1307 PBSBuffer pBsBuffer;
1308 PCODEC_AVC_ENCODE_PIC_PARAMS pPicParams; // pAvcPicParams[ucPPSIdx]
1309 PCODEC_AVC_ENCODE_SEQUENCE_PARAMS pSeqParams; // pAvcSeqParams[ucSPSIdx]
1310 PCODEC_AVC_ENCODE_SLICE_PARAMS pAvcSliceParams;
1311 PCODEC_REF_LIST *ppRefList;
1312 CODEC_PICTURE CurrPic;
1313 CODEC_PICTURE CurrReconPic;
1314 CODEC_AVC_ENCODE_USER_FLAGS UserFlags;
1315 CODECHAL_ENCODE_AVC_NAL_UNIT_TYPE NalUnitType;
1316 uint16_t wPictureCodingType;
1317 bool bVdencEnabled;
1318 } CODECHAL_ENCODE_AVC_PACK_SLC_HEADER_PARAMS, *PCODECHAL_ENCODE_AVC_PACK_SLC_HEADER_PARAMS;
1319
1320 #endif // __CODEC_DEF_ENCODE_AVC_H__