[x264-devel] Re: Very small optimizations

David Pio puffpio at gmail.com
Fri Dec 2 01:59:29 CET 2005


On 12/1/05, Loren Merritt <lorenm at u.washington.edu> wrote:
>
> On Thu, 1 Dec 2005, David Pio wrote:
>
> > encoder/me.c
> > function 'x264_me_search_ref'
> >
> > various search methods use 'i_me_range/2' or 'i_me_range/4' in the
> > conditional part of the looping structure.
> > i_me_range seems not to change within the context of the function, so
> should
> > those divides be taken out of the looping structure?  say create 2 new
> > variables i_me_range_div2 and i_me_range_div4??  It would save some
> divide
> > CPU cycles.
> >
> > Or does the compiler optimize this out?
>
> Division symbol != division instruction. The compiler knows to use shifts.



what I mean here is not about the shifting itslef but more of the
shifting/divide per loop iteration
at the end of the for loop it will do a i_me_range/2 or /4 to compare with
the counter.
if the compiler knows that i_me_range hasn't changed, it can optimize that
conditional fragment by remembering the value of i_me_range/2 or /4...but
does it actually do that?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.videolan.org/pipermail/x264-devel/attachments/20051201/f224dba4/attachment.htm 


More information about the x264-devel mailing list