MPEG4 Decoding Crash Occasionally

Submit New Article

March 17, 2009 10:00 AM PDT


Problem Description :

When developing a vidoe decoder based on the MPEG4 or H263 sample code included in IPP audio_video_codec sample. The decoding usually work, but occasionally it crashed as an exception 'inside' the function UMC::MPEG4VideoDecoder::GetFrame. Decoding the same frame does not always produce the exception.  The core dump information looks like

XXXXX!v8_ippiDecodeDCIntra_MPEG4_1u16s+0x61
XXXXX!mp4_DecodeIntraMB+0x145
XXXXX!mp4_DecodeVOP_I+0xb21
XXXXX!mp4_DecodeVideoObjectPlane+0x2d8
XXXXX!UMC::MPEG4VideoDecoder::GetFrame+0x474
XXXXX!UMC::cGenericDecodec::Decode+0x10d
XXXXX!UMC::cGenericDecodec::Decode+0xb1
XXXXX!CIPPVideoDecoder::Decode+0x93


Cause:
Using 'DevPartner' tools you may see that some operations can produce a 'read over-run' reading beyond the limit of the buffer that contains the encoded data, in some cases it can produce a memory error. The problem did happen when allocating 3 more bytes of memory for this buffer.

Solution:
It is a known problem - our decoders do not check the end of buffer and can read after buffer.
There are several ways to avoid this
1. To put few zero bytes at the and of buffer before calling of decoder.
2. To copy input buffer inside decoder in temporal buffer and pad it by few zero bytes.
    e.g. use temporal buffer of bigger size and copy data to it and put four zero bytes after real data.
3. To implement try-except handling.



Do you need more help?


This article applies to: Intel® Integrated Performance Primitives Knowledge Base