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

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

Powered by Google App Engine
This is Rietveld 408576698