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.

the CPU occupancy rate

dong_x_
Beginner
752 Views

 

HI

    I have a problem,it seem impossible.

    this is my function.  but the CPU occupancy rate is same as soft decode,sometimes higher. 

    The other parts are same, just one use soft decode, the other use mfx . the frame rate is same. the decode image is right.

   Is the function bellow wrong? 

    

BOOL CIntelDecode::DecodeInputData(BYTE *pData , int size)
    {
        //decodeData
        mfxStatus sts = MFX_ERR_NONE;
        mfxSyncPoint syncp;
        mfxFrameSurface1* pmfxOutSurface;

        mfxBitstream mfxBS;
        memset(&mfxBS, 0, sizeof(mfxBS));
        mfxBS.Data = (mfxU8 *)pData;
        mfxBS.MaxLength = size;
        mfxBS.DataLength = size;
        mfxBS.DataOffset = 0;

        while (MFX_ERR_NONE <= sts || MFX_ERR_MORE_DATA == sts || MFX_ERR_MORE_SURFACE == sts)
        {

            if (MFX_WRN_DEVICE_BUSY == sts)
            {
                MSDK_SLEEP(1);  // Wait if device is busy, then repeat the same call to DecodeFrameAsync
            }

            if (MFX_ERR_MORE_DATA == sts) 
            {            
                break;        
                // Read more data into input bit stream
                //MSDK_BREAK_ON_ERROR(sts);
            }

            if (MFX_ERR_MORE_SURFACE == sts || MFX_ERR_NONE == sts) 
            {
                _currentSurfaceIndex = GetFreeSurfaceIndex(_pmfxSurfaces, _numSurfaces);        // Find free frame surface
                if(MFX_ERR_NOT_FOUND == _currentSurfaceIndex)
                {
                    break;
                }
                //MSDK_CHECK_ERROR(MFX_ERR_NOT_FOUND, nIndex, MFX_ERR_MEMORY_ALLOC);
            }

            // Decode a frame asychronously (returns immediately)
            //  - If input bitstream contains multiple frames DecodeFrameAsync will start decoding multiple frames, and remove them from bitstream

            sts = _mfxDEC->DecodeFrameAsync(&mfxBS, _pmfxSurfaces[_currentSurfaceIndex], &pmfxOutSurface, &syncp);

            // Ignore warnings if output is available,
            // if no output and no action required just repeat the DecodeFrameAsync call
            if (MFX_ERR_NONE < sts && syncp)
            {
                sts = MFX_ERR_NONE;
            }

            if (MFX_ERR_NONE == sts)
            {
                sts = _mfxSession.SyncOperation(syncp, 60000);      // Synchronize. Wait until decoded frame is ready
            }

            if (MFX_ERR_NONE == sts) 
            {
                //ConvertToRGB(pmfxOutSurface);
            }
        }

        return TRUE;
    }

0 Kudos
3 Replies
Sravanthi_K_Intel
752 Views

Hello Dong,

Thanks for the question. Looking at your code, it looks very similar to our simple_2_decode_vmem tutorial code - which does give considerable performance benefit for HW impl versus SW.

Can you please let me know:

- what system you are working on (processor/gfx, OS, MSS version installed) -> If you are on Windows, please send the output of sys_analyzer you will find in the tools/ folder in the install path.

- if you are accounting for file i/o as well (output of YUV raw frames, as you know, can considerably affect the overall fps),

- if you can reproduce the issue using simple_2_decode_vmem and send the output please?

(Apologies for the delayed response).

0 Kudos
dong_x_
Beginner
752 Views

Hi SRAVANTHI K

    thanks a lot!

    that is my problem. Change SW to  HW, the CPU usage is down.

 

0 Kudos
Sravanthi_K_Intel
752 Views

Glad it is resolved Dong. Happy coding!

0 Kudos
Reply