[FFmpeg-devel] [PATCH] Move MLP's dot product to DSPContext

Ramiro Polla ramiro.polla
Mon Apr 20 07:29:09 CEST 2009


Hi,

On Mon, Apr 20, 2009 at 12:14 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sun, Apr 19, 2009 at 10:10:05PM -0300, Ramiro Polla wrote:
>> Attached file move MLP's dot product to DSPContext. The filter order
>> is a maximum of 8, and in the rematrix stage it's a maximum of 5+2
>> channels for MLP and 7+0 channels for TrueHD, so it all fits in 8
>> (hopefully) optimized functions.
>
> the functions are too small, the call overhead is too much
> 1-8 multiplicatons and 1-8 additions is not enough ...

I thought that would happen too, but strangely there was a speedup.

> [...]
>
>> static int64_t mlp_dotproduct_c(int32_t *state, int32_t *coeffs, int order)
>
> the arguments should be const

Done.

I also removed a wrong bit in the previous patch regarding the
declaration of matrix_coeff.

>> {
>> ? ? int64_t accum = 0;
>>
>> ? ? while (order--)
>> ? ? ? ? accum += (int64_t) *state++ * *coeffs++;
>
> switch(order){
> case 8: accum ?= (int64_t) *state++ * *coeffs++;
> case 7: accum += (int64_t) *state++ * *coeffs++;
> case 6: accum += (int64_t) *state++ * *coeffs++;
> case 5: accum += (int64_t) *state++ * *coeffs++;
> case 4: accum += (int64_t) *state++ * *coeffs++;
> case 3: accum += (int64_t) *state++ * *coeffs++;
> case 2: accum += (int64_t) *state++ * *coeffs++;
> case 1: accum += (int64_t) *state ? * *coeffs ?;
> case 0:
> }

This makes it 5.4% slower than the current code.

> also state[i] * coeffs[i]; i++
> could be tried

8.1% faster than current code, but a bit slower then the
while(order--) code, which gives 10.8%.

I also tried putting the while(order--) function direcly in mlpdec.c,
which gave only 2.7%. The switch code was about the same.

Ramiro Polla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mlpdsp.c
Type: text/x-csrc
Size: 1867 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090420/310ab861/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mlpdsp_3.diff
Type: text/x-diff
Size: 7037 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090420/310ab861/attachment.diff>



More information about the ffmpeg-devel mailing list