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.

Frame allocator

innes
Beginner
579 Views

Hi,

I am trying to develop a decoding application using IMSDK. I am facing issues with the frame allocator. 

First, I try the application provided by imsdk : sample_decode.exe mpeg2 -i test.m2v -o test.yuv -hw. In this case (hardware implementation, API version 1.0), frame allocator is called "by hand" in the CDecodingPipeline::AllocFrames function. It is never called during the m_pmfxDEC->Init() call. I am actually in the case of system memory allocations.

Then, I try to implement the same in my application. I do have exactly the same parameters as input for each MFX call (I use C API instead of C++, but I do not think it matters), but during the MFXVideoDECODE_Init call, frame allocator is called and request d3d surfaces. 

How can I reproduce the behavior of the sample_decode code ?

Thanks for your help

0 Kudos
1 Reply
Petter_L_Intel
Employee
579 Views
Hi, without details on your implementation it is hard to say what exactly is going on. But, if you used the sample memory allocator classes which are part of the SDK and you initialized them using MFX_IOPATTERN_OUT_SYSTEM_MEMORY then there is no reason the D3D frame allocator should be called. Note that if you plan to use only system memory surfaces for decode then you are not required to create a frame allocator. You can instead allocate your surfaces manually as in the code example below. Regards, Petter // Query number of required surfaces for decoder mfxFrameAllocRequest Request; memset(&Request, 0, sizeof(Request)); sts = mfxDEC.QueryIOSurf(&mfxVideoParams, &Request); MSDK_IGNORE_MFX_STS(sts, MFX_WRN_PARTIAL_ACCELERATION); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); mfxU16 numSurfaces = Request.NumFrameSuggested; // Allocate surfaces for decoder // - Width and height of buffer must be aligned, a multiple of 32 // - Frame surface array keeps pointers all surface planes and general frame info mfxU16 width = (mfxU16)MSDK_ALIGN32(Request.Info.Width); mfxU16 height = (mfxU16)MSDK_ALIGN32(Request.Info.Height); mfxU8 bitsPerPixel = 12; // NV12 format is a 12 bits per pixel format mfxU32 surfaceSize = width * height * bitsPerPixel / 8; mfxU8* surfaceBuffers = (mfxU8 *)new mfxU8[surfaceSize * numSurfaces]; mfxFrameSurface1** pmfxSurfaces = new mfxFrameSurface1*[numSurfaces]; MSDK_CHECK_POINTER(pmfxSurfaces, MFX_ERR_MEMORY_ALLOC); for (int i = 0; i < numSurfaces; i++) { pmfxSurfaces = new mfxFrameSurface1; memset(pmfxSurfaces, 0, sizeof(mfxFrameSurface1)); memcpy(&(pmfxSurfaces->Info), &(mfxVideoParams.mfx.FrameInfo), sizeof(mfxFrameInfo)); pmfxSurfaces->Data.Y = &surfaceBuffers[surfaceSize * i]; pmfxSurfaces->Data.U = pmfxSurfaces->Data.Y + width * height; pmfxSurfaces->Data.V = pmfxSurfaces->Data.U + 1; pmfxSurfaces->Data.Pitch = width; } .
0 Kudos
Reply