| OLD | NEW |
| 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 correlation_scale = std::max(0, correlation_scale); | 447 correlation_scale = std::max(0, correlation_scale); |
| 448 | 448 |
| 449 // Calculate the correlation, store in |correlation_vector2|. | 449 // Calculate the correlation, store in |correlation_vector2|. |
| 450 WebRtcSpl_CrossCorrelation( | 450 WebRtcSpl_CrossCorrelation( |
| 451 correlation_vector2, | 451 correlation_vector2, |
| 452 &(audio_history[signal_length - correlation_length]), | 452 &(audio_history[signal_length - correlation_length]), |
| 453 &(audio_history[signal_length - correlation_length - start_index]), | 453 &(audio_history[signal_length - correlation_length - start_index]), |
| 454 correlation_length, correlation_lags, correlation_scale, -1); | 454 correlation_length, correlation_lags, correlation_scale, -1); |
| 455 | 455 |
| 456 // Find maximizing index. | 456 // Find maximizing index. |
| 457 best_index = static_cast<size_t>( | 457 best_index = WebRtcSpl_MaxIndexW32(correlation_vector2, correlation_lags); |
| 458 WebRtcSpl_MaxIndexW32(correlation_vector2, correlation_lags)); | |
| 459 int32_t max_correlation = correlation_vector2[best_index]; | 458 int32_t max_correlation = correlation_vector2[best_index]; |
| 460 // Compensate index with start offset. | 459 // Compensate index with start offset. |
| 461 best_index = best_index + start_index; | 460 best_index = best_index + start_index; |
| 462 | 461 |
| 463 // Calculate energies. | 462 // Calculate energies. |
| 464 int32_t energy1 = WebRtcSpl_DotProductWithScale( | 463 int32_t energy1 = WebRtcSpl_DotProductWithScale( |
| 465 &(audio_history[signal_length - correlation_length]), | 464 &(audio_history[signal_length - correlation_length]), |
| 466 &(audio_history[signal_length - correlation_length]), | 465 &(audio_history[signal_length - correlation_length]), |
| 467 correlation_length, correlation_scale); | 466 correlation_length, correlation_scale); |
| 468 int32_t energy2 = WebRtcSpl_DotProductWithScale( | 467 int32_t energy2 = WebRtcSpl_DotProductWithScale( |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 const size_t kMaxRandSamples = RandomVector::kRandomTableSize; | 940 const size_t kMaxRandSamples = RandomVector::kRandomTableSize; |
| 942 while (samples_generated < length) { | 941 while (samples_generated < length) { |
| 943 size_t rand_length = std::min(length - samples_generated, kMaxRandSamples); | 942 size_t rand_length = std::min(length - samples_generated, kMaxRandSamples); |
| 944 random_vector_->IncreaseSeedIncrement(seed_increment); | 943 random_vector_->IncreaseSeedIncrement(seed_increment); |
| 945 random_vector_->Generate(rand_length, &random_vector[samples_generated]); | 944 random_vector_->Generate(rand_length, &random_vector[samples_generated]); |
| 946 samples_generated += rand_length; | 945 samples_generated += rand_length; |
| 947 } | 946 } |
| 948 } | 947 } |
| 949 | 948 |
| 950 } // namespace webrtc | 949 } // namespace webrtc |
| OLD | NEW |