Skip to content

Commit

Permalink
[VP] RefactorHDR10 1k1dlut and DV 256 1dlut on base code
Browse files Browse the repository at this point in the history
RefactorHDR10 1k1dlut and DV 256 1dlut on base code.
  • Loading branch information
VickyZengg authored and intel-mediadev committed Jul 8, 2024
1 parent 1ab8969 commit 8b9ce32
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,6 @@ MOS_STATUS VpPlatformInterfacsXe2_Lpm::InitPolicyRules(VP_POLICY_RULES &rules)
VP_PUBLIC_CHK_STATUS_RETURN(VpPlatformInterface::InitPolicyRules(rules));

rules.isHDR33LutSizeEnabled = true;
rules.is1K1DLutSurfaceInUse = true;
return MOS_STATUS_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -554,4 +554,40 @@ MOS_STATUS VpVeboxCmdPacketXe_Lpm_Plus_Base::InitSurfMemCacheControl(VP_EXECUTE_
return MOS_STATUS_SUCCESS;
}

MOS_STATUS VpVeboxCmdPacketXe_Lpm_Plus_Base::SetupVebox3DLutForHDR(
mhw::vebox::VEBOX_STATE_PAR &veboxStateCmdParams)
{
PMHW_VEBOX_MODE pVeboxMode = nullptr;
PMHW_VEBOX_3D_LUT pLUT3D = nullptr;
PVP_SURFACE surf3DLut = GetSurface(SurfaceType3DLut);
VpVeboxRenderData *pRenderData = GetLastExecRenderData();

VP_RENDER_CHK_NULL_RETURN(m_surfMemCacheCtl);
VP_RENDER_CHK_NULL_RETURN(surf3DLut);
VP_RENDER_CHK_NULL_RETURN(surf3DLut->osSurface);
VP_RENDER_CHK_NULL_RETURN(pRenderData);

VP_RENDER_CHK_STATUS_RETURN(Init3DLutTable(surf3DLut));

pVeboxMode = &veboxStateCmdParams.VeboxMode;
pLUT3D = &veboxStateCmdParams.LUT3D;

pLUT3D->ArbitrationPriorityControl = 0;
pLUT3D->Lut3dEnable = true;
// Config 3DLut size to 65 for HDR10 usage.
pLUT3D->Lut3dSize = 2;
if (pRenderData->HDR3DLUT.uiLutSize == 33)
{
pLUT3D->Lut3dSize = 0; // 33x33x33
}

veboxStateCmdParams.Vebox3DLookUpTablesSurfCtrl.Value =
m_surfMemCacheCtl->DnDi.Vebox3DLookUpTablesSurfMemObjCtl;

pVeboxMode->ColorGamutExpansionEnable = true;

veboxStateCmdParams.pVebox3DLookUpTables = &surf3DLut->osSurface->OsResource;

return MOS_STATUS_SUCCESS;
}
} // namespace vp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ class VpVeboxCmdPacketXe_Lpm_Plus_Base : virtual public VpVeboxCmdPacket
uint32_t * pQuery) override;

virtual MOS_STATUS InitSurfMemCacheControl(VP_EXECUTE_CAPS packetCaps) override;
virtual MOS_STATUS SetupVebox3DLutForHDR(
mhw::vebox::VEBOX_STATE_PAR &veboxStateCmdParams) override;

protected:
VpVeboxCmdPacketXe_Lpm_Plus_Base(MediaTask *task, PVP_MHWINTERFACE hwInterface, PVpAllocator &allocator, VPMediaMemComp *mmc);
Expand Down
64 changes: 49 additions & 15 deletions media_softlet/agnostic/common/vp/hal/packet/vp_vebox_cmd_packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,39 +181,73 @@ MOS_STATUS VpVeboxCmdPacket::SetupVeboxExternal3DLutforHDR(
return MOS_STATUS_SUCCESS;
}

MOS_STATUS VpVeboxCmdPacket::SetupVebox3DLutForHDR(
mhw::vebox::VEBOX_STATE_PAR &veboxStateCmdParams)
MOS_STATUS VpVeboxCmdPacket::Add1DLutState(PVP_SURFACE &surface, PMHW_1DLUT_PARAMS p1DLutParams)
{
PMHW_VEBOX_MODE pVeboxMode = nullptr;
PMHW_VEBOX_3D_LUT pLUT3D = nullptr;
PVP_SURFACE surf3DLut = GetSurface(SurfaceType3DLut);
VP_FUNC_CALL();
if (m_PacketCaps.b1K1DLutInited)
{
VP_RENDER_NORMALMESSAGE("1K1DLut Surface is reused for HDR");
return MOS_STATUS_SUCCESS;
}
VP_RENDER_CHK_NULL_RETURN(surface);
void *sur = (void *)m_allocator->LockResourceForWrite(&surface->osSurface->OsResource);
VP_PUBLIC_CHK_NULL_RETURN(sur);
VpVeboxRenderData *pRenderData = GetLastExecRenderData();
VP_PUBLIC_CHK_NULL_RETURN(m_veboxItf);
VP_PUBLIC_CHK_NULL_RETURN(pRenderData);

if (m_veboxItf)
{
m_veboxItf->Add1DLutState(sur, p1DLutParams);
VP_RENDER_NORMALMESSAGE("1K1DLut Surface is inited for HDR");
}

VP_PUBLIC_CHK_STATUS_RETURN(m_allocator->UnLock(&surface->osSurface->OsResource));
return MOS_STATUS_SUCCESS;
}

MOS_STATUS VpVeboxCmdPacket::SetupVebox3DLutForHDR(mhw::vebox::VEBOX_STATE_PAR &veboxStateCmdParams)
{
PMHW_VEBOX_MODE pVeboxMode = nullptr;
PMHW_VEBOX_3D_LUT pLUT3D = nullptr;
PMHW_1DLUT_PARAMS p1DLutParams = nullptr;
PVP_SURFACE surf3DLut = GetSurface(SurfaceType3DLut);
VpVeboxRenderData *pRenderData = GetLastExecRenderData();

VP_RENDER_CHK_NULL_RETURN(m_surfMemCacheCtl);
VP_RENDER_CHK_NULL_RETURN(surf3DLut);
VP_RENDER_CHK_NULL_RETURN(surf3DLut->osSurface);
VP_RENDER_CHK_NULL_RETURN(pRenderData);

VP_RENDER_CHK_STATUS_RETURN(Init3DLutTable(surf3DLut));

pVeboxMode = &veboxStateCmdParams.VeboxMode;
pLUT3D = &veboxStateCmdParams.LUT3D;
pVeboxMode = &veboxStateCmdParams.VeboxMode;
pLUT3D = &veboxStateCmdParams.LUT3D;
p1DLutParams = &(pRenderData->GetIECPParams().s1DLutParams);
pLUT3D->ArbitrationPriorityControl = 0;
pLUT3D->Lut3dEnable = true;

pLUT3D->ArbitrationPriorityControl = 0;
pLUT3D->Lut3dEnable = true;
// Config 3DLut size to 65 for HDR10 usage.
pLUT3D->Lut3dSize = 2;
pLUT3D->Lut3dSize = 2;
if (pRenderData->HDR3DLUT.uiLutSize == 33)
{
pLUT3D->Lut3dSize = 0; // 33x33x33
}

veboxStateCmdParams.Vebox3DLookUpTablesSurfCtrl.Value =
m_surfMemCacheCtl->DnDi.Vebox3DLookUpTablesSurfMemObjCtl;
veboxStateCmdParams.Vebox3DLookUpTablesSurfCtrl.Value = m_surfMemCacheCtl->DnDi.Vebox3DLookUpTablesSurfMemObjCtl;

//Use 1K1DLUT instead of Gamut Expansion
pVeboxMode->ColorGamutExpansionEnable = false;

PVP_SURFACE surface = GetSurface(SurfaceType1k1dLut);
VP_RENDER_CHK_NULL_RETURN(surface);
VP_RENDER_CHK_STATUS_RETURN(Add1DLutState(surface, nullptr));

pVeboxMode->ColorGamutExpansionEnable = true;
veboxStateCmdParams.pVebox1DLookUpTables = &(surface->osSurface->OsResource);
pVeboxMode->Hdr1K1DLut = true;
pVeboxMode->Hdr1DLutEnable = true;
VP_RENDER_CHK_STATUS_RETURN(m_veboxItf->SetDisableHistogram(&pRenderData->GetIECPParams()));

veboxStateCmdParams.pVebox3DLookUpTables = &surf3DLut->osSurface->OsResource;
veboxStateCmdParams.pVebox3DLookUpTables = &surf3DLut->osSurface->OsResource;

return MOS_STATUS_SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,7 @@ class VpVeboxCmdPacket : virtual public VpVeboxCmdPacketBase
mhw::vebox::VEBOX_STATE_PAR &veboxStateCmdParams);
virtual MOS_STATUS Init3DLutTable(PVP_SURFACE surf3DLut);
void UpdateCpPrepareResources();
virtual MOS_STATUS Add1DLutState(PVP_SURFACE &surface, PMHW_1DLUT_PARAMS p1DLutParams);
virtual MOS_STATUS SetupVebox3DLutForHDR(
mhw::vebox::VEBOX_STATE_PAR &veboxStateCmdParams);
virtual MOS_STATUS SetupVeboxExternal3DLutforHDR(
Expand Down

0 comments on commit 8b9ce32

Please sign in to comment.