Commit 85ab2904 authored by Justin Ruggles's avatar Justin Ruggles

ac3enc: make sym_quant() branch-free

parent 45ed8225
......@@ -1096,17 +1096,7 @@ static int compute_bit_allocation(AC3EncodeContext *s)
*/
static inline int sym_quant(int c, int e, int levels)
{
int v;
if (c >= 0) {
v = (levels * (c << e)) >> 24;
v = (v + 1) >> 1;
v = (levels >> 1) + v;
} else {
v = (levels * ((-c) << e)) >> 24;
v = (v + 1) >> 1;
v = (levels >> 1) - v;
}
int v = ((((levels * c) >> (24 - e)) + 1) >> 1) + (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