From 7f6e05cdfd1242a6774e89283b6e2cefde191590 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 31 Mar 2011 01:28:08 +0100 Subject: [PATCH] ac3enc: simplify sym_quant() These expressions are equivalent since levels is always odd, and overflow is impossible due to the constraints set by the assert(). Signed-off-by: Mans Rullgard --- libavcodec/ac3enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 18e4dae26a..a869d7de9d 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1192,7 +1192,7 @@ static int compute_bit_allocation(AC3EncodeContext *s) */ static inline int sym_quant(int c, int e, int levels) { - int v = ((((levels * c) >> (24 - e)) + 1) >> 1) + (levels >> 1); + int v = (((levels * c) >> (24 - e)) + levels) >> 1; av_assert2(v >= 0 && v < levels); return v; }