| 1 | /* |
| 2 | * Copyright (c) 2016-2017, 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 vphal_render_ief.h |
| 24 | //! \brief VPHAL IEF feature interface and structure |
| 25 | //! \details VPHAL IEF feature interface and structure |
| 26 | //! |
| 27 | #ifndef __VPHAL_RENDER_IEF_H__ |
| 28 | #define __VPHAL_RENDER_IEF_H__ |
| 29 | |
| 30 | #include "vphal_common.h" |
| 31 | #include "mhw_sfc.h" |
| 32 | |
| 33 | // Detail filter |
| 34 | #define DETAIL_STRONG_EDGE_WEIGHT 7 |
| 35 | #define DETAIL_NON_EDGE_WEIGHT 1 |
| 36 | #define DETAIL_REGULAR_EDGE_WEIGHT 2 |
| 37 | #define DETAIL_WEAK_EDGE_THRESHOLD 1 |
| 38 | #define DETAIL_STRONG_EDGE_THRESHOLD 8 |
| 39 | |
| 40 | //! |
| 41 | //! \brief IEF Parameters |
| 42 | //! |
| 43 | #define VPHAL_IEF_MIN 0 |
| 44 | #define VPHAL_IEF_MAX 64 |
| 45 | #define VPHAL_IEF_DEFAULT 0 |
| 46 | #define VPHAL_IEF_STEP 1 |
| 47 | #define VPHAL_IEF_OPTIMAL 44 // for perfect SD-HQV Score |
| 48 | #define VPHAL_IEF_UPPER (VPHAL_IEF_MAX - 1 - VPHAL_IEF_OPTIMAL) |
| 49 | #define VPHAL_IEF_VERYSTRONG 63 |
| 50 | |
| 51 | extern const uint32_t R5x[VPHAL_IEF_MAX]; |
| 52 | extern const uint32_t R5cx[VPHAL_IEF_MAX]; |
| 53 | extern const uint32_t R5c[VPHAL_IEF_MAX]; |
| 54 | extern const uint32_t R3x[VPHAL_IEF_MAX]; |
| 55 | extern const uint32_t R3c[VPHAL_IEF_MAX]; |
| 56 | |
| 57 | //! |
| 58 | //! Class Ief |
| 59 | //! \brief IEF extension components |
| 60 | //! |
| 61 | class Ief |
| 62 | { |
| 63 | public: |
| 64 | //! \brief IEF Constructor |
| 65 | //! \param [in] pSource |
| 66 | //! Pointer to VPHAL Surface |
| 67 | //! |
| 68 | Ief( |
| 69 | PVPHAL_SURFACE pSource); |
| 70 | |
| 71 | //! \brief IEF Destructor |
| 72 | //! \details IEF Destructor |
| 73 | //! |
| 74 | virtual ~Ief(); |
| 75 | |
| 76 | //! |
| 77 | //! \brief Set HW State(SFC) according to IEF parameter |
| 78 | //! \param [in,out] pSfcStateParams |
| 79 | //! Pointer to MHW SFC state |
| 80 | //! \param [in,out] pSfcIefStateParams |
| 81 | //! Pointer to MHW SFC IEF state |
| 82 | //! \return MOS_STATUS |
| 83 | //! |
| 84 | MOS_STATUS SetHwState( |
| 85 | PMHW_SFC_STATE_PARAMS pSfcStateParams, |
| 86 | PMHW_SFC_IEF_STATE_PARAMS pSfcIefStateParams); |
| 87 | |
| 88 | //! |
| 89 | //! \brief Set HW State(Sampler) according to IEF parameter |
| 90 | //! \param [in,out] pSamplerStateParams |
| 91 | //! Pointer to MHW Sampler state |
| 92 | //! \return MOS_STATUS |
| 93 | //! |
| 94 | MOS_STATUS SetHwState( |
| 95 | PMHW_SAMPLER_STATE_PARAM pSamplerStateParams); |
| 96 | |
| 97 | protected: |
| 98 | //! |
| 99 | //! \brief Calculate IEF parameters |
| 100 | //! \details Calculate IEF parameters |
| 101 | //! \return MOS_STATUS |
| 102 | //! |
| 103 | MOS_STATUS CalculateIefParams(); |
| 104 | |
| 105 | // VPHAL surface contain required IEF parameter and format info |
| 106 | PVPHAL_SURFACE m_pSource; |
| 107 | |
| 108 | // IEF parameters |
| 109 | uint16_t m_wIEFFactor; |
| 110 | |
| 111 | // common HW state IEF fields |
| 112 | uint32_t m_dwR5xCoefficient; |
| 113 | uint32_t m_dwR5cxCoefficient; |
| 114 | uint32_t m_dwR5cCoefficient; |
| 115 | uint32_t m_dwR3xCoefficient; |
| 116 | uint32_t m_dwR3cCoefficient; |
| 117 | }; |
| 118 | |
| 119 | #endif // __VPHAL_RENDER_IEF_H__ |