Commit graph

208 commits

Author SHA1 Message Date
Artem Titov
3f87250a4f Revert "Remove RTC_DISALLOW_COPY_AND_ASSIGN usages completely"
This reverts commit 5f0eb93d2a.

Reason for revert: Breaks downstream project. I'm going to fix that one and create a reland of this CL after.

Original change's description:
> Remove RTC_DISALLOW_COPY_AND_ASSIGN usages completely
>
> Bug: webrtc:13555, webrtc:13082
> Change-Id: Iff2cda6f516739419e97e975e03f77a98f74be03
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249260
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Artem Titov <titovartem@webrtc.org>
> Commit-Queue: (Daniel.L) Byoungchan Lee <daniel.l@hpcnt.com>
> Cr-Commit-Position: refs/heads/main@{#35805}

TBR=hta@webrtc.org,titovartem@webrtc.org,daniel.l@hpcnt.com,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I33d497f1132adfe6d151023195a388d9b7d548f9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:13555, webrtc:13082
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249364
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Owners-Override: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35807}
2022-01-26 14:56:14 +00:00
Byoungchan Lee
5f0eb93d2a Remove RTC_DISALLOW_COPY_AND_ASSIGN usages completely
Bug: webrtc:13555, webrtc:13082
Change-Id: Iff2cda6f516739419e97e975e03f77a98f74be03
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249260
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: (Daniel.L) Byoungchan Lee <daniel.l@hpcnt.com>
Cr-Commit-Position: refs/heads/main@{#35805}
2022-01-26 14:22:16 +00:00
Sam Zackrisson
03cb7e5a61 APM: Make echo detector an optionally compilable and injectable component
Important: This change does not in any way affect echo cancellation or standardized stats. The user audio experience is unchanged. Only non-standard stats are affected. Echo return loss metrics are unchanged. Residual echo likelihood {recent max} will no longer be computed by default.

Important: The echo detector is no longer enabled by default.

API change, PSA: https://groups.google.com/g/discuss-webrtc/c/mJV5cDysBDI/m/7PTPBjVHCgAJ

This CL removes the default usage of the residual echo detector in APM.
It can now only be used via injection and the helper function webrtc::CreateEchoDetector. See how the function audio_processing_unittest.cc:CreateApm() changed, for an example.

The echo detector implementation is marked poisonous, to avoid accidental dependencies.

Some cleanup is done:
- EchoDetector::PackRenderAudioBuffer is declared in one target but is defined in another target. It is not necessary to keep in the API. It is made an implementation detail, and the echo detector input is documented in the API.
- The internal state of APM is large and difficult to track. Submodule pointers that are set permanently on construction are now appropriately marked const.

Tested:
- existing + new unit tests
- audioproc_f is bitexact on a large number of aecdumps

Bug: webrtc:11539
Change-Id: I00cc2ee112fedb06451a533409311605220064d0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/239652
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35550}
2021-12-16 17:39:11 +00:00
Hanna Silen
cd59704f8d AudioProcessing: Make minimum and maximum analog levels non-configurable
Remove analog_level_minimum and analog_level_maximum from
AudioProcessing GainController1 and replace their use with fixed
values 0 and 255, respectively.

Bug: webrtc:12774
Change-Id: Ia4bfe5ed43a65f1587ed67f36bfbb2966b6fdf26
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235822
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35297}
2021-11-02 12:49:50 +00:00
Alessio Bazzica
183c64ce19 APM: remove LevelEstimator
Only used in unit tests and a duplication of what `capture_output_rms_`
already does.

This CL also removes `AudioProcessingStats::output_rms_dbfs`, which is
now unused.

Bug: webrtc:5298
Fix: chromium:1261339
Change-Id: I6e583c11d4abb58444c440509a8495a7f5ebc589
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235664
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35246}
2021-10-20 10:52:17 +00:00
Alessio Bazzica
20a9ac655c APM: add AudioProcessingBuilder::SetConfig()
Bug: webrtc:5298
Change-Id: If3468ebb841c49dcd410a8bea2f9f8111ee8bc06
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234842
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35199}
2021-10-14 10:45:16 +00:00
Alessio Bazzica
7b80d4480e AGC2: SIMD allowed config flags to field trials
Bug: webrtc:7494
Change-Id: I41fa05d2ef6d969750f3d4c1e40ecbcd30293b5a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/233741
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35144}
2021-10-05 12:01:38 +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
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
Alessio Bazzica
1b200b93d5 APM: remove webrtc::Config
Remove the deprecated way of configuring APM.

Bug: webrtc:5298
Change-Id: Idcedf1fe4a121adfcf2881003579cd58ac42a2b9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232302
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35026}
2021-09-17 11:21:32 +00:00
Alessio Bazzica
be1b8989d1 ExperimentalNs removed + APM not depending anymore on webrtc::Config
Thanks to the elimination of `ExperimentalNs`, there is no need anymore
to pass `webrtc::Config` to build APM.
Hence, `AudioProcessingBuilder::Create(const webrtc::Config&)` is also
removed.

Bug: webrtc:5298
Change-Id: I0a3482376a7753434486fe564681f7b9f83939c5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232128
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35025}
2021-09-17 10:53:43 +00:00
Alessio Bazzica
ff7e1bad1f APM config: remove ExperimentalAgc
Bug: webrtc:5298,webrtc:7494
Change-Id: Ic9bcb702603ec7900fbe9ae38ab49dff8fe99318
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219463
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35015}
2021-09-16 13:28:51 +00:00
Alessio Bazzica
b8a19df71c AGC2: removed unused noise estimator implementation
This CL also includes the following changes:
- `AudioProcessing::Config::GainController2::noise_estimator`
  deprecated
- `EnergyToDbfs()` optimized by removing unnecessary `sqrt`
- Unit test minor fix, incorrect type was used

Bug: webrtc:7494
Change-Id: I88a6672d6f7cd03fcf6a3031883522d256880140
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230940
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34893}
2021-09-01 12:45:20 +00:00
Niels Möller
4f776ac7de Use make_ref_counted in AudioProcessingBuilder
Bug: webrtc:12701
Change-Id: I51ca5a54f812a1620ee2e6605c9ff67b92e2a5f8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/224547
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34725}
2021-08-11 15:40:28 +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
42dacda82c AGC analog clipping predictor: integrate evaluator
Integrate ClippingPredictorEvaluator in AgcManagerDirect adding the
possibility to run the predictor without affecting the analog gain
adjustment process.

The evaluator is used to compute precision, recall and F1 score.
F1 score and the measured clipping prediction intervals are logged as
`WebRTC.Audio.Agc.ClippingPredictor.F1Score` and `.PredictionInterval`
histograms respectively.

Bug: webrtc:12774
Change-Id: I708dcda9321f92d5bd17ec4c36ebce1165ead57f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221921
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34327}
2021-06-17 16:16:53 +00:00
Alessio Bazzica
b237a87a25 AGC analog ClippingPredictor refactoring 1/2
- ClippingPredictor API and docstring changes
- Unified ClippingPredictor factory function

Bug: webrtc:12774
Change-Id: Iafaddae52addc00eb790ac165bf407a4bdd1cb52
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221540
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34279}
2021-06-14 12:21:31 +00:00
Hanna Silen
a43953a518 Add ClippingPredictor config in AudioProcessing config
Bug: webrtc:12774
Change-Id: Id8cdb6b5499a22cbca40d424cf936f81c1e7d8d7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221104
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34204}
2021-06-02 16:16:25 +00:00
Hanna Silen
b8dc7fa5a6 Make AgcManagerDirect clipping parameters configurable
Bug: webrtc:12774
Change-Id: I99824b5aabe6f921a5db425dd1c1c1d4c606186c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219681
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34069}
2021-05-20 16:53:59 +00:00
Alessio Bazzica
dfc11d55af Add RTC_EXPORT to APM config structs with overloaded operators
Bug: webrtc:7494
Change-Id: I9b627709d8c5bb47d73fd7981259a95e6b51e16c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217766
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33946}
2021-05-07 11:31:18 +00:00
Alessio Bazzica
a2efd15627 AGC2 config operator= and unit tests update
Bug: webrtc:7494
Change-Id: I7957602d60658b84175a617f9c283ea44eafe57d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216260
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@google.com>
Cr-Commit-Position: refs/heads/master@{#33876}
2021-04-29 16:37:17 +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
841d74ea80 AGC2 periodically reset VAD state
Bug: webrtc:7494
Change-Id: I880ef3991ade4e429ccde843571f069ede149c0e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213342
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33604}
2021-03-31 14:15:10 +00:00
Per Åhgren
db5d728878 Add refined handling of the internal scaling of the audio in APM
This CL adds functionality that allows adjusting the audio levels
internally in APM. The main purpose of the functionality is to allow
APM to optionally be moved to an integration that does not provide an
analog gain to control, and the implementation of this has been
tailored specifically to meet the requirements for that.

More specifically, this CL does
-Add a new variant of the pre-amplifier gain that is intended to replace
 the pre-amplifier gain (but at the moment can coexist with that). The
 main differences with the pre-amplifier gain is that an attenuating
 gain is allowed, the gain is applied jointly with any emulated analog
 gain, and that its packaging fits better with the post gain.
-Add an emulation of an analog microphone gain. The emulation is
 designed to match the analog mic gain functionality in Chrome OS (which
 is digital) but should be usable also on other platforms.
-Add a post-gain which is applied after all processing has been applied.
 The purpose of this gain is for it to work well with the integration
 in ChromeOS, and be used to compensate for the offset that there is
 applied on some USB audio devices.


Bug: b/177830918
Change-Id: I0f312996e4088c9bd242a713a703eaaeb17f188a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/209707
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33466}
2021-03-15 19:12:02 +00:00
Per Åhgren
652ada5029 Enabling a safe fall-back functionality for overruns in the runtime settings
Bug: b/177830919
Change-Id: I9369f6fc004ceb2b626d33b36262bc8aeabdb1a0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206988
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33371}
2021-03-03 12:06:54 +00:00
Danil Chapovalov
e904161cec Replace RTC_DEPRECATED with ABSL_DEPRECATED
This remove webrtc-specific macro that has no reason to be webrtc specific
ABSL_DEPRECATED takes a message parameter encouraging to write text how class or function is deprecated.

Bug: webrtc:12484
Change-Id: I89f1398f91dacadc37f7db469dcd985e3724e444
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208282
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33314}
2021-02-22 12:53:23 +00:00
Per Åhgren
8eea117dea Make PostRuntimeSetting pure virtual
Bug: b/177830919
Change-Id: I92e30e9b65c8f851444268f0824a676044504814
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206640
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33252}
2021-02-12 22:49:43 +00:00
Alessio Bazzica
5a585952da Update AGC2 tuning
Bug: webrtc:7494
Change-Id: Ifcc5b6c846476ce7d6862fba2cb53e426b5855dc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206800
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33238}
2021-02-11 18:14:34 +00:00
Per Åhgren
0a144a705a Adding initial support for lock-less informing of muting
This CL adds the initial support for letting APM know when its output
will be used or not.
It also adds a new method for passing RuntimeInformation to APM that
returns a bool indicating the success of the passing of information.

Bug: b/177830919
Change-Id: Ic2e1b92c37241d74ca6394b785b91736ca7532aa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206061
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33201}
2021-02-09 12:08:54 +00:00
Per Åhgren
68c225d76d Make 48 kHz maximum rate default for all devices
Bug: b/169918549
Change-Id: I2f4b7ced5ae6efcae3cd59c0a42610a54f5e2dc7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/203260
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33192}
2021-02-08 15:06:05 +00:00
Alessio Bazzica
42eef86c4f Remove unused code in APM
- The injection of the AGC2 level estimator into `AgcManagerDirect`
  is not used anymore
- `ExperimentalAgc::enabled_agc2_level_estimator` can also be removed
- 3 ctors of `ExperimentalAgc` are unused
- `AgcManagerDirectStandaloneTest::AgcMinMicLevelExperiment` can be
  split into separate unit tests (better code clarity)

Bug: webrtc:7494
Change-Id: I5843147c38cf7cb5ee484b0a72fe13dcf363efaf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/202025
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33027}
2021-01-18 13:40:27 +00:00
Hua, Chunbo
e61a40e4ef Fix typo in audio processing header.
Bug: None
Change-Id: Ia47f8229cdfbbcfec3aa7539c587d4e1fdc4ae3a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/200926
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32974}
2021-01-14 10:59:13 +00:00
Alessio Bazzica
524f682184 SSE2 and NEON kill switches for AGC2
Bug: webrtc:7494
Change-Id: I221b717b5cf3c41b7b637e9234d1e339a0e6c7e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/199967
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32918}
2021-01-07 11:41:28 +00:00
Per Åhgren
12dc274749 Make the static variable kChunkSizeMs constexpr
This CL makes the static variable kChunkSizeMs constexpr to avoid
potential issues on some compilers.

Bug: None
Change-Id: I8e2b1819561ec96fb17d3899af95405cc36a6097
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196640
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32795}
2020-12-08 10:46:15 +00:00
Alessio Bazzica
253f8369bb AGC2 RNN VAD: safe SIMD optimizations scheme + AVX2 kill switch
In preparation for adding AVX2 code, a safe scheme to support
different SIMD optimizations is added.

Safety features:
- AVX2 kill switch to stop using it even if supported by the
  architecture
- struct indicating the available CPU features propagated from
  AGC2 to each component; in this way
  - better control over the unit tests
  - no need to propagate individual kill switches but just
    set to false features that are turned off

Note that (i) this CL does not change the performance of the RNN VAD
and (ii) no AVX2 optimization is added yet.

Bug: webrtc:10480
Change-Id: I0e61f3311ecd140f38369cf68b6e5954f3dc1f5a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193140
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32739}
2020-12-02 10:09:24 +00:00
Alessio Bazzica
3438a9383c AGC2 config change detection fixed
AGC2 is correctly (re)initialized when its config changes.
This CL also improves the `AudioProcessingImpl::ApplyConfig`
readability by defining operator!= also for the AGC1 config.

Bug: webrtc:7494
Change-Id: I62068de32c941e6b18d4618c656f569647042345
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/187120
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32402}
2020-10-14 12:18:57 +00:00
Alessio Bazzica
9a625e7aef AGC2: max output noise level now part of config
Tested: bit-exactness verified with audioproc_f

Bug: webrtc:7494
Change-Id: Ic42f09dc13560494963cdcd338a0c52a729e108d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186266
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32282}
2020-10-01 17:06:40 +00:00
Alessio Bazzica
29ef556aff AGC2: max adaptation speed now part of config
Tested: bit-exactness verified with audioproc_f

Bug: webrtc:7494
Change-Id: Ie65a2e2139cff0bd730307d06b74760e307c9568
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186264
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32277}
2020-10-01 16:15:28 +00:00
Alessio Bazzica
59f1d1e36d AGC2 adaptive digital controller config: new params
This CL adds and wires up the following parameters:
- VAD probability attack used in `VadLevelAnalyzer`
- Adjacent spech frames threshold used in `AdaptiveModeLevelEstimator`
- Initial saturation margin used in `AdaptiveModeLevelEstimator`

The deprecated ctor in `AdaptiveModeLevelEstimator` is removed.

Tested: bit-exactness verified with audioproc_f

Bug: webrtc:7494
Change-Id: Idf94aaadba1476757f845e696bfb47ff6252d5f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186048
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32265}
2020-09-30 22:29:14 +00:00
Alessio Bazzica
1309c77a48 AGC2 adaptive digital controller config: new param
This CL adds and wires up a parameter (namely, adjacent speech
frames threshold) used in `AdaptiveDigitalGainApplier`.

Tested: bit-exactness verified with audioproc_f

Bug: webrtc:7494
Change-Id: I751cd91f08a6e98ee20f767c8df0ed121c8d4b68
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186049
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32264}
2020-09-30 22:10:53 +00:00
Niels Möller
de95329daa Delete macros RTC_DISALLOW_ASSIGN and RTC_DISALLOW_IMPLICIT_CONSTRUCTORS
The former was unused, the latter is replaced with the explicit C++11
deletions. The related RTC_DISALLOW_COPY_AND_ASSIGN is left for now,
it is used in a lot more places.

Bug: None
Change-Id: I49503e7f2b9ff43c6285f8695833479bbc18c380
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185500
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32224}
2020-09-29 10:19:20 +00:00
Mirko Bonadei
c94650d88f Remove AudioProcessing::SetExtraOptions.
Bug: webrtc:5298
Change-Id: I28be75df69b66aa59ae91b05cb7f9afad4f55aa1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182120
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32033}
2020-09-03 12:43:14 +00:00
Mirko Bonadei
ea8f739bce Make AudioProcessing::SetExtraOptions non pure-virtual.
Bug: webrtc:5298
Change-Id: Ib5ba81c8e333b1e7189fbb7e9e9f143579c84b8b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182181
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32032}
2020-09-03 06:17:44 +00:00
Per Åhgren
0ade98316c Cleanup of the APM creation
This CL removes the possibility that APM cannot be created, i.e., that
the create method can return nullptr. That was already the case
implicitly but this CL makes that behavior explicit.


Bug: webrtc:5298
Change-Id: I2706ea538c9d1b4bcd65faecab637640a209a4dc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183101
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32029}
2020-09-02 20:28:49 +00:00
Per Åhgren
552d3e3d5e Reland "Add ability to state whether the APM output will be used"
This is a reland of 8be2f201ba

Original change's description:
> Add ability to state whether the APM output will be used
> 
> This CL adds the ability for the surrounding code to state that the
> APM output will not be used. The intended usecase for this is to allow
> APM to run at a lower complexity when the endpoint is muted.
> When APM has been informed that the output will not be used, it can
> turn off code that is needed only for ensuring that the output audio
> will sound good.
> 
> Bug: b/154437967,b/163802450
> Change-Id: I8e22989e35354372e96191d15da44beb9d1b26ae
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181200
> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31949}

Bug: b/154437967
Bug: b/163802450
Change-Id: Ia77a9e43f913929d1afa72212f1ea6c192d0e519
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181887
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31957}
2020-08-18 12:29:32 +00:00
Erik Språng
1804b339a9 Revert "Add ability to state whether the APM output will be used"
This reverts commit 8be2f201ba.

Reason for revert: Breaks downstream

Original change's description:
> Add ability to state whether the APM output will be used
> 
> This CL adds the ability for the surrounding code to state that the
> APM output will not be used. The intended usecase for this is to allow
> APM to run at a lower complexity when the endpoint is muted.
> When APM has been informed that the output will not be used, it can
> turn off code that is needed only for ensuring that the output audio
> will sound good.
> 
> Bug: b/154437967,b/163802450
> Change-Id: I8e22989e35354372e96191d15da44beb9d1b26ae
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181200
> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31949}

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

Change-Id: I1e56dafbbfa6ea69cccbbb5cdc2b1e2a6c122c11
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/154437967
Bug: b/163802450
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181884
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31953}
2020-08-17 14:10:08 +00:00
Per Åhgren
8be2f201ba Add ability to state whether the APM output will be used
This CL adds the ability for the surrounding code to state that the
APM output will not be used. The intended usecase for this is to allow
APM to run at a lower complexity when the endpoint is muted.
When APM has been informed that the output will not be used, it can
turn off code that is needed only for ensuring that the output audio
will sound good.

Bug: b/154437967,b/163802450
Change-Id: I8e22989e35354372e96191d15da44beb9d1b26ae
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181200
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31949}
2020-08-17 12:56:24 +00:00