AGC2: VadWithLevel -> VoiceActivityDetectorWrapper 1/2

Internal refactoring of AGC2. This CL is needed in preparation for its
child CL to correctly show the upcoming changes in the diff.

Bug: webrtc:7494
Change-Id: If7f837e064243d5ffe09e21fc68f489bb00dfdc5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234527
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35170}
This commit is contained in:
Alessio Bazzica 2021-10-08 08:15:29 +02:00 committed by WebRTC LUCI CQ
parent 5a79d28eba
commit 585aad7323
9 changed files with 22 additions and 18 deletions

View File

@ -372,8 +372,8 @@ if (rtc_include_tests) {
"agc2:biquad_filter_unittests",
"agc2:fixed_digital_unittests",
"agc2:noise_estimator_unittests",
"agc2:rnn_vad_with_level_unittests",
"agc2:test_utils",
"agc2:vad_wrapper_unittests",
"agc2/rnn_vad:unittests",
"capture_levels_adjuster",
"capture_levels_adjuster:capture_levels_adjuster_unittests",

View File

@ -36,7 +36,7 @@ rtc_library("adaptive_digital") {
":cpu_features",
":gain_applier",
":noise_level_estimator",
":rnn_vad_with_level",
":vad_wrapper",
"..:api",
"..:apm_logging",
"..:audio_frame_view",
@ -127,10 +127,10 @@ rtc_library("noise_level_estimator") {
configs += [ "..:apm_debug_dump" ]
}
rtc_library("rnn_vad_with_level") {
rtc_library("vad_wrapper") {
sources = [
"vad_with_level.cc",
"vad_with_level.h",
"vad_wrapper.cc",
"vad_wrapper.h",
]
defines = []
@ -249,12 +249,12 @@ rtc_library("noise_estimator_unittests") {
]
}
rtc_library("rnn_vad_with_level_unittests") {
rtc_library("vad_wrapper_unittests") {
testonly = true
sources = [ "vad_with_level_unittest.cc" ]
sources = [ "vad_wrapper_unittest.cc" ]
deps = [
":common",
":rnn_vad_with_level",
":vad_wrapper",
"..:audio_frame_view",
"../../../rtc_base:gunit_helpers",
"../../../rtc_base:safe_compare",

View File

@ -12,7 +12,7 @@
#include "common_audio/include/audio_util.h"
#include "modules/audio_processing/agc2/cpu_features.h"
#include "modules/audio_processing/agc2/vad_with_level.h"
#include "modules/audio_processing/agc2/vad_wrapper.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"

View File

@ -17,7 +17,7 @@
#include "modules/audio_processing/agc2/adaptive_mode_level_estimator.h"
#include "modules/audio_processing/agc2/noise_level_estimator.h"
#include "modules/audio_processing/agc2/saturation_protector.h"
#include "modules/audio_processing/agc2/vad_with_level.h"
#include "modules/audio_processing/agc2/vad_wrapper.h"
#include "modules/audio_processing/include/audio_frame_view.h"
#include "modules/audio_processing/include/audio_processing.h"

View File

@ -12,10 +12,11 @@
#define MODULES_AUDIO_PROCESSING_AGC2_ADAPTIVE_MODE_LEVEL_ESTIMATOR_H_
#include <stddef.h>
#include <type_traits>
#include "modules/audio_processing/agc2/agc2_common.h"
#include "modules/audio_processing/agc2/vad_with_level.h"
#include "modules/audio_processing/agc2/vad_wrapper.h"
#include "modules/audio_processing/include/audio_processing.h"
namespace webrtc {

View File

@ -57,7 +57,7 @@ rtc_source_set("rnn_vad_common") {
# TODO(alessiob): Make this target visibility private.
visibility = [
":*",
"..:rnn_vad_with_level",
"..:vad_wrapper",
]
sources = [ "common.h" ]
deps = [

View File

@ -8,11 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "modules/audio_processing/agc2/vad_with_level.h"
#include "modules/audio_processing/agc2/vad_wrapper.h"
#include <algorithm>
#include <array>
#include <cmath>
#include <utility>
#include "api/array_view.h"
#include "common_audio/include/audio_util.h"

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_AUDIO_PROCESSING_AGC2_VAD_WITH_LEVEL_H_
#define MODULES_AUDIO_PROCESSING_AGC2_VAD_WITH_LEVEL_H_
#ifndef MODULES_AUDIO_PROCESSING_AGC2_VAD_WRAPPER_H_
#define MODULES_AUDIO_PROCESSING_AGC2_VAD_WRAPPER_H_
#include <memory>
@ -61,4 +61,4 @@ class VadLevelAnalyzer {
} // namespace webrtc
#endif // MODULES_AUDIO_PROCESSING_AGC2_VAD_WITH_LEVEL_H_
#endif // MODULES_AUDIO_PROCESSING_AGC2_VAD_WRAPPER_H_

View File

@ -8,10 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "modules/audio_processing/agc2/vad_with_level.h"
#include "modules/audio_processing/agc2/vad_wrapper.h"
#include <limits>
#include <memory>
#include <tuple>
#include <utility>
#include <vector>
#include "modules/audio_processing/agc2/agc2_common.h"
@ -61,7 +63,7 @@ std::unique_ptr<VadLevelAnalyzer> CreateVadLevelAnalyzerWithMockVad(
// 10 ms mono frame.
struct FrameWithView {
// Ctor. Initializes the frame samples with `value`.
FrameWithView(float value = 0.0f)
explicit FrameWithView(float value = 0.0f)
: channel0(samples.data()),
view(&channel0, /*num_channels=*/1, samples.size()) {
samples.fill(value);