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

Side by Side Diff: webrtc/modules/audio_coding/neteq/cross_correlation.h

Issue 1908623002: Avoiding overflow in cross correlation in NetEq. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: expand new method across neteq Created 4 years, 8 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
(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_audio/signal_processing/include/signal_processing_librar y.h"
hlundin-webrtc 2016/04/25 07:53:57 You don't need to include SPL here, but you do nee
minyue-webrtc 2016/04/27 10:38:04 Done.
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 bit shifts in cross_correlation.
hlundin-webrtc 2016/04/25 07:53:57 Delete "bit".
minyue-webrtc 2016/04/27 10:38:04 Done.
40
41 int CrossCorrelationWithAutoShift(int32_t* cross_correlation,
hlundin-webrtc 2016/04/25 07:53:57 Output parameter cross_correlation should be after
minyue-webrtc 2016/04/27 10:38:04 Done.
42 const int16_t* sequence_1,
43 const int16_t* sequence_2,
44 size_t sequence_1_length,
45 size_t cross_correlation_length,
46 int cross_correlation_step);
47
48 } // namespace webrtc
49
50 #endif /* WEBRTC_MODULES_AUDIO_CODING_NETEQ_CROSS_CORRELATION_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698