Skip to content

Commit

Permalink
GN: Implement voice engine, common audio, audio coding and audio proc…
Browse files Browse the repository at this point in the history
…essing

NOTICE: Assembly offsets generation for audio processing will
not be ported to GN and the process of removing them is tracked
in https://code.google.com/p/webrtc/issues/detail?id=3580.

The GN files are based upon the GYP files as of r7009.

BUG=3441
TESTED=Passing builds with:
gn gen out/Default --args="build_with_chromium=false" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false is_debug=true" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false aec_debug_dump=true" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false aec_untrusted_delay_for_testing=true" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false prefer_fixed_point=true" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false os=\"android\" cpu_arch=\"arm\" is_clang=false" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false os=\"android\" cpu_arch=\"arm\" arm_version=7 is_clang=false" && ninja -C out/Default

I don't know how to setup the mips toolchain to test the following, but it's out of scope for the GN effort for now:
gn gen out/Default --args="build_with_chromium=false cpu_arch=\"mipsel\" mips_dsp_rev=0" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false cpu_arch=\"mipsel\" mips_dsp_rev=1" && ninja -C out/Default
gn gen out/Default --args="build_with_chromium=false cpu_arch=\"mipsel\" mips_dsp_rev=2" && ninja -C out/Default

Compilation of Chromium's 'all' target with src/third_party/webrtc
symlinked to the WebRTC checkout with this CL applied, both
with the default GN settings and using
--args="is_debug=false os=\"android\" cpu_arch=\"arm\""

R=andrew@webrtc.org, brettw@chromium.org

Review URL: https://webrtc-codereview.appspot.com/15999004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7012 4adac7df-926f-26a2-2b94-8c16560cd09d
  • Loading branch information
kjellander@webrtc.org committed Aug 31, 2014
1 parent 1b9a188 commit 524b8f7
Show file tree
Hide file tree
Showing 8 changed files with 1,190 additions and 10 deletions.
18 changes: 15 additions & 3 deletions webrtc/build/webrtc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.

import("//build/config/arm.gni")

declare_args() {
# Assume Chromium build for now, since that's the priority case for getting GN
# up and running with WebRTC.
build_with_chromium = true
build_with_libjingle = true

# Disable this to avoid building the Opus audio codec.
include_opus = true

# Adds video support to dependencies shared by voice and video engine.
# This should normally be enabled; the intended use is to disable only
# when building voice engine exclusively.
enable_video = true

# Disable this to not build libvpx and instead use an externally provided lib.
build_libvpx = true

# Selects fixed-point code where possible.
prefer_fixed_point = false

Expand Down Expand Up @@ -51,6 +53,11 @@ declare_args() {

enable_android_opensl = true

# Link-Time Optimizations.
# Executes code generation at link-time instead of compile-time.
# https://gcc.gnu.org/wiki/LinkTimeOptimization
use_lto = false

if (build_with_chromium) {
# Exclude pulse audio on Chromium since its prerequisites don't require
# pulse audio.
Expand Down Expand Up @@ -94,4 +101,9 @@ declare_args() {
if (cpu_arch == "arm") {
prefer_fixed_point = true
}

# WebRTC builds ARM v7 Neon instruction set optimized code for both iOS and
# Android, which is why we currently cannot use the variables in
# //build/config/arm.gni (since it disables Neon for Android).
build_armv7_neon = (cpu_arch == "arm" && arm_version == 7)
}
197 changes: 193 additions & 4 deletions webrtc/common_audio/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,207 @@
import("//build/config/arm.gni")
import("../build/webrtc.gni")

config("common_audio_config") {
include_dirs = [
"resampler/include",
"signal_processing/include",
"vad/include",
]
}

source_set("common_audio") {
# TODO(andrew): Implement.
sources = [
"audio_util.cc",
"fir_filter.cc",
"fir_filter.h",
"fir_filter_neon.h",
"fir_filter_sse.h",
"include/audio_util.h",
"resampler/include/push_resampler.h",
"resampler/include/resampler.h",
"resampler/push_resampler.cc",
"resampler/push_sinc_resampler.cc",
"resampler/push_sinc_resampler.h",
"resampler/resampler.cc",
"resampler/sinc_resampler.cc",
"resampler/sinc_resampler.h",
"signal_processing/include/real_fft.h",
"signal_processing/include/signal_processing_library.h",
"signal_processing/include/spl_inl.h",
"signal_processing/auto_corr_to_refl_coef.c",
"signal_processing/auto_correlation.c",
"signal_processing/complex_fft_tables.h",
"signal_processing/copy_set_operations.c",
"signal_processing/cross_correlation.c",
"signal_processing/division_operations.c",
"signal_processing/dot_product_with_scale.c",
"signal_processing/downsample_fast.c",
"signal_processing/energy.c",
"signal_processing/filter_ar.c",
"signal_processing/filter_ma_fast_q12.c",
"signal_processing/get_hanning_window.c",
"signal_processing/get_scaling_square.c",
"signal_processing/ilbc_specific_functions.c",
"signal_processing/levinson_durbin.c",
"signal_processing/lpc_to_refl_coef.c",
"signal_processing/min_max_operations.c",
"signal_processing/randomization_functions.c",
"signal_processing/refl_coef_to_lpc.c",
"signal_processing/real_fft.c",
"signal_processing/resample.c",
"signal_processing/resample_48khz.c",
"signal_processing/resample_by_2.c",
"signal_processing/resample_by_2_internal.c",
"signal_processing/resample_by_2_internal.h",
"signal_processing/resample_fractional.c",
"signal_processing/spl_init.c",
"signal_processing/spl_sqrt.c",
"signal_processing/spl_version.c",
"signal_processing/splitting_filter.c",
"signal_processing/sqrt_of_one_minus_x_squared.c",
"signal_processing/vector_scaling_operations.c",
"vad/include/webrtc_vad.h",
"vad/webrtc_vad.c",
"vad/vad_core.c",
"vad/vad_core.h",
"vad/vad_filterbank.c",
"vad/vad_filterbank.h",
"vad/vad_gmm.c",
"vad/vad_gmm.h",
"vad/vad_sp.c",
"vad/vad_sp.h",
"wav_header.cc",
"wav_header.h",
"wav_writer.cc",
"wav_writer.h",
]

deps = [ "../system_wrappers" ]

if (cpu_arch == "arm") {
sources += [
"signal_processing/complex_bit_reverse_arm.S",
"signal_processing/spl_sqrt_floor_arm.S",
]

if (arm_version == 7) {
deps += [ ":common_audio_neon" ]
sources += [ "signal_processing/filter_ar_fast_q12_armv7.S" ]
} else {
sources += [ "signal_processing/filter_ar_fast_q12.c" ]
}
}

if (cpu_arch == "mipsel") {
sources += [
"signal_processing/include/spl_inl_mips.h",
"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",
]
if (mips_dsp_rev > 0) {
sources += [ "signal_processing/vector_scaling_operations_mips.c" ]
}
} else {
sources += [
"signal_processing/complex_fft.c",
"signal_processing/filter_ar_fast_q12.c",
]
}

if (cpu_arch != "arm" && cpu_arch != "mipsel") {
sources += [
"signal_processing/complex_bit_reverse.c",
"signal_processing/spl_sqrt_floor.c",
]
}

if (is_win) {
cflags += [
"/wd4334", # Ignore warning on shift operator promotion.
]
}

direct_dependent_configs = [
"..:common_inherited_config",
":common_audio_config",
]

if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
configs -= [ "//build/config/clang:find_bad_constructs" ]
}

if (cpu_arch == "x86" || cpu_arch == "x64") {
deps += [ ":common_audio_sse2" ]
}
}

if (cpu_arch == "x86" || cpu_arch == "x64") {
source_set("common_audio_sse2") {
# TODO(andrew): Implement.
sources = [
"fir_filter_sse.cc",
"resampler/sinc_resampler_sse.cc",
]

cflags = [ "-msse2" ]

configs += [ "..:common_inherited_config" ]

if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
configs -= [ "//build/config/clang:find_bad_constructs" ]
}
}
}

if (cpu_arch == "arm" && arm_version == 7) {
if (build_armv7_neon) {
source_set("common_audio_neon") {
# TODO(andrew): Implement.
sources = [
"fir_filter_neon.cc",
"resampler/sinc_resampler_neon.cc",
"signal_processing/cross_correlation_neon.S",
"signal_processing/downsample_fast_neon.S",
"signal_processing/min_max_operations_neon.S",
"signal_processing/vector_scaling_operations_neon.S",
]

configs += [
"..:common_config",
"..:common_inherited_config",
]

# Enable compilation for the ARM v7 Neon instruction set. This is needed
# since //build/config/arm.gni only enables Neon for iOS, not Android.
# This provides the same functionality as webrtc/build/arm_neon.gypi.
# TODO(kjellander): Investigate if this can be moved into webrtc.gni or
# //build/config/arm.gni instead, to reduce code duplication.
# Remove the -mfpu=vfpv3-d16 cflag.
configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
cflags = [
"-flax-vector-conversions",
"-mfpu=neon",
]

# Disable LTO in audio_processing_neon target due to compiler bug.
if (use_lto) {
cflags -= [
"-flto",
"-ffat-lto-objects",
]
}

if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
configs -= [ "//build/config/clang:find_bad_constructs" ]
}
}
}
Loading

0 comments on commit 524b8f7

Please sign in to comment.