Chromium Code Reviews| 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 4c79c01143344452dc1fd8a256d2a38d3a8de766..0ed1314ffcef512e95ad5dfd26ee58e8fb96d282 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,9 @@ class NonlinearBeamformer |
| int sample_rate_hz_; |
| const std::vector<Point> array_geometry_; |
| + // The normal direction of the array in the xy-plane. It is set to null Point |
|
Andrew MacDonald
2015/10/28 01:57:57
origin or zero
aluebs-webrtc
2015/10/29 00:34:21
Not necessary anymore, since using Maybe.
|
| + // if the array has no normal, or the normal is not in the xy-plane. |
| + const Point array_normal_; |
| // Minimum spacing between microphone pairs. |
| const float min_mic_spacing_; |
| @@ -133,17 +148,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. |