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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 int16_t max_lag() const { return max_lag_; } | 65 int16_t max_lag() const { return max_lag_; } |
66 | 66 |
67 protected: | 67 protected: |
68 static const int kMaxConsecutiveExpands = 200; | 68 static const int kMaxConsecutiveExpands = 200; |
69 void GenerateRandomVector(int16_t seed_increment, | 69 void GenerateRandomVector(int16_t seed_increment, |
70 size_t length, | 70 size_t length, |
71 int16_t* random_vector); | 71 int16_t* random_vector); |
72 | 72 |
73 void GenerateBackgroundNoise(int16_t* random_vector, | 73 void GenerateBackgroundNoise(int16_t* random_vector, |
74 size_t channel, | 74 size_t channel, |
75 int16_t mute_slope, | 75 int mute_slope, |
76 bool too_many_expands, | 76 bool too_many_expands, |
77 size_t num_noise_samples, | 77 size_t num_noise_samples, |
78 int16_t* buffer); | 78 int16_t* buffer); |
79 | 79 |
80 // Initializes member variables at the beginning of an expand period. | 80 // Initializes member variables at the beginning of an expand period. |
81 void InitializeForAnExpandPeriod(); | 81 void InitializeForAnExpandPeriod(); |
82 | 82 |
83 bool TooManyExpands(); | 83 bool TooManyExpands(); |
84 | 84 |
85 // Analyzes the signal history in |sync_buffer_|, and set up all parameters | 85 // Analyzes the signal history in |sync_buffer_|, and set up all parameters |
(...skipping 20 matching lines...) Expand all Loading... |
106 int16_t mute_factor; | 106 int16_t mute_factor; |
107 int16_t ar_filter[kUnvoicedLpcOrder + 1]; | 107 int16_t ar_filter[kUnvoicedLpcOrder + 1]; |
108 int16_t ar_filter_state[kUnvoicedLpcOrder]; | 108 int16_t ar_filter_state[kUnvoicedLpcOrder]; |
109 int16_t ar_gain; | 109 int16_t ar_gain; |
110 int16_t ar_gain_scale; | 110 int16_t ar_gain_scale; |
111 int16_t voice_mix_factor; /* Q14 */ | 111 int16_t voice_mix_factor; /* Q14 */ |
112 int16_t current_voice_mix_factor; /* Q14 */ | 112 int16_t current_voice_mix_factor; /* Q14 */ |
113 AudioVector expand_vector0; | 113 AudioVector expand_vector0; |
114 AudioVector expand_vector1; | 114 AudioVector expand_vector1; |
115 bool onset; | 115 bool onset; |
116 int16_t mute_slope; /* Q20 */ | 116 int mute_slope; /* Q20 */ |
117 }; | 117 }; |
118 | 118 |
119 // Calculate the auto-correlation of |input|, with length |input_length| | 119 // Calculate the auto-correlation of |input|, with length |input_length| |
120 // samples. The correlation is calculated from a downsampled version of | 120 // samples. The correlation is calculated from a downsampled version of |
121 // |input|, and is written to |output|. The scale factor is written to | 121 // |input|, and is written to |output|. The scale factor is written to |
122 // |output_scale|. | 122 // |output_scale|. |
123 void Correlation(const int16_t* input, | 123 void Correlation(const int16_t* input, |
124 size_t input_length, | 124 size_t input_length, |
125 int16_t* output, | 125 int16_t* output, |
126 int16_t* output_scale) const; | 126 int* output_scale) const; |
127 | 127 |
128 void UpdateLagIndex(); | 128 void UpdateLagIndex(); |
129 | 129 |
130 BackgroundNoise* background_noise_; | 130 BackgroundNoise* background_noise_; |
131 const size_t overlap_length_; | 131 const size_t overlap_length_; |
132 int16_t max_lag_; | 132 int16_t max_lag_; |
133 size_t expand_lags_[kNumLags]; | 133 size_t expand_lags_[kNumLags]; |
134 int lag_index_direction_; | 134 int lag_index_direction_; |
135 int current_lag_index_; | 135 int current_lag_index_; |
136 bool stop_muting_; | 136 bool stop_muting_; |
137 rtc::scoped_ptr<ChannelParameters[]> channel_parameters_; | 137 rtc::scoped_ptr<ChannelParameters[]> channel_parameters_; |
138 | 138 |
139 DISALLOW_COPY_AND_ASSIGN(Expand); | 139 DISALLOW_COPY_AND_ASSIGN(Expand); |
140 }; | 140 }; |
141 | 141 |
142 struct ExpandFactory { | 142 struct ExpandFactory { |
143 ExpandFactory() {} | 143 ExpandFactory() {} |
144 virtual ~ExpandFactory() {} | 144 virtual ~ExpandFactory() {} |
145 | 145 |
146 virtual Expand* Create(BackgroundNoise* background_noise, | 146 virtual Expand* Create(BackgroundNoise* background_noise, |
147 SyncBuffer* sync_buffer, | 147 SyncBuffer* sync_buffer, |
148 RandomVector* random_vector, | 148 RandomVector* random_vector, |
149 int fs, | 149 int fs, |
150 size_t num_channels) const; | 150 size_t num_channels) const; |
151 }; | 151 }; |
152 | 152 |
153 } // namespace webrtc | 153 } // namespace webrtc |
154 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_EXPAND_H_ | 154 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_EXPAND_H_ |
OLD | NEW |