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

Unified Diff: webrtc/modules/audio_coding/neteq/dsp_helper.cc

Issue 1948483002: Using ring buffer for AudioVector in NetEq. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: removing a unittest Created 4 years, 7 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
« no previous file with comments | « webrtc/modules/audio_coding/neteq/dsp_helper.h ('k') | webrtc/modules/audio_coding/neteq/expand.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/dsp_helper.cc
diff --git a/webrtc/modules/audio_coding/neteq/dsp_helper.cc b/webrtc/modules/audio_coding/neteq/dsp_helper.cc
index 4188914c86c9bec701c40d92de3ee11be43569bc..32756650942240e65d7f07b5656dc304d6a22ab6 100644
--- a/webrtc/modules/audio_coding/neteq/dsp_helper.cc
+++ b/webrtc/modules/audio_coding/neteq/dsp_helper.cc
@@ -80,6 +80,22 @@ int DspHelper::RampSignal(int16_t* signal,
return RampSignal(signal, length, factor, increment, signal);
}
+int DspHelper::RampSignal(AudioVector* signal,
+ size_t start_index,
+ size_t length,
+ int factor,
+ int increment) {
+ int factor_q20 = (factor << 6) + 32;
+ // TODO(hlundin): Add 32 to factor_q20 when converting back to Q14?
+ for (size_t i = start_index; i < start_index + length; ++i) {
+ (*signal)[i] = (factor * (*signal)[i] + 8192) >> 14;
+ factor_q20 += increment;
+ factor_q20 = std::max(factor_q20, 0); // Never go negative.
+ factor = std::min(factor_q20 >> 6, 16384);
+ }
+ return factor;
+}
+
int DspHelper::RampSignal(AudioMultiVector* signal,
size_t start_index,
size_t length,
@@ -94,7 +110,7 @@ int DspHelper::RampSignal(AudioMultiVector* signal,
// Loop over the channels, starting at the same |factor| each time.
for (size_t channel = 0; channel < signal->Channels(); ++channel) {
end_factor =
- RampSignal(&(*signal)[channel][start_index], length, factor, increment);
+ RampSignal(&(*signal)[channel], start_index, length, factor, increment);
}
return end_factor;
}
« no previous file with comments | « webrtc/modules/audio_coding/neteq/dsp_helper.h ('k') | webrtc/modules/audio_coding/neteq/expand.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698