Commit graph

76 commits

Author SHA1 Message Date
Per Åhgren
c20a19cc4b Allow extracting the linear AEC output
This CL enables extracting the linear AEC output,
allowing for more straightforward
testing/development.

Bug: b/140823178
Change-Id: I14f7934008d87066b35500466cb6e6d96f811688
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153672
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29789}
2019-11-13 11:33:53 +00:00
Gustaf Ullberg
5ea5749a86 AEC3: Multichannel suppressor
This change adds multichannel support to the AEC3 suppressor.
Processing of mono capture is bit-exact to the previous code.

Bug: webrtc:10913
Change-Id: I89affe3e066021bc34e4b525edf44dd3bea68365
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158882
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29692}
2019-11-05 15:51:39 +00:00
Gustaf Ullberg
caaa9e73d7 AEC3: Handle multichannel audio in single CNG instance
Instead of having a comfort noise generator (CNG) instance per capture
channel, one instance handles CNG for all capture channels.

Bug: webrtc:10913
Change-Id: I897471be6d203ad750c517c5076d421f2ae3879b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158780
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29668}
2019-10-31 14:51:35 +00:00
Per Åhgren
119e2197b7 AEC3: General cleanup after multichannel changes
This CL contains various cleanups/corrections to the multichannel AEC
code.

The changes have been shown to be bitexact over a large dataset.

Bug: webrtc:10913
Change-Id: Idd3e410b04527666e052f57ad81d0ac9eef3179b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157173
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29530}
2019-10-18 07:43:49 +00:00
Sam Zackrisson
98872dc556 AEC3: Update SpectrumBuffer API
- RenderBuffer::Spectrum() loses its channel argument, allowing for
  greater flexibility in passing the multi-channel spectrum data into
  functions.
- The FFT spectra lengths are made compile-time constant, rendering
  some DCHECKs obsolete.

Bug: webrtc:10913
Change-Id: Ied0c50cf72d974cfef7279fd2b9c572d049b8b16
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157104
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29528}
2019-10-18 07:01:42 +00:00
Sam Zackrisson
ffc8452730 AEC3: Add support for logging warnings on delay buffer changes
This reintroduces the WARNING log level of a previous CL [1],
via a default-off config flag.

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

Bug: None
Change-Id: Ica8583cbb24a1611cfc684ae02d5a0f582004024
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156566
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29489}
2019-10-15 12:16:51 +00:00
Per Åhgren
8718afb283 AEC3: Made EchoAudibility multichannel
This CL corrects the EchoAudibility and StationarityEstimator
code to work properly with multiple channels.

It also changes the naming of the FilterDelayBlocks() method
to better reflect what it does.

The changes have been verified to be bitexact over a large number
of recordings.

Bug: webrtc:10913
Change-Id: I070b531efcdff4c33f70fd5b37fbb556dcebe5b4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156565
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29482}
2019-10-15 09:25:46 +00:00
Per Åhgren
f9807259a6 AEC3: Send the spectral power estimates for all channels to AecState
This CL passes the spectral power estimates for all channels into
the AecState.

Bug: webrtc:10913
Change-Id: Ie3b5c443be0c63f205e23ed2bfea06d9c447eb39
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156165
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29417}
2019-10-09 12:51:21 +00:00
Sam Zackrisson
46b0140172 Update filter analyzer for multi channel
Multi-channel behaviors introduced in this CL:

- All filters are analyzed independently. The filtering is considered
consistent if any filter is consistent.

- The filter echo path gain used to detect saturation is maxed across
capture channels.

- The filter delay is taken to be the minimum of all filters:
Any module that looks in the render data starting from the filter
delay will iterate over all render audio present in any channel.

- The FilterAnalyzer will consider a render block to be active if any
render channel has activity.

The changes in the CL has been shown to be bitexact on a
large set of mono recordings.

Bug: webrtc:10913
Change-Id: I1e360cd7136ee82d1f6e0f8a1459806e83f4426d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155363
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29408}
2019-10-08 15:44:43 +00:00
Per Åhgren
b4161d3c0d AEC3: Add multichannel support to the residual echo estimator
This CL adds support for multichannel in the residual echo
estimator code. It also adds placeholder functionality in
the surrounding code to ensure that the residual echo
estimator receives the require inputs.

The changes in the CL has been shown to be bitexact on a
large set of mono recordings.

Bug: webrtc:10913
Change-Id: I726128ca928648b1dcf36c5f479eb243f3ff3f96
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155361
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29400}
2019-10-08 11:18:35 +00:00
Per Åhgren
b441acf656 AEC3: Add support in the echo subtractor for handling multiple channels
This CL adds support in the echo subtractor for handling multiple
capture and render channels.

The changes have passed bitexactness tests for substantial set
of mono recordings.

Bug: webrtc:10913
Change-Id: Ib448c9edf172ebc31e8c28db7b2f2a389a53adb9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155168
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29389}
2019-10-05 07:45:47 +00:00
Sam Zackrisson
8f736c0aeb AEC3: Analyze multi-channel SubtractorOutput in AecState
Updates SubtractorOutputAnalyzer and AecState::SaturationDetector
to multi-channel.

Bug: webrtc:10913
Change-Id: I39edafdc5d5a4db5cc853cf116d60af0f506b3bf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154342
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29355}
2019-10-01 11:36:58 +00:00
Sam Zackrisson
32eae4c231 AEC3: use different seed for different channels in CNG
Bug: webrtc:10913
Change-Id: Idca6be02b54b67753cfaf6ff588f5271e0cce892
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155160
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29344}
2019-09-30 13:04:00 +00:00
Per Åhgren
7bdf073c1c First step of adding multi-channel support to the echo subtractor
This CL contains the first step of adding multi-channel support to the
echo subtractor.

The CL is bitexact for the mono case.

Bug: webrtc:10913
Change-Id: I10647b45c692bc001407afc6ff00e26a3e2cffaa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154356
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29303}
2019-09-25 13:27:56 +00:00
Per Åhgren
0e3b1ff8c4 Moving e to comply to the rest of the stack/heap storage scheme
Bug: webrtc:10913
Change-Id: I7dada71fb86e1c7eea27d0aec01b870fd0a6a15e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154347
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29300}
2019-09-25 11:09:22 +00:00
Gustaf Ullberg
7911d3705c AEC3: Simplify use of SignalTransition
Simplifying the use of signal transition and removing unused code.

Bug: webrtc:8671
Change-Id: I0b845405727936b2fa7df7c92ad2e83bea3bc823
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154348
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29298}
2019-09-25 09:00:24 +00:00
Gustaf Ullberg
af3fdc069d AEC3: Suppression filter handles multiple channels
Suppression filter is extended to support the synthesis
of multiple channels. This CL is also a major clean-up of ApplyGain.

The CL has been tested for bit-exactness for single channel output.

Bug: webrtc:10913
Change-Id: I1319f127981552e17dec66701a248d34dcf0e563
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154341
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29284}
2019-09-24 13:50:04 +00:00
Gustaf Ullberg
a99b89b41c AEC3: Echo remover handles multiple capture signals.
Echo remover processes all microphone signals. Suppression gains are
computed separately for each capture signal. The minimum gains determine
the final suppression gains applied.

Only the first channel is synthesized. A follow-up CL will add the
synthesis of the remaining channels.

Bug: webrtc:10913
Change-Id: Ife7e74c9a9c6c208fca3992e3cfa840b6b7afcfa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153526
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29269}
2019-09-23 14:43:50 +00:00
Per Åhgren
f6aa572e36 First step for introducing multichannel support for the AEC3 capture
This CL introduces the handling of multiple microphone channels in
the EchoRemover layer.
The implementation is done such as to support an arbitrary number of
channels in a way that balances stack and heap-space usage.

Bug: webrtc:10913
Change-Id: I475369de6c463b8fe2d7e53799d7322eefb6938f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151647
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29140}
2019-09-10 16:44:18 +00:00
Sam Zackrisson
a81c09d5b6 Make VectorBuffer in AEC3 multi-channel
All dependent modules are hardcoded to do their regular mono processing on the first channel.

This _almost_ makes RenderBuffer multi-channel: FftData is still only mono.

Bug: webrtc:10913
Change-Id: Id5cc34dbabfe59e1cc72a9675dc7979794e870ed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151139
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29074}
2019-09-05 09:03:47 +00:00
Per Åhgren
a33dc0144a AEC3: Propagate the number of channels to the adaptive filters
This CL propagates the number of render and capture channels into
the echo subtractor and the adaptive filters.

Bug: webrtc:10913
Change-Id: I5ffff24ff64b7cc0f262bf008b34b6dfca1e78f9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151300
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29059}
2019-09-04 09:32:14 +00:00
Per Åhgren
ce202a0f98 Reland "Reland "Add core multi-channel pipeline in AEC3 This CL adds basic the basic pipeline to support multi-channel processing in AEC3.""
This is a reland of a66395e72f

Original change's description:
> Reland "Add core multi-channel pipeline in AEC3 This CL adds basic the basic pipeline to support multi-channel processing in AEC3."
> 
> This is a reland of f3a197e553
> 
> Original change's description:
> > Add core multi-channel pipeline in AEC3
> > This CL adds basic the basic pipeline to support multi-channel
> > processing in AEC3.
> > 
> > Apart from that, it removes the 8 kHz processing support in several
> > places of the AEC3 code.
> > 
> > Bug: webrtc:10913
> > Change-Id: If5b75fa325ed0071deea94a7546cb4a7adf22137
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150332
> > Commit-Queue: Per Åhgren <peah@webrtc.org>
> > Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#29017}
> 
> Bug: webrtc:10913
> Change-Id: Ifc4b13bd994cfd22dca8f8755fa5700617cc379d
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151124
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29034}

Bug: webrtc:10913
Change-Id: Id8da5666df8c86f290c73ad5dc9958199f1a7ebe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151127
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29042}
2019-09-03 06:12:32 +00:00
Per Åhgren
d112c75801 Revert "Reland "Add core multi-channel pipeline in AEC3 This CL adds basic the basic pipeline to support multi-channel processing in AEC3.""
This reverts commit a66395e72f.

Reason for revert: Breaking downstream tests

Original change's description:
> Reland "Add core multi-channel pipeline in AEC3 This CL adds basic the basic pipeline to support multi-channel processing in AEC3."
> 
> This is a reland of f3a197e553
> 
> Original change's description:
> > Add core multi-channel pipeline in AEC3
> > This CL adds basic the basic pipeline to support multi-channel
> > processing in AEC3.
> > 
> > Apart from that, it removes the 8 kHz processing support in several
> > places of the AEC3 code.
> > 
> > Bug: webrtc:10913
> > Change-Id: If5b75fa325ed0071deea94a7546cb4a7adf22137
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150332
> > Commit-Queue: Per Åhgren <peah@webrtc.org>
> > Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#29017}
> 
> Bug: webrtc:10913
> Change-Id: Ifc4b13bd994cfd22dca8f8755fa5700617cc379d
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151124
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29034}

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

Change-Id: I0e9fd154da5910d73b7a4c82e4e588f3220fd39d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10913
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151126
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29038}
2019-09-02 13:57:07 +00:00
Per Åhgren
a66395e72f Reland "Add core multi-channel pipeline in AEC3 This CL adds basic the basic pipeline to support multi-channel processing in AEC3."
This is a reland of f3a197e553

Original change's description:
> Add core multi-channel pipeline in AEC3
> This CL adds basic the basic pipeline to support multi-channel
> processing in AEC3.
> 
> Apart from that, it removes the 8 kHz processing support in several
> places of the AEC3 code.
> 
> Bug: webrtc:10913
> Change-Id: If5b75fa325ed0071deea94a7546cb4a7adf22137
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150332
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29017}

Bug: webrtc:10913
Change-Id: Ifc4b13bd994cfd22dca8f8755fa5700617cc379d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151124
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29034}
2019-09-02 12:08:27 +00:00
Ilya Nikolaevskiy
e3e30ae5c5 Revert "Add core multi-channel pipeline in AEC3"
This reverts commit f3a197e553.

Reason for revert: Speculative revert, as this may'be broken some build bots

Original change's description:
> Add core multi-channel pipeline in AEC3
> This CL adds basic the basic pipeline to support multi-channel
> processing in AEC3.
> 
> Apart from that, it removes the 8 kHz processing support in several
> places of the AEC3 code.
> 
> Bug: webrtc:10913
> Change-Id: If5b75fa325ed0071deea94a7546cb4a7adf22137
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150332
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29017}

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

Change-Id: I877d2993b9ccf024bd1d57bca1513c3e24d0bed3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10913
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150940
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29022}
2019-08-30 10:19:29 +00:00
Per Åhgren
f3a197e553 Add core multi-channel pipeline in AEC3
This CL adds basic the basic pipeline to support multi-channel
processing in AEC3.

Apart from that, it removes the 8 kHz processing support in several
places of the AEC3 code.

Bug: webrtc:10913
Change-Id: If5b75fa325ed0071deea94a7546cb4a7adf22137
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150332
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29017}
2019-08-30 08:07:27 +00:00
Gustaf Ullberg
940c2b5005 AEC3: Reduce level of log messages
This change reduces the level of several non-critical log messages in
order to reduce log spamming.

Bug: webrtc:8671
Change-Id: I6faae7a2ae4eeafd18c2770208485a75ad946e20
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148528
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28809}
2019-08-08 14:08:05 +00:00
Jonas Olsson
a4d873786f Format almost everything.
This CL was generated by running

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

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

Bug: webrtc:9340
Change-Id: Ic83ddbc169bfacd21883e381b5181c3dd4fe8a63
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144051
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28505}
2019-07-08 13:45:15 +00:00
Gustaf Ullberg
2bab5ad3b1 AEC3: Avoid using filter output in suppression gain computation in non-linear mode
As non-linear mode uses a suppressed version of y (not e) as output, this change
uses Y2, rather than E2, as nearend spectrum when computing the suppression gains.
E2 is still used in linear mode.

This change also affects how the minimum suppression gains are calculated. The
minimum gain is now min_echo_power / weighted_residual_echo.

Bug: webrtc:10550
Change-Id: I2904c5a09dd64b06bf25eb5a37c18dab50297794
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133023
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27629}
2019-04-15 16:08:41 +00:00
Gustaf Ullberg
0046697841 AEC3: Remove unused parameter from GetGain
Bug: webrtc:8671
Change-Id: Id227d3d5ddfe3b2d08509215e082e3c759f8212b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132794
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27612}
2019-04-15 10:23:50 +00:00
Gustaf Ullberg
1107cab646 Remove the ability for EchoRemover to override the render vs capture alignment
This change removes the (unused) ability of EchoRemover overriding
the delay of the RenderDelayController. The change is tested for
bit-exactness.

Bug: webrtc:8671
Change-Id: I188ef740f1437de64ffe236d07a7dcd4128192c2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130518
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27414}
2019-04-02 14:04:38 +00:00
Mirko Bonadei
dbce09003d Qualify cmath functions.
Use std:: qualified std::log10, std::log, std::floor and std::sin.

Bug: None
Change-Id: Ia78463f1505fcc5941f4c5ef66fc9346d9523cd4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128080
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27141}
2019-03-15 07:31:59 +00:00
Gustaf Ullberg
68d6d44197 AEC3: Remove remaining kill-switches
This CL concludes the post-launch removal of kill-switches is AEC3.

Kill-switches removed:
WebRTC-Aec3AdaptErleOnLowRenderKillSwitch
WebRTC-Aec3AgcGainChangeResponseKillSwitch
WebRTC-Aec3BoundedNearendKillSwitch
WebRTC-Aec3EarlyShadowFilterJumpstartKillSwitch
WebRTC-Aec3EnableAdaptiveEchoReverbEstimation
WebRTC-Aec3EnforceSkewHysteresis1
WebRTC-Aec3EnforceSkewHysteresis2
WebRTC-Aec3FilterAnalyzerPreprocessorKillSwitch
WebRTC-Aec3MisadjustmentEstimatorKillSwitch
WebRTC-Aec3OverrideEchoPathGainKillSwitch
WebRTC-Aec3RapidAgcGainRecoveryKillSwitch
WebRTC-Aec3ResetErleAtGainChangesKillSwitch
WebRTC-Aec3ShadowFilterBoostedJumpstartKillSwitch
WebRTC-Aec3ShadowFilterJumpstartKillSwitch
WebRTC-Aec3SmoothSignalTransitionsKillSwitch
WebRTC-Aec3SmoothUpdatesTailFreqRespKillSwitch
WebRTC-Aec3SoftTransparentModeKillSwitch
WebRTC-Aec3StandardNonlinearReverbModelKillSwitch
WebRTC-Aec3StrictDivergenceCheckKillSwitch
WebRTC-Aec3UseOffsetBlocks
WebRTC-Aec3UseStationarityPropertiesKillSwitch
WebRTC-Aec3UtilizeShadowFilterOutputKillSwitch
WebRTC-Aec3ZeroExternalDelayHeadroomKillSwitch
WebRTC-Aec3FilterQualityStateKillSwitch
WebRTC-Aec3NewSaturationBehaviorKillSwitch
WebRTC-Aec3GainLimiterDeactivationKillSwitch
WebRTC-Aec3EnableErleUpdatesDuringReverbKillSwitch

The change has been tested for bit-exactness.

Bug: webrtc:8671
Change-Id: I42816b9d1c875cec0347034c6e2ed4ff5db6ec0f
Reviewed-on: https://webrtc-review.googlesource.com/c/119942
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26443}
2019-01-29 10:31:45 +00:00
Steve Anton
10542f21c8 (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries
Mechanically generated by running this command:

tools_webrtc/do-renames.sh update all-renames.txt && git cl format

Then manually updating:

tools_webrtc/sanitizers/tsan_suppressions_webrtc.cc

Bug: webrtc:10159
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I54824cd91dada8fc3ee3d098f971bc319d477833
Reviewed-on: https://webrtc-review.googlesource.com/c/115653
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26226}
2019-01-11 17:11:39 +00:00
Gustaf Ullberg
83b00f020e AEC3: Computation of comfort noise gains from suppression gains
This change corrects the computation of the comfort noise gains.

Previously the comfort noise gain of band k, CG_k, was computed
from suppression gain of band k, SG_k, as:
CG_k = 1 - SG_k

But since the two signals are uncorrelated (the comfort noise
is randomly generated), the correct gain to maintain power is:
CG_k = sqrt(1 - SG_k^2).

Bug: webrtc:9967,chromium:902262
Change-Id: I393495742163d5e658bca4ab2f7a5067ab15af01
Reviewed-on: https://webrtc-review.googlesource.com/c/109580
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25525}
2018-11-06 16:10:52 +00:00
Yves Gerey
988cc0870b [Cleanup] Add missing #include. Remove useless ones.
This CL is the result of running include-what-you-use tool on part
of the code base (audio target and dependencies) plus manual fixes.

bug: webrtc:8311
Change-Id: I277d281ce943c3ecc1bd45fd8d83055931743604
Reviewed-on: https://webrtc-review.googlesource.com/c/106280
Commit-Queue: Yves Gerey <yvesg@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25311}
2018-10-23 11:32:56 +00:00
Jesús de Vicente Peña
e9a7e90625 AEC3: ERLE: Allowing increases of the ERLE estimate for low render signals.
Specially for devices with high echo path gain, even low render signal can allow the linear filter of the AEC3 to converge. However, the conditions that were used for updating the ERLE avoided to update that estimation. In this commit, we allow adapting the ERLE estimator using even low render signal but the update of the ERLE is constraint in a way that decreases are not allowed.

Bug: webrtc:9776
Change-Id: Ic4331efcc47a0b05f394cdea9a88f336292de5a1
Reviewed-on: https://webrtc-review.googlesource.com/101641
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24859}
2018-09-27 10:41:10 +00:00
Jesús de Vicente Peña
0faf082f9a AEC3: Bounding the nearend spectrum used as input for the suppressor gain computation
Right after a volume decrease, the echo path estimate is overestimated and, as a side effect, the nearend signal is also overestimated. Due to that, the suppression gains are kept high avoiding the suppression of echoes. In this CL the neared power spectrum estimation is limited to a level given by the power spectrum or the microphone input signal. Additionally, the minimum gain that is computed inside the suppressor is also modified. Instead of using the nearend power spectrum that is now bounded, the power spectrum of the signal after the linear echo canceler is used.

Bug: webrtc:9762
Change-Id: Ia24cd2ce248f2c2ba124711b75acff3b8c5cfa9f
Reviewed-on: https://webrtc-review.googlesource.com/100720
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24796}
2018-09-24 11:15:52 +00:00
Gustaf Ullberg
ddb82a6b5f AEC3: Fix filter output transition when input and output is the same array
This CL fixes a bug in the filter output transition when the 'from' input
points to the same array as the output. It also includes a slight
improvement to the transition by starting one sample earlier than
previously.

Bug: webrtc:9741,chromium:882789
Change-Id: Ifd5f16c1ac88a74d93499e7f4b4c0e5cb3e4976f
Reviewed-on: https://webrtc-review.googlesource.com/99540
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24683}
2018-09-11 11:59:12 +00:00
Gustaf Ullberg
51ccdbeb0c AEC3: Bugfix in filter output transition
Bug: webrtc:9741,chromium:882789
Change-Id: Id83f31dfa2cfaf06f41673ac997becf1e399eeea
Reviewed-on: https://webrtc-review.googlesource.com/99502
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24677}
2018-09-11 10:30:08 +00:00
Per Åhgren
240215431e AEC3: Parametrize the shadow filter output usage
This CL introduces the ability to control the usage of the shadow filter
output in the echo canceller output.

Bug: webrtc:9694,chromium:879451
Change-Id: I01f90de60de1799b32892051c176bda5e1a8d33e
Reviewed-on: https://webrtc-review.googlesource.com/97020
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24506}
2018-08-31 06:51:16 +00:00
Jesús de Vicente Peña
02e9e44c0c AEC3: Adding a reset of the ERLE estimator after going out from the initial state.
Bug: webrtc:9685
Change-Id: Ifc6019811c3d90df91df07e68f1d04cb39cb3545
Reviewed-on: https://webrtc-review.googlesource.com/96661
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24484}
2018-08-29 12:53:21 +00:00
Per Åhgren
fde4aa9909 AEC3: Adaptive handling of echo path with strong high-frequency gain
This CL adds adaptive handling of platforms where the echo path has
a strong gain above 10 kHz. A configurable offset is adaptively applied
depending on the amount of echo and mode of the echo suppressor.

Bug: webrtc:9663
Change-Id: I27dde6dc23b04a76a3be8c49d7fc9e226b9137e6
Reviewed-on: https://webrtc-review.googlesource.com/95947
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24448}
2018-08-27 12:49:28 +00:00
Gustaf Ullberg
a73c3b0e07 AEC3: Removing the coherence computation
This CL removes the unused coherence computation from AEC3. This CL
only removes unused code, the output of AEC3 does not change.

Bug: webrtc:8671
Change-Id: Ie127c5ec64e29414f1e1570511d57a4d09fc9145
Reviewed-on: https://webrtc-review.googlesource.com/95650
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24403}
2018-08-23 13:05:54 +00:00
Per Åhgren
2275439c4e AEC3: Further utilize the shadow filter to boost adaptation
This CL makes the jump-starting of the shadow filter more extreme.
It furthermore utilizes this to allow the AEC to rely further, and
more quickly on its linear filter estimates.

The result is mainly increased transparency but also some
cases of fewer echo blips.


Bug: webrtc:9612,chromium:873074
Change-Id: I90f7cfbff9acb9d0c36409593afbf476e7a830d3
Reviewed-on: https://webrtc-review.googlesource.com/93461
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24264}
2018-08-10 17:16:23 +00:00
Per Åhgren
78026754a7 AEC3: Utilize shadow filter output to respond to audio path changes
This CL adds functionality to use the shadow filter output instead
of the main filter output for cases when the former is better than
the latter. One case when that happens is when there have been an
echo path change, either in the acoustic path, in the audio buffers
or due to some active audio processing effects being applied on
the device.

The CL causes less echo leaks, in particular on devices with
active render processing.

Bug: webrtc:9581,chromium:869821
Change-Id: Icb8df1b94141598da82dc188051ac59e43338938
Reviewed-on: https://webrtc-review.googlesource.com/91820
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24166}
2018-08-01 15:20:33 +00:00
Per Åhgren
88cf0501f3 AEC3: Adding explicit handling of microphone gain changes
This CL re-activates the explicit handling of microphone
gain changes in the AEC3 code. The implementation is done
beneath a kill-switch so that when that switch is active
the changes in this CL are bitexact.


Bug: webrtc:9526,chromium:863826
Change-Id: I58e93d8bc0bce7bec91e102de9891ad48ebc55d8
Reviewed-on: https://webrtc-review.googlesource.com/88620
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23986}
2018-07-16 16:02:07 +00:00
Per Åhgren
b20b93796f AEC3: Refactor the code for analyzing filter convergence
This CL refactors the code in AEC3 that analyzes how
well the adaptive filter performs. The purpose of this
is both to simplify code that is more complex than needed
and also to pave the wave for the upcoming CLs that
softens the echo suppression during doubletalk.

The main changes are that:
-The shadow adaptive filter is now never analyzed. This
turned out to never affect the output in the recordings
it was tested on.
-The convergence analysis was moved to the aec state
code.

The changes are bitexact on all testcases where they
have been tested on.

Bug: webrtc:8671
Change-Id: If76b669565325c8eb4d11d1178a7e20306da9a26
Reviewed-on: https://webrtc-review.googlesource.com/87430
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23958}
2018-07-12 23:13:08 +00:00
Jesús de Vicente Peña
496cedfe56 AEC3: Reverberation model: Changes on the decay estimation.
In this CL we have introduced changes on the estimation of the decay involved in the exponential modeling of the reverberation. Specifically, the instantaneous ERLE has been tracked and used for adapting faster in the regions when the linear filter is performing well. Furthermore, the adaptation is just perform during render activity.


Change-Id: I974fd60e4e1a40a879660efaa24457ed940f77b4
Bug: webrtc:9479
Reviewed-on: https://webrtc-review.googlesource.com/86680
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23836}
2018-07-04 10:04:32 +00:00
Yves Gerey
665174fdbb Reformat the WebRTC code base
Running clang-format with chromium's style guide.

The goal is n-fold:
 * providing consistency and readability (that's what code guidelines are for)
 * preventing noise with presubmit checks and git cl format
 * building on the previous point: making it easier to automatically fix format issues
 * you name it

Please consider using git-hyper-blame to ignore this commit.

Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
2018-06-19 14:00:39 +00:00