| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 virtual void SetParametersForMergeAfterExpand(); | 55 virtual void SetParametersForMergeAfterExpand(); |
| 56 | 56 |
| 57 // Returns the mute factor for |channel|. | 57 // Returns the mute factor for |channel|. |
| 58 int16_t MuteFactor(size_t channel) { | 58 int16_t MuteFactor(size_t channel) { |
| 59 assert(channel < num_channels_); | 59 assert(channel < num_channels_); |
| 60 return channel_parameters_[channel].mute_factor; | 60 return channel_parameters_[channel].mute_factor; |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Accessors and mutators. | 63 // Accessors and mutators. |
| 64 virtual size_t overlap_length() const; | 64 virtual size_t overlap_length() const; |
| 65 int16_t max_lag() const { return max_lag_; } | 65 size_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 int mute_slope, | 75 int mute_slope, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 87 void AnalyzeSignal(int16_t* random_vector); | 87 void AnalyzeSignal(int16_t* random_vector); |
| 88 | 88 |
| 89 RandomVector* random_vector_; | 89 RandomVector* random_vector_; |
| 90 SyncBuffer* sync_buffer_; | 90 SyncBuffer* sync_buffer_; |
| 91 bool first_expand_; | 91 bool first_expand_; |
| 92 const int fs_hz_; | 92 const int fs_hz_; |
| 93 const size_t num_channels_; | 93 const size_t num_channels_; |
| 94 int consecutive_expands_; | 94 int consecutive_expands_; |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 static const int kUnvoicedLpcOrder = 6; | 97 static const size_t kUnvoicedLpcOrder = 6; |
| 98 static const int kNumCorrelationCandidates = 3; | 98 static const size_t kNumCorrelationCandidates = 3; |
| 99 static const int kDistortionLength = 20; | 99 static const size_t kDistortionLength = 20; |
| 100 static const int kLpcAnalysisLength = 160; | 100 static const size_t kLpcAnalysisLength = 160; |
| 101 static const int kMaxSampleRate = 48000; | 101 static const size_t kMaxSampleRate = 48000; |
| 102 static const int kNumLags = 3; | 102 static const int kNumLags = 3; |
| 103 | 103 |
| 104 struct ChannelParameters { | 104 struct ChannelParameters { |
| 105 ChannelParameters(); | 105 ChannelParameters(); |
| 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 */ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 int* 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 size_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 |