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

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

Issue 1211613005: Adding method IsInBeam to beamformer class. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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 1e03c853fe05909eb4a98251b1c8b097578301f9..f3fc6b2175241bf6e118fa9e57e3829d49852287 100644
--- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc
+++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc
@@ -50,6 +50,9 @@ const float kInterfAngleRadians = static_cast<float>(M_PI) / 4.f;
// Rpsi = Rpsi_angled * kBalance + Rpsi_uniform * (1 - kBalance)
const float kBalance = 0.4f;
+// The width of half of the beam in radians.
+const float kBeamWidthAngle = static_cast<float>(M_PI)20.f / 180.f;
aluebs-webrtc 2015/06/25 01:04:36 const float kBeamWidthAngle = static_cast<float>(M
Andrew MacDonald 2015/06/26 02:04:24 I think you can omit the cast.
bloch 2015/06/26 03:37:28 I tried it without the cast and there were some co
Andrew MacDonald 2015/06/26 03:46:09 OK, thanks for trying.
+
// TODO(claguna): need comment here.
const float kBeamwidthConstant = 0.00002f;
@@ -334,6 +337,12 @@ void NonlinearBeamformer::ProcessChunk(const ChannelBuffer<float>& input,
}
}
+bool NonlinearBeamformer::IsInBeam(float azimuth) {
+ // If more than half-beamwidth degrees away from the beam's center,
+ // you are out of the beam.
+ return fabs(azimuth - kTargetAngleRadians) < kBeamWidthAngle;
+}
+
void NonlinearBeamformer::ProcessAudioBlock(const complex_f* const* input,
int num_input_channels,
int num_freq_bins,

Powered by Google App Engine
This is Rietveld 408576698