1 /* 2 * Copyright (c) 2019-2022, 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 //! 24 //! \file encode_vp9_vdenc_feature_manager.h 25 //! \brief Defines the common interface for vp9 vdenc feature manager 26 //! \details The encode feature manager is further sub-divided by platform type. 27 //! This file is for the base interface which is shared by all platforms. 28 //! 29 30 #ifndef __ENCODE_VP9_VDENC_FEATURE_MANAGER_H__ 31 #define __ENCODE_VP9_VDENC_FEATURE_MANAGER_H__ 32 #include <vector> 33 #include "media_vp9_feature_defs.h" 34 #include "encode_feature_manager.h" 35 #include "encode_vp9_basic_feature.h" 36 #include "encode_vp9_tile.h" 37 #include "codec_hw_next.h" 38 #include "encode_recycle_resource.h" 39 #include "encode_tracked_buffer.h" 40 41 namespace encode 42 { 43 44 class EncodeVp9VdencFeatureManager : public EncodeFeatureManager 45 { 46 public: 47 //! 48 //! \brief EncodeVp9VdencFeatureManager constructor 49 //! \param [in] allocator 50 //! Pointer to EncodeAllocator 51 //! \param [in] hwInterface 52 //! Pointer to CodechalHwInterface 53 //! \param [in] trackedBuf 54 //! Pointer to TrackedBuffer 55 //! \param [in] recycleBuf 56 //! Pointer to RecycleResource 57 //! EncodeVp9VdencFeatureManager(EncodeAllocator * allocator,CodechalHwInterfaceNext * hwInterface,TrackedBuffer * trackedBuf,RecycleResource * recycleBuf)58 EncodeVp9VdencFeatureManager(EncodeAllocator *allocator, 59 CodechalHwInterfaceNext *hwInterface, 60 TrackedBuffer *trackedBuf, 61 RecycleResource *recycleBuf): 62 m_allocator(allocator), 63 m_hwInterface(hwInterface), 64 m_recycleResource(recycleBuf), 65 m_trackedBuf(trackedBuf) {}; 66 67 //! 68 //! \brief EncodeVp9VdencFeatureManager destructor 69 //! ~EncodeVp9VdencFeatureManager()70 virtual ~EncodeVp9VdencFeatureManager() {} 71 72 //! 73 //! \brief Check the conflict between features 74 //! \param [in] params 75 //! encode parameters 76 //! \return MOS_STATUS 77 //! MOS_STATUS_SUCCESS if success, else fail reason 78 //! 79 virtual MOS_STATUS CheckFeatures(void *params) override; 80 81 //! 82 //! \brief Set Pass Number 83 //! \param [in] passNum 84 //! Number of passes 85 //! \return void 86 //! SetNumPass(uint8_t passNum)87 void SetNumPass(uint8_t passNum) { m_passNum = passNum; }; 88 89 protected: 90 //! 91 //! \brief Create feature const settings 92 //! \return MOS_STATUS 93 //! MOS_STATUS_SUCCESS if success, else fail reason 94 //! 95 virtual MOS_STATUS CreateConstSettings() override; 96 97 //! 98 //! \brief Create features 99 //! \param [in] constsettings 100 //! feature const settings 101 //! \return MOS_STATUS 102 //! MOS_STATUS_SUCCESS if success, else fail reason 103 //! 104 virtual MOS_STATUS CreateFeatures(void *constSettings) override; 105 106 //! 107 //! \brief Map target usage 108 //! \param [in, out] targetUsage 109 //! Target usage 110 //! \return MOS_STATUS 111 //! MOS_STATUS_SUCCESS if success, else fail reason 112 //! 113 virtual MOS_STATUS MapTargetUsage(uint8_t &targetUsage); 114 115 //! 116 //! \brief Validate number of passes 117 //! \param [in] vp9SeqParams 118 //! sequence parameters from DDI 119 //! \param [in] vp9PictureParams 120 //! picture parameters from DDI 121 //! \return MOS_STATUS 122 //! MOS_STATUS_SUCCESS if success, else fail reason 123 //! 124 MOS_STATUS ValidatePassNum( 125 PCODEC_VP9_ENCODE_SEQUENCE_PARAMS vp9SeqParams, 126 PCODEC_VP9_ENCODE_PIC_PARAMS vp9PicParams); 127 128 EncodeAllocator *m_allocator = nullptr; 129 130 CodechalHwInterfaceNext *m_hwInterface = nullptr; 131 RecycleResource * m_recycleResource = nullptr; 132 TrackedBuffer * m_trackedBuf = nullptr; 133 134 MEDIA_CLASS_DEFINE_END(encode__EncodeVp9VdencFeatureManager) 135 }; 136 137 } // namespace encode 138 #endif // !__ENCODE_HEVC_VDENC_FEATURE_MANAGER_H__ 139