| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // applied as a constant value over the adjacent end "frequency correction" | 260 // applied as a constant value over the adjacent end "frequency correction" |
| 261 // regions. | 261 // regions. |
| 262 // | 262 // |
| 263 // low_mean_start_bin_ high_mean_start_bin_ | 263 // low_mean_start_bin_ high_mean_start_bin_ |
| 264 // v v constant | 264 // v v constant |
| 265 // |----------------|--------|----------------|-------|----------------| | 265 // |----------------|--------|----------------|-------|----------------| |
| 266 // constant ^ ^ | 266 // constant ^ ^ |
| 267 // low_mean_end_bin_ high_mean_end_bin_ | 267 // low_mean_end_bin_ high_mean_end_bin_ |
| 268 // | 268 // |
| 269 void NonlinearBeamformer::InitLowFrequencyCorrectionRanges() { | 269 void NonlinearBeamformer::InitLowFrequencyCorrectionRanges() { |
| 270 low_mean_start_bin_ = Round(kLowMeanStartHz * kFftSize / sample_rate_hz_); | 270 low_mean_start_bin_ = Round(static_cast<float>(kLowMeanStartHz) * |
| 271 low_mean_end_bin_ = Round(kLowMeanEndHz * kFftSize / sample_rate_hz_); | 271 kFftSize / sample_rate_hz_); |
| 272 low_mean_end_bin_ = Round(static_cast<float>(kLowMeanEndHz) * |
| 273 kFftSize / sample_rate_hz_); |
| 272 | 274 |
| 273 RTC_DCHECK_GT(low_mean_start_bin_, 0U); | 275 RTC_DCHECK_GT(low_mean_start_bin_, 0U); |
| 274 RTC_DCHECK_LT(low_mean_start_bin_, low_mean_end_bin_); | 276 RTC_DCHECK_LT(low_mean_start_bin_, low_mean_end_bin_); |
| 275 } | 277 } |
| 276 | 278 |
| 277 void NonlinearBeamformer::InitHighFrequencyCorrectionRanges() { | 279 void NonlinearBeamformer::InitHighFrequencyCorrectionRanges() { |
| 278 const float kAliasingFreqHz = | 280 const float kAliasingFreqHz = |
| 279 kSpeedOfSoundMeterSeconds / | 281 kSpeedOfSoundMeterSeconds / |
| 280 (min_mic_spacing_ * (1.f + std::abs(std::cos(target_angle_radians_)))); | 282 (min_mic_spacing_ * (1.f + std::abs(std::cos(target_angle_radians_)))); |
| 281 const float kHighMeanStartHz = std::min(0.5f * kAliasingFreqHz, | 283 const float kHighMeanStartHz = std::min(0.5f * kAliasingFreqHz, |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 new_mask_ + high_mean_end_bin_ + 1); | 590 new_mask_ + high_mean_end_bin_ + 1); |
| 589 if (new_mask_[quantile] > kMaskTargetThreshold) { | 591 if (new_mask_[quantile] > kMaskTargetThreshold) { |
| 590 is_target_present_ = true; | 592 is_target_present_ = true; |
| 591 interference_blocks_count_ = 0; | 593 interference_blocks_count_ = 0; |
| 592 } else { | 594 } else { |
| 593 is_target_present_ = interference_blocks_count_++ < hold_target_blocks_; | 595 is_target_present_ = interference_blocks_count_++ < hold_target_blocks_; |
| 594 } | 596 } |
| 595 } | 597 } |
| 596 | 598 |
| 597 } // namespace webrtc | 599 } // namespace webrtc |
| OLD | NEW |