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

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

Issue 1925053002: Revert of Avoiding overflow in cross correlation in NetEq. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « webrtc/modules/audio_coding/neteq/expand.cc ('k') | webrtc/modules/audio_coding/neteq/merge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 static const size_t kInputDownsampLength = 40; 62 static const size_t kInputDownsampLength = 40;
63 static const size_t kMaxCorrelationLength = 60; 63 static const size_t kMaxCorrelationLength = 60;
64 64
65 // Calls |expand_| to get more expansion data to merge with. The data is 65 // Calls |expand_| to get more expansion data to merge with. The data is
66 // written to |expanded_signal_|. Returns the length of the expanded data, 66 // written to |expanded_signal_|. Returns the length of the expanded data,
67 // while |expand_period| will be the number of samples in one expansion period 67 // while |expand_period| will be the number of samples in one expansion period
68 // (typically one pitch period). The value of |old_length| will be the number 68 // (typically one pitch period). The value of |old_length| will be the number
69 // of samples that were taken from the |sync_buffer_|. 69 // of samples that were taken from the |sync_buffer_|.
70 size_t GetExpandedSignal(size_t* old_length, size_t* expand_period); 70 size_t GetExpandedSignal(size_t* old_length, size_t* expand_period);
71 71
72 // Analyzes |input| and |expanded_signal| and returns muting factor (Q14) to 72 // Analyzes |input| and |expanded_signal| to find maximum values. Returns
73 // be used on the new data. 73 // a muting factor (Q14) to be used on the new data.
74 int16_t SignalScaling(const int16_t* input, size_t input_length, 74 int16_t SignalScaling(const int16_t* input, size_t input_length,
75 const int16_t* expanded_signal) const; 75 const int16_t* expanded_signal,
76 int16_t* expanded_max, int16_t* input_max) const;
76 77
77 // Downsamples |input| (|input_length| samples) and |expanded_signal| to 78 // Downsamples |input| (|input_length| samples) and |expanded_signal| to
78 // 4 kHz sample rate. The downsampled signals are written to 79 // 4 kHz sample rate. The downsampled signals are written to
79 // |input_downsampled_| and |expanded_downsampled_|, respectively. 80 // |input_downsampled_| and |expanded_downsampled_|, respectively.
80 void Downsample(const int16_t* input, size_t input_length, 81 void Downsample(const int16_t* input, size_t input_length,
81 const int16_t* expanded_signal, size_t expanded_length); 82 const int16_t* expanded_signal, size_t expanded_length);
82 83
83 // Calculates cross-correlation between |input_downsampled_| and 84 // Calculates cross-correlation between |input_downsampled_| and
84 // |expanded_downsampled_|, and finds the correlation maximum. The maximizing 85 // |expanded_downsampled_|, and finds the correlation maximum. The maximizing
85 // lag is returned. 86 // lag is returned.
86 size_t CorrelateAndPeakSearch(size_t start_position, size_t input_length, 87 size_t CorrelateAndPeakSearch(int16_t expanded_max, int16_t input_max,
88 size_t start_position, size_t input_length,
87 size_t expand_period) const; 89 size_t expand_period) const;
88 90
89 const int fs_mult_; // fs_hz_ / 8000. 91 const int fs_mult_; // fs_hz_ / 8000.
90 const size_t timestamps_per_call_; 92 const size_t timestamps_per_call_;
91 Expand* expand_; 93 Expand* expand_;
92 SyncBuffer* sync_buffer_; 94 SyncBuffer* sync_buffer_;
93 int16_t expanded_downsampled_[kExpandDownsampLength]; 95 int16_t expanded_downsampled_[kExpandDownsampLength];
94 int16_t input_downsampled_[kInputDownsampLength]; 96 int16_t input_downsampled_[kInputDownsampLength];
95 AudioMultiVector expanded_; 97 AudioMultiVector expanded_;
96 98
97 RTC_DISALLOW_COPY_AND_ASSIGN(Merge); 99 RTC_DISALLOW_COPY_AND_ASSIGN(Merge);
98 }; 100 };
99 101
100 } // namespace webrtc 102 } // namespace webrtc
101 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MERGE_H_ 103 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MERGE_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/expand.cc ('k') | webrtc/modules/audio_coding/neteq/merge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698