[Ffmpeg-devel] rounding question

Marc Hoffman mmhoffm
Sat Mar 10 02:02:12 CET 2007


Looking at the set of pixel functions which do xy corner averaging  
I'm confused by the reference math.  There are two functions one with  
rounding and the other with out.  The one with rounding adds 4  
samples and then adds 1/2 and truncates.  The one that is titled  
no_rnd adds 1/4 and then truncates.  I'm a little confused by the  
semantics and am not sure why this is.

excerpt from _pixels_xy2_c
             b= LD64(pixels+1);\
             l0=  (a&0x0303030303030303ULL)\
                + (b&0x0303030303030303ULL)\
                + 0x0202020202020202ULL;\
             h0= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\

  excerpt from _no_rnd_pixels_xy2_c
             b= LD64(pixels+1);\
             l0=  (a&0x0303030303030303ULL)\
                + (b&0x0303030303030303ULL)\
                + 0x0101010101010101ULL;\
             h0= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\


I guess any direction would be great here I might just be missing  
something like the no_rnd means something other than truncate.

Thanks
Marc




More information about the ffmpeg-devel mailing list