Commit graph

35 commits

Author SHA1 Message Date
Hanna Silen
7000b99384 Update GainController2 adaptive digital default parameters
Update the default parameters to match with the Chromium parameters in
https://chromium-review.googlesource.com/c/chromium/src/+/5272859.

Bug: webrtc:7494
Change-Id: Id405109cca4adaa6d21945ed89f84d7e27ad361b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/345923
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42048}
2024-04-12 08:29:26 +00:00
Alessio Bazzica
40b5bd72d0 APM: fix TS initialization bugs with WebRTC-Audio-GainController2
When the `WebRTC-Audio-GainController2` field trial is used, the
initial APM configuration is adjusted depending on its original
values and the field trial parameters.

This CL fixes two cases when the code crashes:
1. when, in the initial APM config, AGC1 is enabled, AGC2 is
   disabled and TS is enabled
2. when the initial APM sample rate is different from the
   capture one and the VAD APM sub-module is not re-initialized

This CL also improves the unit tests coverage and it has been
tested offline to check that the VAD sub-module is created only
when expected and that AGC2 uses its internal VAD when expected.
The tests ran on a few Wav files with different sample rates and
one AEC dump and on 16 different APM and field trial
configurations.

Bug: chromium:1407341, b/265112132
Change-Id: I7cc267ea81cb02be92c1f37f273b7ae93b6e4634
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290988
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Olga Sharonova <olka@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39118}
2023-01-16 20:30:12 +00:00
Hanna Silen
597a2ba41a AGC2: Return the recommended volume from RecommendInputVolume()
In InputVolumeController, rename AnalyzePreProcess() and Process() to
reflect their use and replace the use of the getter
recommended_input_volume() with an optional return value from the
latter one. The added return value carries the recommended input
volume if the call sequence follows the API contract. Make the member
applied_input_volume_ optional. Restrict the use of the getter
recommended_input_volume() for test use. Add a method
capture_output_used() for test use.

In GainController2, store the output of InputVolumeController::Process()
in a new member variable that's updated in Analyze() and Process(). Use
a trivial getter to read the value in APM.

Bug: webrtc:7494
Change-Id: Ifcfb466c4f558be560eb6d2f45410d04adb7e2ad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/287862
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38889}
2022-12-14 13:05:37 +00:00
Alessio Bazzica
dfba28e30e AGC2 adaptive digital controller config clean-up
- Remove dry-run option
- Hard-code `adjacent_speech_frames_threshold` and
  `vad_reset_period_ms`
- Expose `initial_gain_db` via field trial

Tested: adaptive digital controller bit-exactness verified

Bug: webrtc:7494
Change-Id: I6166611f91320b6c37de3f8e553c06c2ed95b772
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/287222
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38862}
2022-12-09 13:07:34 +00:00
Hanna Silen
a6574909e9 APM: Add a field trial for input volume controller
Add a field trial WebRTC-Audio-InputVolumeControllerExperiment and
a mechanism to adjust the config accordingly. Pass the additional
input volume controller config to GainController2.

Bug: webrtc:7494
Change-Id: I3dd624df1f4774cb533417747627995e1f60aa68
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/284101
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38780}
2022-11-30 17:26:45 +00:00
Hanna Silen
27fed4513f InputVolumeController: Make speech_probability non-optional
Make the argument speech_probability non-optional in
InputVolumeController::Process() and
MonoInputVolumeController::Process().

Additional clean-up: Remove the flag enabled in the
config. Add unit tests for MonoInputVolumeController.

Bug: webrtc:7494
Change-Id: Ie28af77dc628bf71d09ce1ff033d39031f77a21e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283700
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38710}
2022-11-22 15:19:02 +00:00
Hanna Silen
d7cfbe3843 Add support for InputVolumeController in GainController2
Add InputVolumeController as a member in GainController2 (not created
by default). Add a method GainController2::Analyze() to update the
applied input volume and run the pre-processing steps in
InputVolumeController. Add a call InputVolumeController::Process() in
GainController2::Process().

Bug: webrtc:7494
Change-Id: Idf4111ac5e19a620b6421c7f23fd642f169c7b5a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279822
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38548}
2022-11-03 18:32:55 +00:00
Alessio Bazzica
fcf1af3049 APM: add AudioProcessingImpl::capture_::applied_input_volume(_changed)
The `recommended_stream_analog_level()` getter is used to retrieve
both the applied and the recommended input volume. This behavior is
error-prone since the caller must know what is returned based on
the point in the code (namely, before/after the AGC has changed
the last applied input volume into a recommended level).

This CL is a first step to make clarity on which input volume is
handled in different parts of APM. Next in the pipeline: make
`recommended_stream_analog_level()` a trivial getter that always
returns the recommended level.

Main changes:
- When `recommended_stream_analog_level()` is called but
  `set_stream_analog_level()` is not called, APM logs an error
  and returns a fall-back volume (which should not be applied
  since, when `set_stream_analog_level()` is not called, no
  external input volume is expected to be present
- When APM is used without calling the `*_stream_analog_level()`
  methods (e.g., when the caller does not provide any input volume),
  the recorded AEC dumps won't store `Stream::applied_input_level`

Other changes:
- Removed `AudioProcessingImpl::capture_::prev_analog_mic_level`
- Removed redundant code in `GainController2` around detecting
  input volume changes (already done by APM)
- Adapted the `audioproc_f` and `unpack_aecdump` tools
- Data dumps clean-up: the applied and the recommended input
  volumes are now recorded in an AGC implementation agnostic way

Bug: webrtc:7494, b/241923537
Change-Id: I3cb4a731fd9f3dc19bf6ac679b7ed8c969ea283b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271544
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38054}
2022-09-09 17:36:05 +00:00
Hanna Silen
0c1ad2992b AudioProcessingImpl: Add a VAD submodule
Add a VoiceActivityDetectorWrapper submodule in AudioProcessingImpl
and enable injecting speech probability into GainController2.

Bug: webrtc:13663
Change-Id: I05e13b737d085b45ac8ce76660191867c56834c2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/265166
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37275}
2022-06-20 10:44:41 +00:00
Henrik Lundin
64253a93dc Remove more traces of keyboard mic support from APM
The 6-parameter Initialize method is removed. The has_keyboard parameter
in the StreamConfig constructor is removed together with the underlying
member and helper functions.

Bug: chromium:1271981, b/217349489
Change-Id: I7259a114a395f74f735a9c06510c0fc0f0f008e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250221
Reviewed-by: Sam Zackrisson <saza@google.com>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Auto-Submit: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35908}
2022-02-04 14:27:51 +00:00
Alessio Bazzica
389010438d AGC2: GainController::ApplyConfig removed
When `AudioProcessingImpl::ApplyConfig()` is called, AGC2 is initialized
and then the new config is applied. That is error prone and for example
breaks bit exactness in [1].

Changes:
- `GainController2` must be created by passing configuration,
  sample rate and number of channels
- `GainController2::ApplyConfig()` removed

Bit exactness verified with audioproc_f on a collection of AEC dumps
and Wav files (42 recordings in total).

[1] https://webrtc-review.googlesource.com/c/src/+/234587.

Bug: webrtc:7494
Change-Id: I251e03603394a4fc8769b9b5c197a157893676a9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235060
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35206}
2021-10-14 12:58:25 +00:00
Alessio Bazzica
a850e6c8b6 AGC2 config: allow tuning of headroom, max gain and initial gain
This CL does *not* change the behavior of the AGC2 adaptive digital
controller - bitexactness verified with audioproc_f on a collection of
AEC dumps and Wav files (42 recordings in total).

Tested: compiled Chrome with this patch and made an appr.tc test call

Bug: webrtc:7494
Change-Id: Ia8a9f6fbc3a3459b888a2eed87e108f0d39cfe99
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/233520
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35140}
2021-10-04 16:11:00 +00:00
Alessio Bazzica
6ee9734887 AGC2: update adaptive digital test
This CL improves `GainController2::CheckGainAdaptiveDigital`, namely:
- correctly initialize AGC2 with the correct number of channels
- attenuate the input signal in order to avoid that the target gain is
  set to zero (which was the case before)
- run AG2 adaptive digital for a longer period to allow time to trigger
  the adaptive behavior (namely, from 2s to 10s)
- minor code style improvements

Bug: webrtc:7494
Change-Id: Ib41de088b341bb30460238b83e306a507b2bc5af
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/233101
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35099}
2021-09-27 16:05:25 +00:00
Alessio Bazzica
1ac4f2a29e AGC2: Remove unused parameters
- `NoiseEstimator` and `LevelEstimator` enums
- `vad_probability_attack`
- `level_estimator_adjacent_speech_frames_threshold`
- `use_saturation_protector`
- `gain_applier_adjacent_speech_frames_threshold`
- `initial_saturation_margin_db`
- `extra_saturation_margin_db`

Bug: webrtc:7494
Change-Id: I12e40c8efe2d2126d7597ec18a78cf9d5d39baf2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232903
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35096}
2021-09-27 11:14:35 +00:00
Artem Titov
cfea2182f8 Use backticks not vertical bars to denote variables in comments
Bug: webrtc:12338
Change-Id: I89c8b3a328d04203177522cbdfd9e606fd4bce4c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228246
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34696}
2021-08-10 10:40:03 +00:00
Artem Titov
0b489303d2 Use backticks not vertical bars to denote variables in comments for /modules/audio_processing
Bug: webrtc:12338
Change-Id: I85bff694dd2ead83c939c4d1945eff82e1296001
No-Presubmit: True
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227161
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34690}
2021-08-09 21:49:02 +00:00
Alessio Bazzica
d66a60597d AGC2 adaptive digital dry run mode
Add the option to run the adaptive digital controller of AGC2 without
side-effects - i.e., no gain applied.

Tested: adapation verified during a video call in chromium

Bug: webrtc:7494
Change-Id: I4776f6012907d76a17a3bca89991da97dc38657f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215964
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33875}
2021-04-29 16:05:57 +00:00
Alessio Bazzica
980c4601e1 AGC2: retuning and large refactoring
- Bug fix: the desired initial gain quickly dropped to 0 dB hence
  starting a call with a too low level
- New tuning to make AGC2 more robust to VAD mistakes
- Smarter max gain increase speed: to deal with an increased threshold
  of adjacent speech frames, the gain applier temporarily allows a
  faster gain increase to deal with a longer time spent waiting for
  enough speech frames in a row to be observed
- Saturation protector isolated from `AdaptiveModeLevelEstimator` to
  simplify the unit tests for the latter (non bit-exact change)
- AGC2 adaptive digital config: unnecessary params deprecated
- Code readability improvements
- Data dumps clean-up and better naming

Bug: webrtc:7494
Change-Id: I4e36059bdf2566cc2a7e1a7e95b7430ba9ae9844
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215140
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33736}
2021-04-14 19:01:01 +00:00
Alessio Bazzica
61982a7f2d AGC2 lightweight noise floor estimator
The current noise level estimator has a bug due to which the estimated
level decays to the lower bound in a few seconds when speech is observed.
Instead of fixing the current implementation, which is based on a
stationarity classifier, an alternative, lightweight, noise floor
estimator has been added and tuned for AGC2.

Tested on several AEC dumps including HW mute, music and fast talking.

Bug: webrtc:7494
Change-Id: Iae4cff9fc955a716878f830957e893cd5bc59446
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214133
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33733}
2021-04-14 15:56:41 +00:00
Alessio Bazzica
0c83e15c6b Move AGC2 config ToString to the right place and update Validate()
The APM config to string mapping must be in one place (namely,
in `audio_processing.cc`). This CL moves the AGC2 config to string
impl to the right place.

This CL also updates `GainController2::Validate()` and adds the
missing unit tests for the parameters that have recently been added.

Stack buffer size in `AudioProcessing::Config::ToString()` increased
because of the extra params. Syntax near `multi_channel_capture` fixed.
Output string format verified with a JS linter.

Bug: webrtc:7494
Change-Id: I692e1549b7d40c970d88a14c8e83da16325fb54c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/187080
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32400}
2020-10-14 12:00:54 +00:00
Mirko Bonadei
317a1f09ed Use std::make_unique instead of absl::make_unique.
WebRTC is now using C++14 so there is no need to use the Abseil version
of std::make_unique.

This CL has been created with the following steps:

git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt
git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt
git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt

diff --new-line-format="" --unchanged-line-format="" \
  /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \
  uniq > /tmp/only_make_unique.txt
diff --new-line-format="" --unchanged-line-format="" \
  /tmp/only_make_unique.txt /tmp/memory.txt | \
  xargs grep -l "absl/memory" > /tmp/add-memory.txt

git grep -l "\babsl::make_unique\b" | \
  xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g"

git checkout PRESUBMIT.py abseil-in-webrtc.md

cat /tmp/add-memory.txt | \
  xargs sed -i \
  's/#include "absl\/memory\/memory.h"/#include <memory>/g'
git cl format
# Manual fix order of the new inserted #include <memory>

cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \
  xargs sed -i '/#include "absl\/memory\/memory.h"/d'

git ls-files | grep BUILD.gn | \
  xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d'

python tools_webrtc/gn_check_autofix.py \
  -m tryserver.webrtc -b linux_rel

# Repead the gn_check_autofix step for other platforms

git ls-files | grep BUILD.gn | \
  xargs sed -i 's/absl\/memory:memory/absl\/memory/g'
git cl format

Bug: webrtc:10945
Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 15:47:29 +00:00
Per Åhgren
d47941e018 Reland "Simplification and refactoring of the AudioBuffer code"
This is a reland of 81c0cf287c

Original change's description:
> Simplification and refactoring of the AudioBuffer code
> 
> This CL performs a major refactoring and simplification
> of the AudioBuffer code that.
> -Removes 7 of the 9 internal buffers of the AudioBuffer.
> -Avoids the implicit copying required to keep the
>  internal buffers in sync.
> -Removes all code relating to handling of fixed-point
>  sample data in the AudioBuffer.
> -Changes the naming of the class methods to reflect
>  that only floating point is handled.
> -Corrects some bugs in the code.
> -Extends the handling of internal downmixing to be
>  more generic.
> 
> Bug: webrtc:10882
> Change-Id: I12c8af156fbe366b154744a0a1b3d926bf7be572
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149828
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#28928}

Bug: webrtc:10882
Change-Id: I2ddf327e80a03468c41662ae63c619ff34f2363a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150101
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28938}
2019-08-22 10:34:05 +00:00
Steve Anton
f254e9e9e5 Revert "Simplification and refactoring of the AudioBuffer code"
This reverts commit 81c0cf287c.

Reason for revert: internal test failures

Original change's description:
> Simplification and refactoring of the AudioBuffer code
> 
> This CL performs a major refactoring and simplification
> of the AudioBuffer code that.
> -Removes 7 of the 9 internal buffers of the AudioBuffer.
> -Avoids the implicit copying required to keep the
>  internal buffers in sync.
> -Removes all code relating to handling of fixed-point
>  sample data in the AudioBuffer.
> -Changes the naming of the class methods to reflect
>  that only floating point is handled.
> -Corrects some bugs in the code.
> -Extends the handling of internal downmixing to be
>  more generic.
> 
> Bug: webrtc:10882
> Change-Id: I12c8af156fbe366b154744a0a1b3d926bf7be572
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149828
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#28928}

TBR=gustaf@webrtc.org,peah@webrtc.org

Change-Id: I2729e3ad24b3a9b40b368b84cb565c859e79b51e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10882
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150084
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28931}
2019-08-21 18:00:59 +00:00
Per Åhgren
81c0cf287c Simplification and refactoring of the AudioBuffer code
This CL performs a major refactoring and simplification
of the AudioBuffer code that.
-Removes 7 of the 9 internal buffers of the AudioBuffer.
-Avoids the implicit copying required to keep the
 internal buffers in sync.
-Removes all code relating to handling of fixed-point
 sample data in the AudioBuffer.
-Changes the naming of the class methods to reflect
 that only floating point is handled.
-Corrects some bugs in the code.
-Extends the handling of internal downmixing to be
 more generic.

Bug: webrtc:10882
Change-Id: I12c8af156fbe366b154744a0a1b3d926bf7be572
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149828
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28928}
2019-08-21 13:40:59 +00:00
Jonas Olsson
a4d873786f Format almost everything.
This CL was generated by running

git ls-files | grep -P "(\.h|\.cc)$" | grep -v 'sdk/' | grep -v 'rtc_base/ssl_' | \
grep -v 'fake_rtc_certificate_generator.h' | grep -v 'modules/audio_device/win/' | \
grep -v 'system_wrappers/source/clock.cc' | grep -v 'rtc_base/trace_event.h' | \
grep -v 'modules/audio_coding/codecs/ilbc/' | grep -v 'screen_capturer_mac.h' | \
grep -v 'spl_inl_mips.h' | grep -v 'data_size_unittest.cc' | grep -v 'timestamp_unittest.cc' \
| xargs clang-format -i ; git cl format

Most of these changes are clang-format grouping and reordering includes
differently.

Bug: webrtc:9340
Change-Id: Ic83ddbc169bfacd21883e381b5181c3dd4fe8a63
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144051
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28505}
2019-07-08 13:45:15 +00:00
Mirko Bonadei
6a489f22c7 Fully qualify googletest symbols.
Semi-automatically created with:

git grep -l " testing::" | xargs sed -i "s/ testing::/ ::testing::/g"
git grep -l "(testing::" | xargs sed -i "s/(testing::/(::testing::/g"
git cl format

After this, two .cc files failed to compile and I have fixed them
manually.

Bug: webrtc:10523
Change-Id: I4741d3bcedc831b6c5fdc04485678617eb4ce031
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132018
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27526}
2019-04-09 17:18:20 +00:00
Mirko Bonadei
c84f661b10 Stop using Googletest legacy APIs.
Googletest recently started replacing the term Test Case by Test Suite.
From now on, the preferred API is TestSuite*; the older TestCase* API
will be slowly deprecated.

This CL moves WebRTC to the new set of APIs.

More info in [1].

This CL has been generated with this script:

declare -A items
items[TYPED_TEST_CASE]=TYPED_TEST_SUITE
items[TYPED_TEST_CASE_P]=TYPED_TEST_SUITE_P
items[REGISTER_TYPED_TEST_CASE_P]=REGISTER_TYPED_TEST_SUITE_P
items[INSTANTIATE_TYPED_TEST_CASE_P]=INSTANTIATE_TYPED_TEST_SUITE_P
items[INSTANTIATE_TEST_CASE_P]=INSTANTIATE_TEST_SUITE_P
for i in "${!items[@]}"
do
  git ls-files | xargs sed -i "s/\b$i\b/${items[$i]}/g"
done
git cl format

[1] - https://github.com/google/googletest/blob/master/googletest/docs/primer.md#beware-of-the-nomenclature

Bug: None
Change-Id: I5ae191e3046caf347aeee01554d5743548ab0e3f
Reviewed-on: https://webrtc-review.googlesource.com/c/118701
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26494}
2019-01-31 13:23:33 +00:00
Alessio Bazzica
8da7b350cf AGC2 adaptive digital false by default
Avoid that the client code relies on the adaptive digital mode being
enabled by default (error prone).

Bug: webrtc:7494
Change-Id: I765fecf535cf31a2163e10595a42520473c233b6
Reviewed-on: https://webrtc-review.googlesource.com/c/111586
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25728}
2018-11-21 14:20:15 +00:00
Alessio Bazzica
1e2542f593 AGC2: adding level estimation option (RMS or peak-based).
This CL makes possible to choose the level estimation for the adaptive
digital GC of AGC2. The options are RMS (default and currently used
estimator) and peak-based (already computed, but not used).

Besides adding the new AGC2 config param for the level estimator, this CL
also refactors the config class by making it more structured.

Bug: webrtc:7494
Change-Id: I20eb558ca50f13536aa7bdea08d21de3b630f8bc
Reviewed-on: https://webrtc-review.googlesource.com/c/110144
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25620}
2018-11-13 14:32:13 +00:00
Alex Loiko
20f60f0dc6 Fuzzer crash in AGC2.
Gain specified by fuzzer in APM config was too high.

Bug: chromium:901661
Change-Id: Id3ea8d23a4284a35c827bb16125902d84e37ca1e
Reviewed-on: https://webrtc-review.googlesource.com/c/110604
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25594}
2018-11-12 12:16:47 +00:00
Alessio Bazzica
3e4c77f1c1 Fix AGC2 fixed-adaptive gain controllers order.
This CL refactors AGC2 and fixes the order with which the fixed
and the adaptive digital gain controllers are applied - i.e., fixed
first, then adaptive and finally limiter.

FixedGainController has been removed since we need to split the
processing done by the gain applier and the limiter.
Also, GainApplier and Limiter are easy enough to be used without
a wrapper and a wrapper would need 2 separated calls in the right
order - i.e., error prone.

FrameCombiner in audio mixer has been adapted and now only uses the
limiter (which is what is needed since no gain is applied).

The unit tests for FixedGainController have been moved to
gain_controller2_unittests. They have been re-adapted and
ChangeFixedGainShouldBeFastAndTimeInvariant has been re-tuned.

Bug: webrtc:7494
Change-Id: I4d7daeae917257ac019a645b74deba6642f77322
Reviewed-on: https://webrtc-review.googlesource.com/c/108624
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25477}
2018-11-01 20:35:36 +00:00
Alex Loiko
5e784616e0 Make the extra seturation margin configurable.
The extra saturation margin is a setting for the SaturationProtector
in GainController2. The higher it is, the less gain GC2 will apply. In
this CL we pipe the setting up to audio_processing.h. Now the setting
can be set at a high level.

Also in this CL add a few (missing, they should have been there
already) tests for the GC2 and GC2 with saturation margin.

Bug: webrtc:7494
Change-Id: I1b61f1662e6c6a8817fd5b0e845339694bf8d50d
Reviewed-on: https://webrtc-review.googlesource.com/c/109001
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25470}
2018-11-01 15:12:11 +00:00
Alex Loiko
95141d91d8 Set a positive initial gain in the Adaptive Digital GC.
If the adaptive gain is too low, we raise it slowly and only during
speech.

The CL gives better behavior at the start of a call. If the gain is too
high, the fixed-digital limits it. The gain is also quickly reduced by
the AdaptiveGainApplier.

Bug: webrtc:7494
Change-Id: I683f1e3e463cddec2d91f6c7f15c73e744430034
Reviewed-on: https://webrtc-review.googlesource.com/71484
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23053}
2018-04-27 09:05:25 +00:00
Alex Loiko
9d2788f745 Make possible to activate adaptive AGC2 in the APM.
We update the configuration settings for AGC2. We also update their
effects. Now, 'gain_controller2.enable=true' means 'first run Adaptive
AGC2; then run AGC2 limiter'.

Previously, only the AGC2 limiter was implemented. To run that, one
had to set both 'gain_controller2.enable=true' and
'gain_controller2.enable_limiter=true'.

This setting also enables adaptive AGC2 in the test tool 'audioproc_f'.

Bug: webrtc:7494
Change-Id: I0d5dfe443f2cdc0ecf3aa4054442dab6276d284d
Reviewed-on: https://webrtc-review.googlesource.com/64990
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22669}
2018-03-29 09:42:07 +00:00
Alex Loiko
e36e8bbf6d Add FixedGainController and move GainController2 in APM.
The FixedGainController (FGC) applies a fixed gain. It will also
control the limiter. The limiter will be landed over the next several
CLs.

The GainController2 is a 'private submodule' of APM. It will control
the new automatic gain controller (AGC). It controls the AGC through
Initialize() and ApplyConfig().

This CL contains

* build changes to make modules/audio_processing/agc2 an independent
  target

* a new MutableFloatAudioFrame which is the audio interface between
  AGC2 and APM

* move of the fixed gain application from GainController2 to
  FixedGainController.

If you are a googler, there is more information in this doc:
https://docs.google.com/document/d/1RV2Doet3MZtUPAHVva61Vjo20iyd1bmmm3aR8znWpzo/edit#

Bug: webrtc:7949
Change-Id: Ief95cbbce83c3aafe54638fd2ab881c9fb8bdc3a
Reviewed-on: https://webrtc-review.googlesource.com/50440
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22046}
2018-02-16 10:56:38 +00:00
Renamed from modules/audio_processing/agc2/gain_controller2_unittest.cc (Browse further)