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.

MFX_ERR_MEMORY_ALLOC

hui1234
Beginner
772 Views
Hi

When the implementation of the

sts = m_pmfxDEC->Init(&m_mfxVideoParams);

return value is -4 (MFX_ERR_MEMORY_ALLOC)

May I ask what factors produced this result?

Thanks
0 Kudos
2 Replies
IDZ_A_Intel
Employee
772 Views
Hi,

In your case Intel Media SDK failed to allocate the memory required to create decoder surfaces.

Your system has likely run out of memory. You may try to free up some memory used by other applications or try other lower resolution workload, or expand your system with additonal RAM.

Regards,
Petter


0 Kudos
hamed_b_
Beginner
772 Views

I have the exact same problem but I do have enough RAM and when I run the intel example it's work fine.. but I changed it and now it's not working this way. here is my code for initializing decoder :
 

mfxStatus decoder::initDecoder(HWND window, mfxBitstream *Header) {
	mfxStatus sts = MFX_ERR_NONE;
	mfxVersion ver = { { 0, 1 } };
	mfxVideoParam mfxVideoParams;
	mfxFrameAllocator mfxAllocator;
	mfxFrameAllocResponse mfxResponse;

	sts = m_mfxSession.Init(MFX_IMPL_AUTO_ANY, &ver); //sts = MFX_ERR_NONE

	if (sts == MFX_ERR_NONE) {
		sts = m_mfxSession.SetHandle(MFX_HANDLE_DIRECT3D_DEVICE_MANAGER9, 
			m_renderer.initD3d(GetIntelDeviceAdapterNum(), window)); //sts = MFX_ERR_NONE
		if (sts == MFX_ERR_NONE) {
			mfxAllocator.pthis = m_mfxSession;
			sts = m_mfxSession.SetFrameAllocator(&mfxAllocator); //sts = MFX_ERR_NONE
			if (sts == MFX_ERR_NONE) {
				MFXVideoDECODE mfxDEC(m_mfxSession);
				m_mfxVideoDecode = mfxDEC;
				memset(&mfxVideoParams, 0, sizeof(mfxVideoParams));
				mfxVideoParams.mfx.CodecId = MFX_CODEC_AVC;
				mfxVideoParams.IOPattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY;

				sts = m_mfxVideoDecode.DecodeHeader(Header, &mfxVideoParams); //sts = MFX_ERR_NONE
				if (sts == MFX_ERR_NONE) {
					memset(&m_mfxRequest, 0, sizeof(m_mfxRequest));
					sts = m_mfxVideoDecode.Query(&mfxVideoParams, &mfxVideoParams);
					sts = m_mfxVideoDecode.QueryIOSurf(&mfxVideoParams, &m_mfxRequest); //sts = MFX_ERR_NONE
					if (sts == MFX_ERR_NONE) {
						sts = m_renderer.allocSurfaces(mfxAllocator.pthis, &m_mfxRequest, &mfxResponse);
						if (sts == MFX_ERR_NONE) {
							m_pmfxSurfaces = new mfxFrameSurface1 *[m_mfxRequest.NumFrameSuggested];
							for (int i = 0; i < m_mfxRequest.NumFrameSuggested; i++) {
								m_pmfxSurfaces = new mfxFrameSurface1;
								memset(m_pmfxSurfaces, 0, sizeof(mfxFrameSurface1));
								memcpy(&(m_pmfxSurfaces->Info), &(mfxVideoParams.mfx.FrameInfo), sizeof(mfxFrameInfo));
								// MID (memory id) represents one video NV12 surface
								m_pmfxSurfaces->Data.MemId = mfxResponse.mids;
							};
							sts = m_mfxVideoDecode.Init(&mfxVideoParams); //sts = MFX_ERR_MEMORY_ALLOC
						}
					}
				}
			}
		}
	}

	return sts;
}

 

0 Kudos
Reply