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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 } | 115 } |
116 | 116 |
117 return result; | 117 return result; |
118 } | 118 } |
119 | 119 |
120 // Works for positive numbers only. | 120 // Works for positive numbers only. |
121 size_t Round(float x) { | 121 size_t Round(float x) { |
122 return static_cast<size_t>(std::floor(x + 0.5f)); | 122 return static_cast<size_t>(std::floor(x + 0.5f)); |
123 } | 123 } |
124 | 124 |
125 // Calculates the sum of absolute values of a complex matrix. | |
126 float SumAbs(const ComplexMatrix<float>& mat) { | |
127 float sum_abs = 0.f; | |
128 const complex<float>* const* mat_els = mat.elements(); | |
129 for (size_t i = 0; i < mat.num_rows(); ++i) { | |
130 for (size_t j = 0; j < mat.num_columns(); ++j) { | |
131 sum_abs += std::abs(mat_els[i][j]); | |
132 } | |
133 } | |
134 return sum_abs; | |
135 } | |
136 | |
137 // Calculates the sum of squares of a complex matrix. | 125 // Calculates the sum of squares of a complex matrix. |
138 float SumSquares(const ComplexMatrix<float>& mat) { | 126 float SumSquares(const ComplexMatrix<float>& mat) { |
139 float sum_squares = 0.f; | 127 float sum_squares = 0.f; |
140 const complex<float>* const* mat_els = mat.elements(); | 128 const complex<float>* const* mat_els = mat.elements(); |
141 for (size_t i = 0; i < mat.num_rows(); ++i) { | 129 for (size_t i = 0; i < mat.num_rows(); ++i) { |
142 for (size_t j = 0; j < mat.num_columns(); ++j) { | 130 for (size_t j = 0; j < mat.num_columns(); ++j) { |
143 float abs_value = std::abs(mat_els[i][j]); | 131 float abs_value = std::abs(mat_els[i][j]); |
144 sum_squares += abs_value * abs_value; | 132 sum_squares += abs_value * abs_value; |
145 } | 133 } |
146 } | 134 } |
(...skipping 29 matching lines...) Expand all Loading... | |
176 return array_geometry; | 164 return array_geometry; |
177 } | 165 } |
178 | 166 |
179 } // namespace | 167 } // namespace |
180 | 168 |
181 const float NonlinearBeamformer::kHalfBeamWidthRadians = DegreesToRadians(20.f); | 169 const float NonlinearBeamformer::kHalfBeamWidthRadians = DegreesToRadians(20.f); |
182 | 170 |
183 // static | 171 // static |
184 const size_t NonlinearBeamformer::kNumFreqBins; | 172 const size_t NonlinearBeamformer::kNumFreqBins; |
185 | 173 |
174 PostFilterTransform::PostFilterTransform(size_t chunk_length, | |
175 float* window, | |
176 size_t fft_size) | |
177 : transform_(1u, 1u, chunk_length, window, fft_size, fft_size / 2, this), | |
178 num_freq_bins_(fft_size / 2 + 1) {} | |
179 | |
180 void PostFilterTransform::ProcessChunk(float* const* data, float* final_mask) { | |
181 final_mask_ = final_mask; | |
182 transform_.ProcessChunk(data, data); | |
183 } | |
184 | |
185 void PostFilterTransform::ProcessAudioBlock(const complex<float>* const* input, | |
186 size_t num_input_channels, | |
187 size_t num_freq_bins, | |
188 size_t num_output_channels, | |
189 complex<float>* const* output) { | |
190 RTC_CHECK_EQ(num_freq_bins_, num_freq_bins); | |
191 RTC_CHECK_EQ(1u, num_input_channels); | |
192 RTC_CHECK_EQ(1u, num_output_channels); | |
193 | |
194 for (size_t f_ix = 0; f_ix < num_freq_bins_; ++f_ix) { | |
195 output[0][f_ix] = kCompensationGain * final_mask_[f_ix] * input[0][f_ix]; | |
196 } | |
197 } | |
198 | |
186 NonlinearBeamformer::NonlinearBeamformer( | 199 NonlinearBeamformer::NonlinearBeamformer( |
187 const std::vector<Point>& array_geometry, | 200 const std::vector<Point>& array_geometry, |
188 SphericalPointf target_direction) | 201 SphericalPointf target_direction) |
189 : num_input_channels_(array_geometry.size()), | 202 : num_input_channels_(array_geometry.size()), |
190 array_geometry_(GetCenteredArray(array_geometry)), | 203 array_geometry_(GetCenteredArray(array_geometry)), |
191 array_normal_(GetArrayNormalIfExists(array_geometry)), | 204 array_normal_(GetArrayNormalIfExists(array_geometry)), |
192 min_mic_spacing_(GetMinimumSpacing(array_geometry)), | 205 min_mic_spacing_(GetMinimumSpacing(array_geometry)), |
193 target_angle_radians_(target_direction.azimuth()), | 206 target_angle_radians_(target_direction.azimuth()), |
194 away_radians_(std::min( | 207 away_radians_(std::min( |
195 static_cast<float>(M_PI), | 208 static_cast<float>(M_PI), |
196 std::max(kMinAwayRadians, | 209 std::max(kMinAwayRadians, |
197 kAwaySlope * static_cast<float>(M_PI) / min_mic_spacing_))) { | 210 kAwaySlope * static_cast<float>(M_PI) / min_mic_spacing_))) { |
198 WindowGenerator::KaiserBesselDerived(kKbdAlpha, kFftSize, window_); | 211 WindowGenerator::KaiserBesselDerived(kKbdAlpha, kFftSize, window_); |
199 } | 212 } |
200 | 213 |
201 void NonlinearBeamformer::Initialize(int chunk_size_ms, int sample_rate_hz) { | 214 void NonlinearBeamformer::Initialize(int chunk_size_ms, int sample_rate_hz) { |
202 chunk_length_ = | 215 chunk_length_ = |
203 static_cast<size_t>(sample_rate_hz / (1000.f / chunk_size_ms)); | 216 static_cast<size_t>(sample_rate_hz / (1000.f / chunk_size_ms)); |
204 sample_rate_hz_ = sample_rate_hz; | 217 sample_rate_hz_ = sample_rate_hz; |
205 | 218 |
206 high_pass_postfilter_mask_ = 1.f; | 219 high_pass_postfilter_mask_ = 1.f; |
207 is_target_present_ = false; | 220 is_target_present_ = false; |
208 hold_target_blocks_ = kHoldTargetSeconds * 2 * sample_rate_hz / kFftSize; | 221 hold_target_blocks_ = kHoldTargetSeconds * 2 * sample_rate_hz / kFftSize; |
209 interference_blocks_count_ = hold_target_blocks_; | 222 interference_blocks_count_ = hold_target_blocks_; |
210 | 223 |
211 lapped_transform_.reset(new LappedTransform(num_input_channels_, | 224 process_transform_.reset(new LappedTransform(num_input_channels_, |
212 1, | 225 1u, |
213 chunk_length_, | 226 chunk_length_, |
214 window_, | 227 window_, |
215 kFftSize, | 228 kFftSize, |
216 kFftSize / 2, | 229 kFftSize / 2, |
217 this)); | 230 this)); |
231 postfilter_transform_.reset(new PostFilterTransform( | |
232 chunk_length_, window_, kFftSize)); | |
233 dummy_out.reset(new ChannelBuffer<float>(chunk_length_, 1u)); | |
234 const float wave_number_step = | |
235 (2.f * M_PI * sample_rate_hz_) / (kFftSize * kSpeedOfSoundMeterSeconds); | |
218 for (size_t i = 0; i < kNumFreqBins; ++i) { | 236 for (size_t i = 0; i < kNumFreqBins; ++i) { |
219 time_smooth_mask_[i] = 1.f; | 237 time_smooth_mask_[i] = 1.f; |
220 final_mask_[i] = 1.f; | 238 final_mask_[i] = 1.f; |
221 float freq_hz = (static_cast<float>(i) / kFftSize) * sample_rate_hz_; | 239 wave_numbers_[i] = i * wave_number_step; |
222 wave_numbers_[i] = 2 * M_PI * freq_hz / kSpeedOfSoundMeterSeconds; | |
223 } | 240 } |
224 | 241 |
225 InitLowFrequencyCorrectionRanges(); | 242 InitLowFrequencyCorrectionRanges(); |
226 InitDiffuseCovMats(); | 243 InitDiffuseCovMats(); |
227 AimAt(SphericalPointf(target_angle_radians_, 0.f, 1.f)); | 244 AimAt(SphericalPointf(target_angle_radians_, 0.f, 1.f)); |
228 } | 245 } |
229 | 246 |
230 // These bin indexes determine the regions over which a mean is taken. This is | 247 // These bin indexes determine the regions over which a mean is taken. This is |
231 // applied as a constant value over the adjacent end "frequency correction" | 248 // applied as a constant value over the adjacent end "frequency correction" |
232 // regions. | 249 // regions. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 void NonlinearBeamformer::InitDelaySumMasks() { | 316 void NonlinearBeamformer::InitDelaySumMasks() { |
300 for (size_t f_ix = 0; f_ix < kNumFreqBins; ++f_ix) { | 317 for (size_t f_ix = 0; f_ix < kNumFreqBins; ++f_ix) { |
301 delay_sum_masks_[f_ix].Resize(1, num_input_channels_); | 318 delay_sum_masks_[f_ix].Resize(1, num_input_channels_); |
302 CovarianceMatrixGenerator::PhaseAlignmentMasks( | 319 CovarianceMatrixGenerator::PhaseAlignmentMasks( |
303 f_ix, kFftSize, sample_rate_hz_, kSpeedOfSoundMeterSeconds, | 320 f_ix, kFftSize, sample_rate_hz_, kSpeedOfSoundMeterSeconds, |
304 array_geometry_, target_angle_radians_, &delay_sum_masks_[f_ix]); | 321 array_geometry_, target_angle_radians_, &delay_sum_masks_[f_ix]); |
305 | 322 |
306 complex_f norm_factor = sqrt( | 323 complex_f norm_factor = sqrt( |
307 ConjugateDotProduct(delay_sum_masks_[f_ix], delay_sum_masks_[f_ix])); | 324 ConjugateDotProduct(delay_sum_masks_[f_ix], delay_sum_masks_[f_ix])); |
308 delay_sum_masks_[f_ix].Scale(1.f / norm_factor); | 325 delay_sum_masks_[f_ix].Scale(1.f / norm_factor); |
309 normalized_delay_sum_masks_[f_ix].CopyFrom(delay_sum_masks_[f_ix]); | |
310 normalized_delay_sum_masks_[f_ix].Scale(1.f / SumAbs( | |
311 normalized_delay_sum_masks_[f_ix])); | |
312 } | 326 } |
313 } | 327 } |
314 | 328 |
315 void NonlinearBeamformer::InitTargetCovMats() { | 329 void NonlinearBeamformer::InitTargetCovMats() { |
316 for (size_t i = 0; i < kNumFreqBins; ++i) { | 330 for (size_t i = 0; i < kNumFreqBins; ++i) { |
317 target_cov_mats_[i].Resize(num_input_channels_, num_input_channels_); | 331 target_cov_mats_[i].Resize(num_input_channels_, num_input_channels_); |
318 TransposedConjugatedProduct(delay_sum_masks_[i], &target_cov_mats_[i]); | 332 TransposedConjugatedProduct(delay_sum_masks_[i], &target_cov_mats_[i]); |
319 } | 333 } |
320 } | 334 } |
321 | 335 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 rpsiws_[i].push_back(Norm(*interf_cov_mats_[i][j], delay_sum_masks_[i])); | 378 rpsiws_[i].push_back(Norm(*interf_cov_mats_[i][j], delay_sum_masks_[i])); |
365 } | 379 } |
366 } | 380 } |
367 } | 381 } |
368 | 382 |
369 void NonlinearBeamformer::ProcessChunk(const ChannelBuffer<float>& input, | 383 void NonlinearBeamformer::ProcessChunk(const ChannelBuffer<float>& input, |
370 ChannelBuffer<float>* output) { | 384 ChannelBuffer<float>* output) { |
371 RTC_DCHECK_EQ(input.num_channels(), num_input_channels_); | 385 RTC_DCHECK_EQ(input.num_channels(), num_input_channels_); |
372 RTC_DCHECK_EQ(input.num_frames_per_band(), chunk_length_); | 386 RTC_DCHECK_EQ(input.num_frames_per_band(), chunk_length_); |
373 | 387 |
374 float old_high_pass_mask = high_pass_postfilter_mask_; | 388 old_high_pass_mask_ = high_pass_postfilter_mask_; |
375 lapped_transform_->ProcessChunk(input.channels(0), output->channels(0)); | 389 process_transform_->ProcessChunk(input.channels(0), dummy_out->channels(0)); |
peah-webrtc
2016/05/30 11:49:25
I think changing to interface would be much prefer
aluebs-webrtc
2016/06/01 00:16:34
The necessity of having a dummy_out has nothing to
| |
376 // Ramp up/down for smoothing. 1 mask per 10ms results in audible | 390 // Copy over only the first channel of each band. |
377 // discontinuities. | |
378 const float ramp_increment = | |
379 (high_pass_postfilter_mask_ - old_high_pass_mask) / | |
380 input.num_frames_per_band(); | |
381 // Apply the smoothed high-pass mask to the first channel of each band. | |
382 // This can be done because the effect of the linear beamformer is negligible | 391 // This can be done because the effect of the linear beamformer is negligible |
383 // compared to the post-filter. | 392 // compared to the post-filter. |
384 for (size_t i = 1; i < input.num_bands(); ++i) { | 393 for (size_t i = 0; i < input.num_bands(); ++i) { |
385 float smoothed_mask = old_high_pass_mask; | 394 memcpy(output->channels(i)[0], |
386 for (size_t j = 0; j < input.num_frames_per_band(); ++j) { | 395 input.channels(i)[0], |
396 input.num_frames_per_band() * sizeof(output->channels(i)[0][0])); | |
397 } | |
398 } | |
399 | |
400 void NonlinearBeamformer::PostFilter(ChannelBuffer<float>* data) { | |
401 RTC_DCHECK_EQ(data->num_frames_per_band(), chunk_length_); | |
402 | |
403 postfilter_transform_->ProcessChunk(data->channels(0), final_mask_); | |
404 | |
405 // Ramp up/down for smoothing is needed in order to avoid discontinuities in | |
406 // the transitions between 10 ms frames. | |
407 const float ramp_increment = | |
408 (high_pass_postfilter_mask_ - old_high_pass_mask_) / | |
409 data->num_frames_per_band(); | |
410 for (size_t i = 1; i < data->num_bands(); ++i) { | |
411 float smoothed_mask = old_high_pass_mask_; | |
412 for (size_t j = 0; j < data->num_frames_per_band(); ++j) { | |
387 smoothed_mask += ramp_increment; | 413 smoothed_mask += ramp_increment; |
388 output->channels(i)[0][j] = input.channels(i)[0][j] * smoothed_mask; | 414 data->channels(i)[0][j] *= smoothed_mask; |
389 } | 415 } |
390 } | 416 } |
391 } | 417 } |
392 | 418 |
393 void NonlinearBeamformer::AimAt(const SphericalPointf& target_direction) { | 419 void NonlinearBeamformer::AimAt(const SphericalPointf& target_direction) { |
394 target_angle_radians_ = target_direction.azimuth(); | 420 target_angle_radians_ = target_direction.azimuth(); |
395 InitHighFrequencyCorrectionRanges(); | 421 InitHighFrequencyCorrectionRanges(); |
396 InitInterfAngles(); | 422 InitInterfAngles(); |
397 InitDelaySumMasks(); | 423 InitDelaySumMasks(); |
398 InitTargetCovMats(); | 424 InitTargetCovMats(); |
399 InitInterfCovMats(); | 425 InitInterfCovMats(); |
400 NormalizeCovMats(); | 426 NormalizeCovMats(); |
401 } | 427 } |
402 | 428 |
403 bool NonlinearBeamformer::IsInBeam(const SphericalPointf& spherical_point) { | 429 bool NonlinearBeamformer::IsInBeam(const SphericalPointf& spherical_point) { |
404 // If more than half-beamwidth degrees away from the beam's center, | 430 // If more than half-beamwidth degrees away from the beam's center, |
405 // you are out of the beam. | 431 // you are out of the beam. |
406 return fabs(spherical_point.azimuth() - target_angle_radians_) < | 432 return fabs(spherical_point.azimuth() - target_angle_radians_) < |
407 kHalfBeamWidthRadians; | 433 kHalfBeamWidthRadians; |
408 } | 434 } |
409 | 435 |
410 void NonlinearBeamformer::ProcessAudioBlock(const complex_f* const* input, | 436 void NonlinearBeamformer::ProcessAudioBlock(const complex_f* const* input, |
411 size_t num_input_channels, | 437 size_t num_input_channels, |
412 size_t num_freq_bins, | 438 size_t num_freq_bins, |
413 size_t num_output_channels, | 439 size_t num_output_channels, |
peah-webrtc
2016/05/30 11:49:25
With this implementation, the last two parameters
aluebs-webrtc
2016/06/01 00:16:34
Good point! Using 0 output channels achieves this.
| |
414 complex_f* const* output) { | 440 complex_f* const* output) { |
415 RTC_CHECK_EQ(kNumFreqBins, num_freq_bins); | 441 RTC_CHECK_EQ(kNumFreqBins, num_freq_bins); |
416 RTC_CHECK_EQ(num_input_channels_, num_input_channels); | 442 RTC_CHECK_EQ(num_input_channels_, num_input_channels); |
417 RTC_CHECK_EQ(1u, num_output_channels); | 443 RTC_CHECK_EQ(1u, num_output_channels); |
peah-webrtc
2016/05/30 11:49:25
I guess this CHECK can be removed, right?
aluebs-webrtc
2016/06/01 00:16:34
I changed it to 0 to make sure it only does synthe
| |
418 | 444 |
419 // Calculating the post-filter masks. Note that we need two for each | 445 // Calculating the post-filter masks. Note that we need two for each |
420 // frequency bin to account for the positive and negative interferer | 446 // frequency bin to account for the positive and negative interferer |
421 // angle. | 447 // angle. |
422 for (size_t i = low_mean_start_bin_; i <= high_mean_end_bin_; ++i) { | 448 for (size_t i = low_mean_start_bin_; i <= high_mean_end_bin_; ++i) { |
423 eig_m_.CopyFromColumn(input, i, num_input_channels_); | 449 eig_m_.CopyFromColumn(input, i, num_input_channels_); |
424 float eig_m_norm_factor = std::sqrt(SumSquares(eig_m_)); | 450 float eig_m_norm_factor = std::sqrt(SumSquares(eig_m_)); |
425 if (eig_m_norm_factor != 0.f) { | 451 if (eig_m_norm_factor != 0.f) { |
426 eig_m_.Scale(1.f / eig_m_norm_factor); | 452 eig_m_.Scale(1.f / eig_m_norm_factor); |
427 } | 453 } |
(...skipping 21 matching lines...) Expand all Loading... | |
449 new_mask_[i] = tmp_mask; | 475 new_mask_[i] = tmp_mask; |
450 } | 476 } |
451 } | 477 } |
452 } | 478 } |
453 | 479 |
454 ApplyMaskTimeSmoothing(); | 480 ApplyMaskTimeSmoothing(); |
455 EstimateTargetPresence(); | 481 EstimateTargetPresence(); |
456 ApplyLowFrequencyCorrection(); | 482 ApplyLowFrequencyCorrection(); |
457 ApplyHighFrequencyCorrection(); | 483 ApplyHighFrequencyCorrection(); |
458 ApplyMaskFrequencySmoothing(); | 484 ApplyMaskFrequencySmoothing(); |
459 ApplyMasks(input, output); | |
460 } | 485 } |
461 | 486 |
462 float NonlinearBeamformer::CalculatePostfilterMask( | 487 float NonlinearBeamformer::CalculatePostfilterMask( |
463 const ComplexMatrixF& interf_cov_mat, | 488 const ComplexMatrixF& interf_cov_mat, |
464 float rpsiw, | 489 float rpsiw, |
465 float ratio_rxiw_rxim, | 490 float ratio_rxiw_rxim, |
466 float rmw_r) { | 491 float rmw_r) { |
467 float rpsim = Norm(interf_cov_mat, eig_m_); | 492 float rpsim = Norm(interf_cov_mat, eig_m_); |
468 | 493 |
469 float ratio = 0.f; | 494 float ratio = 0.f; |
470 if (rpsim > 0.f) { | 495 if (rpsim > 0.f) { |
471 ratio = rpsiw / rpsim; | 496 ratio = rpsiw / rpsim; |
472 } | 497 } |
473 | 498 |
474 float numerator = 1.f - kCutOffConstant; | 499 float numerator = 1.f - kCutOffConstant; |
475 if (rmw_r > 0.f) { | 500 if (rmw_r > 0.f) { |
476 numerator = 1.f - std::min(kCutOffConstant, ratio / rmw_r); | 501 numerator = 1.f - std::min(kCutOffConstant, ratio / rmw_r); |
477 } | 502 } |
478 | 503 |
479 float denominator = 1.f - kCutOffConstant; | 504 float denominator = 1.f - kCutOffConstant; |
480 if (ratio_rxiw_rxim > 0.f) { | 505 if (ratio_rxiw_rxim > 0.f) { |
481 denominator = 1.f - std::min(kCutOffConstant, ratio / ratio_rxiw_rxim); | 506 denominator = 1.f - std::min(kCutOffConstant, ratio / ratio_rxiw_rxim); |
482 } | 507 } |
483 | 508 |
484 return numerator / denominator; | 509 return numerator / denominator; |
485 } | 510 } |
486 | 511 |
487 void NonlinearBeamformer::ApplyMasks(const complex_f* const* input, | |
488 complex_f* const* output) { | |
489 complex_f* output_channel = output[0]; | |
490 for (size_t f_ix = 0; f_ix < kNumFreqBins; ++f_ix) { | |
491 output_channel[f_ix] = complex_f(0.f, 0.f); | |
492 | |
493 const complex_f* delay_sum_mask_els = | |
494 normalized_delay_sum_masks_[f_ix].elements()[0]; | |
495 for (size_t c_ix = 0; c_ix < num_input_channels_; ++c_ix) { | |
496 output_channel[f_ix] += input[c_ix][f_ix] * delay_sum_mask_els[c_ix]; | |
497 } | |
498 | |
499 output_channel[f_ix] *= kCompensationGain * final_mask_[f_ix]; | |
500 } | |
501 } | |
502 | |
503 // Smooth new_mask_ into time_smooth_mask_. | 512 // Smooth new_mask_ into time_smooth_mask_. |
504 void NonlinearBeamformer::ApplyMaskTimeSmoothing() { | 513 void NonlinearBeamformer::ApplyMaskTimeSmoothing() { |
505 for (size_t i = low_mean_start_bin_; i <= high_mean_end_bin_; ++i) { | 514 for (size_t i = low_mean_start_bin_; i <= high_mean_end_bin_; ++i) { |
506 time_smooth_mask_[i] = kMaskTimeSmoothAlpha * new_mask_[i] + | 515 time_smooth_mask_[i] = kMaskTimeSmoothAlpha * new_mask_[i] + |
507 (1 - kMaskTimeSmoothAlpha) * time_smooth_mask_[i]; | 516 (1 - kMaskTimeSmoothAlpha) * time_smooth_mask_[i]; |
508 } | 517 } |
509 } | 518 } |
510 | 519 |
511 // Copy time_smooth_mask_ to final_mask_ and smooth over frequency. | 520 // Copy time_smooth_mask_ to final_mask_ and smooth over frequency. |
512 void NonlinearBeamformer::ApplyMaskFrequencySmoothing() { | 521 void NonlinearBeamformer::ApplyMaskFrequencySmoothing() { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
570 new_mask_ + high_mean_end_bin_ + 1); | 579 new_mask_ + high_mean_end_bin_ + 1); |
571 if (new_mask_[quantile] > kMaskTargetThreshold) { | 580 if (new_mask_[quantile] > kMaskTargetThreshold) { |
572 is_target_present_ = true; | 581 is_target_present_ = true; |
573 interference_blocks_count_ = 0; | 582 interference_blocks_count_ = 0; |
574 } else { | 583 } else { |
575 is_target_present_ = interference_blocks_count_++ < hold_target_blocks_; | 584 is_target_present_ = interference_blocks_count_++ < hold_target_blocks_; |
576 } | 585 } |
577 } | 586 } |
578 | 587 |
579 } // namespace webrtc | 588 } // namespace webrtc |
OLD | NEW |