Commit 7f6e05cd authored by Mans Rullgard's avatar Mans Rullgard

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: default avatarMans Rullgard <mans@mansr.com>
parent cb7e2c1c
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment