blob: e249a11cad05b44c15f20155d1fa86eb8bb2a00a [file] [log] [blame]
peah57d5a2e2016-03-29 16:48:361/*
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 04:47:3112#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 16:48:3618
peah57d5a2e2016-03-29 16:48:3619namespace 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 12:42:2033 std::vector<int16_t> render_audio;
34 GainControlImpl::PackRenderAudioBuffer(render_audio_buffer, &render_audio);
35 gain_controller->ProcessRenderAudio(render_audio);
peah57d5a2e2016-03-29 16:48:3636 gain_controller->AnalyzeCaptureAudio(capture_audio_buffer);
37 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 12:28:0875 GainControlImpl gain_controller;
peah57d5a2e2016-03-29 16:48:3676 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(
83 render_config.num_frames(), render_config.num_channels(),
84 render_config.num_frames(), 1, render_config.num_frames());
85 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(
91 capture_config.num_frames(), capture_config.num_channels(),
92 capture_config.num_frames(), 1, capture_config.num_frames());
93 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 15:13:57124 const float kElementErrorBound = 1.0f / 32768.0f;
125 EXPECT_TRUE(test::VerifyDeinterleavedArray(
peah57d5a2e2016-03-29 16:48:36126 capture_config.num_frames(), capture_config.num_channels(),
peah7ea928e2016-03-30 15:13:57127 output_reference, capture_output, kElementErrorBound));
peah57d5a2e2016-03-29 16:48:36128}
129
130} // namespace
131
peah51fbdd62016-03-30 21:58:32132// 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 16:48:36138TEST(GainControlBitExactnessTest,
139 Mono8kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32140#else
141TEST(GainControlBitExactnessTest,
142 DISABLED_Mono8kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
143#endif
peah57d5a2e2016-03-29 16:48:36144 const int kStreamAnalogLevelReference = 50;
145 const float kOutputReference[] = {-0.006622f, -0.002747f, 0.001587f};
146 RunBitExactnessTest(8000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
147 true, 0, 100, kStreamAnalogLevelReference,
148 kOutputReference);
149}
150
peah51fbdd62016-03-30 21:58:32151#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
152 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36153TEST(GainControlBitExactnessTest,
154 Mono16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32155#else
156TEST(GainControlBitExactnessTest,
157 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
158#endif
peah57d5a2e2016-03-29 16:48:36159 const int kStreamAnalogLevelReference = 50;
160 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f};
161 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
162 true, 0, 100, kStreamAnalogLevelReference,
163 kOutputReference);
164}
165
peah51fbdd62016-03-30 21:58:32166#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
167 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36168TEST(GainControlBitExactnessTest,
169 Stereo16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32170#else
171TEST(GainControlBitExactnessTest,
172 DISABLED_Stereo16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
173#endif
peah57d5a2e2016-03-29 16:48:36174 const int kStreamAnalogLevelReference = 50;
175 const float kOutputReference[] = {-0.027313f, -0.015900f, -0.028107f,
176 -0.027313f, -0.015900f, -0.028107f};
177 RunBitExactnessTest(16000, 2, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
178 true, 0, 100, kStreamAnalogLevelReference,
179 kOutputReference);
180}
181
peah51fbdd62016-03-30 21:58:32182#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
183 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36184TEST(GainControlBitExactnessTest,
185 Mono32kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32186#else
187TEST(GainControlBitExactnessTest,
188 DISABLED_Mono32kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
189#endif
peah57d5a2e2016-03-29 16:48:36190 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 21:58:32197#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
198 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36199TEST(GainControlBitExactnessTest,
200 Mono48kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32201#else
202TEST(GainControlBitExactnessTest,
203 DISABLED_Mono48kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
204#endif
peah57d5a2e2016-03-29 16:48:36205 const int kStreamAnalogLevelReference = 50;
206 const float kOutputReference[] = {-0.010162f, -0.009155f, -0.008301f};
207 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
208 true, 0, 100, kStreamAnalogLevelReference,
209 kOutputReference);
210}
211
peah51fbdd62016-03-30 21:58:32212#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
213 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36214TEST(GainControlBitExactnessTest,
215 Mono8kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32216#else
217TEST(GainControlBitExactnessTest,
218 DISABLED_Mono8kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
219#endif
peah57d5a2e2016-03-29 16:48:36220 const int kStreamAnalogLevelReference = 50;
minyuefd634c42016-06-17 11:36:10221 const float kOutputReference[] = {-0.004028f, -0.001678f, 0.000946f};
peah57d5a2e2016-03-29 16:48:36222 RunBitExactnessTest(8000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
223 true, 0, 100, kStreamAnalogLevelReference,
224 kOutputReference);
225}
226
peah51fbdd62016-03-30 21:58:32227#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
228 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36229TEST(GainControlBitExactnessTest,
230 Mono16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32231#else
232TEST(GainControlBitExactnessTest,
233 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
234#endif
peah57d5a2e2016-03-29 16:48:36235 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 09:38:32236 const float kOutputReference[] = {-0.003967f, -0.002777f, -0.001770f};
peah57d5a2e2016-03-29 16:48:36237 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
238 true, 0, 100, kStreamAnalogLevelReference,
239 kOutputReference);
240}
241
peah51fbdd62016-03-30 21:58:32242#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
243 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36244TEST(GainControlBitExactnessTest,
245 Stereo16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32246#else
247TEST(GainControlBitExactnessTest,
248 DISABLED_Stereo16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
249#endif
peah57d5a2e2016-03-29 16:48:36250 const int kStreamAnalogLevelReference = 50;
minyuefd634c42016-06-17 11:36:10251 const float kOutputReference[] = {-0.015411f, -0.008972f, -0.015839f,
252 -0.015411f, -0.008972f, -0.015839f};
peah57d5a2e2016-03-29 16:48:36253 RunBitExactnessTest(16000, 2, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
254 true, 0, 100, kStreamAnalogLevelReference,
255 kOutputReference);
256}
257
peah51fbdd62016-03-30 21:58:32258#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
259 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36260TEST(GainControlBitExactnessTest,
261 Mono32kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32262#else
263TEST(GainControlBitExactnessTest,
264 DISABLED_Mono32kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
265#endif
peah57d5a2e2016-03-29 16:48:36266 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 09:38:32267 const float kOutputReference[] = {-0.006104f, -0.005524f, -0.004974f};
peah57d5a2e2016-03-29 16:48:36268 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
269 true, 0, 100, kStreamAnalogLevelReference,
270 kOutputReference);
271}
272
peah51fbdd62016-03-30 21:58:32273#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
274 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36275TEST(GainControlBitExactnessTest,
276 Mono48kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32277#else
278TEST(GainControlBitExactnessTest,
279 DISABLED_Mono48kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
280#endif
peah57d5a2e2016-03-29 16:48:36281 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 09:38:32282 const float kOutputReference[] = {-0.006104f, -0.005524f, -0.004974f};
peah57d5a2e2016-03-29 16:48:36283 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
284 true, 0, 100, kStreamAnalogLevelReference,
285 kOutputReference);
286}
287
peah51fbdd62016-03-30 21:58:32288#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
289 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36290TEST(GainControlBitExactnessTest,
291 Mono8kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32292#else
293TEST(GainControlBitExactnessTest,
294 DISABLED_Mono8kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
295#endif
peah57d5a2e2016-03-29 16:48:36296 const int kStreamAnalogLevelReference = 50;
297 const float kOutputReference[] = {-0.011871f, -0.004944f, 0.002838f};
298 RunBitExactnessTest(8000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
299 true, 0, 100, kStreamAnalogLevelReference,
300 kOutputReference);
301}
302
peah51fbdd62016-03-30 21:58:32303#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
304 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36305TEST(GainControlBitExactnessTest,
306 Mono16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32307#else
308TEST(GainControlBitExactnessTest,
309 DISABLED_Mono16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
310#endif
peah57d5a2e2016-03-29 16:48:36311 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 09:38:32312 const float kOutputReference[] = {-0.011749f, -0.008270f, -0.005219f};
peah57d5a2e2016-03-29 16:48:36313 RunBitExactnessTest(16000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
314 true, 0, 100, kStreamAnalogLevelReference,
315 kOutputReference);
316}
317
peah51fbdd62016-03-30 21:58:32318#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
319 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36320TEST(GainControlBitExactnessTest,
321 Stereo16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32322#else
323TEST(GainControlBitExactnessTest,
324 DISABLED_Stereo16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
325#endif
peah57d5a2e2016-03-29 16:48:36326 const int kStreamAnalogLevelReference = 50;
327 const float kOutputReference[] = {-0.048950f, -0.028503f, -0.050354f,
328 -0.048950f, -0.028503f, -0.050354f};
329 RunBitExactnessTest(16000, 2, GainControl::Mode::kFixedDigital, 10, 50, 5,
330 true, 0, 100, kStreamAnalogLevelReference,
331 kOutputReference);
332}
333
peah51fbdd62016-03-30 21:58:32334#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
335 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36336TEST(GainControlBitExactnessTest,
337 Mono32kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32338#else
339TEST(GainControlBitExactnessTest,
340 DISABLED_Mono32kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
341#endif
peah57d5a2e2016-03-29 16:48:36342 const int kStreamAnalogLevelReference = 50;
343 const float kOutputReference[] = {-0.018188f, -0.016418f, -0.014862f};
344 RunBitExactnessTest(32000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
345 true, 0, 100, kStreamAnalogLevelReference,
346 kOutputReference);
347}
348
peah51fbdd62016-03-30 21:58:32349#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
350 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36351TEST(GainControlBitExactnessTest,
352 Mono48kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32353#else
354TEST(GainControlBitExactnessTest,
355 DISABLED_Mono48kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
356#endif
peah57d5a2e2016-03-29 16:48:36357 const int kStreamAnalogLevelReference = 50;
358 const float kOutputReference[] = {-0.018188f, -0.016418f, -0.014862f};
359 RunBitExactnessTest(32000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
360 true, 0, 100, kStreamAnalogLevelReference,
361 kOutputReference);
362}
363
peah51fbdd62016-03-30 21:58:32364#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
365 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36366TEST(GainControlBitExactnessTest,
367 Mono16kHz_AdaptiveAnalog_Tl10_SL10_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32368#else
369TEST(GainControlBitExactnessTest,
370 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL10_CG5_Lim_AL0_100) {
371#endif
peah57d5a2e2016-03-29 16:48:36372 const int kStreamAnalogLevelReference = 12;
373 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f};
374 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 10, 5,
375 true, 0, 100, kStreamAnalogLevelReference,
376 kOutputReference);
377}
378
peah51fbdd62016-03-30 21:58:32379#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
380 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36381TEST(GainControlBitExactnessTest,
382 Mono16kHz_AdaptiveAnalog_Tl10_SL100_CG5_Lim_AL70_80) {
peah51fbdd62016-03-30 21:58:32383#else
384TEST(GainControlBitExactnessTest,
385 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL100_CG5_Lim_AL70_80) {
386#endif
peah57d5a2e2016-03-29 16:48:36387 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 09:38:32388 const float kOutputReference[] = {-0.003998f, -0.002808f, -0.001770f};
peah57d5a2e2016-03-29 16:48:36389 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 100, 5,
390 true, 70, 80, kStreamAnalogLevelReference,
391 kOutputReference);
392}
393
peah51fbdd62016-03-30 21:58:32394#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
395 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36396TEST(GainControlBitExactnessTest,
397 Mono16kHz_AdaptiveDigital_Tl10_SL100_CG5_NoLim_AL0_100) {
peah51fbdd62016-03-30 21:58:32398#else
399TEST(GainControlBitExactnessTest,
400 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL100_CG5_NoLim_AL0_100) {
401#endif
peah57d5a2e2016-03-29 16:48:36402 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 09:38:32403 const float kOutputReference[] = {-0.004028f, -0.002838f, -0.001770f};
peah57d5a2e2016-03-29 16:48:36404 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 100, 5,
405 false, 0, 100, kStreamAnalogLevelReference,
406 kOutputReference);
407}
408
peah51fbdd62016-03-30 21:58:32409#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
410 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36411TEST(GainControlBitExactnessTest,
412 Mono16kHz_AdaptiveDigital_Tl40_SL100_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32413#else
414TEST(GainControlBitExactnessTest,
415 DISABLED_Mono16kHz_AdaptiveDigital_Tl40_SL100_CG5_Lim_AL0_100) {
416#endif
peah57d5a2e2016-03-29 16:48:36417 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 09:38:32418 const float kOutputReference[] = {-0.008728f, -0.006134f, -0.003845f};
peah57d5a2e2016-03-29 16:48:36419 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 40, 100, 5,
420 true, 0, 100, kStreamAnalogLevelReference,
421 kOutputReference);
422}
423
peah51fbdd62016-03-30 21:58:32424#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
425 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36426TEST(GainControlBitExactnessTest,
427 Mono16kHz_AdaptiveDigital_Tl10_SL100_CG30_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32428#else
429TEST(GainControlBitExactnessTest,
430 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL100_CG30_Lim_AL0_100) {
431#endif
peah57d5a2e2016-03-29 16:48:36432 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 09:38:32433 const float kOutputReference[] = {-0.005859f, -0.004120f, -0.002594f};
peah57d5a2e2016-03-29 16:48:36434 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 100,
435 30, true, 0, 100, kStreamAnalogLevelReference,
436 kOutputReference);
437}
438
439} // namespace webrtc