ac3dec: use get_sbits() instead of manually sign-extending
authorMans Rullgard <mans@mansr.com>
Sun, 9 Oct 2011 22:15:17 +0000 (23:15 +0100)
committerMans Rullgard <mans@mansr.com>
Sun, 9 Oct 2011 22:21:31 +0000 (23:21 +0100)
Signed-off-by: Mans Rullgard <mans@mansr.com>
libavcodec/ac3dec.c

index 5046a5c..956a7ac 100644 (file)
@@ -505,9 +505,9 @@ static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, ma
                 mantissa = b5_mantissas[get_bits(gbc, 4)];
                 break;
             default: /* 6 to 15 */
-                mantissa = get_bits(gbc, quantization_tab[bap]);
                 /* Shift mantissa and sign-extend it. */
-                mantissa = (mantissa << (32-quantization_tab[bap]))>>8;
+                mantissa = get_sbits(gbc, quantization_tab[bap]);
+                mantissa <<= 24 - quantization_tab[bap];
                 break;
         }
         coeffs[freq] = mantissa >> exps[freq];