[FFmpeg-devel] [Ffmpeg-devel] [PATCH] Vorbis I floor type 0 support

Uoti Urpala uoti.urpala
Sun Mar 16 04:44:16 CET 2008


On Sun, 2008-03-16 at 03:59 +0100, Michael Niedermayer wrote:
> code like:
>     int_fast32_t pow_of_two = 2, exponent = vf->amplitude_bits;
>     while ( --exponent ) { pow_of_two <<= 1; }
> instead of
>     pow_of_two = 1<<vf->amplitude_bits;

While checking why you were replying to a 2 year old post I noticed that
this is suspicious in another way - it looks like amplitude_bits could
have values up to 63 which would make the shift illegal (and the current
code does have a shift instead of loop).

The current code has:

            floor_setup->data.t0.amplitude_bits=get_bits(gb, 6);

and later

    uint_fast32_t amplitude;

    amplitude=get_bits(&vc->gb, vf->amplitude_bits);

                    q=exp( (
                             ( (amplitude*vf->amplitude_offset)/
                               (((1<<vf->amplitude_bits)-1) * sqrt(p+q)) )
                             - vf->amplitude_offset ) * .11512925f
                         );

If amplitude_bits really can have 6-bit values this code seems wrong,
and at least I didn't notice anything which would prevent that.





More information about the ffmpeg-devel mailing list