Commit 98454ed2 authored by Arun Raghavan's avatar Arun Raghavan
Browse files

build: Add architecture checks for x86 and ARM

On x86, SSE optimisations are always compiled in, and used based on
runtime checks.

On ARM, we try to autodetect NEON support (with an option of runtime
detection). This has not been build-tested on ARM yet.

This leaves MIPS to be done.
parent f6941fbf
......@@ -7,10 +7,14 @@ AC_SUBST(LIBWEBRTC_AUDIO_PROCESSING_VERSION_INFO, [0:0:0])
AM_SILENT_RULES([yes])
# Set up the host_* variables
AC_CANONICAL_HOST
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AM_PROG_AS
AC_LANG_C
AC_LANG_CPLUSPLUS
......@@ -53,8 +57,51 @@ AS_CASE(["${host}"],
)
AC_SUBST(PLATFORM_CFLAGS)
COMMON_CFLAGS="-DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD ${PLATFORM_CFLAGS} ${OS_CFLAGS} -DNDEBUG -I\$(top_srcdir)"
COMMON_CXXFLAGS="-std=c++11 -DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD ${PLATFORM_CFLAGS} ${OS_CFLAGS} -DNDEBUG -I\$(top_srcdir)"
AS_CASE(["${host_cpu}"],
[i?86|x86_64],
[
HAVE_X86=1
],
[armv7*|armv8*],
[
HAVE_ARM=1
HAVE_ARMV7=1
],
[arm*],
[
HAVE_ARM=1
]
# FIXME: Add MIPS support, see webrtc/BUILD.gn for defines
)
AM_CONDITIONAL(HAVE_X86, [test "x${HAVE_X86}" = "x1"])
AM_CONDITIONAL(HAVE_ARM, [test "x${HAVE_ARM}" = "x1"])
AM_CONDITIONAL(HAVE_ARMV7, [test "x${HAVE_ARMV7}" = "x1"])
# Borrowed from pulseaudio's configure.ac
AC_ARG_ENABLE([neon],
AS_HELP_STRING([--enable-neon], [Enable NEON optimisations on ARM CPUs that support it (yes|no|auto|runtime)]))
AS_IF([test "x$enable_neon" != "xno"],
AS_IF([test "x$enable_neon" != "xruntime"],
[
save_CFLAGS="$CFLAGS"; CFLAGS="-mfpu=neon $CFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <arm_neon.h>]], [])],
[
HAVE_NEON=1
ARCH_CFLAGS="-mfpu=neon"
])
CFLAGS="$save_CFLAGS"
],
[
HAVE_NEON=1
ARCH_CFLAGS="-mfpu=neon -DWEBRTC_DETECT_NEON"
])
)
AM_CONDITIONAL([HAVE_NEON], [test "x$HAVE_NEON" = "x1"])
COMMON_CFLAGS="-DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD ${PLATFORM_CFLAGS} ${OS_CFLAGS} ${ARCH_CFLAGS} -DNDEBUG -I\$(top_srcdir)"
COMMON_CXXFLAGS="-std=c++11 -DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD ${PLATFORM_CFLAGS} ${OS_CFLAGS} ${ARCH_CFLAGS} -DNDEBUG -I\$(top_srcdir)"
AC_SUBST([COMMON_CFLAGS])
AC_SUBST([COMMON_CXXFLAGS])
......
......@@ -11,7 +11,6 @@ libcommon_audio_la_SOURCES = resampler/include/push_resampler.h \
resampler/push_sinc_resampler.cc \
resampler/resampler.cc \
resampler/sinc_resampler.cc \
resampler/sinc_resampler_sse.cc \
resampler/sinusoidal_linear_chirp_source.cc \
signal_processing/include/real_fft.h \
signal_processing/include/signal_processing_library.h \
......@@ -78,8 +77,6 @@ libcommon_audio_la_SOURCES = resampler/include/push_resampler.h \
fft4g.h \
fir_filter.cc \
fir_filter.h \
fir_filter_sse.cc \
fir_filter_sse.h \
lapped_transform.cc \
lapped_transform.h \
real_fourier.cc \
......@@ -98,28 +95,46 @@ libcommon_audio_la_SOURCES = resampler/include/push_resampler.h \
window_generator.h \
window_generator.cc
if HAVE_X86
libcommon_audio_la_SOURCES += \
resampler/sinc_resampler_sse.cc \
fir_filter_sse.cc \
fir_filter_sse.h
endif
if HAVE_ARM
libcommon_audio_la_SOURCES += \
signal_processing/complex_bit_reverse_arm.S \
signal_processing/spl_sqrt_floor_arm.S
endif
if HAVE_ARMV7
libcommon_audio_la_SOURCES += \
signal_processing/filter_ar_fast_q12_armv7.S
endif
if HAVE_NEON
libcommon_audio_la_SOURCES += \
resampler/sinc_resampler_neon.cc \
signal_processing/cross_correlation_neon.c \
signal_processing/downsample_fast_neon.c \
signal_processing/min_max_operations_neon.c \
fir_filter_neon.cc \
fir_filter_neon.h
endif
libcommon_audio_la_CFLAGS = $(AM_CFLAGS) $(COMMON_CFLAGS)
libcommon_audio_la_CXXFLAGS = $(AM_CXXFLAGS) $(COMMON_CXXFLAGS)
EXTRA_DIST = BUILD.gn
# FIXME:
# x86 - resampler/sinc_resampler_sse.cc
# fir_filter_sse.cc
# ARM - signal_processing/complex_bit_reverse_arm.S
# signal_processing/spl_sqrt_floor_arm.S
# ARM7 - signal_processing/filter_ar_fast_q12_armv7.S
# NEON - resampler/sinc_resampler_neon.cc \
# signal_processing/cross_correlation_neon.c
# signal_processing/downsample_fast_neon.c
# signal_processing/min_max_operations_neon.c
# fir_filter_neon.c
# MIPS - signal_processing/complex_bit_reverse_mips.c
# signal_processing/complex_fft_mips.c
# signal_processing/cross_correlation_mips.c
# signal_processing/downsample_fast_mips.c
# signal_processing/filter_ar_fast_q12_mips.c
# signal_processing/min_max_operations_mips.c
# signal_processing/resample_by_2_mips.c
# signal_processing/spl_sqrt_floor_mips.c
# signal_processing/vector_scaling_operations_mips.c
# FIXME: The MIPS optimisations need to be hooked up once we have the
# autotools conditionals in place
EXTRA_DIST = BUILD.gn \
signal_processing/complex_bit_reverse_mips.c \
signal_processing/complex_fft_mips.c \
signal_processing/cross_correlation_mips.c \
signal_processing/downsample_fast_mips.c \
signal_processing/filter_ar_fast_q12_mips.c \
signal_processing/min_max_operations_mips.c \
signal_processing/resample_by_2_mips.c \
signal_processing/spl_sqrt_floor_mips.c \
signal_processing/vector_scaling_operations_mips.c
......@@ -6,10 +6,8 @@ libwebrtc_audio_processing_la_SOURCES = include/audio_processing.h \
aec/aec_core.c \
aec/aec_core.h \
aec/aec_core_internal.h \
aec/aec_core_sse2.c \
aec/aec_rdft.c \
aec/aec_rdft.h \
aec/aec_rdft_sse2.c \
aec/aec_resampler.c \
aec/aec_resampler.h \
aec/echo_cancellation.c \
......@@ -130,6 +128,10 @@ libwebrtc_audio_processing_la_SOURCES += \
ns/nsx_core.c \
ns/nsx_core.h \
ns/nsx_core_c.c
if HAVE_NEON
libwebrtc_audio_processing_la_SOURCES += \
ns/nsx_core_neon.c
endif
else
COMMON_CFLAGS += -DWEBRTC_NS_FLOAT=1
COMMON_CXXFLAGS += -DWEBRTC_NS_FLOAT=1
......@@ -142,6 +144,19 @@ libwebrtc_audio_processing_la_SOURCES += \
ns/windows_private.h
endif
if HAVE_X86
libwebrtc_audio_processing_la_SOURCES += \
aec/aec_core_sse2.c \
aec/aec_rdft_sse2.c
endif
if HAVE_NEON
libwebrtc_audio_processing_la_SOURCES += \
aec/aec_core_neon.c \
aec/aec_rdft_neon.c \
aecm/aecm_core_neon.c
endif
libwebrtc_audio_processing_la_CFLAGS = $(AM_CFLAGS) $(COMMON_CFLAGS)
libwebrtc_audio_processing_la_CXXFLAGS = $(AM_CXXFLAGS) $(COMMON_CXXFLAGS)
......@@ -152,16 +167,10 @@ libwebrtc_audio_processing_la_LIBADD = $(top_builddir)/webrtc/libwebrtc.la \
$(top_builddir)/webrtc/modules/audio_coding/libaudio_coding.la
libwebrtc_audio_processing_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBWEBRTC_AUDIO_PROCESSING_VERSION_INFO)
EXTRA_DIST = BUILD.gn
# FIXME:
# x86: aec/aec_core_sse2.c
# aec/aec_rdft_sse2.c
# NEON: aec/aec_core_neon.c
# aec/aec_rdft_neon.c
# aecm/aecm_core_neon.c
# ns/nsx_core_neon.c
# MIPS: aec/aec_core_mips.c
# aec/aec_rdft_neon.c
# aecm/aecm_core_mips.c
# ns/nsx_core_mips.c
# FIXME: The MIPS optimisations need to be hooked up once we have the
# autotools conditionals in place
EXTRA_DIST = BUILD.gn \
aec/aec_core_mips.c \
aec/aec_rdft_neon.c \
aecm/aecm_core_mips.c \
ns/nsx_core_mips.c
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment