[FFmpeg-devel] [PATCH] Added integer 32 bits support to wavpack

Laurent Aimar fenrir
Fri May 1 16:05:54 CEST 2009


Hi,

On Fri, May 01, 2009, Michael Niedermayer wrote:
> On Fri, May 01, 2009 at 01:49:37PM +0200, Laurent Aimar wrote:
> >  The attached patch completes the support for files with INT32INFO chunk
> > with non zero sent_bits.
> 
> [...]
> > @@ -344,6 +348,7 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d
> >      int A, B, L, L2, R, R2, bit;
> >      int pos = 0;
> >      uint32_t crc = 0xFFFFFFFF;
> > +    uint32_t crc_extra = 0xFFFFFFFF;
> >      int16_t *dst16 = dst;
> >      int32_t *dst32 = dst;
> >  
> 
> > @@ -424,6 +429,18 @@ static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *d
> >          if(s->joint)
> >              L += (R -= (L >> 1));
> >          crc = (crc * 3 + L) * 3 + R;
> > +        if(s->extra_bits){
> > +            L <<= s->extra_bits;
> > +            R <<= s->extra_bits;
> > +
> > +            if(s->got_extra){
> > +                L |= get_bits(&s->gb_extra, s->extra_bits);
> > +                crc_extra = crc_extra * 9 + (L&0xffff) * 3 + ((L>>16)&0xffff);
> 
> the second & can be avoided if the >> is unsigned
 Something like (uin32_t)L >> 16 (or (unsigned)L) ?

 I think it is more obfuscated and it's the job of the compilo to remove
it if unneeded.
 But if it is needed to have this patch applied, I will redo it.

-- 
fenrir




More information about the ffmpeg-devel mailing list