[FFmpeg-devel] [PATCH] H.264: fix decoding of plain still images (broken since revision 14289)

Michael Niedermayer michaelni
Wed Jan 7 01:52:49 CET 2009


On Wed, Jan 07, 2009 at 12:56:01AM +0100, Reinhard Nissl wrote:
> Hi,
> 
> Michael Niedermayer schrieb:
> > On Mon, Jan 05, 2009 at 11:35:03PM +0100, Reimar D?ffinger wrote:
> >> On Mon, Jan 05, 2009 at 11:15:22PM +0100, Reinhard Nissl wrote:
> >>> Some thoughts about the change: actually, it pulls just one
> >>> picture from delayed_pics when a sequence end has been detected.
[...]
> >>> One could go on and implement that for consecutive calls no bytes
> >>> are consumed until all delayed_pics have been drained. This is
> > 
> > this will likely not work
> 
> Sounds like returning 0 consumed bytes indicates an error.

the problem is you assume that the decoder will receive the packet
again if it returns 0. At least ffmpeg.c does not behave like that currently
and i suspect its not the only application.


> 
> >>> similar to calling decode with a zero sized buffer, but works in
> >>> the case where for example two or more sequences have simply been
> >>> catted together but separated by a sequence end code. Finally,
> >>> idr() should be called too to initialize the decoder into a state
> >>> where a next sequence which doesn't start with an idr can be
> >>> properly decoded.
> >> If this change is considered correct/acceptable, at least MPEG-2 should
> >> be changed in the same way.
> > 
> > mpeg2 currently does:
> >     if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {
> >         /* special case for last picture */
> >         if (s2->low_delay==0 && s2->next_picture_ptr) {
> >             *picture= *(AVFrame*)s2->next_picture_ptr;
> >             s2->next_picture_ptr= NULL;
> > 
> >             *data_size = sizeof(AVFrame);
> >         }
> >         return buf_size;
> 
> Well in MPEG-2 it's much easier as there is just a single delayed
> picture: the future reference frame. I've added similar code some
> years ago to xine-lib's libmpeg2 to retrieve the future reference
> frame when a sequence end is detected. Regarding the above code
> fragment, I've no idea what s2->low_delay==0 takes care of.

if low_delay != 0 than every frame is output immedeatly thus there is
no delayed pic

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090107/b0bcca09/attachment.pgp>



More information about the ffmpeg-devel mailing list