Commit graph

304 commits

Author SHA1 Message Date
Jesús de Vicente Peña
2f2633d90c AEC3: Audility: Avoid the initialization of the noise estimator in pure zeroes signals at the render.
Bug: webrtc:9193,chromium:836790
Change-Id: Ic162dd72947f1d075b55df6725a17b66c782930a
Reviewed-on: https://webrtc-review.googlesource.com/73200
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23075}
2018-05-02 10:19:46 +00:00
Alessio Bazzica
f22550175b AGC2 RNN VAD: Pitch Search
Functions to estimate pitch period and gain.

Bug: webrtc:9076
Change-Id: Icfe9430dcae11bdb96165c5bfe6e2b1d3bf848ab
Reviewed-on: https://webrtc-review.googlesource.com/70382
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23066}
2018-04-30 10:20:39 +00:00
Jesús de Vicente Peña
9558192711 AEC3: Removing the need of a buffer for the stationarity estimator of the render signal.
Change-Id: I6983e1d8bdd048a5d92209e3023c687f82d383d5

Bug: webrtc:9193,chromium:836790
Change-Id: I6983e1d8bdd048a5d92209e3023c687f82d383d5
Reviewed-on: https://webrtc-review.googlesource.com/72760
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23065}
2018-04-30 09:03:19 +00:00
Per Åhgren
658ad8816b Removed the updating of the padding data buffer in the AEC3 FFT
This CL removes the updating of the buffered data used to to pad the
64 sample blocks to 128 samples FFTs. As that padding was used
incorrectly in one place this resolves an important issue.


Bug: webrtc:9159,chromium:833801,webrtc:9206
Change-Id: Ie6830878ebec6130b61d4e7e3169357f2e253073
Reviewed-on: https://webrtc-review.googlesource.com/73240
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23059}
2018-04-27 19:26:03 +00:00
Per Åhgren
169c7fd521 Use windowed, data padded, FFTs when computing the AEC3 suppressor gain
This CL changes the way the suppressor gain is computed in AEC3 in that
the FFTs used are padded with data and windowed with a Hanning-style
window.
This gives better FFT accuracy, an behavior matching the suppressor
gain application, and also results in one less FFT operation.

Bug: webrtc:9204,chromium:837563
Change-Id: I612676c389cb76a3130966a9b596ff3f44d21863
Reviewed-on: https://webrtc-review.googlesource.com/73141
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23057}
2018-04-27 14:47:56 +00:00
Alex Loiko
95141d91d8 Set a positive initial gain in the Adaptive Digital GC.
If the adaptive gain is too low, we raise it slowly and only during
speech.

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

Bug: webrtc:7494
Change-Id: I683f1e3e463cddec2d91f6c7f15c73e744430034
Reviewed-on: https://webrtc-review.googlesource.com/71484
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23053}
2018-04-27 09:05:25 +00:00
Gustaf Ullberg
216af841ad Add debug data dumping to the AEC3 suppressor
Bug: webrtc:8671
Change-Id: Ia4f96fc247335bdf19620446559c21f16abd6682
Reviewed-on: https://webrtc-review.googlesource.com/72700
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23051}
2018-04-27 07:45:45 +00:00
Per Åhgren
280a31fc30 Revert "Making the delay estimator more robust to noisy nearends and low echoes"
This reverts commit b04e5cae08.

Reason for revert: The reason for the revert is that some scenarios were detected where this caused the delay estimation to occur too slowly.

Original change's description:
> Making the delay estimator more robust to noisy nearends and low echoes
> 
> This CL reduces the delay estimator step size to make it react better in
> scenarios where the environment is noisy, or the echo level is fairly
> low.
> 
> Bug: webrtc:9177,chromium:835281
> Change-Id: I482d898c91eddc497e1284ee500d26df21a0574a
> Reviewed-on: https://webrtc-review.googlesource.com/71486
> Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> Commit-Queue: Per Åhgren <peah@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22990}

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

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

Bug: webrtc:9177, chromium:835281
Change-Id: I33e09ebfed8ad8330419e554f482c956608befce
Reviewed-on: https://webrtc-review.googlesource.com/72843
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23042}
2018-04-26 16:32:07 +00:00
Gustaf Ullberg
0cb4a25e43 Apply upper gain limit after coherence gains in AEC3
This CL makes sure that the coherence-based gains are affected by the
upper gain limit during call start-up and after resets.

Bug: webrtc:9159,chromium:833801
Change-Id: I93fdd173b6e11ea861d0e01e12c048ec0a91db70
Reviewed-on: https://webrtc-review.googlesource.com/72841
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23039}
2018-04-26 15:43:27 +00:00
Jesús de Vicente Peña
dc872b6be1 AEC3: Audibility: improvements on the initial noise estimation
Bug: webrtc:9193,chromium:836790
Change-Id: I589082a18a4a5d1ba5abc170b6cf49d1f545b6cc
Reviewed-on: https://webrtc-review.googlesource.com/72480
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23027}
2018-04-25 16:19:43 +00:00
Jesús de Vicente Peña
d5cb477576 AEC3: Audibility improvements
This CL is created from a work initiated at https://webrtc-review.googlesource.com/c/src/+/61160

The purpose of this work is to improve the performance of the echo canceler (AEC3) when the farend signal contains stationary noises:
- An stationarity estimator of the farend signal has been added for detecting the portions of the farend signal that are pure noise.
- When the echo canceler deals with a portion of the signal that contains basically noise, the echo suppressor is able to back-off and avoid the fading of the nearend speech.

Change-Id: Id4b87fc59f4765bf1fca36d1cab39a49aabe104a
Bug: webrtc:9193,chromium:836790
Reviewed-on: https://webrtc-review.googlesource.com/64141
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23024}
2018-04-25 13:52:03 +00:00
Gustaf Ullberg
5bb98971ce Remove attenuation of narrow banded peaks
The code that attenuates narrow banded echo peaks in low frequencies
is removed as it affects transparency negatively.

Bug: webrtc:9192,chromium:836729
Change-Id: Ib90ce6a3db0a75e8d69bdca432e1f8f8bfbbd988
Reviewed-on: https://webrtc-review.googlesource.com/72380
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23022}
2018-04-25 11:51:23 +00:00
Per Åhgren
47d7fbd8fe Reuse the AEC2 coherence-based gain for the lower bands in AEC3.
This CL overrides the power-based suppressor gain decision with
a coherence based descision for the cases when that indicates a
higher suppressor gain.

Bug: webrtc:9159,chromium:833801
Change-Id: I0e7d82ac1b8c70ffe9d45907559bb14b1b849d71
Reviewed-on: https://webrtc-review.googlesource.com/71660
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22997}
2018-04-24 11:24:44 +00:00
Per Åhgren
882477f19d Corrected the counter for the filter constraint when the filter size changes
Bug: chromium:834875
Change-Id: I036fe34eef894a8911a4d561fe5b671a8f98b718
Reviewed-on: https://webrtc-review.googlesource.com/71820
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22992}
2018-04-24 09:02:34 +00:00
Per Åhgren
b04e5cae08 Making the delay estimator more robust to noisy nearends and low echoes
This CL reduces the delay estimator step size to make it react better in
scenarios where the environment is noisy, or the echo level is fairly
low.

Bug: webrtc:9177,chromium:835281
Change-Id: I482d898c91eddc497e1284ee500d26df21a0574a
Reviewed-on: https://webrtc-review.googlesource.com/71486
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22990}
2018-04-24 00:53:33 +00:00
Karl Wiberg
bb23c838f5 GN hack to tag targets as poisonous (and use it with audio codecs)
Only specially taggged targets may transitively depend on poisonous
targets. We first apply it to audio codecs.

This makes it much clearer exactly what parts of the code still have
dependencies on the audio codecs (and we want to eventually get rid of
pretty much all of them).

Bug: webrtc:8396, webrtc:9121
Change-Id: Iba5c2e806c702b5cfe881022674705f647896d43
Reviewed-on: https://webrtc-review.googlesource.com/69520
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22979}
2018-04-23 13:41:47 +00:00
Alessio Bazzica
33444dc835 APM pre-gain sub-module: code improvements.
- No need to have a unique ptr for the swap queue
- Remove default case from the switch in
  AudioProcessingImpl::HandleRuntimeSettings()

Bug: webrtc:9138
Change-Id: I346ba1db6510b5caa637510298b67ead07197b81
Reviewed-on: https://webrtc-review.googlesource.com/71164
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22958}
2018-04-20 12:53:53 +00:00
Alessio Bazzica
e63d38ba34 AGC2 RNN VAD: Linear Prediction Residual
Functions to estimate the inverse filter via LPC and compute the LP
residual applying the inverse filter.

This CL also includes test utilities, in particular BinaryFileReader,
used to read chunks of data and optionally cast them on the fly, and
Create*Reader() functions to read resource files available at test
time.

Bug: webrtc:9076
Change-Id: Ia4793b8ad6a63cb3089ed11ddad89d1aa0b840f6
Reviewed-on: https://webrtc-review.googlesource.com/70244
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22946}
2018-04-19 17:32:20 +00:00
Alessio Bazzica
b4c748de03 AGC2 RNN VAD: Symmetric matrix buffer
Adding a data structure to cache the results of pair-wise comparisons
between items stored in a ring buffer. This is used to avoid recomputing
the pair-wise comparison every time that a new item is added in a ring
buffer.

Bug: webrtc:9076
Change-Id: I88fb67a80bd3fd8497764dc7ae7e0a577c06b20f
Reviewed-on: https://webrtc-review.googlesource.com/70162
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22942}
2018-04-19 15:31:09 +00:00
Alessio Bazzica
adbd808e0a AGC2 RNN VAD: Ring buffer
Ring buffer template for a finite number of arrays of given type and size.

Bug: webrtc:9076
Change-Id: Ia6c2065b0013f4a00f693966641f9aebe09f6f5c
Reviewed-on: https://webrtc-review.googlesource.com/70161
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22939}
2018-04-19 13:36:58 +00:00
Fredrik Solenberg
104ad0b62b Remove stale dependencies from APM static lib target:
- protobuf library
- file_wrapper.h

These appear to have been left behind during the AecDump refactoring.
After this CL, APM no longer depends on zlib by default! :)

Bug: webrtc:9139
Change-Id: I12a8df2a17a575515b9c07165825f0879c4e15eb
Reviewed-on: https://webrtc-review.googlesource.com/70762
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22923}
2018-04-18 17:00:05 +00:00
Alessio Bazzica
4736d4e524 AGC2 RNN VAD: Sequence buffer
The SequenceBuffer class template implements a linear buffer with a Push
operation that is used to add a fixed size chunk of new samples into the
buffer. Its properties are its size and the size of the chunks that are
pushed. It is used to implement the pitch buffer in the RNN VAD feature
extractor, for which a ring buffer would be a painful choice.

Bug: webrtc:9076
Change-Id: I4767bf06d5a414dbed724a96ea4186ef013a1e30
Reviewed-on: https://webrtc-review.googlesource.com/70204
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22919}
2018-04-18 09:43:54 +00:00
Per Åhgren
d0fa820559 Allow AEC3 to use any externally reported audio buffer delay in AEC3
This CL adds support for using any externally reported audio buffer
delay to set the initial alignment in AEC3 which is used before the
AEC has been able to detect the delay.

Bug: chromium:834182,webrtc:9163
Change-Id: Ic71355f69b7c4d5815b78e49987043441e7908fb
Reviewed-on: https://webrtc-review.googlesource.com/70580
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22917}
2018-04-18 09:05:54 +00:00
Per Åhgren
b02644f2b8 AEC3 transparency improvements through refined echo audibility analysis
This CL increases the transparency in AEC3 during regions of low level
echo. What is done is:
-Low-level echoes are smoothly weighted so as to be deemed less
disturbing.
-The time-domain masking effect of the nearend speech is increased for
all frequencies.
-A separate, even more increased, time-domain masking effect is
introduced for lower frequencies.
-The intra-band masking is reduced to reduce the risk of echo leakage.
-The limiting of maximum gain due to filter-bank dynamics is removed
as the usecase for it could no longer be identified.

Bug: webrtc:9159,cromium:833801
Change-Id: I289b92919763124d6c5e5ede19e9a5917877c654
Reviewed-on: https://webrtc-review.googlesource.com/70421
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22915}
2018-04-18 08:08:44 +00:00
Alessio Bazzica
a44b91de3e Reland "Reland "AGC2 RNN VAD: initial build targets""
This reverts commit 772d43d4c0.

Reason for revert: fix issues and reland revert

Original change's description:
> Revert "Reland "AGC2 RNN VAD: initial build targets""
> 
> This reverts commit e0031500ba.
> 
> Reason for revert: reland automatically landed by mistake
> 
> Original change's description:
> > Reland "AGC2 RNN VAD: initial build targets"
> > 
> > This reverts commit a153c00bce.
> > 
> > Reason for revert: fix issues and reland revert
> > 
> > Original change's description:
> > > Revert "AGC2 RNN VAD: initial build targets"
> > > 
> > > This reverts commit 8628f5bb7c.
> > > 
> > > Reason for revert: iOS buildbot failing
> > > 
> > > Original change's description:
> > > > AGC2 RNN VAD: initial build targets
> > > > 
> > > > rnn_vad_tool is an executable that reads a wav file of any sample rate
> > > > compatible with 10 ms frames that are resampled and, when the VAD is
> > > > fully landed, will process the resampled frames to compute the VAD
> > > > probability.
> > > > 
> > > > To avoid mac, win and ios trybot failures, to_be_removed.h/.cc have
> > > > been added and will be removed as soon as the :lib target includes
> > > > code that leads to a non-empty static lib file on those platforms.
> > > > 
> > > > Bug: webrtc:9076
> > > > Change-Id: I810c08acfa1adf2029e3baac2adda3045ae5214a
> > > > Reviewed-on: https://webrtc-review.googlesource.com/70202
> > > > Reviewed-by: Alex Loiko <aleloi@webrtc.org>
> > > > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/master@{#22898}
> > > 
> > > TBR=alessiob@webrtc.org,aleloi@webrtc.org
> > > 
> > > Change-Id: Ic6014dde78b0ef371804c52608145ba8acdd9c97
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: webrtc:9076
> > > Reviewed-on: https://webrtc-review.googlesource.com/70144
> > > Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> > > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#22899}
> > 
> > TBR=alessiob@webrtc.org,aleloi@webrtc.org
> > 
> > Change-Id: I55e5a77274684b4cff3c950ca3514cc769d5dc26
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: webrtc:9076
> > Reviewed-on: https://webrtc-review.googlesource.com/70145
> > Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22901}
> 
> TBR=alessiob@webrtc.org,aleloi@webrtc.org
> 
> Change-Id: Ia6a837f79ac3f12aa4b0659938454141c69fee61
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:9076
> Reviewed-on: https://webrtc-review.googlesource.com/70520
> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22902}

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

Change-Id: If0884ab59d66ac3ba6460dbfe14a083f20493c10
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9076
Reviewed-on: https://webrtc-review.googlesource.com/70521
Reviewed-by: Minyue Li <minyue@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22904}
2018-04-17 14:34:14 +00:00
Alessio Bazzica
772d43d4c0 Revert "Reland "AGC2 RNN VAD: initial build targets""
This reverts commit e0031500ba.

Reason for revert: reland automatically landed by mistake

Original change's description:
> Reland "AGC2 RNN VAD: initial build targets"
> 
> This reverts commit a153c00bce.
> 
> Reason for revert: fix issues and reland revert
> 
> Original change's description:
> > Revert "AGC2 RNN VAD: initial build targets"
> > 
> > This reverts commit 8628f5bb7c.
> > 
> > Reason for revert: iOS buildbot failing
> > 
> > Original change's description:
> > > AGC2 RNN VAD: initial build targets
> > > 
> > > rnn_vad_tool is an executable that reads a wav file of any sample rate
> > > compatible with 10 ms frames that are resampled and, when the VAD is
> > > fully landed, will process the resampled frames to compute the VAD
> > > probability.
> > > 
> > > To avoid mac, win and ios trybot failures, to_be_removed.h/.cc have
> > > been added and will be removed as soon as the :lib target includes
> > > code that leads to a non-empty static lib file on those platforms.
> > > 
> > > Bug: webrtc:9076
> > > Change-Id: I810c08acfa1adf2029e3baac2adda3045ae5214a
> > > Reviewed-on: https://webrtc-review.googlesource.com/70202
> > > Reviewed-by: Alex Loiko <aleloi@webrtc.org>
> > > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#22898}
> > 
> > TBR=alessiob@webrtc.org,aleloi@webrtc.org
> > 
> > Change-Id: Ic6014dde78b0ef371804c52608145ba8acdd9c97
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: webrtc:9076
> > Reviewed-on: https://webrtc-review.googlesource.com/70144
> > Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22899}
> 
> TBR=alessiob@webrtc.org,aleloi@webrtc.org
> 
> Change-Id: I55e5a77274684b4cff3c950ca3514cc769d5dc26
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:9076
> Reviewed-on: https://webrtc-review.googlesource.com/70145
> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22901}

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

Change-Id: Ia6a837f79ac3f12aa4b0659938454141c69fee61
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9076
Reviewed-on: https://webrtc-review.googlesource.com/70520
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22902}
2018-04-17 13:17:49 +00:00
Alessio Bazzica
e0031500ba Reland "AGC2 RNN VAD: initial build targets"
This reverts commit a153c00bce.

Reason for revert: fix issues and reland revert

Original change's description:
> Revert "AGC2 RNN VAD: initial build targets"
> 
> This reverts commit 8628f5bb7c.
> 
> Reason for revert: iOS buildbot failing
> 
> Original change's description:
> > AGC2 RNN VAD: initial build targets
> > 
> > rnn_vad_tool is an executable that reads a wav file of any sample rate
> > compatible with 10 ms frames that are resampled and, when the VAD is
> > fully landed, will process the resampled frames to compute the VAD
> > probability.
> > 
> > To avoid mac, win and ios trybot failures, to_be_removed.h/.cc have
> > been added and will be removed as soon as the :lib target includes
> > code that leads to a non-empty static lib file on those platforms.
> > 
> > Bug: webrtc:9076
> > Change-Id: I810c08acfa1adf2029e3baac2adda3045ae5214a
> > Reviewed-on: https://webrtc-review.googlesource.com/70202
> > Reviewed-by: Alex Loiko <aleloi@webrtc.org>
> > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22898}
> 
> TBR=alessiob@webrtc.org,aleloi@webrtc.org
> 
> Change-Id: Ic6014dde78b0ef371804c52608145ba8acdd9c97
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:9076
> Reviewed-on: https://webrtc-review.googlesource.com/70144
> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22899}

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

Change-Id: I55e5a77274684b4cff3c950ca3514cc769d5dc26
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9076
Reviewed-on: https://webrtc-review.googlesource.com/70145
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22901}
2018-04-17 13:16:44 +00:00
Alessio Bazzica
a153c00bce Revert "AGC2 RNN VAD: initial build targets"
This reverts commit 8628f5bb7c.

Reason for revert: iOS buildbot failing

Original change's description:
> AGC2 RNN VAD: initial build targets
> 
> rnn_vad_tool is an executable that reads a wav file of any sample rate
> compatible with 10 ms frames that are resampled and, when the VAD is
> fully landed, will process the resampled frames to compute the VAD
> probability.
> 
> To avoid mac, win and ios trybot failures, to_be_removed.h/.cc have
> been added and will be removed as soon as the :lib target includes
> code that leads to a non-empty static lib file on those platforms.
> 
> Bug: webrtc:9076
> Change-Id: I810c08acfa1adf2029e3baac2adda3045ae5214a
> Reviewed-on: https://webrtc-review.googlesource.com/70202
> Reviewed-by: Alex Loiko <aleloi@webrtc.org>
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22898}

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

Change-Id: Ic6014dde78b0ef371804c52608145ba8acdd9c97
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:9076
Reviewed-on: https://webrtc-review.googlesource.com/70144
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22899}
2018-04-17 12:48:35 +00:00
Alessio Bazzica
8628f5bb7c AGC2 RNN VAD: initial build targets
rnn_vad_tool is an executable that reads a wav file of any sample rate
compatible with 10 ms frames that are resampled and, when the VAD is
fully landed, will process the resampled frames to compute the VAD
probability.

To avoid mac, win and ios trybot failures, to_be_removed.h/.cc have
been added and will be removed as soon as the :lib target includes
code that leads to a non-empty static lib file on those platforms.

Bug: webrtc:9076
Change-Id: I810c08acfa1adf2029e3baac2adda3045ae5214a
Reviewed-on: https://webrtc-review.googlesource.com/70202
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22898}
2018-04-17 12:22:23 +00:00
Raphael Kubo da Costa
7ce3091d8a IWYU: Include <string.h> for memcpy(3) after bbf21a3fd.
Commit bbf21a3fd6 ("Remove dependencies on
modules:module_api from AudioProcessing") causes the build to fail with
libstdc++ due to several files using memcpy(3) or memset(3) while relying on
string.h being included implicitly by other headers.

Bug: webrtc:9139
Change-Id: Ib73284962f8694d8bed0551968265bfd13cab967
Reviewed-on: https://webrtc-review.googlesource.com/70180
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Raphael Kubo da Costa (rakuco) <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/master@{#22895}
2018-04-17 11:48:13 +00:00
Ivo Creusen
b1facc1f71 The initialization of the echo detector should always signal that the input audio is mono.
Since we always pass in the first audio channel, we should always pass 1 as the number of channels in the initialization function.

Bug: webrtc:8732
Change-Id: I978edb125d7cc701a5e07193256327908be00560
Reviewed-on: https://webrtc-review.googlesource.com/69660
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22885}
2018-04-16 18:38:58 +00:00
Alex Loiko
b5c9a79e68 Activate the pre-amplifier in AudioProcessing.
It's a module for applying a gain to the capture signal.
The gain is the first processing step in APM.

After this CL, these two features work:
* The PreAmplifier can be activated with
  AudioProcessing::Config::pre_amplifier
* The PreApmlifier can be controlled after APM creation by
  AudioProcessing::SetRuntimeSetting.

What's left is a change to AecDumps and to AecDump-replay.

NOTRY=True # 1-line change, tests just passed.

Bug: webrtc:9138
Change-Id: I85b3af511695b0a9cec2eed6fee7f05080305e1d
Reviewed-on: https://webrtc-review.googlesource.com/69811
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22881}
2018-04-16 14:36:49 +00:00
Alex Loiko
5feb30e85f Options and settings for the Pre-amplifier.
Add configuration fields for the pre-amplifier in the Audio Processing
Module. Also add flags and settings for the pre-amplifier in
audioproc_f.

Also make the setting stored in Aec Dumps. And make the setting
applied when playing back Aec Dumps in audioproc_f.

Bug: webrtc:9138
Change-Id: I4e59df200e1ebc56f06fae74ebf17d85858958a3
Reviewed-on: https://webrtc-review.googlesource.com/69560
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22876}
2018-04-16 12:25:48 +00:00
Alessio Bazzica
c054e78f4e Send runtime settings to the Audio Processing Module (APM)
This CL includes the following changes:
- APM runtime setting (ID + float payload) and unit tests
- Swap queue of APM runtime settings used in AudioProcessingImpl
- runtime settings handler that forwards the settings to APM
  sub-modules when a message is retrieved from the queue
- Unit test placeholder to check that the pre-gain update message
  is correctly delivered

Bug: webrtc:9138
Change-Id: Id22704af15fde2b87a4431f5ce64ad1aeafc5280
Reviewed-on: https://webrtc-review.googlesource.com/69320
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22873}
2018-04-16 11:11:27 +00:00
Alex Loiko
8a3eaddc95 Pre-amplification in the audio processing module.
Added a new sub-module 'GainApplier'. The build target is
'modules/audio_processing/agc2:gain_applier'. A small refactoring
makes the GainApplier used in adaptive-digital AGC2.

The AGC2 now multiplies samples with a gain in 3 places. It's the
GainApplier, the GainCurveApplier, and the FixedGainController. The
GainApplier is used in AdaptiveDigitalGainApplier and will be used as
a pre-amplifier.

Bug: webrtc:9138
Change-Id: Ibc4c0ea109c6757f159d4adb6e3d8614179c9bc6
Reviewed-on: https://webrtc-review.googlesource.com/69321
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22849}
2018-04-13 10:19:58 +00:00
Fredrik Solenberg
bbf21a3fd6 Remove dependencies on modules:module_api from AudioProcessing.
- Directly include api/audio/audio_frame.h everywhere AudioFrame is used.
- This *will* remove transient dependencies on libjpeg and a bunch of other things from the e.g. APM.
- audio_frame.h still included from module_common_types.h for backwards compatibility with clients.

Bug: webrtc:9139, webrtc:7504
Change-Id: Id96f9268c01667fbcc29a01f5c1dd25a37836897
Reviewed-on: https://webrtc-review.googlesource.com/62464
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22845}
2018-04-12 22:05:27 +00:00
Per Åhgren
31122d6c5f Correct and soften the AEC3 handling of saturated mic signals
This CL changes the handling of saturated microphone signals in AEC3.

Some of the changes included are
-Make the detection of saturated echoes depend on the echo path gain
 estimate.
-Remove redundant code related to echo saturation.
-Correct the computation of residual echoes when the echo is saturated.
-Soften the echo removal during echo saturation.

Bug: webrtc:9119
Change-Id: I5cb11cd449de552ab670beeb24ed8112f8beb734
Reviewed-on: https://webrtc-review.googlesource.com/67220
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22809}
2018-04-10 15:28:45 +00:00
Danil Chapovalov
6e9d89588d Add missing includes checks.h/array_view.h
instead of relying on optional.h to included these 2 headers.

Bug: webrtc:9078
Change-Id: I7a4b3facd81690b8f107640487e129986c1f5ff6
Reviewed-on: https://webrtc-review.googlesource.com/68602
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22803}
2018-04-10 10:33:34 +00:00
Jonas Olsson
18f151a582 Remove stringstream usages from the APM
Bug: webrtc:8982
Change-Id: Icdbf7ec8d12a40efba9859f5fdf9953683e603c1
Reviewed-on: https://webrtc-review.googlesource.com/67060
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22771}
2018-04-06 14:17:03 +00:00
Fabrice de Gans-Riberi
09a6cd5541 Prepare for |is_posix| switch in the Fuchsia build
|is_posix| will be switched to false for Fuchsia, this is a preliminary change.

Bug: chromium:812974
Change-Id: I3bfda3e056ad1e5229834286ce5d095d9204a428
Reviewed-on: https://webrtc-review.googlesource.com/65782
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#22753}
2018-04-05 17:25:39 +00:00
Alex Loiko
cab48c391d Adaptive digital gain applier
AGC2 component that computes and applies the digital gain.
The gain is computed from an estimated speech and noise level.
This component decides how fast the gain can change and what it
should be.

Bug: webrtc:7494
Change-Id: If55b6e5c765f958e433730cd9e3b2b93c14a7910
Reviewed-on: https://webrtc-review.googlesource.com/64985
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22741}
2018-04-05 06:40:02 +00:00
Alex Loiko
4ed47d0190 Noise level estimation for AGC2.
We put back the old noise estimator from LevelController. We add a few
new unit tests. We also re-arrange the code so that it fits with how
it is used in AGC2. The differences are:

1. The NoiseLevelEstimator is now fully self-contained.
2. The NoiseLevelEstimator is responsible for calling SignalClassifier
   and computing the signal energy. Previously the signal type and
   energy were used in several places. It made sense to compute the
   values independently of the noise calculation.
3. Re-initialization doesn't have to be done by the caller.
4. The interface is AudioFrameView instead of AudioBuffer.

# Bots are green, nothing should break internal stuff
NOTRY=True

Bug: webrtc:7494
Change-Id: I442bdbbeb3796eb2518e96000aec9dc5a039ae6d
Reviewed-on: https://webrtc-review.googlesource.com/66380
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22738}
2018-04-04 18:23:55 +00:00
Alex Loiko
9917c4a780 Saturation Protector in AGC2.
Another submodule of the Automatic Gain Controller 2. It refines the
biased estimate of the Adaptive Mode Level Estimator. It works by
generating a delayed stream of peak levels. The delayed peaks are
compared to the level estimate.

Bug: webrtc:7494
Change-Id: If4c2c19088d1ca73fb93511dad4e1c8ccabcaf03
Reviewed-on: https://webrtc-review.googlesource.com/65461
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22732}
2018-04-04 13:07:30 +00:00
Per Åhgren
971bf03ee4 Corrected the threshold for determining filter convergence in AEC3
Bug: webrtc:9087,chromium:827101
Change-Id: Ic1da3bc2877a406b80affff68143766761e24c13
Reviewed-on: https://webrtc-review.googlesource.com/65501
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22675}
2018-03-29 11:31:57 +00:00
Alex Loiko
9d2788f745 Make possible to activate adaptive AGC2 in the APM.
We update the configuration settings for AGC2. We also update their
effects. Now, 'gain_controller2.enable=true' means 'first run Adaptive
AGC2; then run AGC2 limiter'.

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

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

Bug: webrtc:7494
Change-Id: I0d5dfe443f2cdc0ecf3aa4054442dab6276d284d
Reviewed-on: https://webrtc-review.googlesource.com/64990
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22669}
2018-03-29 09:42:07 +00:00
Per Åhgren
8131eb0667 Allow the headset mode to be entered after the call has started
This CL adds a timeout for the detection of the headset mode that
allows it to be entered also for the cases where a headset is
inserted during the call.

Bug: chromium:826720,webrtc:9083
Change-Id: Ic3cb4cc0258997a74eccd1bcdf65765e44016ad8
Reviewed-on: https://webrtc-review.googlesource.com/65240
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22658}
2018-03-28 17:28:46 +00:00
Per Åhgren
251c7355aa Add a specific AEC3 behavior for setups with known clock-drift
TBR=gustaf@webrtc.org

Change-Id: I9c726fc8e1b010255a1bee166c99fe6cb75d7658
Bug: chromium:826655,webrtc:9079
Reviewed-on: https://webrtc-review.googlesource.com/64982
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22657}
2018-03-28 16:51:57 +00:00
Alex Loiko
1e48e8095c Level estimation and saturation protection stub.
The level estimator (AdaptiveModeLevelEstimator) produces a biased
estimate of the speech level. In our model, we use another module
(the SaturationProtector) to compute the bias. This CL contains the
estimator and a stub of the saturation protector.

Bug: webrtc:7494
Change-Id: I0df736d0346063f544fa680b4cc84177ea548545
Reviewed-on: https://webrtc-review.googlesource.com/64820
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22641}
2018-03-28 08:41:45 +00:00
Alex Loiko
2bac896d5e Adaptive Digital gain control structure.
This CL defines the control flow of the adaptive AGC. It also defines
method and class stubs.

Contents:
1. Divide the 'agc2' build target into 'fixed_digital' and
'adaptive_digital'.
1. Update the dependencies of everything that depended on 'agc2'.
2. Define the sub-modules of the adaptive digital AGC 2. They are:
   1. Level Estimator - it gets the energy and a speech probability
      and updates a speech level estimate.
   2. Noise Estimator - it gets an immutable view of the speech frame
      and updates the noise level estimate
   3. Gain applier - it gets the speech frame, the current speech and
      noise estimates, and the speech probability. It finds a gain to
      apply and applies it.
   4. AdaptiveAgc - sets up and controls the sub-modules described
      above.

Bug: webrtc:7494
Change-Id: Ib7ccd8924e94eead0bc5f935b5d8a12e06e24fd1
Reviewed-on: https://webrtc-review.googlesource.com/64440
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22628}
2018-03-27 14:12:50 +00:00
Alex Loiko
250155d0db Fix histogram logging in InterpolatedGainCurve.
We had the following pattern:

if (case_A) metric = METRIC_A;
if (case_B) metric = METRIC_B;
RTC_HISTOGRAM_COUNTS_10000(metric, value);

That's wrong, because once the logging macro runs once, it will use
the same histogram no matter what the first argument is. The macro
expands into roughly

static Histogram* histogram_ptr = nullptr;
if (histogram_ptr == nullptr) {
  // Look up the histogram and put in histogram_ptr
}
// Add data through the histogram pointer.

We change the logging to use macros with string literals. We add a
macro for every of the 4 possible invocations. The macros will expand
to one static pointer each.

Bug: webrtc:8925
Change-Id: Ic7e4a6299eff31dd5988047edfcedce7d369e5ce
Reviewed-on: https://webrtc-review.googlesource.com/64724
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22606}
2018-03-26 14:17:00 +00:00