Index: webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h |
diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h |
index 62d5d69168d228231bdd32b38791d19afef3418b..edf8c49d2b02b613f1146af40a96c2af1ca3c026 100644 |
--- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h |
+++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h |
@@ -31,7 +31,11 @@ class NonlinearBeamformer |
: public Beamformer<float>, |
public LappedTransform::Callback { |
public: |
- explicit NonlinearBeamformer(const std::vector<Point>& array_geometry); |
+ static const float kHalfBeamWidthRadians; |
+ |
+ explicit NonlinearBeamformer( |
+ const std::vector<Point>& array_geometry, |
+ SphericalPointf target_direction = SphericalPointf(M_PI / 2.f, 0.f, 1.f)); |
// Sample rate corresponds to the lower band. |
// Needs to be called before the NonlinearBeamformer can be used. |
@@ -44,6 +48,8 @@ class NonlinearBeamformer |
void ProcessChunk(const ChannelBuffer<float>& input, |
ChannelBuffer<float>* output) override; |
+ void AimAt(const SphericalPointf& target_direction) override; |
+ |
bool IsInBeam(const SphericalPointf& spherical_point) override; |
// After processing each block |is_target_present_| is set to true if the |
@@ -62,15 +68,21 @@ class NonlinearBeamformer |
complex<float>* const* output) override; |
private: |
+ FRIEND_TEST_ALL_PREFIXES(NonlinearBeamformerTest, |
+ InterfAnglesTakeAmbiguityIntoAccount); |
+ |
typedef Matrix<float> MatrixF; |
typedef ComplexMatrix<float> ComplexMatrixF; |
typedef complex<float> complex_f; |
- void InitFrequencyCorrectionRanges(); |
+ void InitLowFrequencyCorrectionRanges(); |
+ void InitHighFrequencyCorrectionRanges(); |
void InitInterfAngles(); |
void InitDelaySumMasks(); |
void InitTargetCovMats(); |
+ void InitDiffuseCovMats(); |
void InitInterfCovMats(); |
+ void NormalizeCovMats(); |
// Calculates postfilter masks that minimize the mean squared error of our |
// estimation of the desired signal. |
@@ -116,6 +128,8 @@ class NonlinearBeamformer |
int sample_rate_hz_; |
const std::vector<Point> array_geometry_; |
+ // The normal direction of the array if it has one and it is in the xy-plane. |
+ const rtc::Maybe<Point> array_normal_; |
// Minimum spacing between microphone pairs. |
const float min_mic_spacing_; |
@@ -133,17 +147,20 @@ class NonlinearBeamformer |
// Time and frequency smoothed mask. |
float final_mask_[kNumFreqBins]; |
+ float target_angle_radians_; |
// Angles of the interferer scenarios. |
std::vector<float> interf_angles_radians_; |
+ // The angle between the target and the interferer scenarios. |
+ const float away_radians_; |
// Array of length |kNumFreqBins|, Matrix of size |1| x |num_channels_|. |
ComplexMatrixF delay_sum_masks_[kNumFreqBins]; |
ComplexMatrixF normalized_delay_sum_masks_[kNumFreqBins]; |
- // Array of length |kNumFreqBins|, Matrix of size |num_input_channels_| x |
+ // Arrays of length |kNumFreqBins|, Matrix of size |num_input_channels_| x |
// |num_input_channels_|. |
ComplexMatrixF target_cov_mats_[kNumFreqBins]; |
- |
+ ComplexMatrixF uniform_cov_mat_[kNumFreqBins]; |
// Array of length |kNumFreqBins|, Matrix of size |num_input_channels_| x |
// |num_input_channels_|. ScopedVector has a size equal to the number of |
// interferer scenarios. |