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

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

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 4 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
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 virtual void SetParametersForMergeAfterExpand(); 57 virtual void SetParametersForMergeAfterExpand();
58 58
59 // Returns the mute factor for |channel|. 59 // Returns the mute factor for |channel|.
60 int16_t MuteFactor(size_t channel) { 60 int16_t MuteFactor(size_t channel) {
61 assert(channel < num_channels_); 61 assert(channel < num_channels_);
62 return channel_parameters_[channel].mute_factor; 62 return channel_parameters_[channel].mute_factor;
63 } 63 }
64 64
65 // Accessors and mutators. 65 // Accessors and mutators.
66 virtual size_t overlap_length() const; 66 virtual size_t overlap_length() const;
67 int16_t max_lag() const { return max_lag_; } 67 size_t max_lag() const { return max_lag_; }
68 68
69 protected: 69 protected:
70 static const int kMaxConsecutiveExpands = 200; 70 static const int kMaxConsecutiveExpands = 200;
71 void GenerateRandomVector(int16_t seed_increment, 71 void GenerateRandomVector(int16_t seed_increment,
72 size_t length, 72 size_t length,
73 int16_t* random_vector); 73 int16_t* random_vector);
74 74
75 void GenerateBackgroundNoise(int16_t* random_vector, 75 void GenerateBackgroundNoise(int16_t* random_vector,
76 size_t channel, 76 size_t channel,
77 int mute_slope, 77 int mute_slope,
(...skipping 11 matching lines...) Expand all
89 void AnalyzeSignal(int16_t* random_vector); 89 void AnalyzeSignal(int16_t* random_vector);
90 90
91 RandomVector* const random_vector_; 91 RandomVector* const random_vector_;
92 SyncBuffer* const sync_buffer_; 92 SyncBuffer* const sync_buffer_;
93 bool first_expand_; 93 bool first_expand_;
94 const int fs_hz_; 94 const int fs_hz_;
95 const size_t num_channels_; 95 const size_t num_channels_;
96 int consecutive_expands_; 96 int consecutive_expands_;
97 97
98 private: 98 private:
99 static const int kUnvoicedLpcOrder = 6; 99 static const size_t kUnvoicedLpcOrder = 6;
100 static const int kNumCorrelationCandidates = 3; 100 static const size_t kNumCorrelationCandidates = 3;
101 static const int kDistortionLength = 20; 101 static const size_t kDistortionLength = 20;
102 static const int kLpcAnalysisLength = 160; 102 static const size_t kLpcAnalysisLength = 160;
103 static const int kMaxSampleRate = 48000; 103 static const size_t kMaxSampleRate = 48000;
104 static const int kNumLags = 3; 104 static const int kNumLags = 3;
105 105
106 struct ChannelParameters { 106 struct ChannelParameters {
107 ChannelParameters(); 107 ChannelParameters();
108 int16_t mute_factor; 108 int16_t mute_factor;
109 int16_t ar_filter[kUnvoicedLpcOrder + 1]; 109 int16_t ar_filter[kUnvoicedLpcOrder + 1];
110 int16_t ar_filter_state[kUnvoicedLpcOrder]; 110 int16_t ar_filter_state[kUnvoicedLpcOrder];
111 int16_t ar_gain; 111 int16_t ar_gain;
112 int16_t ar_gain_scale; 112 int16_t ar_gain_scale;
113 int16_t voice_mix_factor; /* Q14 */ 113 int16_t voice_mix_factor; /* Q14 */
(...skipping 11 matching lines...) Expand all
125 void Correlation(const int16_t* input, 125 void Correlation(const int16_t* input,
126 size_t input_length, 126 size_t input_length,
127 int16_t* output, 127 int16_t* output,
128 int* output_scale) const; 128 int* output_scale) const;
129 129
130 void UpdateLagIndex(); 130 void UpdateLagIndex();
131 131
132 BackgroundNoise* const background_noise_; 132 BackgroundNoise* const background_noise_;
133 StatisticsCalculator* const statistics_; 133 StatisticsCalculator* const statistics_;
134 const size_t overlap_length_; 134 const size_t overlap_length_;
135 int16_t max_lag_; 135 size_t max_lag_;
136 size_t expand_lags_[kNumLags]; 136 size_t expand_lags_[kNumLags];
137 int lag_index_direction_; 137 int lag_index_direction_;
138 int current_lag_index_; 138 int current_lag_index_;
139 bool stop_muting_; 139 bool stop_muting_;
140 size_t expand_duration_samples_; 140 size_t expand_duration_samples_;
141 rtc::scoped_ptr<ChannelParameters[]> channel_parameters_; 141 rtc::scoped_ptr<ChannelParameters[]> channel_parameters_;
142 142
143 DISALLOW_COPY_AND_ASSIGN(Expand); 143 DISALLOW_COPY_AND_ASSIGN(Expand);
144 }; 144 };
145 145
146 struct ExpandFactory { 146 struct ExpandFactory {
147 ExpandFactory() {} 147 ExpandFactory() {}
148 virtual ~ExpandFactory() {} 148 virtual ~ExpandFactory() {}
149 149
150 virtual Expand* Create(BackgroundNoise* background_noise, 150 virtual Expand* Create(BackgroundNoise* background_noise,
151 SyncBuffer* sync_buffer, 151 SyncBuffer* sync_buffer,
152 RandomVector* random_vector, 152 RandomVector* random_vector,
153 StatisticsCalculator* statistics, 153 StatisticsCalculator* statistics,
154 int fs, 154 int fs,
155 size_t num_channels) const; 155 size_t num_channels) const;
156 }; 156 };
157 157
158 } // namespace webrtc 158 } // namespace webrtc
159 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_EXPAND_H_ 159 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_EXPAND_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/dtmf_tone_generator_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/expand.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698