[vlc-devel] [vlc-commits] Avcodec: set the dsp_mask for NEON too

Måns Rullgård mans at mansr.com
Tue Oct 2 14:21:12 CEST 2012

Jean-Baptiste Kempf <jb at videolan.org> writes:

> On Tue, Oct 02, 2012 at 12:19:29AM +0100, Måns Rullgård wrote :
>> Jean-Baptiste Kempf <jb at videolan.org> writes:
>> > On Mon, Oct 01, 2012 at 11:45:40PM +0100, Måns Rullgård wrote :
>> >> Because runtime CPU detection on ARM is not generally possible (some
>> >> systems expose a subset of the information we need), we rely on probing
>> >> the compiler settings to determine which code to build and use.
>> >
>> > The information of having NEON or not is not enough?
>> Obviosly not.  You need to know about armv5te, armv6, armv6t2, vfp,
>> vfpv3, vfpv3-d32, neon, etc.  Some of these are reported in Linux hwcaps
>> (listed in /proc/cpuinfo) but not all.
> Hmmm. I think that for VLC, we mostly care for Android and iOS, since
> most of the other OSes are marginalized (whether we like it or not)
> According to docs, on Android, NEON can only be with ARMv7. And ARMv7
> guarantees to have vfpv3.

ARMv7 does not mandate VFP.

> iOS is easy to deal with, because of the limited number of devices (10
> or so).

IIUC all Apple devices since the iPhone 3GS have armv7-a + neon, so
there is actually no problem there.  The original armv6 based iPhone is
probably irrelevant.

>> >> Furthermore, even if runtime detection is possible, you still want to
>> >> build with the compiler flags best matching the target device.  Compared
>> >> to x86, much greater gains are made in plain C code when building for
>> >> the actual target hardware rather than something less capable.
>> >
>> > Sure, but can't one do a "average" binary (not best match) to work
>> > on all cortex-a8 and a9 and just activate NEON code when a NEON fpu
>> > is present?  Or am I too naive?
>> s/average/minimum/
> Well, my (our?) issue is to be have to have, for Android, a minimum
> binary that can work on all classic devices (Cortex-A8+NEON) and not
> crash on nVidia Tegra2 devices.
> If I understand you correctly, it probably won't be 100% optimized for
> Cortex-A9+NEON nor for tegra2, but that is a limitation that we can
> accept, if it avoids having to do .so downloading...

A base configuration for armv7-a + vfpv3-d16 will run on any cortex-a*
CPU without suffering too much if runtime selection is used for NEON
code where possible.  Also supporting older versions would have a higher

Måns Rullgård
mans at mansr.com

More information about the vlc-devel mailing list