1# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. 2# 3# Use of this source code is governed by a BSD-style license 4# that can be found in the LICENSE file in the root of the source 5# tree. An additional intellectual property rights grant can be found 6# in the file PATENTS. All contributing project authors may 7# be found in the AUTHORS file in the root of the source tree. 8 9import("../../../../webrtc.gni") 10 11rtc_library("rnn_vad") { 12 visibility = [ "../*" ] 13 sources = [ 14 "auto_correlation.cc", 15 "auto_correlation.h", 16 "common.cc", 17 "common.h", 18 "features_extraction.cc", 19 "features_extraction.h", 20 "lp_residual.cc", 21 "lp_residual.h", 22 "pitch_info.h", 23 "pitch_search.cc", 24 "pitch_search.h", 25 "pitch_search_internal.cc", 26 "pitch_search_internal.h", 27 "ring_buffer.h", 28 "rnn.cc", 29 "rnn.h", 30 "sequence_buffer.h", 31 "spectral_features.cc", 32 "spectral_features.h", 33 "spectral_features_internal.cc", 34 "spectral_features_internal.h", 35 "symmetric_matrix_buffer.h", 36 ] 37 38 defines = [] 39 if (rtc_build_with_neon && current_cpu != "arm64") { 40 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ] 41 cflags = [ "-mfpu=neon" ] 42 } 43 44 deps = [ 45 "..:biquad_filter", 46 "../../../../api:array_view", 47 "../../../../api:function_view", 48 "../../../../rtc_base:checks", 49 "../../../../rtc_base:rtc_base_approved", 50 "../../../../rtc_base/system:arch", 51 "../../../../system_wrappers:cpu_features_api", 52 "../../utility:pffft_wrapper", 53 "//third_party/rnnoise:rnn_vad", 54 ] 55} 56 57if (rtc_include_tests) { 58 rtc_library("test_utils") { 59 testonly = true 60 sources = [ 61 "test_utils.cc", 62 "test_utils.h", 63 ] 64 deps = [ 65 ":rnn_vad", 66 "../../../../api:array_view", 67 "../../../../api:scoped_refptr", 68 "../../../../rtc_base:checks", 69 "../../../../rtc_base/system:arch", 70 "../../../../system_wrappers:cpu_features_api", 71 "../../../../test:fileutils", 72 "../../../../test:test_support", 73 ] 74 } 75 76 unittest_resources = [ 77 "../../../../resources/audio_processing/agc2/rnn_vad/band_energies.dat", 78 "../../../../resources/audio_processing/agc2/rnn_vad/pitch_buf_24k.dat", 79 "../../../../resources/audio_processing/agc2/rnn_vad/pitch_lp_res.dat", 80 "../../../../resources/audio_processing/agc2/rnn_vad/pitch_search_int.dat", 81 "../../../../resources/audio_processing/agc2/rnn_vad/samples.pcm", 82 "../../../../resources/audio_processing/agc2/rnn_vad/vad_prob.dat", 83 ] 84 85 if (is_ios) { 86 bundle_data("unittests_bundle_data") { 87 testonly = true 88 sources = unittest_resources 89 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] 90 } 91 } 92 93 rtc_library("unittests") { 94 testonly = true 95 sources = [ 96 "auto_correlation_unittest.cc", 97 "features_extraction_unittest.cc", 98 "lp_residual_unittest.cc", 99 "pitch_search_internal_unittest.cc", 100 "pitch_search_unittest.cc", 101 "ring_buffer_unittest.cc", 102 "rnn_unittest.cc", 103 "rnn_vad_unittest.cc", 104 "sequence_buffer_unittest.cc", 105 "spectral_features_internal_unittest.cc", 106 "spectral_features_unittest.cc", 107 "symmetric_matrix_buffer_unittest.cc", 108 ] 109 deps = [ 110 ":rnn_vad", 111 ":test_utils", 112 "../..:audioproc_test_utils", 113 "../../../../api:array_view", 114 "../../../../common_audio/", 115 "../../../../rtc_base:checks", 116 "../../../../rtc_base:logging", 117 "../../../../rtc_base/system:arch", 118 "../../../../test:test_support", 119 "../../utility:pffft_wrapper", 120 "//third_party/rnnoise:rnn_vad", 121 ] 122 absl_deps = [ "//third_party/abseil-cpp/absl/memory" ] 123 data = unittest_resources 124 if (is_ios) { 125 deps += [ ":unittests_bundle_data" ] 126 } 127 } 128 129 rtc_executable("rnn_vad_tool") { 130 testonly = true 131 sources = [ "rnn_vad_tool.cc" ] 132 deps = [ 133 ":rnn_vad", 134 "../../../../api:array_view", 135 "../../../../common_audio", 136 "../../../../rtc_base:rtc_base_approved", 137 "../../../../test:test_support", 138 "//third_party/abseil-cpp/absl/flags:flag", 139 "//third_party/abseil-cpp/absl/flags:parse", 140 ] 141 } 142} 143