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 vp_dn_filter.h 24 //! \brief Defines the common interface for denoise 25 //! this file is for the base interface which is shared by all denoise in driver. 26 //! 27 #ifndef __VP_DN_FILTER_H__ 28 #define __VP_DN_FILTER_H__ 29 #include "vp_filter.h" 30 #include "sw_filter.h" 31 32 namespace vp { 33 class VpDnFilter : public VpFilter 34 { 35 public: 36 37 VpDnFilter( 38 PVP_MHWINTERFACE vpMhwInterface); 39 ~VpDnFilter()40 ~VpDnFilter() 41 { 42 Destroy(); 43 }; 44 45 virtual MOS_STATUS Init() override; 46 47 virtual MOS_STATUS Prepare() override; 48 49 virtual MOS_STATUS Destroy() override; 50 51 virtual MOS_STATUS SetExecuteEngineCaps( 52 FeatureParamDenoise &dnParams, 53 VP_EXECUTE_CAPS vpExecuteCaps); 54 55 MOS_STATUS CalculateEngineParams(); GetVeboxParams()56 PVEBOX_DN_PARAMS GetVeboxParams() 57 { 58 return m_veboxDnParams; 59 } 60 61 protected: 62 FeatureParamDenoise m_dnParams = {}; 63 PVEBOX_DN_PARAMS m_veboxDnParams = nullptr; 64 }; 65 66 67 struct HW_FILTER_DN_PARAM 68 { 69 FeatureType type; 70 PVP_MHWINTERFACE pHwInterface; 71 VP_EXECUTE_CAPS vpExecuteCaps; 72 PacketParamFactoryBase *pPacketParamFactory; 73 FeatureParamDenoise dnParams; 74 }; 75 76 class HwFilterDnParameter : public HwFilterParameter 77 { 78 public: 79 static HwFilterParameter *Create(HW_FILTER_DN_PARAM ¶m, FeatureType featureType); 80 HwFilterDnParameter(FeatureType featureType); 81 virtual ~HwFilterDnParameter(); 82 virtual MOS_STATUS ConfigParams(HwFilter &hwFilter); 83 84 MOS_STATUS Initialize(HW_FILTER_DN_PARAM¶m); 85 86 private: 87 HW_FILTER_DN_PARAM m_Params = {}; 88 }; 89 90 class VpVeboxDnParameter : public VpPacketParameter 91 { 92 public: 93 static VpPacketParameter *Create(HW_FILTER_DN_PARAM ¶m); 94 VpVeboxDnParameter(PVP_MHWINTERFACE pHwInterface, PacketParamFactoryBase *packetParamFactory); 95 virtual ~VpVeboxDnParameter(); 96 97 virtual bool SetPacketParam(VpCmdPacket *pPacket); 98 99 private: 100 MOS_STATUS Initialize(HW_FILTER_DN_PARAM¶ms); 101 102 VpDnFilter m_dnFilter; 103 }; 104 105 class PolicyVeboxDnHandler : public PolicyFeatureHandler 106 { 107 public: 108 PolicyVeboxDnHandler(); 109 virtual ~PolicyVeboxDnHandler(); 110 virtual bool IsFeatureEnabled(VP_EXECUTE_CAPS vpExecuteCaps); 111 virtual HwFilterParameter *CreateHwFilterParam(VP_EXECUTE_CAPS vpExecuteCaps, SwFilterPipe &swFilterPipe, PVP_MHWINTERFACE pHwInterface); 112 113 private: 114 PacketParamFactory<VpVeboxDnParameter> m_PacketParamFactory; 115 }; 116 } 117 #endif 118