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

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

Issue 1172163004: Reformat existing code. There should be no functional effects. (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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 num_coefficients, decimation_factor, 302 num_coefficients, decimation_factor,
303 kCompensateDelay); 303 kCompensateDelay);
304 } 304 }
305 } 305 }
306 306
307 int16_t Merge::CorrelateAndPeakSearch(int16_t expanded_max, int16_t input_max, 307 int16_t Merge::CorrelateAndPeakSearch(int16_t expanded_max, int16_t input_max,
308 int start_position, int input_length, 308 int start_position, int input_length,
309 int expand_period) const { 309 int expand_period) const {
310 // Calculate correlation without any normalization. 310 // Calculate correlation without any normalization.
311 const int max_corr_length = kMaxCorrelationLength; 311 const int max_corr_length = kMaxCorrelationLength;
312 int stop_position_downsamp = std::min( 312 int stop_position_downsamp =
313 max_corr_length, expand_->max_lag() / (fs_mult_ * 2) + 1); 313 std::min(max_corr_length, expand_->max_lag() / (fs_mult_ * 2) + 1);
314 int correlation_shift = 0; 314 int correlation_shift = 0;
315 if (expanded_max * input_max > 26843546) { 315 if (expanded_max * input_max > 26843546) {
316 correlation_shift = 3; 316 correlation_shift = 3;
317 } 317 }
318 318
319 int32_t correlation[kMaxCorrelationLength]; 319 int32_t correlation[kMaxCorrelationLength];
320 WebRtcSpl_CrossCorrelation(correlation, input_downsampled_, 320 WebRtcSpl_CrossCorrelation(correlation, input_downsampled_,
321 expanded_downsampled_, kInputDownsampLength, 321 expanded_downsampled_, kInputDownsampLength,
322 stop_position_downsamp, correlation_shift, 1); 322 stop_position_downsamp, correlation_shift, 1);
323 323
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 DspHelper::PeakDetection(&correlation_ptr[start_index_downsamp], 357 DspHelper::PeakDetection(&correlation_ptr[start_index_downsamp],
358 modified_stop_pos, kNumCorrelationCandidates, 358 modified_stop_pos, kNumCorrelationCandidates,
359 fs_mult_, &best_correlation_index, 359 fs_mult_, &best_correlation_index,
360 &best_correlation); 360 &best_correlation);
361 // Compensate for modified start index. 361 // Compensate for modified start index.
362 best_correlation_index += start_index; 362 best_correlation_index += start_index;
363 363
364 // Ensure that underrun does not occur for 10ms case => we have to get at 364 // Ensure that underrun does not occur for 10ms case => we have to get at
365 // least 10ms + overlap . (This should never happen thanks to the above 365 // least 10ms + overlap . (This should never happen thanks to the above
366 // modification of peak-finding starting point.) 366 // modification of peak-finding starting point.)
367 while ((best_correlation_index + input_length) < 367 while (((best_correlation_index + input_length) <
368 static_cast<int>(timestamps_per_call_ + expand_->overlap_length()) || 368 static_cast<int>(timestamps_per_call_ + expand_->overlap_length())) ||
369 best_correlation_index + input_length < start_position) { 369 ((best_correlation_index + input_length) < start_position)) {
kwiberg-webrtc 2015/06/10 11:58:32 Why the extra parentheses? There were too many to
370 assert(false); // Should never happen. 370 assert(false); // Should never happen.
371 best_correlation_index += expand_period; // Jump one lag ahead. 371 best_correlation_index += expand_period; // Jump one lag ahead.
372 } 372 }
373 return best_correlation_index; 373 return best_correlation_index;
374 } 374 }
375 375
376 int Merge::RequiredFutureSamples() { 376 int Merge::RequiredFutureSamples() {
377 return static_cast<int>(fs_hz_ / 100 * num_channels_); // 10 ms. 377 return static_cast<int>(fs_hz_ / 100 * num_channels_); // 10 ms.
378 } 378 }
379 379
380 380
381 } // namespace webrtc 381 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698