diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-08-22 19:41:39 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-08-22 19:41:39 +0000 |
commit | f36db5dfd3c3cfd5d2e9feb0462c18431183cff5 (patch) | |
tree | dd74494896ac8b73d360250d263229b5f3a8e573 /libavcodec/common.h | |
parent | 1fb4890b5195db4de31733a234abb946f9399f3e (diff) | |
download | ffmpeg-f36db5dfd3c3cfd5d2e9feb0462c18431183cff5.tar.gz |
faster ff_sqrt()
Originally committed as revision 859 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/common.h')
-rw-r--r-- | libavcodec/common.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/common.h b/libavcodec/common.h index bacc6470e1..c3010896e9 100644 --- a/libavcodec/common.h +++ b/libavcodec/common.h @@ -901,6 +901,8 @@ static inline int clip(int a, int amin, int amax) } /* 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 @@ static inline int ff_sqrt(int a) 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){ |