[FFmpeg-devel] [PATCH 3/3] Deobfuscate LE SHOW_[SU]BITS; these are simple sign/zero extend

Michael Niedermayer michaelni
Sun Feb 21 03:14:12 CET 2010


On Sun, Feb 21, 2010 at 02:54:28AM +0100, Michael Niedermayer wrote:
> On Sun, Feb 21, 2010 at 12:35:59AM +0000, Mans Rullgard wrote:
> > ---
> >  libavcodec/get_bits.h |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
> > index bb40ff4..7c4ee43 100644
> > --- a/libavcodec/get_bits.h
> > +++ b/libavcodec/get_bits.h
> > @@ -166,10 +166,10 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
> >  
> >  # ifdef ALT_BITSTREAM_READER_LE
> >  #   define SHOW_UBITS(name, gb, num)\
> > -        ((name##_cache) & (NEG_USR32(0xffffffff,num)))
> > +        zero_extend(name##_cache, num)
> >  
> >  #   define SHOW_SBITS(name, gb, num)\
> > -        NEG_SSR32((name##_cache)<<(32-(num)), num)
> > +        sign_extend(name##_cache, num)
> >  # else
> >  #   define SHOW_UBITS(name, gb, num)\
> >          NEG_USR32(name##_cache, num)
> 
> i prefer the code the way it was

the reason is that NEG_U/SSR32 is used all over this file and
relpacing 2 by different functions makes it harder to understand
as there is more code

someone not knoing what NEG_U/SSR32 do will be lost before as well
as after this change but afterwards he also needs t know what 2
additional functions do

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- 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/20100221/874de806/attachment.pgp>



More information about the ffmpeg-devel mailing list