1 /* 2 * Copyright (c) 2018-2020, 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 encode_hevc_vdenc_weighted_prediction.h 24 //! \brief Defines for hevc weighted prediction feature 25 //! 26 #ifndef __ENCODE_HEVC_VDENC_WEIGHTED_PREDICTION_H__ 27 #define __ENCODE_HEVC_VDENC_WEIGHTED_PREDICTION_H__ 28 29 #include "media_feature.h" 30 #include "encode_allocator.h" 31 #include "codec_hw_next.h" 32 #include "encode_huc_brc_update_packet.h" 33 #include "mhw_vdbox_vdenc_itf.h" 34 #include "mhw_vdbox_hcp_itf.h" 35 36 namespace encode 37 { 38 class HevcVdencWeightedPred : public MediaFeature, public mhw::vdbox::vdenc::Itf::ParSetting, public mhw::vdbox::hcp::Itf::ParSetting 39 { 40 public: 41 HevcVdencWeightedPred( 42 MediaFeatureManager *featureManager, 43 EncodeAllocator *allocator, 44 CodechalHwInterfaceNext *hwInterface, 45 void *constSettings); 46 47 //! 48 //! \brief Update weighted prediction features related parameter 49 //! \param [in] params 50 //! Pointer to parameters 51 //! \return MOS_STATUS 52 //! MOS_STATUS_SUCCESS if success, else fail reason 53 //! 54 MOS_STATUS Update(void *params) override; 55 56 //! 57 //! \brief Set HuC dmem of BRC update for weighted prediction 58 //! 59 //! \param [in] isFirstPass 60 //! Whether is first pass or not 61 //! \param [out] dmem 62 //! Reference of CODECHAL_VDENC_HEVC_HUC_BRC_UPDATE_DMEM_G12 63 //! 64 //! \return MOS_STATUS 65 //! MOS_STATUS_SUCCESS if success, else fail reason 66 //! 67 MOS_STATUS SetHucBrcUpdateDmemBuffer( 68 bool isFirstPass, 69 VdencHevcHucBrcUpdateDmem &dmem); 70 71 //! 72 //! \brief Set HuC Constant data of BRC update for weighted prediction 73 //! 74 //! \param [in] hevcSlcParams 75 //! Reference of HEVC slice parameters 76 //! \param [in] sliceIndex 77 //! Index of slice 78 //! \param [in] weightOffsetStateCmdSize 79 //! Command size of weight offset state 80 //! \param [in, out] sliceLocation 81 //! the location of slice in command 82 //! \param [out] constantData 83 //! Reference of CODECHAL_VDENC_HEVC_HUC_BRC_CONSTANT_DATA_G12 84 //! 85 //! \return MOS_STATUS 86 //! MOS_STATUS_SUCCESS if success, else fail reason 87 //! 88 MOS_STATUS SetHucBrcUpdateConstData( 89 const CODEC_HEVC_ENCODE_SLICE_PARAMS &hevcSliceParams, 90 uint32_t sliceIndex, 91 uint32_t weightOffsetStateCmdSize, 92 uint32_t &sliceLocation, 93 VdencHevcHucBrcConstantData &constantData); 94 95 MHW_SETPAR_DECL_HDR(VDENC_WEIGHTSOFFSETS_STATE); 96 97 MHW_SETPAR_DECL_HDR(HCP_WEIGHTOFFSET_STATE); 98 99 MHW_SETPAR_DECL_HDR(VDENC_HEVC_VP9_TILE_SLICE_STATE); 100 101 protected: 102 PCODEC_HEVC_ENCODE_SLICE_PARAMS m_hevcSliceParams = nullptr; //!< Pointer to slice parameter 103 bool m_bEnableGPUWeightedPrediction = false; 104 HevcBasicFeature *m_basicFeature = nullptr; 105 106 MEDIA_CLASS_DEFINE_END(encode__HevcVdencWeightedPred) 107 }; 108 109 } // namespace encode 110 111 #endif // !__ENCODE_HEVC_VDENC_WEIGHTED_PREDICTION_H__ 112