Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Unified Diff: webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc

Issue 1388033002: Make the separation between target and interferer scenario depend on microphone spacing in Nonlinea… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@nlbf3
Patch Set: Widen beam Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc
diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc
index 6a30cbfbb3272a014f063ca07a7eb4d0c9949357..fec93778d872a6c4b53a0f98de45d0b3095f42d5 100644
--- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc
+++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc
@@ -36,6 +36,14 @@ const float kSpeedOfSoundMeterSeconds = 343;
// TODO(aluebs): Make the target angle dynamically settable.
const float kTargetAngleRadians = static_cast<float>(M_PI) / 2.f;
+// The minimum separation in radians between the target direction and a
Andrew MacDonald 2015/10/14 23:38:53 and an interferer
aluebs-webrtc 2015/10/17 00:54:49 Done.
+// interferer scenario.
+const float kMinAwayRadians = 0.2f;
+
+// The separation between the target direction and the closest interferer
+// scenario is proportional to this constant.
+const float kAwaySlope = 0.008f;
+
// When calculating the interference covariance matrix, this is the weight for
// the weighted average between the uniform covariance matrix and the angled
// covariance matrix.
@@ -183,6 +191,19 @@ std::vector<Point> GetCenteredArray(std::vector<Point> array_geometry) {
return array_geometry;
}
+float GetMinimumSpacing(std::vector<Point> array_geometry) {
Andrew MacDonald 2015/10/14 23:38:53 const reference
aluebs-webrtc 2015/10/17 00:54:50 Done.
+ float mic_spacing = Distance(array_geometry[0], array_geometry[1]);
+ for (size_t i = 0; i < (array_geometry.size() - 1); ++i) {
+ for (size_t j = i + 1; j < array_geometry.size(); ++j) {
+ float distance = Distance(array_geometry[i], array_geometry[j]);
Andrew MacDonald 2015/10/14 23:38:53 Not a big deal, but you're computing the first dis
aluebs-webrtc 2015/10/17 00:54:49 Good suggestion. Done.
+ if (distance < mic_spacing) {
+ mic_spacing = distance;
+ }
+ }
+ }
+ return mic_spacing;
+}
+
} // namespace
// static
@@ -190,8 +211,9 @@ const size_t NonlinearBeamformer::kNumFreqBins;
NonlinearBeamformer::NonlinearBeamformer(
const std::vector<Point>& array_geometry)
- : num_input_channels_(array_geometry.size()),
- array_geometry_(GetCenteredArray(array_geometry)) {
+ : num_input_channels_(array_geometry.size()),
+ array_geometry_(GetCenteredArray(array_geometry)),
+ mic_spacing_(GetMinimumSpacing(array_geometry)) {
WindowGenerator::KaiserBesselDerived(kKbdAlpha, kFftSize, window_);
}
@@ -254,8 +276,10 @@ void NonlinearBeamformer::Initialize(int chunk_size_ms, int sample_rate_hz) {
}
void NonlinearBeamformer::InitInterfAngles() {
- // TODO(aluebs): Make kAway dependent on the mic spacing.
- const float kAway = 0.5;
+ const float kAway =
+ std::min(static_cast<float>(M_PI),
+ std::max(kMinAwayRadians,
+ kAwaySlope * static_cast<float>(M_PI) / mic_spacing_));
interf_angles_radians_.clear();
// TODO(aluebs): When the target angle is settable, make sure the interferer

Powered by Google App Engine
This is Rietveld 408576698