blob: 989771ac69b813334ceefdf63da91f865c73dad0 [file] [log] [blame]
peah57d5a2e2016-03-29 09:48:36 -07001/*
2 * Copyright (c) 2016 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#include <vector>
11
peah57d5a2e2016-03-29 09:48:36 -070012#include "webrtc/base/array_view.h"
13#include "webrtc/modules/audio_processing/audio_buffer.h"
14#include "webrtc/modules/audio_processing/gain_control_impl.h"
15#include "webrtc/modules/audio_processing/test/audio_buffer_tools.h"
16#include "webrtc/modules/audio_processing/test/bitexactness_tools.h"
kwibergac9f8762016-09-30 22:29:43 -070017#include "webrtc/test/gtest.h"
peah57d5a2e2016-03-29 09:48:36 -070018
peah57d5a2e2016-03-29 09:48:36 -070019namespace webrtc {
20namespace {
21
22const int kNumFramesToProcess = 100;
23
24void ProcessOneFrame(int sample_rate_hz,
25 AudioBuffer* render_audio_buffer,
26 AudioBuffer* capture_audio_buffer,
27 GainControlImpl* gain_controller) {
28 if (sample_rate_hz > AudioProcessing::kSampleRate16kHz) {
29 render_audio_buffer->SplitIntoFrequencyBands();
30 capture_audio_buffer->SplitIntoFrequencyBands();
31 }
32
33 gain_controller->ProcessRenderAudio(render_audio_buffer);
peah12986c42016-10-22 02:38:32 -070034 gain_controller->ReadQueuedRenderData();
peah57d5a2e2016-03-29 09:48:36 -070035 gain_controller->AnalyzeCaptureAudio(capture_audio_buffer);
36 gain_controller->ProcessCaptureAudio(capture_audio_buffer, false);
37
38 if (sample_rate_hz > AudioProcessing::kSampleRate16kHz) {
39 capture_audio_buffer->MergeFrequencyBands();
40 }
41}
42
43void SetupComponent(int sample_rate_hz,
44 GainControl::Mode mode,
45 int target_level_dbfs,
46 int stream_analog_level,
47 int compression_gain_db,
48 bool enable_limiter,
49 int analog_level_min,
50 int analog_level_max,
51 GainControlImpl* gain_controller) {
52 gain_controller->Initialize(1, sample_rate_hz);
53 GainControl* gc = static_cast<GainControl*>(gain_controller);
54 gc->Enable(true);
55 gc->set_mode(mode);
56 gc->set_stream_analog_level(stream_analog_level);
57 gc->set_target_level_dbfs(target_level_dbfs);
58 gc->set_compression_gain_db(compression_gain_db);
59 gc->enable_limiter(enable_limiter);
60 gc->set_analog_level_limits(analog_level_min, analog_level_max);
61}
62
63void RunBitExactnessTest(int sample_rate_hz,
64 size_t num_channels,
65 GainControl::Mode mode,
66 int target_level_dbfs,
67 int stream_analog_level,
68 int compression_gain_db,
69 bool enable_limiter,
70 int analog_level_min,
71 int analog_level_max,
72 int achieved_stream_analog_level_reference,
73 rtc::ArrayView<const float> output_reference) {
74 rtc::CriticalSection crit_render;
75 rtc::CriticalSection crit_capture;
76 GainControlImpl gain_controller(&crit_render, &crit_capture);
77 SetupComponent(sample_rate_hz, mode, target_level_dbfs, stream_analog_level,
78 compression_gain_db, enable_limiter, analog_level_min,
79 analog_level_max, &gain_controller);
80
81 const int samples_per_channel = rtc::CheckedDivExact(sample_rate_hz, 100);
82 const StreamConfig render_config(sample_rate_hz, num_channels, false);
83 AudioBuffer render_buffer(
84 render_config.num_frames(), render_config.num_channels(),
85 render_config.num_frames(), 1, render_config.num_frames());
86 test::InputAudioFile render_file(
87 test::GetApmRenderTestVectorFileName(sample_rate_hz));
88 std::vector<float> render_input(samples_per_channel * num_channels);
89
90 const StreamConfig capture_config(sample_rate_hz, num_channels, false);
91 AudioBuffer capture_buffer(
92 capture_config.num_frames(), capture_config.num_channels(),
93 capture_config.num_frames(), 1, capture_config.num_frames());
94 test::InputAudioFile capture_file(
95 test::GetApmCaptureTestVectorFileName(sample_rate_hz));
96 std::vector<float> capture_input(samples_per_channel * num_channels);
97
98 for (int frame_no = 0; frame_no < kNumFramesToProcess; ++frame_no) {
99 ReadFloatSamplesFromStereoFile(samples_per_channel, num_channels,
100 &render_file, render_input);
101 ReadFloatSamplesFromStereoFile(samples_per_channel, num_channels,
102 &capture_file, capture_input);
103
104 test::CopyVectorToAudioBuffer(render_config, render_input, &render_buffer);
105 test::CopyVectorToAudioBuffer(capture_config, capture_input,
106 &capture_buffer);
107
108 ProcessOneFrame(sample_rate_hz, &render_buffer, &capture_buffer,
109 &gain_controller);
110 }
111
112 // Extract and verify the test results.
113 std::vector<float> capture_output;
114 test::ExtractVectorFromAudioBuffer(capture_config, &capture_buffer,
115 &capture_output);
116
117 EXPECT_EQ(achieved_stream_analog_level_reference,
118 gain_controller.stream_analog_level());
119
120 // Compare the output with the reference. Only the first values of the output
121 // from last frame processed are compared in order not having to specify all
122 // preceeding frames as testvectors. As the algorithm being tested has a
123 // memory, testing only the last frame implicitly also tests the preceeding
124 // frames.
peah7ea928e2016-03-30 08:13:57 -0700125 const float kElementErrorBound = 1.0f / 32768.0f;
126 EXPECT_TRUE(test::VerifyDeinterleavedArray(
peah57d5a2e2016-03-29 09:48:36 -0700127 capture_config.num_frames(), capture_config.num_channels(),
peah7ea928e2016-03-30 08:13:57 -0700128 output_reference, capture_output, kElementErrorBound));
peah57d5a2e2016-03-29 09:48:36 -0700129}
130
131} // namespace
132
peah51fbdd62016-03-30 14:58:32 -0700133// TODO(peah): Activate all these tests for ARM and ARM64 once the issue on the
134// Chromium ARM and ARM64 boths have been identified. This is tracked in the
135// issue https://bugs.chromium.org/p/webrtc/issues/detail?id=5711.
136
137#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
138 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700139TEST(GainControlBitExactnessTest,
140 Mono8kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700141#else
142TEST(GainControlBitExactnessTest,
143 DISABLED_Mono8kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
144#endif
peah57d5a2e2016-03-29 09:48:36 -0700145 const int kStreamAnalogLevelReference = 50;
146 const float kOutputReference[] = {-0.006622f, -0.002747f, 0.001587f};
147 RunBitExactnessTest(8000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
148 true, 0, 100, kStreamAnalogLevelReference,
149 kOutputReference);
150}
151
peah51fbdd62016-03-30 14:58:32 -0700152#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
153 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700154TEST(GainControlBitExactnessTest,
155 Mono16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700156#else
157TEST(GainControlBitExactnessTest,
158 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
159#endif
peah57d5a2e2016-03-29 09:48:36 -0700160 const int kStreamAnalogLevelReference = 50;
161 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f};
162 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
163 true, 0, 100, kStreamAnalogLevelReference,
164 kOutputReference);
165}
166
peah51fbdd62016-03-30 14:58:32 -0700167#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
168 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700169TEST(GainControlBitExactnessTest,
170 Stereo16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700171#else
172TEST(GainControlBitExactnessTest,
173 DISABLED_Stereo16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
174#endif
peah57d5a2e2016-03-29 09:48:36 -0700175 const int kStreamAnalogLevelReference = 50;
176 const float kOutputReference[] = {-0.027313f, -0.015900f, -0.028107f,
177 -0.027313f, -0.015900f, -0.028107f};
178 RunBitExactnessTest(16000, 2, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
179 true, 0, 100, kStreamAnalogLevelReference,
180 kOutputReference);
181}
182
peah51fbdd62016-03-30 14:58:32 -0700183#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
184 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700185TEST(GainControlBitExactnessTest,
186 Mono32kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700187#else
188TEST(GainControlBitExactnessTest,
189 DISABLED_Mono32kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
190#endif
peah57d5a2e2016-03-29 09:48:36 -0700191 const int kStreamAnalogLevelReference = 50;
192 const float kOutputReference[] = {-0.010162f, -0.009155f, -0.008301f};
193 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
194 true, 0, 100, kStreamAnalogLevelReference,
195 kOutputReference);
196}
197
peah51fbdd62016-03-30 14:58:32 -0700198#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
199 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700200TEST(GainControlBitExactnessTest,
201 Mono48kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700202#else
203TEST(GainControlBitExactnessTest,
204 DISABLED_Mono48kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
205#endif
peah57d5a2e2016-03-29 09:48:36 -0700206 const int kStreamAnalogLevelReference = 50;
207 const float kOutputReference[] = {-0.010162f, -0.009155f, -0.008301f};
208 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
209 true, 0, 100, kStreamAnalogLevelReference,
210 kOutputReference);
211}
212
peah51fbdd62016-03-30 14:58:32 -0700213#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
214 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700215TEST(GainControlBitExactnessTest,
216 Mono8kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700217#else
218TEST(GainControlBitExactnessTest,
219 DISABLED_Mono8kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
220#endif
peah57d5a2e2016-03-29 09:48:36 -0700221 const int kStreamAnalogLevelReference = 50;
minyuefd634c42016-06-17 04:36:10 -0700222 const float kOutputReference[] = {-0.004028f, -0.001678f, 0.000946f};
peah57d5a2e2016-03-29 09:48:36 -0700223 RunBitExactnessTest(8000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
224 true, 0, 100, kStreamAnalogLevelReference,
225 kOutputReference);
226}
227
peah51fbdd62016-03-30 14:58:32 -0700228#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
229 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700230TEST(GainControlBitExactnessTest,
231 Mono16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700232#else
233TEST(GainControlBitExactnessTest,
234 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
235#endif
peah57d5a2e2016-03-29 09:48:36 -0700236 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 02:38:32 -0700237 const float kOutputReference[] = {-0.003967f, -0.002777f, -0.001770f};
peah57d5a2e2016-03-29 09:48:36 -0700238 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
239 true, 0, 100, kStreamAnalogLevelReference,
240 kOutputReference);
241}
242
peah51fbdd62016-03-30 14:58:32 -0700243#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
244 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700245TEST(GainControlBitExactnessTest,
246 Stereo16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700247#else
248TEST(GainControlBitExactnessTest,
249 DISABLED_Stereo16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
250#endif
peah57d5a2e2016-03-29 09:48:36 -0700251 const int kStreamAnalogLevelReference = 50;
minyuefd634c42016-06-17 04:36:10 -0700252 const float kOutputReference[] = {-0.015411f, -0.008972f, -0.015839f,
253 -0.015411f, -0.008972f, -0.015839f};
peah57d5a2e2016-03-29 09:48:36 -0700254 RunBitExactnessTest(16000, 2, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
255 true, 0, 100, kStreamAnalogLevelReference,
256 kOutputReference);
257}
258
peah51fbdd62016-03-30 14:58:32 -0700259#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
260 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700261TEST(GainControlBitExactnessTest,
262 Mono32kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700263#else
264TEST(GainControlBitExactnessTest,
265 DISABLED_Mono32kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
266#endif
peah57d5a2e2016-03-29 09:48:36 -0700267 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 02:38:32 -0700268 const float kOutputReference[] = {-0.006104f, -0.005524f, -0.004974f};
peah57d5a2e2016-03-29 09:48:36 -0700269 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
270 true, 0, 100, kStreamAnalogLevelReference,
271 kOutputReference);
272}
273
peah51fbdd62016-03-30 14:58:32 -0700274#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
275 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700276TEST(GainControlBitExactnessTest,
277 Mono48kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700278#else
279TEST(GainControlBitExactnessTest,
280 DISABLED_Mono48kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
281#endif
peah57d5a2e2016-03-29 09:48:36 -0700282 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 02:38:32 -0700283 const float kOutputReference[] = {-0.006104f, -0.005524f, -0.004974f};
peah57d5a2e2016-03-29 09:48:36 -0700284 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
285 true, 0, 100, kStreamAnalogLevelReference,
286 kOutputReference);
287}
288
peah51fbdd62016-03-30 14:58:32 -0700289#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
290 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700291TEST(GainControlBitExactnessTest,
292 Mono8kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700293#else
294TEST(GainControlBitExactnessTest,
295 DISABLED_Mono8kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
296#endif
peah57d5a2e2016-03-29 09:48:36 -0700297 const int kStreamAnalogLevelReference = 50;
298 const float kOutputReference[] = {-0.011871f, -0.004944f, 0.002838f};
299 RunBitExactnessTest(8000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
300 true, 0, 100, kStreamAnalogLevelReference,
301 kOutputReference);
302}
303
peah51fbdd62016-03-30 14:58:32 -0700304#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
305 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700306TEST(GainControlBitExactnessTest,
307 Mono16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700308#else
309TEST(GainControlBitExactnessTest,
310 DISABLED_Mono16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
311#endif
peah57d5a2e2016-03-29 09:48:36 -0700312 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 02:38:32 -0700313 const float kOutputReference[] = {-0.011749f, -0.008270f, -0.005219f};
peah57d5a2e2016-03-29 09:48:36 -0700314 RunBitExactnessTest(16000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
315 true, 0, 100, kStreamAnalogLevelReference,
316 kOutputReference);
317}
318
peah51fbdd62016-03-30 14:58:32 -0700319#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
320 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700321TEST(GainControlBitExactnessTest,
322 Stereo16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700323#else
324TEST(GainControlBitExactnessTest,
325 DISABLED_Stereo16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
326#endif
peah57d5a2e2016-03-29 09:48:36 -0700327 const int kStreamAnalogLevelReference = 50;
328 const float kOutputReference[] = {-0.048950f, -0.028503f, -0.050354f,
329 -0.048950f, -0.028503f, -0.050354f};
330 RunBitExactnessTest(16000, 2, GainControl::Mode::kFixedDigital, 10, 50, 5,
331 true, 0, 100, kStreamAnalogLevelReference,
332 kOutputReference);
333}
334
peah51fbdd62016-03-30 14:58:32 -0700335#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
336 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700337TEST(GainControlBitExactnessTest,
338 Mono32kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700339#else
340TEST(GainControlBitExactnessTest,
341 DISABLED_Mono32kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
342#endif
peah57d5a2e2016-03-29 09:48:36 -0700343 const int kStreamAnalogLevelReference = 50;
344 const float kOutputReference[] = {-0.018188f, -0.016418f, -0.014862f};
345 RunBitExactnessTest(32000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
346 true, 0, 100, kStreamAnalogLevelReference,
347 kOutputReference);
348}
349
peah51fbdd62016-03-30 14:58:32 -0700350#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
351 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700352TEST(GainControlBitExactnessTest,
353 Mono48kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700354#else
355TEST(GainControlBitExactnessTest,
356 DISABLED_Mono48kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
357#endif
peah57d5a2e2016-03-29 09:48:36 -0700358 const int kStreamAnalogLevelReference = 50;
359 const float kOutputReference[] = {-0.018188f, -0.016418f, -0.014862f};
360 RunBitExactnessTest(32000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
361 true, 0, 100, kStreamAnalogLevelReference,
362 kOutputReference);
363}
364
peah51fbdd62016-03-30 14:58:32 -0700365#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
366 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700367TEST(GainControlBitExactnessTest,
368 Mono16kHz_AdaptiveAnalog_Tl10_SL10_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700369#else
370TEST(GainControlBitExactnessTest,
371 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL10_CG5_Lim_AL0_100) {
372#endif
peah57d5a2e2016-03-29 09:48:36 -0700373 const int kStreamAnalogLevelReference = 12;
374 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f};
375 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 10, 5,
376 true, 0, 100, kStreamAnalogLevelReference,
377 kOutputReference);
378}
379
peah51fbdd62016-03-30 14:58:32 -0700380#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
381 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700382TEST(GainControlBitExactnessTest,
383 Mono16kHz_AdaptiveAnalog_Tl10_SL100_CG5_Lim_AL70_80) {
peah51fbdd62016-03-30 14:58:32 -0700384#else
385TEST(GainControlBitExactnessTest,
386 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL100_CG5_Lim_AL70_80) {
387#endif
peah57d5a2e2016-03-29 09:48:36 -0700388 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 02:38:32 -0700389 const float kOutputReference[] = {-0.003998f, -0.002808f, -0.001770f};
peah57d5a2e2016-03-29 09:48:36 -0700390 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 100, 5,
391 true, 70, 80, kStreamAnalogLevelReference,
392 kOutputReference);
393}
394
peah51fbdd62016-03-30 14:58:32 -0700395#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
396 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700397TEST(GainControlBitExactnessTest,
398 Mono16kHz_AdaptiveDigital_Tl10_SL100_CG5_NoLim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700399#else
400TEST(GainControlBitExactnessTest,
401 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL100_CG5_NoLim_AL0_100) {
402#endif
peah57d5a2e2016-03-29 09:48:36 -0700403 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 02:38:32 -0700404 const float kOutputReference[] = {-0.004028f, -0.002838f, -0.001770f};
peah57d5a2e2016-03-29 09:48:36 -0700405 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 100, 5,
406 false, 0, 100, kStreamAnalogLevelReference,
407 kOutputReference);
408}
409
peah51fbdd62016-03-30 14:58:32 -0700410#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
411 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700412TEST(GainControlBitExactnessTest,
413 Mono16kHz_AdaptiveDigital_Tl40_SL100_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700414#else
415TEST(GainControlBitExactnessTest,
416 DISABLED_Mono16kHz_AdaptiveDigital_Tl40_SL100_CG5_Lim_AL0_100) {
417#endif
peah57d5a2e2016-03-29 09:48:36 -0700418 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 02:38:32 -0700419 const float kOutputReference[] = {-0.008728f, -0.006134f, -0.003845f};
peah57d5a2e2016-03-29 09:48:36 -0700420 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 40, 100, 5,
421 true, 0, 100, kStreamAnalogLevelReference,
422 kOutputReference);
423}
424
peah51fbdd62016-03-30 14:58:32 -0700425#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
426 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700427TEST(GainControlBitExactnessTest,
428 Mono16kHz_AdaptiveDigital_Tl10_SL100_CG30_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700429#else
430TEST(GainControlBitExactnessTest,
431 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL100_CG30_Lim_AL0_100) {
432#endif
peah57d5a2e2016-03-29 09:48:36 -0700433 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 02:38:32 -0700434 const float kOutputReference[] = {-0.005859f, -0.004120f, -0.002594f};
peah57d5a2e2016-03-29 09:48:36 -0700435 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 100,
436 30, true, 0, 100, kStreamAnalogLevelReference,
437 kOutputReference);
438}
439
440} // namespace webrtc