[Ffmpeg-devel] [PATCH] use libavutil macros in libpostproc

Michael Niedermayer michaelni
Tue Oct 10 08:04:37 CEST 2006


Hi

On Tue, Oct 10, 2006 at 02:33:31AM +0100, M?ns Rullg?rd wrote:
> 
> Aurelien Jacobs said:
> > On Tue, 10 Oct 2006 01:23:23 +0200
> > Diego Biurrun <diego at biurrun.de> wrote:
> >
> >> $subject, plus put the SIGN macro in libavutil/common.h as well, it
> >> might be useful in other places.
> >>
> >> Index: libavutil/common.h
> >> ===================================================================
> >> --- libavutil/common.h	(revision 6612)
> >> +++ libavutil/common.h	(working copy)
> >> @@ -193,6 +193,7 @@
> >>  /* assume b>0 */
> >>  #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
> >>  #define ABS(a) ((a) >= 0 ? (a) : (-(a)))
> >> +#define SIGN(a) ((a) > 0 ? 1 : -1)
> >
> > Maybe use this instead ? (but I don't know if it's worth)
> >
> >   +#define SIGN(a) ((((a) > 0) - 1) | 1)     /* same as ((a) > 0 ? 1 : -1) */
> 
> Or (((a)>>(sizeof(a)*CHAR_BIT-1))|1).

well, we have 3 proposals ...
what about a benchmark? and dont forget the randomness of the sign (branch
misspredictons) might matter 

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list