[Ffmpeg-devel] [PATCH] fix mpegaudiodec on ARM and benchmark

Michael Niedermayer michaelni
Wed Aug 23 17:21:29 CEST 2006


Hi

On Wed, Aug 23, 2006 at 02:12:40PM +0200, Aurelien Jacobs wrote:
> Hi,
> 
> After the recent optimisation in mpegaudiodec, I've benchmarked mp3 on ARM.
> But first, mpegaudiodec.c didn't compiled, so I fixed it.
> I guess I should commit the attached patch ?
> 
> Here is how I benchmarked:
>  ./mplayer -quiet -ac ffmp3 -ao pcm:fast:file=/dev/null -benchmark a.mp3
> 
> And here are the results with various lavc revisions (Xscale IXP420).
> 
> r6036
> BENCHMARKs: VC:   0.000s VO:   0.000s A: 216.931s Sys:   0.414s =  217.346s
> BENCHMARK%: VC:  0.0000% VO:  0.0000% A: 99.8093% Sys:  0.1907% = 100.0000%
> 
> r6037
> BENCHMARKs: VC:   0.000s VO:   0.000s A: 212.347s Sys:   0.412s =  212.759s
> BENCHMARK%: VC:  0.0000% VO:  0.0000% A: 99.8062% Sys:  0.1938% = 100.0000%
> 
> r6039
> BENCHMARKs: VC:   0.000s VO:   0.000s A: 212.703s Sys:   0.411s =  213.114s
> BENCHMARK%: VC:  0.0000% VO:  0.0000% A: 99.8070% Sys:  0.1930% = 100.0000%
> 
> r6050 (patched)
> BENCHMARKs: VC:   0.000s VO:   0.000s A: 170.642s Sys:   0.411s =  171.053s
> BENCHMARK%: VC:  0.0000% VO:  0.0000% A: 99.7597% Sys:  0.2403% = 100.0000%
> 
> Overall 20% speedup, which is not so bad :-)

was this with or without  --disable-libavcodec_mpegaudio_hp ?


> 
> Aurel

> Index: mpegaudiodec.c
> ===================================================================
> --- mpegaudiodec.c	(revision 6050)
> +++ mpegaudiodec.c	(working copy)
> @@ -59,13 +59,13 @@
>  #   define MULL(a, b) \
>          ({  int lo, hi;\
>              asm("smull %0, %1, %2, %3     \n\t"\
> -                "mov   %0, %0,     lsr #%4\n\t"\
> -                "add   %1, %0, %1, lsl #%5\n\t"\
> -            : "=r"(lo), "=r"(hi)\
> +                "mov   %0, %0,     lsr %4\n\t"\
> +                "add   %1, %0, %1, lsl %5\n\t"\
> +            : "=&r"(lo), "=&r"(hi)\
>              : "r"(b), "r"(a), "i"(FRAC_BITS), "i"(32-FRAC_BITS));\
>           hi; })
>  #   define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
> -#   define MULH(a, b) ({ int lo, hi; asm ("smull %0, %1, %2, %3" : "=r"(lo), "=r"(hi) : "r"(b),"r"(a)); hi; })
> +#   define MULH(a, b) ({ int lo, hi; asm ("smull %0, %1, %2, %3" : "=&r"(lo), "=&r"(hi) : "r"(b),"r"(a)); hi; })

i think not all 4 of the & are needed, but iam not sure ...

also please try to xchange a and b, some ARM cpus need less time to do 
multiplications if the right one of these is small but i dunno which one it 
was ...

and another idea, try to set -mcpu -march -mtune correctly for the cpu

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

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list