diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-03-22 14:36:18 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-03-22 14:36:18 -0400 |
commit | 85ab2904700c5bf8b55a33ad598191e36318e195 (patch) | |
tree | d1d38d7fb1ac19745f339bed0124615828e1508d /libavcodec/ac3enc.c | |
parent | 45ed82255025a200beae3b56a84bee20aad41465 (diff) | |
download | ffmpeg-streaming-85ab2904700c5bf8b55a33ad598191e36318e195.zip ffmpeg-streaming-85ab2904700c5bf8b55a33ad598191e36318e195.tar.gz |
ac3enc: make sym_quant() branch-free
Diffstat (limited to 'libavcodec/ac3enc.c')
-rw-r--r-- | libavcodec/ac3enc.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index d9b06d9..202e611 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -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; } |