[MPlayer-dev-eng] [PATCH] slightly faster float2int
Rich Felker
dalias at aerifal.cx
Fri Aug 18 16:58:23 CEST 2006
On Tue, Apr 11, 2006 at 11:46:32AM +0200, Reimar Döffinger wrote:
> Hi,
> please comment and if possible benchmark as well. Not sure if it's worth
> changing, but this rots in my tree...
>
> Greetings,
> Reimar Döffinger
> Index: libaf/af_format.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libaf/af_format.c,v
> retrieving revision 1.31
> diff -u -r1.31 af_format.c
> --- libaf/af_format.c 13 Nov 2005 18:28:44 -0000 1.31
> +++ libaf/af_format.c 11 Apr 2006 09:45:18 -0000
> @@ -467,23 +467,31 @@
>
> static void float2int(float* in, void* out, int len, int bps)
> {
> - register int i;
> + register long i = -len;
> + if (len <= 0)
> + return;
> + in = &in[len];
Why not in += len; ??
> + out += bps * len;
This line is not valid C. You cannot perform arithmetic on void
pointers. Instead: out = (char *)out + bps*len;
Rich
More information about the MPlayer-dev-eng
mailing list