mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user