[vlc-devel] [PATCH] Add ARM mode compilation for JNI files

Rafaël Carré funman at videolan.org
Tue May 1 23:29:01 CEST 2012


Le 01/05/2012 13:36, Måns Rullgård a écrit :
> Jean-Baptiste Kempf <jb at videolan.org> writes:
> 
>> On Tue, May 01, 2012 at 01:23:27PM -0400, Rafaël Carré wrote :
>>> Le 01/05/2012 06:51, satish MR a écrit :
>>>> Hi,
>>>> This patch covers Support for ARM mode compilation of JNI files instead of
>>>> THUMB mode (selected by default now).
>>>
>>> What is wrong with thumb ?
>>
>> It is slower than ARM, IIRC.
> 
> Thumb-1 is certainly slower.  Thumb-2 is usually about the same speed.
> All Cortex-Ax CPUs support Thumb-2.  ARM1136/76 do not.

Here are 2 armv7a+neon builds:
http://people.videolan.org/~funman/andro/VLC-armv7a-neon-arm.apk
http://people.videolan.org/~funman/andro/VLC-armv7a-neon-thumb.apk

The thumb build is 456kB smaller (7.5%)

Decoding a mpeg-4 ASP gives, as expected, identical performance as
measured with top -m 10


I think it makes sense to build for thumb when targetting armv7a, opinions ?


Here is how I made the thumb build :

android.git diff (add -mthumb -mthumb-interwork):

diff --git a/configure.sh b/configure.sh
index 3f48c50..668c4c0 100755
--- a/configure.sh
+++ b/configure.sh
@@ -9,7 +9,7 @@ ANDROID_API=android-9

 VLC_SOURCEDIR=..

-CFLAGS="-g -O2 -mlong-calls -fstrict-aliasing -mfloat-abi=softfp
-funsafe-math-optimizations"
+CFLAGS="-g -O2 -mlong-calls -fstrict-aliasing -mfloat-abi=softfp
-funsafe-math-optimizations -mthumb -mthumb-interwork"
 LDFLAGS="-Wl,-Bdynamic,-dynamic-linker=/system/bin/linker
-Wl,--no-undefined"

 if [ -z "$NO_NEON" ]; then


vlc.git diff (add -mthumb -mthumbinterwork, add --enable-thumb for
ffmpeg, add -mnothumb (forces -marm) for a few libs which dont build in
thumb (usually because they use ARM-only assembly) : speex, mad (and
tremor and faad2 but we dont build them)

diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index e91ed35..67575b2 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -32,7 +32,7 @@ FFMPEGCONF += --disable-encoders --disable-muxers
 endif

 ifdef ENABLE_SMALL
-FFMPEGCONF += --enable-small --optflags=-O2
+FFMPEGCONF += --enable-small --optflags=-O2 --enable-thumb
 endif

 # XXX: REVISIT
diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index 9ac80d2..912d16d 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -99,6 +99,10 @@ STRIP := $(HOST)-strip
 endif
 endif

+ifeq ($(ARCH), arm)
+NOTHUMB=-mno-thumb
+endif
+
 ifdef HAVE_ANDROID
 CC :=  $(HOST)-gcc --sysroot=$(ANDROID_NDK)/platforms/android-9/arch-arm
 CXX := $(HOST)-g++ --sysroot=$(ANDROID_NDK)/platforms/android-9/arch-arm
@@ -116,7 +120,7 @@ endif
 endif
 EXTRA_CFLAGS += -I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/include
 EXTRA_CFLAGS +=
-I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/libs/$(ANDROID_ABI)/include
-EXTRA_CFLAGS += -mfloat-abi=softfp $(ANDROID_CPU_FLAGS)
+EXTRA_CFLAGS += -mfloat-abi=softfp $(ANDROID_CPU_FLAGS) -mthumb
-mthumb-interwork
 endif

 ifdef HAVE_MACOSX



More information about the vlc-devel mailing list