[FFmpeg-devel] [PATCH] JPEG interlaced error resilience

Baptiste Coudurier baptiste.coudurier
Sun Aug 2 22:57:55 CEST 2009

On 08/02/2009 03:58 AM, Reimar D?ffinger wrote:
> On Sun, Aug 02, 2009 at 12:25:16PM +0200, Reimar D?ffinger wrote:
>> On Sun, Aug 02, 2009 at 01:48:16AM -0700, Baptiste Coudurier wrote:
>>> On 08/02/2009 01:04 AM, Reimar D?ffinger wrote:
>>>> currently when FFmpeg encounters a broken interlaced JPEG where only the
>>>> second part is available, it decodes nothing at all.
>>>> This patch changes the behaviour to make it still decode the second half
>>>> (e.g. the odd lines).
>>>> Currently the only real source of such broken JPEGs is the MJPEG parser which
>>>> incorrectly splits all interlaced JPEGs into two packets.
>>> Technically there are 2 independant jpegs.
>> I think not quite, while there are two SOF there is only one EOI.
> Forget about it, you are right.
> The obvious question is: How should we handle it?
> Originally we just went by coded_height and if it was large enough we merged two
> JPEG frames into one - which meant half of the time the decode function had no
> output and in addition when the AVParser is used and you seek after decoding
> an odd number of frames it might end up combining the wrong two frames.
> On the other hand just decoding them normally like there was no interlacing would
> end up dropping at least the quicktime-stored field order information and probably
> generally no be what users expect...

It can be detected by parsing "mjpg" userdata or "AVI1" in avi which 
specify interlacing.

Does the problem still occur now that the parser will output the avi 
chunk as it is ? It seems to work fine here.

Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org

More information about the ffmpeg-devel mailing list