1 /* 2 * Copyright (c) 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_scc.h 24 //! \brief Defines for hevc screen content coding feature 25 //! 26 #ifndef __ENCODE_HEVC_VDENC_SCC_H__ 27 #define __ENCODE_HEVC_VDENC_SCC_H__ 28 29 #include "media_feature.h" 30 #include "encode_allocator.h" 31 #include "encode_basic_feature.h" 32 #include "mhw_vdbox_vdenc_itf.h" 33 #include "mhw_vdbox_hcp_itf.h" 34 35 namespace encode 36 { 37 class HevcVdencScc : public MediaFeature, public mhw::vdbox::vdenc::Itf::ParSetting, public mhw::vdbox::hcp::Itf::ParSetting 38 { 39 public: 40 HevcVdencScc( 41 MediaFeatureManager *featureManager, 42 EncodeAllocator *allocator, 43 CodechalHwInterfaceNext *hwInterface, 44 void *constSettings); 45 46 virtual ~HevcVdencScc(); 47 48 //! 49 //! \brief Init scc basic features related parameter 50 //! 51 //! \param [in] settings 52 //! Pointer to settings 53 //! 54 //! \return MOS_STATUS 55 //! MOS_STATUS_SUCCESS if success, else fail reason 56 //! 57 MOS_STATUS Init(void *settings) override; 58 59 //! 60 //! \brief Update scc features related parameter 61 //! 62 //! \param [in] params 63 //! Pointer to parameters 64 //! 65 //! \return MOS_STATUS 66 //! MOS_STATUS_SUCCESS if success, else fail reason 67 //! 68 MOS_STATUS Update(void *params) override; 69 70 //! 71 //! \brief Set huc dmem of brc update for scc 72 //! 73 //! \param [in out] hucVdencBrcUpdateDmem 74 //! Reference of CODECHAL_VDENC_HEVC_HUC_BRC_UPDATE_DMEM_G12 75 //! 76 //! \return MOS_STATUS 77 //! MOS_STATUS_SUCCESS if success, else fail reason 78 //! 79 MOS_STATUS SetHucBrcUpdateDmem(void* hucVdencBrcUpdateDmem); 80 81 //! 82 //! \brief SetRecNotFilteredID parameters 83 //! 84 //! \param [in, out] slotForRecNotFiltered 85 //! Slot ID for not filtered reconstructed surface 86 //! 87 //! \return MOS_STATUS 88 //! MOS_STATUS_SUCCESS if success, else fail reason 89 //! 90 MOS_STATUS SetRecNotFilteredID(unsigned char &slotForRecNotFiltered); 91 92 //! 93 //! \brief Check if SCC enabled 94 //! 95 //! \return bool 96 //! true if SCC enabled, else SCC disabled. 97 //! IsSCCEnabled()98 bool IsSCCEnabled() { return m_enableSCC; } 99 IsCompressFlagNeeded()100 virtual bool IsCompressFlagNeeded() { return true; } 101 102 MHW_SETPAR_DECL_HDR(VDENC_PIPE_MODE_SELECT); 103 104 MHW_SETPAR_DECL_HDR(VDENC_PIPE_BUF_ADDR_STATE); 105 106 MHW_SETPAR_DECL_HDR(VDENC_CMD2); 107 108 MHW_SETPAR_DECL_HDR(HCP_PIC_STATE); 109 110 MHW_SETPAR_DECL_HDR(HCP_PIPE_BUF_ADDR_STATE); 111 112 MHW_SETPAR_DECL_HDR(HCP_SURFACE_STATE); 113 114 MHW_SETPAR_DECL_HDR(HCP_REF_IDX_STATE); 115 116 MHW_SETPAR_DECL_HDR(VDENC_HEVC_VP9_TILE_SLICE_STATE); 117 118 protected: 119 MOS_STATUS AllocateEncResources(); 120 MOS_STATUS FreeEncResources(); 121 122 PMOS_INTERFACE m_osInterface = nullptr; //!< Os Inteface 123 MOS_RESOURCE m_vdencRecNotFilteredBuffer = {}; 124 125 bool m_enableLBCOnly = false; //!< Enable LBC only for IBC 126 bool m_enableSCC = false; //!< Flag to indicate if HEVC SCC is enabled. 127 unsigned char m_slotForRecNotFiltered = 0; //!< Slot for not filtered reconstructed surface 128 129 EncodeBasicFeature *m_basicFeature = nullptr; //!< EncodeBasicFeature 130 bool m_mmcEnabled = false; 131 MOS_CONTEXT_HANDLE m_mosCtx = nullptr; 132 133 MEDIA_CLASS_DEFINE_END(encode__HevcVdencScc) 134 }; 135 136 } // namespace encode 137 138 #endif // !__ENCODE_HEVC_VDENC_SCC_H__ 139