[Ffmpeg-devel] rounding question

Marc Hoffman mmh
Mon Mar 12 16:59:20 CET 2007


On Mar 9, 2007, at 8:02 PM, Marc Hoffman wrote:

> 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


Does this question make sense to anyone? I really want to get an  
understanding of what is meant by no_rnd vs the default which is to  
add .5 and then truncate.

Thanks
Marc




More information about the ffmpeg-devel mailing list