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

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

Issue 1174813003: Prepare to convert various types to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix MSVC warning 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 int16_t decoded_max = WebRtcSpl_MaxAbsValueW16( 76 int16_t decoded_max = WebRtcSpl_MaxAbsValueW16(
77 signal, static_cast<int>(length_per_channel)); 77 signal, static_cast<int>(length_per_channel));
78 // Adjust muting factor if needed (to BGN level). 78 // Adjust muting factor if needed (to BGN level).
79 int energy_length = std::min(static_cast<int>(fs_mult * 64), 79 int energy_length = std::min(static_cast<int>(fs_mult * 64),
80 static_cast<int>(length_per_channel)); 80 static_cast<int>(length_per_channel));
81 int scaling = 6 + fs_shift 81 int scaling = 6 + fs_shift
82 - WebRtcSpl_NormW32(decoded_max * decoded_max); 82 - WebRtcSpl_NormW32(decoded_max * decoded_max);
83 scaling = std::max(scaling, 0); // |scaling| should always be >= 0. 83 scaling = std::max(scaling, 0); // |scaling| should always be >= 0.
84 int32_t energy = WebRtcSpl_DotProductWithScale(signal, signal, 84 int32_t energy = WebRtcSpl_DotProductWithScale(signal, signal,
85 energy_length, scaling); 85 energy_length, scaling);
86 if ((energy_length >> scaling) > 0) { 86 int32_t scaled_energy_length =
87 energy = energy / (energy_length >> scaling); 87 static_cast<int32_t>(energy_length >> scaling);
88 if (scaled_energy_length > 0) {
89 energy = energy / scaled_energy_length;
88 } else { 90 } else {
89 energy = 0; 91 energy = 0;
90 } 92 }
91 93
92 int mute_factor; 94 int mute_factor;
93 if ((energy != 0) && 95 if ((energy != 0) &&
94 (energy > background_noise_.Energy(channel_ix))) { 96 (energy > background_noise_.Energy(channel_ix))) {
95 // Normalize new frame energy to 15 bits. 97 // Normalize new frame energy to 15 bits.
96 scaling = WebRtcSpl_NormW32(energy) - 16; 98 scaling = WebRtcSpl_NormW32(energy) - 16;
97 // We want background_noise_.energy() / energy in Q14. 99 // We want background_noise_.energy() / energy in Q14.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 external_mute_factor_array[channel_ix] = 192 external_mute_factor_array[channel_ix] =
191 std::min(16384, external_mute_factor_array[channel_ix] + increment); 193 std::min(16384, external_mute_factor_array[channel_ix] + increment);
192 } 194 }
193 } 195 }
194 } 196 }
195 197
196 return static_cast<int>(length); 198 return static_cast<int>(length);
197 } 199 }
198 200
199 } // namespace webrtc 201 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698