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

Side by Side Diff: webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc

Issue 2320833002: Compensate for the IntelligibilityEnhancer processing delay in high bands (Closed)
Patch Set: optimize 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 GainApplier::~GainApplier() {} 59 GainApplier::~GainApplier() {}
60 60
61 void GainApplier::Apply(const std::complex<float>* in_block, 61 void GainApplier::Apply(const std::complex<float>* in_block,
62 std::complex<float>* out_block) { 62 std::complex<float>* out_block) {
63 for (size_t i = 0; i < num_freqs_; ++i) { 63 for (size_t i = 0; i < num_freqs_; ++i) {
64 current_[i] = UpdateFactor(target_[i], current_[i], relative_change_limit_); 64 current_[i] = UpdateFactor(target_[i], current_[i], relative_change_limit_);
65 out_block[i] = sqrtf(fabsf(current_[i])) * in_block[i]; 65 out_block[i] = sqrtf(fabsf(current_[i])) * in_block[i];
66 } 66 }
67 } 67 }
68 68
69 DelayBuffer::DelayBuffer(size_t delay, size_t num_channels)
70 : buffer_(num_channels, std::vector<float>(delay, 0.f)), read_index_(0u) {}
71
72 DelayBuffer::~DelayBuffer() {}
73
74 void DelayBuffer::Delay(float* const* data, size_t length) {
75 for (size_t i = 0u; i < buffer_.size(); ++i) {
76 size_t channel_index = read_index_;
peah-webrtc 2016/09/17 21:31:30 Please consider changing this name. To me, a chan
aluebs-webrtc 2016/09/19 19:17:14 Good point. Done.
77 for (size_t j = 0u; j < length; ++j) {
78 float swap = data[i][j];
79 data[i][j] = buffer_[i][channel_index];
80 buffer_[i][channel_index] = swap;
81 if (++channel_index == buffer_.size()) {
82 channel_index = 0u;
83 }
84 }
85 }
86 read_index_ += length;
87 while (read_index_ >= buffer_.size()) {
peah-webrtc 2016/09/17 21:31:30 This part is not necessary. You have the wraparoun
aluebs-webrtc 2016/09/19 19:17:14 Good point. Done.
88 read_index_ -= buffer_.size();
89 }
90 }
91
69 } // namespace intelligibility 92 } // namespace intelligibility
70 93
71 } // namespace webrtc 94 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698