OSDN Git Service
(root)
/
coroid
/
libav_saccubus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
45ed822
)
ac3enc: make sym_quant() branch-free
author
Justin Ruggles
<justin.ruggles@gmail.com>
Tue, 22 Mar 2011 18:36:18 +0000
(14:36 -0400)
committer
Justin Ruggles
<justin.ruggles@gmail.com>
Tue, 22 Mar 2011 18:36:18 +0000
(14:36 -0400)
libavcodec/ac3enc.c
patch
|
blob
|
history
diff --git
a/libavcodec/ac3enc.c
b/libavcodec/ac3enc.c
index
d9b06d9
..
202e611
100644
(file)
--- 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;
}