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.
3075 Discussions

Program crashed when running the frame reset routine by using VPP in MediaSamples_Linux_2017R2

Michael_H_1
Beginner
752 Views

Hello,

I integrated the sample_vpp program into our encoder and tried to perform one overlay stream on the primary stream. However, when the program runs into frame number 65527 (NOT_INIT_VALUE = 0xFFF7), reset routine will be triggered. The problem is the code will return error to me. I used the code in sample.vpp and here is the main code I mentioned:

do
    {
        if (bNeedReset)
        {
            paramID++;
            bNeedReset = false;
            nextResetFrmNum = (Params.resetFrmNums.size() > paramID) ? Params.resetFrmNums[paramID] : NOT_INIT_VALUE;

            //prepare mfxParams
            sts = InitParamsVPP(&mfxParamsVideo, &Params, paramID);
            MSDK_CHECK_STATUS_SAFE(sts, "InitParamsVPP failed", {WipeResources(&Resources); WipeParams(&Params);});

            sts = ConfigVideoEnhancementFilters(&Params, &Resources, paramID);
            MSDK_CHECK_STATUS_SAFE(sts, "ConfigVideoEnchancementFilters failed", {WipeResources(&Resources); WipeParams(&Params);});

            sts = Resources.pProcessor->pmfxVPP->Reset(Resources.pVppParams);
            MSDK_CHECK_STATUS_SAFE(sts, "Resources.pProcessor->pmfxVPP->Reset failed", {WipeResources(&Resources); WipeParams(&Params);});

            ownToMfxFrameInfo( &(Params.frameInfoIn[paramID]),  &realFrameInfoIn[0]);
            ownToMfxFrameInfo( &(Params.frameInfoOut[paramID]), &realFrameInfoOut);
            UpdateSurfacePool(mfxParamsVideo.vpp.Out, allocator.responseOut.NumFrameActual, allocator.pSurfacesOut);
            if(Params.numStreams==1)
            {
                UpdateSurfacePool(mfxParamsVideo.vpp.In,  allocator.responseIn[0].NumFrameActual,  allocator.pSurfacesIn[0]);
            }
            else
            {
                for(int i=0;i<Params.numStreams;i++)
                {
                    ownToMfxFrameInfo(&(Params.inFrameInfo),  &realFrameInfoIn);

                    UpdateSurfacePool(mfxParamsVideo.vpp.In, allocator.responseIn.NumFrameActual, allocator.pSurfacesIn);
                }
            }

            msdk_printf(MSDK_STRING("VPP reseted at frame number %d\n"), numGetFrames);
        }

	//... ...

    } while (bNeedReset);
 
I try to debug on it and find that when the program gets frame number 65527, the reset routine will enter the above code. The first time, InitParamsVPP return error to me and sts=MFX_ERR_UNSUPPORTED(-3). I followed the code InitParamsVPP and find that the problem is neither frameInfoOut and frameInfoIn set correctly.
 
if (pInParams->frameInfoIn[paramID].nWidth == 0 || pInParams->frameInfoIn[paramID].nHeight == 0 ){
        return MFX_ERR_UNSUPPORTED;
}
if (pInParams->frameInfoOut[paramID].nWidth == 0 || pInParams->frameInfoOut[paramID].nHeight == 0 ){
        return MFX_ERR_UNSUPPORTED;
}
 

m_Params->frameInfoIn[paramID].nWidth 0
m_Params.frameInfoIn[m_paramID].nHeight 0
m_Params.frameInfoIn[m_paramID].dFrameRate 1
m_Params->frameInfoIn[paramID].CropH 1080
m_Params.frameInfoIn[m_paramID].CropW 1920
m_Params->frameInfoIn[paramID].CropX 0
m_Params.frameInfoIn[m_paramID].CropY 0

m_Params->frameInfoOut[paramID].CropH 0
m_Params.frameInfoOut[m_paramID].CropW 0
m_Params->frameInfoOut[paramID].CropX 0
m_Params.frameInfoOut[m_paramID].CropY 0
m_Params->frameInfoOut[paramID].nWidth 0
m_Params.frameInfoOut[m_paramID].nHeight 0
m_Params.frameInfoOut[m_paramID].dFrameRate 1

Then, I make a function MakingFrameInfo() to make the values of the above correct before passing InitParamsVPP 

mfxStatus MakingFrameInfo(CEncoder *encoder, sInputParams* pParams){

    mfxStatus sts = MFX_ERR_NONE;
    vector<COverlay>::const_iterator ciiprimary2 = encoder->GetEncoderProfile()->m_overlay_primary.begin();
    pParams->frameInfoIn[m_paramID].nWidth = (mfxU16)ciiprimary2->width;
    pParams->frameInfoIn[m_paramID].nHeight = (mfxU16)ciiprimary2->height;
    pParams->frameInfoIn[m_paramID].dFrameRate = (mfxF64) ciiprimary2->framerate;
    pParams->frameInfoIn[m_paramID].CropH = (mfxU16)ciiprimary2->croph;
    pParams->frameInfoIn[m_paramID].CropW = (mfxU16)ciiprimary2->cropw;
    pParams->frameInfoIn[m_paramID].CropX = (mfxU16) ciiprimary2->cropx;
    pParams->frameInfoIn[m_paramID].CropY = (mfxU16)ciiprimary2->cropy;
    char * temp2 = (char *)ciiprimary2->infourcc.c_str();
    pParams->frameInfoIn[m_paramID].FourCC = Str2FourCC(temp2);
    pParams->frameInfoIn[m_paramID].PicStruct = (mfxU16)ciiprimary2->PicStruct;
    pParams->frameInfoIn[m_paramID].BitDepthChroma = 0;
    pParams->frameInfoIn[m_paramID].BitDepthLuma  = 0;

    vector<COverlay>::const_iterator ciiprimary = encoder->GetEncoderProfile()->m_overlay_primary.begin();
    pParams->frameInfoOut[m_paramID].nWidth= (mfxU16)ciiprimary->width;
    pParams->frameInfoOut[m_paramID].nHeight = (mfxU16)ciiprimary->height;
    pParams->frameInfoOut[m_paramID].dFrameRate = (mfxF64)ciiprimary->framerate;
    pParams->frameInfoOut[m_paramID].CropH = (mfxU16)ciiprimary->croph;
    pParams->frameInfoOut[m_paramID].CropW = (mfxU16)ciiprimary->cropw;
    pParams->frameInfoOut[m_paramID].CropX =  (mfxU16)ciiprimary->cropx;
    pParams->frameInfoOut[m_paramID].CropY = (mfxU16)ciiprimary->cropy;
    char * temp3 = (char *)ciiprimary->infourcc.c_str();
    pParams->frameInfoOut[m_paramID].FourCC = Str2FourCC(temp3);
    pParams->frameInfoOut[m_paramID].PicStruct = (mfxU16)ciiprimary->PicStruct;
    pParams->frameInfoOut[m_paramID].BitDepthChroma = 0;
    pParams->frameInfoOut[m_paramID].BitDepthLuma  = 0;
    return sts;
}

 

After that, I can pass through the checking and run the program and reset successfully. However, when the program runs into the reset routine the second time, it returns error MFX_ERR_INVALID_VIDEO_PARAM(-15) on Reset function. Below is the video parameter of the Reset function. I am not sure what is going on and would like to ask for help on it. 

m_Resources.pVppParams->vpp.In.Height 1088
m_Resources.pVppParams->vpp.In.Width 1920
m_Resources.pVppParams->vpp.In.CropH 1088
m_Resources.pVppParams->vpp.In.CropW 1920
m_Resources.pVppParams->vpp.In.CropX 0
m_Resources.pVppParams->vpp.In.CropY 0
m_Resources.pVppParams->vpp.In.FrameRateExtN 30
m_Resources.pVppParams->vpp.In.FrameRateExtD 1

m_Resources.pVppParams->vpp.Out.Height 1088
m_Resources.pVppParams->vpp.Out.Width 1920
m_Resources.pVppParams->vpp.Out.CropH 1080
m_Resources.pVppParams->vpp.Out.CropW 1920
m_Resources.pVppParams->vpp.Out.CropX 0
m_Resources.pVppParams->vpp.Out.CropY 0
m_Resources.pVppParams->vpp.Out.FrameRateExtN 30
m_Resources.pVppParams->vpp.Out.FrameRateExtD 1

Many Thanks,

Michael Hui

 

0 Kudos
3 Replies
Jiandong_Z_Intel
Employee
752 Views

Hi Michael,

I think you can try to call MFXVideoVPP_Query  Page 71 in 

to check if your input parameter is correct.

 

 

Thanks,

Zachary

 

0 Kudos
Michael_H_1
Beginner
753 Views

Dear Zachary,

Thank you for your reply. I followed the SDK to call MFXVideoVPP_Query but it returned to me error (MFX_ERR_UNSUPPORTED(-3)) when passing the reset routine the second time. Any further thing I can do?

m_Resources.pVppParams->vpp.In.Height 1088
m_Resources.pVppParams->vpp.In.Width 1920
m_Resources.pVppParams->vpp.In.CropH 1088
m_Resources.pVppParams->vpp.In.CropW 1920
m_Resources.pVppParams->vpp.In.CropX 0
m_Resources.pVppParams->vpp.In.CropY 0
m_Resources.pVppParams->vpp.In.FrameRateExtN 30
m_Resources.pVppParams->vpp.In.FrameRateExtD 1

m_Resources.pVppParams->mfx.FrameInfo.Height 1088
m_Resources.pVppParams->mfx.FrameInfo.Width 1920
m_Resources.pVppParams->mfx.FrameInfo.CropH 1088
m_Resources.pVppParams->mfx.FrameInfo.CropW 1920
m_Resources.pVppParams->mfx.FrameInfo.CropX 0
m_Resources.pVppParams->mfx.FrameInfo.CropY 0
m_Resources.pVppParams->mfx.FrameInfo.FrameRateExtN 30
m_Resources.pVppParams->mfx.FrameInfo.FrameRateExtD 1

m_Resources.pVppParams->vpp.Out.Height 1088
m_Resources.pVppParams->vpp.Out.Width 1920
m_Resources.pVppParams->vpp.Out.CropH 1080
m_Resources.pVppParams->vpp.Out.CropW 1920
m_Resources.pVppParams->vpp.Out.CropX 0
m_Resources.pVppParams->vpp.Out.CropY 0
m_Resources.pVppParams->vpp.Out.FrameRateExtN 30
m_Resources.pVppParams->vpp.Out.FrameRateExtD 1

Many Thanks,

Michael Hui

0 Kudos
Michael_H_1
Beginner
753 Views

hello all,

I found something similar in the forum

https://software.intel.com/en-us/forums/intel-media-sdk/topic/326853

I changed to use Close/Init instead of Reset, the first time I could pass through Close/Init but the second time I failed to pass through Init function and it return to me the MFX_ERR_INVALID_VIDEO_PARAM. So I would like to get any help.

Many Thanks,

Michael Hui

0 Kudos
Reply