From 524b8f7304090eec09e4251ca234e0ea083ce858 Mon Sep 17 00:00:00 2001 From: "kjellander@webrtc.org" Date: Sun, 31 Aug 2014 20:32:53 +0000 Subject: [PATCH] GN: Implement voice engine, common audio, audio coding and audio processing 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 --- webrtc/build/webrtc.gni | 18 +- webrtc/common_audio/BUILD.gn | 197 ++++- webrtc/modules/audio_coding/BUILD.gn | 674 +++++++++++++++++- .../isac/main/source/filter_functions.c | 1 + .../codecs/isac/main/source/lattice.c | 1 + .../codecs/isac/main/source/pitch_estimator.c | 1 + webrtc/modules/audio_processing/BUILD.gn | 218 +++++- webrtc/voice_engine/BUILD.gn | 94 ++- 8 files changed, 1192 insertions(+), 12 deletions(-) diff --git a/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni index 5b3fe1834..cae816640 100644 --- a/webrtc/build/webrtc.gni +++ b/webrtc/build/webrtc.gni @@ -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 @@ -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. @@ -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) } diff --git a/webrtc/common_audio/BUILD.gn b/webrtc/common_audio/BUILD.gn index 4dcc32265..6b5fe9de9 100644 --- a/webrtc/common_audio/BUILD.gn +++ b/webrtc/common_audio/BUILD.gn @@ -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" ] + } } } diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn index e4ad4cb35..206445fe2 100644 --- a/webrtc/modules/audio_coding/BUILD.gn +++ b/webrtc/modules/audio_coding/BUILD.gn @@ -6,8 +6,678 @@ # 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") import("../../build/webrtc.gni") -source_set("audio_coding") { - # TODO(andrew): Implement. +config("audio_coding_config") { + include_dirs = [ + "main/interface", + "../interface", + ] +} + +source_set("audio_coding") { + sources = [ + "main/acm2/acm_amr.cc", + "main/acm2/acm_amr.h", + "main/acm2/acm_amrwb.cc", + "main/acm2/acm_amrwb.h", + "main/acm2/acm_celt.cc", + "main/acm2/acm_celt.h", + "main/acm2/acm_cng.cc", + "main/acm2/acm_cng.h", + "main/acm2/acm_codec_database.cc", + "main/acm2/acm_codec_database.h", + "main/acm2/acm_common_defs.h", + "main/acm2/acm_dtmf_playout.cc", + "main/acm2/acm_dtmf_playout.h", + "main/acm2/acm_g722.cc", + "main/acm2/acm_g722.h", + "main/acm2/acm_g7221.cc", + "main/acm2/acm_g7221.h", + "main/acm2/acm_g7221c.cc", + "main/acm2/acm_g7221c.h", + "main/acm2/acm_g729.cc", + "main/acm2/acm_g729.h", + "main/acm2/acm_g7291.cc", + "main/acm2/acm_g7291.h", + "main/acm2/acm_generic_codec.cc", + "main/acm2/acm_generic_codec.h", + "main/acm2/acm_gsmfr.cc", + "main/acm2/acm_gsmfr.h", + "main/acm2/acm_ilbc.cc", + "main/acm2/acm_ilbc.h", + "main/acm2/acm_isac.cc", + "main/acm2/acm_isac.h", + "main/acm2/acm_isac_macros.h", + "main/acm2/acm_opus.cc", + "main/acm2/acm_opus.h", + "main/acm2/acm_speex.cc", + "main/acm2/acm_speex.h", + "main/acm2/acm_pcm16b.cc", + "main/acm2/acm_pcm16b.h", + "main/acm2/acm_pcma.cc", + "main/acm2/acm_pcma.h", + "main/acm2/acm_pcmu.cc", + "main/acm2/acm_pcmu.h", + "main/acm2/acm_red.cc", + "main/acm2/acm_red.h", + "main/acm2/acm_receiver.cc", + "main/acm2/acm_receiver.h", + "main/acm2/acm_resampler.cc", + "main/acm2/acm_resampler.h", + "main/acm2/audio_coding_module.cc", + "main/acm2/audio_coding_module_impl.cc", + "main/acm2/audio_coding_module_impl.h", + "main/acm2/call_statistics.cc", + "main/acm2/call_statistics.h", + "main/acm2/initial_delay_manager.cc", + "main/acm2/initial_delay_manager.h", + "main/acm2/nack.cc", + "main/acm2/nack.h", + "main/interface/audio_coding_module.h", + "main/interface/audio_coding_module_typedefs.h", + ] + + defines = [] + + direct_dependent_configs = [ ":audio_coding_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" ] + } + + deps = [ + ":cng", + ":g711", + ":g722", + ":ilbc", + ":isac", + ":isacfix", + ":neteq", + ":pcm16b", + "../../common_audio", + "../../system_wrappers", + ] + + if (include_opus) { + defines += [ "WEBRTC_CODEC_OPUS" ] + deps += [ ":webrtc_opus" ] + } +} + +config("cng_config") { + include_dirs = [ + "../..", + "codecs/cng/include", + ] +} + +source_set("cng") { + sources = [ + "codecs/cng/cng_helpfuns.c", + "codecs/cng/cng_helpfuns.h", + "codecs/cng/include/webrtc_cng.h", + "codecs/cng/webrtc_cng.c", + ] + + direct_dependent_configs = [ ":cng_config" ] + + deps = [ "../../common_audio" ] +} + +config("g711_config") { + include_dirs = [ + "../..", + "codecs/g711/include", + ] +} + +source_set("g711") { + sources = [ + "codecs/g711/include/g711_interface.h", + "codecs/g711/g711_interface.c", + "codecs/g711/g711.c", + "codecs/g711/g711.h", + ] + + direct_dependent_configs = [ ":g711_config" ] +} + +config("g722_config") { + include_dirs = [ + "../..", + "codecs/g722/include", + ] +} + +source_set("g722") { + sources = [ + "codecs/g722/include/g722_interface.h", + "codecs/g722/g722_interface.c", + "codecs/g722/g722_encode.c", + "codecs/g722/g722_decode.c", + "codecs/g722/g722_enc_dec.h", + ] + + direct_dependent_configs = [ ":g722_config" ] +} + +config("ilbc_config") { + include_dirs = [ + "../..", + "codecs/ilbc/interface", + ] +} + +source_set("ilbc") { + sources = [ + "codecs/ilbc/abs_quant.c", + "codecs/ilbc/abs_quant.h", + "codecs/ilbc/abs_quant_loop.c", + "codecs/ilbc/abs_quant_loop.h", + "codecs/ilbc/augmented_cb_corr.c", + "codecs/ilbc/augmented_cb_corr.h", + "codecs/ilbc/bw_expand.c", + "codecs/ilbc/bw_expand.h", + "codecs/ilbc/cb_construct.c", + "codecs/ilbc/cb_construct.h", + "codecs/ilbc/cb_mem_energy_augmentation.c", + "codecs/ilbc/cb_mem_energy_augmentation.h", + "codecs/ilbc/cb_mem_energy.c", + "codecs/ilbc/cb_mem_energy_calc.c", + "codecs/ilbc/cb_mem_energy_calc.h", + "codecs/ilbc/cb_mem_energy.h", + "codecs/ilbc/cb_search.c", + "codecs/ilbc/cb_search_core.c", + "codecs/ilbc/cb_search_core.h", + "codecs/ilbc/cb_search.h", + "codecs/ilbc/cb_update_best_index.c", + "codecs/ilbc/cb_update_best_index.h", + "codecs/ilbc/chebyshev.c", + "codecs/ilbc/chebyshev.h", + "codecs/ilbc/comp_corr.c", + "codecs/ilbc/comp_corr.h", + "codecs/ilbc/constants.c", + "codecs/ilbc/constants.h", + "codecs/ilbc/create_augmented_vec.c", + "codecs/ilbc/create_augmented_vec.h", + "codecs/ilbc/decode.c", + "codecs/ilbc/decode.h", + "codecs/ilbc/decode_residual.c", + "codecs/ilbc/decode_residual.h", + "codecs/ilbc/decoder_interpolate_lsf.c", + "codecs/ilbc/decoder_interpolate_lsf.h", + "codecs/ilbc/defines.h", + "codecs/ilbc/do_plc.c", + "codecs/ilbc/do_plc.h", + "codecs/ilbc/encode.c", + "codecs/ilbc/encode.h", + "codecs/ilbc/energy_inverse.c", + "codecs/ilbc/energy_inverse.h", + "codecs/ilbc/enhancer.c", + "codecs/ilbc/enhancer.h", + "codecs/ilbc/enhancer_interface.c", + "codecs/ilbc/enhancer_interface.h", + "codecs/ilbc/enh_upsample.c", + "codecs/ilbc/enh_upsample.h", + "codecs/ilbc/filtered_cb_vecs.c", + "codecs/ilbc/filtered_cb_vecs.h", + "codecs/ilbc/frame_classify.c", + "codecs/ilbc/frame_classify.h", + "codecs/ilbc/gain_dequant.c", + "codecs/ilbc/gain_dequant.h", + "codecs/ilbc/gain_quant.c", + "codecs/ilbc/gain_quant.h", + "codecs/ilbc/get_cd_vec.c", + "codecs/ilbc/get_cd_vec.h", + "codecs/ilbc/get_lsp_poly.c", + "codecs/ilbc/get_lsp_poly.h", + "codecs/ilbc/get_sync_seq.c", + "codecs/ilbc/get_sync_seq.h", + "codecs/ilbc/hp_input.c", + "codecs/ilbc/hp_input.h", + "codecs/ilbc/hp_output.c", + "codecs/ilbc/hp_output.h", + "codecs/ilbc/ilbc.c", + "codecs/ilbc/index_conv_dec.c", + "codecs/ilbc/index_conv_dec.h", + "codecs/ilbc/index_conv_enc.c", + "codecs/ilbc/index_conv_enc.h", + "codecs/ilbc/init_decode.c", + "codecs/ilbc/init_decode.h", + "codecs/ilbc/init_encode.c", + "codecs/ilbc/init_encode.h", + "codecs/ilbc/interface/ilbc.h", + "codecs/ilbc/interpolate.c", + "codecs/ilbc/interpolate.h", + "codecs/ilbc/interpolate_samples.c", + "codecs/ilbc/interpolate_samples.h", + "codecs/ilbc/lpc_encode.c", + "codecs/ilbc/lpc_encode.h", + "codecs/ilbc/lsf_check.c", + "codecs/ilbc/lsf_check.h", + "codecs/ilbc/lsf_interpolate_to_poly_dec.c", + "codecs/ilbc/lsf_interpolate_to_poly_dec.h", + "codecs/ilbc/lsf_interpolate_to_poly_enc.c", + "codecs/ilbc/lsf_interpolate_to_poly_enc.h", + "codecs/ilbc/lsf_to_lsp.c", + "codecs/ilbc/lsf_to_lsp.h", + "codecs/ilbc/lsf_to_poly.c", + "codecs/ilbc/lsf_to_poly.h", + "codecs/ilbc/lsp_to_lsf.c", + "codecs/ilbc/lsp_to_lsf.h", + "codecs/ilbc/my_corr.c", + "codecs/ilbc/my_corr.h", + "codecs/ilbc/nearest_neighbor.c", + "codecs/ilbc/nearest_neighbor.h", + "codecs/ilbc/pack_bits.c", + "codecs/ilbc/pack_bits.h", + "codecs/ilbc/poly_to_lsf.c", + "codecs/ilbc/poly_to_lsf.h", + "codecs/ilbc/poly_to_lsp.c", + "codecs/ilbc/poly_to_lsp.h", + "codecs/ilbc/refiner.c", + "codecs/ilbc/refiner.h", + "codecs/ilbc/simple_interpolate_lsf.c", + "codecs/ilbc/simple_interpolate_lsf.h", + "codecs/ilbc/simple_lpc_analysis.c", + "codecs/ilbc/simple_lpc_analysis.h", + "codecs/ilbc/simple_lsf_dequant.c", + "codecs/ilbc/simple_lsf_dequant.h", + "codecs/ilbc/simple_lsf_quant.c", + "codecs/ilbc/simple_lsf_quant.h", + "codecs/ilbc/smooth.c", + "codecs/ilbc/smooth.h", + "codecs/ilbc/smooth_out_data.c", + "codecs/ilbc/smooth_out_data.h", + "codecs/ilbc/sort_sq.c", + "codecs/ilbc/sort_sq.h", + "codecs/ilbc/split_vq.c", + "codecs/ilbc/split_vq.h", + "codecs/ilbc/state_construct.c", + "codecs/ilbc/state_construct.h", + "codecs/ilbc/state_search.c", + "codecs/ilbc/state_search.h", + "codecs/ilbc/swap_bytes.c", + "codecs/ilbc/swap_bytes.h", + "codecs/ilbc/unpack_bits.c", + "codecs/ilbc/unpack_bits.h", + "codecs/ilbc/vq3.c", + "codecs/ilbc/vq3.h", + "codecs/ilbc/vq4.c", + "codecs/ilbc/vq4.h", + "codecs/ilbc/window32_w32.c", + "codecs/ilbc/window32_w32.h", + "codecs/ilbc/xcorr_coef.c", + "codecs/ilbc/xcorr_coef.h", + ] + + direct_dependent_configs = [ ":ilbc_config" ] + + deps = [ "../../common_audio" ] +} + +config("isac_config") { + include_dirs = [ + "../..", + "codecs/isac/main/interface", + ] +} + +source_set("isac") { + sources = [ + "codecs/isac/main/interface/isac.h", + "codecs/isac/main/source/arith_routines.c", + "codecs/isac/main/source/arith_routines.h", + "codecs/isac/main/source/arith_routines_hist.c", + "codecs/isac/main/source/arith_routines_logist.c", + "codecs/isac/main/source/bandwidth_estimator.c", + "codecs/isac/main/source/bandwidth_estimator.h", + "codecs/isac/main/source/codec.h", + "codecs/isac/main/source/crc.c", + "codecs/isac/main/source/crc.h", + "codecs/isac/main/source/decode_bwe.c", + "codecs/isac/main/source/decode.c", + "codecs/isac/main/source/encode.c", + "codecs/isac/main/source/encode_lpc_swb.c", + "codecs/isac/main/source/encode_lpc_swb.h", + "codecs/isac/main/source/entropy_coding.c", + "codecs/isac/main/source/entropy_coding.h", + "codecs/isac/main/source/fft.c", + "codecs/isac/main/source/fft.h", + "codecs/isac/main/source/filterbanks.c", + "codecs/isac/main/source/filterbank_tables.c", + "codecs/isac/main/source/filterbank_tables.h", + "codecs/isac/main/source/filter_functions.c", + "codecs/isac/main/source/intialize.c", + "codecs/isac/main/source/isac.c", + "codecs/isac/main/source/lattice.c", + "codecs/isac/main/source/lpc_analysis.c", + "codecs/isac/main/source/lpc_analysis.h", + "codecs/isac/main/source/lpc_gain_swb_tables.c", + "codecs/isac/main/source/lpc_gain_swb_tables.h", + "codecs/isac/main/source/lpc_shape_swb12_tables.c", + "codecs/isac/main/source/lpc_shape_swb12_tables.h", + "codecs/isac/main/source/lpc_shape_swb16_tables.c", + "codecs/isac/main/source/lpc_shape_swb16_tables.h", + "codecs/isac/main/source/lpc_tables.c", + "codecs/isac/main/source/lpc_tables.h", + "codecs/isac/main/source/os_specific_inline.h", + "codecs/isac/main/source/pitch_estimator.c", + "codecs/isac/main/source/pitch_estimator.h", + "codecs/isac/main/source/pitch_filter.c", + "codecs/isac/main/source/pitch_gain_tables.c", + "codecs/isac/main/source/pitch_gain_tables.h", + "codecs/isac/main/source/pitch_lag_tables.c", + "codecs/isac/main/source/pitch_lag_tables.h", + "codecs/isac/main/source/settings.h", + "codecs/isac/main/source/spectrum_ar_model_tables.c", + "codecs/isac/main/source/spectrum_ar_model_tables.h", + "codecs/isac/main/source/structs.h", + "codecs/isac/main/source/transform.c", + ] + + if (is_linux) { + libs = [ "m" ] + } + + configs += [ "../..:common_inherited_config" ] + + direct_dependent_configs = [ ":isac_config" ] + + deps = [ "../../common_audio" ] +} + +config("isac_fix_config") { + include_dirs = [ + "../..", + "codecs/isac/fix/interface", + ] +} + +source_set("isacfix") { + sources = [ + "codecs/isac/fix/interface/isacfix.h", + "codecs/isac/fix/source/arith_routines.c", + "codecs/isac/fix/source/arith_routines_hist.c", + "codecs/isac/fix/source/arith_routines_logist.c", + "codecs/isac/fix/source/arith_routins.h", + "codecs/isac/fix/source/bandwidth_estimator.c", + "codecs/isac/fix/source/bandwidth_estimator.h", + "codecs/isac/fix/source/codec.h", + "codecs/isac/fix/source/decode_bwe.c", + "codecs/isac/fix/source/decode.c", + "codecs/isac/fix/source/decode_plc.c", + "codecs/isac/fix/source/encode.c", + "codecs/isac/fix/source/entropy_coding.c", + "codecs/isac/fix/source/entropy_coding.h", + "codecs/isac/fix/source/fft.c", + "codecs/isac/fix/source/fft.h", + "codecs/isac/fix/source/filterbanks.c", + "codecs/isac/fix/source/filterbank_tables.c", + "codecs/isac/fix/source/filterbank_tables.h", + "codecs/isac/fix/source/filters.c", + "codecs/isac/fix/source/initialize.c", + "codecs/isac/fix/source/isacfix.c", + "codecs/isac/fix/source/lattice.c", + "codecs/isac/fix/source/lpc_masking_model.c", + "codecs/isac/fix/source/lpc_masking_model.h", + "codecs/isac/fix/source/lpc_tables.c", + "codecs/isac/fix/source/lpc_tables.h", + "codecs/isac/fix/source/pitch_estimator.c", + "codecs/isac/fix/source/pitch_estimator.h", + "codecs/isac/fix/source/pitch_filter.c", + "codecs/isac/fix/source/pitch_gain_tables.c", + "codecs/isac/fix/source/pitch_gain_tables.h", + "codecs/isac/fix/source/pitch_lag_tables.c", + "codecs/isac/fix/source/pitch_lag_tables.h", + "codecs/isac/fix/source/settings.h", + "codecs/isac/fix/source/spectrum_ar_model_tables.c", + "codecs/isac/fix/source/spectrum_ar_model_tables.h", + "codecs/isac/fix/source/structs.h", + "codecs/isac/fix/source/transform.c", + "codecs/isac/fix/source/transform_tables.c", + ] + + if (!is_win) { + defines = [ "WEBRTC_LINUX" ] + } + + direct_dependent_configs = [ ":isac_fix_config" ] + + deps = [ + "../../common_audio", + "../../system_wrappers", + ] + + if (build_armv7_neon) { + deps += [ ":isac_neon" ] + + # 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", + ] + + sources += [ + "codecs/isac/fix/source/lattice_armv7.S", + "codecs/isac/fix/source/pitch_filter_armv6.S", + ] + } else { + sources += [ "codecs/isac/fix/source/pitch_filter_c.c" ] + } + + if (cpu_arch == "mipsel") { + sources += [ + "codecs/isac/fix/source/entropy_coding_mips.c", + "codecs/isac/fix/source/filters_mips.c", + "codecs/isac/fix/source/lattice_mips.c", + "codecs/isac/fix/source/pitch_estimator_mips.c", + "codecs/isac/fix/source/transform_mips.c", + ] + if (mips_dsp_rev > 0) { + sources += [ "codecs/isac/fix/source/filterbanks_mips.c" ] + } + if (mips_dsp_rev > 1) { + sources += [ + "codecs/isac/fix/source/lpc_masking_model_mips.c", + "codecs/isac/fix/source/pitch_filter_mips.c", + ] + } else { + sources += [ "codecs/isac/fix/source/pitch_filter_c.c" ] + } + } + + if (build_armv7_neon) { + sources += [ + "codecs/isac/fix/source/lattice_c.c", + "codecs/isac/fix/source/pitch_estimator_c.c", + ] + } +} + +if (build_armv7_neon) { + source_set("isac_neon") { + sources = [ + "codecs/isac/fix/source/entropy_coding_neon.c", + "codecs/isac/fix/source/filterbanks_neon.S", + "codecs/isac/fix/source/filters_neon.S", + "codecs/isac/fix/source/lattice_neon.S", + "codecs/isac/fix/source/lpc_masking_model_neon.S", + "codecs/isac/fix/source/transform_neon.S", + ] + + include_dirs = [ + "../..", + ] + + # Disable LTO in audio_processing_neon target due to compiler bug. + if (use_lto) { + cflags -= [ + "-flto", + "-ffat-lto-objects", + ] + } + + # 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", + ] + + deps = [ "../../common_audio" ] + } +} + +config("pcm16b_config") { + include_dirs = [ + "../..", + "codecs/pcm16b/include", + ] +} + +source_set("pcm16b") { + sources = [ + "codecs/pcm16b/include/pcm16b.h", + "codecs/pcm16b/pcm16b.c", + ] + + direct_dependent_configs = [ ":pcm16b_config" ] +} + +config("opus_config") { + include_dirs = [ "../.." ] +} + +source_set("webrtc_opus") { + sources = [ + "codecs/opus/interface/opus_interface.h", + "codecs/opus/opus_inst.h", + "codecs/opus/opus_interface.c", + ] + if (build_with_mozilla) { + include_dirs = [ getenv("DIST") + "/include/opus" ] + } else { + configs += [ "../..:common_inherited_config" ] + + deps = [ "//third_party/opus" ] + } +} + +config("neteq_config") { + include_dirs = [ + # Need Opus header files for the audio classifier. + "//third_party/opus/src/celt", + "//third_party/opus/src/src", + ] +} + +source_set("neteq") { + sources = [ + "neteq/interface/audio_decoder.h", + "neteq/interface/neteq.h", + "neteq/accelerate.cc", + "neteq/accelerate.h", + "neteq/audio_classifier.cc", + "neteq/audio_classifier.h", + "neteq/audio_decoder_impl.cc", + "neteq/audio_decoder_impl.h", + "neteq/audio_decoder.cc", + "neteq/audio_multi_vector.cc", + "neteq/audio_multi_vector.h", + "neteq/audio_vector.cc", + "neteq/audio_vector.h", + "neteq/background_noise.cc", + "neteq/background_noise.h", + "neteq/buffer_level_filter.cc", + "neteq/buffer_level_filter.h", + "neteq/comfort_noise.cc", + "neteq/comfort_noise.h", + "neteq/decision_logic.cc", + "neteq/decision_logic.h", + "neteq/decision_logic_fax.cc", + "neteq/decision_logic_fax.h", + "neteq/decision_logic_normal.cc", + "neteq/decision_logic_normal.h", + "neteq/decoder_database.cc", + "neteq/decoder_database.h", + "neteq/defines.h", + "neteq/delay_manager.cc", + "neteq/delay_manager.h", + "neteq/delay_peak_detector.cc", + "neteq/delay_peak_detector.h", + "neteq/dsp_helper.cc", + "neteq/dsp_helper.h", + "neteq/dtmf_buffer.cc", + "neteq/dtmf_buffer.h", + "neteq/dtmf_tone_generator.cc", + "neteq/dtmf_tone_generator.h", + "neteq/expand.cc", + "neteq/expand.h", + "neteq/merge.cc", + "neteq/merge.h", + "neteq/neteq_impl.cc", + "neteq/neteq_impl.h", + "neteq/neteq.cc", + "neteq/statistics_calculator.cc", + "neteq/statistics_calculator.h", + "neteq/normal.cc", + "neteq/normal.h", + "neteq/packet_buffer.cc", + "neteq/packet_buffer.h", + "neteq/payload_splitter.cc", + "neteq/payload_splitter.h", + "neteq/post_decode_vad.cc", + "neteq/post_decode_vad.h", + "neteq/preemptive_expand.cc", + "neteq/preemptive_expand.h", + "neteq/random_vector.cc", + "neteq/random_vector.h", + "neteq/rtcp.cc", + "neteq/rtcp.h", + "neteq/sync_buffer.cc", + "neteq/sync_buffer.h", + "neteq/timestamp_scaler.cc", + "neteq/timestamp_scaler.h", + "neteq/time_stretch.cc", + "neteq/time_stretch.h", + ] + + direct_dependent_configs = [ ":neteq_config" ] + + forward_dependent_configs_from = [ "//third_party/opus" ] + + 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" ] + } + + deps = [ + ":cng", + ":g711", + ":g722", + ":ilbc", + ":isac", + ":isacfix", + ":pcm16b", + "../../common_audio", + "../../system_wrappers", + "//third_party/opus", + ] } diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/filter_functions.c b/webrtc/modules/audio_coding/codecs/isac/main/source/filter_functions.c index 33024a3de..76a9e7530 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/filter_functions.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/filter_functions.c @@ -9,6 +9,7 @@ */ #include +#include #ifdef WEBRTC_ANDROID #include #endif diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/lattice.c b/webrtc/modules/audio_coding/codecs/isac/main/source/lattice.c index a46135a3f..eabe70804 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/lattice.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/lattice.c @@ -19,6 +19,7 @@ #include #include +#include #ifdef WEBRTC_ANDROID #include #endif diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/pitch_estimator.c b/webrtc/modules/audio_coding/codecs/isac/main/source/pitch_estimator.c index 75525f69d..090b94ca0 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/pitch_estimator.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/pitch_estimator.c @@ -12,6 +12,7 @@ #include #include +#include #ifdef WEBRTC_ANDROID #include #endif diff --git a/webrtc/modules/audio_processing/BUILD.gn b/webrtc/modules/audio_processing/BUILD.gn index a727d54b2..57b721bd4 100644 --- a/webrtc/modules/audio_processing/BUILD.gn +++ b/webrtc/modules/audio_processing/BUILD.gn @@ -6,8 +6,222 @@ # 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") +import("//third_party/protobuf/proto_library.gni") import("../../build/webrtc.gni") -source_set("audio_processing") { - # TODO(andrew): Implement. +declare_args() { + # Outputs some low-level debug files. + aec_debug_dump = false + + # Disables the usual mode where we trust the reported system delay + # values the AEC receives. The corresponding define is set appropriately + # in the code, but it can be force-enabled here for testing. + aec_untrusted_delay_for_testing = false +} + +source_set("audio_processing") { + sources = [ + "aec/include/echo_cancellation.h", + "aec/echo_cancellation.c", + "aec/echo_cancellation_internal.h", + "aec/aec_core.h", + "aec/aec_core.c", + "aec/aec_core_internal.h", + "aec/aec_rdft.h", + "aec/aec_rdft.c", + "aec/aec_resampler.h", + "aec/aec_resampler.c", + "aecm/include/echo_control_mobile.h", + "aecm/echo_control_mobile.c", + "aecm/aecm_core.c", + "aecm/aecm_core.h", + "agc/include/gain_control.h", + "agc/analog_agc.c", + "agc/analog_agc.h", + "agc/digital_agc.c", + "agc/digital_agc.h", + "audio_buffer.cc", + "audio_buffer.h", + "audio_processing_impl.cc", + "audio_processing_impl.h", + "common.h", + "echo_cancellation_impl.cc", + "echo_cancellation_impl.h", + "echo_control_mobile_impl.cc", + "echo_control_mobile_impl.h", + "gain_control_impl.cc", + "gain_control_impl.h", + "high_pass_filter_impl.cc", + "high_pass_filter_impl.h", + "include/audio_processing.h", + "level_estimator_impl.cc", + "level_estimator_impl.h", + "noise_suppression_impl.cc", + "noise_suppression_impl.h", + "processing_component.cc", + "processing_component.h", + "rms_level.cc", + "rms_level.h", + "typing_detection.cc", + "typing_detection.h", + "utility/delay_estimator.c", + "utility/delay_estimator.h", + "utility/delay_estimator_internal.h", + "utility/delay_estimator_wrapper.c", + "utility/delay_estimator_wrapper.h", + "utility/fft4g.c", + "utility/fft4g.h", + "utility/ring_buffer.c", + "utility/ring_buffer.h", + "voice_detection_impl.cc", + "voice_detection_impl.h", + ] + + defines = [] + deps = [] + + if (aec_debug_dump) { + defines += [ "WEBRTC_AEC_DEBUG_DUMP" ] + } + + if (aec_untrusted_delay_for_testing) { + defines += [ "WEBRTC_UNTRUSTED_DELAY" ] + } + + if (enable_protobuf) { + defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ] + deps += [ ":audioproc_debug_proto" ] + } + + if (prefer_fixed_point) { + defines += [ "WEBRTC_NS_FIXED" ] + sources += [ + "ns/include/noise_suppression_x.h", + "ns/noise_suppression_x.c", + "ns/nsx_core.c", + "ns/nsx_core.h", + "ns/nsx_defines.h", + ] + if (cpu_arch == "mipsel") { + sources += [ "ns/nsx_core_mips.c" ] + } else { + sources += [ "ns/nsx_core_c.c" ] + } + } else { + defines += [ "WEBRTC_NS_FLOAT" ] + sources += [ + "ns/defines.h", + "ns/include/noise_suppression.h", + "ns/noise_suppression.c", + "ns/ns_core.c", + "ns/ns_core.h", + "ns/windows_private.h", + ] + } + + if (cpu_arch == "x86" || cpu_arch == "x64") { + deps += [ ":audio_processing_sse2" ] + } + + if (build_armv7_neon) { + deps += [ ":audio_processing_neon" ] + } + + if (cpu_arch == "mipsel") { + sources += [ "aecm/aecm_core_mips.c" ] + if (mips_fpu) { + sources += [ + "aec/aec_core_mips.c", + "aec/aec_rdft_mips.c", + ] + } + } else { + sources += [ "aecm/aecm_core_c.c" ] + } + + if (is_win) { + cflags = [ + # TODO(jschuh): Bug 1348: fix this warning. + "/wd4267", # size_t to int truncations + ] + } + + 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" ] + } + + deps += [ + "../../common_audio", + "../../system_wrappers", + ] +} + +if (enable_protobuf) { + proto_library("audioproc_debug_proto") { + sources = [ "debug.proto" ] + + proto_out_dir = "webrtc/audio_processing" + } +} + +if (cpu_arch == "x86" || cpu_arch == "x64") { + source_set("audio_processing_sse2") { + sources = [ + "aec/aec_core_sse2.c", + "aec/aec_rdft_sse2.c", + ] + + cflags = [ "-msse2" ] + + configs += [ "../..:common_inherited_config" ] + } +} + +if (build_armv7_neon) { + source_set("audio_processing_neon") { + sources = [ + "aec/aec_core_neon.c", + "aec/aec_rdft_neon.c", + ] + + deps = [ "../../common_audio" ] + + if (is_android || is_ios) { + sources += [ + # TODO(andrew): Re-enable these once webrtc:3580 is resolved. + #"aecm/aecm_core_neon.S", + #"ns/nsx_core_neon.S", + ] + + include_dirs = [ target_out_dir ] + } else { + sources += [ + "aecm/aecm_core_neon.c", + "ns/nsx_core_neon.c", + ] + } + + # 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", + ] + } + } } diff --git a/webrtc/voice_engine/BUILD.gn b/webrtc/voice_engine/BUILD.gn index 7c1a1b19b..f9c5f913e 100644 --- a/webrtc/voice_engine/BUILD.gn +++ b/webrtc/voice_engine/BUILD.gn @@ -9,5 +9,97 @@ import("../build/webrtc.gni") source_set("voice_engine") { - # TODO(henrika): Implement. + + sources = [ + "../common_types.h", + "../engine_configurations.h", + "../typedefs.h", + "include/voe_audio_processing.h", + "include/voe_base.h", + "include/voe_codec.h", + "include/voe_dtmf.h", + "include/voe_errors.h", + "include/voe_external_media.h", + "include/voe_file.h", + "include/voe_hardware.h", + "include/voe_neteq_stats.h", + "include/voe_network.h", + "include/voe_rtp_rtcp.h", + "include/voe_video_sync.h", + "include/voe_volume_control.h", + "channel.cc", + "channel.h", + "channel_manager.cc", + "channel_manager.h", + "dtmf_inband.cc", + "dtmf_inband.h", + "dtmf_inband_queue.cc", + "dtmf_inband_queue.h", + "level_indicator.cc", + "level_indicator.h", + "monitor_module.cc", + "monitor_module.h", + "network_predictor.cc", + "network_predictor.h", + "output_mixer.cc", + "output_mixer.h", + "shared_data.cc", + "shared_data.h", + "statistics.cc", + "statistics.h", + "transmit_mixer.cc", + "transmit_mixer.h", + "utility.cc", + "utility.h", + "voe_audio_processing_impl.cc", + "voe_audio_processing_impl.h", + "voe_base_impl.cc", + "voe_base_impl.h", + "voe_codec_impl.cc", + "voe_codec_impl.h", + "voe_dtmf_impl.cc", + "voe_dtmf_impl.h", + "voe_external_media_impl.cc", + "voe_external_media_impl.h", + "voe_file_impl.cc", + "voe_file_impl.h", + "voe_hardware_impl.cc", + "voe_hardware_impl.h", + "voe_neteq_stats_impl.cc", + "voe_neteq_stats_impl.h", + "voe_network_impl.cc", + "voe_network_impl.h", + "voe_rtp_rtcp_impl.cc", + "voe_rtp_rtcp_impl.h", + "voe_video_sync_impl.cc", + "voe_video_sync_impl.h", + "voe_volume_control_impl.cc", + "voe_volume_control_impl.h", + "voice_engine_defines.h", + "voice_engine_impl.cc", + "voice_engine_impl.h", + ] + + if (is_win) { + defines = [ "WEBRTC_DRIFT_COMPENSATION_SUPPORTED" ] + } + + 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" ] + } + + deps = [ + "../common_audio", + "../modules/audio_coding", + "../modules/audio_conference_mixer", + "../modules/audio_device", + "../modules/audio_processing", + "../modules/bitrate_controller", + "../modules/media_file", + "../modules/rtp_rtcp", + "../modules/utility", + "../system_wrappers", + ] }