MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_sqrt

Function ff_sqrt

libavcodec/mathops.h:221–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219#ifndef ff_sqrt
220#define ff_sqrt ff_sqrt
221static 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}

Callers 14

fixed_sqrtFunction · 0.85
square_rootFunction · 0.85
encode_q_branchFunction · 0.85
calc_cpl_coordFunction · 0.85
sonic_encode_initFunction · 0.85
sonic_decode_initFunction · 0.85
ff_t_sqrtFunction · 0.85
dpcm_predictFunction · 0.85
get_visual_weightFunction · 0.85
leastsquaresFunction · 0.85
ff_opus_rc_dec_uint_triFunction · 0.85

Calls 2

av_log2_16bitFunction · 0.85
FASTDIVFunction · 0.85

Tested by 1

mainFunction · 0.68