带有 Neon 优化的 FFMPEG
我正在使用 ffmpeg 在 Android 上解码 h.264 视频文件。性能非常低。我想在 ffmpeg 中启用 neon 优化以提高性能。尽管在配置文件中添加了 neon 相关命令,但我没有看到性能提升。有人可以告诉我我是否在任何地方出错了?我的配置文件如下所示。
function build_one_r6
{
make clean
./configure \
--prefix=$PREFIX \
--disable-shared \
--enable-static \
--enable-version3 \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-avfilter \
--disable-postproc \
--enable-small \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--enable-cross-compile \
--target-os=linux \
--extra-cflags="-I$PLATFORM/usr/include -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing $OPTIMIZE_CFLAGS" \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
--arch=arm \
--disable-symver \
--disable-debug \
--disable-indevs \
--disable-encoders \
--disable-bsfs \
--disable-filters \
$ADDITIONAL_CONFIGURE_FLAG || exit 1;
sed -i 's/HAVE_LRINT 0/HAVE_LRINT 1/g' config.h
sed -i 's/HAVE_LRINTF 0/HAVE_LRINTF 1/g' config.h
sed -i 's/HAVE_ROUND 0/HAVE_ROUND 1/g' config.h
sed -i 's/HAVE_ROUNDF 0/HAVE_ROUNDF 1/g' config.h
sed -i 's/HAVE_TRUNC 0/HAVE_TRUNC 1/g' config.h
sed -i 's/HAVE_TRUNCF 0/HAVE_TRUNCF 1/g' config.h
make -j4 install || exit 1;
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o || exit 1;
$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/lib/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 || exit 1;
}
#armv5te
CPU=armv5te
OPTIMIZE_CFLAGS="-marm -march=$CPU "
PREFIX=../../build/android/armeabi
ADDITIONAL_CONFIGURE_FLAG=
build_one_r6
#arm v7n
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8"
PREFIX=../../build/android/armeabi-v7a
ADDITIONAL_CONFIGURE_FLAG="--enable-neon --disable-armv5te --disable-armv6 --disable-armv6t2"
build_one_r6enter code here
I am decoding an h.264 video file on android using ffmpeg. The performace is very low. I would like to enable neon optimzation in ffmpeg to improve the performace. Inspite of adding the neon related commands in the config file, I don't see performance gain. Can someone tell me if I am going wrong anywhere? My config file is as given below.
function build_one_r6
{
make clean
./configure \
--prefix=$PREFIX \
--disable-shared \
--enable-static \
--enable-version3 \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-avfilter \
--disable-postproc \
--enable-small \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--enable-cross-compile \
--target-os=linux \
--extra-cflags="-I$PLATFORM/usr/include -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing $OPTIMIZE_CFLAGS" \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
--arch=arm \
--disable-symver \
--disable-debug \
--disable-indevs \
--disable-encoders \
--disable-bsfs \
--disable-filters \
$ADDITIONAL_CONFIGURE_FLAG || exit 1;
sed -i 's/HAVE_LRINT 0/HAVE_LRINT 1/g' config.h
sed -i 's/HAVE_LRINTF 0/HAVE_LRINTF 1/g' config.h
sed -i 's/HAVE_ROUND 0/HAVE_ROUND 1/g' config.h
sed -i 's/HAVE_ROUNDF 0/HAVE_ROUNDF 1/g' config.h
sed -i 's/HAVE_TRUNC 0/HAVE_TRUNC 1/g' config.h
sed -i 's/HAVE_TRUNCF 0/HAVE_TRUNCF 1/g' config.h
make -j4 install || exit 1;
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o || exit 1;
$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/lib/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 || exit 1;
}
#armv5te
CPU=armv5te
OPTIMIZE_CFLAGS="-marm -march=$CPU "
PREFIX=../../build/android/armeabi
ADDITIONAL_CONFIGURE_FLAG=
build_one_r6
#arm v7n
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8"
PREFIX=../../build/android/armeabi-v7a
ADDITIONAL_CONFIGURE_FLAG="--enable-neon --disable-armv5te --disable-armv6 --disable-armv6t2"
build_one_r6enter code here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经使用位于此处的脚本为 android 编译了 ffmpeg-0.10:tools/build_libstagefright.sh。如果你不需要 libStagefright(对我来说它仍然不起作用),最好删除启动 android 库和标头下载以及 android 选项。它具有适用于 NEON 的正确工作选项。我总结的构建选项:
I have compiled ffmpeg-0.10 for android using its script situated here: tools/build_libstagefright.sh. If you dont need libStagefright (as for me its still not working) it`s better to delete start android libs and headers download and android options. It has properly working options for NEON. My summary build options: