Update x264 and enable it on x86.

This commit is contained in:
Ghislain MARY 2013-09-26 16:49:03 +02:00
parent 45de6a529e
commit 0bd31a01df
6 changed files with 50 additions and 77 deletions

View file

@ -106,6 +106,43 @@ clean-ffmpeg:
rm -rf $(FFMPEG_BUILD_DIR)/arm && \
rm -rf $(FFMPEG_BUILD_DIR)/x86
#x264
ifeq ($(BUILD_X264), 1)
BUILD_X264_DEPS=$(X264_BUILD_DIR)/arm/libx264.a
ifeq ($(BUILD_FOR_X86), 1)
BUILD_X264_DEPS+=$(X264_BUILD_DIR)/x86/libx264.a
endif
X264_SRC_DIR=$(TOPDIR)/submodules/externals/x264
X264_BUILD_DIR=$(TOPDIR)/submodules/externals/build/x264
X264_CONFIGURE_OPTIONS=--disable-shared
X264_ARM_CONFIGURE_OPTIONS=--host=arm-none-linux-gnueabi --sysroot=$(NDK_PATH)/platforms/android-18/arch-arm --cross-prefix=$(NDK_PATH)/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --enable-pic
X264_X86_CONFIGURE_OPTIONS=--host=i686-linux-gnueabi --sysroot=$(NDK_PATH)/platforms/android-18/arch-x86 --cross-prefix=$(NDK_PATH)/toolchains/x86-4.6/prebuilt/linux-x86_64/bin/i686-linux-android-
$(X264_BUILD_DIR)/arm/libx264.a:
mkdir -p $(X264_BUILD_DIR)/arm && \
cd $(X264_SRC_DIR) && \
$(X264_SRC_DIR)/configure $(X264_CONFIGURE_OPTIONS) $(X264_ARM_CONFIGURE_OPTIONS) && \
make -j $(NUMCPUS) && \
cp libx264.a $(X264_BUILD_DIR)/arm/libx264.a && \
make clean \
|| ( echo "Build of x264 for arm failed." ; exit 1 )
$(X264_BUILD_DIR)/x86/libx264.a:
mkdir -p $(X264_BUILD_DIR)/x86 && \
cd $(X264_SRC_DIR) && \
$(X264_SRC_DIR)/configure $(X264_CONFIGURE_OPTIONS) $(X264_X86_CONFIGURE_OPTIONS) && \
make -j $(NUMCPUS) && \
cp libx264.a $(X264_BUILD_DIR)/x86/libx264.a && \
make clean \
|| ( echo "Build of x264 for x86 failed." ; exit 1 )
endif
build-x264: $(BUILD_X264_DEPS)
clean-x264:
rm -rf $(X264_BUILD_DIR)/arm && \
rm -rf $(X264_BUILD_DIR)/x86
#libvpx
BUILD_VPX_DEPS=$(LIBVPX_BUILD_DIR)/arm/libvpx.a
ifeq ($(BUILD_FOR_X86), 1)
@ -116,15 +153,15 @@ LIBVPX_BUILD_DIR=$(TOPDIR)/submodules/externals/build/libvpx
LIBVPX_CONFIGURE_OPTIONS=--disable-vp9 --disable-examples --disable-unit-tests --disable-postproc --enable-error-concealment
$(LIBVPX_BUILD_DIR)/arm/libvpx.a:
mkdir -p submodules/externals/build/libvpx/arm && \
cd submodules/externals/build/libvpx/arm && \
mkdir -p $(LIBVPX_BUILD_DIR)/arm && \
cd $(LIBVPX_BUILD_DIR)/arm && \
$(LIBVPX_SRC_DIR)/configure --target=armv7-android-gcc --sdk-path=$(NDK_PATH) $(LIBVPX_CONFIGURE_OPTIONS) && \
make -j ${NUMCPUS} \
|| ( echo "Build of libvpx for arm failed." ; exit 1 )
$(LIBVPX_BUILD_DIR)/x86/libvpx.a:
mkdir -p submodules/externals/build/libvpx/x86 && \
cd submodules/externals/build/libvpx/x86 && \
mkdir -p $(LIBVPX_BUILD_DIR)/x86 && \
cd $(LIBVPX_BUILD_DIR)/x86 && \
$(LIBVPX_SRC_DIR)/configure --target=x86-android-gcc --sdk-path=$(NDK_PATH) $(LIBVPX_CONFIGURE_OPTIONS) --extra-cflags="--sysroot=$(NDK_PATH)/platforms/android-18/arch-x86" && \
make -j${NUMCPUS} \
|| ( echo "Build of libvpx for x86 failed." ; exit 1 )
@ -220,7 +257,7 @@ $(SQLITE_BASENAME).zip:
curl -sO $(SQLITE_URL)
#Build targets
prepare-sources: build-ffmpeg prepare-ilbc build-vpx prepare-silk prepare-srtp prepare-mediastreamer2 prepare-antlr3 prepare-belle-sip $(TOPDIR)/res/raw/rootca.pem prepare-sqlite3
prepare-sources: build-ffmpeg build-x264 prepare-ilbc build-vpx prepare-silk prepare-srtp prepare-mediastreamer2 prepare-antlr3 prepare-belle-sip $(TOPDIR)/res/raw/rootca.pem prepare-sqlite3
LIBLINPHONE_OPTIONS = NDK_DEBUG=$(NDK_DEBUG) LINPHONE_VERSION=$(LINPHONE_VERSION) BUILD_UPNP=$(BUILD_UPNP) BUILD_REMOTE_PROVISIONING=$(BUILD_REMOTE_PROVISIONING) BUILD_X264=$(BUILD_X264) \
BUILD_AMRNB=$(BUILD_AMRNB) BUILD_AMRWB=$(BUILD_AMRWB) BUILD_GPLV3_ZRTP=$(BUILD_GPLV3_ZRTP) BUILD_SILK=$(BUILD_SILK) BUILD_G729=$(BUILD_G729) BUILD_TUNNEL=$(BUILD_TUNNEL) \
@ -275,7 +312,7 @@ clean-ndk-build:
clean: clean-ndk-build
veryclean: clean clean-ffmpeg clean-vpx
veryclean: clean clean-ffmpeg clean-x264 clean-vpx
.PHONY: clean

View file

@ -4,15 +4,9 @@ include $(linphone-root-dir)/submodules/linphone/mediastreamer2/src/android/libn
#enable video on armv7 and x86 targets only
ifeq ($(TARGET_ARCH_ABI), armeabi)
_BUILD_X264=0
_BUILD_VIDEO=0
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
_BUILD_X264=1
_BUILD_VIDEO=1
endif
ifeq ($(TARGET_ARCH_ABI),x86)
_BUILD_X264=1
_BUILD_VIDEO=1
endif
ifeq ($(_BUILD_VIDEO),0)
ifeq (,$(DUMP_VAR))

View file

@ -20,10 +20,6 @@ ifeq ($(BUILD_X264),)
BUILD_X264=0
endif
ifeq ($(BUILD_X264),)
BUILD_X264=0
endif
ifeq ($(BUILD_G729),)
BUILD_G729=0
endif

View file

@ -178,10 +178,10 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
prefMPEG4.setSummary(R.string.pref_video_codec_mpeg4_unavailable);
} else {
detectVideoCodec(R.string.pref_video_codec_h264_key, "H264");
if (!Version.hasNeon())
if (!Version.hasFastCpuWithAsmOptim())
{
// Android without neon doesn't support H264
Log.w("No NEON available, disabling H264");
Log.w("CPU does not have asm optimisations available, disabling H264");
findPreference(R.string.pref_video_codec_h264_key).setEnabled(false);
findPreference(R.string.pref_video_codec_h264_key).setDefaultValue(false);
}

View file

@ -1,61 +1,7 @@
#
# List of compiled files and related options obtained using
# ./configure --cross-prefix=arm-none-linux-gnueabi- --host=arm-none-linux-gnueabi --disable-pthread --enable-pic
# && make
#
LOCAL_PATH:= $(call my-dir)/../../x264
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libx264
LOCAL_SRC_FILES := $(TARGET_ARCH)/libx264.a
LOCAL_SRC_FILES = \
common/mc.c \
common/predict.c \
common/pixel.c \
common/macroblock.c \
common/frame.c \
common/dct.c \
common/cpu.c \
common/cabac.c \
common/common.c \
common/mdate.c \
common/rectangle.c \
common/set.c \
common/quant.c \
common/deblock.c \
common/vlc.c \
common/mvpred.c \
common/bitstream.c \
encoder/analyse.c \
encoder/me.c \
encoder/ratecontrol.c \
encoder/set.c \
encoder/macroblock.c \
encoder/cabac.c \
encoder/cavlc.c \
encoder/encoder.c \
encoder/lookahead.c \
common/arm/mc-c.c \
common/arm/predict-c.c \
common/arm/cpu-a.S \
common/arm/pixel-a.S \
common/arm/mc-a.S \
common/arm/dct-a.S \
common/arm/quant-a.S \
common/arm/deblock-a.S \
common/arm/predict-a.S
LOCAL_ARM_MODE := arm
LOCAL_CFLAGS += -DPIC -DBIT_DEPTH=8 -std=gnu99
#for including config.h:
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/../build/x264 \
$(LOCAL_PATH)/
include $(BUILD_STATIC_LIBRARY)
include $(PREBUILT_STATIC_LIBRARY)

@ -1 +1 @@
Subproject commit e89c4cfc9f37d0b7684507974b333545b5bcc37a
Subproject commit 3361d59a0a83dcb8b321cc0eb8e6ba68ca49c7d4