OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return SignalClassifier::SignalType::kStationary; | 86 return SignalClassifier::SignalType::kStationary; |
87 } else if (num_highly_nonstationary_bands > 15) { | 87 } else if (num_highly_nonstationary_bands > 15) { |
88 return SignalClassifier::SignalType::kHighlyNonStationary; | 88 return SignalClassifier::SignalType::kHighlyNonStationary; |
89 } else { | 89 } else { |
90 return SignalClassifier::SignalType::kNonStationary; | 90 return SignalClassifier::SignalType::kNonStationary; |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 } // namespace | 94 } // namespace |
95 | 95 |
| 96 SignalClassifier::FrameExtender::FrameExtender(size_t frame_size, |
| 97 size_t extended_frame_size) |
| 98 : x_old_(extended_frame_size - frame_size, 0.f) {} |
| 99 |
| 100 SignalClassifier::FrameExtender::~FrameExtender() = default; |
| 101 |
96 void SignalClassifier::FrameExtender::ExtendFrame( | 102 void SignalClassifier::FrameExtender::ExtendFrame( |
97 rtc::ArrayView<const float> x, | 103 rtc::ArrayView<const float> x, |
98 rtc::ArrayView<float> x_extended) { | 104 rtc::ArrayView<float> x_extended) { |
99 RTC_DCHECK_EQ(x_old_.size() + x.size(), x_extended.size()); | 105 RTC_DCHECK_EQ(x_old_.size() + x.size(), x_extended.size()); |
100 std::copy(x_old_.data(), x_old_.data() + x_old_.size(), x_extended.data()); | 106 std::copy(x_old_.data(), x_old_.data() + x_old_.size(), x_extended.data()); |
101 std::copy(x.data(), x.data() + x.size(), x_extended.data() + x_old_.size()); | 107 std::copy(x.data(), x.data() + x.size(), x_extended.data() + x_old_.size()); |
102 std::copy(x_extended.data() + x_extended.size() - x_old_.size(), | 108 std::copy(x_extended.data() + x_extended.size() - x_old_.size(), |
103 x_extended.data() + x_extended.size(), x_old_.data()); | 109 x_extended.data() + x_extended.size(), x_old_.data()); |
104 } | 110 } |
105 | 111 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 last_signal_type_ = *signal_type; | 163 last_signal_type_ = *signal_type; |
158 consistent_classification_counter_ = 3; | 164 consistent_classification_counter_ = 3; |
159 } | 165 } |
160 | 166 |
161 if (consistent_classification_counter_ > 0) { | 167 if (consistent_classification_counter_ > 0) { |
162 *signal_type = SignalClassifier::SignalType::kNonStationary; | 168 *signal_type = SignalClassifier::SignalType::kNonStationary; |
163 } | 169 } |
164 } | 170 } |
165 | 171 |
166 } // namespace webrtc | 172 } // namespace webrtc |
OLD | NEW |