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

Reimar Döffinger Reimar.Doeffinger
Sun Aug 2 12:58:01 CEST 2009

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...

More information about the ffmpeg-devel mailing list