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. # Enables the use of protocol buffers for debug recordings.
'enable_protobuf%': 1, '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. # Disable these to not build components which can be externally provided.
'build_expat%': 1, 'build_expat%': 1,
'build_json%': 1, 'build_json%': 1,

View File

@ -36,6 +36,9 @@ declare_args() {
# Enables the use of protocol buffers for debug recordings. # Enables the use of protocol buffers for debug recordings.
rtc_enable_protobuf = true 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. # Disable these to not build components which can be externally provided.
rtc_build_expat = true rtc_build_expat = true
rtc_build_json = 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 = [] include_dirs = []
if (rtc_build_libyuv) { if (rtc_build_libyuv) {
deps += [ "$rtc_libyuv_dir" ] deps += [ "$rtc_libyuv_dir" ]

View File

@ -64,6 +64,14 @@ const int kDefaultAudioDeviceId = 0;
constexpr int kNackRtpHistoryMs = 5000; 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. // Codec parameters for Opus.
// draft-spittka-payload-rtp-opus-03 // draft-spittka-payload-rtp-opus-03
@ -649,6 +657,11 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
} }
#endif #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(); webrtc::VoEAudioProcessing* voep = voe_wrapper_->processing();
if (options.echo_cancellation) { if (options.echo_cancellation) {

View File

@ -125,6 +125,11 @@
'<(DEPTH)/third_party/usrsctp/usrsctp.gyp:usrsctplib', '<(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', { ['build_with_chromium==1', {
'dependencies': [ 'dependencies': [
'<(webrtc_root)/modules/modules.gyp:video_capture', '<(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/mock_nonlinear_beamformer.h",
"audio_processing/beamformer/nonlinear_beamformer_unittest.cc", "audio_processing/beamformer/nonlinear_beamformer_unittest.cc",
"audio_processing/echo_cancellation_impl_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/splitting_filter_unittest.cc",
"audio_processing/transient/dyadic_decimator_unittest.cc", "audio_processing/transient/dyadic_decimator_unittest.cc",
"audio_processing/transient/file_utils.cc", "audio_processing/transient/file_utils.cc",
@ -348,6 +346,16 @@ if (rtc_include_tests) {
"video_processing/test/video_processing_unittest.h", "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) { if (rtc_libvpx_build_vp9) {
sources += sources +=
[ "video_coding/codecs/vp9/vp9_screenshare_layers_unittest.cc" ] [ "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.cc",
"high_pass_filter_impl.h", "high_pass_filter_impl.h",
"include/audio_processing.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.cc",
"level_controller/biquad_filter.h", "level_controller/biquad_filter.h",
"level_controller/down_sampler.cc", "level_controller/down_sampler.cc",
@ -182,6 +178,18 @@ source_set("audio_processing") {
deps += [ ":audioproc_debug_proto" ] 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) { if (rtc_prefer_fixed_point) {
defines += [ "WEBRTC_NS_FIXED" ] defines += [ "WEBRTC_NS_FIXED" ]
sources += [ sources += [
@ -481,6 +489,7 @@ if (rtc_include_tests) {
} }
} }
if (rtc_enable_intelligibility_enhancer) {
executable("intelligibility_proc") { executable("intelligibility_proc") {
testonly = true testonly = true
sources = [ sources = [
@ -499,6 +508,7 @@ if (rtc_include_tests) {
configs -= [ "//build/config/clang:find_bad_constructs" ] configs -= [ "//build/config/clang:find_bad_constructs" ]
} }
} }
}
if (rtc_enable_protobuf) { if (rtc_enable_protobuf) {
proto_library("audioproc_unittest_proto") { proto_library("audioproc_unittest_proto") {

View File

@ -85,10 +85,6 @@
'high_pass_filter_impl.cc', 'high_pass_filter_impl.cc',
'high_pass_filter_impl.h', 'high_pass_filter_impl.h',
'include/audio_processing.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.cc',
'level_controller/biquad_filter.h', 'level_controller/biquad_filter.h',
'level_controller/down_sampler.cc', 'level_controller/down_sampler.cc',
@ -184,6 +180,17 @@
'dependencies': ['audioproc_debug_proto'], 'dependencies': ['audioproc_debug_proto'],
'defines': ['WEBRTC_AUDIOPROC_DEBUG_DUMP'], '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', { ['prefer_fixed_point==1', {
'defines': ['WEBRTC_NS_FIXED'], 'defines': ['WEBRTC_NS_FIXED'],
'sources': [ '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_for_experimental_agc.h"
#include "webrtc/modules/audio_processing/gain_control_impl.h" #include "webrtc/modules/audio_processing/gain_control_impl.h"
#include "webrtc/modules/audio_processing/high_pass_filter_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" #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_controller/level_controller.h"
#include "webrtc/modules/audio_processing/level_estimator_impl.h" #include "webrtc/modules/audio_processing/level_estimator_impl.h"
#include "webrtc/modules/audio_processing/noise_suppression_impl.h" #include "webrtc/modules/audio_processing/noise_suppression_impl.h"
@ -50,6 +52,14 @@
#endif #endif
#endif // WEBRTC_AUDIOPROC_DEBUG_DUMP #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) \ #define RETURN_ON_ERR(expr) \
do { \ do { \
int err = (expr); \ int err = (expr); \
@ -124,7 +134,9 @@ struct AudioProcessingImpl::ApmPublicSubmodules {
// Accessed internally from both render and capture. // Accessed internally from both render and capture.
std::unique_ptr<TransientSuppressor> transient_suppressor; std::unique_ptr<TransientSuppressor> transient_suppressor;
#if WEBRTC_INTELLIGIBILITY_ENHANCER
std::unique_ptr<IntelligibilityEnhancer> intelligibility_enhancer; std::unique_ptr<IntelligibilityEnhancer> intelligibility_enhancer;
#endif
}; };
struct AudioProcessingImpl::ApmPrivateSubmodules { struct AudioProcessingImpl::ApmPrivateSubmodules {
@ -321,7 +333,9 @@ int AudioProcessingImpl::InitializeLocked() {
InitializeExperimentalAgc(); InitializeExperimentalAgc();
InitializeTransient(); InitializeTransient();
InitializeBeamformer(); InitializeBeamformer();
#if WEBRTC_INTELLIGIBILITY_ENHANCER
InitializeIntelligibility(); InitializeIntelligibility();
#endif
InitializeHighPassFilter(); InitializeHighPassFilter();
InitializeNoiseSuppression(); InitializeNoiseSuppression();
InitializeLevelEstimator(); InitializeLevelEstimator();
@ -423,12 +437,14 @@ void AudioProcessingImpl::SetExtraOptions(const Config& config) {
InitializeLevelController(); InitializeLevelController();
} }
#if WEBRTC_INTELLIGIBILITY_ENHANCER
if(capture_nonlocked_.intelligibility_enabled != if(capture_nonlocked_.intelligibility_enabled !=
config.Get<Intelligibility>().enabled) { config.Get<Intelligibility>().enabled) {
capture_nonlocked_.intelligibility_enabled = capture_nonlocked_.intelligibility_enabled =
config.Get<Intelligibility>().enabled; config.Get<Intelligibility>().enabled;
InitializeIntelligibility(); InitializeIntelligibility();
} }
#endif
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
if (capture_nonlocked_.beamformer_enabled != if (capture_nonlocked_.beamformer_enabled !=
@ -725,6 +741,7 @@ int AudioProcessingImpl::ProcessStreamLocked() {
ca->CopyLowPassToReference(); ca->CopyLowPassToReference();
} }
public_submodules_->noise_suppression->ProcessCaptureAudio(ca); public_submodules_->noise_suppression->ProcessCaptureAudio(ca);
#if WEBRTC_INTELLIGIBILITY_ENHANCER
if (capture_nonlocked_.intelligibility_enabled) { if (capture_nonlocked_.intelligibility_enabled) {
RTC_DCHECK(public_submodules_->noise_suppression->is_enabled()); RTC_DCHECK(public_submodules_->noise_suppression->is_enabled());
int gain_db = public_submodules_->gain_control->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_->intelligibility_enhancer->SetCaptureNoiseEstimate(
public_submodules_->noise_suppression->NoiseEstimate(), gain); public_submodules_->noise_suppression->NoiseEstimate(), gain);
} }
#endif
// Ensure that the stream delay was set before the call to the // Ensure that the stream delay was set before the call to the
// AECM ProcessCaptureAudio function. // AECM ProcessCaptureAudio function.
@ -936,11 +954,13 @@ int AudioProcessingImpl::ProcessReverseStreamLocked() {
ra->SplitIntoFrequencyBands(); ra->SplitIntoFrequencyBands();
} }
#if WEBRTC_INTELLIGIBILITY_ENHANCER
if (capture_nonlocked_.intelligibility_enabled) { if (capture_nonlocked_.intelligibility_enabled) {
public_submodules_->intelligibility_enhancer->ProcessRenderAudio( public_submodules_->intelligibility_enhancer->ProcessRenderAudio(
ra->split_channels_f(kBand0To8kHz), capture_nonlocked_.split_rate, ra->split_channels_f(kBand0To8kHz), capture_nonlocked_.split_rate,
ra->num_channels()); ra->num_channels());
} }
#endif
RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessRenderAudio(ra)); RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessRenderAudio(ra));
RETURN_ON_ERR( RETURN_ON_ERR(
@ -1172,7 +1192,11 @@ bool AudioProcessingImpl::fwd_analysis_needed() const {
} }
bool AudioProcessingImpl::is_rev_processed() const { bool AudioProcessingImpl::is_rev_processed() const {
#if WEBRTC_INTELLIGIBILITY_ENHANCER
return capture_nonlocked_.intelligibility_enabled; return capture_nonlocked_.intelligibility_enabled;
#else
return false;
#endif
} }
bool AudioProcessingImpl::rev_synthesis_needed() const { bool AudioProcessingImpl::rev_synthesis_needed() const {
@ -1237,12 +1261,14 @@ void AudioProcessingImpl::InitializeBeamformer() {
} }
void AudioProcessingImpl::InitializeIntelligibility() { void AudioProcessingImpl::InitializeIntelligibility() {
#if WEBRTC_INTELLIGIBILITY_ENHANCER
if (capture_nonlocked_.intelligibility_enabled) { if (capture_nonlocked_.intelligibility_enabled) {
public_submodules_->intelligibility_enhancer.reset( public_submodules_->intelligibility_enhancer.reset(
new IntelligibilityEnhancer(capture_nonlocked_.split_rate, new IntelligibilityEnhancer(capture_nonlocked_.split_rate,
render_.render_audio->num_channels(), render_.render_audio->num_channels(),
NoiseSuppressionImpl::num_noise_bins())); NoiseSuppressionImpl::num_noise_bins()));
} }
#endif
} }
void AudioProcessingImpl::InitializeHighPassFilter() { void AudioProcessingImpl::InitializeHighPassFilter() {

View File

@ -61,6 +61,11 @@
'beamformer/nonlinear_beamformer_test.cc', 'beamformer/nonlinear_beamformer_test.cc',
], ],
}, # nonlinear_beamformer_test }, # nonlinear_beamformer_test
],
'conditions': [
['enable_intelligibility_enhancer==1', {
'defines': ['WEBRTC_INTELLIGIBILITY_ENHANCER=1',],
'targets': [
{ {
'target_name': 'intelligibility_proc', 'target_name': 'intelligibility_proc',
'type': 'executable', 'type': 'executable',
@ -74,9 +79,11 @@
'sources': [ 'sources': [
'intelligibility/test/intelligibility_proc.cc', 'intelligibility/test/intelligibility_proc.cc',
], ],
}, # intelligibility_proc },
], ],
'conditions': [ }, {
'defines': ['WEBRTC_INTELLIGIBILITY_ENHANCER=0',],
}],
['enable_protobuf==1', { ['enable_protobuf==1', {
'targets': [ 'targets': [
{ {

View File

@ -249,8 +249,6 @@
'audio_processing/beamformer/mock_nonlinear_beamformer.h', 'audio_processing/beamformer/mock_nonlinear_beamformer.h',
'audio_processing/beamformer/nonlinear_beamformer_unittest.cc', 'audio_processing/beamformer/nonlinear_beamformer_unittest.cc',
'audio_processing/echo_cancellation_impl_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/splitting_filter_unittest.cc',
'audio_processing/transient/dyadic_decimator_unittest.cc', 'audio_processing/transient/dyadic_decimator_unittest.cc',
'audio_processing/transient/file_utils.cc', 'audio_processing/transient/file_utils.cc',
@ -398,6 +396,15 @@
'video_processing/test/video_processing_unittest.h', 'video_processing/test/video_processing_unittest.h',
], ],
'conditions': [ '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', { ['libvpx_build_vp9==1', {
'sources': [ 'sources': [
'video_coding/codecs/vp9/vp9_screenshare_layers_unittest.cc', 'video_coding/codecs/vp9/vp9_screenshare_layers_unittest.cc',