OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_CROSS_CORRELATION_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_CROSS_CORRELATION_H_ |
| 13 |
| 14 #include "webrtc/common_types.h" |
| 15 |
| 16 namespace webrtc { |
| 17 |
| 18 // The function calculates the cross-correlation between two sequences |
| 19 // |sequence_1| and |sequence_2|. |sequence_1| is taken as reference, with |
| 20 // |sequence_1_length| as its length. |sequence_2| slides for the calculation of |
| 21 // cross-correlation. The result will be saved in |cross_correlation|. |
| 22 // |cross_correlation_length| correlation points are calculated. |
| 23 // The corresponding lag starts from 0, and increases with a step of |
| 24 // |cross_correlation_step|. The result is without normalization. To avoid |
| 25 // overflow, the result will be right shifted. The amount of shifts will be |
| 26 // returned. |
| 27 // |
| 28 // Input: |
| 29 // - sequence_1 : First sequence (reference). |
| 30 // - sequence_2 : Second sequence (sliding during calculation). |
| 31 // - sequence_1_length : Length of |sequence_1|. |
| 32 // - cross_correlation_length : Number of cross-correlations to calculate. |
| 33 // - cross_correlation_step : Step in the lag for the cross-correlation. |
| 34 // |
| 35 // Output: |
| 36 // - cross_correlation : The cross-correlation in Q(-right_shifts) |
| 37 // |
| 38 // Return: |
| 39 // Number of right shifts in cross_correlation. |
| 40 |
| 41 int CrossCorrelationWithAutoShift(const int16_t* sequence_1, |
| 42 const int16_t* sequence_2, |
| 43 size_t sequence_1_length, |
| 44 size_t cross_correlation_length, |
| 45 int cross_correlation_step, |
| 46 int32_t* cross_correlation); |
| 47 |
| 48 } // namespace webrtc |
| 49 |
| 50 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_CROSS_CORRELATION_H_ |
OLD | NEW |