Crash in ffmpeg compiled for neon.

546 views
Skip to first unread message

B.Arunkumar

unread,
Jul 13, 2012, 2:36:15 AM7/13/12
to android-ndk, aswinp...@omeonsolutions.com, ra...@omeonsolutions.com
Hi,

We compiled ffmpeg for neon as per the link:

http://www.roman10.net/how-to-build-ffmpeg-for-android/

We see a crash at avcodec_decode_video2 in our wrapper class.

We modified the compile script build_android.sh according to the
suggestions given in Android Developer forums:

http://groups.google.com/group/android-developers/browse_frm/thread/6c961b827ab493dc.
And this is build_android.sd that we are using now. But we are still
seeing the crash.

PREBUILT=/home/arun/android/android-ndk-r6b/toolchains/arm-linux-
androideabi-4.4.3/prebuilt/linux-x86
PLATFORM=/home/arun/android/android-ndk-r6b/platforms/android-9/arch-
arm

CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -
mtune=cortex-a8"
PREFIX=./android/$CPU
ADDITIONAL_CONFIGURE_FLAG=--enable-neon

./configure --target-os=linux \
--prefix=$PREFIX \
--enable-cross-compile \
--extra-libs="-lgcc" \
--arch=arm \
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
--sysroot=$PLATFORM \
--extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -
Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -
fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
--disable-shared \
--enable-static \
--extra-ldflags="-Wl,-malign-double -rpath-link=$PLATFORM/usr/lib
-
L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
--disable-everything \
--enable-demuxer=h264 \
--disable-ffplay \
--enable-protocol=file \
--enable-avformat \
--enable-avcodec \
--enable-decoder=rawvideo \
--enable-decoder=mjpeg \
--enable-decoder=h263 \
--enable-decoder=mpeg4 \
--enable-decoder=h264 \
--enable-parser=h264 \
--disable-network \
--enable-zlib \
--disable-avfilter \
--disable-avdevice \
$ADDITIONAL_CONFIGURE_FLAG

make clean
make -j4 install
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a
inverse.o
$PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -
L
$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -
z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/
libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a
libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog
--warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/
arm-
linux-androideabi/4.4.3/libgcc.a

And the Android.mk is as follows:

LOCAL_PATH := $(call my-dir)

FFMPEG:= /home/arun/ffmpegneon1103/android/armv7-a/lib

include $(CLEAR_VARS)

LOCAL_MODULE := OnVRView
LOCAL_SRC_FILES := OnVRView.cpp

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_CFLAGS := -DHAVE_NEON=1
LOCAL_MODULE := OnVRView
LOCAL_SRC_FILES += VideoDecoder.cpp.neon
LOCAL_ARM_NEON := true
endif

LOCAL_C_INCLUDES := /home/arun/ffmpegneon1103/android/armv7-a/include

LOCAL_ARM_MODE := arm

LOCAL_STATIC_LIBRARIES := cpufeatures

LOCAL_LDLIBS := -llog -L$(FFMPEG) -lswresample -lavformat -
lavcodec -lswscale -lavutil -Werror

include $(BUILD_SHARED_LIBRARY)

$(call import-module,cpufeatures)

This requires any changes?

Thank you,
B.Arunkumar.

step_jac

unread,
Aug 27, 2012, 5:37:20 PM8/27/12
to andro...@googlegroups.com, aswinp...@omeonsolutions.com, ra...@omeonsolutions.com
Hi kefrens,

I'm on NDK r8, Cygwin.

Best,

Stephane

On Friday, 24 August 2012 04:55:27 UTC-7, kefrens wrote:
hi!
 
which version of the sdk are you using?
do you compile this under ubuntu or cygwin?
 
regards,

On Tuesday, July 31, 2012 10:12:00 PM UTC+2, step_jac wrote:
Hi B.Arunkumar,

Is the crash you are seeing a SIGILL (Illegal Instruction)? If so, you are probably running on a device that has 16 d NEON registers but the runtime is trying to access beyond those bounds. If that is the case, add -mfpu=vfpv3-d16 to your compile flags.

Best,

Stephane Jacoby

B.Arunkumar

unread,
Aug 28, 2012, 5:24:01 AM8/28/12
to android-ndk
Hi,

Thank you for your mail. We will try it out and get back to you. By
the way, ffmpeg compilation as per given in this link:

http://abitno.me/compile-ffmpeg-android-ndk

works fine without crashing. That has a flag enable-neon in the script
too. But the library files get generated under armeabi folder rather
than armv7-a folder when compiled as per this link:

http://www.roman10.net/how-to-build-ffmpeg-for-android/

I just wonder if the abitno link compiles ffmpeg for neon or non-neon
mode?

Thank you,
B.Arunkumar.

On Aug 1, 1:12 am, step_jac <stephane.jac...@gmail.com> wrote:
> Hi B.Arunkumar,
>
> Is the crash you are seeing a SIGILL (Illegal Instruction)? If so, you are
> probably running on a device that has 16 d NEON registers but the runtime
> is trying to access beyond those bounds. If that is the case, add -mfpu=vfpv3-d16
> to your compile flags.
>
> Best,
>
> Stephane Jacoby*
> *
>
>
>
>
>
>
>
> On Thursday, 12 July 2012 23:36:15 UTC-7, B.Arunkumar wrote:
>
> > Hi,
>
> > We compiled ffmpeg for neon as per the link:
>
> >http://www.roman10.net/how-to-build-ffmpeg-for-android/
>
> > We see a crash at avcodec_decode_video2 in our wrapper class.
>
> > We modified the compile script build_android.sh according to the
> > suggestions given in Android Developer forums:
>
> >http://groups.google.com/group/android-developers/browse_frm/thread/6....
Reply all
Reply to author
Forward
0 new messages