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(int seed_increment, | 69 void GenerateRandomVector(int 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 int mute_slope, | 75 int16_t 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 int mute_slope; /* Q20 */ | 116 int16_t 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|. Returns the length of the correlation vector. | 122 // |output_scale|. Returns the length of the correlation vector. |
123 int16_t Correlation(const int16_t* input, size_t input_length, | 123 int16_t Correlation(const int16_t* input, size_t input_length, |
124 int16_t* output, int* output_scale) const; | 124 int16_t* output, int16_t* output_scale) const; |
125 | 125 |
126 void UpdateLagIndex(); | 126 void UpdateLagIndex(); |
127 | 127 |
128 BackgroundNoise* background_noise_; | 128 BackgroundNoise* background_noise_; |
129 const size_t overlap_length_; | 129 const size_t overlap_length_; |
130 int16_t max_lag_; | 130 int16_t max_lag_; |
131 size_t expand_lags_[kNumLags]; | 131 size_t expand_lags_[kNumLags]; |
132 int lag_index_direction_; | 132 int lag_index_direction_; |
133 int current_lag_index_; | 133 int current_lag_index_; |
134 bool stop_muting_; | 134 bool stop_muting_; |
135 rtc::scoped_ptr<ChannelParameters[]> channel_parameters_; | 135 rtc::scoped_ptr<ChannelParameters[]> channel_parameters_; |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(Expand); | 137 DISALLOW_COPY_AND_ASSIGN(Expand); |
138 }; | 138 }; |
139 | 139 |
140 struct ExpandFactory { | 140 struct ExpandFactory { |
141 ExpandFactory() {} | 141 ExpandFactory() {} |
142 virtual ~ExpandFactory() {} | 142 virtual ~ExpandFactory() {} |
143 | 143 |
144 virtual Expand* Create(BackgroundNoise* background_noise, | 144 virtual Expand* Create(BackgroundNoise* background_noise, |
145 SyncBuffer* sync_buffer, | 145 SyncBuffer* sync_buffer, |
146 RandomVector* random_vector, | 146 RandomVector* random_vector, |
147 int fs, | 147 int fs, |
148 size_t num_channels) const; | 148 size_t num_channels) const; |
149 }; | 149 }; |
150 | 150 |
151 } // namespace webrtc | 151 } // namespace webrtc |
152 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_EXPAND_H_ | 152 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_EXPAND_H_ |
OLD | NEW |