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

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

Issue 1179953003: Revert "Upconvert various types to int." (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 for (size_t i = 0; i < length; i++) { 265 for (size_t i = 0; i < length; i++) {
266 output[i] = 266 output[i] =
267 (factor * input1[i] + complement_factor * input2[i] + 8192) >> 14; 267 (factor * input1[i] + complement_factor * input2[i] + 8192) >> 14;
268 factor -= factor_decrement; 268 factor -= factor_decrement;
269 complement_factor += factor_decrement; 269 complement_factor += factor_decrement;
270 } 270 }
271 *mix_factor = factor; 271 *mix_factor = factor;
272 } 272 }
273 273
274 void DspHelper::UnmuteSignal(const int16_t* input, size_t length, 274 void DspHelper::UnmuteSignal(const int16_t* input, size_t length,
275 int16_t* factor, int increment, 275 int16_t* factor, int16_t increment,
276 int16_t* output) { 276 int16_t* output) {
277 uint16_t factor_16b = *factor; 277 uint16_t factor_16b = *factor;
278 int32_t factor_32b = (static_cast<int32_t>(factor_16b) << 6) + 32; 278 int32_t factor_32b = (static_cast<int32_t>(factor_16b) << 6) + 32;
279 for (size_t i = 0; i < length; i++) { 279 for (size_t i = 0; i < length; i++) {
280 output[i] = (factor_16b * input[i] + 8192) >> 14; 280 output[i] = (factor_16b * input[i] + 8192) >> 14;
281 factor_32b = std::max(factor_32b + increment, 0); 281 factor_32b = std::max(factor_32b + increment, 0);
282 factor_16b = std::min(16384, factor_32b >> 6); 282 factor_16b = std::min(16384, factor_32b >> 6);
283 } 283 }
284 *factor = factor_16b; 284 *factor = factor_16b;
285 } 285 }
286 286
287 void DspHelper::MuteSignal(int16_t* signal, int mute_slope, size_t length) { 287 void DspHelper::MuteSignal(int16_t* signal, int16_t mute_slope, size_t length) {
288 int32_t factor = (16384 << 6) + 32; 288 int32_t factor = (16384 << 6) + 32;
289 for (size_t i = 0; i < length; i++) { 289 for (size_t i = 0; i < length; i++) {
290 signal[i] = ((factor >> 6) * signal[i] + 8192) >> 14; 290 signal[i] = ((factor >> 6) * signal[i] + 8192) >> 14;
291 factor -= mute_slope; 291 factor -= mute_slope;
292 } 292 }
293 } 293 }
294 294
295 int DspHelper::DownsampleTo4kHz(const int16_t* input, size_t input_length, 295 int DspHelper::DownsampleTo4kHz(const int16_t* input, size_t input_length,
296 int output_length, int input_rate_hz, 296 int output_length, int input_rate_hz,
297 bool compensate_delay, int16_t* output) { 297 bool compensate_delay, int16_t* output) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 344 }
345 345
346 // Returns -1 if input signal is too short; 0 otherwise. 346 // Returns -1 if input signal is too short; 0 otherwise.
347 return WebRtcSpl_DownsampleFast( 347 return WebRtcSpl_DownsampleFast(
348 &input[filter_length - 1], static_cast<int>(input_length) - 348 &input[filter_length - 1], static_cast<int>(input_length) -
349 (filter_length - 1), output, output_length, filter_coefficients, 349 (filter_length - 1), output, output_length, filter_coefficients,
350 filter_length, factor, filter_delay); 350 filter_length, factor, filter_delay);
351 } 351 }
352 352
353 } // namespace webrtc 353 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/dsp_helper.h ('k') | webrtc/modules/audio_coding/neteq/expand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698