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

Måns Rullgård mans
Sun Feb 21 03:39:33 CET 2010


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.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list