Skip to content

Commit

Permalink
[vpp] [vfi] duplicate last frame so that number of output frame is mu…
Browse files Browse the repository at this point in the history
…ltiple of that of input
  • Loading branch information
MicroYY authored and gfxVPLsdm committed Oct 23, 2024
1 parent b6ac79a commit 4ef6d7c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class MFXVideoFrameInterpolation
Ratio m_ratio;
mfxU16 m_outStamp;
mfxU16 m_outTick;
bool m_sequenceEnd;

mfxU16 m_IOPattern;

Expand Down
3 changes: 3 additions & 0 deletions _studio/mfx_lib/vpp/include/mfx_vpp_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ namespace MfxHwVideoProcessing
, skipQueryStatus(false)
, pAuxData(NULL)
, pSubResource(NULL)
, m_aiVfiSequenceEnd(false)
{
#ifdef MFX_ENABLE_MCTF
memset(&MctfData, 0, sizeof(IntMctfParams));
Expand Down Expand Up @@ -318,6 +319,8 @@ namespace MfxHwVideoProcessing
ReleaseResource* pSubResource;

std::vector<ExtSurface> m_refList; //m_refList.size() == bkwdRefCount +fwdRefCount

bool m_aiVfiSequenceEnd;
};

struct ExtendedConfig
Expand Down
12 changes: 11 additions & 1 deletion _studio/mfx_lib/vpp/src/mfx_vpp_ai_frame_interpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#define HEIGHT2 (mfxU16)1440

MFXVideoFrameInterpolation::MFXVideoFrameInterpolation() :
m_sequenceEnd(false),
m_inputFwd(),
m_inputBkwd(),
m_enableScd(false),
Expand Down Expand Up @@ -368,7 +369,16 @@ mfxStatus MFXVideoFrameInterpolation::UpdateTsAndGetStatus(
mfxFrameSurface1* output,
mfxStatus* intSts)
{
if (nullptr == input) return MFX_ERR_MORE_DATA;
if (nullptr == input)
{
// nullptr == input means input sequence reaches its end
if (m_sequenceEnd)
{
return MFX_ERR_MORE_DATA;
}
if (m_outStamp == (m_ratio - 1)) m_sequenceEnd = true;
return MFX_ERR_NONE;
}
mfxStatus sts = MFX_ERR_NONE;

if (m_outStamp == 0)
Expand Down
23 changes: 19 additions & 4 deletions _studio/mfx_lib/vpp/src/mfx_vpp_hw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1664,11 +1664,20 @@ mfxStatus TaskManager::FillTask(
m_resMngr.m_surf[VPP_IN][pTask->input.resIdx].SetFree(false);
}
}

mfxStatus sts = MFX_ERR_NONE;
m_actualNumber += 1; // make sense for simple mode only
MFX_CHECK_NULL_PTR1(pTask->input.pSurf);
mfxStatus sts = m_core->IncreaseReference(*pTask->input.pSurf);
MFX_CHECK_STS(sts);

if ((FRC_AI_INTERPOLATION & m_extMode) && !pTask->input.pSurf)
{
// input sequence reaches its end
pTask->m_aiVfiSequenceEnd = true;
}
else
{
MFX_CHECK_NULL_PTR1(pTask->input.pSurf);
sts = m_core->IncreaseReference(*pTask->input.pSurf);
MFX_CHECK_STS(sts);
}

sts = m_core->IncreaseReference(*pTask->output.pSurf);
MFX_CHECK_STS(sts);
Expand Down Expand Up @@ -4222,6 +4231,12 @@ mfxStatus VideoVPPHW::MergeRuntimeParams(const DdiTask *pTask, MfxHwVideoProcess
mfxStatus VideoVPPHW::SyncTaskSubmission(DdiTask* pTask)
{
mfxStatus sts = MFX_ERR_NONE;

if (pTask->m_aiVfiSequenceEnd)
{
pTask->skipQueryStatus = true;
return sts;
}
#ifdef MFX_ENABLE_MCTF
if (pTask->outputForApp.pSurf)
{
Expand Down

0 comments on commit 4ef6d7c

Please sign in to comment.