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

Michael Niedermayer michaelni
Sun Feb 21 03:42:44 CET 2010


On Sun, Feb 21, 2010 at 02:39:33AM +0000, M?ns Rullg?rd wrote:
> Michael Niedermayer <michaelni at gmx.at> writes:
> 
> > 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
> 
> This change makes it easier to optimise on a CPU where sign/zero
> extending is faster than two shifts.

ok, then consider my preferance against this hunk void

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- 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/132f9c96/attachment.pgp>



More information about the ffmpeg-devel mailing list