[FFmpeg-devel] [PATCH 07/12] WMA: use fill_float from dsputil

Michael Niedermayer michaelni
Mon Sep 28 00:16:32 CEST 2009


On Sun, Sep 27, 2009 at 11:49:23AM +0100, Mans Rullgard wrote:
> ---
>  libavcodec/wmadec.c |   11 +++++------
>  1 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
> index e5f0508..52ea7a3 100644
> --- a/libavcodec/wmadec.c
> +++ b/libavcodec/wmadec.c
> @@ -262,9 +262,8 @@ static int decode_exp_vlc(WMACodecContext *s, int ch)
>          v = pow(10, last_exp * (1.0 / 16.0));
>          max_scale = v;
>          n = *ptr++;
> -        do {
> -            *q++ = v;
> -        } while (--n);
> +        s->dsp.fill_float(q, v, n);
> +        q += n;
>      }else
>          last_exp = 36;
>  
> @@ -275,13 +274,13 @@ static int decode_exp_vlc(WMACodecContext *s, int ch)
>          /* NOTE: this offset is the same as MPEG4 AAC ! */
>          last_exp += code - 60;
>          /* XXX: use a table */
> +        av_log(NULL, AV_LOG_ERROR, "exp= %d\n", last_exp);
>          v = pow(10, last_exp * (1.0 / 16.0));
>          if (v > max_scale)
>              max_scale = v;
>          n = *ptr++;
> -        do {
> -            *q++ = v;
> -        } while (--n);
> +        s->dsp.fill_float(q, v, n);
> +        q += n;
>      }

the call overhead should be quite significant here,
if gcc doesnt get it and someone considers this important then the whole
should be written in asm or inline asm should be used with C code.
calling dsp really does not seems like a good idea to me

(and the av_log of course shouldnt be there ...)

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

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090928/2a1b12dc/attachment.pgp>



More information about the ffmpeg-devel mailing list