On Fri, Aug 02, 2013 at 06:04:12PM +0200, Diego Biurrun wrote:
> On Fri, Aug 02, 2013 at 11:24:22AM +0200, Kostya Shishkov wrote:
> > --- a/libavcodec/twinvq.c
> > +++ b/libavcodec/twinvq.c
> > @@ -379,22 +402,20 @@ static void dequant(TwinVQContext *tctx, 
> > GetBitContext *gb, float *out,
> >          int bitstream_second_part = (i >= 
> > tctx->bits_main_spec_change[ftype]);
> >  
> >          int bits = tctx->bits_main_spec[0][ftype][bitstream_second_part];
> > +        tmp0 = *cb_bits++;
> >          if (bits == 7) {
> > -            if (get_bits1(gb))
> > +            if (tmp0 & 0x40)
> >                  sign0 = -1;
> > -            bits = 6;
> > +            tmp0 &= 0x3F;
> >          }
> > -        tmp0 = get_bits(gb, bits);
> >  
> >          bits = tctx->bits_main_spec[1][ftype][bitstream_second_part];
> > -
> > +        tmp1 = *cb_bits++;
> >          if (bits == 7) {
> > -            if (get_bits1(gb))
> > +            if (tmp1 & 0x40)
> >                  sign1 = -1;
> > -
> > -            bits = 6;
> > +            tmp1 &= 0x3F;
> >          }
> > -        tmp1 = get_bits(gb, bits);
> 
> The hex values look very magic numberish.  Is there an alternative way
> to express this?

if bit six is set then set sign to minus one and clear that bit

It should be obvious immediately because 0x40 is the top bit for bits==7
and 0x3F is just follows from it.
 
> This also looks like it could be split off into a function to avoid the
> code duplication.

Doesn't worth it IMO.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to