Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_METRICS_H_ | |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_METRICS_H_ | |
| 13 | |
| 14 #include "webrtc/base/constructormagic.h" | |
| 15 #include "webrtc/modules/audio_processing/aec3/aec_state.h" | |
| 16 | |
| 17 namespace webrtc { | |
| 18 | |
| 19 // Handles the reporting of metrics for the echo remover. | |
| 20 class EchoRemoverMetrics { | |
| 21 public: | |
| 22 struct DbMetric { | |
| 23 DbMetric(); | |
| 24 DbMetric(float sum_value, float floor_value, float ceil_value); | |
| 25 void Update(float value); | |
| 26 void FormatForReporting(bool negate, | |
| 27 float min_value, | |
| 28 float max_value, | |
| 29 float offset, | |
| 30 float scaling); | |
| 31 | |
| 32 float sum_value; | |
| 33 float floor_value; | |
| 34 float ceil_value; | |
| 35 }; | |
| 36 | |
| 37 EchoRemoverMetrics(); | |
| 38 | |
| 39 // Updates the metric with new data. | |
| 40 void Update( | |
| 41 const AecState& aec_state, | |
| 42 const std::array<float, kFftLengthBy2Plus1>& comfort_noise_spectrum, | |
| 43 const std::array<float, kFftLengthBy2Plus1>& suppressor_gain); | |
| 44 | |
| 45 // Returns true if the metrics has just been reported, otherwise false. | |
|
hlundin-webrtc
2017/02/28 10:04:23
has -> have
peah-webrtc
2017/02/28 12:57:26
Done.
| |
| 46 bool MetricsReported() { return metric_reported_; } | |
| 47 | |
| 48 private: | |
| 49 // Resets the metrics. | |
| 50 void ResetMetrics(); | |
| 51 | |
| 52 int block_counter_ = 0; | |
| 53 std::array<DbMetric, 2> erl_; | |
| 54 std::array<DbMetric, 2> erle_; | |
| 55 std::array<DbMetric, 2> comfort_noise_; | |
| 56 std::array<DbMetric, 2> suppressor_gain_; | |
| 57 int active_render_ = 0; | |
| 58 bool saturated_capture_ = false; | |
| 59 bool metric_reported_ = false; | |
|
hlundin-webrtc
2017/02/28 10:04:23
metrics_reported_
peah-webrtc
2017/02/28 12:57:26
Done.
| |
| 60 | |
| 61 RTC_DISALLOW_COPY_AND_ASSIGN(EchoRemoverMetrics); | |
| 62 }; | |
| 63 | |
| 64 namespace aec3 { | |
| 65 | |
| 66 // Updates a banded metric of type DbMetric with the values in the supplied | |
| 67 // array. | |
| 68 void UpdateDbMetric(const std::array<float, kFftLengthBy2Plus1>& value, | |
| 69 std::array<EchoRemoverMetrics::DbMetric, 2>* statistic); | |
| 70 | |
| 71 // Transforms a DbMetric from the linear domain into the logarithmic domain. | |
| 72 void TransformDbMetricForReporting(bool negate, | |
| 73 float min_value, | |
| 74 float max_value, | |
| 75 float offset, | |
| 76 float scaleing, | |
| 77 float* value); | |
| 78 | |
| 79 } // namespace aec3 | |
| 80 | |
| 81 } // namespace webrtc | |
| 82 | |
| 83 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_METRICS_H_ | |
| OLD | NEW |