xref: /aosp_15_r20/external/intel-media-driver/media_softlet/agnostic/common/vp/hal/features/vp_di_filter.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2020-2021, 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_di_filter.h
24 //! \brief    Defines the common interface for ace
25 //!           this file is for the base interface which is shared by all ace in driver.
26 //!
27 #ifndef __VP_DI_FILTER_H__
28 #define __VP_DI_FILTER_H__
29 #include "vp_filter.h"
30 #include "sw_filter.h"
31 
32 #define FMD_SUMMATION_KERNEL_COLUMN_PER_MEDIA_OBJECT 4
33 #define VP_VEBOX_PER_BLOCK_STATISTICS_SIZE 16
34 
35 namespace vp {
36 class VpDiFilter : public VpFilter
37 {
38 public:
39 
40     VpDiFilter(
41         PVP_MHWINTERFACE vpMhwInterface);
42 
~VpDiFilter()43     ~VpDiFilter()
44     {
45         Destroy();
46     };
47 
48     virtual MOS_STATUS Init() override;
49 
50     virtual MOS_STATUS Prepare() override;
51 
52     virtual MOS_STATUS Destroy() override;
53 
54     virtual MOS_STATUS SetExecuteEngineCaps(
55         FeatureParamDeinterlace &diParams,
56         VP_EXECUTE_CAPS         vpExecuteCaps);
57 
58     MOS_STATUS CalculateEngineParams();
GetVeboxParams()59     PVEBOX_DI_PARAMS GetVeboxParams()
60     {
61         return m_pVeboxDiParams;
62     }
63 
64 protected:
65     FeatureParamDeinterlace     m_diParams = {};
66     PVEBOX_DI_PARAMS            m_pVeboxDiParams = nullptr;
67 
68 MEDIA_CLASS_DEFINE_END(vp__VpDiFilter)
69 };
70 
71 struct HW_FILTER_DI_PARAM : public HW_FILTER_PARAM
72 {
73     FeatureParamDeinterlace     diParams;
74 };
75 
76 class HwFilterDiParameter : public HwFilterParameter
77 {
78 public:
79     static HwFilterParameter *Create(HW_FILTER_DI_PARAM &param, FeatureType featureType);
80     HwFilterDiParameter(FeatureType featureType);
81     virtual ~HwFilterDiParameter();
82     virtual MOS_STATUS ConfigParams(HwFilter &hwFilter);
83 
84     MOS_STATUS Initialize(HW_FILTER_DI_PARAM&param);
85 
86 private:
87     HW_FILTER_DI_PARAM m_Params = {};
88 
89 MEDIA_CLASS_DEFINE_END(vp__HwFilterDiParameter)
90 };
91 
92 class VpDiParameter : public VpPacketParameter
93 {
94 public:
95     static VpPacketParameter *Create(HW_FILTER_DI_PARAM &param);
96     VpDiParameter(PVP_MHWINTERFACE pHwInterface, PacketParamFactoryBase *packetParamFactory);
97     virtual ~VpDiParameter();
98 
99     virtual bool SetPacketParam(VpCmdPacket *pPacket);
100 
101 private:
102     MOS_STATUS Initialize(HW_FILTER_DI_PARAM&params);
103 
104     VpDiFilter m_diFilter;
105 
106 MEDIA_CLASS_DEFINE_END(vp__VpDiParameter)
107 };
108 
109 class PolicyDiHandler : public PolicyFeatureHandler
110 {
111 public:
112     PolicyDiHandler(VP_HW_CAPS &hwCaps);
113     virtual ~PolicyDiHandler();
114     virtual bool IsFeatureEnabled(VP_EXECUTE_CAPS vpExecuteCaps);
115     virtual HwFilterParameter *CreateHwFilterParam(VP_EXECUTE_CAPS vpExecuteCaps, SwFilterPipe &swFilterPipe, PVP_MHWINTERFACE pHwInterface);
116 
CreatePacketParam(HW_FILTER_PARAM & param)117     static VpPacketParameter* CreatePacketParam(HW_FILTER_PARAM& param)
118     {
119         if (param.type != FeatureTypeDiOnVebox)
120         {
121             VP_PUBLIC_ASSERTMESSAGE("Invalid parameter for Deinterlace!");
122             return nullptr;
123         }
124 
125         HW_FILTER_DI_PARAM *diParam = (HW_FILTER_DI_PARAM *)(&param);
126         return VpDiParameter::Create(*diParam);
127     }
128 
129 private:
130     PacketParamFactory<VpDiParameter> m_PacketParamFactory;
131 
132 MEDIA_CLASS_DEFINE_END(vp__PolicyDiHandler)
133 };
134 }
135 #endif
136