OSDN Git Service
(root)
/
coroid
/
ffmpeg_saccubus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0e4dbe2
)
ac3enc: remove a branch in asym_quant() by doing 2 shifts
author
Justin Ruggles
<justin.ruggles@gmail.com>
Tue, 21 Jun 2011 20:14:19 +0000
(16:14 -0400)
committer
Justin Ruggles
<justin.ruggles@gmail.com>
Wed, 22 Jun 2011 16:18:10 +0000
(12:18 -0400)
libavcodec/ac3enc.c
patch
|
blob
|
history
diff --git
a/libavcodec/ac3enc.c
b/libavcodec/ac3enc.c
index
1db6941
..
db45c83
100644
(file)
--- a/
libavcodec/ac3enc.c
+++ b/
libavcodec/ac3enc.c
@@
-1123,15
+1123,9
@@
static inline int sym_quant(int c, int e, int levels)
*/
static inline int asym_quant(int c, int e, int qbits)
{
- int
lshift,
m, v;
+ int m, v;
- lshift = e + qbits - 24;
- if (lshift >= 0)
- v = c << lshift;
- else
- v = c >> (-lshift);
- /* rounding */
- v = (v + 1) >> 1;
+ v = (((c << e) >> (24 - qbits)) + 1) >> 1;
m = (1 << (qbits-1));
if (v >= m)
v = m - 1;