Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: webrtc/modules/audio_processing/logging/apm_data_dumper.h

Issue 2090583002: New module for the adaptive level controlling functionality in the audio processing module (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Corrected the initial behavior for the peak level estimate, and ensured a nonzero minimum peak leveā€¦ Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 fwrite(v, sizeof(v[0]), v_length, file); 66 fwrite(v, sizeof(v[0]), v_length, file);
67 #endif 67 #endif
68 } 68 }
69 69
70 void DumpRaw(const char* name, rtc::ArrayView<const float> v) { 70 void DumpRaw(const char* name, rtc::ArrayView<const float> v) {
71 #if WEBRTC_AEC_DEBUG_DUMP == 1 71 #if WEBRTC_AEC_DEBUG_DUMP == 1
72 DumpRaw(name, v.size(), v.data()); 72 DumpRaw(name, v.size(), v.data());
73 #endif 73 #endif
74 } 74 }
75 75
76 void DumpRaw(const char* name, int v_length, const bool* v) {
77 #if WEBRTC_AEC_DEBUG_DUMP == 1
78 FILE* file = GetRawFile(name);
79 for (int k = 0; k < v_length; ++k) {
80 int16_t value = static_cast<int16_t>(v[k]);
81 fwrite(&value, sizeof(value), 1, file);
82 }
83 #endif
84 }
85
86 void DumpRaw(const char* name, rtc::ArrayView<const bool> v) {
87 #if WEBRTC_AEC_DEBUG_DUMP == 1
88 DumpRaw(name, v.size(), v.data());
89 #endif
90 }
91
76 void DumpRaw(const char* name, int v_length, const int16_t* v) { 92 void DumpRaw(const char* name, int v_length, const int16_t* v) {
77 #if WEBRTC_AEC_DEBUG_DUMP == 1 93 #if WEBRTC_AEC_DEBUG_DUMP == 1
78 FILE* file = GetRawFile(name); 94 FILE* file = GetRawFile(name);
79 fwrite(v, sizeof(v[0]), v_length, file); 95 fwrite(v, sizeof(v[0]), v_length, file);
80 #endif 96 #endif
81 } 97 }
82 98
83 void DumpRaw(const char* name, rtc::ArrayView<const int16_t> v) { 99 void DumpRaw(const char* name, rtc::ArrayView<const int16_t> v) {
84 #if WEBRTC_AEC_DEBUG_DUMP == 1 100 #if WEBRTC_AEC_DEBUG_DUMP == 1
85 DumpRaw(name, v.size(), v.data()); 101 DumpRaw(name, v.size(), v.data());
(...skipping 17 matching lines...) Expand all
103 int v_length, 119 int v_length,
104 const float* v, 120 const float* v,
105 int sample_rate_hz, 121 int sample_rate_hz,
106 int num_channels) { 122 int num_channels) {
107 #if WEBRTC_AEC_DEBUG_DUMP == 1 123 #if WEBRTC_AEC_DEBUG_DUMP == 1
108 WavWriter* file = GetWavFile(name, sample_rate_hz, num_channels); 124 WavWriter* file = GetWavFile(name, sample_rate_hz, num_channels);
109 file->WriteSamples(v, v_length); 125 file->WriteSamples(v, v_length);
110 #endif 126 #endif
111 } 127 }
112 128
129 void DumpWav(const char* name,
130 rtc::ArrayView<const float> v,
131 int sample_rate_hz,
132 int num_channels) {
133 #if WEBRTC_AEC_DEBUG_DUMP == 1
134 DumpWav(name, v.size(), v.data(), sample_rate_hz, num_channels);
135 #endif
136 }
137
113 private: 138 private:
114 #if WEBRTC_AEC_DEBUG_DUMP == 1 139 #if WEBRTC_AEC_DEBUG_DUMP == 1
115 const int instance_index_; 140 const int instance_index_;
116 int recording_set_index_ = 0; 141 int recording_set_index_ = 0;
117 std::unordered_map<std::string, std::unique_ptr<FILE, RawFileCloseFunctor>> 142 std::unordered_map<std::string, std::unique_ptr<FILE, RawFileCloseFunctor>>
118 raw_files_; 143 raw_files_;
119 std::unordered_map<std::string, std::unique_ptr<WavWriter>> wav_files_; 144 std::unordered_map<std::string, std::unique_ptr<WavWriter>> wav_files_;
120 145
121 FILE* GetRawFile(const char* name); 146 FILE* GetRawFile(const char* name);
122 WavWriter* GetWavFile(const char* name, int sample_rate_hz, int num_channels); 147 WavWriter* GetWavFile(const char* name, int sample_rate_hz, int num_channels);
123 #endif 148 #endif
124 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ApmDataDumper); 149 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ApmDataDumper);
125 }; 150 };
126 151
127 } // namespace webrtc 152 } // namespace webrtc
128 153
129 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LOGGING_APM_DATA_DUMPER_H_ 154 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LOGGING_APM_DATA_DUMPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698