Chromium Code Reviews| 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 66ad6259a3690c31f96668c6d9c206ed1ae9cca7..6925b617624579bcc70804b25ef1456af88757cf 100644 |
| --- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc |
| +++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc |
| @@ -120,7 +120,7 @@ complex<float> ConjugateDotProduct(const ComplexMatrix<float>& lhs, |
| // Works for positive numbers only. |
| int Round(float x) { |
| - return std::floor(x + 0.5f); |
| + return static_cast<int>(std::floor(x + 0.5f)); |
| } |
| // Calculates the sum of absolute values of a complex matrix. |
| @@ -464,9 +464,9 @@ void NonlinearBeamformer::ApplyMaskFrequencySmoothing() { |
| final_mask_[i] = kMaskFrequencySmoothAlpha * final_mask_[i] + |
| (1 - kMaskFrequencySmoothAlpha) * final_mask_[i - 1]; |
| } |
| - for (int i = high_mean_end_bin_; i >= 0; --i) { |
| - final_mask_[i] = kMaskFrequencySmoothAlpha * final_mask_[i] + |
| - (1 - kMaskFrequencySmoothAlpha) * final_mask_[i + 1]; |
| + for (int i = high_mean_end_bin_ + 1; i > 0; --i) { |
| + final_mask_[i - 1] = kMaskFrequencySmoothAlpha * final_mask_[i - 1] + |
| + (1 - kMaskFrequencySmoothAlpha) * final_mask_[i]; |
|
Peter Kasting
2015/07/10 18:48:46
This form is safe against underflow if |i| becomes
|
| } |
| } |