| 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 |
| 11 #include "webrtc/modules/audio_processing/level_controller/signal_classifier.h" | 11 #include "webrtc/modules/audio_processing/level_controller/signal_classifier.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 #include <numeric> | 14 #include <numeric> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "webrtc/api/array_view.h" |
| 17 #include "webrtc/modules/audio_processing/audio_buffer.h" | 18 #include "webrtc/modules/audio_processing/audio_buffer.h" |
| 18 #include "webrtc/modules/audio_processing/level_controller/down_sampler.h" | 19 #include "webrtc/modules/audio_processing/level_controller/down_sampler.h" |
| 19 #include "webrtc/modules/audio_processing/level_controller/noise_spectrum_estima
tor.h" | 20 #include "webrtc/modules/audio_processing/level_controller/noise_spectrum_estima
tor.h" |
| 20 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" | 21 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" |
| 21 #include "webrtc/rtc_base/array_view.h" | |
| 22 #include "webrtc/rtc_base/constructormagic.h" | 22 #include "webrtc/rtc_base/constructormagic.h" |
| 23 | 23 |
| 24 namespace webrtc { | 24 namespace webrtc { |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 void RemoveDcLevel(rtc::ArrayView<float> x) { | 27 void RemoveDcLevel(rtc::ArrayView<float> x) { |
| 28 RTC_DCHECK_LT(0, x.size()); | 28 RTC_DCHECK_LT(0, x.size()); |
| 29 float mean = std::accumulate(x.data(), x.data() + x.size(), 0.f); | 29 float mean = std::accumulate(x.data(), x.data() + x.size(), 0.f); |
| 30 mean /= x.size(); | 30 mean /= x.size(); |
| 31 | 31 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 last_signal_type_ = *signal_type; | 162 last_signal_type_ = *signal_type; |
| 163 consistent_classification_counter_ = 3; | 163 consistent_classification_counter_ = 3; |
| 164 } | 164 } |
| 165 | 165 |
| 166 if (consistent_classification_counter_ > 0) { | 166 if (consistent_classification_counter_ > 0) { |
| 167 *signal_type = SignalClassifier::SignalType::kNonStationary; | 167 *signal_type = SignalClassifier::SignalType::kNonStationary; |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace webrtc | 171 } // namespace webrtc |
| OLD | NEW |