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_render_ief.h 24 //! \brief VP IEF feature interface and structure 25 //! \details VP IEF feature interface and structure 26 //! 27 #ifndef __VP_RENDER_IEF_H__ 28 #define __VP_RENDER_IEF_H__ 29 30 #include <stdint.h> 31 #include "mos_defs.h" 32 #include "media_class_trace.h" 33 #include "mhw_sfc.h" 34 #include "mhw_state_heap.h" 35 #include "mos_resource_defs.h" 36 #include "vp_common.h" 37 namespace mhw 38 { 39 namespace sfc 40 { 41 struct SFC_IEF_STATE_PAR; 42 } 43 } // namespace mhw 44 namespace mhw 45 { 46 namespace sfc 47 { 48 struct SFC_STATE_PAR; 49 } 50 } // namespace mhw 51 52 //! 53 //! Class VpIef 54 //! \brief IEF extension components 55 //! 56 namespace vp{ 57 58 class VpIef 59 { 60 public: 61 //! \brief IEF Constructor 62 //! 63 VpIef(); 64 65 //! \brief IEF Destructor 66 //! \details IEF Destructor 67 //! 68 virtual ~VpIef(); 69 70 //! 71 //! \brief Set HW State(SFC) according to IEF parameter 72 //! \param [in,out] pSfcStateParams 73 //! Pointer to MHW SFC state 74 //! \param [in,out] pSfcIefStateParams 75 //! Pointer to MHW SFC IEF state 76 //! \return MOS_STATUS 77 //! 78 virtual MOS_STATUS SetHwState( 79 PMHW_SFC_STATE_PARAMS pSfcStateParams, 80 PMHW_SFC_IEF_STATE_PARAMS pSfcIefStateParams); 81 82 virtual MOS_STATUS SetHwState( 83 mhw::sfc::SFC_STATE_PAR *pSfcStateParams, 84 mhw::sfc::SFC_IEF_STATE_PAR *pSfcIefStateParams); 85 86 //! 87 //! \brief Set HW State(Sampler) according to IEF parameter 88 //! \param [in,out] pSamplerStateParams 89 //! Pointer to MHW Sampler state 90 //! \return MOS_STATUS 91 //! 92 virtual MOS_STATUS SetHwState( 93 PMHW_SAMPLER_STATE_PARAM pSamplerStateParams); 94 95 //! 96 //! \brief IEF Initialization 97 //! \details Initialize member varible in IEF object. 98 //! \param [in] iefParams 99 //! Pointer to VPHAL Surface IEF Params 100 //! \param [in] format 101 //! IEF Format 102 //! \param fScaleX 103 //! [in] width scaling ratio 104 //! \param fScaleY 105 //! [in] height scaling ratio 106 //! 107 virtual void Init( 108 PVPHAL_IEF_PARAMS iefParams, 109 MOS_FORMAT format, 110 float scaleX, 111 float scaleY); 112 113 protected: 114 //! 115 //! \brief Calculate IEF parameters 116 //! \details Calculate IEF parameters 117 //! \return MOS_STATUS 118 //! 119 virtual MOS_STATUS CalculateIefParams(); 120 121 // VPHAL surface contain required IEF parameter and format info 122 PVPHAL_IEF_PARAMS m_iefParams = nullptr; 123 MOS_FORMAT m_format = Format_Invalid; 124 // IEF parameters 125 uint16_t m_iefFactor = 0; 126 float m_scaleX = 0.0; 127 float m_scaleY = 0.0; 128 // common HW state IEF fields 129 uint32_t m_r5xCoefficient = 0; 130 uint32_t m_r5cxCoefficient = 0; 131 uint32_t m_r5cCoefficient = 0; 132 uint32_t m_r3xCoefficient = 0; 133 uint32_t m_r3cCoefficient = 0; 134 //detail 135 static const uint32_t s_detailStrongEdgeWeight = 7; 136 static const uint32_t s_detailRegularEdgeWeight = 2; 137 static const uint32_t s_iefMaxItem = 64; 138 //IEF R5X coefficient array 139 static const uint32_t s_r5x[s_iefMaxItem]; 140 //IEF R5CX coefficient array 141 static const uint32_t s_r5cx[s_iefMaxItem]; 142 //IEF R5C coefficient array 143 static const uint32_t s_r5c[s_iefMaxItem]; 144 //IEF R3X coefficient array 145 static const uint32_t s_r3x[s_iefMaxItem]; 146 //brief Const IEF R3C coefficient array 147 static const uint32_t s_r3c[s_iefMaxItem]; 148 149 MEDIA_CLASS_DEFINE_END(vp__VpIef) 150 }; 151 152 } 153 #endif // __VP_RENDER_IEF_H__ 154