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

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

Issue 1168753002: Match existing type usage better. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 6 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 (kMaxLpcOrder+1) * sizeof(int16_t)); 232 (kMaxLpcOrder+1) * sizeof(int16_t));
233 memcpy(parameters.filter_state, filter_state, 233 memcpy(parameters.filter_state, filter_state,
234 kMaxLpcOrder * sizeof(int16_t)); 234 kMaxLpcOrder * sizeof(int16_t));
235 // Save energy level and update energy threshold levels. 235 // Save energy level and update energy threshold levels.
236 // Never get under 1.0 in average sample energy. 236 // Never get under 1.0 in average sample energy.
237 parameters.energy = std::max(sample_energy, 1); 237 parameters.energy = std::max(sample_energy, 1);
238 parameters.energy_update_threshold = parameters.energy; 238 parameters.energy_update_threshold = parameters.energy;
239 parameters.low_energy_update_threshold = 0; 239 parameters.low_energy_update_threshold = 0;
240 240
241 // Normalize residual_energy to 29 or 30 bits before sqrt. 241 // Normalize residual_energy to 29 or 30 bits before sqrt.
242 int norm_shift = WebRtcSpl_NormW32(residual_energy) - 1; 242 int16_t norm_shift = WebRtcSpl_NormW32(residual_energy) - 1;
243 if (norm_shift & 0x1) { 243 if (norm_shift & 0x1) {
244 norm_shift -= 1; // Even number of shifts required. 244 norm_shift -= 1; // Even number of shifts required.
245 } 245 }
246 assert(norm_shift >= 0); // Should always be positive. 246 assert(norm_shift >= 0); // Should always be positive.
247 residual_energy = residual_energy << norm_shift; 247 residual_energy = residual_energy << norm_shift;
248 248
249 // Calculate scale and shift factor. 249 // Calculate scale and shift factor.
250 parameters.scale = WebRtcSpl_SqrtFloor(residual_energy); 250 parameters.scale = WebRtcSpl_SqrtFloor(residual_energy);
251 // Add 13 to the |scale_shift_|, since the random numbers table is in 251 // Add 13 to the |scale_shift_|, since the random numbers table is in
252 // Q13. 252 // Q13.
253 // TODO(hlundin): Move the "13" to where the |scale_shift_| is used? 253 // TODO(hlundin): Move the "13" to where the |scale_shift_| is used?
254 parameters.scale_shift = 13 + ((kLogResidualLength + norm_shift) / 2); 254 parameters.scale_shift =
255 static_cast<int16_t>(13 + ((kLogResidualLength + norm_shift) / 2));
255 256
256 initialized_ = true; 257 initialized_ = true;
257 } 258 }
258 259
259 } // namespace webrtc 260 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/background_noise.h ('k') | webrtc/modules/audio_coding/neteq/decision_logic_normal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698