[vlc-devel] [PATCH] FFmpeg: allow runtime NEON detection

Rafaël Carré funman at videolan.org
Fri Oct 5 17:46:28 CEST 2012


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

Signed-off-by: Rafaël Carré <funman at videolan.org>
---
 .../0001-KLUDGE-Deactivate-INLINE-NEON-ASM.patch   |   53 ++++++++++++++++++++
 contrib/src/ffmpeg/rules.mak                       |    5 +-
 2 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 contrib/src/ffmpeg/0001-KLUDGE-Deactivate-INLINE-NEON-ASM.patch

diff --git a/contrib/src/ffmpeg/0001-KLUDGE-Deactivate-INLINE-NEON-ASM.patch b/contrib/src/ffmpeg/0001-KLUDGE-Deactivate-INLINE-NEON-ASM.patch
new file mode 100644
index 0000000..980dd47
--- /dev/null
+++ b/contrib/src/ffmpeg/0001-KLUDGE-Deactivate-INLINE-NEON-ASM.patch
@@ -0,0 +1,53 @@
+From 2d554ccc944f41317f38ccff58d4cf93df82c4a4 Mon Sep 17 00:00:00 2001
+From: Jean-Baptiste Kempf <jb at videolan.org>
+Date: Wed, 3 Oct 2012 20:03:12 +0200
+Subject: [PATCH] KLUDGE: Deactivate INLINE NEON ASM
+
+---
+ configure            | 2 +-
+ libavcodec/arm/aac.h | 2 +-
+ libavcodec/arm/dca.h | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/configure b/configure
+index cd72f36..b5f7354 100755
+--- a/configure
++++ b/configure
+@@ -3016,7 +3016,7 @@ EOF
+     enabled armv6   && check_inline_asm armv6   '"sadd16 r0, r0, r0"'
+     enabled armv6t2 && check_inline_asm armv6t2 '"movt r0, #0"'
+     enabled armvfp  && check_inline_asm armvfp  '"fadds s0, s0, s0"'
+-    enabled neon    && check_inline_asm neon    '"vadd.i16 q0, q0, q0"'
++#    enabled neon    && check_inline_asm neon    '"vadd.i16 q0, q0, q0"'
+     enabled vfpv3   && check_inline_asm vfpv3   '"vmov.f32 s0, #1.0"'
+ 
+     check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
+diff --git a/libavcodec/arm/aac.h b/libavcodec/arm/aac.h
+index 83b5aef..04fd820 100644
+--- a/libavcodec/arm/aac.h
++++ b/libavcodec/arm/aac.h
+@@ -23,7 +23,7 @@
+ 
+ #include "config.h"
+ 
+-#if HAVE_NEON && HAVE_INLINE_ASM
++#if 0 && HAVE_NEON && HAVE_INLINE_ASM
+ 
+ #define VMUL2 VMUL2
+ static inline float *VMUL2(float *dst, const float *v, unsigned idx,
+diff --git a/libavcodec/arm/dca.h b/libavcodec/arm/dca.h
+index 9b0efc0..89f1eb1 100644
+--- a/libavcodec/arm/dca.h
++++ b/libavcodec/arm/dca.h
+@@ -79,7 +79,7 @@ static inline int decode_blockcodes(int code1, int code2, int levels,
+ 
+ #endif
+ 
+-#if HAVE_NEON && HAVE_INLINE_ASM && HAVE_ASM_MOD_Y
++#if 0 && HAVE_NEON && HAVE_INLINE_ASM && HAVE_ASM_MOD_Y
+ 
+ #define int8x8_fmul_int32 int8x8_fmul_int32
+ static inline void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
+-- 
+1.7.12.2
+
diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index 39a1a0c..1c07db0 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -55,9 +55,11 @@ endif
 # ARM stuff
 ifeq ($(ARCH),arm)
 FFMPEGCONF += --arch=arm
-ifdef HAVE_NEON
 FFMPEGCONF += --cpu=cortex-a8 --enable-neon
+ifdef HAVE_NEON
 FFMPEG_CFLAGS += -mfpu=neon
+else
+FFMPEG_CFLAGS += -mfpu=vfpv3-d16
 endif
 endif
 
@@ -142,6 +144,7 @@ ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg
 ifdef HAVE_WIN32
 	sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
 endif
+	$(APPLY) $(SRC)/0001-KLUDGE-Deactivate-INLINE-NEON-ASM.patch
 	$(MOVE)
 
 .ffmpeg: ffmpeg
-- 
1.7.10.4



More information about the vlc-devel mailing list