[FFmpeg-devel] [PATCH] Faster ff_sqrt()

Vitor Sessak vitor1001
Sat Jan 19 23:15:43 CET 2008


Hi

Michael Niedermayer wrote:
> On Sun, Jan 13, 2008 at 09:14:10PM +0100, Michael Niedermayer wrote:
>> On Sun, Jan 13, 2008 at 08:49:17PM +0100, Michael Niedermayer wrote:
> [...]
>> next one, just reordering the if() to make smaller values faster and some
>> cosmetics
>>

[...]

> 
> another minor revission (just av_log2 -> av_log2_16bit)
> 
> static inline unsigned int sqrt3(unsigned int a)
> {
>     unsigned int b;
> 
>     if     (a<(1<<10)- 3) b= sqrt_tab[(a+ 3)>>2 ]>>3;
>     else if(a<(1<<14)-28) b= sqrt_tab[(a+28)>>6 ]>>1;
>     else if(a<(1<<16)   ) b= sqrt_tab[ a    >>8 ]   ;
>     else{
>         int s= av_log2_16bit(a>>16)>>1;
>         b= sqrt_tab[a>>(2*s+10)];
>         b= (FASTDIV(a,b)>>(s+2)) + (b<<s);
>     }
> 
>     return b - (a<b*b);
> }

Just a question: you didn't commit it because you didn't have time, or 
do you think it's not fit for lavu? Wasn't lavu supposed to have 
efficient code, no matter if it is used in speed critical codecs or not?

-Vitor




More information about the ffmpeg-devel mailing list