# HG changeset patch # User glantau # Date 1022015267 0 # Node ID c3aebacf546e6db671ad003a879ec8c2cd2d70f9 # Parent 62b311619b4477d66c8e68c358250a014da8213d fixed incorrect global gain - slightly increased precision of n^(4/3) table diff -r 62b311619b44 -r c3aebacf546e mpegaudiodec.c --- a/mpegaudiodec.c Tue May 21 19:42:43 2002 +0000 +++ b/mpegaudiodec.c Tue May 21 21:07:47 2002 +0000 @@ -279,12 +279,17 @@ a = a << 1; eq--; } + /* now POW_FRAC_ONE <= a < 2 * POW_FRAC_ONE */ +#if (POW_FRAC_BITS - 1) > FRAC_BITS + a = (a + (1 << (POW_FRAC_BITS - FRAC_BITS - 1))) >> (POW_FRAC_BITS - FRAC_BITS); + /* correct overflow */ + if (a >= 2 * (1 << FRAC_BITS)) { + a = a >> 1; + eq++; + } +#endif *exp_ptr = eq; -#if POW_FRAC_BITS == FRAC_BITS return a; -#else - return (a + (1 << (POW_FRAC_BITS - FRAC_BITS - 1))) >> (POW_FRAC_BITS - FRAC_BITS); -#endif } static int decode_init(AVCodecContext * avctx) @@ -388,10 +393,6 @@ for(i=1;i> 1; + e1++; + } #endif e1--; if (m != m1 || e != e1) { @@ -413,9 +416,8 @@ #endif /* normalized to FRAC_BITS */ table_4_3_value[i] = m; - table_4_3_exp[i] = e - 1; + table_4_3_exp[i] = e; } - for(i=0;i<7;i++) { float f;