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

Måns Rullgård mans
Sat May 2 00:41:11 CEST 2009


Laurent Aimar <fenrir at videolan.org> writes:

> On Fri, May 01, 2009, Michael Niedermayer wrote:
>> > > > @@ -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) ?
>> 
>> (unsigned)L
>> if thats not correct then the int L is likely wrong too
>> 
>> 
>> > 
>> >  I think it is more obfuscated and it's the job of the compilo to remove
>> > it if unneeded.
>> 
>> suggestions for better compilers are welcome ...
>  For the record, gcc -S (Debian 4.3.3-3) does generate the exact same
> assembly output files using either the 0xffff mask or the unsigned cast...

On all architectures?  I prefer not to rely on compiler optimisations.

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



More information about the ffmpeg-devel mailing list