Deactivated the intelligibility enhancement functionality by default

NOTRY=true
BUG=

Review-Url: https://codereview.webrtc.org/2272423003
Cr-Commit-Position: refs/heads/master@{#13937}
This commit is contained in:
peah 2016-08-26 07:16:04 -07:00 committed by Commit bot
parent 7d67e45104
commit 1bcfce5ff2
11 changed files with 137 additions and 42 deletions

View File

@ -118,6 +118,9 @@
# Enables the use of protocol buffers for debug recordings.
'enable_protobuf%': 1,
# Disable the code for the intelligibility enhancer by default.
'enable_intelligibility_enhancer%': 0,
# Disable these to not build components which can be externally provided.
'build_expat%': 1,
'build_json%': 1,

View File

@ -36,6 +36,9 @@ declare_args() {
# Enables the use of protocol buffers for debug recordings.
rtc_enable_protobuf = true
# Disable the code for the intelligibility enhancer by default.
rtc_enable_intelligibility_enhancer = false
# Disable these to not build components which can be externally provided.
rtc_build_expat = true
rtc_build_json = true

View File

@ -141,6 +141,12 @@ source_set("rtc_media") {
]
}
if (rtc_enable_intelligibility_enhancer) {
defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
} else {
defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
}
include_dirs = []
if (rtc_build_libyuv) {
deps += [ "$rtc_libyuv_dir" ]

View File

@ -64,6 +64,14 @@ const int kDefaultAudioDeviceId = 0;
constexpr int kNackRtpHistoryMs = 5000;
// Check to verify that the define for the intelligibility enhancer is properly
// set.
#if !defined(WEBRTC_INTELLIGIBILITY_ENHANCER) || \
(WEBRTC_INTELLIGIBILITY_ENHANCER != 0 && \
WEBRTC_INTELLIGIBILITY_ENHANCER != 1)
#error "Set WEBRTC_INTELLIGIBILITY_ENHANCER to either 0 or 1"
#endif
// Codec parameters for Opus.
// draft-spittka-payload-rtp-opus-03
@ -649,6 +657,11 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
}
#endif
#if (WEBRTC_INTELLIGIBILITY_ENHANCER == 0)
// Hardcode the intelligibility enhancer to be off.
options.intelligibility_enhancer = rtc::Optional<bool>(false);
#endif
webrtc::VoEAudioProcessing* voep = voe_wrapper_->processing();
if (options.echo_cancellation) {

View File

@ -125,6 +125,11 @@
'<(DEPTH)/third_party/usrsctp/usrsctp.gyp:usrsctplib',
],
}],
['enable_intelligibility_enhancer==1', {
'defines': ['WEBRTC_INTELLIGIBILITY_ENHANCER=1',],
}, {
'defines': ['WEBRTC_INTELLIGIBILITY_ENHANCER=0',],
}],
['build_with_chromium==1', {
'dependencies': [
'<(webrtc_root)/modules/modules.gyp:video_capture',

View File

@ -199,8 +199,6 @@ if (rtc_include_tests) {
"audio_processing/beamformer/mock_nonlinear_beamformer.h",
"audio_processing/beamformer/nonlinear_beamformer_unittest.cc",
"audio_processing/echo_cancellation_impl_unittest.cc",
"audio_processing/intelligibility/intelligibility_enhancer_unittest.cc",
"audio_processing/intelligibility/intelligibility_utils_unittest.cc",
"audio_processing/splitting_filter_unittest.cc",
"audio_processing/transient/dyadic_decimator_unittest.cc",
"audio_processing/transient/file_utils.cc",
@ -348,6 +346,16 @@ if (rtc_include_tests) {
"video_processing/test/video_processing_unittest.h",
]
if (rtc_enable_intelligibility_enhancer) {
defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
sources += [
"audio_processing/intelligibility/intelligibility_enhancer_unittest.cc",
"audio_processing/intelligibility/intelligibility_utils_unittest.cc",
]
} else {
defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
}
if (rtc_libvpx_build_vp9) {
sources +=
[ "video_coding/codecs/vp9/vp9_screenshare_layers_unittest.cc" ]

View File

@ -74,10 +74,6 @@ source_set("audio_processing") {
"high_pass_filter_impl.cc",
"high_pass_filter_impl.h",
"include/audio_processing.h",
"intelligibility/intelligibility_enhancer.cc",
"intelligibility/intelligibility_enhancer.h",
"intelligibility/intelligibility_utils.cc",
"intelligibility/intelligibility_utils.h",
"level_controller/biquad_filter.cc",
"level_controller/biquad_filter.h",
"level_controller/down_sampler.cc",
@ -182,6 +178,18 @@ source_set("audio_processing") {
deps += [ ":audioproc_debug_proto" ]
}
if (rtc_enable_intelligibility_enhancer) {
defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
sources += [
"intelligibility/intelligibility_enhancer.cc",
"intelligibility/intelligibility_enhancer.h",
"intelligibility/intelligibility_utils.cc",
"intelligibility/intelligibility_utils.h",
]
} else {
defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
}
if (rtc_prefer_fixed_point) {
defines += [ "WEBRTC_NS_FIXED" ]
sources += [
@ -481,22 +489,24 @@ if (rtc_include_tests) {
}
}
executable("intelligibility_proc") {
testonly = true
sources = [
"intelligibility/test/intelligibility_proc.cc",
]
deps = [
":audio_processing",
":audioproc_test_utils",
"../../system_wrappers:metrics_default",
"../../test:test_support",
"//testing/gtest",
"//third_party/gflags",
]
if (is_clang) {
# Suppress warnings from the Chromium Clang plugins (bugs.webrtc.org/163).
configs -= [ "//build/config/clang:find_bad_constructs" ]
if (rtc_enable_intelligibility_enhancer) {
executable("intelligibility_proc") {
testonly = true
sources = [
"intelligibility/test/intelligibility_proc.cc",
]
deps = [
":audio_processing",
":audioproc_test_utils",
"../../system_wrappers:metrics_default",
"../../test:test_support",
"//testing/gtest",
"//third_party/gflags",
]
if (is_clang) {
# Suppress warnings from the Chromium Clang plugins (bugs.webrtc.org/163).
configs -= [ "//build/config/clang:find_bad_constructs" ]
}
}
}

View File

@ -85,10 +85,6 @@
'high_pass_filter_impl.cc',
'high_pass_filter_impl.h',
'include/audio_processing.h',
'intelligibility/intelligibility_enhancer.cc',
'intelligibility/intelligibility_enhancer.h',
'intelligibility/intelligibility_utils.cc',
'intelligibility/intelligibility_utils.h',
'level_controller/biquad_filter.cc',
'level_controller/biquad_filter.h',
'level_controller/down_sampler.cc',
@ -184,6 +180,17 @@
'dependencies': ['audioproc_debug_proto'],
'defines': ['WEBRTC_AUDIOPROC_DEBUG_DUMP'],
}],
['enable_intelligibility_enhancer==1', {
'defines': ['WEBRTC_INTELLIGIBILITY_ENHANCER=1',],
'sources': [
'intelligibility/intelligibility_enhancer.cc',
'intelligibility/intelligibility_enhancer.h',
'intelligibility/intelligibility_utils.cc',
'intelligibility/intelligibility_utils.h',
],
}, {
'defines': ['WEBRTC_INTELLIGIBILITY_ENHANCER=0',],
}],
['prefer_fixed_point==1', {
'defines': ['WEBRTC_NS_FIXED'],
'sources': [

View File

@ -30,7 +30,9 @@
#include "webrtc/modules/audio_processing/gain_control_for_experimental_agc.h"
#include "webrtc/modules/audio_processing/gain_control_impl.h"
#include "webrtc/modules/audio_processing/high_pass_filter_impl.h"
#if WEBRTC_INTELLIGIBILITY_ENHANCER
#include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.h"
#endif
#include "webrtc/modules/audio_processing/level_controller/level_controller.h"
#include "webrtc/modules/audio_processing/level_estimator_impl.h"
#include "webrtc/modules/audio_processing/noise_suppression_impl.h"
@ -50,6 +52,14 @@
#endif
#endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
// Check to verify that the define for the intelligibility enhancer is properly
// set.
#if !defined(WEBRTC_INTELLIGIBILITY_ENHANCER) || \
(WEBRTC_INTELLIGIBILITY_ENHANCER != 0 && \
WEBRTC_INTELLIGIBILITY_ENHANCER != 1)
#error "Set WEBRTC_INTELLIGIBILITY_ENHANCER to either 0 or 1"
#endif
#define RETURN_ON_ERR(expr) \
do { \
int err = (expr); \
@ -124,7 +134,9 @@ struct AudioProcessingImpl::ApmPublicSubmodules {
// Accessed internally from both render and capture.
std::unique_ptr<TransientSuppressor> transient_suppressor;
#if WEBRTC_INTELLIGIBILITY_ENHANCER
std::unique_ptr<IntelligibilityEnhancer> intelligibility_enhancer;
#endif
};
struct AudioProcessingImpl::ApmPrivateSubmodules {
@ -321,7 +333,9 @@ int AudioProcessingImpl::InitializeLocked() {
InitializeExperimentalAgc();
InitializeTransient();
InitializeBeamformer();
#if WEBRTC_INTELLIGIBILITY_ENHANCER
InitializeIntelligibility();
#endif
InitializeHighPassFilter();
InitializeNoiseSuppression();
InitializeLevelEstimator();
@ -423,12 +437,14 @@ void AudioProcessingImpl::SetExtraOptions(const Config& config) {
InitializeLevelController();
}
#if WEBRTC_INTELLIGIBILITY_ENHANCER
if(capture_nonlocked_.intelligibility_enabled !=
config.Get<Intelligibility>().enabled) {
capture_nonlocked_.intelligibility_enabled =
config.Get<Intelligibility>().enabled;
InitializeIntelligibility();
}
#endif
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
if (capture_nonlocked_.beamformer_enabled !=
@ -725,6 +741,7 @@ int AudioProcessingImpl::ProcessStreamLocked() {
ca->CopyLowPassToReference();
}
public_submodules_->noise_suppression->ProcessCaptureAudio(ca);
#if WEBRTC_INTELLIGIBILITY_ENHANCER
if (capture_nonlocked_.intelligibility_enabled) {
RTC_DCHECK(public_submodules_->noise_suppression->is_enabled());
int gain_db = public_submodules_->gain_control->is_enabled() ?
@ -737,6 +754,7 @@ int AudioProcessingImpl::ProcessStreamLocked() {
public_submodules_->intelligibility_enhancer->SetCaptureNoiseEstimate(
public_submodules_->noise_suppression->NoiseEstimate(), gain);
}
#endif
// Ensure that the stream delay was set before the call to the
// AECM ProcessCaptureAudio function.
@ -936,11 +954,13 @@ int AudioProcessingImpl::ProcessReverseStreamLocked() {
ra->SplitIntoFrequencyBands();
}
#if WEBRTC_INTELLIGIBILITY_ENHANCER
if (capture_nonlocked_.intelligibility_enabled) {
public_submodules_->intelligibility_enhancer->ProcessRenderAudio(
ra->split_channels_f(kBand0To8kHz), capture_nonlocked_.split_rate,
ra->num_channels());
}
#endif
RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessRenderAudio(ra));
RETURN_ON_ERR(
@ -1172,7 +1192,11 @@ bool AudioProcessingImpl::fwd_analysis_needed() const {
}
bool AudioProcessingImpl::is_rev_processed() const {
#if WEBRTC_INTELLIGIBILITY_ENHANCER
return capture_nonlocked_.intelligibility_enabled;
#else
return false;
#endif
}
bool AudioProcessingImpl::rev_synthesis_needed() const {
@ -1237,12 +1261,14 @@ void AudioProcessingImpl::InitializeBeamformer() {
}
void AudioProcessingImpl::InitializeIntelligibility() {
#if WEBRTC_INTELLIGIBILITY_ENHANCER
if (capture_nonlocked_.intelligibility_enabled) {
public_submodules_->intelligibility_enhancer.reset(
new IntelligibilityEnhancer(capture_nonlocked_.split_rate,
render_.render_audio->num_channels(),
NoiseSuppressionImpl::num_noise_bins()));
}
#endif
}
void AudioProcessingImpl::InitializeHighPassFilter() {

View File

@ -61,22 +61,29 @@
'beamformer/nonlinear_beamformer_test.cc',
],
}, # nonlinear_beamformer_test
{
'target_name': 'intelligibility_proc',
'type': 'executable',
'dependencies': [
'audioproc_test_utils',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(webrtc_root)/modules/modules.gyp:audio_processing',
'<(webrtc_root)/test/test.gyp:test_support',
],
'sources': [
'intelligibility/test/intelligibility_proc.cc',
],
}, # intelligibility_proc
],
'conditions': [
['enable_intelligibility_enhancer==1', {
'defines': ['WEBRTC_INTELLIGIBILITY_ENHANCER=1',],
'targets': [
{
'target_name': 'intelligibility_proc',
'type': 'executable',
'dependencies': [
'audioproc_test_utils',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(webrtc_root)/modules/modules.gyp:audio_processing',
'<(webrtc_root)/test/test.gyp:test_support',
],
'sources': [
'intelligibility/test/intelligibility_proc.cc',
],
},
],
}, {
'defines': ['WEBRTC_INTELLIGIBILITY_ENHANCER=0',],
}],
['enable_protobuf==1', {
'targets': [
{

View File

@ -249,8 +249,6 @@
'audio_processing/beamformer/mock_nonlinear_beamformer.h',
'audio_processing/beamformer/nonlinear_beamformer_unittest.cc',
'audio_processing/echo_cancellation_impl_unittest.cc',
'audio_processing/intelligibility/intelligibility_enhancer_unittest.cc',
'audio_processing/intelligibility/intelligibility_utils_unittest.cc',
'audio_processing/splitting_filter_unittest.cc',
'audio_processing/transient/dyadic_decimator_unittest.cc',
'audio_processing/transient/file_utils.cc',
@ -398,6 +396,15 @@
'video_processing/test/video_processing_unittest.h',
],
'conditions': [
['enable_intelligibility_enhancer==1', {
'defines': ['WEBRTC_INTELLIGIBILITY_ENHANCER=1',],
'sources': [
'audio_processing/intelligibility/intelligibility_enhancer_unittest.cc',
'audio_processing/intelligibility/intelligibility_utils_unittest.cc',
],
}, {
'defines': ['WEBRTC_INTELLIGIBILITY_ENHANCER=0',],
}],
['libvpx_build_vp9==1', {
'sources': [
'video_coding/codecs/vp9/vp9_screenshare_layers_unittest.cc',