| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 using VarianceType = intelligibility::VarianceArray::StepType; | 47 using VarianceType = intelligibility::VarianceArray::StepType; |
| 48 | 48 |
| 49 IntelligibilityEnhancer::TransformCallback::TransformCallback( | 49 IntelligibilityEnhancer::TransformCallback::TransformCallback( |
| 50 IntelligibilityEnhancer* parent, | 50 IntelligibilityEnhancer* parent, |
| 51 IntelligibilityEnhancer::AudioSource source) | 51 IntelligibilityEnhancer::AudioSource source) |
| 52 : parent_(parent), source_(source) { | 52 : parent_(parent), source_(source) { |
| 53 } | 53 } |
| 54 | 54 |
| 55 void IntelligibilityEnhancer::TransformCallback::ProcessAudioBlock( | 55 void IntelligibilityEnhancer::TransformCallback::ProcessAudioBlock( |
| 56 const complex<float>* const* in_block, | 56 const complex<float>* const* in_block, |
| 57 int in_channels, | 57 size_t in_channels, |
| 58 size_t frames, | 58 size_t frames, |
| 59 int /* out_channels */, | 59 size_t /* out_channels */, |
| 60 complex<float>* const* out_block) { | 60 complex<float>* const* out_block) { |
| 61 RTC_DCHECK_EQ(parent_->freqs_, frames); | 61 RTC_DCHECK_EQ(parent_->freqs_, frames); |
| 62 for (int i = 0; i < in_channels; ++i) { | 62 for (size_t i = 0; i < in_channels; ++i) { |
| 63 parent_->DispatchAudio(source_, in_block[i], out_block[i]); | 63 parent_->DispatchAudio(source_, in_block[i], out_block[i]); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 IntelligibilityEnhancer::IntelligibilityEnhancer() | 67 IntelligibilityEnhancer::IntelligibilityEnhancer() |
| 68 : IntelligibilityEnhancer(IntelligibilityEnhancer::Config()) { | 68 : IntelligibilityEnhancer(IntelligibilityEnhancer::Config()) { |
| 69 } | 69 } |
| 70 | 70 |
| 71 IntelligibilityEnhancer::IntelligibilityEnhancer(const Config& config) | 71 IntelligibilityEnhancer::IntelligibilityEnhancer(const Config& config) |
| 72 : freqs_(RealFourier::ComplexLength( | 72 : freqs_(RealFourier::ComplexLength( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 render_mangler_.reset(new LappedTransform( | 122 render_mangler_.reset(new LappedTransform( |
| 123 num_render_channels_, num_render_channels_, chunk_length_, | 123 num_render_channels_, num_render_channels_, chunk_length_, |
| 124 kbd_window_.get(), window_size_, window_size_ / 2, &render_callback_)); | 124 kbd_window_.get(), window_size_, window_size_ / 2, &render_callback_)); |
| 125 capture_mangler_.reset(new LappedTransform( | 125 capture_mangler_.reset(new LappedTransform( |
| 126 num_capture_channels_, num_capture_channels_, chunk_length_, | 126 num_capture_channels_, num_capture_channels_, chunk_length_, |
| 127 kbd_window_.get(), window_size_, window_size_ / 2, &capture_callback_)); | 127 kbd_window_.get(), window_size_, window_size_ / 2, &capture_callback_)); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void IntelligibilityEnhancer::ProcessRenderAudio(float* const* audio, | 130 void IntelligibilityEnhancer::ProcessRenderAudio(float* const* audio, |
| 131 int sample_rate_hz, | 131 int sample_rate_hz, |
| 132 int num_channels) { | 132 size_t num_channels) { |
| 133 RTC_CHECK_EQ(sample_rate_hz_, sample_rate_hz); | 133 RTC_CHECK_EQ(sample_rate_hz_, sample_rate_hz); |
| 134 RTC_CHECK_EQ(num_render_channels_, num_channels); | 134 RTC_CHECK_EQ(num_render_channels_, num_channels); |
| 135 | 135 |
| 136 if (active_) { | 136 if (active_) { |
| 137 render_mangler_->ProcessChunk(audio, temp_render_out_buffer_.channels()); | 137 render_mangler_->ProcessChunk(audio, temp_render_out_buffer_.channels()); |
| 138 } | 138 } |
| 139 | 139 |
| 140 if (active_) { | 140 if (active_) { |
| 141 for (int i = 0; i < num_render_channels_; ++i) { | 141 for (size_t i = 0; i < num_render_channels_; ++i) { |
| 142 memcpy(audio[i], temp_render_out_buffer_.channels()[i], | 142 memcpy(audio[i], temp_render_out_buffer_.channels()[i], |
| 143 chunk_length_ * sizeof(**audio)); | 143 chunk_length_ * sizeof(**audio)); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 void IntelligibilityEnhancer::AnalyzeCaptureAudio(float* const* audio, | 148 void IntelligibilityEnhancer::AnalyzeCaptureAudio(float* const* audio, |
| 149 int sample_rate_hz, | 149 int sample_rate_hz, |
| 150 int num_channels) { | 150 size_t num_channels) { |
| 151 RTC_CHECK_EQ(sample_rate_hz_, sample_rate_hz); | 151 RTC_CHECK_EQ(sample_rate_hz_, sample_rate_hz); |
| 152 RTC_CHECK_EQ(num_capture_channels_, num_channels); | 152 RTC_CHECK_EQ(num_capture_channels_, num_channels); |
| 153 | 153 |
| 154 capture_mangler_->ProcessChunk(audio, temp_capture_out_buffer_.channels()); | 154 capture_mangler_->ProcessChunk(audio, temp_capture_out_buffer_.channels()); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void IntelligibilityEnhancer::DispatchAudio( | 157 void IntelligibilityEnhancer::DispatchAudio( |
| 158 IntelligibilityEnhancer::AudioSource source, | 158 IntelligibilityEnhancer::AudioSource source, |
| 159 const complex<float>* in_block, | 159 const complex<float>* in_block, |
| 160 complex<float>* out_block) { | 160 complex<float>* out_block) { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 ret = fmaf(a[i], b[i], ret); | 372 ret = fmaf(a[i], b[i], ret); |
| 373 } | 373 } |
| 374 return ret; | 374 return ret; |
| 375 } | 375 } |
| 376 | 376 |
| 377 bool IntelligibilityEnhancer::active() const { | 377 bool IntelligibilityEnhancer::active() const { |
| 378 return active_; | 378 return active_; |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace webrtc | 381 } // namespace webrtc |
| OLD | NEW |