DirectShow Sample H264 Decoder crashes

DirectShow Sample H264 Decoder crashes


to get the hardware acceleration running, I have to use the Sample H264 Decoder Filter and replace SetAcceleration(MFX_IMPL_AUTO) with MFX_IMPL_HARDWARE_ANY in the constructor of CBaseDecoder (same as encoder). With 1920x1080 pixels everything is ok, but if i use 1080x1920 or 1920x1200 the application (or graphedit) crashes in m_pmfxDEC->DecodeFrameAsync(...) in CBaseDecoder::RunDecode(...).

The original Filter in the bin directory don't crash, but it defines wrong dimensions for the output. With 1920x1080 pixels the VIDEOINFOHEADER.bmiHeader.biHeight is 1088 and the heigt in VIDEOINFOHEADER.rcSource is set to 1080. For 1080x1920 pixels the width is set to 1080, but it has to be 1088. I can check the width and set it manually to 1088 in my downstream filter, but this is ugly...

Any idea, who I can fix the sample H264 Decoder?

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


Is MFX_IMPL_HARDWARE_ANY the only change you do to the original sample code? Please specify the SandyBridge driver version you are testing the hardware acceleration with and check which status is returned from MFXVideo_Decode.Init with those resolutions.

The original filter doesn't crash because it is using the software dll of MSDK, I guess. For 1080x1920 resolution 1080 is the correct width. Decoder alignes the width at 16 and height at 32. That's why for 1920x1080 it becomes 1088.



Yes, I only changed that, nothing else. With 1080x1920 MFXVideoDecode.Init returns MFX_WRN_PARTIAL_ACCELERATION and with 1920x1080 it returns MFX_ERR_NONE.

I'm using HD2000 (Core i7-2600) with Media SDK 3.0 Beta 4 and driver version

Visual Studio 2010, Windows SDK 7.1

Ok, get it. Thanks for the info, we will investigate the issue and get back to you with results.

I forgot: With resolution 1080x1920 the output picture of the original filter is scrambled. If I set the width manually to 1088 as i wrote above, it is just fine. So I think, the width also alignes at 32...

That's interesting. We will investigate this one too.

Hi SuperRudi,
I was obviously wrong when stating that w=1080 doesn't need alignment at 16. If alignment is applied the width becomes 1088 as you mention. We have corrected this point in sample code, please check out the Media SDK 2012 Gold release when it is posted. You can also apply a quick fix in your code right now:
Add a line pDstVIH->bmiHeader.biWidth = (pDstVIH->bmiHeader.biWidth + 15) &~ 15;
in CVideoDecFilter::GetMediaType method
I must say that we were not able to reproduce neither crashes nor scrambled output with our sample filters. But it could be due to difference in third party filters used in your and our testing. Hopefully the fix we suggest will resolve your problem.
Best regards,Nina

Leave a Comment

Please sign in to add a comment. Not a member? Join today