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

Måns Rullgård mans
Fri Oct 2 00:29:47 CEST 2009


Michael Niedermayer <michaelni at gmx.at> writes:

> 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 ?

A-codecs/WMA/Bangles 01 - Walk Like An Egyptian.wma

> 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 ...

That would a possibility if only a few bsize-esize values ever occur.
I have only seen values in the -4..4 range, but that doesn't mean much.

> as another big advantage such seperate "rescaling" would reduce the
> amount of code in dsp

We still need a function doing d[x]=a[x]*b[x]*c.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list