how to compile ffmpeg with neon support?

3,486 views
Skip to first unread message

smallrui

unread,
Sep 7, 2011, 3:16:32 AM9/7/11
to android-ndk
hi,
how to compile ffmpeg with neon support?

Zoran Angelov

unread,
Sep 7, 2011, 10:13:41 AM9/7/11
to andro...@googlegroups.com
You can try with this one http://bambuser.com/opensource but you need to manually add features as you need because by default there is very few enabled. Look inside the build.sh there is armv6, armv7a and armv7a+neon configure arguments. I'm using armv6 only, have not tried to build armv7a+neon yet.






On Wed, Sep 7, 2011 at 9:16 AM, smallrui <isma...@gmail.com> wrote:
hi,
how to compile ffmpeg with neon support?

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


smallrui

unread,
Sep 8, 2011, 8:56:22 AM9/8/11
to android-ndk
hi, thanks for your reply.

when i compile follow your suggestion.but it cause an error.

Compile thumb : avcodec <= dsputil.c
/tmp/ccQYYjME.s: Assembler messages:
/tmp/ccQYYjME.s:24484: Error: thumb conditional instruction not in IT
block
/tmp/ccQYYjME.s:24485: Error: thumb conditional instruction not in IT
block
/tmp/ccQYYjME.s:24487: Error: thumb conditional instruction not in IT
block
/tmp/ccQYYjME.s:24489: Error: thumb conditional instruction not in IT
block
/tmp/ccQYYjME.s:24581: Error: thumb conditional instruction not in IT
block
/tmp/ccQYYjME.s:24582: Error: thumb conditional instruction not in IT
block
/tmp/ccQYYjME.s:24584: Error: thumb conditional instruction not in IT
block
/tmp/ccQYYjME.s:24586: Error: thumb conditional instruction not in IT
block

i found that says theirs seems have a bug in dsputil.c, but i am not
very confirm
whether their is a bug and how to solve the bug.
https://bugs.launchpad.net/gcc-linaro/+bug/666183

can you take some times to test whether can compile with the neon
support for me?
thanks a lot.

On 9月7日, 下午10时13分, Zoran Angelov <bald...@gmail.com> wrote:
> You can try with this onehttp://bambuser.com/opensourcebut you need to

Zoran Angelov

unread,
Sep 8, 2011, 5:14:19 PM9/8/11
to andro...@googlegroups.com
Hi,
i tried and successfully build the ffmpeg with neon support.
I had to add "--enable-memalign-hack" in order build to succeed.
Also note that i was using ndk-r6b (latest) under cygwin ( make=3.81 ).
I'm attaching my build.sh that will only build ffmpeg with neon ( ... for version in neon; do ... ).
Lately with newer ndk's i'm experiencing difficulties with path under cygwin, so i had to modify configure script to adjust temporary directory with cygpath, also attached.

Try with my build.sh first, and use my configure script only if you experience similar difficulties under cygwin (because it fixes $TMPDIR only with cygpath ).



2011/9/8 smallrui <isma...@gmail.com>
build.sh
configure

Zoran Angelov

unread,
Sep 8, 2011, 5:17:21 PM9/8/11
to andro...@googlegroups.com
BTW which version of ndk you were using ?


2011/9/8 Zoran Angelov <bal...@gmail.com>

Smallrui

unread,
Sep 13, 2011, 2:57:04 AM9/13/11
to android-ndk
hi, it works, nice!!! it can directly build the library and auto copy
the header to the include folder, that's great!!

but!!, when i linked the static library into my workspace it said
"undefined reference to....".

i have copy the source code from havlenapetr's prject("https://
github.com/havlenapetr/FFMpeg").
it works well in armeabi but cannot build with neon supported.

so i copy that static neon library replace default libffmpeg and
created a Android.mk like
=====================================
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libavcodec
LOCAL_SRC_FILES := libavcodec.a
include $(PREBUILT_STATIC_LIBRARY)
=====================================
with the default configure also follows havlenapetr's project.
but it errors with follows "undefined reference to...".

BTW, i am using NDK r5b now and ffmpeg version 0.6.3.
anyway can compile with havlenapetr's project directly or how to fix
the errors above?

thanks.

On 9月9日, 上午5时17分, Zoran Angelov <bald...@gmail.com> wrote:
> BTW which version of ndk you were using ?
>
> 2011/9/8 Zoran Angelov <bald...@gmail.com>
>
>
>
>
>
>
>
> > Hi,
> > i tried and successfully build the ffmpeg with neon support.
> > I had to add "--enable-memalign-hack" in order build to succeed.
> > Also note that i was using ndk-r6b (latest) under cygwin ( make=3.81 ).
> > I'm attaching my build.sh that will only build ffmpeg with neon ( ... for
> > version in neon; do ... ).
> > Lately with newer ndk's i'm experiencing difficulties with path under
> > cygwin, so i had to modify configure script to adjust temporary directory
> > with cygpath, also attached.
>
> > Try with my build.sh first, and use my configure script only if you
> > experience similar difficulties under cygwin (because it fixes $TMPDIR only
> > with cygpath ).
>
> > 2011/9/8 smallrui <ismall...@gmail.com>
> >> > You can try with this onehttp://bambuser.com/opensourcebutyou need to

Zoran Angelov

unread,
Sep 14, 2011, 3:00:54 AM9/14/11
to andro...@googlegroups.com
You need to link against all static libraries that your code depends on directly and libraries that ffmpeg libraries depends on.

So you should hava something like this ( Android.mk ):

LOCAL_PATH := $(call my-dir)

FFMPEG_DIR := <your ffmpeg dir>

ifeq ($(TARGET_ARCH_ABI), armeabi)
FFMPEG_DIR := $(FFMPEG_DIR)/armeabi
else
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
FFMPEG_DIR := $(FFMPEG_DIR)/armeabi-v7a
endif
endif

#ifeq ($(HOST_OS), windows)
# FFMPEG_DIR := $(shell cygpath -m $(FFMPEG_DIR))
#endif


include $(CLEAR_VARS)
LOCAL_MODULE := libavcodec
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/$(FFMPEG_DIR)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libavcore
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/$(FFMPEG_DIR)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libavdevice
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/$(FFMPEG_DIR)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libavfilter
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/$(FFMPEG_DIR)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libavformat
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/$(FFMPEG_DIR)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libavutil
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/$(FFMPEG_DIR)/include
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libswscale
LOCAL_SRC_FILES := $(FFMPEG_DIR)/lib/$(LOCAL_MODULE).a
LOCAL_EXPORT_C_INCLUDES := $(FFMPEG_DIR)/include
include $(PREBUILT_STATIC_LIBRARY)


# yours module definition :
include $(CLEAR_VARS)
....
LOCAL_LDFLAGS     :=  -llog -lz -ldl
LOCAL_STATIC_LIBRARIES := libavformat libavcodec libswscale libavcore libavutil
....




2011/9/13 Smallrui <isma...@gmail.com>

smallrui

unread,
Sep 22, 2011, 4:32:01 AM9/22/11
to android-ndk
hi, i have do other trouble things these days, but i still have the
trouble in ffmpeg neon or vfp support.
when i add a flag to Android.mk with "LOCAL_ARM_MODE := arm"
it can be build ok!!!, but it shows the same errors like

SharedLibrary : libffmpeg_jni.so
E:/android-ndk-r5c/havlenapetr/obj/local/armeabi-v7a/
libavcodec.a(dcadsp.o): In
function `ff_dcadsp_init':
E:/android-ndk-r5c/havlenapetr/jni/libffmpeg/libavcodec/dcadsp.c:50:
undefined r
eference to `ff_dcadsp_init_arm'
E:/android-ndk-r5c/havlenapetr/obj/local/armeabi-v7a/
libavcodec.a(dsputil.o): In
function `dsputil_init':
E:/android-ndk-r5c/havlenapetr/jni/libffmpeg/libavcodec/dsputil.c:
4521: undefine
d reference to `dsputil_init_arm'
E:/android-ndk-r5c/havlenapetr/obj/local/armeabi-v7a/
libavcodec.a(fft.o): In fun
ction `ff_fft_init':
E:/android-ndk-r5c/havlenapetr/jni/libffmpeg/libavcodec/fft.c:113:
undefined ref
erence to `ff_fft_init_arm'
E:/android-ndk-r5c/havlenapetr/obj/local/armeabi-v7a/
libavcodec.a(h264dsp.o): In
function `ff_h264dsp_init':
E:/android-ndk-r5c/havlenapetr/jni/libffmpeg/libavcodec/h264dsp.c:317:
undefined
reference to `ff_h264dsp_init_arm'
E:/android-ndk-r5c/havlenapetr/obj/local/armeabi-v7a/
libavcodec.a(h264pred.o): I
n function `ff_h264_pred_init':
E:/android-ndk-r5c/havlenapetr/jni/libffmpeg/libavcodec/h264pred.c:
1176: undefin
ed reference to `ff_h264_pred_init_arm'
E:/android-ndk-r5c/havlenapetr/obj/local/armeabi-v7a/
libavcodec.a(mpegvideo.o):
In function `ff_dct_common_init':
E:/android-ndk-r5c/havlenapetr/jni/libffmpeg/libavcodec/mpegvideo.c:
174: undefin
ed reference to `MPV_common_init_arm'



i saw that in "libffmpeg/libavcodec/arm" folder
the makefile says

OBJS-$(CONFIG_H264DSP) += arm/
h264dsp_init_arm.o \
arm/
h264pred_init_arm.o \

i have already defined the CONFIG_H264DSP macro both in config.h and
config.mak
but their also have undefined reference......
BTW, i found their is nothing .o file in the arm folders.

who to build such like"h264dsp_neon.S"files that can be linked by
ffmpeg?

my apology, but really need your help, thanks.
> 2011/9/13 Smallrui <ismall...@gmail.com>

smallrui

unread,
Sep 22, 2011, 5:45:45 AM9/22/11
to android-ndk

smallrui

unread,
Sep 26, 2011, 3:30:43 AM9/26/11
to android-ndk
anybody can help me?thanks
> ...
>
> 阅读更多 >>
Reply all
Reply to author
Forward
0 new messages