[Ffmpeg-devel] [PATCH] fix mpegaudiodec on ARM and benchmark
Aurelien Jacobs
aurel
Thu Aug 24 01:48:25 CEST 2006
On Thu, 24 Aug 2006 00:51:09 +0200
Michael Niedermayer <michaelni at gmx.at> wrote:
> Hi
>
> On Thu, Aug 24, 2006 at 12:08:22AM +0200, Aurelien Jacobs wrote:
> [...]
> > > > 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 ...
> >
> > If I remove any one of them, I get a load of messages like this one:
> > {standard input}: Assembler messages:
> > {standard input}:630: rdhi, rdlo and rm must all be different
> > Note that I'm cross-compiling with gcc-4.1 if that's relevant.
>
> hmm ok, then they probably are needed, feel free to commit the patch ...
done.
> > Setting -march=armv5te (which is exactly what my Xscale is) is quite
> > slower, I don't understand why:
> > BENCHMARKs: VC: 0.000s VO: 0.000s A: 206.553s Sys: 0.438s = 206.991s
> > BENCHMARK%: VC: 0.0000% VO: 0.0000% A: 99.7882% Sys: 0.2118% = 100.0000%
>
> maybe bugreport to gcc devels?
Previous disscussions on this list about gcc bugreports are not much
encouraging... Maybe I will try...
> > Now I also benchmarked libmad. It's still "slightly" faster !
> > BENCHMARKs: VC: 0.000s VO: 0.000s A: 54.212s Sys: 0.407s = 54.618s
> > BENCHMARK%: VC: 0.0000% VO: 0.0000% A: 99.2554% Sys: 0.7446% = 100.0000%
> >
> > Then I benchmarked ffmp3 r6050 (patched) with --disable-libavcodec_mpegaudio_hp
> > BENCHMARKs: VC: 0.000s VO: 0.000s A: 78.751s Sys: 0.419s = 79.171s
> > BENCHMARK%: VC: 0.0000% VO: 0.0000% A: 99.4702% Sys: 0.5298% = 100.0000%
> > Pretty impressive ! Not so far from libmad !
>
> next thing you could try are the different bitstream readers, the default is
> probably not good on arm as it does unaligned reads
> see the #defines at the top of libavcodec/bitstream.h
> note, if anything fails compilation or such please report it ...
Ok, so first the compilation failures. With LIBMPEG2_BITSTREAM_READER there
was a single error, but I'm not sure how to fix it properly:
arm-linux-gnu-gcc -DHAVE_AV_CONFIG_H -I.. -I../libavutil -Wdeclaration-after-statement -O4 -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -I/usr/include -I/usr/src/DVB/ost/include -I/usr/include/dxr2 -I/usr/local/include/cdda -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -c -o h263.o h263.c
In file included from mpegvideo.h:30,
from h263.c:38:
bitstream.h: In function 'init_get_bits':
bitstream.h:696: warning: assignment discards qualifiers from pointer target type
bitstream.h:701: warning: assignment discards qualifiers from pointer target type
h263.c: In function 'decode_user_data':
h263.c:5802: error: 'GetBitContext' has no member named 'index'
Then with A32_BITSTREAM_READER I had two more errors which are fixed by
the attached patch.
Now the benchmarks:
#define ALT_BITSTREAM_READER
BENCHMARKs: VC: 0.000s VO: 0.000s A: 78.751s Sys: 0.419s = 79.171s
BENCHMARK%: VC: 0.0000% VO: 0.0000% A: 99.4702% Sys: 0.5298% = 100.0000%
#define LIBMPEG2_BITSTREAM_READER
BENCHMARKs: VC: 0.000s VO: 0.000s A: 78.978s Sys: 0.422s = 79.399s
BENCHMARK%: VC: 0.0000% VO: 0.0000% A: 99.4691% Sys: 0.5309% = 100.0000%
#define A32_BITSTREAM_READER
BENCHMARKs: VC: 0.000s VO: 0.000s A: 70.622s Sys: 0.357s = 70.978s
BENCHMARK%: VC: 0.0000% VO: 0.0000% A: 99.4973% Sys: 0.5027% = 100.0000%
We are getting even closer to libmad :-)
What about something like the second attached patch ?
Aurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bitstream-reader.diff
Type: text/x-diff
Size: 682 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060824/66655909/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bitstream-reader-arm.diff
Type: text/x-diff
Size: 499 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060824/66655909/attachment-0001.diff>
More information about the ffmpeg-devel
mailing list