Mercurial > libavcodec.hg
diff common.h @ 609:153a7ffd289b libavcodec
faster ff_sqrt()
author | michaelni |
---|---|
date | Thu, 22 Aug 2002 19:41:39 +0000 |
parents | 0b706debf55d |
children | 85b071dfc7e3 |
line wrap: on
line diff
--- a/common.h Thu Aug 22 19:41:06 2002 +0000 +++ b/common.h Thu Aug 22 19:41:39 2002 +0000 @@ -901,6 +901,8 @@ } /* math */ +extern const UINT8 ff_sqrt_tab[128]; + int ff_gcd(int a, int b); static inline int ff_sqrt(int a) @@ -908,7 +910,9 @@ int ret=0; int s; int ret_sq=0; - + + if(a<128) return ff_sqrt_tab[a]; + for(s=15; s>=0; s--){ int b= ret_sq + (1<<(s*2)) + (ret<<s)*2; if(b<=a){