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

Side by Side Diff: webrtc/modules/audio_coding/neteq/background_noise.cc

Issue 1948483002: Using ring buffer for AudioVector in NetEq. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: refinements 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 int32_t auto_correlation[kMaxLpcOrder + 1]; 53 int32_t auto_correlation[kMaxLpcOrder + 1];
54 int16_t fiter_output[kMaxLpcOrder + kResidualLength]; 54 int16_t fiter_output[kMaxLpcOrder + kResidualLength];
55 int16_t reflection_coefficients[kMaxLpcOrder]; 55 int16_t reflection_coefficients[kMaxLpcOrder];
56 int16_t lpc_coefficients[kMaxLpcOrder + 1]; 56 int16_t lpc_coefficients[kMaxLpcOrder + 1];
57 57
58 for (size_t channel_ix = 0; channel_ix < num_channels_; ++channel_ix) { 58 for (size_t channel_ix = 0; channel_ix < num_channels_; ++channel_ix) {
59 ChannelParameters& parameters = channel_parameters_[channel_ix]; 59 ChannelParameters& parameters = channel_parameters_[channel_ix];
60 int16_t temp_signal_array[kVecLen + kMaxLpcOrder] = {0}; 60 int16_t temp_signal_array[kVecLen + kMaxLpcOrder] = {0};
61 int16_t* temp_signal = &temp_signal_array[kMaxLpcOrder]; 61 int16_t* temp_signal = &temp_signal_array[kMaxLpcOrder];
62 memcpy(temp_signal, 62 input[channel_ix].CopyTo(kVecLen, input.Size() - kVecLen, temp_signal);
63 &input[channel_ix][input.Size() - kVecLen],
64 sizeof(int16_t) * kVecLen);
65
66 int32_t sample_energy = CalculateAutoCorrelation(temp_signal, kVecLen, 63 int32_t sample_energy = CalculateAutoCorrelation(temp_signal, kVecLen,
67 auto_correlation); 64 auto_correlation);
68 65
69 if ((!vad.running() && 66 if ((!vad.running() &&
70 sample_energy < parameters.energy_update_threshold) || 67 sample_energy < parameters.energy_update_threshold) ||
71 (vad.running() && !vad.active_speech())) { 68 (vad.running() && !vad.active_speech())) {
72 // Generate LPC coefficients. 69 // Generate LPC coefficients.
73 if (auto_correlation[0] > 0) { 70 if (auto_correlation[0] > 0) {
74 // Regardless of whether the filter is actually updated or not, 71 // Regardless of whether the filter is actually updated or not,
75 // update energy threshold levels, since we have in fact observed 72 // update energy threshold levels, since we have in fact observed
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // Add 13 to the |scale_shift_|, since the random numbers table is in 246 // Add 13 to the |scale_shift_|, since the random numbers table is in
250 // Q13. 247 // Q13.
251 // TODO(hlundin): Move the "13" to where the |scale_shift_| is used? 248 // TODO(hlundin): Move the "13" to where the |scale_shift_| is used?
252 parameters.scale_shift = 249 parameters.scale_shift =
253 static_cast<int16_t>(13 + ((kLogResidualLength + norm_shift) / 2)); 250 static_cast<int16_t>(13 + ((kLogResidualLength + norm_shift) / 2));
254 251
255 initialized_ = true; 252 initialized_ = true;
256 } 253 }
257 254
258 } // namespace webrtc 255 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698