| 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 WEBRTC_SPL_ABS_W16((distortion_lag-correlation_lag)) + 1; | 434 WEBRTC_SPL_ABS_W16((distortion_lag-correlation_lag)) + 1; |
| 435 assert(correlation_lags <= 99 * fs_mult + 1); // Cannot be larger. | 435 assert(correlation_lags <= 99 * fs_mult + 1); // Cannot be larger. |
| 436 | 436 |
| 437 for (size_t channel_ix = 0; channel_ix < num_channels_; ++channel_ix) { | 437 for (size_t channel_ix = 0; channel_ix < num_channels_; ++channel_ix) { |
| 438 ChannelParameters& parameters = channel_parameters_[channel_ix]; | 438 ChannelParameters& parameters = channel_parameters_[channel_ix]; |
| 439 // Calculate suitable scaling. | 439 // Calculate suitable scaling. |
| 440 int16_t signal_max = WebRtcSpl_MaxAbsValueW16( | 440 int16_t signal_max = WebRtcSpl_MaxAbsValueW16( |
| 441 &audio_history[signal_length - correlation_length - start_index | 441 &audio_history[signal_length - correlation_length - start_index |
| 442 - correlation_lags], | 442 - correlation_lags], |
| 443 correlation_length + start_index + correlation_lags - 1); | 443 correlation_length + start_index + correlation_lags - 1); |
| 444 correlation_scale = ((31 - WebRtcSpl_NormW32(signal_max * signal_max)) | 444 correlation_scale = (31 - WebRtcSpl_NormW32(signal_max * signal_max)) + |
| 445 + (31 - WebRtcSpl_NormW32(correlation_length))) - 31; | 445 (31 - WebRtcSpl_NormW32(correlation_length)) - 31; |
| 446 correlation_scale = std::max(0, correlation_scale); | 446 correlation_scale = std::max(0, correlation_scale); |
| 447 | 447 |
| 448 // Calculate the correlation, store in |correlation_vector2|. | 448 // Calculate the correlation, store in |correlation_vector2|. |
| 449 WebRtcSpl_CrossCorrelation( | 449 WebRtcSpl_CrossCorrelation( |
| 450 correlation_vector2, | 450 correlation_vector2, |
| 451 &(audio_history[signal_length - correlation_length]), | 451 &(audio_history[signal_length - correlation_length]), |
| 452 &(audio_history[signal_length - correlation_length - start_index]), | 452 &(audio_history[signal_length - correlation_length - start_index]), |
| 453 correlation_length, correlation_lags, correlation_scale, -1); | 453 correlation_length, correlation_lags, correlation_scale, -1); |
| 454 | 454 |
| 455 // Find maximizing index. | 455 // Find maximizing index. |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 const size_t kMaxRandSamples = RandomVector::kRandomTableSize; | 938 const size_t kMaxRandSamples = RandomVector::kRandomTableSize; |
| 939 while (samples_generated < length) { | 939 while (samples_generated < length) { |
| 940 size_t rand_length = std::min(length - samples_generated, kMaxRandSamples); | 940 size_t rand_length = std::min(length - samples_generated, kMaxRandSamples); |
| 941 random_vector_->IncreaseSeedIncrement(seed_increment); | 941 random_vector_->IncreaseSeedIncrement(seed_increment); |
| 942 random_vector_->Generate(rand_length, &random_vector[samples_generated]); | 942 random_vector_->Generate(rand_length, &random_vector[samples_generated]); |
| 943 samples_generated += rand_length; | 943 samples_generated += rand_length; |
| 944 } | 944 } |
| 945 } | 945 } |
| 946 | 946 |
| 947 } // namespace webrtc | 947 } // namespace webrtc |
| OLD | NEW |