[Ffmpeg-cvslog] CVS: ffmpeg/libavutil common.h,1.164,1.165
Rich Felker
dalias
Mon May 1 03:25:23 CEST 2006
On Mon, May 01, 2006 at 02:27:26AM +0200, Aurelien Jacobs CVS wrote:
> Update of /cvsroot/ffmpeg/ffmpeg/libavutil
> In directory mail:/var2/tmp/cvs-serv11761/libavutil
>
> Modified Files:
> common.h
> Log Message:
> document clip functions
>
> Index: common.h
> ===================================================================
> RCS file: /cvsroot/ffmpeg/ffmpeg/libavutil/common.h,v
> retrieving revision 1.164
> retrieving revision 1.165
> diff -u -d -r1.164 -r1.165
> --- common.h 30 Apr 2006 17:49:11 -0000 1.164
> +++ common.h 1 May 2006 00:27:24 -0000 1.165
> @@ -427,6 +427,13 @@
> #endif
> }
>
> +/**
> + * clip a signed integer value into the amin-amax range
> + * @param a value to clip
> + * @param amin minimum value of the clip range
> + * @param amax maximum value of the clip range
> + * @return cliped value
> + */
> static inline int clip(int a, int amin, int amax)
> {
> if (a < amin)
> @@ -437,6 +444,11 @@
> return a;
> }
Possibly faster version of clip():
if ((unsigned)a-amin > amax-amin) {
if (x < amin) return amin;
else return amax;
} else return a;
I say possibly only because there's more arithmetic, but the extra
arithmetic collapses away during inlining if amin and amax are
constants at compiletime.
Rich
More information about the ffmpeg-cvslog
mailing list