blob: 62908c7aecbd2f5c1ebacbca7184b18ca19fb6e5 [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) {
75 rtc::CriticalSection crit_render;
76 rtc::CriticalSection crit_capture;
77 GainControlImpl gain_controller(&crit_render, &crit_capture);
78 SetupComponent(sample_rate_hz, mode, target_level_dbfs, stream_analog_level,
79 compression_gain_db, enable_limiter, analog_level_min,
80 analog_level_max, &gain_controller);
81
82 const int samples_per_channel = rtc::CheckedDivExact(sample_rate_hz, 100);
83 const StreamConfig render_config(sample_rate_hz, num_channels, false);
84 AudioBuffer render_buffer(
85 render_config.num_frames(), render_config.num_channels(),
86 render_config.num_frames(), 1, render_config.num_frames());
87 test::InputAudioFile render_file(
88 test::GetApmRenderTestVectorFileName(sample_rate_hz));
89 std::vector<float> render_input(samples_per_channel * num_channels);
90
91 const StreamConfig capture_config(sample_rate_hz, num_channels, false);
92 AudioBuffer capture_buffer(
93 capture_config.num_frames(), capture_config.num_channels(),
94 capture_config.num_frames(), 1, capture_config.num_frames());
95 test::InputAudioFile capture_file(
96 test::GetApmCaptureTestVectorFileName(sample_rate_hz));
97 std::vector<float> capture_input(samples_per_channel * num_channels);
98
99 for (int frame_no = 0; frame_no < kNumFramesToProcess; ++frame_no) {
100 ReadFloatSamplesFromStereoFile(samples_per_channel, num_channels,
101 &render_file, render_input);
102 ReadFloatSamplesFromStereoFile(samples_per_channel, num_channels,
103 &capture_file, capture_input);
104
105 test::CopyVectorToAudioBuffer(render_config, render_input, &render_buffer);
106 test::CopyVectorToAudioBuffer(capture_config, capture_input,
107 &capture_buffer);
108
109 ProcessOneFrame(sample_rate_hz, &render_buffer, &capture_buffer,
110 &gain_controller);
111 }
112
113 // Extract and verify the test results.
114 std::vector<float> capture_output;
115 test::ExtractVectorFromAudioBuffer(capture_config, &capture_buffer,
116 &capture_output);
117
118 EXPECT_EQ(achieved_stream_analog_level_reference,
119 gain_controller.stream_analog_level());
120
121 // Compare the output with the reference. Only the first values of the output
122 // from last frame processed are compared in order not having to specify all
123 // preceeding frames as testvectors. As the algorithm being tested has a
124 // memory, testing only the last frame implicitly also tests the preceeding
125 // frames.
peah7ea928e2016-03-30 15:13:57126 const float kElementErrorBound = 1.0f / 32768.0f;
127 EXPECT_TRUE(test::VerifyDeinterleavedArray(
peah57d5a2e2016-03-29 16:48:36128 capture_config.num_frames(), capture_config.num_channels(),
peah7ea928e2016-03-30 15:13:57129 output_reference, capture_output, kElementErrorBound));
peah57d5a2e2016-03-29 16:48:36130}
131
132} // namespace
133
peah51fbdd62016-03-30 21:58:32134// TODO(peah): Activate all these tests for ARM and ARM64 once the issue on the
135// Chromium ARM and ARM64 boths have been identified. This is tracked in the
136// issue https://bugs.chromium.org/p/webrtc/issues/detail?id=5711.
137
138#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
139 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36140TEST(GainControlBitExactnessTest,
141 Mono8kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32142#else
143TEST(GainControlBitExactnessTest,
144 DISABLED_Mono8kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
145#endif
peah57d5a2e2016-03-29 16:48:36146 const int kStreamAnalogLevelReference = 50;
147 const float kOutputReference[] = {-0.006622f, -0.002747f, 0.001587f};
148 RunBitExactnessTest(8000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
149 true, 0, 100, kStreamAnalogLevelReference,
150 kOutputReference);
151}
152
peah51fbdd62016-03-30 21:58:32153#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
154 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36155TEST(GainControlBitExactnessTest,
156 Mono16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32157#else
158TEST(GainControlBitExactnessTest,
159 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
160#endif
peah57d5a2e2016-03-29 16:48:36161 const int kStreamAnalogLevelReference = 50;
162 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f};
163 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
164 true, 0, 100, kStreamAnalogLevelReference,
165 kOutputReference);
166}
167
peah51fbdd62016-03-30 21:58:32168#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
169 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36170TEST(GainControlBitExactnessTest,
171 Stereo16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32172#else
173TEST(GainControlBitExactnessTest,
174 DISABLED_Stereo16kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
175#endif
peah57d5a2e2016-03-29 16:48:36176 const int kStreamAnalogLevelReference = 50;
177 const float kOutputReference[] = {-0.027313f, -0.015900f, -0.028107f,
178 -0.027313f, -0.015900f, -0.028107f};
179 RunBitExactnessTest(16000, 2, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
180 true, 0, 100, kStreamAnalogLevelReference,
181 kOutputReference);
182}
183
peah51fbdd62016-03-30 21:58:32184#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
185 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36186TEST(GainControlBitExactnessTest,
187 Mono32kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32188#else
189TEST(GainControlBitExactnessTest,
190 DISABLED_Mono32kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
191#endif
peah57d5a2e2016-03-29 16:48:36192 const int kStreamAnalogLevelReference = 50;
193 const float kOutputReference[] = {-0.010162f, -0.009155f, -0.008301f};
194 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
195 true, 0, 100, kStreamAnalogLevelReference,
196 kOutputReference);
197}
198
peah51fbdd62016-03-30 21:58:32199#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
200 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36201TEST(GainControlBitExactnessTest,
202 Mono48kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32203#else
204TEST(GainControlBitExactnessTest,
205 DISABLED_Mono48kHz_AdaptiveAnalog_Tl10_SL50_CG5_Lim_AL0_100) {
206#endif
peah57d5a2e2016-03-29 16:48:36207 const int kStreamAnalogLevelReference = 50;
208 const float kOutputReference[] = {-0.010162f, -0.009155f, -0.008301f};
209 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 50, 5,
210 true, 0, 100, kStreamAnalogLevelReference,
211 kOutputReference);
212}
213
peah51fbdd62016-03-30 21:58:32214#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
215 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36216TEST(GainControlBitExactnessTest,
217 Mono8kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32218#else
219TEST(GainControlBitExactnessTest,
220 DISABLED_Mono8kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
221#endif
peah57d5a2e2016-03-29 16:48:36222 const int kStreamAnalogLevelReference = 50;
minyuefd634c42016-06-17 11:36:10223 const float kOutputReference[] = {-0.004028f, -0.001678f, 0.000946f};
peah57d5a2e2016-03-29 16:48:36224 RunBitExactnessTest(8000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
225 true, 0, 100, kStreamAnalogLevelReference,
226 kOutputReference);
227}
228
peah51fbdd62016-03-30 21:58:32229#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
230 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36231TEST(GainControlBitExactnessTest,
232 Mono16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32233#else
234TEST(GainControlBitExactnessTest,
235 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
236#endif
peah57d5a2e2016-03-29 16:48:36237 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 09:38:32238 const float kOutputReference[] = {-0.003967f, -0.002777f, -0.001770f};
peah57d5a2e2016-03-29 16:48:36239 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
240 true, 0, 100, kStreamAnalogLevelReference,
241 kOutputReference);
242}
243
peah51fbdd62016-03-30 21:58:32244#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
245 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36246TEST(GainControlBitExactnessTest,
247 Stereo16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32248#else
249TEST(GainControlBitExactnessTest,
250 DISABLED_Stereo16kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
251#endif
peah57d5a2e2016-03-29 16:48:36252 const int kStreamAnalogLevelReference = 50;
minyuefd634c42016-06-17 11:36:10253 const float kOutputReference[] = {-0.015411f, -0.008972f, -0.015839f,
254 -0.015411f, -0.008972f, -0.015839f};
peah57d5a2e2016-03-29 16:48:36255 RunBitExactnessTest(16000, 2, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
256 true, 0, 100, kStreamAnalogLevelReference,
257 kOutputReference);
258}
259
peah51fbdd62016-03-30 21:58:32260#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
261 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36262TEST(GainControlBitExactnessTest,
263 Mono32kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32264#else
265TEST(GainControlBitExactnessTest,
266 DISABLED_Mono32kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
267#endif
peah57d5a2e2016-03-29 16:48:36268 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 09:38:32269 const float kOutputReference[] = {-0.006104f, -0.005524f, -0.004974f};
peah57d5a2e2016-03-29 16:48:36270 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
271 true, 0, 100, kStreamAnalogLevelReference,
272 kOutputReference);
273}
274
peah51fbdd62016-03-30 21:58:32275#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
276 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36277TEST(GainControlBitExactnessTest,
278 Mono48kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32279#else
280TEST(GainControlBitExactnessTest,
281 DISABLED_Mono48kHz_AdaptiveDigital_Tl10_SL50_CG5_Lim_AL0_100) {
282#endif
peah57d5a2e2016-03-29 16:48:36283 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 09:38:32284 const float kOutputReference[] = {-0.006104f, -0.005524f, -0.004974f};
peah57d5a2e2016-03-29 16:48:36285 RunBitExactnessTest(32000, 1, GainControl::Mode::kAdaptiveDigital, 10, 50, 5,
286 true, 0, 100, kStreamAnalogLevelReference,
287 kOutputReference);
288}
289
peah51fbdd62016-03-30 21:58:32290#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
291 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36292TEST(GainControlBitExactnessTest,
293 Mono8kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32294#else
295TEST(GainControlBitExactnessTest,
296 DISABLED_Mono8kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
297#endif
peah57d5a2e2016-03-29 16:48:36298 const int kStreamAnalogLevelReference = 50;
299 const float kOutputReference[] = {-0.011871f, -0.004944f, 0.002838f};
300 RunBitExactnessTest(8000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
301 true, 0, 100, kStreamAnalogLevelReference,
302 kOutputReference);
303}
304
peah51fbdd62016-03-30 21:58:32305#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
306 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36307TEST(GainControlBitExactnessTest,
308 Mono16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32309#else
310TEST(GainControlBitExactnessTest,
311 DISABLED_Mono16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
312#endif
peah57d5a2e2016-03-29 16:48:36313 const int kStreamAnalogLevelReference = 50;
peah12986c42016-10-22 09:38:32314 const float kOutputReference[] = {-0.011749f, -0.008270f, -0.005219f};
peah57d5a2e2016-03-29 16:48:36315 RunBitExactnessTest(16000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
316 true, 0, 100, kStreamAnalogLevelReference,
317 kOutputReference);
318}
319
peah51fbdd62016-03-30 21:58:32320#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
321 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36322TEST(GainControlBitExactnessTest,
323 Stereo16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32324#else
325TEST(GainControlBitExactnessTest,
326 DISABLED_Stereo16kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
327#endif
peah57d5a2e2016-03-29 16:48:36328 const int kStreamAnalogLevelReference = 50;
329 const float kOutputReference[] = {-0.048950f, -0.028503f, -0.050354f,
330 -0.048950f, -0.028503f, -0.050354f};
331 RunBitExactnessTest(16000, 2, GainControl::Mode::kFixedDigital, 10, 50, 5,
332 true, 0, 100, kStreamAnalogLevelReference,
333 kOutputReference);
334}
335
peah51fbdd62016-03-30 21:58:32336#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
337 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36338TEST(GainControlBitExactnessTest,
339 Mono32kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32340#else
341TEST(GainControlBitExactnessTest,
342 DISABLED_Mono32kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
343#endif
peah57d5a2e2016-03-29 16:48:36344 const int kStreamAnalogLevelReference = 50;
345 const float kOutputReference[] = {-0.018188f, -0.016418f, -0.014862f};
346 RunBitExactnessTest(32000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
347 true, 0, 100, kStreamAnalogLevelReference,
348 kOutputReference);
349}
350
peah51fbdd62016-03-30 21:58:32351#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
352 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36353TEST(GainControlBitExactnessTest,
354 Mono48kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32355#else
356TEST(GainControlBitExactnessTest,
357 DISABLED_Mono48kHz_FixedDigital_Tl10_SL50_CG5_Lim_AL0_100) {
358#endif
peah57d5a2e2016-03-29 16:48:36359 const int kStreamAnalogLevelReference = 50;
360 const float kOutputReference[] = {-0.018188f, -0.016418f, -0.014862f};
361 RunBitExactnessTest(32000, 1, GainControl::Mode::kFixedDigital, 10, 50, 5,
362 true, 0, 100, kStreamAnalogLevelReference,
363 kOutputReference);
364}
365
peah51fbdd62016-03-30 21:58:32366#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
367 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36368TEST(GainControlBitExactnessTest,
369 Mono16kHz_AdaptiveAnalog_Tl10_SL10_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32370#else
371TEST(GainControlBitExactnessTest,
372 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL10_CG5_Lim_AL0_100) {
373#endif
peah57d5a2e2016-03-29 16:48:36374 const int kStreamAnalogLevelReference = 12;
375 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f};
376 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 10, 5,
377 true, 0, 100, kStreamAnalogLevelReference,
378 kOutputReference);
379}
380
peah51fbdd62016-03-30 21:58:32381#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
382 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36383TEST(GainControlBitExactnessTest,
384 Mono16kHz_AdaptiveAnalog_Tl10_SL100_CG5_Lim_AL70_80) {
peah51fbdd62016-03-30 21:58:32385#else
386TEST(GainControlBitExactnessTest,
387 DISABLED_Mono16kHz_AdaptiveAnalog_Tl10_SL100_CG5_Lim_AL70_80) {
388#endif
peah57d5a2e2016-03-29 16:48:36389 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 09:38:32390 const float kOutputReference[] = {-0.003998f, -0.002808f, -0.001770f};
peah57d5a2e2016-03-29 16:48:36391 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveAnalog, 10, 100, 5,
392 true, 70, 80, kStreamAnalogLevelReference,
393 kOutputReference);
394}
395
peah51fbdd62016-03-30 21:58:32396#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
397 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36398TEST(GainControlBitExactnessTest,
399 Mono16kHz_AdaptiveDigital_Tl10_SL100_CG5_NoLim_AL0_100) {
peah51fbdd62016-03-30 21:58:32400#else
401TEST(GainControlBitExactnessTest,
402 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL100_CG5_NoLim_AL0_100) {
403#endif
peah57d5a2e2016-03-29 16:48:36404 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 09:38:32405 const float kOutputReference[] = {-0.004028f, -0.002838f, -0.001770f};
peah57d5a2e2016-03-29 16:48:36406 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 100, 5,
407 false, 0, 100, kStreamAnalogLevelReference,
408 kOutputReference);
409}
410
peah51fbdd62016-03-30 21:58:32411#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
412 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36413TEST(GainControlBitExactnessTest,
414 Mono16kHz_AdaptiveDigital_Tl40_SL100_CG5_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32415#else
416TEST(GainControlBitExactnessTest,
417 DISABLED_Mono16kHz_AdaptiveDigital_Tl40_SL100_CG5_Lim_AL0_100) {
418#endif
peah57d5a2e2016-03-29 16:48:36419 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 09:38:32420 const float kOutputReference[] = {-0.008728f, -0.006134f, -0.003845f};
peah57d5a2e2016-03-29 16:48:36421 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 40, 100, 5,
422 true, 0, 100, kStreamAnalogLevelReference,
423 kOutputReference);
424}
425
peah51fbdd62016-03-30 21:58:32426#if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \
427 defined(WEBRTC_ANDROID))
peah57d5a2e2016-03-29 16:48:36428TEST(GainControlBitExactnessTest,
429 Mono16kHz_AdaptiveDigital_Tl10_SL100_CG30_Lim_AL0_100) {
peah51fbdd62016-03-30 21:58:32430#else
431TEST(GainControlBitExactnessTest,
432 DISABLED_Mono16kHz_AdaptiveDigital_Tl10_SL100_CG30_Lim_AL0_100) {
433#endif
peah57d5a2e2016-03-29 16:48:36434 const int kStreamAnalogLevelReference = 100;
peah12986c42016-10-22 09:38:32435 const float kOutputReference[] = {-0.005859f, -0.004120f, -0.002594f};
peah57d5a2e2016-03-29 16:48:36436 RunBitExactnessTest(16000, 1, GainControl::Mode::kAdaptiveDigital, 10, 100,
437 30, true, 0, 100, kStreamAnalogLevelReference,
438 kOutputReference);
439}
440
441} // namespace webrtc