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

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

Issue 2320833002: Compensate for the IntelligibilityEnhancer processing delay in high bands (Closed)
Patch Set: Implement DelayBuffer helper class 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..758d4bdba9e9a49fbf0e24e2bd76a97f40c09ef0 100644
--- a/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc
+++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc
@@ -66,6 +66,22 @@ 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) {
+ for (size_t i = 0u; i < length; ++i) {
peah-webrtc 2016/09/16 13:35:56 I think this implementation is more expensive than
aluebs-webrtc 2016/09/17 00:48:48 1) This makes the code less readable, because it r
peah-webrtc 2016/09/17 21:31:29 It may be less readable, but definitely faster. Y
aluebs-webrtc 2016/09/19 19:17:14 There is a tradeoff between memory footprint and s
+ for (size_t j = 0u; j < buffer.size(); ++j) {
+ float swap = data[j][i];
+ data[j][i] = buffer[j][read_index];
+ buffer[j][read_index] = swap;
+ }
+ read_index = (read_index + 1u) % buffer.size();
+ }
+}
+
} // namespace intelligibility
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698