[XviD-devel] New Qpel code

Edouard Gomez ed.gomez at free.fr
Sun Aug 24 18:08:15 CEST 2003


Christoph Lampert (chl at math.uni-bonn.de) wrote:
> Have you checked if this provides any positive effect?

It's not for speed that i  write this function array tricks, the code is
far more easy to read and  understand that way (it helps for manual loop
unrolling as well). 

Impact on speed is zero.

> Branching based on some value  (which might be constant, so prediction
> works almost always)  doesn't have to slower than  reading the address
> of  a  routine from  memory  (based on  the  same  value) and  jumping
> then. In  both cases,  pipelining has to  be stopped because  the next
> instruction isn't clear. 

Nah current code looks like this:
 1/ branch on constant value "rrv is set?" 
 2/ do  things (slightly  different if it's  rrv or  not, a factor  2 in
    divisions)
 3/ branch on constant value "mpeg quant is set?" 
 4/ call the function through the function pointer

My modifications just do:
 0/ Create arrays of function addresses
 1/ make rrv and mpeg booleans (1 if they are true, 0 otherwise)
 2/ do things (same formula for all now)
 3/ call the  function through the function pointer  indexed by mpeg/rrv
    and so on

It does not add more indirections, functions were already called through
pointers, so the code is just cleaner. 

Btw  the patch  is ready  and modifies  the trellis  quantization  so it
returns  the sum  of the  coefficents (wether  original ones  if trellis
failed to optimize the coeffs, or new Out[] sum if it succeed)

--
Edouard Gomez


More information about the XviD-devel mailing list