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

Side by Side Diff: webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.cc

Issue 2288593004: Fix Chromium clang plugin warnings (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 array_normal_(GetArrayNormalIfExists(array_geometry)), 215 array_normal_(GetArrayNormalIfExists(array_geometry)),
216 min_mic_spacing_(GetMinimumSpacing(array_geometry)), 216 min_mic_spacing_(GetMinimumSpacing(array_geometry)),
217 target_angle_radians_(target_direction.azimuth()), 217 target_angle_radians_(target_direction.azimuth()),
218 away_radians_(std::min( 218 away_radians_(std::min(
219 static_cast<float>(M_PI), 219 static_cast<float>(M_PI),
220 std::max(kMinAwayRadians, 220 std::max(kMinAwayRadians,
221 kAwaySlope * static_cast<float>(M_PI) / min_mic_spacing_))) { 221 kAwaySlope * static_cast<float>(M_PI) / min_mic_spacing_))) {
222 WindowGenerator::KaiserBesselDerived(kKbdAlpha, kFftSize, window_); 222 WindowGenerator::KaiserBesselDerived(kKbdAlpha, kFftSize, window_);
223 } 223 }
224 224
225 NonlinearBeamformer::~NonlinearBeamformer() = default;
226
225 void NonlinearBeamformer::Initialize(int chunk_size_ms, int sample_rate_hz) { 227 void NonlinearBeamformer::Initialize(int chunk_size_ms, int sample_rate_hz) {
226 chunk_length_ = 228 chunk_length_ =
227 static_cast<size_t>(sample_rate_hz / (1000.f / chunk_size_ms)); 229 static_cast<size_t>(sample_rate_hz / (1000.f / chunk_size_ms));
228 sample_rate_hz_ = sample_rate_hz; 230 sample_rate_hz_ = sample_rate_hz;
229 231
230 high_pass_postfilter_mask_ = 1.f; 232 high_pass_postfilter_mask_ = 1.f;
231 is_target_present_ = false; 233 is_target_present_ = false;
232 hold_target_blocks_ = kHoldTargetSeconds * 2 * sample_rate_hz / kFftSize; 234 hold_target_blocks_ = kHoldTargetSeconds * 2 * sample_rate_hz / kFftSize;
233 interference_blocks_count_ = hold_target_blocks_; 235 interference_blocks_count_ = hold_target_blocks_;
234 236
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 NormalizeCovMats(); 433 NormalizeCovMats();
432 } 434 }
433 435
434 bool NonlinearBeamformer::IsInBeam(const SphericalPointf& spherical_point) { 436 bool NonlinearBeamformer::IsInBeam(const SphericalPointf& spherical_point) {
435 // If more than half-beamwidth degrees away from the beam's center, 437 // If more than half-beamwidth degrees away from the beam's center,
436 // you are out of the beam. 438 // you are out of the beam.
437 return fabs(spherical_point.azimuth() - target_angle_radians_) < 439 return fabs(spherical_point.azimuth() - target_angle_radians_) <
438 kHalfBeamWidthRadians; 440 kHalfBeamWidthRadians;
439 } 441 }
440 442
443 bool NonlinearBeamformer::is_target_present() { return is_target_present_; }
444
441 void NonlinearBeamformer::ProcessAudioBlock(const complex_f* const* input, 445 void NonlinearBeamformer::ProcessAudioBlock(const complex_f* const* input,
442 size_t num_input_channels, 446 size_t num_input_channels,
443 size_t num_freq_bins, 447 size_t num_freq_bins,
444 size_t num_output_channels, 448 size_t num_output_channels,
445 complex_f* const* output) { 449 complex_f* const* output) {
446 RTC_CHECK_EQ(kNumFreqBins, num_freq_bins); 450 RTC_CHECK_EQ(kNumFreqBins, num_freq_bins);
447 RTC_CHECK_EQ(num_input_channels_, num_input_channels); 451 RTC_CHECK_EQ(num_input_channels_, num_input_channels);
448 RTC_CHECK_EQ(0u, num_output_channels); 452 RTC_CHECK_EQ(0u, num_output_channels);
449 453
450 // Calculating the post-filter masks. Note that we need two for each 454 // Calculating the post-filter masks. Note that we need two for each
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 new_mask_ + high_mean_end_bin_ + 1); 588 new_mask_ + high_mean_end_bin_ + 1);
585 if (new_mask_[quantile] > kMaskTargetThreshold) { 589 if (new_mask_[quantile] > kMaskTargetThreshold) {
586 is_target_present_ = true; 590 is_target_present_ = true;
587 interference_blocks_count_ = 0; 591 interference_blocks_count_ = 0;
588 } else { 592 } else {
589 is_target_present_ = interference_blocks_count_++ < hold_target_blocks_; 593 is_target_present_ = interference_blocks_count_++ < hold_target_blocks_;
590 } 594 }
591 } 595 }
592 596
593 } // namespace webrtc 597 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698