[FFmpeg-cvslog] r19045 - trunk/libavcodec/lcldec.c

Reimar Döffinger Reimar.Doeffinger
Mon Jun 1 01:00:11 CEST 2009


On Sun, May 31, 2009 at 11:59:53PM +0200, Aurelien Jacobs wrote:
> On Sun, May 31, 2009 at 12:14:27PM +0200, reimar wrote:
> > Author: reimar
> > Date: Sun May 31 12:14:27 2009
> > New Revision: 19045
> > 
> > Log:
> > Fix decoding of multithread-encoded lcl files on big-endian.
> > 
> > Modified:
> >    trunk/libavcodec/lcldec.c
> > 
> > Modified: trunk/libavcodec/lcldec.c
> > ==============================================================================
> > --- trunk/libavcodec/lcldec.c	Sun May 31 12:05:21 2009	(r19044)
> > +++ trunk/libavcodec/lcldec.c	Sun May 31 12:14:27 2009	(r19045)
> > @@ -189,9 +189,9 @@ static int decode_frame(AVCodecContext *
> >          switch (c->compression) {
> >          case COMP_MSZH:
> >              if (c->flags & FLAG_MULTITHREAD) {
> > -                mthread_inlen = *(unsigned int*)encoded;
> > +                mthread_inlen = AV_RL32(encoded);
> >                  mthread_inlen = FFMIN(mthread_inlen, len - 8);
> > -                mthread_outlen = *(unsigned int*)(encoded+4);
> > +                mthread_outlen = AV_RL32(encoded+4);
> >                  mthread_outlen = FFMIN(mthread_outlen, c->decomp_size);
> 
> Could be slightly simplified... See attached patch.

IMO that is more obfuscation than simplification, I generally don't
like mixing reading data and validating it (particularly since
just using FFMIN is questionable, ideally it should fail depending
on error resilience level).
Lastly, those macros would expand to something horrible, and
I don't like relying on the compiler's common subexpression evaluation
that much.



More information about the ffmpeg-cvslog mailing list