| 1 |
/* |
| 2 |
* Copyright (c) 2012-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 codechal_decode_hevc.h |
| 24 |
//! \brief Defines the decode interface extension for HEVC. |
| 25 |
//! \details Defines all types, macros, and functions required by CodecHal for HEVC decoding. Definitions are not externally facing. |
| 26 |
//! |
| 27 |
|
| 28 |
#ifndef __CODECHAL_DECODER_HEVC_H__ |
| 29 |
#define __CODECHAL_DECODER_HEVC_H__ |
| 30 |
|
| 31 |
#include "codechal.h" |
| 32 |
#include "codechal_hw.h" |
| 33 |
#include "codechal_decode_sfc_hevc.h" |
| 34 |
#include "codechal_decoder.h" |
| 35 |
|
| 36 |
class CodechalDecodeNV12ToP010; |
| 37 |
|
| 38 |
typedef class CodechalDecodeHevc *PCODECHAL_DECODE_HEVC_STATE; |
| 39 |
|
| 40 |
typedef struct _CODECHAL_DECODE_HEVC_MV_LIST |
| 41 |
{ |
| 42 |
uint8_t u8FrameId; |
| 43 |
bool bInUse; |
| 44 |
bool bReUse; |
| 45 |
} CODECHAL_DECODE_HEVC_MV_LIST, *PCODECHAL_DECODE_HEVC_MV_LIST; |
| 46 |
|
| 47 |
typedef struct |
| 48 |
{ |
| 49 |
uint32_t pic_width_in_min_cbs_y; |
| 50 |
uint32_t pic_height_in_min_cbs_y; |
| 51 |
uint8_t log2_min_luma_coding_block_size_minus3; |
| 52 |
uint8_t log2_diff_max_min_luma_coding_block_size; |
| 53 |
uint16_t chroma_format_idc : 2; //!< range 0..3 |
| 54 |
uint16_t separate_colour_plane_flag : 1; |
| 55 |
uint16_t bit_depth_luma_minus8 : 4; |
| 56 |
uint16_t bit_depth_chroma_minus8 : 4; |
| 57 |
uint16_t log2_max_pic_order_cnt_lsb_minus4 : 4; //!< range 0..12 |
| 58 |
uint16_t sample_adaptive_offset_enabled_flag : 1; |
| 59 |
uint8_t num_short_term_ref_pic_sets; //!< range 0..64 |
| 60 |
uint8_t long_term_ref_pics_present_flag : 1; |
| 61 |
uint8_t num_long_term_ref_pics_sps : 6; //!< range 0..32 |
| 62 |
uint8_t sps_temporal_mvp_enable_flag : 1; |
| 63 |
|
| 64 |
uint8_t num_ref_idx_l0_default_active_minus1 : 4; //!< range 0..15 |
| 65 |
uint8_t num_ref_idx_l1_default_active_minus1 : 4; //!< range 0..15 |
| 66 |
int8_t pic_init_qp_minus26; //!< range -62..25 |
| 67 |
uint8_t dependent_slice_segments_enabled_flag : 1; |
| 68 |
uint8_t cabac_init_present_flag : 1; |
| 69 |
uint8_t pps_slice_chroma_qp_offsets_present_flag : 1; |
| 70 |
uint8_t weighted_pred_flag : 1; |
| 71 |
uint8_t weighted_bipred_flag : 1; |
| 72 |
uint8_t output_flag_present_flag : 1; |
| 73 |
uint8_t tiles_enabled_flag : 1; |
| 74 |
uint8_t entropy_coding_sync_enabled_flag : 1; |
| 75 |
uint8_t loop_filter_across_slices_enabled_flag : 1; |
| 76 |
uint8_t deblocking_filter_override_enabled_flag : 1; |
| 77 |
uint8_t pic_disable_deblocking_filter_flag : 1; |
| 78 |
uint8_t lists_modification_present_flag : 1; |
| 79 |
uint8_t slice_segment_header_extension_present_flag : 1; |
| 80 |
uint8_t high_precision_offsets_enabled_flag : 1; |
| 81 |
uint8_t chroma_qp_offset_list_enabled_flag : 1; |
| 82 |
uint8_t : 1; |
| 83 |
|
| 84 |
int32_t CurrPicOrderCntVal; |
| 85 |
int32_t PicOrderCntValList[CODEC_MAX_NUM_REF_FRAME_HEVC]; |
| 86 |
uint8_t RefPicSetStCurrBefore[8]; |
| 87 |
uint8_t RefPicSetStCurrAfter[8]; |
| 88 |
uint8_t RefPicSetLtCurr[8]; |
| 89 |
uint16_t RefFieldPicFlag; |
| 90 |
uint16_t RefBottomFieldFlag; |
| 91 |
int8_t pps_beta_offset_div2; |
| 92 |
int8_t pps_tc_offset_div2; |
| 93 |
uint16_t StRPSBits; |
| 94 |
|
| 95 |
uint8_t num_tile_columns_minus1; |
| 96 |
uint8_t num_tile_rows_minus1; |
| 97 |
uint16_t column_width[HEVC_NUM_MAX_TILE_COLUMN]; |
| 98 |
uint16_t row_height[HEVC_NUM_MAX_TILE_ROW]; |
| 99 |
|
| 100 |
uint16_t NumSlices; |
| 101 |
uint8_t num_extra_slice_header_bits; |
| 102 |
int8_t RefIdxMapping[CODEC_MAX_NUM_REF_FRAME_HEVC]; |
| 103 |
|
| 104 |
struct |
| 105 |
{ |
| 106 |
uint8_t reserve_0; |
| 107 |
uint16_t reserve_1; |
| 108 |
uint32_t reserve_2; |
| 109 |
uint32_t reserve_3; |
| 110 |
} reserve; |
| 111 |
} HUC_HEVC_S2L_PIC_BSS, *PHUC_HEVC_S2L_PIC_BSS; |
| 112 |
|
| 113 |
typedef struct { |
| 114 |
uint32_t BSNALunitDataLocation; |
| 115 |
uint32_t SliceBytesInBuffer; |
| 116 |
|
| 117 |
struct |
| 118 |
{ |
| 119 |
uint32_t reserve_0; |
| 120 |
uint32_t reserve_1; |
| 121 |
uint32_t reserve_2; |
| 122 |
uint32_t reserve_3; |
| 123 |
} reserve; |
| 124 |
} HUC_HEVC_S2L_SLICE_BSS, *PHUC_HEVC_S2L_SLICE_BSS; |
| 125 |
|
| 126 |
typedef struct { |
| 127 |
// Platfrom information |
| 128 |
uint32_t ProductFamily; |
| 129 |
uint16_t RevId; |
| 130 |
|
| 131 |
// Flag to indicate if create dummy HCP_REF_IDX_STATE or not |
| 132 |
uint32_t DummyRefIdxState; |
| 133 |
|
| 134 |
// Picture level DMEM data |
| 135 |
HUC_HEVC_S2L_PIC_BSS PictureBss; |
| 136 |
|
| 137 |
// Slice level DMEM data |
| 138 |
HUC_HEVC_S2L_SLICE_BSS SliceBss[CODECHAL_HEVC_MAX_NUM_SLICES_LVL_6]; |
| 139 |
|
| 140 |
} HUC_HEVC_S2L_BSS, *PHUC_HEVC_S2L_BSS; |
| 141 |
|
| 142 |
//! |
| 143 |
//! \class CodechalDecodeHevc |
| 144 |
//! \brief Codechal decode HEVC |
| 145 |
//! |
| 146 |
class CodechalDecodeHevc : public CodechalDecode |
| 147 |
{ |
| 148 |
public: |
| 149 |
|
| 150 |
typedef struct |
| 151 |
{ |
| 152 |
PMHW_VDBOX_PIPE_MODE_SELECT_PARAMS PipeModeSelectParams; |
| 153 |
PMHW_VDBOX_SURFACE_PARAMS SurfaceParams; |
| 154 |
PMHW_VDBOX_PIPE_BUF_ADDR_PARAMS PipeBufAddrParams; |
| 155 |
PMHW_VDBOX_IND_OBJ_BASE_ADDR_PARAMS IndObjBaseAddrParams; |
| 156 |
PMHW_VDBOX_QM_PARAMS QmParams; |
| 157 |
PMHW_VDBOX_HEVC_PIC_STATE HevcPicState; |
| 158 |
PMHW_VDBOX_HEVC_TILE_STATE HevcTileState; |
| 159 |
} PIC_LONG_FORMAT_MHW_PARAMS; |
| 160 |
|
| 161 |
//! |
| 162 |
//! \brief Constructor |
| 163 |
//! \param [in] hwInterface |
| 164 |
//! Hardware interface |
| 165 |
//! \param [in] debugInterface |
| 166 |
//! Debug interface |
| 167 |
//! \param [in] standardInfo |
| 168 |
//! The information of decode standard for this instance |
| 169 |
//! |
| 170 |
CodechalDecodeHevc( |
| 171 |
CodechalHwInterface *hwInterface, |
| 172 |
CodechalDebugInterface* debugInterface, |
| 173 |
PCODECHAL_STANDARD_INFO standardInfo); |
| 174 |
|
| 175 |
//! |
| 176 |
//! \brief Copy constructor |
| 177 |
//! |
| 178 |
CodechalDecodeHevc(const CodechalDecodeHevc&) = delete; |
| 179 |
|
| 180 |
//! |
| 181 |
//! \brief Copy assignment operator |
| 182 |
//! |
| 183 |
CodechalDecodeHevc& operator=(const CodechalDecodeHevc&) = delete; |
| 184 |
|
| 185 |
//! |
| 186 |
//! \brief Destructor |
| 187 |
//! |
| 188 |
~CodechalDecodeHevc (); |
| 189 |
|
| 190 |
//! |
| 191 |
//! \brief Allocate and initialize HEVC decoder standard |
| 192 |
//! \param [in] settings |
| 193 |
//! Pointer to CodechalSetting |
| 194 |
//! \return MOS_STATUS |
| 195 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 196 |
//! |
| 197 |
MOS_STATUS AllocateStandard ( |
| 198 |
CodechalSetting *settings) override; |
| 199 |
|
| 200 |
//! |
| 201 |
//! \brief Set states for each frame to prepare for HEVC decode |
| 202 |
//! \return MOS_STATUS |
| 203 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 204 |
//! |
| 205 |
MOS_STATUS SetFrameStates () override; |
| 206 |
|
| 207 |
//! |
| 208 |
//! \brief HEVC decoder state level function |
| 209 |
//! \details State level function for HEVC decoder |
| 210 |
//! |
| 211 |
//! \return MOS_STATUS |
| 212 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 213 |
//! |
| 214 |
MOS_STATUS DecodeStateLevel () override; |
| 215 |
|
| 216 |
//! |
| 217 |
//! \brief HEVC decoder primitive level function |
| 218 |
//! \details Primitive level function for GEN specific HEVC decoder |
| 219 |
//! |
| 220 |
//! \return MOS_STATUS |
| 221 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 222 |
//! |
| 223 |
MOS_STATUS DecodePrimitiveLevel () override; |
| 224 |
|
| 225 |
//! |
| 226 |
//! \brief HEVC decoder downsampling calc function |
| 227 |
//! \details calc downsample param for GEN specific HEVC decoder |
| 228 |
//! |
| 229 |
//! \param [in] picParams |
| 230 |
//! Pointer to picture parameters |
| 231 |
//! \param [out] refSurfWidth |
| 232 |
//! Pointer to reference surface width |
| 233 |
//! \param [out] refSurfHeight |
| 234 |
//! Pointer to reference surface height |
| 235 |
//! \param [out] format |
| 236 |
//! Pointer to MOS_FORMAT returned |
| 237 |
//! \param [out] frameIdx |
| 238 |
//! Pointer to frame index |
| 239 |
//! |
| 240 |
//! \return MOS_STATUS |
| 241 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 242 |
//! |
| 243 |
MOS_STATUS CalcDownsamplingParams ( |
| 244 |
void *picParams, |
| 245 |
uint32_t *refSurfWidth, |
| 246 |
uint32_t *refSurfHeight, |
| 247 |
MOS_FORMAT *format, |
| 248 |
uint8_t *frameIdx) override; |
| 249 |
|
| 250 |
MOS_STATUS InitMmcState() override; |
| 251 |
|
| 252 |
//! |
| 253 |
//! \brief Add S2L picture level commands to command buffer |
| 254 |
//! \details Add S2L picture level commands to command buffer in HEVC decode driver |
| 255 |
//! |
| 256 |
//! \param [out] cmdBufferInUse |
| 257 |
//! Pointer to Command buffer |
| 258 |
//! |
| 259 |
//! \return MOS_STATUS |
| 260 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 261 |
//! |
| 262 |
MOS_STATUS AddPictureS2LCmds( |
| 263 |
PMOS_COMMAND_BUFFER cmdBufferInUse); |
| 264 |
|
| 265 |
//! |
| 266 |
//! \brief Send S2L picture level commands |
| 267 |
//! \details Send S2L picture level commands in HEVC decode driver |
| 268 |
//! |
| 269 |
//! \return MOS_STATUS |
| 270 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 271 |
//! |
| 272 |
virtual MOS_STATUS SendPictureS2L (); |
| 273 |
|
| 274 |
//! |
| 275 |
//! \brief Send S2L Slice level commands |
| 276 |
//! \details Send S2L Slice level commands in HEVC decode driver |
| 277 |
//! |
| 278 |
//! \param [out] cmdBuffer |
| 279 |
//! Pointer to Command buffer |
| 280 |
//! \param [in] hevcSliceState |
| 281 |
//! Pointer to HEVC Slice State |
| 282 |
//! |
| 283 |
//! \return MOS_STATUS |
| 284 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 285 |
//! |
| 286 |
virtual MOS_STATUS SendSliceS2L ( |
| 287 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 288 |
PMHW_VDBOX_HEVC_SLICE_STATE hevcSliceState); |
| 289 |
|
| 290 |
//! |
| 291 |
//! \brief Get the Huc Dmem resource size |
| 292 |
//! \details Return the Huc Dmem resource size in bytes. |
| 293 |
//! |
| 294 |
//! \return uint32_t |
| 295 |
//! the size of Dmem resource |
| 296 |
//! |
| 297 |
virtual uint32_t GetDmemBufferSize(); |
| 298 |
|
| 299 |
//! |
| 300 |
//! \brief Set S2L picture level Dmem parameters |
| 301 |
//! \details Set S2L HuC Dmem picture level paramters |
| 302 |
//! |
| 303 |
//! \param [out] hucHevcS2LPicBss |
| 304 |
//! Pointer to S2L Dmem picture Bss paramters |
| 305 |
//! |
| 306 |
//! \return MOS_STATUS |
| 307 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 308 |
//! |
| 309 |
virtual MOS_STATUS SetHucDmemS2LPictureBss( |
| 310 |
PHUC_HEVC_S2L_PIC_BSS hucHevcS2LPicBss); |
| 311 |
|
| 312 |
//! |
| 313 |
//! \brief Set S2L Slice level Dmem parameters |
| 314 |
//! \details Set S2L HuC Dmem slice related paramters |
| 315 |
//! |
| 316 |
//! \param [out] hucHevcS2LSliceBss |
| 317 |
//! Pointer to S2L Dmem Slice Bss paramters |
| 318 |
//! |
| 319 |
//! \return MOS_STATUS |
| 320 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 321 |
//! |
| 322 |
virtual MOS_STATUS SetHucDmemS2LSliceBss( |
| 323 |
PHUC_HEVC_S2L_SLICE_BSS hucHevcS2LSliceBss); |
| 324 |
|
| 325 |
//! |
| 326 |
//! \brief Setup HuC DMEM buffer |
| 327 |
//! \details Setup HuC DMEM buffer in HEVC decode driver |
| 328 |
//! |
| 329 |
//! \param [in] dmemBuffer |
| 330 |
//! Pointer to HuC DMEM resource buffer |
| 331 |
//! |
| 332 |
//! \return MOS_STATUS |
| 333 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 334 |
//! |
| 335 |
virtual MOS_STATUS SetHucDmemParams( |
| 336 |
PMOS_RESOURCE dmemBuffer); |
| 337 |
|
| 338 |
//! |
| 339 |
//! \brief Initialize the picture level MHW parameters for long format |
| 340 |
//! \details Initialize the picture level MHW parameters for long format in HEVC decode driver |
| 341 |
//! |
| 342 |
//! \return MOS_STATUS |
| 343 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 344 |
//! |
| 345 |
virtual MOS_STATUS InitPicLongFormatMhwParams(); |
| 346 |
|
| 347 |
//! |
| 348 |
//! \brief Add long format picture level commands to command buffer |
| 349 |
//! \details Add long format picture level commands to command buffer in HEVC decode driver |
| 350 |
//! |
| 351 |
//! \param [out] cmdBufferInUse |
| 352 |
//! Pointer to Command buffer |
| 353 |
//! \param [in] picMhwParams |
| 354 |
//! Pointer to the picture level MHW parameters |
| 355 |
//! |
| 356 |
//! \return MOS_STATUS |
| 357 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 358 |
//! |
| 359 |
virtual MOS_STATUS AddPictureLongFormatCmds( |
| 360 |
PMOS_COMMAND_BUFFER cmdBufferInUse, |
| 361 |
PIC_LONG_FORMAT_MHW_PARAMS *picMhwParams); |
| 362 |
|
| 363 |
//! |
| 364 |
//! \brief Send long format picture level commands |
| 365 |
//! \details Send long format picture level commands in HEVC decode driver |
| 366 |
//! |
| 367 |
//! \return MOS_STATUS |
| 368 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 369 |
//! |
| 370 |
virtual MOS_STATUS SendPictureLongFormat (); |
| 371 |
|
| 372 |
//! |
| 373 |
//! \brief Send long format Slice level commands |
| 374 |
//! \details Send long format Slice level commands in HEVC decode driver |
| 375 |
//! |
| 376 |
//! \param [out] cmdBuffer |
| 377 |
//! Pointer to Command buffer |
| 378 |
//! \param [in] hevcSliceState |
| 379 |
//! Pointer to HEVC Slice State |
| 380 |
//! |
| 381 |
//! \return MOS_STATUS |
| 382 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 383 |
//! |
| 384 |
MOS_STATUS SendSliceLongFormat ( |
| 385 |
PMOS_COMMAND_BUFFER cmdBuffer, |
| 386 |
PMHW_VDBOX_HEVC_SLICE_STATE hevcSliceState); |
| 387 |
|
| 388 |
//! |
| 389 |
//! \brief Determine Decode Phase |
| 390 |
//! \details Determine decode phase in hevc decode |
| 391 |
//! |
| 392 |
//! \return MOS_STATUS |
| 393 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 394 |
//! |
| 395 |
MOS_STATUS DetermineDecodePhase(); |
| 396 |
|
| 397 |
//! |
| 398 |
//! \brief Set Picture Struct |
| 399 |
//! \details Set Picture Struct in HEVC decode driver |
| 400 |
//! |
| 401 |
//! \return MOS_STATUS |
| 402 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 403 |
//! |
| 404 |
MOS_STATUS SetPictureStructs(); |
| 405 |
|
| 406 |
//! |
| 407 |
//! \brief Concatenate the bitstreams and save them to locl buffer if multiple execution call |
| 408 |
//! \details Concatenate the bitstreams and save them to locl buffer if multiple execution call in HEVC decode driver |
| 409 |
//! |
| 410 |
//! \return MOS_STATUS |
| 411 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 412 |
//! |
| 413 |
MOS_STATUS CheckAndCopyBitstream(); |
| 414 |
|
| 415 |
//! |
| 416 |
//! \brief Copy bitstream to local buffer |
| 417 |
//! \details Copy bitstream to local buffer in HEVC decode driver |
| 418 |
//! |
| 419 |
//! \return MOS_STATUS |
| 420 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 421 |
//! |
| 422 |
MOS_STATUS CopyDataSurface(); |
| 423 |
|
| 424 |
//! |
| 425 |
//! \brief Initialize status for bitstream concatenating |
| 426 |
//! \details Initialize status for bitstream concatenating in HEVC decode driver |
| 427 |
//! |
| 428 |
//! \return MOS_STATUS |
| 429 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 430 |
//! |
| 431 |
MOS_STATUS InitializeBitstreamCat (); |
| 432 |
|
| 433 |
//! |
| 434 |
//! \brief Get all tile information |
| 435 |
//! \details Get all tile information in HEVC decode driver |
| 436 |
//! |
| 437 |
//! \return MOS_STATUS |
| 438 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 439 |
//! |
| 440 |
MOS_STATUS GetAllTileInfo(); |
| 441 |
|
| 442 |
//! |
| 443 |
//! \brief Allocate variable sized resources |
| 444 |
//! \details Allocate variable sized resources in HEVC decode driver |
| 445 |
//! \return MOS_STATUS |
| 446 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 447 |
//! |
| 448 |
MOS_STATUS AllocateResourcesVariableSizes(); |
| 449 |
|
| 450 |
//! |
| 451 |
//! \brief Allocate the MV Temporal buffer |
| 452 |
//! |
| 453 |
//! \param [in] hevcMvBuffIndex |
| 454 |
//! buff index for unused mv buffer |
| 455 |
//! |
| 456 |
//! \return MOS_STATUS |
| 457 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 458 |
//! |
| 459 |
MOS_STATUS AllocateMvTemporalBuffer( |
| 460 |
uint8_t hevcMvBuffIndex); |
| 461 |
|
| 462 |
//! |
| 463 |
//! \brief Allocate fixed sized resources |
| 464 |
//! \details Allocate fixed sized resources HEVC decode driver |
| 465 |
//! \return MOS_STATUS |
| 466 |
//! MOS_STATUS_SUCCESS if success, else fail reason |
| 467 |
//! |
| 468 |
MOS_STATUS AllocateResourcesFixedSizes(); |
| 469 |
|
| 470 |
//! |
| 471 |
//! \brief Get mv buffer index |
| 472 |
//! \details Find out an unused MvBuffer and get hte mv buffer index in HEVC decode driver |
| 473 |
//! |
| 474 |
//! \param [in] frameIdx |
| 475 |
//! frame idx associated with unused mv buffer |
| 476 |
//! |
| 477 |
//! \return uint8_t |
| 478 |
//! MV buffer index if success, else return CODEC_NUM_HEVC_MV_BUFFERS |
| 479 |
//! |
| 480 |
uint8_t GetMvBufferIndex( |
| 481 |
uint8_t frameIdx); |
| 482 |
|
| 483 |
#if USE_CODECHAL_DEBUG_TOOL |
| 484 |
MOS_STATUS DumpPicParams( |
| 485 |
PCODEC_HEVC_PIC_PARAMS picParams, |
| 486 |
void* extPicParams); |
| 487 |
|
| 488 |
MOS_STATUS DumpSliceParams( |
| 489 |
PCODEC_HEVC_SLICE_PARAMS sliceParams, |
| 490 |
void* extSliceParams, |
| 491 |
uint32_t numSlices, |
| 492 |
bool shortFormatInUse); |
| 493 |
|
| 494 |
MOS_STATUS DumpIQParams( |
| 495 |
PCODECHAL_HEVC_IQ_MATRIX_PARAMS matrixData); |
| 496 |
|
| 497 |
MOS_STATUS DumpHucS2l(PMHW_VDBOX_HUC_DMEM_STATE_PARAMS hucDmemStateParams); |
| 498 |
|
| 499 |
#endif |
| 500 |
|
| 501 |
static const uint32_t m_hucS2lKernelId = 1; //!< VDBox Huc decode S2L kernel descriptoer |
| 502 |
|
| 503 |
// Parameters passed by application |
| 504 |
uint32_t m_minCtbSize; //!< Min Luma Coding Block Size |
| 505 |
bool m_is10BitHevc; //!< Indicate it is 10 bit HEVC |
| 506 |
bool m_is12BitHevc; //!< Indicate it is 12 bit HEVC |
| 507 |
uint8_t m_chromaFormatinProfile; //!< Chrama format in profile |
| 508 |
bool m_shortFormatInUse; //!< Indicate short format is inuse |
| 509 |
uint32_t m_dataSize; //!< Size of bitstream |
| 510 |
uint32_t m_dataOffset; //!< Offset of bitstream |
| 511 |
uint32_t m_numSlices; //!< Num of slices |
| 512 |
PCODEC_HEVC_PIC_PARAMS m_hevcPicParams; //!< Pointer to HEVC picture parameter |
| 513 |
PCODEC_HEVC_SLICE_PARAMS m_hevcSliceParams; //!< Pointer to HEVC slice parameter |
| 514 |
PCODECHAL_HEVC_IQ_MATRIX_PARAMS m_hevcIqMatrixParams; //!< Pointer to HEVC IQ matrix parameter |
| 515 |
MOS_SURFACE m_destSurface; //!< Handle of render surface |
| 516 |
PMOS_RESOURCE m_presReferences[CODEC_MAX_NUM_REF_FRAME_HEVC]; //!< Pointer to Handle of Reference Frames |
| 517 |
MOS_RESOURCE m_resDataBuffer; //!< Handle of bitstream data surface |
| 518 |
|
| 519 |
bool m_is8BitFrameIn10BitHevc; //!< Indicate 8bit frame in 10bit HEVC stream |
| 520 |
MOS_SURFACE m_internalNv12RtSurfaces[CODECHAL_NUM_INTERNAL_NV12_RT_HEVC]; //!< Handles of internal NV12 render target |
| 521 |
uint32_t m_internalNv12RtIndexMap[CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC]; //!< Index map for internal NV12 render targets |
| 522 |
bool m_internalNv12RtIndexMapInitilized; //!< Indicate the index map of internal NV12 render targets is intialized |
| 523 |
//! \brief Context for NV12ToP010 Kernel |
| 524 |
CodechalDecodeNV12ToP010 *m_decodeNV12ToP010 = nullptr; |
| 525 |
|
| 526 |
//Track for several row store buffer's max picture width in MB used for buffer allocation in past frames |
| 527 |
uint32_t m_mfdDeblockingFilterRowStoreScratchBufferPicWidth; //!< max picture width for deblocking filter row store scratch buffer |
| 528 |
uint32_t m_metadataLineBufferPicWidth; //!< max picture width for meta data line buffer |
| 529 |
uint32_t m_saoLineBufferPicWidth; //!< max picture width for SAO line buffer |
| 530 |
|
| 531 |
// Internally maintained |
| 532 |
MOS_RESOURCE m_resMfdDeblockingFilterRowStoreScratchBuffer; //!< Handle of MFD Deblocking Filter Row Store Scratch data surface |
| 533 |
MOS_RESOURCE m_resDeblockingFilterTileRowStoreScratchBuffer; //!< Handle of Deblocking Filter Tile Row Store Scratch data surface |
| 534 |
MOS_RESOURCE m_resDeblockingFilterColumnRowStoreScratchBuffer; //!< Handle of Deblocking Filter Column Row Store Scratch data surface |
| 535 |
MOS_RESOURCE m_resMetadataLineBuffer; //!< Handle of Metadata Line data buffer |
| 536 |
MOS_RESOURCE m_resMetadataTileLineBuffer; //!< Handle of Metadata Tile Line data buffer |
| 537 |
MOS_RESOURCE m_resMetadataTileColumnBuffer; //!< Handle of Metadata Tile Column data buffer |
| 538 |
MOS_RESOURCE m_resSaoLineBuffer; //!< Handle of SAO Line data buffer |
| 539 |
MOS_RESOURCE m_resSaoTileLineBuffer; //!< Handle of SAO Tile Line data buffer |
| 540 |
MOS_RESOURCE m_resSaoTileColumnBuffer; //!< Handle of SAO Tile Column data buffer |
| 541 |
bool m_mvBufferProgrammed; //!< Indicate mv buffer is programmed |
| 542 |
MOS_RESOURCE m_resMvTemporalBuffer[CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC]; //!< Handles of MV Temporal data buffer, only use CODEC_NUM_HEVC_MV_BUFFERS normally |
| 543 |
uint32_t m_secondLevelBatchBufferIndex; |
| 544 |
MHW_BATCH_BUFFER m_secondLevelBatchBuffer[CODEC_HEVC_NUM_SECOND_BB];//!< Handle of second level batch buffer |
| 545 |
uint32_t m_dmemBufferIdx; //!< Indicate current idx of DMEM buffer to program |
| 546 |
MOS_RESOURCE m_resDmemBuffer[CODECHAL_HEVC_NUM_DMEM_BUFFERS]; //!< Handles of DMEM buffer |
| 547 |
uint32_t m_dmemBufferSize; //!< Size of DMEM buffer |
| 548 |
uint32_t m_dmemTransferSize; //!< Transfer size of DMEM data |
| 549 |
bool m_dmemBufferProgrammed; //!< Indicate DMEM buffer is programmed |
| 550 |
MOS_RESOURCE m_resCopyDataBuffer; //!< Handle of copied bitstream buffer |
| 551 |
uint32_t m_copyDataBufferSize; //!< Size of copied bitstream buffer |
| 552 |
uint32_t m_copyDataOffset; //!< Offset of copied bitstream |
| 553 |
bool m_copyDataBufferInUse; //!< Indicate copied bistream is inuse |
| 554 |
uint32_t m_estiBytesInBitstream; //!< Estimated size of bitstream |
| 555 |
|
| 556 |
MOS_RESOURCE m_resSyncObjectWaContextInUse; //!< signals on the video WA context |
| 557 |
|
| 558 |
bool m_curPicIntra; //!< Indicate current picture is intra |
| 559 |
uint32_t m_mvBufferSize; //!< Size of MV buffer |
| 560 |
|
| 561 |
CODEC_PICTURE m_currPic; //!< Current Picture Struct |
| 562 |
PCODEC_REF_LIST m_hevcRefList[CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC]; //!< Pointer to reference list |
| 563 |
uint8_t m_hevcMvBufferIndex; //!< Index of MV buffer for current picture |
| 564 |
CODECHAL_DECODE_HEVC_MV_LIST m_hevcMvList[CODEC_NUM_HEVC_MV_BUFFERS]; //!< Status table of MV buffers |
| 565 |
bool m_frameUsedAsCurRef[CODEC_MAX_NUM_REF_FRAME_HEVC]; //!< Indicate frames used as reference of current picture |
| 566 |
int8_t m_refIdxMapping[CODEC_MAX_NUM_REF_FRAME_HEVC]; //!< Map table of indices of references |
| 567 |
uint32_t m_frameIdx; //!< Decode order index of current frame |
| 568 |
bool m_enableSf2DmaSubmits; //!< Indicate two DMA submits is enabled on short format |
| 569 |
|
| 570 |
uint16_t m_tileColWidth[HEVC_NUM_MAX_TILE_COLUMN]; //!< Table of tile column width |
| 571 |
uint16_t m_tileRowHeight[HEVC_NUM_MAX_TILE_ROW]; //!< Table of tile row height |
| 572 |
|
| 573 |
uint32_t m_widthLastMaxAlloced; //!< Max Picture Width used for buffer allocation in past frames |
| 574 |
uint32_t m_heightLastMaxAlloced; //!< Max Picture Height used for buffer allocation in past frames |
| 575 |
uint32_t m_ctbLog2SizeYMax; //!< Max CtbLog2 size used for buffer allocation in past frames |
| 576 |
|
| 577 |
uint32_t m_hcpDecPhase; //!< HCP decode phase |
| 578 |
|
| 579 |
#ifdef _DECODE_PROCESSING_SUPPORTED |
| 580 |
// SFC |
| 581 |
CodechalHevcSfcState *m_sfcState = nullptr; //!< HEVC SFC State |
| 582 |
#endif |
| 583 |
PIC_LONG_FORMAT_MHW_PARAMS m_picMhwParams; //!< picture parameters |
| 584 |
|
| 585 |
bool m_dummyReferenceSlot[CODECHAL_MAX_CUR_NUM_REF_FRAME_HEVC]; |
| 586 |
|
| 587 |
bool m_reportHucStatus = false; |
| 588 |
bool m_reportHucCriticalError = false; |
| 589 |
}; |
| 590 |
|
| 591 |
#endif // __CODECHAL_DECODER_HEVC_H__ |