I'm a developer and I'm trying to do a HW implementation of VPP and ENCODER from the Intel Media SDK.
I'm capturing the screen of my laptop (so the format is RGB4) and in order to encode to H.264, the format has to be changed to NV12 which is the native format of the SDK. Having seen the tutorials (especially simple_6_encode - d3d - vpp_preproc) and used them as a guide, I initialize the SDK sessions of VPP and ENCODE and everything seems to be fine. The problem appears when I'm in the actual processing of VPP, so since the format conversion is failing, the encoding is not happening as well. To give you an idea of what's going on here is the code:
It consists of an init and an encode function. As you will see in the init function, the SDK sessions are initialized with a HW implementation. The VPP and ENCODER parameters are set up and finally, memory blocks are allocated for the surfaces. Untill this point when I'm debugging, I'm not getting any errors at all, not even warnings. But, when the program reaches the main loop of VPP and ENCODING I get status code -14 which is Incompatible video parameters.
So to recap, the input is 1920*1080p RGB4 and if the resolution is bigger than that I want to scale down to 1920*1080p and convert to NV12 as well in order to feed the encoder. Can anyone tell me where did I go wrong?
It's somewhat hard to track down the exact cause of the issue looking at the supplied code. But... I have some concerns.
First, can you confirm if both Encode and VPP Init() calls are successful?
1. It looks like you may have some configuration issues with regards to setting the frame surface dimensions.
"encoder->hwenc.VPPParams.vpp.Out.Width = MSDK_ALIGN16(image->width);"
The VPP output surface size should be determined by the VPP output surface size, not the input size, which is what your code seems to be doing.
2. I can see that you're only allocating surfaces determined by encode->QueryIO for the surfaces you need between VPP and encode. Please make sure you allocated needed surfaces for encode + needed surfaces for VPP input. This is illustrated in the Media SDK tutorial sample you referred to.
"encoder->hwenc.nENCSurfs = ENCsurfReq.NumFrameSuggested;" <- Should be + VPP input surfaces
3. Make sure you set the mfxFrameInfo for each allocated surface correctly. There may be some issue with this causing the issue.
Many thanks for the reply. Your hints helped me overcome my problem and and now VPP color conversion works fine and the program advances to the Encoding phase. The new problem that I am facing now is that when I am invoking the Sync operation it returns status code MFX_ERR_DEVICE_FAILED.
In the previous post I didn't mention that I'm using system memory and not video memory which I assume will just be a performance penalty but it will be possible to function.
This is the link to the code:
The error occurs in line 359. Any help is appreciated.
MFX_ERR_DEVICE_FAILED could be due to many things, but most probably some kind of driver level failure.
Make sure your surface pointers are valid.
Also please update your system to the latest available Intel Graphics driver.
Does it fail on the first call to SyncOperation()?
In your case, note that the input surface to the encoder should the the output surface of VPP. From the code it does not look like that is happening.
If you want a simple example on how to perform VPP+Encode then refer to the Media SDK tutorial sample "simple_6_encode - d3d - vpp_preproc" from here: http://software.intel.com/en-us/articles/intel-media-sdk-tutorial ;
If you still encounter issues please share your system config (you can catch high level config using the Media SDK tool: system_analyzer), and a trace log fetched using the Media SDK tracer tool while initializing and running your workload.