aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/g723_1.c
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2011-09-29 21:28:18 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-29 21:44:03 +0200
commit6e505547f148235b5e2733bf42a4615ae67d4cb4 (patch)
treeb782efa9744a822e4590a72a10cd767277df2a9a /libavcodec/g723_1.c
parentc02c52f7b2870869b58fab37414a8f7ac55da25e (diff)
downloadffmpeg-6e505547f148235b5e2733bf42a4615ae67d4cb4.tar.gz
g723.1: cleanup square_root()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/g723_1.c')
-rw-r--r--libavcodec/g723_1.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index de7fe3b80b..a48eca3ab0 100644
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -196,17 +196,7 @@ static int unpack_bitstream(G723_1_Context *p, const uint8_t *buf,
*/
static int16_t square_root(int val)
{
- int16_t res = 0;
- int16_t exp = 0x4000;
- int i;
-
- for (i = 0; i < 14; i ++) {
- int res_exp = res + exp;
- if (val >= res_exp * res_exp << 1)
- res += exp;
- exp >>= 1;
- }
- return res;
+ return (ff_sqrt(val << 1) >> 1) & (~1);
}
/**