[MPlayer-dev-eng] ARM and liba52
Ivan Kalvachev
ikalvachev at gmail.com
Thu May 1 14:28:51 CEST 2008
On Thu, May 1, 2008 at 1:05 PM, Siarhei Siamashka
<siarhei.siamashka at gmail.com> wrote:
> On Monday 28 April 2008, Siarhei Siamashka wrote:
> > Hi,
> >
> > Currently liba52 is broken for ARM processors which require strict
> > alignment for accessing memory (ARM9, XScale, ...). AC3 audio playback just
> > produces noise.
> >
> > Interestingly enough, the problem was introduced in 2003 (SVN revision
> > 10314), and it was supposedly a fix for ARM:
> > http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2003-June/019377.html
> >
> > I wonder if it was a fix that turned compilation error into runtime failure
> > ;)
> >
> > Anyway, it should be mentioned that modern ARM cores (such as ARM11)
> > support unaligned memory access natively. Older cores can emulate unaligned
> > memory accesses by handling alignment faults in the kernel, but this is
> > very slow.
> >
> > PS. liba52 uses floating point math which is very slow on old ARM cores
> > without hardware FPU, so using liba52 on such old cores is not very
> > practical anyway.
>
> Ping.
>
> Can anybody consider reverting r10314 change? Or alternatively you can try to
> use the attached patch. Anyway, some kind of action needs to be taken to fix
> this breakage.
>
> Also I strongly suspect that r10490 was a proper fix for that ARM
> compilation issue with gcc 2.95 that r10314 tried to address but introduced
> a bigger problem instead.
>
> ------------------------------------------------------------------------
> r10490 | alex | 2003-07-28 02:02:58 +0300 (Mon, 28 Jul 2003) | 2 lines
> Changed paths:
> M /trunk/liba52/bitstream.h
>
> Changed swab32 from macro to inline function, this fixes compilation on alpha
> (with gcc2.95). Based on patch by KotH
>
I think the proper fix would be to don't use ALT_BITSTREAM_READER on
architectures that can't read unaligned words. It seems that the code
in question uses some kind of black magic trying to make unaligned
access problem of the compiler, instead of reading it byte by byte.
I think a patch that disables ALT_* on all ARMs without native
unaligned access would be quickly committed.
p.s.
the black magic code is present in lavc bitreader too, but it looks
like it is not used anywhere. Time for cleanup :)
More information about the MPlayer-dev-eng
mailing list