[FFmpeg-devel] [PATCH 2/2] WMA: use vector_fmul_step_scalar

Michael Niedermayer michaelni
Thu Oct 1 23:52:13 CEST 2009


On Wed, Sep 30, 2009 at 11:16:22PM +0100, Mans Rullgard wrote:
> ---
>  libavcodec/wma.h    |    2 +-
>  libavcodec/wmadec.c |    6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/wma.h b/libavcodec/wma.h
> index b6c2943..390cdd2 100644
> --- a/libavcodec/wma.h
> +++ b/libavcodec/wma.h
> @@ -113,7 +113,7 @@ typedef struct WMACodecContext {
>      int exponents_bsize[MAX_CHANNELS];      ///< log2 ratio frame/exp. length
>      DECLARE_ALIGNED_16(float, exponents[MAX_CHANNELS][BLOCK_MAX_SIZE]);
>      float max_exponent[MAX_CHANNELS];
> -    WMACoef coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE];
> +    DECLARE_ALIGNED_16(WMACoef, coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE]);
>      DECLARE_ALIGNED_16(float, coefs[MAX_CHANNELS][BLOCK_MAX_SIZE]);
>      DECLARE_ALIGNED_16(FFTSample, output[BLOCK_MAX_SIZE * 2]);
>      FFTContext mdct_ctx[BLOCK_NB_SIZES];
> diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
> index 5a31963..d3651ed 100644
> --- a/libavcodec/wmadec.c
> +++ b/libavcodec/wmadec.c
> @@ -680,9 +680,9 @@ static int wma_decode_block(WMACodecContext *s)
>                  for(i = 0;i < s->coefs_start; i++)
>                      *coefs++ = 0.0;
>                  n = nb_coefs[ch];
> -                for(i = 0;i < n; i++) {
> -                    *coefs++ = coefs1[i] * exponents[i<<bsize>>esize] * mult;
> -                }
> +                s->dsp.vector_fmul_step_scalar(coefs, coefs1, exponents,
> +                                               mult, bsize-esize, n);
> +                coefs += n;

do you have a file where bsize<esize ?

also it may be faster to "rescale" the array and then use a normal
a[x]*=b[x] instead of the more complex indexing but this depends on
how much such rescaled arrays are reuseable ...
as another big advantage such seperate "rescaling" would reduce the
amount of code in dsp

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

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- 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/20091001/b0b52814/attachment.pgp>



More information about the ffmpeg-devel mailing list