[FFmpeg-devel] [PATCH] Fix unaligned access in lcl decoder

Reimar Döffinger Reimar.Doeffinger
Fri May 29 21:20:58 CEST 2009

On Wed, May 27, 2009 at 06:50:14PM +0200, Michael Niedermayer wrote:
> On Wed, May 27, 2009 at 12:22:19PM -0400, Jeff Downs wrote:
> > FATE test 289 (http://fate.multimedia.cx/index.php?test_spec=289) 
> > currently crashes on Sparc/Solaris due to unaligned memory accesses in the 
> > lcl decoder.
> > 
> > Attached fixes by using memcpy instead of integer copies on platforms 
> > without fast unaligned access.
> AV_R/WN32() might be more appropriate than the ifdeffery

I looked at the code, and I think it looks buggy (boundary checks do not account
for overflow) and inefficient (if several consecutive bits are unset, they
probably should be handled in one memcpy, but at least (1 << maskbit) should
not be calculated at every iteration, src_end should be used instead of
src_len to avoid a add in each iteration etc.) anyway.
Couldn't we just use memcpy anyway, performance on inefficient compilers be damned?
If someone has a good sample for performance testing I think I volunteer to
optimize it in exchange...

Reimar D?ffinger

More information about the ffmpeg-devel mailing list