| 1 |
/* |
| 2 |
* Copyright (c) 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_vebox_ste.cpp |
| 24 |
//! \brief VPHAL VEBOX IECP Skin Tone Detect & Enhancement (STD/E) interfaces |
| 25 |
//! \details VPHAL VEBOX IECP Skin Tone Detect & Enhancement (STD/E) interfaces |
| 26 |
//! |
| 27 |
|
| 28 |
#include "vphal_render_vebox_ste.h" |
| 29 |
|
| 30 |
#if VPHAL_RENDER_VEBOX_STE_ENABLE |
| 31 |
|
| 32 |
#define MHW_STE_FACTOR_MAX 9 // STE factor is 0 ~ 9 |
| 33 |
|
| 34 |
const uint32_t satP1[MHW_STE_FACTOR_MAX + 1] = { |
| 35 |
0x00000000, 0xfffffffe, 0xfffffffc, 0xfffffffa, 0xfffffff6, 0xfffffff4, 0xfffffff2, 0xfffffff0, 0xffffffee, 0xffffffec }; |
| 36 |
|
| 37 |
const uint32_t satS0[MHW_STE_FACTOR_MAX + 1] = { |
| 38 |
0x000000ef, 0x00000100, 0x00000113, 0x00000129, 0x0000017a, 0x000001a2, 0x000001d3, 0x00000211, 0x00000262, 0x000002d1 }; |
| 39 |
|
| 40 |
const uint32_t satS1[MHW_STE_FACTOR_MAX + 1] = { |
| 41 |
0x000000ab, 0x00000080, 0x00000066, 0x00000055, 0x000000c2, 0x000000b9, 0x000000b0, 0x000000a9, 0x000000a2, 0x0000009c }; |
| 42 |
|
| 43 |
//! |
| 44 |
//! \brief Vebox set IECP parameter |
| 45 |
//! \details Set Vebox IECP state parameter |
| 46 |
//! \param [in] pSrcSurface |
| 47 |
//! Pointer to input surface of Vebox |
| 48 |
//! \param [in,out] pRenderData |
| 49 |
//! Pointer to Vebox Render Data |
| 50 |
//! \return void |
| 51 |
//! |
| 52 |
void VPHAL_VEBOX_IECP_STE::SetParams( |
| 53 |
PVPHAL_SURFACE pSrcSurface, |
| 54 |
PVPHAL_VEBOX_RENDER_DATA pRenderData) |
| 55 |
{ |
| 56 |
PVPHAL_VEBOX_IECP_PARAMS pVphalVeboxIecpParams; |
| 57 |
|
| 58 |
pVphalVeboxIecpParams = pRenderData->GetVeboxIECPParams(); |
| 59 |
|
| 60 |
if (pSrcSurface->pColorPipeParams && pRenderData->bColorPipe) |
| 61 |
{ |
| 62 |
pVphalVeboxIecpParams->pColorPipeParams = pSrcSurface->pColorPipeParams; |
| 63 |
|
| 64 |
pRenderData->GetVeboxStateParams()->pVphalVeboxIecpParams = pVphalVeboxIecpParams; |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
//! |
| 69 |
//! \brief Init Vebox IECP parameter |
| 70 |
//! \param [in] pVphalVeboxIecpParams |
| 71 |
//! Pointer to input Vphal Iecp parameters |
| 72 |
//! \param [in,out] pMhwVeboxIecpParams |
| 73 |
//! Pointer to Mhw Iecp parameters |
| 74 |
//! \return void |
| 75 |
//! |
| 76 |
void VPHAL_VEBOX_IECP_STE::InitParams( |
| 77 |
PVPHAL_VEBOX_IECP_PARAMS pVphalVeboxIecpParams, |
| 78 |
PMHW_VEBOX_IECP_PARAMS pMhwVeboxIecpParams) |
| 79 |
{ |
| 80 |
PVPHAL_COLORPIPE_PARAMS pVpHalColorPipeParams; |
| 81 |
PMHW_COLORPIPE_PARAMS pMhwColorPipeParams; |
| 82 |
|
| 83 |
pVpHalColorPipeParams = pVphalVeboxIecpParams->pColorPipeParams; |
| 84 |
pMhwColorPipeParams = &pMhwVeboxIecpParams->ColorPipeParams; |
| 85 |
if (pVpHalColorPipeParams) |
| 86 |
{ |
| 87 |
if (pVpHalColorPipeParams->SteParams.dwSTEFactor > MHW_STE_FACTOR_MAX) |
| 88 |
{ |
| 89 |
pVpHalColorPipeParams->SteParams.dwSTEFactor = MHW_STE_FACTOR_MAX; |
| 90 |
} |
| 91 |
|
| 92 |
pMhwColorPipeParams->bActive = true; |
| 93 |
pMhwColorPipeParams->bEnableSTE = pVpHalColorPipeParams->bEnableSTE; |
| 94 |
pMhwColorPipeParams->SteParams.dwSTEFactor = pVpHalColorPipeParams->SteParams.dwSTEFactor; |
| 95 |
pMhwColorPipeParams->SteParams.satP1 = satP1[pVpHalColorPipeParams->SteParams.dwSTEFactor]; |
| 96 |
pMhwColorPipeParams->SteParams.satS0 = satS0[pVpHalColorPipeParams->SteParams.dwSTEFactor]; |
| 97 |
pMhwColorPipeParams->SteParams.satS1 = satS1[pVpHalColorPipeParams->SteParams.dwSTEFactor]; |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
#endif // VPHAL_RENDER_VEBOX_STE_ENABLE |