blob: c1078b409bdddc1e06dbb14ef7608119fe1f301d [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020012#include "api/array_view.h"
13#include "modules/audio_processing/audio_buffer.h"
14#include "modules/audio_processing/gain_control_impl.h"
15#include "modules/audio_processing/test/audio_buffer_tools.h"
16#include "modules/audio_processing/test/bitexactness_tools.h"
17#include "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
peah701d6282016-10-25 05:42:20 -070033 std::vector<int16_t> render_audio;
Per Åhgrene35b32c2019-11-22 18:22:04 +010034 GainControlImpl::PackRenderAudioBuffer(*render_audio_buffer, &render_audio);
peah701d6282016-10-25 05:42:20 -070035 gain_controller->ProcessRenderAudio(render_audio);
Per Åhgrene35b32c2019-11-22 18:22:04 +010036 gain_controller->AnalyzeCaptureAudio(*capture_audio_buffer);
peah57d5a2e2016-03-29 09:48:36 -070037 gain_controller->ProcessCaptureAudio(capture_audio_buffer, false);
38
39 if (sample_rate_hz > AudioProcessing::kSampleRate16kHz) {
40 capture_audio_buffer->MergeFrequencyBands();
41 }
42}
43
44void SetupComponent(int sample_rate_hz,
45 GainControl::Mode mode,
46 int target_level_dbfs,
47 int stream_analog_level,
48 int compression_gain_db,
49 bool enable_limiter,
50 int analog_level_min,
51 int analog_level_max,
52 GainControlImpl* gain_controller) {
53 gain_controller->Initialize(1, sample_rate_hz);
54 GainControl* gc = static_cast<GainControl*>(gain_controller);
55 gc->Enable(true);
56 gc->set_mode(mode);
57 gc->set_stream_analog_level(stream_analog_level);
58 gc->set_target_level_dbfs(target_level_dbfs);
59 gc->set_compression_gain_db(compression_gain_db);
60 gc->enable_limiter(enable_limiter);
61 gc->set_analog_level_limits(analog_level_min, analog_level_max);
62}
63
64void RunBitExactnessTest(int sample_rate_hz,
65 size_t num_channels,
66 GainControl::Mode mode,
67 int target_level_dbfs,
68 int stream_analog_level,
69 int compression_gain_db,
70 bool enable_limiter,
71 int analog_level_min,
72 int analog_level_max,
73 int achieved_stream_analog_level_reference,
74 rtc::ArrayView<const float> output_reference) {
Sam Zackrissonf0d1c032019-03-27 13:28:08 +010075 GainControlImpl gain_controller;
peah57d5a2e2016-03-29 09:48:36 -070076 SetupComponent(sample_rate_hz, mode, target_level_dbfs, stream_analog_level,
77 compression_gain_db, enable_limiter, analog_level_min,
78 analog_level_max, &gain_controller);
79
80 const int samples_per_channel = rtc::CheckedDivExact(sample_rate_hz, 100);
81 const StreamConfig render_config(sample_rate_hz, num_channels, false);
82 AudioBuffer render_buffer(
Per Åhgrend47941e2019-08-22 11:51:13 +020083 render_config.sample_rate_hz(), render_config.num_channels(),
84 render_config.sample_rate_hz(), 1, render_config.sample_rate_hz(), 1);
peah57d5a2e2016-03-29 09:48:36 -070085 test::InputAudioFile render_file(
86 test::GetApmRenderTestVectorFileName(sample_rate_hz));
87 std::vector<float> render_input(samples_per_channel * num_channels);
88
89 const StreamConfig capture_config(sample_rate_hz, num_channels, false);
90 AudioBuffer capture_buffer(
Per Åhgrend47941e2019-08-22 11:51:13 +020091 capture_config.sample_rate_hz(), capture_config.num_channels(),
92 capture_config.sample_rate_hz(), 1, capture_config.sample_rate_hz(), 1);
peah57d5a2e2016-03-29 09:48:36 -070093 test::InputAudioFile capture_file(
94 test::GetApmCaptureTestVectorFileName(sample_rate_hz));
95 std::vector<float> capture_input(samples_per_channel * num_channels);
96
97 for (int frame_no = 0; frame_no < kNumFramesToProcess; ++frame_no) {
98 ReadFloatSamplesFromStereoFile(samples_per_channel, num_channels,
99 &render_file, render_input);
100 ReadFloatSamplesFromStereoFile(samples_per_channel, num_channels,
101 &capture_file, capture_input);
102
103 test::CopyVectorToAudioBuffer(render_config, render_input, &render_buffer);
104 test::CopyVectorToAudioBuffer(capture_config, capture_input,
105 &capture_buffer);
106
107 ProcessOneFrame(sample_rate_hz, &render_buffer, &capture_buffer,
108 &gain_controller);
109 }
110
111 // Extract and verify the test results.
112 std::vector<float> capture_output;
113 test::ExtractVectorFromAudioBuffer(capture_config, &capture_buffer,
114 &capture_output);
115
116 EXPECT_EQ(achieved_stream_analog_level_reference,
117 gain_controller.stream_analog_level());
118
119 // Compare the output with the reference. Only the first values of the output
120 // from last frame processed are compared in order not having to specify all
121 // preceeding frames as testvectors. As the algorithm being tested has a
122 // memory, testing only the last frame implicitly also tests the preceeding
123 // frames.
peah7ea928e2016-03-30 08:13:57 -0700124 const float kElementErrorBound = 1.0f / 32768.0f;
125 EXPECT_TRUE(test::VerifyDeinterleavedArray(
peah57d5a2e2016-03-29 09:48:36 -0700126 capture_config.num_frames(), capture_config.num_channels(),
peah7ea928e2016-03-30 08:13:57 -0700127 output_reference, capture_output, kElementErrorBound));
peah57d5a2e2016-03-29 09:48:36 -0700128}
129
130} // namespace
131
peah51fbdd62016-03-30 14:58:32 -0700132// TODO(peah): Activate all these tests for ARM and ARM64 once the issue on the
133// Chromium ARM and ARM64 boths have been identified. This is tracked in the
134// issue https://bugs.chromium.org/p/webrtc/issues/detail?id=5711.
135
136#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
137 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700138TEST(GainControlBitExactnessTest,
peah57d5a2e2016-03-29 09:48:36 -0700139 Mono16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700140#else
141TEST(GainControlBitExactnessTest,
142 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
143#endif
peah57d5a2e2016-03-29 09:48:36 -0700144 const int kStreamAnalogLevelReference = 50;
145 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f};
146 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
147 true, 0, 100, kStreamAnalogLevelReference,
148 kOutputReference);
149}
150
peah51fbdd62016-03-30 14:58:32 -0700151#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
152 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700153TEST(GainControlBitExactnessTest,
154 Stereo16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700155#else
156TEST(GainControlBitExactnessTest,
157 DISABLED_Stereo16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
158#endif
peah57d5a2e2016-03-29 09:48:36 -0700159 const int kStreamAnalogLevelReference = 50;
160 const float kOutputReference[] = {-0.027313f, -0.015900f, -0.028107f,
161 -0.027313f, -0.015900f, -0.028107f};
162 RunBitExactnessTest(16000, 2, 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 Mono32kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700171#else
172TEST(GainControlBitExactnessTest,
173 DISABLED_Mono32kHz_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.010162f, -0.009155f, -0.008301f};
177 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
178 true, 0, 100, kStreamAnalogLevelReference,
179 kOutputReference);
180}
181
peah51fbdd62016-03-30 14:58:32 -0700182#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
183 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700184TEST(GainControlBitExactnessTest,
185 Mono48kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700186#else
187TEST(GainControlBitExactnessTest,
188 DISABLED_Mono48kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
189#endif
peah57d5a2e2016-03-29 09:48:36 -0700190 const int kStreamAnalogLevelReference = 50;
191 const float kOutputReference[] = {-0.010162f, -0.009155f, -0.008301f};
192 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
193 true, 0, 100, kStreamAnalogLevelReference,
194 kOutputReference);
195}
196
peah51fbdd62016-03-30 14:58:32 -0700197#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
198 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700199TEST(GainControlBitExactnessTest,
peah57d5a2e2016-03-29 09:48:36 -0700200 Mono16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700201#else
202TEST(GainControlBitExactnessTest,
203 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
204#endif
peah57d5a2e2016-03-29 09:48:36 -0700205 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 02:38:32 -0700206 const float kOutputReference[] = {-0.003967f, -0.002777f, -0.001770f};
peah57d5a2e2016-03-29 09:48:36 -0700207 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
208 true, 0, 100, kStreamAnalogLevelReference,
209 kOutputReference);
210}
211
peah51fbdd62016-03-30 14:58:32 -0700212#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
213 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700214TEST(GainControlBitExactnessTest,
215 Stereo16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700216#else
217TEST(GainControlBitExactnessTest,
218 DISABLED_Stereo16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
219#endif
peah57d5a2e2016-03-29 09:48:36 -0700220 const int kStreamAnalogLevelReference = 50;
minyuefd634c42016-06-17 04:36:10 -0700221 const float kOutputReference[] = {-0.015411f, -0.008972f, -0.015839f,
222 -0.015411f, -0.008972f, -0.015839f};
peah57d5a2e2016-03-29 09:48:36 -0700223 RunBitExactnessTest(16000, 2, 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 Mono32kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700232#else
233TEST(GainControlBitExactnessTest,
234 DISABLED_Mono32kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
235#endif
peah57d5a2e2016-03-29 09:48:36 -0700236 const int kStreamAnalogLevelReference = 50;
Per Åhgren77dc1992019-11-23 00:14:31 +0100237 const float kOutputReference[] = {-0.006134f, -0.005524f, -0.005005f};
peah57d5a2e2016-03-29 09:48:36 -0700238 RunBitExactnessTest(32000, 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 Mono48kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700247#else
248TEST(GainControlBitExactnessTest,
249 DISABLED_Mono48kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
250#endif
peah57d5a2e2016-03-29 09:48:36 -0700251 const int kStreamAnalogLevelReference = 50;
Per Åhgren77dc1992019-11-23 00:14:31 +0100252 const float kOutputReference[] = {-0.006134f, -0.005524f, -0.005005};
peah57d5a2e2016-03-29 09:48:36 -0700253 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
254 true, 0, 100, kStreamAnalogLevelReference,
255 kOutputReference);
256}
257
peah51fbdd62016-03-30 14:58:32 -0700258#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
259 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700260TEST(GainControlBitExactnessTest,
peah57d5a2e2016-03-29 09:48:36 -0700261 Mono16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700262#else
263TEST(GainControlBitExactnessTest,
264 DISABLED_Mono16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
265#endif
peah57d5a2e2016-03-29 09:48:36 -0700266 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 02:38:32 -0700267 const float kOutputReference[] = {-0.011749f, -0.008270f, -0.005219f};
peah57d5a2e2016-03-29 09:48:36 -0700268 RunBitExactnessTest(16000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
269 true, 0, 100, kStreamAnalogLevelReference,
270 kOutputReference);
271}
272
peah51fbdd62016-03-30 14:58:32 -0700273#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
274 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700275TEST(GainControlBitExactnessTest,
276 Stereo16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700277#else
278TEST(GainControlBitExactnessTest,
279 DISABLED_Stereo16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
280#endif
peah57d5a2e2016-03-29 09:48:36 -0700281 const int kStreamAnalogLevelReference = 50;
Per Åhgren77dc1992019-11-23 00:14:31 +0100282 const float kOutputReference[] = {-0.048896f, -0.028479f, -0.050345f,
283 -0.048896f, -0.028479f, -0.050345f};
peah57d5a2e2016-03-29 09:48:36 -0700284 RunBitExactnessTest(16000, 2, GainControl::Mode::kFixedDigital, 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 Mono32kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700293#else
294TEST(GainControlBitExactnessTest,
295 DISABLED_Mono32kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
296#endif
peah57d5a2e2016-03-29 09:48:36 -0700297 const int kStreamAnalogLevelReference = 50;
Per Åhgren77dc1992019-11-23 00:14:31 +0100298 const float kOutputReference[] = {-0.018158f, -0.016357f, -0.014832f};
peah57d5a2e2016-03-29 09:48:36 -0700299 RunBitExactnessTest(32000, 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 Mono48kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700308#else
309TEST(GainControlBitExactnessTest,
310 DISABLED_Mono48kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
311#endif
peah57d5a2e2016-03-29 09:48:36 -0700312 const int kStreamAnalogLevelReference = 50;
Per Åhgren77dc1992019-11-23 00:14:31 +0100313 const float kOutputReference[] = {-0.018158f, -0.016357f, -0.014832f};
peah57d5a2e2016-03-29 09:48:36 -0700314 RunBitExactnessTest(32000, 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 Mono16kHz_AdaptiveAnalog_Tl10_SL10_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700323#else
324TEST(GainControlBitExactnessTest,
325 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL10_CG5_Lim_AL0_100) {
326#endif
peah57d5a2e2016-03-29 09:48:36 -0700327 const int kStreamAnalogLevelReference = 12;
328 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f};
329 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 10, 5,
330 true, 0, 100, kStreamAnalogLevelReference,
331 kOutputReference);
332}
333
peah51fbdd62016-03-30 14:58:32 -0700334#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
335 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700336TEST(GainControlBitExactnessTest,
337 Mono16kHz_AdaptiveAnalog_Tl10_SL100_CG5_Lim_AL70_80) {
peah51fbdd62016-03-30 14:58:32 -0700338#else
339TEST(GainControlBitExactnessTest,
340 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL100_CG5_Lim_AL70_80) {
341#endif
peah57d5a2e2016-03-29 09:48:36 -0700342 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 02:38:32 -0700343 const float kOutputReference[] = {-0.003998f, -0.002808f, -0.001770f};
peah57d5a2e2016-03-29 09:48:36 -0700344 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 100, 5,
345 true, 70, 80, kStreamAnalogLevelReference,
346 kOutputReference);
347}
348
peah51fbdd62016-03-30 14:58:32 -0700349#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
350 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700351TEST(GainControlBitExactnessTest,
352 Mono16kHz_AdaptiveDigital_Tl10_SL100_CG5_NoLim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700353#else
354TEST(GainControlBitExactnessTest,
355 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL100_CG5_NoLim_AL0_100) {
356#endif
peah57d5a2e2016-03-29 09:48:36 -0700357 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 02:38:32 -0700358 const float kOutputReference[] = {-0.004028f, -0.002838f, -0.001770f};
peah57d5a2e2016-03-29 09:48:36 -0700359 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 100, 5,
360 false, 0, 100, kStreamAnalogLevelReference,
361 kOutputReference);
362}
363
peah51fbdd62016-03-30 14:58:32 -0700364#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
365 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700366TEST(GainControlBitExactnessTest,
367 Mono16kHz_AdaptiveDigital_Tl40_SL100_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700368#else
369TEST(GainControlBitExactnessTest,
370 DISABLED_Mono16kHz_AdaptiveDigital_Tl40_SL100_CG5_Lim_AL0_100) {
371#endif
peah57d5a2e2016-03-29 09:48:36 -0700372 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 02:38:32 -0700373 const float kOutputReference[] = {-0.008728f, -0.006134f, -0.003845f};
peah57d5a2e2016-03-29 09:48:36 -0700374 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 40, 100, 5,
375 true, 0, 100, kStreamAnalogLevelReference,
376 kOutputReference);
377}
378
peah51fbdd62016-03-30 14:58:32 -0700379#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
380 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 09:48:36 -0700381TEST(GainControlBitExactnessTest,
382 Mono16kHz_AdaptiveDigital_Tl10_SL100_CG30_Lim_AL0_100) {
peah51fbdd62016-03-30 14:58:32 -0700383#else
384TEST(GainControlBitExactnessTest,
385 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL100_CG30_Lim_AL0_100) {
386#endif
peah57d5a2e2016-03-29 09:48:36 -0700387 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 02:38:32 -0700388 const float kOutputReference[] = {-0.005859f, -0.004120f, -0.002594f};
peah57d5a2e2016-03-29 09:48:36 -0700389 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 100,
390 30, true, 0, 100, kStreamAnalogLevelReference,
391 kOutputReference);
392}
393
394} // namespace webrtc