ac3enc: make sym_quant() branch-free
This commit is contained in:
parent
45ed822550
commit
85ab290470
@ -1096,17 +1096,7 @@ static int compute_bit_allocation(AC3EncodeContext *s)
|
|||||||
*/
|
*/
|
||||||
static inline int sym_quant(int c, int e, int levels)
|
static inline int sym_quant(int c, int e, int levels)
|
||||||
{
|
{
|
||||||
int v;
|
int v = ((((levels * c) >> (24 - e)) + 1) >> 1) + (levels >> 1);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
av_assert2(v >= 0 && v < levels);
|
av_assert2(v >= 0 && v < levels);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user