Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Reset VPP

Sebastian_A_
Beginner
771 Views

Hello,

i'm trying to reset the vpp for allowing dynamic input and output resolutions. MFXVideoVPP_Reset returns MFX_ERR_NONE. RunFrameVPPAsync now returns MFX_ERR_INCOMPATIBLE_VIDEO_PARAM, which isn't even documented in the manual.

If i reset the VPP with close and init it works fine. the only difference i can see in the trace is that vpp.RunFrameVppAsync.out.Data.Locked is set to 1 instead to 0. the problem is that the close/init workaround takes quite some processing time. what am i doing wrong? is resetting the vpp actually faster?

Thanks!

 

 

 

 

0 Kudos
5 Replies
David_Pochron
Beginner
771 Views

I am having a very similar problem, except I am only trying to change the VPP input pixel format. The output format stays the same and gets passed to the encoder. I am trying to append 2 clips, the first is RGB32 the second is NV12, both are identical in size.

This is the block of pseudocode that runs when I call MFXVideoVPP_Reset(), which works fine but running the VPP w/ the new param causes errors:

// Write out the delayed frames in the VPP and do any required encoding

... etc usual stuff no need to pollute the example - it runs  the VPP w/ NULL frames, passes it along to the encoder, and muxes.

 

// Update the VPP params w/ the new values
if (srcInfo->format & RFMT_ISYUV)
    VPPParams.vpp.In.FourCC = MFX_FOURCC_NV12;
else if (srcInfo->format & RFMT_ISRGB)
    VPPParams.vpp.In.FourCC = MFX_FOURCC_RGB4;
VPPParams.vpp.In.ChromaFormat = MFX_CHROMAFORMAT_YUV420;    // its YUV420 for both YUV and RGB

 

// Use updated params to get required surface alloc info from the SDK
mfxFrameAllocRequest VPPRequest[2];   // we'll only use the 1st entry in the array in this case
memset(&VPPRequest, 0, sizeof(mfxFrameAllocRequest)*2);
sts = MFXVideoVPP_QueryIOSurf(session, &VPPParams, VPPRequest));

 

// Add additional surfaces as shown in the 2014 SDK
VPPRequest[0].NumFrameSuggested += MYDEPTH - 1;
VPPRequest[0].NumFrameMin = VPPRequest[0].NumFrameSuggested;

 

// Reinitialize the VPP with the new params; this frees any remaining locks on the input surfaces
sts = MFXVideoVPP_Reset(session, &VPPParams));

 

// Free the old surfaces to the VPP input
delete pmfxSurfacesVPPIn;
DXAllocator->FreeFrames(&mfxResponseVPPIn);

 

// Allocate new VPPin surfaces for the new format
sts = DXAllocator->Alloc(DXAllocator->pthis, &VPPRequest[0], &mfxResponseVPPIn);
pmfxSurfacesVPPIn = new mfxFrameSurface1[mfxResponseVPPIn.NumFrameActual];
for (mfxU16 i=0; i<mfxResponseVPPIn.NumFrameActual; i++)
{
    memset(&pmfxSurfacesVPPIn, 0, sizeof(mfxFrameSurface1));
    memcpy(&(pmfxSurfacesVPPIn.Info), &(VPPParams.vpp.In), sizeof(mfxFrameInfo));
    pmfxSurfacesVPPIn.Data.MemId = mfxResponseVPPIn.mids;
}

 

// Grab a new available VPP input surface since we wiped out the old ones
surfIdxVPP = getFreeSurfaceIndex(pmfxSurfacesVPPIn, mfxResponseVPPIn.NumFrameActual);
surfIn = &pmfxSurfacesVPPIn[surfIdxVPP];
pInfo = &surfIn->Info;

And then it's pretty much back to doing the usual stuff - lock the input surface, copy pixel data into the staging surface, unlock the surface, get the next free output VPP surface, and call MFXVideoVPP_RunFrameVPPAsync() with the input and output surface as params.

When I "hack" the code so it still does the Reset but doesn't change the pixel format, it works to completion. So I know it's not simply the act of freeing and reallocating the input VPP surfaces that is causing the error. There seems to be something specific about switching the VPP from converting RGB32->NV12 to simply going from NV12->NV12.

Are there any concrete examples of using MFXVideoVPP_Reset() anywhere?

0 Kudos
Anthony_P_Intel
Employee
771 Views

Hi,

Thank you for the detail information.  I am looking into this and will report my findings.

0 Kudos
David_Pochron
Beginner
771 Views

Has there been any new info regarding resetting the VPP discovered? I am still unable to call MFXVideoVPP_Reset() with modified input params and have MFXVideoVPP_RunFrameVPPAsync() not return an error.

0 Kudos
Karthick_K_
Beginner
771 Views

I'm also facing the similar problem in VPP reset call. I wanted to change the resolution (both vpp in and vpp out) using MFXVideoVPP_Reset call. Though the call is success, still the params are the same as the older one.

eg> old vpp_in 1280x720 , modified one 640x480.

----> Reset call ----> success ---->GetVideoParam() ---->vpp_in = 1280x720.

If I reverse the above resolutions, say, I had initialized VPP with 640x480 (vpp_in) then calling Reset() with vpp_in 1280x720 throws error saying  Incompatible Video Param.

SDK version used: 1.16

Windows 7, Intel- i5- 4310M

0 Kudos
Surbhi_M_Intel
Employee
771 Views

Hi Karthick, 

For changing the resolution dynamically you will need to close and reinitialize in case when you are changing to higher resolution as surfaces need to be reallocated. In case of changing to lower resolution, you don't need to reinitialize instead use cropW and cropH to get desired resolution, please make sure width & height is multiple of 16 for progressive content. 

Thanks,
Surbhi

 

0 Kudos
Reply