Commit graph

1233 commits

Author SHA1 Message Date
Tony Herre
b0ed12099f Update links to point at main branch
As part of go/coil update code search links to not point to the
"master" branch.

Bug: chromium:1226942
Change-Id: I0ae9e84ecc660f789a69fe0b226f93bbc39a8a66
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226081
Commit-Queue: Tony Herre <toprice@chromium.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34531}
2021-07-22 16:41:26 +00:00
Hanna Silen
e7e9292fe8 Analog AGC: Add clipping rate metrics
Add a histogram WebRTC.Audio.Agc.InputClippingRate and logging of
max clipping rate in AgcManagerDirect.

Bug: webrtc:12774
Change-Id: I4a72119b65ad032fc50672e2a8fb4a4d55e1ff24
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225264
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34450}
2021-07-10 13:13:46 +00:00
Peter Kasting
286b1db1b2 Fix -Wunreachable-code-aggressive.
Bug: chromium:1066980
Change-Id: I6888ea1fbc458c9b3063b3f60a7732af16ab5fc9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/224266
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#34393}
2021-06-30 11:14:37 +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
5b9d0c70c2 AGC1 add clipping predictor evaluator
Observes clipping predictions and detections and computes evaluation
metrics for the predictor.

Bug: webrtc:12774
Change-Id: I83f5942a3b6491de288510f2200f2f5c0e099bf2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221619
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34305}
2021-06-16 15:33:51 +00:00
Alessio Bazzica
98ff0280ce AGC analog ClippingPredictor refactoring 2/2
Uunit test code readability improvements.

Bug: webrtc:12774
Change-Id: I66f552d23680ddb03824618dab869946e0940334
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221900
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34300}
2021-06-16 10:28:57 +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
Gustaf Ullberg
a63d152423 AEC3: Unbounded echo spectrum for dominant nearend detection.
The dominant nearend detector uses the residual echo spectrum for
determining whether in nearend state. The residual echo spectrum in
computed using the ERLE. To reduce the risk of echo leaks in the
suppressor, the ERLE is capped. While minimizing echo leaks, the
capping of the ERLE can affect the dominant nearend classification
negatively as the residual echo spectrum is often over estimated.

This change enables the dominant nearend detector to use a residual
echo spectrum computed with a virtually non-capped ERLE. This ERLE
is only used for dominant nearend detection and leads to increased
transparency.

The feature is currently disabled by default and can be enabled
with the field trial "WebRTC-Aec3UseUnboundedEchoSpectrum".

Bug: webrtc:12870
Change-Id: Icb675c6f5d42ab9286e623b5fb38424d5c9cbee4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221920
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34270}
2021-06-11 13:30:00 +00:00
Hanna Silen
a004715d13 Integrate ClippingPredictor into AudioProcessingImpl and AgcManagerDirect
Integrate ClippingPredictor in AgcManagerDirect and
AudioProcessingImpl. Disable functionality by default.

Bug: webrtc:12774
Change-Id: Ic67a47f439c89b75066506fca8acaf636d8812f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221100
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34207}
2021-06-03 02:35:05 +00:00
Hanna Silen
4b3a06139b Add ClippingPredictor implementation
Add implementation for clipping prediction and clipped level step estimation.

Bug: webrtc:12774
Change-Id: I855d22980302aac7d49078ca29755f9422af9cb5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/220935
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34206}
2021-06-02 22:45:46 +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
Per Åhgren
cbdbb8c166 Add ability to adjust the suppressor smoothing in AEC3
Bug: b/177359044
Change-Id: I5eddb6fa6f01aa14426161204e37a9097b182234
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217889
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34203}
2021-06-02 15:21:35 +00:00
Hanna Silen
ea72ee6350 Add ClippingPredictorLevelBuffer circular buffer.
Bug: webrtc:12774
Change-Id: I2b26660e3fe051ab358dd5298ba5098f275943da
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219631
Reviewed-by: Minyue Li <minyue@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34167}
2021-05-31 14:04:54 +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
Gustaf Ullberg
398def6828 Improvements to AEC3 logging to simplify debugging
Adds log messages for
- AEC3 creation
- Transparent mode implementation selection
- Config parameter changes via RetrieveFieldTrialValue

Bug: webrtc:8671
Change-Id: Ibb1e76d66975a3a3c1227e31b9916a17b76e6c29
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219468
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34056}
2021-05-19 14:28:44 +00:00
Gustaf Ullberg
aeb8ce882f AEC3: Change adaptation speed of the matched filter after a delay is found
This change enables the use of two different adaptation speeds of the
matched filter of the delay estimator of AEC3.

One speed is used when no delay has been found, and one is used after a
reliable delay has been found. The purpose is to use a slower adaptation
speed to reduce the risk of divergence during double-talk without
slowing down the search for the initial delay.

The CL prepares for experimentation by adding field trials for
controlling the two adaptation speeds.

Bug: webrtc:12775
Change-Id: I817a1ab5ded0f78d20de45edcf04c708290173fc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219083
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34055}
2021-05-19 13:37:13 +00:00
Per Åhgren
91a892f8ed Add ability to dump the coarse filter in the echo subtractor
Bug: b/155316201
Change-Id: I008cdf1531af3c3c0fff4ce19ad5dd74f8e73f65
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217891
Reviewed-by: Sam Zackrisson <saza@google.com>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34047}
2021-05-19 08:24:16 +00:00
Gustaf Ullberg
a399c823bb Field trial to disable the transient suppressor
This change adds the field trial "WebRTC-TransientSuppressorForcedOff"
that can be used to disable the transient suppressor (removal of
keyboard typing sounds). The field trial can be enabled by users via
command-line or via experimentation.

Bug: chromium:1186705
Change-Id: I7272df6a20fbbee24a7ba0904502c76bd775d275
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219282
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34038}
2021-05-18 12:34:37 +00:00
Alessio Bazzica
7ddadbc108 APM: dump GainController1::AnalogGainController in Config::ToString
Update `AudioProcessing::Config::ToString()` to also dump the config
from `AnalogGainController` which is missing.

Bug: webrtc:7494
Change-Id: Iea5dab1f6abb9ec8581ce690a2a119f202b4d1e1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219082
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34025}
2021-05-17 16:37:37 +00:00
Markus Handell
ad5037b4a8 Reland "Refactor the PlatformThread API."
This reverts commit 793bac569f.

Reason for revert: rare compilation error fixed

Original change's description:
> Revert "Refactor the PlatformThread API."
>
> This reverts commit c89fdd716c.
>
> Reason for revert: Causes rare compilation error on win-libfuzzer-asan trybot.
> See https://ci.chromium.org/p/chromium/builders/try/win-libfuzzer-asan-rel/713745?
>
> Original change's description:
> > Refactor the PlatformThread API.
> >
> > PlatformThread's API is using old style function pointers, causes
> > casting, is unintuitive and forces artificial call sequences, and
> > is additionally possible to misuse in release mode.
> >
> > Fix this by an API face lift:
> > 1. The class is turned into a handle, which can be empty.
> > 2. The only way of getting a non-empty PlatformThread is by calling
> > SpawnJoinable or SpawnDetached, clearly conveying the semantics to the
> > code reader.
> > 3. Handles can be Finalized, which works differently for joinable and
> > detached threads:
> >   a) Handles for detached threads are simply closed where applicable.
> >   b) Joinable threads are joined before handles are closed.
> > 4. The destructor finalizes handles. No explicit call is needed.
> >
> > Fixed: webrtc:12727
> > Change-Id: Id00a0464edf4fc9e552b6a1fbb5d2e1280e88811
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215075
> > Commit-Queue: Markus Handell <handellm@webrtc.org>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> > Reviewed-by: Tommi <tommi@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#33923}
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> TBR=handellm@webrtc.org
>
> Bug: webrtc:12727
> Change-Id: Ic0146be8866f6dd3ad9c364fb8646650b8e07419
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217583
> Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
> Reviewed-by: Markus Handell <handellm@webrtc.org>
> Commit-Queue: Guido Urdaneta <guidou@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#33936}

# Not skipping CQ checks because this is a reland.

Bug: webrtc:12727
Change-Id: Ifd6f44eac72fed84474277a1be03eb84d2f4376e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217881
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Markus Handell <handellm@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33950}
2021-05-07 14:14:43 +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
Guido Urdaneta
793bac569f Revert "Refactor the PlatformThread API."
This reverts commit c89fdd716c.

Reason for revert: Causes rare compilation error on win-libfuzzer-asan trybot.
See https://ci.chromium.org/p/chromium/builders/try/win-libfuzzer-asan-rel/713745?

Original change's description:
> Refactor the PlatformThread API.
>
> PlatformThread's API is using old style function pointers, causes
> casting, is unintuitive and forces artificial call sequences, and
> is additionally possible to misuse in release mode.
>
> Fix this by an API face lift:
> 1. The class is turned into a handle, which can be empty.
> 2. The only way of getting a non-empty PlatformThread is by calling
> SpawnJoinable or SpawnDetached, clearly conveying the semantics to the
> code reader.
> 3. Handles can be Finalized, which works differently for joinable and
> detached threads:
>   a) Handles for detached threads are simply closed where applicable.
>   b) Joinable threads are joined before handles are closed.
> 4. The destructor finalizes handles. No explicit call is needed.
>
> Fixed: webrtc:12727
> Change-Id: Id00a0464edf4fc9e552b6a1fbb5d2e1280e88811
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215075
> Commit-Queue: Markus Handell <handellm@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Tommi <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#33923}

# Not skipping CQ checks because original CL landed > 1 day ago.

TBR=handellm@webrtc.org

Bug: webrtc:12727
Change-Id: Ic0146be8866f6dd3ad9c364fb8646650b8e07419
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217583
Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
Reviewed-by: Markus Handell <handellm@webrtc.org>
Commit-Queue: Guido Urdaneta <guidou@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33936}
2021-05-06 14:22:57 +00:00
Markus Handell
c89fdd716c Refactor the PlatformThread API.
PlatformThread's API is using old style function pointers, causes
casting, is unintuitive and forces artificial call sequences, and
is additionally possible to misuse in release mode.

Fix this by an API face lift:
1. The class is turned into a handle, which can be empty.
2. The only way of getting a non-empty PlatformThread is by calling
SpawnJoinable or SpawnDetached, clearly conveying the semantics to the
code reader.
3. Handles can be Finalized, which works differently for joinable and
detached threads:
  a) Handles for detached threads are simply closed where applicable.
  b) Joinable threads are joined before handles are closed.
4. The destructor finalizes handles. No explicit call is needed.

Fixed: webrtc:12727
Change-Id: Id00a0464edf4fc9e552b6a1fbb5d2e1280e88811
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215075
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33923}
2021-05-05 09:59:07 +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
Tommi
87f7090fd9 Replace more instances of rtc::RefCountedObject with make_ref_counted.
This is essentially replacing `new rtc::RefCountedObject` with
`rtc::make_ref_counted` in many files. In a couple of places I
made minor tweaks to make things compile such as adding parenthesis
when they were missing.

Bug: webrtc:12701
Change-Id: I3828dbf3ee0eb0232f3a47067474484ac2f4aed2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215973
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33852}
2021-04-27 17:01:59 +00:00
Markus Handell
97c4458c8f PlatformThread: add support for detached threads.
The change introduces support for detachable PlatformThreads, for which
the Stop() call doesn't wait until the thread has finished executing.

The change also introduces rtc::ThreadAttributes that carries priority
and detachability thread attributes. It additionally refactors all
known use to use the new semantics.

Bug: b:181572711, webrtc:12659
Change-Id: Id96e87c2a0dafabc8047767d241fd5da4505d14c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214704
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33796}
2021-04-21 07:44:31 +00:00
Gustaf Ullberg
437d129ef5 AEC3: Avoid overcompensating for render onsets during dominant nearend
The ERLE is used to estimate residual echo for echo suppression. The
ERLE is reduced during far-end offset to avoid echo leakage. When there
is a strong near-end present this can cause unnecessary transparency loss.

This change adds an ERLE estimation that does not compensate for onsets and
uses it for residual echo estimation when the suppressor considers the near-end to be dominant.

Bug: webrtc:12686
Change-Id: Ida78eeacf1f95c6e62403f86ba3f2ff055898a84
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215323
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33786}
2021-04-20 12:33:02 +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
Per Åhgren
dea5721efb Adding g3doc for AudioProcessingModule (APM)
Bug: webrtc:12569
Change-Id: I8fa896a5afa9791ad6d8c2b5011d1e75ca068df4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215141
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33726}
2021-04-14 09:40:25 +00:00
Gustaf Ullberg
1fad94f502 Remove ErleUncertainty
Erle Uncertainty changes the residual echo computation during saturated
echo. However, the case of saturated echo is already handled by the
residual echo estimator causing the ErleUncertainty to be a no-op.

The change has been tested for bit-exactness.

Bug: webrtc:8671
Change-Id: I779ba67f99f29d4475a0465d05da03d42d50e075
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215072
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33719}
2021-04-14 07:01:14 +00:00
Alessio Bazzica
11bd143974 AGC2 add an interface for the noise level estimator
Done in preparation for the child CL which adds an alternative
implementation.

Bug: webrtc:7494
Change-Id: I4963376afc917eae434a0d0ccee18f21880eefe0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214125
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33646}
2021-04-08 07:34:22 +00:00
Alessio Bazzica
70b775d77f AGC2 noise estimator code style improvements
Code style improvements done in preparation for a bug fix (TODO added)
which requires changes in the unit tests.

Note that one expected value in the unit tests has been adjusted since
the white noise generator is now instanced in each separate test and
therefore, even if the seed remained the same, the generated sequences
differ.

Bug: webrtc:7494
Change-Id: I497513b84f50b5c66cf6241a09946ce853eb1cd2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214122
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33636}
2021-04-07 11:57:55 +00:00
Alessio Bazzica
8aaa604375 AGC2 new data dumps
Bug: webrtc:7494
Change-Id: Id288dd426e1c2754805bc548fbffe0eaeaacf3da
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213420
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33605}
2021-03-31 14:55:42 +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
Alessio Bazzica
b995bb86df AGC2 size_t -> int
Bug: webrtc:7494
Change-Id: I5ecf242e83b509931c1764a37339d11506c5afc6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213341
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33600}
2021-03-31 11:18:30 +00:00
Per Åhgren
19775cbd29 Reland "Reduce complexity in the APM pipeline when the output is not used"
This is a reland of aa6adffba3

What was changed in the reland is that the merging of the bands is
excluded from the code that is not run when the output is not used.
I.e., the merging is always done.

This is important to have since some clients may apply muting before APM,
and still flag to APM that the signal is muted. If the merging is not
always done, those clients will get nonzero output from APM during muting.


Original change's description:
> Reduce complexity in the APM pipeline when the output is not used
>
> This CL selectively turns off parts of the audio processing when
> the output of APM is not used. The parts turned off are such that
> don't need to continuously need to be trained, but rather can be
> temporarily deactivated.
>
> The purpose of this CL is to allow CPU to be reduced when the
> client is muted.
>
> The CL will be follow by additional CLs, adding similar functionality
> in the echo canceller and the noiser suppressor
>
> Bug: b/177830919
> Change-Id: I72d24505197a53872562c0955f3e7b670c43df6b
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/209703
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#33431}

Bug: b/177830919
Change-Id: Ib74dd1cefa173d45101e26c4f2b931860abc6d08
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211760
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33478}
2021-03-16 09:33:02 +00:00
Per Åhgren
15179a9986 Allowing reduced computations in the noise suppressor when the output is not used
This CL adds functionality in the noise suppressor that allows the
computational complexity to be reduced when the output of APM is not used.

Bug: b/177830919
Change-Id: I849351ba9559fae770e4667d78e38abde5230eed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211342
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33477}
2021-03-16 09:28:42 +00:00
Per Åhgren
8ee1ec82e4 Allowing reduced computations in the AEC3 when the output is not used
This CL adds functionality in AEC3 that allows the computational
complexity to be reduced when the output of APM is not used.

Bug: b/177830919
Change-Id: I08121364bf966f34311f54ffa5affbfd8b4db1e2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211341
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33476}
2021-03-16 09:16:32 +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
Gustaf Ullberg
fdd6099348 Rework transient suppressor configuration in audioproc_f
The transient suppressor can be configured as:
0 - Deactivated
1 - Activated with key events from aecdump
2 - Activated with continuous key events (for debugging purposes)

Bug: webrtc:5298
Change-Id: I116eb08ad50178dc5116d5d967084e6c9967f258
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211869
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33464}
2021-03-15 15:19:09 +00:00
Per Åhgren
55bc077b45 Add one frame (10 ms) of silence in APM output after unmuting
This CL adds one frame (10 ms) of silence in APM output after unmuting to mask
audio resulting from the turning on the processing that was deactivated
during the muting.

Bug: b/177830919
Change-Id: If44cfb0ef270dde839dcd3f0b98d1c91e81668dd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211343
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33454}
2021-03-13 01:05:45 +00:00
Ilya Nikolaevskiy
8097935df3 Revert "Reduce complexity in the APM pipeline when the output is not used"
This reverts commit aa6adffba3.

Reason for revert: breaks webrtc-importer

Original change's description:
> Reduce complexity in the APM pipeline when the output is not used
>
> This CL selectively turns off parts of the audio processing when
> the output of APM is not used. The parts turned off are such that
> don't need to continuously need to be trained, but rather can be
> temporarily deactivated.
>
> The purpose of this CL is to allow CPU to be reduced when the
> client is muted.
>
> The CL will be follow by additional CLs, adding similar functionality
> in the echo canceller and the noiser suppressor
>
> Bug: b/177830919
> Change-Id: I72d24505197a53872562c0955f3e7b670c43df6b
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/209703
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#33431}

Bug: b/177830919
Change-Id: I937cd61dedcd43150933eb1b9d65aebe68401e91
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211348
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33433}
2021-03-11 11:41:20 +00:00
Per Åhgren
aa6adffba3 Reduce complexity in the APM pipeline when the output is not used
This CL selectively turns off parts of the audio processing when
the output of APM is not used. The parts turned off are such that
don't need to continuously need to be trained, but rather can be
temporarily deactivated.

The purpose of this CL is to allow CPU to be reduced when the
client is muted.

The CL will be follow by additional CLs, adding similar functionality
in the echo canceller and the noiser suppressor

Bug: b/177830919
Change-Id: I72d24505197a53872562c0955f3e7b670c43df6b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/209703
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33431}
2021-03-11 10:06:58 +00:00
Per Åhgren
34fdc92119 Add audioproc_f support for testing the runtime settings of whether the output is used
Bug: b/177830919
Change-Id: Iddcb79000f471eac165e3f44f14fad41435e6ccb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211241
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33426}
2021-03-10 23:19:30 +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
Gustaf Ullberg
09226fc832 Disable high-pass filtering of the AEC reference
Currently the echo canceller reference signal is high-pass filtered to
avoid the need of modeling the capture-side high-pass filter as part of
the echo path.

This can lead to the lowest frequency bins of the linear filter
diverging as there is little low-frequency content available for
training. Over time the filter can output an increasing amount of
low-frequency power, which in turn affects the filter's ability to
adapt properly.

Disabling the high-pass filtering of the echo canceller reference solves
this issue, resulting in improved filter convergence.

Bug: webrtc:12265
Change-Id: Ic526a4b1b73e1808cfcd96a8cdee801b96a27671
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208288
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33322}
2021-02-23 07:06:11 +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
Per Åhgren
879d33b9f8 Add more refined control over dumping of data and the aecdump content
This CL adds the ability in audioproc_f and unpack_aecdump to:
-Clearly identify the Init events and when those occur.
-Optionally only process a specific Init section of an aecdump.
-Optionally selectively turn on dumping of internal data for a
 specific init section, and a specific time interval.
-Optionally let unpack_aecdump produce file names based on inits.

Bug: webrtc:5298
Change-Id: Id654b7175407a23ef634fca832994d87d1073239
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196160
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33181}
2021-02-06 00:36:10 +00:00
Sam Zackrisson
53610223a8 Delete unused function webrtc::AudioProcessing::MutateConfig
Bug: None
Change-Id: Ibc70e5246a3f7b89775c65a19c808c1f030b8ac6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205522
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33147}
2021-02-03 12:55:23 +00:00
Alessio Bazzica
6f75f6b3bd APM: add AGC2 SIMD kill switches in AudioProcessing::Config::ToString()
Bug: webrtc:7494
Change-Id: Icba5f6be689a57ef4748ae816565349fd1ad2108
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/205322
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33146}
2021-02-03 12:31:56 +00:00
Andrey Logvin
e7c79fd3d6 Remove from chromium build targets that are not compatible with it.
We need to be able build chromium with rtc_include_tests = true. It
reveals a lot of targets that are not compatible with chromium but
aren't marked so.

`rtc_include_tests=true` has been considered a way to disable targets for the Chromium build, causing an overload on rtc_include_tests while the meaning of the two GN args (rtc_include_tests and build_with_chromium) should be kept separated.

Bug: webrtc:12404
Change-Id: I2f72825445916eae7c20ef9338672d6a07a9b9ff
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/203890
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33124}
2021-02-01 13:46:19 +00:00
Andrey Logvin
b79acd8ce9 Format webrtc/modules/audio_processing/transient/BUILD.gn file
Bug: webrtc:12404
Change-Id: I3cb6b96255409709fa3144d2f83d13d12e39ab2a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/204064
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33107}
2021-01-29 16:33:19 +00:00
Per Åhgren
c2ae4c8a37 Allow separate dump sets for the data dumper in APM
This CL allows separate dump sets to be used when dumping internal
APM data using audioproc_f, opening up for reducing the amount of
data to be dumped.

Bug: webrtc:5298
Change-Id: I8286933ceed10db074f2064414cc08e8b12653fa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196089
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33047}
2021-01-20 16:38:17 +00:00
Gustaf Ullberg
5c3ff6b60f Switch to enable the HMM transparent mode classifier
Bug: chromium:1155071,webrtc:12265,chromium:1155477
Change-Id: I9d3119e9cbfdd5d7b41de2ed0f9dec92f7bf753d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/202258
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33037}
2021-01-19 16:26:11 +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
Mirko Bonadei
e5f4c6b8d2 Reland "Refactor rtc_base build targets."
This is a reland of 69241a93fb

Fix: The problem was related to NO_MAIN_THREAD_WRAPPING, which
affects https://source.chromium.org/chromium/chromium/src/+/master:third_party/webrtc/rtc_base/thread.cc;l=257-263;drc=7acc2d9fe3a6e3c4d8881d2bdfc9b8968a724cd5.
The original CL didn't attach the definition of the macro
NO_MAIN_THREAD_WRAPPING when building for Chromium (which doesn't have
to be related to //rtc_base anymore but to //rtc_base:threading).

Original change's description:
> Refactor rtc_base build targets.
>
> The "//rtc_base:rtc_base" build target has historically been one of the
> biggest targets in the WebRTC build. Big targets are the main source of
> circular dependencies and non-API types leakage.
>
> This CL is a step forward into splitting "//rtc_base:rtc_base" into
> smaller targets (as originally started in 2018).
>
> The only non-automated changes are (like re-wiring the build system):
> * The creation of //rtc_base/async_resolver.{h,cc} which allows to
>   break a circular dependency (is has been extracted from
>   //rtc_base/net_helpers.{h,cc}).
> * The creation of //rtc_base/internal/default_socket_server.{h,cc} to
>   break another circular dependency.
>
> Bug: webrtc:9987
> Change-Id: I0c8f5e7efe2c8fd8e6bffa0d6dd2dd494cf3df02
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196903
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32941}

Bug: webrtc:9987
Change-Id: I7cdf49d2aac8357f1f50f90010bf2c2f62fa19f6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/202021
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33001}
2021-01-15 17:00:05 +00:00
Mirko Bonadei
7acc2d9fe3 Revert "Refactor rtc_base build targets."
This reverts commit 69241a93fb.

Reason for revert: Breaks WebRTC roll into Chromium.

Original change's description:
> Refactor rtc_base build targets.
>
> The "//rtc_base:rtc_base" build target has historically been one of the
> biggest targets in the WebRTC build. Big targets are the main source of
> circular dependencies and non-API types leakage.
>
> This CL is a step forward into splitting "//rtc_base:rtc_base" into
> smaller targets (as originally started in 2018).
>
> The only non-automated changes are (like re-wiring the build system):
> * The creation of //rtc_base/async_resolver.{h,cc} which allows to
>   break a circular dependency (is has been extracted from
>   //rtc_base/net_helpers.{h,cc}).
> * The creation of //rtc_base/internal/default_socket_server.{h,cc} to
>   break another circular dependency.
>
> Bug: webrtc:9987
> Change-Id: I0c8f5e7efe2c8fd8e6bffa0d6dd2dd494cf3df02
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196903
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32941}

TBR=mbonadei@webrtc.org,hta@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

No-Try: True
Bug: webrtc:9987
Change-Id: I1e36ad64cc60092f38d6886153a94f1a58339256
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/201840
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32986}
2021-01-14 21:27:38 +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
Hua, Chunbo
dbcaff0925 Fix AudioProcessing::Config::ToString() implementation.
residual_echo_detector and level_estimation is not part of gain_controller2
in AudioProcessing::Config.

Bug: None
Change-Id: Ic31b8c6bb4d9ed59b4f337e5dc8b8c587ae54202
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/200924
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32972}
2021-01-14 10:27:18 +00:00
Alessio Bazzica
76714a6cc8 AGC2 minor code clean up
Dead code removed plus const ref std::string to avoid copies.

Bug: webrtc:7494
Change-Id: Ic408a810ae310fea942f25fc697ab81017c8a739
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/201624
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32968}
2021-01-14 08:03:17 +00:00
Mirko Bonadei
69241a93fb Refactor rtc_base build targets.
The "//rtc_base:rtc_base" build target has historically been one of the
biggest targets in the WebRTC build. Big targets are the main source of
circular dependencies and non-API types leakage.

This CL is a step forward into splitting "//rtc_base:rtc_base" into
smaller targets (as originally started in 2018).

The only non-automated changes are (like re-wiring the build system):
* The creation of //rtc_base/async_resolver.{h,cc} which allows to
  break a circular dependency (is has been extracted from
  //rtc_base/net_helpers.{h,cc}).
* The creation of //rtc_base/internal/default_socket_server.{h,cc} to
  break another circular dependency.

Bug: webrtc:9987
Change-Id: I0c8f5e7efe2c8fd8e6bffa0d6dd2dd494cf3df02
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196903
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32941}
2021-01-11 18:32:30 +00:00
Alessio Bazzica
5247070f5d RNN VAD: add missing CPU features to test FC and GRU layers
Bug: webrtc:10480
Change-Id: I6c49e728ed61647b098c20a6d8a856005066ab75
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/200840
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32930}
2021-01-10 12:42:39 +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
Alessio Bazzica
ed9f5f85fd RNN VAD optimizations: VectorMath::DotProduct() NEON arm64
Results: RNN VAD realtime factor improved from 140x to 195x (+55x)
Test device: Pixel 2 XL
Benchmark setup: max clock speed forced on all the cores by
setting "performance" as scaling governor

Bug: webrtc:10480
Change-Id: I3e92f643853ad1fe990db909c578ce78ee826c03
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/198842
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32888}
2020-12-30 10:47:01 +00:00
Jesús de Vicente Peña
16dd6b0ce4 Fixing the bounds for the max and min erle in the erle instantaneous estimation.
Bug: webrtc:12283
Change-Id: I534a5da30e575f9b100046fff31a84774afbf67f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196654
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32834}
2020-12-15 14:29:52 +00:00
Jesús de Vicente Peña
3bda2362f1 Erle metric: avoid the decreasing of the metric when there is no render activity.
This change just affects the ERLE metric that is reported. The rest is unaffected and bitexact.

Bug: webrtc:12280
Change-Id: I2d28ef14a9b704c83aba18b624f67671eec4a042
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196649
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32809}
2020-12-09 11:48:11 +00:00
Alessio Bazzica
e8ee462681 RNN VAD: FC layer simplified
The implementations for the fully connected layer can be simlpified by
using `VectorMath:DotProduct()`. In this way, it is also possible to
remove (nearly) duplicated SIMD code, reduce the binary size and more
easily maintain the code.

This CL also forces unoptimized code for the output layer of the VAD,
which is a FC 24x1 layer. A slight improvement of the realtime has
been measured (delta ~ +5x).

Bug: webrtc:10480
Change-Id: Iee93bd59f7905ebf96275dbbfeb3c921baf4e8db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195580
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32806}
2020-12-09 00:04:50 +00:00
Alessio Bazzica
4e9c5b592a RNN VAD: GRU layer optimized
Using `VectorMath::DotProduct()` in GatedRecurrentLayer to reuse existing
SIMD optimizations. Results:
- When SSE2/AVX2 is avilable, the GRU layer takes 40% of the unoptimized
  code
- The realtime factor for the VAD improved as follows
  - SSE2: from 570x to 630x
  - AVX2: from 610x to 680x

This CL also improved the GRU layer benchmark by (i) benchmarking a GRU
layer havibng the same size of that used in the VAD and (ii) by prefetching
a long input sequence.

Bug: webrtc:10480
Change-Id: I9716b15661e4c6b81592b4cf7c172d90e41b5223
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195545
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32803}
2020-12-08 15:37:38 +00:00
Gustaf Ullberg
992a96f68e AEC3: Prevent diverging coarse filter from influencing the refined filter
After the refined filter has been determined to perform better than
the coarse filter, and the coefficients of the coarse filters are
overwritten by the ones from the refined filter, at least 100 ms have
to pass before the adaptation of the refined filter is allowed to speed
up due to good coarse filter performance.

This change solves the vicious circle described in webrtc:12265, where
the coarse and refined filters can diverge over time.

This feature can be disabled remotely via a kill-switch. When disabled
the AEC output is bit-exact to before the change.

Bug: webrtc:12265,chromium:1155477
Change-Id: Iacd6e325e987dd8a475bb3e8163fee714c65b20a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196501
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32801}
2020-12-08 15:05:23 +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
bb1a28de3c RNN VAD: unit test code clean-up
- test_utils.h/.cc simplified
- webrtc::rnnvad::test -> webrtc::rnnvad
- all unit test code inside the anonymous namespace
- names improved

Bug: webrtc:10480
Change-Id: I0a0f056f9728bb8a1b93006b95d7ed5bf5bd4adb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196509
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32789}
2020-12-07 17:35:45 +00:00
Alessio Bazzica
3ee4af4509 AGC2: Fix GetAvailableCpuFeatures()
Handle the case in which neither WEBRTC_ARCH_X86_FAMILY nor
WEBRTC_HAS_NEON are defined.

Bug: webrtc:10480
Change-Id: I241583911d8e5645dfbd39b60337dd20b2d9f046
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196525
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32786}
2020-12-07 13:34:58 +00:00
Alex Konradi
c20baf6067 Remove nesting of Naggy/Strict/NiceMock
This will soon become a compile-time error. Fix class hierarchies that
wrap StrictMock in a NiceMock or vice-versa by removing redundant
wrappings and removing inheritance from Nice/StrictMock and fixing the
call sites as appropriate.

Bug: b/173702213
Change-Id: Ic90b1f270c180f7308f40e52e358a8f6a6baad86
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196461
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32783}
2020-12-07 08:19:50 +00:00
Alessio Bazzica
9131313913 RNN VAD: GRU layer isolated into rnn_gru.h/.cc
Refactoring done to more easily and cleanly add SIMD optimizations and
to remove `GatedRecurrentLayer` from the RNN VAD api.

Bug: webrtc:10480
Change-Id: Ie1dffdd9b19c57c03a0b634f6818c0780456a66c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195445
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32770}
2020-12-04 07:40:41 +00:00
Alessio Bazzica
31d3b217d3 RNN VAD: FC layer isolated into rnn_fc.h/.cc
Refactoring done to more easily and cleanly add SIMD optimizations and
to remove `FullyConnectedLayer` from the RNN VAD api.

Minor improvements (readability, API):
- `FullyConnectedLayer` gets the ActivationFunction enum and not
  a function view anymore
- SSE2 optimization moved into `FullyConnectedLayer::ComputeOutputSse2`
- layer name added for improved logs

Bug: webrtc:10480
Change-Id: Ida4903a67655e19ef0464f378c433c1f6e96dca7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195444
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32766}
2020-12-03 23:25:22 +00:00
Alessio Bazzica
812dc072c6 RNN VAD: FC and GRU layers implicit conversion to ArrayView
Plus a few minor code readability improvements.

Bug: webrtc:10480
Change-Id: I590d8e203b1d05959a8c15373841e37abe83237e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195334
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32764}
2020-12-03 18:02:25 +00:00
Alessio Bazzica
e7b5c1a235 RNN VAD: unit tests for RnnBasedVad
Bug: webrtc:10480
Change-Id: I4ac8ae044261f94db7a1e9559aa61f532602b408
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195446
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32758}
2020-12-03 14:00:03 +00:00
Gustaf Ullberg
d891fd3f6f Disable HMM based transparent mode classifier
The HMM based transparent mode classifier is disabled until an issue
with diverging filters is resolved.

Bug: chromium:1155071
Change-Id: Iee249869f6ece1e48e834b3a4b9249c69a51286c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196341
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32756}
2020-12-03 12:15:49 +00:00
Alessio Bazzica
fd5dadbea9 RNN VAD: use VectorMath::DotProduct() for pitch search
This CL brings a large improvement to the RNN VAD CPU performance
by finally using `VectorMath::DotProduct()` for pitch search.

The realtime factor improved from about 390x to 570x for SSE2
(+180x, 45% faster) and to 610x for AVX2 (+235x, 60% faster).

RNN VAD benchmark results:
```
+-----+-------+------+------+
| run | none* | SSE2 | AVX2 |
+-----+-------+------+------+
|   1 | 393x  | 572x | 618x |
|   2 | 388x  | 568x | 607x |
|   3 | 393x  | 564x | 599x |
+-----+-------+------+------+
```
*: baseline, no SIMD used for pitch search, but SSE2 used for the RNN

Results obtained as follows:
1. Force SSE2 in `DISABLED_RnnVadPerformance` for the RNN part in
   order to measure the baseline correctly:
```
RnnBasedVad rnn_vad({/*sse2=*/true, /*avx2=*/true, /*neon=*/false});
```
2. Run the test:
```
$ ./out/release/modules_unittests \
  --gtest_filter=*RnnVadTest*DISABLED_RnnVadPerformance* \
  --gtest_also_run_disabled_tests --logs
```

Bug: webrtc:10480
Change-Id: I89a2bd420265540026944b9c0f1fdd4bfda7f475
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/195001
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32755}
2020-12-03 11:50:09 +00:00
Alessio Bazzica
b6e840c036 RNN VAD: SSE2 optimization for VectorMath::DotProduct
Bug: webrtc:10480
Change-Id: I9f40352308bbfd5ea72a2607e7d1184cb6b85333
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/194328
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32745}
2020-12-02 16:59:06 +00:00
Alessio Bazzica
01b3e24a83 RNN VAD: VectorMath::DotProduct with AVX2 optimization
This CL adds a new library for the RNN VAD that provides (optimized)
vector math ops. The scheme is the same of the `VectorMath` class of AEC3
to ensure correct builds across different platforms.

Bug: webrtc:10480
Change-Id: I96bcfbf930ca27388ab5f2d52c022ddb73acf8e6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/194326
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32741}
2020-12-02 15:13: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
08d2a703fc AGC2 limiter stats + config ToString missing param
Bug: webrtc:7494
Change-Id: Icb6a164882af5c15c9400eb869dccbfda20b3da7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/194324
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32653}
2020-11-20 17:03:05 +00:00
Mirko Bonadei
01719fbeb5 Reland "Rename FATAL() into RTC_FATAL()."
This is a reland of 9653d26f8e

Original change's description:
> Rename FATAL() into RTC_FATAL().
>
> No-Try: True
> Bug: webrtc:8454
> Change-Id: I9130487a92463a2128cf1493e6c5117b2fab313a
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193703
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32620}

No-Try: True
Bug: webrtc:8454
Change-Id: Idb80125ac31ea307d1434bc9a65f148ac2017a3c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193864
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32635}
2020-11-18 20:49:08 +00:00
Mirko Bonadei
a4fd641f51 Revert "Rename FATAL() into RTC_FATAL()."
This reverts commit 9653d26f8e.

Reason for revert: Breaks downstream project.

Original change's description:
> Rename FATAL() into RTC_FATAL().
>
> No-Try: True
> Bug: webrtc:8454
> Change-Id: I9130487a92463a2128cf1493e6c5117b2fab313a
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193703
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32620}

TBR=mbonadei@webrtc.org,kwiberg@webrtc.org

Change-Id: I0ad01bcac60c87b30bd4575a9d631e7dd8f34992
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8454
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193863
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32627}
2020-11-18 07:03:54 +00:00
Mirko Bonadei
9653d26f8e Rename FATAL() into RTC_FATAL().
No-Try: True
Bug: webrtc:8454
Change-Id: I9130487a92463a2128cf1493e6c5117b2fab313a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193703
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32620}
2020-11-17 16:12:40 +00:00
Gustaf Ullberg
4543697b37 Set range of GetLinearAecOutput to [-1, 1]
The output of GetLinearAecOutput is changed to have the range [-1, 1]
instead of [-2^15, 2^15] to be more similar to other Audio Processing
Module API functions.

The "--linear_aec_output" of audioproc_f has been tested for
bit-exactness.

Bug: webrtc:12185
Change-Id: Id50d93fcfaee5c239f3eb73f99d0bd3533319518
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193062
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32604}
2020-11-13 15:01:31 +00:00
Alessio Bazzica
05f5d636e5 RNN VAD: pitch search optimizations (part 4)
Add inverted lags index to simplify the loop in
`FindBestPitchPeriod48kHz()`. Instead of looping over 294 items,
only loop over the relevant ones (up to 10) by keeping track of
the relevant indexes.

The benchmark has shown a slight improvement (about +6x).

Benchmarked as follows:
```
out/release/modules_unittests \
  --gtest_filter=*RnnVadTest.DISABLED_RnnVadPerformance* \
  --gtest_also_run_disabled_tests --logs
```

Results:

      | baseline             | this CL
------+----------------------+------------------------
run 1 | 22.8319 +/- 1.46554  | 22.1951 +/- 0.747611
      | 389.367x             | 400.539x
------+----------------------+------------------------
run 2 | 22.4286 +/- 0.726449 | 22.2718 +/- 0.963738
      | 396.369x             | 399.16x
------+----------------------+------------------------
run 2 | 22.5688 +/- 0.831341 | 22.4166 +/- 0.953362
      | 393.906x             | 396.581x

This CL also moved `PitchPseudoInterpolationInvLagAutoCorr()`
into `FindBestPitchPeriod48kHz()`.

Bug: webrtc:10480
Change-Id: Id4e6d755045c3198a80fa94a0a7463577d909b7e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191764
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32590}
2020-11-11 15:51:52 +00:00
Alessio Bazzica
f2a2fe84b8 Reland "RNN VAD: pitch search optimizations (part 3)"
This reverts commit 57e68ee1b9.

Reason for revert: bug in ancestor CL fixed

Original change's description:
> Revert "RNN VAD: pitch search optimizations (part 3)"
>
> This reverts commit ea89f2a447.
>
> Reason for revert: bug in ancestor CL https://webrtc-review.googlesource.com/c/src/+/191320
>
> Original change's description:
> > RNN VAD: pitch search optimizations (part 3)
> >
> > `ComputeSlidingFrameSquareEnergies()` which computes the energy of a
> > sliding 20 ms frame in the pitch buffer has been switched from backward
> > to forward.
> >
> > The benchmark has shown a slight improvement (about +6x).
> >
> > This change is not bit exact but all the tolerance tests still pass
> > except for one single case in `RnnVadTest,PitchSearchWithinTolerance`
> > for which the tolerance has been slightly increased. Note that the pitch
> > estimation is still bit-exact.
> >
> > Benchmarked as follows:
> > ```
> > out/release/modules_unittests \
> >   --gtest_filter=*RnnVadTest.DISABLED_RnnVadPerformance* \
> >   --gtest_also_run_disabled_tests --logs
> > ```
> >
> > Results:
> >
> >       | baseline             | this CL
> > ------+----------------------+------------------------
> > run 1 | 22.8319 +/- 1.46554  | 22.087 +/- 0.552932
> >       | 389.367x             | 402.499x
> > ------+----------------------+------------------------
> > run 2 | 22.4286 +/- 0.726449 | 22.216 +/- 0.916222
> >       | 396.369x             | 400.162x
> > ------+----------------------+------------------------
> > run 2 | 22.5688 +/- 0.831341 | 22.4902 +/- 1.04881
> >       | 393.906x             | 395.283x
> >
> > Bug: webrtc:10480
> > Change-Id: I1fd54077a32e25e46196c8e18f003cd0ffd503e1
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191703
> > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#32572}
>
> TBR=alessiob@webrtc.org,kwiberg@webrtc.org
>
> Change-Id: I57a8f937ade0a35e1ccf0e229c391cc3a10e7c48
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:10480
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192621
> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32578}

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

# Not skipping CQ checks because this is a reland.

Bug: webrtc:10480
Change-Id: I1d510697236255d8c0cca405e90781f5d8c6a3e6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192783
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32587}
2020-11-11 13:46:02 +00:00
Alessio Bazzica
5a37b94029 Reland "RNN VAD: pitch search optimizations (part 2)"
This reverts commit e6a731fcea.

Reason for revert: bug in parent CL fixed

Original change's description:
> Revert "RNN VAD: pitch search optimizations (part 2)"
>
> This reverts commit 2f7d1c62e2.
>
> Reason for revert: bug in ancestor CL https://webrtc-review.googlesource.com/c/src/+/191320
>
> Original change's description:
> > RNN VAD: pitch search optimizations (part 2)
> >
> > This CL brings a large improvement to the VAD by precomputing the
> > energy for the sliding frame `y` in the pitch buffer instead of
> > computing them twice in two different places. The realtime factor
> > has improved by about +16x.
> >
> > There is room for additional improvement (TODOs added), but that will
> > be done in a follow up CL since the change won't be bit-exact and
> > careful testing is needed.
> >
> > Benchmarked as follows:
> > ```
> > out/release/modules_unittests \
> >   --gtest_filter=*RnnVadTest.DISABLED_RnnVadPerformance* \
> >   --gtest_also_run_disabled_tests --logs
> > ```
> >
> > Results:
> >
> >       | baseline             | this CL
> > ------+----------------------+------------------------
> > run 1 | 23.568 +/- 0.990788  | 22.8319 +/- 1.46554
> >       | 377.207x             | 389.367x
> > ------+----------------------+------------------------
> > run 2 | 23.3714 +/- 0.857523 | 22.4286 +/- 0.726449
> >       | 380.379x             | 396.369x
> > ------+----------------------+------------------------
> > run 2 | 23.709 +/- 1.04477   | 22.5688 +/- 0.831341
> >       | 374.963x             | 393.906x
> >
> > Bug: webrtc:10480
> > Change-Id: I599a4dda2bde16dc6c2f42cf89e96afbd4630311
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191484
> > Reviewed-by: Per Åhgren <peah@webrtc.org>
> > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#32571}
>
> TBR=alessiob@webrtc.org,peah@webrtc.org
>
> Change-Id: I53e478d8d58912c7a5fae4ad8a8d1342a9a48091
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:10480
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192620
> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32580}

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

# Not skipping CQ checks because this is a reland.

Bug: webrtc:10480
Change-Id: I0d6c89c64587bb6c38e69b968df12a5eb499ac6f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192782
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32586}
2020-11-11 13:19:02 +00:00
Alessio Bazzica
c36f8623c0 Reland "RNN VAD: pitch search optimizations (part 1)"
This reverts commit 1b6b958a4a.

Reason for revert: Bug fix

Original change's description:
> Revert "RNN VAD: pitch search optimizations (part 1)"
>
> This reverts commit 9da3e177fd.
>
> Reason for revert: bug in ComputePitchPeriod48kHz()
>
> Original change's description:
> > RNN VAD: pitch search optimizations (part 1)
> >
> > TL;DR this CL improves efficiency and includes several code
> > readability improvements mainly triggered by the comments to
> > patch set #10.
> >
> > Highlights:
> > - Split `FindBestPitchPeriods()` into 12 and 24 kHz versions
> >   to hard-code the input size and simplify the 24 kHz version
> > - Loop in `ComputePitchPeriod48kHz()` (new name for
> >   `RefinePitchPeriod48kHz()`) removed since the lags for which
> >   we need to compute the auto correlation are a few
> > - `ComputePitchGainThreshold()` was only used in unit tests; it's been
> >   moved into the anon ns and the test removed
> >
> > This CL makes `ComputePitchPeriod48kHz()` is about 10% faster (measured
> > with https://webrtc-review.googlesource.com/c/src/+/191320/4/modules/audio_processing/agc2/rnn_vad/pitch_search_internal_unittest.cc).
> > The realtime factor has improved by about +14%.
> >
> > Benchmarked as follows:
> > ```
> > out/release/modules_unittests \
> >   --gtest_filter=*RnnVadTest.DISABLED_RnnVadPerformance* \
> >   --gtest_also_run_disabled_tests --logs
> > ```
> >
> > Results:
> >
> >       | baseline             | this CL
> > ------+----------------------+------------------------
> > run 1 | 24.0231 +/- 0.591016 | 23.568 +/- 0.990788
> >       | 370.06x              | 377.207x
> > ------+----------------------+------------------------
> > run 2 | 24.0485 +/- 0.957498 | 23.3714 +/- 0.857523
> >       | 369.67x              | 380.379x
> > ------+----------------------+------------------------
> > run 2 | 25.4091 +/- 2.6123   | 23.709 +/- 1.04477
> >       | 349.875x             | 374.963x
> >
> > Bug: webrtc:10480
> > Change-Id: I9a3e9164b2442114b928de506c92a547c273882f
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191320
> > Reviewed-by: Per Åhgren <peah@webrtc.org>
> > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#32568}
>
> TBR=alessiob@webrtc.org,peah@webrtc.org
>
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:10480
> Change-Id: I2a91f4f29566f872a7dfa220b31c6c625ed075db
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192660
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32581}

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

# Not skipping CQ checks because this is a reland.

Bug: webrtc:10480
Change-Id: I66e3e8d73ebc04a437c01a0396cd5613c42a8cf5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192780
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32585}
2020-11-11 12:43:45 +00:00
Alessio Bazzica
1b6b958a4a Revert "RNN VAD: pitch search optimizations (part 1)"
This reverts commit 9da3e177fd.

Reason for revert: bug in ComputePitchPeriod48kHz()

Original change's description:
> RNN VAD: pitch search optimizations (part 1)
>
> TL;DR this CL improves efficiency and includes several code
> readability improvements mainly triggered by the comments to
> patch set #10.
>
> Highlights:
> - Split `FindBestPitchPeriods()` into 12 and 24 kHz versions
>   to hard-code the input size and simplify the 24 kHz version
> - Loop in `ComputePitchPeriod48kHz()` (new name for
>   `RefinePitchPeriod48kHz()`) removed since the lags for which
>   we need to compute the auto correlation are a few
> - `ComputePitchGainThreshold()` was only used in unit tests; it's been
>   moved into the anon ns and the test removed
>
> This CL makes `ComputePitchPeriod48kHz()` is about 10% faster (measured
> with https://webrtc-review.googlesource.com/c/src/+/191320/4/modules/audio_processing/agc2/rnn_vad/pitch_search_internal_unittest.cc).
> The realtime factor has improved by about +14%.
>
> Benchmarked as follows:
> ```
> out/release/modules_unittests \
>   --gtest_filter=*RnnVadTest.DISABLED_RnnVadPerformance* \
>   --gtest_also_run_disabled_tests --logs
> ```
>
> Results:
>
>       | baseline             | this CL
> ------+----------------------+------------------------
> run 1 | 24.0231 +/- 0.591016 | 23.568 +/- 0.990788
>       | 370.06x              | 377.207x
> ------+----------------------+------------------------
> run 2 | 24.0485 +/- 0.957498 | 23.3714 +/- 0.857523
>       | 369.67x              | 380.379x
> ------+----------------------+------------------------
> run 2 | 25.4091 +/- 2.6123   | 23.709 +/- 1.04477
>       | 349.875x             | 374.963x
>
> Bug: webrtc:10480
> Change-Id: I9a3e9164b2442114b928de506c92a547c273882f
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191320
> Reviewed-by: Per Åhgren <peah@webrtc.org>
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32568}

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

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10480
Change-Id: I2a91f4f29566f872a7dfa220b31c6c625ed075db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192660
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32581}
2020-11-10 20:31:28 +00:00
Alessio Bazzica
e6a731fcea Revert "RNN VAD: pitch search optimizations (part 2)"
This reverts commit 2f7d1c62e2.

Reason for revert: bug in ancestor CL https://webrtc-review.googlesource.com/c/src/+/191320

Original change's description:
> RNN VAD: pitch search optimizations (part 2)
>
> This CL brings a large improvement to the VAD by precomputing the
> energy for the sliding frame `y` in the pitch buffer instead of
> computing them twice in two different places. The realtime factor
> has improved by about +16x.
>
> There is room for additional improvement (TODOs added), but that will
> be done in a follow up CL since the change won't be bit-exact and
> careful testing is needed.
>
> Benchmarked as follows:
> ```
> out/release/modules_unittests \
>   --gtest_filter=*RnnVadTest.DISABLED_RnnVadPerformance* \
>   --gtest_also_run_disabled_tests --logs
> ```
>
> Results:
>
>       | baseline             | this CL
> ------+----------------------+------------------------
> run 1 | 23.568 +/- 0.990788  | 22.8319 +/- 1.46554
>       | 377.207x             | 389.367x
> ------+----------------------+------------------------
> run 2 | 23.3714 +/- 0.857523 | 22.4286 +/- 0.726449
>       | 380.379x             | 396.369x
> ------+----------------------+------------------------
> run 2 | 23.709 +/- 1.04477   | 22.5688 +/- 0.831341
>       | 374.963x             | 393.906x
>
> Bug: webrtc:10480
> Change-Id: I599a4dda2bde16dc6c2f42cf89e96afbd4630311
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191484
> Reviewed-by: Per Åhgren <peah@webrtc.org>
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32571}

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

Change-Id: I53e478d8d58912c7a5fae4ad8a8d1342a9a48091
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10480
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192620
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32580}
2020-11-10 19:44:09 +00:00
Alessio Bazzica
57e68ee1b9 Revert "RNN VAD: pitch search optimizations (part 3)"
This reverts commit ea89f2a447.

Reason for revert: bug in ancestor CL https://webrtc-review.googlesource.com/c/src/+/191320

Original change's description:
> RNN VAD: pitch search optimizations (part 3)
>
> `ComputeSlidingFrameSquareEnergies()` which computes the energy of a
> sliding 20 ms frame in the pitch buffer has been switched from backward
> to forward.
>
> The benchmark has shown a slight improvement (about +6x).
>
> This change is not bit exact but all the tolerance tests still pass
> except for one single case in `RnnVadTest,PitchSearchWithinTolerance`
> for which the tolerance has been slightly increased. Note that the pitch
> estimation is still bit-exact.
>
> Benchmarked as follows:
> ```
> out/release/modules_unittests \
>   --gtest_filter=*RnnVadTest.DISABLED_RnnVadPerformance* \
>   --gtest_also_run_disabled_tests --logs
> ```
>
> Results:
>
>       | baseline             | this CL
> ------+----------------------+------------------------
> run 1 | 22.8319 +/- 1.46554  | 22.087 +/- 0.552932
>       | 389.367x             | 402.499x
> ------+----------------------+------------------------
> run 2 | 22.4286 +/- 0.726449 | 22.216 +/- 0.916222
>       | 396.369x             | 400.162x
> ------+----------------------+------------------------
> run 2 | 22.5688 +/- 0.831341 | 22.4902 +/- 1.04881
>       | 393.906x             | 395.283x
>
> Bug: webrtc:10480
> Change-Id: I1fd54077a32e25e46196c8e18f003cd0ffd503e1
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191703
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32572}

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

Change-Id: I57a8f937ade0a35e1ccf0e229c391cc3a10e7c48
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10480
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192621
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32578}
2020-11-10 18:43:48 +00:00
Alessio Bazzica
ea89f2a447 RNN VAD: pitch search optimizations (part 3)
`ComputeSlidingFrameSquareEnergies()` which computes the energy of a
sliding 20 ms frame in the pitch buffer has been switched from backward
to forward.

The benchmark has shown a slight improvement (about +6x).

This change is not bit exact but all the tolerance tests still pass
except for one single case in `RnnVadTest,PitchSearchWithinTolerance`
for which the tolerance has been slightly increased. Note that the pitch
estimation is still bit-exact.

Benchmarked as follows:
```
out/release/modules_unittests \
  --gtest_filter=*RnnVadTest.DISABLED_RnnVadPerformance* \
  --gtest_also_run_disabled_tests --logs
```

Results:

      | baseline             | this CL
------+----------------------+------------------------
run 1 | 22.8319 +/- 1.46554  | 22.087 +/- 0.552932
      | 389.367x             | 402.499x
------+----------------------+------------------------
run 2 | 22.4286 +/- 0.726449 | 22.216 +/- 0.916222
      | 396.369x             | 400.162x
------+----------------------+------------------------
run 2 | 22.5688 +/- 0.831341 | 22.4902 +/- 1.04881
      | 393.906x             | 395.283x

Bug: webrtc:10480
Change-Id: I1fd54077a32e25e46196c8e18f003cd0ffd503e1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191703
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32572}
2020-11-10 10:18:58 +00:00
Alessio Bazzica
2f7d1c62e2 RNN VAD: pitch search optimizations (part 2)
This CL brings a large improvement to the VAD by precomputing the
energy for the sliding frame `y` in the pitch buffer instead of
computing them twice in two different places. The realtime factor
has improved by about +16x.

There is room for additional improvement (TODOs added), but that will
be done in a follow up CL since the change won't be bit-exact and
careful testing is needed.

Benchmarked as follows:
```
out/release/modules_unittests \
  --gtest_filter=*RnnVadTest.DISABLED_RnnVadPerformance* \
  --gtest_also_run_disabled_tests --logs
```

Results:

      | baseline             | this CL
------+----------------------+------------------------
run 1 | 23.568 +/- 0.990788  | 22.8319 +/- 1.46554
      | 377.207x             | 389.367x
------+----------------------+------------------------
run 2 | 23.3714 +/- 0.857523 | 22.4286 +/- 0.726449
      | 380.379x             | 396.369x
------+----------------------+------------------------
run 2 | 23.709 +/- 1.04477   | 22.5688 +/- 0.831341
      | 374.963x             | 393.906x

Bug: webrtc:10480
Change-Id: I599a4dda2bde16dc6c2f42cf89e96afbd4630311
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191484
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32571}
2020-11-10 00:18:46 +00:00
Alessio Bazzica
9da3e177fd RNN VAD: pitch search optimizations (part 1)
TL;DR this CL improves efficiency and includes several code
readability improvements mainly triggered by the comments to
patch set #10.

Highlights:
- Split `FindBestPitchPeriods()` into 12 and 24 kHz versions
  to hard-code the input size and simplify the 24 kHz version
- Loop in `ComputePitchPeriod48kHz()` (new name for
  `RefinePitchPeriod48kHz()`) removed since the lags for which
  we need to compute the auto correlation are a few
- `ComputePitchGainThreshold()` was only used in unit tests; it's been
  moved into the anon ns and the test removed

This CL makes `ComputePitchPeriod48kHz()` is about 10% faster (measured
with https://webrtc-review.googlesource.com/c/src/+/191320/4/modules/audio_processing/agc2/rnn_vad/pitch_search_internal_unittest.cc).
The realtime factor has improved by about +14%.

Benchmarked as follows:
```
out/release/modules_unittests \
  --gtest_filter=*RnnVadTest.DISABLED_RnnVadPerformance* \
  --gtest_also_run_disabled_tests --logs
```

Results:

      | baseline             | this CL
------+----------------------+------------------------
run 1 | 24.0231 +/- 0.591016 | 23.568 +/- 0.990788
      | 370.06x              | 377.207x
------+----------------------+------------------------
run 2 | 24.0485 +/- 0.957498 | 23.3714 +/- 0.857523
      | 369.67x              | 380.379x
------+----------------------+------------------------
run 2 | 25.4091 +/- 2.6123   | 23.709 +/- 1.04477
      | 349.875x             | 374.963x

Bug: webrtc:10480
Change-Id: I9a3e9164b2442114b928de506c92a547c273882f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191320
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32568}
2020-11-09 16:12:10 +00:00
Karl Wiberg
c95b939667 Introduce RTC_CHECK_NOTREACHED(), an always-checking RTC_NOTREACHED()
And use it in a few places that were using RTC_CHECK(false) or FATAL()
to do the exact same job. There should be no change in behavior.

Bug: none
Change-Id: I36d5e6bcf35fd41534e08a8c879fa0811b4f1967
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191963
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32567}
2020-11-09 10:47:55 +00:00
Alessio Bazzica
0b10f4605e APM RuntimeSetting: record bool histogram when enqueuing a setting fails
Adding a stat to keep track of how frequently APM runtime settings
cannot be successfully enqueued.

Defined in
https://chromium-review.googlesource.com/c/chromium/src/+/2495180.

Bug: webrtc:9138
Change-Id: I33a9105e6fe513a9d0cbb8917a5d576fe47eaa94
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190144
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32546}
2020-11-04 09:42:59 +00:00
Gustaf Ullberg
7e4ad828d6 Increased high frequency transparency
Avoid excessive echo suppression in frequencies above 2 kHz when
there is a dominant nearend. Calls with clock drift will not be affected
by this change as they tend to have less accurate linear filters.

Bug: webrtc:11985
Change-Id: Iddc628da5e2ba572c1b47acd87dd3be35260dca1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/188580
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32533}
2020-11-02 10:42:10 +00:00
Mirko Bonadei
8cc6695652 Reformat python files checked by pylint (part 1/2).
After recently changing .pylintrc (see [1]) we discovered that
the presubmit check always checks all the python files when just
one python file gets updated.

This CL moves all these files one step closer to what the linter
wants.

Autogenerated with:

# Added all the files under pylint control to ~/Desktop/to-reformat
cat ~/Desktop/to-reformat | xargs sed -i '1i\\'
git cl format --python --full

This is part 1 out of 2. The second part will fix function names and
will not be automated.

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

No-Presubmit: True
Bug: webrtc:12114
Change-Id: Idfec4d759f209a2090440d0af2413a1ddc01b841
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190980
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32530}
2020-10-30 10:13:11 +00:00
Alessio Bazzica
f622ba725e AGC2 RNN VAD size_t -> int
Motivation: read "On Unsigned Integers" section in
https://google.github.io/styleguide/cppguide.html#Integer_Types

Plus, improved readability by getting rid of a bunch of
`static_cast<int>`s.

Bug: webrtc:10480
Change-Id: I911aa8cd08f5ccde4ee6f23534240d1faa84cdea
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/190880
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32524}
2020-10-29 21:15:50 +00:00
Alessio Bazzica
842b675304 RNN VAD: Pitch periods as integers and for-if-break optimization
This CL includes two changes:
1. the type for (inverted) lags and pitch periods changed from
   size_t to int to reduce the chance of bugs with pitch period
   manipulations
2. CheckLowerPitchPeriodsAndComputePitchGain() is optimized by
   replacing an unnecessary if statement inside the loop with the
   predetermined number of loops

Bug: webrtc:10480
Change-Id: I38432699254b37a2c0111279c28be8dc65b87e9b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/139252
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Fredrik Hernqvist <fhernqvist@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32521}
2020-10-29 19:45:17 +00:00
Fabien Vallée
f8b5bfeaf2 Fix "control reaches end of non-void function" warnings
"warning: control reaches end of non-void function [-Wreturn-type]"
Reported by gcc (8.3)

In all the reported cases, the end of function is never actually
reached. Add RTC_CHECK(false) to ensure the compiler is aware that
this path is a dead-end.

Bug: webrtc:12008
Change-Id: I7f816fde3d1897ed2774057c7e05da66e1895e60
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/189784
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Fabien VALLÉE <fabien.vallee@netgem.com>
Cr-Commit-Position: refs/heads/master@{#32503}
2020-10-27 10:22:23 +00:00
Alessio Bazzica
0fb0eb3e80 RNN VAD: LP residual optimized (part 4)
This CL removes the circular shift to compute the convolution in
`ComputeLpResidual()`, which is now 4x faster (benchmarked with the
`RnnVadTest.DISABLED_ComputeLpResidualBenchmark` unit test).

Note that the `RnnVadTest.LpResidualPipelineBitExactness` unit test
is still passing.

Bug: webrtc:10480
Change-Id: Ia7767d9b57378c12c8ff31f58fea03905be5c5de
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/189964
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32491}
2020-10-26 12:04:46 +00:00
Alessio Bazzica
1925402ed8 RNN VAD: LP residual optimized (part 3)
Use hard-coded constants previously computed at runtime within a loop in
`DenoiseAutoCorrelation`.

Note that the `RnnVadTest.LpResidualPipelineBitExactness` unit test
is still passing.

Bug: webrtc:10480
Change-Id: I02c2fff7dc7153ea2ab8a27cad8a479a0f029996
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/189963
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32489}
2020-10-26 10:46:16 +00:00
Alessio Bazzica
024d0157ab RNN VAD: LP residual optimized (part 2)
The cross-correlation function in the anonimous namespace of
lp_residual.cc is used once as to compute auto-correlation coefficients.
Hence, it can be simplified (and renamed).

Note that the `RnnVadTest.LpResidualPipelineBitExactness` unit test
is still passing.

Bug: webrtc:10480
Change-Id: Ie769e42907c15572172a8ad1a34e82ce60c4a386
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/189962
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32464}
2020-10-21 15:20:29 +00:00
Alessio Bazzica
5d13d61193 RNN VAD: LP residual optimized (part 1)
Use hard-coded constants previously computed at runtime within a loop in
`ComputeAndPostProcessLpcCoefficients`.

Note that the `RnnVadTest.LpResidualPipelineBitExactness` unit test
is still passing.

Bug: webrtc:10480
Change-Id: Iaec178c56937449c3fe9af881354d19cc8c47c7d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/189961
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32462}
2020-10-21 12:58:05 +00:00
Gustaf Ullberg
7481ba01d1 AEC3: Prevent transparent mode from leaking low volume echo
This change makes the transparent mode classifier consider filter
convergence also for microphone signals with very low volume. This is
in order to prevent entering transparent mode when there is low, but
audible, echo.

Furthermore, the suppression gain during transparent mode is restored
to avoid leaks when the echo is too low to be reliably detected by
filter convergence.

Bug: webrtc:10232, chromium:1140452
Change-Id: Idd4f40c4aee7c20baa444afaa5ec604eb65bcfd0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/189786
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32461}
2020-10-21 11:19:55 +00:00
Sam Zackrisson
7bc3356fbc AEC3: Stop reporting obsolete metrics
These metrics are no longer in use:
WebRTC.Audio.EchoCanceller.ActiveRender
WebRTC.Audio.EchoCanceller.ErleBand*
WebRTC.Audio.EchoCanceller.ErlBand*

Corresponding CL to mark obsolete in histograms.xml:
https://chromium-review.googlesource.com/c/chromium/src/+/2485059

Bug: chromium:1140067,chromium:1140071,chromium:1140073
Change-Id: Icb79b540f340a596c178f352363b30dc7b885251
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/189783
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32449}
2020-10-20 11:54:48 +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
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
Sam Zackrisson
fa2927970e AEC3: Re-add delay headroom when precise alignment is needed
This CL adds delay headroom when an external delay estimator is used.

Tested: audioproc_f --aec=1 is bitexact on a large number of aecdumps

Bug: b/158455753
Change-Id: I56de44e841bb8162e302181c6c386ad7fbb00dee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186703
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32323}
2020-10-06 07:54:08 +00:00
Alessio Bazzica
eacbd972ab AGC2 logs
- Now every 10s
- Also logging estimated speech+noise level
- Also logging via RTC_LOG

Bug: webrtc:7494
Change-Id: Ib60a74d319d29c8f6ae4ea6dae8f2bca687c4c25
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186780
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32316}
2020-10-05 15:34:52 +00:00
Per Åhgren
f9f53316f5 Reland "Reduce the amount of howling reduction in AEC3"
This is a reland of 2978abb88c

Original change's description:
> Reduce the amount of howling reduction in AEC3
>
> This CL backs off the howling protection functionality in AEC3.
> The effect is increased transparency in some cases. No negative effects
> have been identified in the hands-on testing.
>
>
> A kill-switch is added that can be used to turn off the functionality.
>
> Bug: b/150764764
> Change-Id: I604c569c76f911799556a60bc8fd2fb43bbfe196
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186082
> Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32258}

Bug: b/150764764,chromium:1134939
Change-Id: I5eea60b35e6d09003ec2fee3865513df8bdd5823
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186260
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32304}
2020-10-03 23:28:33 +00:00
Per Åhgren
a43178c871 Reland "Activating AVX2 support by default"
This is a reland of ad148272b8

Original change's description:
> Activating AVX2 support by default
>
> This CL activates the newly added AVX2 support by default.
> The activation is done beneath a kill-switch.
>
> Beyond the above, the CL also changes an incorrect DCHECK_GT
> to a DCHECK_GE.
>
> Bug: webrtc:11663
> Change-Id: I231ccb2f5efabf74cd8190411daa954b2b94a2a0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183042
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32193}

Bug: webrtc:11663, chromium:1134234
Change-Id: I0cb34cf08d4d14bc3aee055254493c9c9ee8faa0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186401
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32303}
2020-10-03 22:37:13 +00:00
Sam Zackrisson
389bf0feb8 AEC3: Move option for reverb model in nonlinaer mode into AEC3 config
This adds a config parameter for reverb modelling in nonlinear mode.
The killswitch is preserved, and will have the same effect before and after this CL.

Tested: Bitexact on a large number of aecdumps both with and without WebRTC-Aec3NonlinearModeReverbKillSwitch.
Bug: webrtc:8671
Change-Id: I7b2fa92307af5316dbe895392367abb8d15f06bf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183541
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32298}
2020-10-02 20:27:47 +00:00
Alessio Bazzica
ab4a49259c GainController2::ToString updated
New params have recently been added, but ToString() was not updated.

Bug: webrtc:7494
Change-Id: I2115ccb08d29e860a658284d096e48da17daaedd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186267
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32283}
2020-10-01 17:31:00 +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
Andrey Logvin
dba4db5668 Revert "Reland "Reduce the amount of howling reduction in AEC3""
This reverts commit 18515e2793.

Reason for revert: Continuation of previous revert https://webrtc-review.googlesource.com/c/src/+/186304

Original change's description:
> Reland "Reduce the amount of howling reduction in AEC3"
>
> This is a reland of 2978abb88c
>
> Original change's description:
> > Reduce the amount of howling reduction in AEC3
> >
> > This CL backs off the howling protection functionality in AEC3.
> > The effect is increased transparency in some cases. No negative effects
> > have been identified in the hands-on testing.
> >
> >
> > A kill-switch is added that can be used to turn off the functionality.
> >
> > Bug: b/150764764
> > Change-Id: I604c569c76f911799556a60bc8fd2fb43bbfe196
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186082
> > Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> > Commit-Queue: Per Åhgren <peah@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#32258}
>
> Bug: b/150764764
> Change-Id: I277f24eb3288ad0307e7463bad9aea6436cfe879
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186263
> Reviewed-by: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32274}

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

Change-Id: I0596855e3bf910878aebcee90e03345d5db1105d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/150764764
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186269
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32276}
2020-10-01 14:48:58 +00:00
Per Åhgren
18515e2793 Reland "Reduce the amount of howling reduction in AEC3"
This is a reland of 2978abb88c

Original change's description:
> Reduce the amount of howling reduction in AEC3
>
> This CL backs off the howling protection functionality in AEC3.
> The effect is increased transparency in some cases. No negative effects
> have been identified in the hands-on testing.
>
>
> A kill-switch is added that can be used to turn off the functionality.
>
> Bug: b/150764764
> Change-Id: I604c569c76f911799556a60bc8fd2fb43bbfe196
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186082
> Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32258}

Bug: b/150764764
Change-Id: I277f24eb3288ad0307e7463bad9aea6436cfe879
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186263
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32274}
2020-10-01 13:44:23 +00:00
Andrey Logvin
082fac73be Revert "Reland "Activating AVX2 support by default""
This reverts commit a0ad0bbf8f.

Reason for revert: Speculative revert. I suspect it breaks downstream project

Original change's description:
> Reland "Activating AVX2 support by default"
>
> This is a reland of ad148272b8
>
> Original change's description:
> > Activating AVX2 support by default
> >
> > This CL activates the newly added AVX2 support by default.
> > The activation is done beneath a kill-switch.
> >
> > Beyond the above, the CL also changes an incorrect DCHECK_GT
> > to a DCHECK_GE.
> >
> > Bug: webrtc:11663
> > Change-Id: I231ccb2f5efabf74cd8190411daa954b2b94a2a0
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183042
> > Commit-Queue: Per Åhgren <peah@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#32193}
>
> Bug: webrtc:11663
> Change-Id: Ib41dc1d1c5865f2828699c462939d15d5562df47
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186262
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32270}

TBR=mbonadei@webrtc.org,saza@webrtc.org,peah@webrtc.org,kwiberg@webrtc.org

Change-Id: I1305fad8d19ba0bd69a38b9e2959af54f900535d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:11663
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186304
Reviewed-by: Andrey Logvin <landrey@webrtc.org>
Commit-Queue: Andrey Logvin <landrey@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32273}
2020-10-01 13:39:07 +00:00
Per Åhgren
a0ad0bbf8f Reland "Activating AVX2 support by default"
This is a reland of ad148272b8

Original change's description:
> Activating AVX2 support by default
>
> This CL activates the newly added AVX2 support by default.
> The activation is done beneath a kill-switch.
>
> Beyond the above, the CL also changes an incorrect DCHECK_GT
> to a DCHECK_GE.
>
> Bug: webrtc:11663
> Change-Id: I231ccb2f5efabf74cd8190411daa954b2b94a2a0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183042
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32193}

Bug: webrtc:11663
Change-Id: Ib41dc1d1c5865f2828699c462939d15d5562df47
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186262
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32270}
2020-10-01 12:19:19 +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
Alessio Bazzica
87b86acde9 AGC2: gain increase allowed once enough adjacent speech frames observed
Make the digital adaptive gain applier more robust to VAD false
positives. Achieved by allowing a gain increase only if enough adjacent
speech frames are observed.

Tested:
- Bit-exactness verified with audioproc_f
- If `kDefaultDigitalGainApplierAdjacentSpeechFramesThreshold` == 2
  then not bit-exact

Bug: webrtc:7494
Change-Id: I3bab5a449aaf0ef1a64b671b413ba2ddb4688cd2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186042
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32263}
2020-09-30 22:04:33 +00:00
Mirko Bonadei
aa3d3b4793 Revert "Reduce the amount of howling reduction in AEC3"
This reverts commit 2978abb88c.

Reason for revert: Breaks ApmTest.Process.

After trying to enable AVX2, we increased the amount of error
we tolerate (kFloatNear) and this CL introduced a regression which
makes the test fail after we reverted the enabling of AVX2 (restoring
the old tolerance).

With this CL:
../../modules/audio_processing/audio_processing_unittest.cc:1779: Failure
The difference between test->rms_dbfs_average() and rms_dbfs_average is 0.00142669677734375, which exceeds kFloatNear, where
test->rms_dbfs_average() evaluates to 52.907142639160156,
rms_dbfs_average evaluates to 52.905715942382812, and
kFloatNear evaluates to 0.00050000000000000001.

[  FAILED  ] ApmTest.Process (5347 ms)
[----------] 1 test from ApmTest (5348 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (5350 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] ApmTest.Process

After reverting it:

[       OK ] ApmTest.Process (5345 ms)
[----------] 1 test from ApmTest (5347 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (5350 ms total)
[  PASSED  ] 1 test.

Original change's description:
> Reduce the amount of howling reduction in AEC3
>
> This CL backs off the howling protection functionality in AEC3.
> The effect is increased transparency in some cases. No negative effects
> have been identified in the hands-on testing.
>
>
> A kill-switch is added that can be used to turn off the functionality.
>
> Bug: b/150764764
> Change-Id: I604c569c76f911799556a60bc8fd2fb43bbfe196
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186082
> Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32258}

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

Change-Id: I4723c5cd66e3046851089157ec586afab55c5ce8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/150764764
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186122
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32261}
2020-09-30 19:00:37 +00:00
Per Åhgren
80907be915 Revert "Activating AVX2 support by default"
This reverts commit ad148272b8.

Reason for revert: Speculative revert to investigate test failures

Original change's description:
> Activating AVX2 support by default
>
> This CL activates the newly added AVX2 support by default.
> The activation is done beneath a kill-switch.
>
> Beyond the above, the CL also changes an incorrect DCHECK_GT
> to a DCHECK_GE.
>
> Bug: webrtc:11663
> Change-Id: I231ccb2f5efabf74cd8190411daa954b2b94a2a0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183042
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32193}

TBR=mbonadei@webrtc.org,saza@webrtc.org,peah@webrtc.org,kwiberg@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:11663
Change-Id: Ibb019e8c702dce45ebf47f1c1e8db19069b4964d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186081
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32259}
2020-09-30 15:30:04 +00:00
Per Åhgren
2978abb88c Reduce the amount of howling reduction in AEC3
This CL backs off the howling protection functionality in AEC3.
The effect is increased transparency in some cases. No negative effects
have been identified in the hands-on testing.


A kill-switch is added that can be used to turn off the functionality.

Bug: b/150764764
Change-Id: I604c569c76f911799556a60bc8fd2fb43bbfe196
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186082
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32258}
2020-09-30 15:21:34 +00:00
Gustaf Ullberg
d324a79a85 Remove unused enums and members
Bug: webrtc:8671
Change-Id: Id0d7042a824c20d0f8a9b7a01c3a0274ef04cdf0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185815
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32256}
2020-09-30 14:34:44 +00:00
Alessio Bazzica
57ad54332b AGC2 Saturation Protector always on
Tested: bit-exactness verified with audioproc_f

Bug: webrtc:7494
Change-Id: I9f6c22c097b15c83a68e9fbc256abd161626df93
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185816
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32255}
2020-09-30 14:04:54 +00:00
Alessio Bazzica
d5e6f413ab AGC2 AdaptiveDigitalGainApplier and AdaptiveAgc code improvements
This CL was written in preparation for the next CL in the chain and
it contains the following changes:
- SignalWithLevels -> AdaptiveDigitalGainApplier::FrameInfo
- Frame view removed from AdaptiveDigitalGainApplier::FrameInfo
- AdaptiveDigitalGainApplier::Process now gets side info as const& to
  avoid unnecessary copies
- AdaptiveAgc::Process: `last_audio_level` renamed to `limiter_envelope`
  to better reflect what that actually is
- Missing class/method docstrings added

Tested: bit-exactness verified with audioproc_f

Bug: webrtc:7494
Change-Id: Ie25dcd389d6eed74ea9a65f0720eeb8f20f0096b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186040
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32251}
2020-09-30 13:15:38 +00:00
Alessio Bazzica
8845f7e32b AGC2 AdaptiveModeLevelEstimator min consecutive speech frames (3/3)
This is the last CL needed to add a new `AdaptiveModeLevelEstimator`
feature that makes AGC2 more robus to VAD mistakes: the level estimator
discards estimation updates when too few consecutive speech frames are
observed.

This CL adds a second state property to hold temporary updates and a
counter for consecutive speech frames. When enough speech frames are
observed, the reliable state is updated; otherwise, the temporary state
is discarded.

The default for `AdaptiveModeLevelEstimator::min_consecutive_speech_frames_`
is 1, which means that the new feature is disabled.

Tested:
- Bit-exactness verified with audioproc_f
- Not bit-exact if `min_consecutive_speech_frames_` set to 10

Bug: webrtc:7494
No-Try: True
Change-Id: I0daa00e90c27c418c00baec39fb8eacd26eed858
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185125
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32250}
2020-09-30 13:08:08 +00:00
Alessio Bazzica
9cf3ea0ab2 AGC2 AdaptiveModeLevelEstimator: minor code improvements
- State -> LevelEstimatorState
- Mark two methods as const
- Call DumpDebugData() in one place
- DumpDebugData: don't check if data dumper is provided
- Add LevelEstimatorState::operator==

The changes will reduce clutter in follow up CL.

Note: this CL breaks the chain of 3 CLs titled
"AGC2 AdaptiveModeLevelEstimator min consecutive speech frames".

Bug: webrtc:7494
Change-Id: If39ce4b787069bef4af910d718cdfae3af1784a4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185811
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32247}
2020-09-30 10:31:30 +00:00
Alessio Bazzica
307fab9e02 AGC2 AdaptiveModeLevelEstimator: cache last level estimate
`AdaptiveModeLevelEstimator::last_level_dbfs_` doesn't need to be optional.

Note: this CL breaks the chain of 3 CLs titled
"AGC2 AdaptiveModeLevelEstimator min consecutive speech frames".

Bug: webrtc:7494
Change-Id: Id5b409ca5cb5f11ed132c861b7995b9721e167bb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185809
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32237}
2020-09-29 15:45:22 +00:00
Alessio Bazzica
435f279433 AGC2 remove incorrect field trial parsing functions
The AGC2 params must be exposed via
`AudioProcessing::Config::GainController2` and the Finch params must
be parsed in blink (see [1]).

Note: this CL breaks the chain of 3 CLs titled
"AGC2 AdaptiveModeLevelEstimator min consecutive speech frames".

[1] https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.cc;l=593-596?q=HybridAgc&start=11

Bug: webrtc:7494
Change-Id: Ie7bd1bef1d6caf7d2b20600a1626c12171b67c82
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185044
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32230}
2020-09-29 13:33:15 +00:00
Alessio Bazzica
56f63c3e7e AGC2 AdaptiveModeLevelEstimator min consecutive speech frames (2/3)
This is the second CL needed to add a new `AdaptiveModeLevelEstimator`
feature that makes AGC2 more robus to VAD mistakes: the level estimator
discards estimation updates when too few consecutive speech frames are
observed.

In this CL, the `SaturationProtector` class has been replaced by a
struct that define the state and two functions to change it.
This is done in order to use the saturation protector state in
`AdaptiveModeLevelEstimator::State` and will allow to add a
temporary state in `AdaptiveModeLevelEstimator` (see the child CL).

Tested: Bit-exactness verified with audioproc_f

Bug: webrtc:7494
Change-Id: Ic5ecd1e174010656ed20664ef7b7e5798ebb7978
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185041
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32226}
2020-09-29 11:02:10 +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
Gustaf Ullberg
46be80d349 Remove echo suppression in transparent mode
This change completely disables the use of suppression
when operating in transparent mode.

It also removes the following field trials:
* WebRTC-Aec3UseLowEarlyReflectionsTransparentModeGain
* WebRTC-Aec3UseLowLateReflectionsTransparentModeGain

Bug: webrtc:11985
Change-Id: I1c75efdad2d9c9d0a1aced86bf0278fc96616ea1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185402
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32223}
2020-09-29 09:35:09 +00:00
Per Åhgren
e5d669ed28 Reland "Activating AVX2 support by default"
This is a reland of ad148272b8

Original change's description:
> Activating AVX2 support by default
>
> This CL activates the newly added AVX2 support by default.
> The activation is done beneath a kill-switch.
>
> Beyond the above, the CL also changes an incorrect DCHECK_GT
> to a DCHECK_GE.
>
> Bug: webrtc:11663
> Change-Id: I231ccb2f5efabf74cd8190411daa954b2b94a2a0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183042
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32193}

Bug: webrtc:11663
Change-Id: I669435c2f4e451ee0766d809443484f2dde09d8d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185482
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32200}
2020-09-25 14:46:20 +00:00
Alessio Bazzica
cd92b0be9a AGC2 AdaptiveModeLevelEstimator min consecutive speech frames (1/3)
This is the first CL needed to add a new `AdaptiveModeLevelEstimator`
feature that makes AGC2 more robus to VAD mistakes: the level estimator
discards estimation updates when too few consecutive speech frames are
observed.

In this CL, the state of the estimator is defined in a separate struct
so that in a follow-up CL a new member of that type can be added to
hold a temporary state (that can be either confirmed or discarded).

Tested: Bit-exactness verified with audioproc_f

Bug: webrtc:7494
Change-Id: Ic2ea5ed63c493b9f3a79f19e7f5eaecaa6808ace
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184931
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32199}
2020-09-25 14:04:57 +00:00
Alessio Bazzica
c1ece012cb AGC2 VAD probability: instant decay / slow attack
Feature added to gain robustness to occasional VAD speech probability
spikes. In such a case, the attack process reduces the chance that the
smoothed values are greater than the speech threshold.

Bug: webrtc:7494
Change-Id: I6babe5afe30ea3dea021181a19d86bb74b33a98c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185046
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32198}
2020-09-25 14:03:17 +00:00
Per Åhgren
9ccbe17abb Revert "Activating AVX2 support by default"
This reverts commit ad148272b8.

Reason for revert: Causing test failures downstream.

Original change's description:
> Activating AVX2 support by default
>
> This CL activates the newly added AVX2 support by default.
> The activation is done beneath a kill-switch.
>
> Beyond the above, the CL also changes an incorrect DCHECK_GT
> to a DCHECK_GE.
>
> Bug: webrtc:11663
> Change-Id: I231ccb2f5efabf74cd8190411daa954b2b94a2a0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183042
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32193}

TBR=mbonadei@webrtc.org,saza@webrtc.org,peah@webrtc.org,kwiberg@webrtc.org

Change-Id: If2287a0a4b37931ce5f85baae093a66b19d0a78b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:11663
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185481
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32196}
2020-09-25 12:13:46 +00:00
Alessio Bazzica
530781d03f AGC2 VadWithLevel(::LevelAndProbability) renamed + injectable VAD
Refactoring CL to improve names and allow to inject a VAD into
`VadLevelAnalyzer` (new name for `VadWithLevel`).

The injectable VAD is needed to inject a mock VAD and write better
unit tests as new features are going to be added to the class.

Bug: webrtc:7494
Change-Id: Ic0cea1e86a19a82533bd40fa04c061be3c44f068
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185180
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32195}
2020-09-25 12:11:12 +00:00
Per Åhgren
ad148272b8 Activating AVX2 support by default
This CL activates the newly added AVX2 support by default.
The activation is done beneath a kill-switch.

Beyond the above, the CL also changes an incorrect DCHECK_GT
to a DCHECK_GE.

Bug: webrtc:11663
Change-Id: I231ccb2f5efabf74cd8190411daa954b2b94a2a0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183042
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32193}
2020-09-25 11:30:22 +00:00
Gustaf Ullberg
39a3f081c1 Disable transparent mode when ERL is bounded
A bounded ERL disables all TransparentMode implementations.

Bug: webrtc:10232
Change-Id: I5a3641b356c2abf42cd6d055cee4007327528a41
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185301
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32187}
2020-09-24 20:53:09 +00:00
Alessio Bazzica
9e81182f8e RNN VAD build file refactoring: split into separate (private) targets
First step to only expose the relevant RNN VAD API to AGC2.

Bug: webrtc:7494
Change-Id: I7f11f6eebded124c30cabd64963c8e3ccc35e58f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185124
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32185}
2020-09-24 14:33:14 +00:00
Gustaf Ullberg
afef7a74a7 HMM based transparent mode classifier
This change introduces a new Hidden Markov Model based classifier for
AEC3's 'transparent mode'. Transparent mode is used with
headsets/headphones where the speaker signal does not leak into the
microphone signal.

The current classifier suffers from two problems:
1. It sometimes takes a long time to enter transparent mode.
2. Sometimes transparent mode is left (and it once again takes a long
time to re-enter).

Both problems have a severe effect on AEC transparency.

The new classifier enters transparent mode quicker and is less likely
to exit transparent mode when there is no echo. This improves the
audio experience when using headset/headphones.

Another (minor) benefit of this change is that when transparent mode
is disabled no classifier is run (or even created) saving some memory
and CPU cycles.

Bug: webrtc:10232
Change-Id: I509af0e22b59463aeaead53c78c35be1e97fe8c3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184500
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32182}
2020-09-24 08:25:50 +00:00
Alessio Bazzica
1922fb0ec3 AGC2 saturation protector: extra margin added by level estimator
In preparation for a coming refactoring CL, the (fixed) extra saturation
margin is now applied into `AdaptiveModeLevelEstimator`.

This CL also improves the unit tests by hard-coding its saturation
params instead of reading them from a field trial.
This reduces the chances of making the test flaky if a default value
changes.

Tested: Bit-exactness verified with audioproc_f

Bug: webrtc:7494
Change-Id: I6765def9887a2f4e55b04d929af754cfecbb1626
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184927
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32172}
2020-09-23 11:33:37 +00:00
Alessio Bazzica
736ff83e69 AGC2 saturation protector: simplify interface and impl
- Passing the speech peak power instead of VAD data
- The private class SaturationProtector::PeakEnveloper has been removed
- Added `initial_saturation_margin_db_` parameter to correctly
  initialize `last_margin_` (renamed to `margin_db_`)
- Member names have been fixed and/or shortened for better readability

Tested: Bit-exactness verified with audioproc_f

Bug: webrtc:7494
Change-Id: I6cad2974397319737c8ac201d44311bf16275f28
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184925
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32168}
2020-09-23 07:56:44 +00:00
Alessio Bazzica
10f6eadd48 AGC2 Saturation Protector: switch to ring buffer
Even if small, the peak delay buffer copies N-1 elements for each frame
whereas a ring buffer is copy-free and scales better if the buffer size
increases.

Tested: Bit-exactness verified with audioproc_f

Bug: webrtc:7494
Change-Id: If8c33877b7ab1d881a0606e222b26857a82fff69
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184920
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32165}
2020-09-22 19:34:04 +00:00
Per Åhgren
2f0f93a0c9 Add explicit initialization for the FilterAnalyzer in AEC3
This CL adds explicit initialization of the FilterAnalyzer in AEC3.
While the current code never uses any fields before they are initialized,
it makes sense to be on the safe side and add initialization during
construction.

Bug: webrtc:11918
Change-Id: I467c4c8b8d6dd859a1b216baef28ac1e9d3f76c2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183764
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32069}
2020-09-10 10:50:43 +00:00
Mirko Bonadei
bef022bde0 Refactor cpu_features_wrapper.h functions from C to C++.
As mentioned on https://webrtc-review.googlesource.com/c/src/+/183380,
then relanded as https://webrtc-review.googlesource.com/c/src/+/183444,
functions in cpu_features_wrapper.h should be refactored to use
C++ features like namespaces and drop the WebRtc_ prefix.

Bug: None
Change-Id: I3e83e1668f9bf48a5d8e85d809f006666b7fa45e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183445
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32045}
2020-09-07 08:44:24 +00:00
Mirko Bonadei
66e7338617 Reland "Merge cpu_features build targets into //system_wrappers."
This is a reland of 2b242d8fba

Original change's description:
> Merge cpu_features build targets into //system_wrappers.
>
> Before this CL, functions declared in cpu_features_wrapper.h where
> not defined in the same build target, causing brittle builds that
> might fail at link time if the binary was not depending on
> //system_wrappers (the target with the definitions), violating [1].
>
> This CL moves everything into //system_wrappers and also moves
> cpu_features_wrapper.h definitions from C to C++ (in order to be able
> to add the definitions to a C++ build target like //system_wrappers).
>
> [1] - https://webrtc.googlesource.com/src/+/refs/heads/master/style-guide.md#h-cc-pairs
>
> Bug: None
> Change-Id: I5a0009cddb17206b19f2a71eeba722faacc4bcae
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183380
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32039}

TBR=kwiberg@webrtc.org

Bug: None
Change-Id: I1695b9a34d3ec20c50c1202a745f64fac58edef0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183444
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32042}
2020-09-06 10:38:23 +00:00
Mirko Bonadei
d156a0d061 Revert "Merge cpu_features build targets into //system_wrappers."
This reverts commit 2b242d8fba.

Reason for revert: Breaks downstream project.

Original change's description:
> Merge cpu_features build targets into //system_wrappers.
> 
> Before this CL, functions declared in cpu_features_wrapper.h where
> not defined in the same build target, causing brittle builds that
> might fail at link time if the binary was not depending on
> //system_wrappers (the target with the definitions), violating [1].
> 
> This CL moves everything into //system_wrappers and also moves
> cpu_features_wrapper.h definitions from C to C++ (in order to be able
> to add the definitions to a C++ build target like //system_wrappers).
> 
> [1] - https://webrtc.googlesource.com/src/+/refs/heads/master/style-guide.md#h-cc-pairs
> 
> Bug: None
> Change-Id: I5a0009cddb17206b19f2a71eeba722faacc4bcae
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183380
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32039}

TBR=mbonadei@webrtc.org,kwiberg@webrtc.org

Change-Id: I4daa7582e55a0343eef72f08ed023c73e0b6456b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: None
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183443
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32040}
2020-09-05 21:18:40 +00:00
Mirko Bonadei
2b242d8fba Merge cpu_features build targets into //system_wrappers.
Before this CL, functions declared in cpu_features_wrapper.h where
not defined in the same build target, causing brittle builds that
might fail at link time if the binary was not depending on
//system_wrappers (the target with the definitions), violating [1].

This CL moves everything into //system_wrappers and also moves
cpu_features_wrapper.h definitions from C to C++ (in order to be able
to add the definitions to a C++ build target like //system_wrappers).

[1] - https://webrtc.googlesource.com/src/+/refs/heads/master/style-guide.md#h-cc-pairs

Bug: None
Change-Id: I5a0009cddb17206b19f2a71eeba722faacc4bcae
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183380
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32039}
2020-09-05 20:43:27 +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
Zhaoliang Ma
e537e9ca13 aec3: Support AVX2/FMA intrinsics in AEC3
Bug: webrtc:11663
Change-Id: Ib75eb616ef0cb62698b0d96af7ebe42e93825222
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179006
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32023}
2020-09-01 11:58:16 +00:00
Per Åhgren
0796b58a7e Removing call to deprecated SetExtraOptions method
Bug: webrtc:5298
Change-Id: If81d74727bb231f6e61b1647cc7b80ef13107b62
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182121
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31972}
2020-08-20 16:13:12 +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
Sam Zackrisson
ff571c60a9 AEC3: Fix render delay buffer alignment issue at call start
Internal counters in the RenderDelayBuffer can slip out of sync with external counters, leading to buffer misalignment.
This CL gives the RenderDelayBuffer an opportunity to update its counters.

Tested:
Passes: modules_unittests --gtest_filter=BlockProcessor.*
Fails as expected due to new unit test: modules_unittests --gtest_filter=BlockProcessor.* --force_fieldtrials="WebRTC-Aec3RenderBufferCallCounterUpdateKillSwitch/Enabled/"

audioproc_f with default AEC settings has been verified to be bit-exact on a large number of aecdumps.

Bug: webrtc:11803
Change-Id: I9363b834c8c8c934add0335013df60bf131da4bc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180126
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31795}
2020-07-27 15:19:58 +00:00
Markus Handell
3d2210876e Remove unused critical section includes.
Bug: webrtc:11567
Change-Id: Ic5e43c51ce06c0619adc265d12ad4bef73a9df76
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179521
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31745}
2020-07-16 13:52:28 +00:00
Markus Handell
0df0faefd5 Migrate modules/audio_coding, audio_mixer/ and audio_processing/ to webrtc::Mutex.
Bug: webrtc:11567
Change-Id: I03b78bd2e411e9bcca199f85e4457511826cd17e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176745
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31649}
2020-07-07 14:35:58 +00:00
Brian Sheedy
8e144aa33f Remove WebRTC usage of //third_party/pymock
Removes usage of Chromium's //third_party/pymock in favor of the version
provided by vpython. This is so that the third_party version can
eventually be removed.

TBR=aleloi@webrtc.org

Bug: chromium:1094489
Change-Id: I68511e11ed1e517c2b6d3bb832090a3c27e480e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177921
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@google.com>
Cr-Commit-Position: refs/heads/master@{#31568}
2020-06-25 18:01:30 +00:00
Mirko Bonadei
2dcf348011 Use absl_deps in order to preapre to the Abseil component build release.
Bug: webrtc:1046390
Change-Id: Ia35545599de23b1a2c2d8be2d53469af7ac16f1d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176502
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31463}
2020-06-08 12:59:40 +00:00
Per Åhgren
80b301255e Reland "Change to using the new Ooura constructor"
This is a reland of a6c70741e7

Original change's description:
> Change to using the new Ooura constructor
> 
> 
> Bug: b/155316201
> Change-Id: I40000e30df7a495a0937885abea19caeb599e00a
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176378
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31411}

Bug: b/155316201
Change-Id: Iba9748509d66b9ad4b210be83d515db684c5d5e0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176410
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31422}
2020-06-03 12:27:14 +00:00
Stephan Hartmann
3ca2836f70 IWYU: size_t is defined in stddef.h
This required for gcc-10.

Bug: None
Change-Id: Iba3ff0881005cb2ae4574e47284a1b881594de86
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176361
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31417}
2020-06-03 08:43:50 +00:00
Per Åhgren
43ccfecdb7 Remove unused instance of Ooura FFT
Bug: b/155316201
Change-Id: I29a2dcf620091665b6d48820022fac3a3b672c04
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176405
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31414}
2020-06-03 00:33:54 +00:00
Alex Glaznev
955e9039ea Revert "Change to using the new Ooura constructor"
This reverts commit a6c70741e7.

Reason for revert: breaks TAP build

Original change's description:
> Change to using the new Ooura constructor
> 
> 
> Bug: b/155316201
> Change-Id: I40000e30df7a495a0937885abea19caeb599e00a
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176378
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31411}

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

Change-Id: Id8149889fddf96276cc15f37686ef9d1190c5c94
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/155316201
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176420
Reviewed-by: Alex Glaznev <glaznev@webrtc.org>
Commit-Queue: Alex Glaznev <glaznev@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31413}
2020-06-02 22:28:07 +00:00
Per Åhgren
a6c70741e7 Change to using the new Ooura constructor
Bug: b/155316201
Change-Id: I40000e30df7a495a0937885abea19caeb599e00a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176378
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31411}
2020-06-02 14:38:58 +00:00
Tommi
a5e07cc3db Rename more death test to *DeathTest
Bug: webrtc:11577
Change-Id: If45e322fed3f2935e64c9e4d7e8c096eccc53ac4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176140
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31362}
2020-05-26 20:27:34 +00:00
Danil Chapovalov
704fb55255 In common_audio/ and modules/audio_* replace mock macros with unified MOCK_METHOD macro
Bug: webrtc:11564
Change-Id: Ib0ffce4de50a13b018926f6ea2865a2ec2fb2ec7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175621
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31333}
2020-05-20 13:17:31 +00:00
Per Åhgren
e9cd6177eb Add ability for audioproc_f to operate on any AudioProcessing object.
This CL extends the WebRTC testing API to allow audioproc_f -based
testing using a pre-created AudioProcessing object. This is an
important feature to allow testing any AudioProcessing objects
that are injected into WebRTC.

Beyond adding this, the CL also changes the simulation code to
operate on a scoped_refptr<AudioProcessing> object instead of a
std::unique<AudioProcessing> object

Bug: webrtc:5298
Change-Id: I70179f19518fc583ad0101bd59c038478a3cc23d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175568
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31319}
2020-05-19 11:37:18 +00:00
Tommi
909f3a5339 Rename several more tests that use EXPECT_DEATH to *DeathTest.
Bug: webrtc:11577
Change-Id: I0397ee933464496e4885bb0f8030f3d669e5e612
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175641
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31309}
2020-05-18 16:10:04 +00:00
Tommi
da357a9495 Rename EchoPathDelayEstimator to EchoPathDelayEstimatorDeathTest.
...for the NullDataDumper, WrongCaptureBlockSize and
DISABLED_WrongRenderBlockSize tests. This is to avoid creation
of additional threads on Mac, which can cause issues on asan bots.

Bug: webrtc:11577
Change-Id: I4e6a64d47ec3b0a0e0018b19a0486208ba7e6ae2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175600
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31307}
2020-05-18 14:27:14 +00:00
Markus Handell
02ba1d252e AudioProcessingImpl: remove lock recursions.
This change removes lock recursions and adds thread annotations.

Bug: webrtc:11567
Change-Id: Ibefb49bb5b865cb0bb33e4580d34d9837fb41bff
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175121
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Markus Handell <handellm@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31260}
2020-05-14 14:53:58 +00:00
Per Åhgren
09e9a83d91 Change the way that AecDumps are created in APM
This CL changes the way that AecDumps are created in APM. Instead
of being injected, they are now created via the API.

This removes the AecDumpFactory from the API surface of APM and
makes the API more explicit.

The CL will be followed by one more CL that deprecates the usage
of the AttachAecDump API also within the audio_processing
and the fuzzer folders.

The CL also moves the aec_dump.* files from the include folder
to the aec_dump folder and changes the build files. The reasons
for this are that
1) The content of aec_dump.h is not really part of the API
   surface of APM.
2) Those files anyway needed to be moved to a separate build-
   target to avoid a circular build-file dependency caused by
   the other changes in this CL

Bug: webrtc:5298
Change-Id: I7dd6b49de76eb44158472874e1d4ae17dca9be54
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174750
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31207}
2020-05-11 10:33:00 +00:00
Sam Zackrisson
ab866a2ccb Remove audio playout generator from APM API
This API is and has always been unused.

Bug: webrtc:5298
Change-Id: If1201d37a00e387567d44a9ed8be99a157915b47
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174661
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31180}
2020-05-07 12:14:50 +00:00
Ivo Creusen
bb826c9142 Make echo metrics optional
This makes it optional for an echo detector to report metrics through
the getStats interface.

Bug: webrtc:11539
Change-Id: I1fef93b7bf534637b69c16971d38709b3e849a08
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174100
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31146}
2020-04-29 14:29:27 +00:00
Sam Zackrisson
b37e59d198 Add unittests for APM with submodule creation disabled
This introduces a function AudioProcessingImpl::SetCreateOptionalSubmodulesForTesting to simulate the exclusion of build-optional submodules, and tests of the currently only excludable submodule.

Bug: webrtc:11292
Change-Id: If492606205c9fdc669a6dce3a8989a434aeeed1f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173746
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31138}
2020-04-27 11:47:15 +00:00
Per Åhgren
cc73ed3e70 APM: Add build flag to allow building WebRTC without APM
This CL adds a build flag to allow building the non-test parts
of WebRTC without the audio processing module.
The CL also ensures that the WebRTC code correctly handles
the case when no APM is available.

Bug: webrtc:5298
Change-Id: I5c8b5d1f7115e5cce2af4c2b5ff701fa1c54e49e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171509
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31133}
2020-04-26 23:06:44 +00:00
Mirko Bonadei
146137adee Merge OOURA BUILD.gn files.
No-Tree-Checks: True
No-Try: True
Bug: webrtc:11509
Change-Id: If66483a02085396e231986e39ef0dafcdd3f4bed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173740
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31114}
2020-04-21 09:06:37 +00:00
Mirko Bonadei
f0d64a5f9b Reland "Unify OOURA implementations in one directory."
This is a reland of 09b439c6f7

Original change's description:
> Unify OOURA implementations in one directory.
>
> This CL moves the two OOURA implementations present in the WebRTC tree
> in one place.
>
> No functional change is expected.
>
> TBR=kwiberg@webrtc.org
>
> No-Try: True
> Bug: webrtc:11509
> Change-Id: I330a9ec57e3dc65c9c8b43edd4bb295c55920efa
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173682
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31106}

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

No-Tree-Checks: True
No-Try: True
Bug: webrtc:11509
Change-Id: Ifc28b0380062ab5aad5c498700aa3cc7f9c7802c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173720
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31111}
2020-04-20 16:08:19 +00:00
Mirko Bonadei
ed005be788 Revert "Unify OOURA implementations in one directory."
This reverts commit 09b439c6f7.

Reason for revert: Breaks downstream project. Will reland tomorrow.

Original change's description:
> Unify OOURA implementations in one directory.
> 
> This CL moves the two OOURA implementations present in the WebRTC tree
> in one place.
> 
> No functional change is expected.
> 
> TBR=kwiberg@webrtc.org
> 
> No-Try: True
> Bug: webrtc:11509
> Change-Id: I330a9ec57e3dc65c9c8b43edd4bb295c55920efa
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173682
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31106}

TBR=mbonadei@webrtc.org,peah@webrtc.org,kwiberg@webrtc.org

Change-Id: I41acf34aef6497adfa7750223acbcc3725db6feb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:11509
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173706
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31107}
2020-04-19 09:59:52 +00:00
Mirko Bonadei
09b439c6f7 Unify OOURA implementations in one directory.
This CL moves the two OOURA implementations present in the WebRTC tree
in one place.

No functional change is expected.

TBR=kwiberg@webrtc.org

No-Try: True
Bug: webrtc:11509
Change-Id: I330a9ec57e3dc65c9c8b43edd4bb295c55920efa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173682
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31106}
2020-04-18 17:52:53 +00:00
Mirko Bonadei
491ff3d54c Remove AudioProcessing::UpdateHistogramsOnCallEnd.
Bug: webrtc:10198
Change-Id: I3e7a98f9b94c171e7f105883fc755e44b2e991ae
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173464
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31070}
2020-04-14 18:08:52 +00:00
Per Åhgren
fea8b94591 Reland "APM: Remove the usage of AudioFrame in the AudioProcessing interface"
This is a reland of 12e2d4ddb2

Original change's description:
> APM: Remove the usage of AudioFrame in the AudioProcessing interface
> 
> This CL removes the AudioFrame-based APIs from the AudioProcessing
> interface.
> 
> Bug: webrtc:5298
> Change-Id: Iab470b26b10e06dcf29c543851ae0085bc5b66f0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172939
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31016}

Bug: webrtc:5298
Change-Id: I70e6d59afc3716ee6109d8b9dc384abc71c93624
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173476
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31066}
2020-04-14 14:11:06 +00:00
Per Åhgren
8b844f21e1 AEC3: Remove parameters for the legacy filter naming
Bug: webrtc:8671
Change-Id: Ia5f8e33b9646e2b922428a72364cbbca47091579
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173092
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31030}
2020-04-08 07:34:08 +00:00
Artem Titov
7e60483915 Revert "APM: Remove the usage of AudioFrame in the AudioProcessing interface"
This reverts commit 12e2d4ddb2.

Reason for revert: Speculative revert: breaks downstream project

Original change's description:
> APM: Remove the usage of AudioFrame in the AudioProcessing interface
> 
> This CL removes the AudioFrame-based APIs from the AudioProcessing
> interface.
> 
> Bug: webrtc:5298
> Change-Id: Iab470b26b10e06dcf29c543851ae0085bc5b66f0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172939
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31016}

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

Change-Id: I82729b54c74cf1362332a28a96f598d6747b53ff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:5298
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173091
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31022}
2020-04-07 19:37:32 +00:00