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

Unified Diff: webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc

Issue 2320833002: Compensate for the IntelligibilityEnhancer processing delay in high bands (Closed)
Patch Set: Rebasing 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc
diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc b/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc
index 6e641a23325984bee6daab921a67c9acc959a489..fa8d1704c6775e31673c07a460d2e835fa5f1a58 100644
--- a/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc
+++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc
@@ -66,6 +66,27 @@ void GainApplier::Apply(const std::complex<float>* in_block,
}
}
+DelayBuffer::DelayBuffer(size_t delay, size_t num_channels)
+ : buffer_(num_channels, std::vector<float>(delay, 0.f)), read_index_(0u) {}
+
+DelayBuffer::~DelayBuffer() {}
+
+void DelayBuffer::Delay(float* const* data, size_t length) {
+ size_t sample_index = read_index_;
+ for (size_t i = 0u; i < buffer_.size(); ++i) {
+ sample_index = read_index_;
+ for (size_t j = 0u; j < length; ++j) {
+ float swap = data[i][j];
+ data[i][j] = buffer_[i][sample_index];
+ buffer_[i][sample_index] = swap;
+ if (++sample_index == buffer_.size()) {
+ sample_index = 0u;
+ }
+ }
+ }
+ read_index_ = sample_index;
+}
+
} // namespace intelligibility
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698