Skip to content

Commit

Permalink
[VP] Enable VPL SR (#6528)
Browse files Browse the repository at this point in the history
Enable VPL SR

Co-authored-by: Gu, Peiyi <[email protected]>
  • Loading branch information
gfxVPLsdm and peiyigu-intel authored Mar 6, 2024
1 parent 1417747 commit 0aa97d7
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 5 deletions.
68 changes: 66 additions & 2 deletions _studio/mfx_lib/vpp/src/mfx_vpp_hw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2154,6 +2154,12 @@ mfxStatus VideoVPPHW::GetVideoParams(mfxVideoParam *par) const
MFX_CHECK_NULL_PTR1(bufColorfill);
bufColorfill->Enable = static_cast<mfxU16>(m_executeParams.iBackgroundColor?MFX_CODINGOPTION_ON:MFX_CODINGOPTION_OFF);
}
else if (MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION == bufferId)
{
mfxExtVPPAISuperResolution* bufSuperResolution = reinterpret_cast<mfxExtVPPAISuperResolution*>(par->ExtParam[i]);
MFX_CHECK_NULL_PTR1(bufSuperResolution);
bufSuperResolution->SRMode = m_executeParams.m_srMode;
}
}

return MFX_ERR_NONE;
Expand Down Expand Up @@ -2380,6 +2386,12 @@ mfxStatus VideoVPPHW::CheckFormatLimitation(mfxU32 filter, mfxU32 format, mfxU32
formatSupport = MFX_FORMAT_SUPPORT_OUTPUT;
}
break;
case MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION:
if (format == MFX_FOURCC_NV12)
{
formatSupport = MFX_FORMAT_SUPPORT_INPUT | MFX_FORMAT_SUPPORT_OUTPUT;
}
break;
#if defined (ONEVPL_EXPERIMENTAL)
case MFX_EXTBUFF_VPP_PERC_ENC_PREFILTER:
if (format == MFX_FOURCC_NV12)
Expand Down Expand Up @@ -2674,6 +2686,15 @@ mfxStatus VideoVPPHW::Init(
}
}
}
else if (m_params.ExtParam[i]->BufferId == MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION)
{
mfxExtVPPAISuperResolution* extSR = (mfxExtVPPAISuperResolution*)m_params.ExtParam[i];
if (extSR)
{
m_executeParams.bSuperResolution = true;
m_executeParams.m_srMode = extSR->SRMode;
}
}
}

m_config.m_IOPattern = 0;
Expand Down Expand Up @@ -5305,7 +5326,36 @@ mfxStatus ValidateParams(mfxVideoParam *par, mfxVppCaps *caps, VideoCORE *core,

break;
} //case MFX_EXTBUFF_VPP_COMPOSITE

case MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION:
{
if (!caps->uSuperResolution)
{
sts = GetWorstSts(sts, MFX_ERR_UNSUPPORTED);
}
if (par->vpp.In.FourCC != MFX_FOURCC_NV12 ||
(par->vpp.Out.FourCC != MFX_FOURCC_NV12 && par->vpp.Out.FourCC != MFX_FOURCC_BGRA))
{
sts = GetWorstSts(sts, MFX_ERR_UNSUPPORTED);
}
mfxU32 inputWidth = std::min(par->vpp.In.Width, par->vpp.In.CropW);
mfxU32 inputHeight = std::min(par->vpp.In.Height, par->vpp.In.CropH);
mfxU32 outputWidth = std::min(par->vpp.Out.Width, par->vpp.Out.CropW);
mfxU32 outputHeight = std::min(par->vpp.Out.Height, par->vpp.Out.CropH);
//add rotation support next
if (inputWidth > caps->uSrMaxInWidth ||
inputHeight > caps->uSrMaxInHeight)
{
sts = GetWorstSts(sts, MFX_ERR_UNSUPPORTED);
}
mfxF32 fScaleX = (mfxF32)outputWidth / inputWidth;
mfxF32 fScaleY = (mfxF32)outputHeight / inputHeight;
if (fScaleX < 1.4f ||
fScaleY < 1.4f)
{
sts = GetWorstSts(sts, MFX_ERR_UNSUPPORTED);
}
break;
}
case MFX_EXTBUFF_ALLOCATION_HINTS:
{
if (++n_hints_buf > 2)
Expand Down Expand Up @@ -6721,7 +6771,17 @@ mfxStatus ConfigureExecuteParams(
executeParams.iFieldProcessingMode++;
break;
}

case MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION:
for (mfxU32 i = 0; i < videoParam.NumExtParam; i++)
{
if (videoParam.ExtParam[i]->BufferId == MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION)
{
mfxExtVPPAISuperResolution* extSR = (mfxExtVPPAISuperResolution*)videoParam.ExtParam[i];
executeParams.bSuperResolution = true;
executeParams.m_srMode = extSR->SRMode;
}
}
break;
#ifdef MFX_ENABLE_MCTF
case MFX_EXTBUFF_VPP_MCTF:
{
Expand Down Expand Up @@ -6906,6 +6966,10 @@ mfxStatus ConfigureExecuteParams(
executeParams.VideoSignalInfoOut.enabled = false;

}
else if (MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION == bufferId)
{
executeParams.bSuperResolution = false;
}
#ifdef MFX_ENABLE_MCTF
else if (MFX_EXTBUFF_VPP_MCTF == bufferId)
{
Expand Down
4 changes: 4 additions & 0 deletions _studio/mfx_lib/vpp/src/mfx_vpp_sw_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,10 @@ mfxStatus VideoVPPBase::Query(VideoCORE * core, mfxVideoParam *in, mfxVideoParam
{
continue;
}
else if (MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION == in->ExtParam[i]->BufferId)
{
continue;
}
else
{
out->ExtParam[i]->BufferId = 0;
Expand Down
6 changes: 6 additions & 0 deletions _studio/mfx_lib/vpp/src/mfx_vpp_sw_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ mfxStatus GetExternalFramesCount(VideoCORE* core,
break;
}
#endif
case (mfxU32)MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION:
{
inputFramesCount[filterIndex] = 1;
outputFramesCount[filterIndex] = 1;
break;
}
case (mfxU32)MFX_EXTBUFF_VPP_RESIZE:
{
inputFramesCount[filterIndex] = 1;
Expand Down
18 changes: 16 additions & 2 deletions _studio/mfx_lib/vpp/src/mfx_vpp_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ const mfxU32 g_TABLE_CONFIG [] =
MFX_EXTBUF_CAM_PADDING,
MFX_EXTBUF_CAM_LENS_GEOM_DIST_CORRECTION,
MFX_EXTBUF_CAM_TOTAL_COLOR_CONTROL,
MFX_EXTBUF_CAM_CSC_YUV_RGB
MFX_EXTBUF_CAM_CSC_YUV_RGB,
MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION
#if defined (ONEVPL_EXPERIMENTAL)
, MFX_EXTBUFF_VPP_PERC_ENC_PREFILTER
#endif
Expand Down Expand Up @@ -175,7 +176,8 @@ const mfxU32 g_TABLE_EXT_PARAM [] =
MFX_EXTBUF_CAM_PADDING,
MFX_EXTBUF_CAM_LENS_GEOM_DIST_CORRECTION,
MFX_EXTBUF_CAM_TOTAL_COLOR_CONTROL,
MFX_EXTBUF_CAM_CSC_YUV_RGB
MFX_EXTBUF_CAM_CSC_YUV_RGB,
MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION
#if defined (ONEVPL_EXPERIMENTAL)
, MFX_EXTBUFF_VPP_PERC_ENC_PREFILTER
#endif
Expand Down Expand Up @@ -963,6 +965,12 @@ void ReorderPipelineListForQuality( std::vector<mfxU32> & pipelineList )
newList[index] = MFX_EXTBUFF_VPP_MIRRORING;
index++;
}

if (IsFilterFound(&pipelineList[0], (mfxU32)pipelineList.size(), MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION))
{
newList[index] = MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION;
index++;
}
#ifdef MFX_ENABLE_MCTF
// add to the end
if (IsFilterFound(&pipelineList[0], (mfxU32)pipelineList.size(), MFX_EXTBUFF_VPP_MCTF))
Expand Down Expand Up @@ -1385,6 +1393,12 @@ mfxStatus GetPipelineList(
pipelineList.push_back(MFX_EXTBUFF_CONTENT_LIGHT_LEVEL_INFO);
}
}

if (IsFilterFound(&configList[0], configCount, MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION)
&& !IsFilterFound(&pipelineList[0], (mfxU32)pipelineList.size(), MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION))
{
pipelineList.push_back(MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION);
}

#if defined (ONEVPL_EXPERIMENTAL)
if ( IsFilterFound(&configList[0], configCount, MFX_EXTBUFF_VPP_PERC_ENC_PREFILTER)
Expand Down
15 changes: 14 additions & 1 deletion _studio/shared/include/mfx_vpp_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ namespace MfxHwVideoProcessing
mfxU32 u3DLut;
mfxU32 uDenoise2Filter; // mfxExtVPPDenoise2

mfxU32 uSuperResolution;
mfxU32 uSrMaxInWidth;
mfxU32 uSrMaxInHeight;

mfxVppCaps()
: uAdvancedDI(0)
, uSimpleDI(0)
Expand Down Expand Up @@ -247,6 +251,9 @@ namespace MfxHwVideoProcessing
, uFieldProcessing(0)
, u3DLut(0)
, uDenoise2Filter(0)
, uSuperResolution(0)
, uSrMaxInWidth(0)
, uSrMaxInHeight(0)
{
memset(&cameraCaps, 0, sizeof(CameraCaps));
};
Expand Down Expand Up @@ -403,6 +410,8 @@ namespace MfxHwVideoProcessing
,mirroringExt(false)
,scene(VPP_NO_SCENE_CHANGE)
,bDeinterlace30i60p(false)
, bSuperResolution(false)
, m_srMode(MFX_AI_SUPER_RESOLUTION_MODE_DEFAULT)
#if defined (MFX_EXTBUFF_GPU_HANG_ENABLE)
,gpuHangTrigger(false)
#endif
Expand Down Expand Up @@ -472,7 +481,8 @@ namespace MfxHwVideoProcessing
mirroringExt != false ||
scene != VPP_NO_SCENE_CHANGE ||
bDeinterlace30i60p != false ||
chromaSiting != MFX_CHROMA_SITING_UNKNOWN
chromaSiting != MFX_CHROMA_SITING_UNKNOWN ||
bSuperResolution
#ifdef MFX_ENABLE_MCTF
|| bEnableMctf != false
#endif
Expand Down Expand Up @@ -595,6 +605,9 @@ namespace MfxHwVideoProcessing

vppScene scene; // Keep information about scene change
bool bDeinterlace30i60p;

bool bSuperResolution;
mfxAISuperResolutionMode m_srMode;

#if defined (MFX_EXTBUFF_GPU_HANG_ENABLE)
bool gpuHangTrigger;
Expand Down

0 comments on commit 0aa97d7

Please sign in to comment.