| 219 | #ifndef ff_sqrt |
| 220 | #define ff_sqrt ff_sqrt |
| 221 | static inline av_const unsigned int ff_sqrt(unsigned int a) |
| 222 | { |
| 223 | unsigned int b; |
| 224 | |
| 225 | if (a < 255) return (ff_sqrt_tab[a + 1] - 1) >> 4; |
| 226 | else if (a < (1 << 12)) b = ff_sqrt_tab[a >> 4] >> 2; |
| 227 | #if !CONFIG_SMALL |
| 228 | else if (a < (1 << 14)) b = ff_sqrt_tab[a >> 6] >> 1; |
| 229 | else if (a < (1 << 16)) b = ff_sqrt_tab[a >> 8] ; |
| 230 | #endif |
| 231 | else { |
| 232 | int s = av_log2_16bit(a >> 16) >> 1; |
| 233 | unsigned int c = a >> (s + 2); |
| 234 | b = ff_sqrt_tab[c >> (s + 8)]; |
| 235 | b = FASTDIV(c,b) + (b << s); |
| 236 | } |
| 237 | |
| 238 | return b - (a < b * b); |
| 239 | } |