| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 return ret; | 52 return ret; |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Computes the power across ERB bands from the power spectral density |pow|. | 55 // Computes the power across ERB bands from the power spectral density |pow|. |
| 56 // Stores it in |result|. | 56 // Stores it in |result|. |
| 57 void MapToErbBands(const float* pow, | 57 void MapToErbBands(const float* pow, |
| 58 const std::vector<std::vector<float>>& filter_bank, | 58 const std::vector<std::vector<float>>& filter_bank, |
| 59 float* result) { | 59 float* result) { |
| 60 for (size_t i = 0; i < filter_bank.size(); ++i) { | 60 for (size_t i = 0; i < filter_bank.size(); ++i) { |
| 61 RTC_DCHECK_GT(filter_bank[i].size(), 0u); | 61 RTC_DCHECK_GT(filter_bank[i].size(), 0); |
| 62 result[i] = kPowerNormalizationFactor * | 62 result[i] = kPowerNormalizationFactor * |
| 63 DotProduct(filter_bank[i].data(), pow, filter_bank[i].size()); | 63 DotProduct(filter_bank[i].data(), pow, filter_bank[i].size()); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace | 67 } // namespace |
| 68 | 68 |
| 69 IntelligibilityEnhancer::IntelligibilityEnhancer(int sample_rate_hz, | 69 IntelligibilityEnhancer::IntelligibilityEnhancer(int sample_rate_hz, |
| 70 size_t num_render_channels, | 70 size_t num_render_channels, |
| 71 size_t num_bands, | 71 size_t num_bands, |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 vad_.ProcessChunk(audio_s16_.data(), chunk_length_, sample_rate_hz_); | 373 vad_.ProcessChunk(audio_s16_.data(), chunk_length_, sample_rate_hz_); |
| 374 if (vad_.last_voice_probability() > kVoiceProbabilityThreshold) { | 374 if (vad_.last_voice_probability() > kVoiceProbabilityThreshold) { |
| 375 chunks_since_voice_ = 0; | 375 chunks_since_voice_ = 0; |
| 376 } else if (chunks_since_voice_ < kSpeechOffsetDelay) { | 376 } else if (chunks_since_voice_ < kSpeechOffsetDelay) { |
| 377 ++chunks_since_voice_; | 377 ++chunks_since_voice_; |
| 378 } | 378 } |
| 379 return chunks_since_voice_ < kSpeechOffsetDelay; | 379 return chunks_since_voice_ < kSpeechOffsetDelay; |
| 380 } | 380 } |
| 381 | 381 |
| 382 void IntelligibilityEnhancer::DelayHighBands(AudioBuffer* audio) { | 382 void IntelligibilityEnhancer::DelayHighBands(AudioBuffer* audio) { |
| 383 RTC_DCHECK_EQ(audio->num_bands(), high_bands_buffers_.size() + 1u); | 383 RTC_DCHECK_EQ(audio->num_bands(), high_bands_buffers_.size() + 1); |
| 384 for (size_t i = 0u; i < high_bands_buffers_.size(); ++i) { | 384 for (size_t i = 0u; i < high_bands_buffers_.size(); ++i) { |
| 385 Band band = static_cast<Band>(i + 1); | 385 Band band = static_cast<Band>(i + 1); |
| 386 high_bands_buffers_[i]->Delay(audio->split_channels_f(band), chunk_length_); | 386 high_bands_buffers_[i]->Delay(audio->split_channels_f(band), chunk_length_); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace webrtc | 390 } // namespace webrtc |
| OLD | NEW |