Commit graph

231 commits

Author SHA1 Message Date
Alessio Bazzica
dfba28e30e AGC2 adaptive digital controller config clean-up
- Remove dry-run option
- Hard-code `adjacent_speech_frames_threshold` and
  `vad_reset_period_ms`
- Expose `initial_gain_db` via field trial

Tested: adaptive digital controller bit-exactness verified

Bug: webrtc:7494
Change-Id: I6166611f91320b6c37de3f8e553c06c2ed95b772
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/287222
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38862}
2022-12-09 13:07:34 +00:00
Alessio Bazzica
4366c5469f AGC2: move fixed digital controller before limiter
Currently the fixed digital gain is applied after the input volume
controller and before the adaptive digital one. This CL moves its
application after the adaptive digital controller and before the
limiter.

Reasons:
- This change is safe: no production config where both adaptive and
  fixed digital controllers are jointly used
- More predictable behavior: when the fixed digital controller is
  used after the adaptive digital controller it is easier to describe
  the overall behavior - i.e., the fixed digital combined with the
  limiter can be used for digital compression
- Allow to remove an unwanted temporal dependency: in a follow-up CL
  the input volume controller will use the latest speech level
  estimation instead of that from the previously analyzed frame; this
  CL makes that change easier.

Bug: webrtc:7494
Change-Id: I2e9869081e0eba1e4f30f11ea93a973ca7fea28c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/286340
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38813}
2022-12-05 16:21:33 +00:00
Alessio Bazzica
504bd59422 Expose APM pipeline parameter to select downmixing method
Bug: b/257289030
Change-Id: I03a666a15752d7a1125af2f8d3edae530493618c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/285473
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38789}
2022-12-01 15:30:13 +00:00
Sam Zackrisson
5dd548261f APM: Signal error on unsupported sample rates
This CL adds more explicit tests for unsupported sample rates in the WebRTC audio processing module (APM). Rates are restricted to the range [8000, 384000] Hz. Rates outside this range are handled as best as possible, depending on the format.

Tested: bitexact on a large number of aecdumps
Bug: chromium:1332484, chromium:1334991
Change-Id: I9639d03dc837e1fdff64d1f9d1fff0edc0fb299f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276920
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38663}
2022-11-17 12:12:04 +00:00
Hanna Silen
9f06ef1cc3 Implement InputVolumeController
Implement InputVolumeController and RecommendedInputVolumeEstimator based on the copy of agc classes AgcManagerDirect and MonoAgc.
Copies of the original files created in https://webrtc-review.googlesource.com/c/src/+/278624.

Bug: webrtc:7494
Change-Id: I74acee57b0db5cc8a6b666be9ba619c6c98a1773
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278625
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38533}
2022-11-02 11:31:59 +00:00
Alessio Bazzica
7afd698e0e APM AgcManagerDirect: unusued min startup volume param removed
Tested: Chromium built with this change; verified that the
behavior at the beginning of the call has not changed with
both low (< 12) and high (> 12) input volumes.

Bug: webrtc:7494
Change-Id: Ie184c994d46bf6fd1cb209873383b911beb766e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278787
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38420}
2022-10-17 16:51:38 +00:00
Alessio Bazzica
488f669724 APM: remove kClippedLevelMin from audio_processing.h
Bug: webrtc:7494
Change-Id: I91ed3b82592d9801b113ca72a2b2221b5abf20a3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278788
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38389}
2022-10-13 15:01:37 +00:00
Alessio Bazzica
fcf1af3049 APM: add AudioProcessingImpl::capture_::applied_input_volume(_changed)
The `recommended_stream_analog_level()` getter is used to retrieve
both the applied and the recommended input volume. This behavior is
error-prone since the caller must know what is returned based on
the point in the code (namely, before/after the AGC has changed
the last applied input volume into a recommended level).

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

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

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

Bug: webrtc:7494, b/241923537
Change-Id: I3cb4a731fd9f3dc19bf6ac679b7ed8c969ea283b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271544
Reviewed-by: Per Åhgren <peah@webrtc.org>
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38054}
2022-09-09 17:36:05 +00:00
Ali Tofigh
e2d829cf77 Remove unnecessary overload
Bug: webrtc:13579
Change-Id: Ib8e9f3fb085718a140b5a6199cb75e7da22e4fe5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271202
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37747}
2022-08-11 12:34:32 +00:00
Ali Tofigh
980ad0cd64 Remove unnecessary overloads of AudioProcessing::CreateAndAttachAecDump()
Bug: webrtc:13579
Change-Id: I2e121b5fd30de4ac1813483f00a51184ff861760
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269623
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37723}
2022-08-09 13:32:59 +00:00
Sam Zackrisson
3bd444ffdb Clarify and extend test support for certain sample rates in audio processing
Sample rates not divisible by 100, in particular 11025 Hz and 22050 Hz, have long been used with APM in Chrome, but the support has never been stated explicitly.

This CL makes minor modifications to the APM API to clarify how rates are handled when 10 ms is not an integer number of samples. Unit tests are also extended to cover this case better.

This does not update all references to 10 ms and implicit floor(sample_rate/100) computations, but it does at least take us closer to a correct API.

Note that not all code needs to support these sample rates. For example, audio processing submodules only need to operate on the native APM rates 16000, 32000, 48000.

Bug: chromium:1332484
Change-Id: I1dad15468f6ccb9c0d4d09c5819fe87f8388d5b8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268769
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37682}
2022-08-03 14:26:36 +00:00
Ali Tofigh
1fa87c44cb Adopt absl::string_view in AudioProcessing's interface
This is the first step of migrating
AudioProcessing::CreateAndAttachAecDump() from using std::string to
absl::string_view.

Bug: webrtc:13579
Change-Id: I8fc373e7ac55fd8e96bb0b01d1a30e28883ac9a2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269400
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37631}
2022-07-27 19:24:39 +00:00
Alessio Bazzica
866caeb62c AgcManagerDirect ctor API and doc string improved
Bug: chromium:1275566
Change-Id: Iedc8f5cbbf65fbf018da9df1aaa1f8ade1bbc063
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268840
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37569}
2022-07-20 09:39:24 +00:00
Sam Zackrisson
498078ce28 Remove deprecated webrtc::AudioProcessing::ResidualEchoDetector stats config
Replaced by injectable component, see discussion and PSA in attached bug.

Bug: webrtc:11539
Change-Id: I11ac4504e3d7e0d42b545ff92178674c709f586d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258680
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36612}
2022-04-22 08:37:19 +00:00
Alessio Bazzica
1db0a261ca Reland "Reland "Remove unused APM voice activity detection sub-module""
This reverts commit 09aaf6f7bc.

Reason for revert: downstream fixed (see https://chromium-review.googlesource.com/c/chromium/src/+/3461371)

Original change's description:
> Revert "Reland "Remove unused APM voice activity detection sub-module""
>
> This reverts commit 54d1344d98.
>
> Reason for revert: Breaks chromium roll, see 
> https://ci.chromium.org/ui/p/chromium/builders/try/linux_chromium_tsan_rel_ng/1080583/overview
>
> https://chromium-review.googlesource.com/c/chromium/src/+/3461512
>
> Original change's description:
> > Reland "Remove unused APM voice activity detection sub-module"
> >
> > This reverts commit a751f167c6.
> >
> > Reason for revert: dependency in a downstream project removed
> >
> > Original change's description:
> > > Revert "Remove unused APM voice activity detection sub-module"
> > >
> > > This reverts commit b4e06d032e.
> > >
> > > Reason for revert: breaking downstream projects
> > >
> > > Original change's description:
> > > > Remove unused APM voice activity detection sub-module
> > > >
> > > > API changes:
> > > > - webrtc::AudioProcessing::Config::VoiceDetection removed
> > > > - webrtc::AudioProcessingStats::voice_detected deprecated
> > > > - cricket::AudioOptions::typing_detection deprecated
> > > > - webrtc::StatsReport::StatsValueName::
> > > >   kStatsValueNameTypingNoiseState deprecated
> > > >
> > > > PSA: https://groups.google.com/g/discuss-webrtc/c/7X6uwmJarE0
> > > >
> > > > Bug: webrtc:11226,webrtc:11292
> > > > Change-Id: I8d008b56708cf62961b9857ec052b59fda3b41bf
> > > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250666
> > > > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > > > Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> > > > Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> > > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > > > Cr-Commit-Position: refs/heads/main@{#35975}
> > >
> > > TBR=gustaf@webrtc.org,saza@webrtc.org,alessiob@webrtc.org,terelius@webrtc.org,hta@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com
> > >
> > > Change-Id: Iee01fdb874b4e0331277f3ffe60dacaabc3859a2
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: webrtc:11226,webrtc:11292
> > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251600
> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > > Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> > > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> > > Cr-Commit-Position: refs/heads/main@{#35977}
> >
> > # Not skipping CQ checks because this is a reland.
> >
> > Bug: webrtc:11226,webrtc:11292
> > Change-Id: I2fcbc5fdade16bfe6a0f0a02841a33a598d4f2ad
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251660
> > Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#35984}
>
> TBR=mbonadei@webrtc.org,gustaf@webrtc.org,saza@webrtc.org,alessiob@webrtc.org,terelius@webrtc.org,hta@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com
>
> Change-Id: Ib308a3af2dcce85a0074ef5a4680ccec3f82712f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:11226,webrtc:11292
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251688
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Auto-Submit: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35990}

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

Bug: webrtc:11226,webrtc:11292
Change-Id: Idfda6a517027ad323caf44c526a88468e5b52b65
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251762
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36012}
2022-02-16 08:41:30 +00:00
Henrik Boström
09aaf6f7bc Revert "Reland "Remove unused APM voice activity detection sub-module""
This reverts commit 54d1344d98.

Reason for revert: Breaks chromium roll, see 
https://ci.chromium.org/ui/p/chromium/builders/try/linux_chromium_tsan_rel_ng/1080583/overview

https://chromium-review.googlesource.com/c/chromium/src/+/3461512

Original change's description:
> Reland "Remove unused APM voice activity detection sub-module"
>
> This reverts commit a751f167c6.
>
> Reason for revert: dependency in a downstream project removed
>
> Original change's description:
> > Revert "Remove unused APM voice activity detection sub-module"
> >
> > This reverts commit b4e06d032e.
> >
> > Reason for revert: breaking downstream projects
> >
> > Original change's description:
> > > Remove unused APM voice activity detection sub-module
> > >
> > > API changes:
> > > - webrtc::AudioProcessing::Config::VoiceDetection removed
> > > - webrtc::AudioProcessingStats::voice_detected deprecated
> > > - cricket::AudioOptions::typing_detection deprecated
> > > - webrtc::StatsReport::StatsValueName::
> > >   kStatsValueNameTypingNoiseState deprecated
> > >
> > > PSA: https://groups.google.com/g/discuss-webrtc/c/7X6uwmJarE0
> > >
> > > Bug: webrtc:11226,webrtc:11292
> > > Change-Id: I8d008b56708cf62961b9857ec052b59fda3b41bf
> > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250666
> > > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > > Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> > > Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> > > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > > Cr-Commit-Position: refs/heads/main@{#35975}
> >
> > TBR=gustaf@webrtc.org,saza@webrtc.org,alessiob@webrtc.org,terelius@webrtc.org,hta@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com
> >
> > Change-Id: Iee01fdb874b4e0331277f3ffe60dacaabc3859a2
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: webrtc:11226,webrtc:11292
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251600
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#35977}
>
> # Not skipping CQ checks because this is a reland.
>
> Bug: webrtc:11226,webrtc:11292
> Change-Id: I2fcbc5fdade16bfe6a0f0a02841a33a598d4f2ad
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251660
> Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35984}

TBR=mbonadei@webrtc.org,gustaf@webrtc.org,saza@webrtc.org,alessiob@webrtc.org,terelius@webrtc.org,hta@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Ib308a3af2dcce85a0074ef5a4680ccec3f82712f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:11226,webrtc:11292
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251688
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35990}
2022-02-14 12:25:51 +00:00
Alessio Bazzica
54d1344d98 Reland "Remove unused APM voice activity detection sub-module"
This reverts commit a751f167c6.

Reason for revert: dependency in a downstream project removed

Original change's description:
> Revert "Remove unused APM voice activity detection sub-module"
>
> This reverts commit b4e06d032e.
>
> Reason for revert: breaking downstream projects
>
> Original change's description:
> > Remove unused APM voice activity detection sub-module
> >
> > API changes:
> > - webrtc::AudioProcessing::Config::VoiceDetection removed
> > - webrtc::AudioProcessingStats::voice_detected deprecated
> > - cricket::AudioOptions::typing_detection deprecated
> > - webrtc::StatsReport::StatsValueName::
> >   kStatsValueNameTypingNoiseState deprecated
> >
> > PSA: https://groups.google.com/g/discuss-webrtc/c/7X6uwmJarE0
> >
> > Bug: webrtc:11226,webrtc:11292
> > Change-Id: I8d008b56708cf62961b9857ec052b59fda3b41bf
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250666
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> > Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> > Reviewed-by: Björn Terelius <terelius@webrtc.org>
> > Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#35975}
>
> TBR=gustaf@webrtc.org,saza@webrtc.org,alessiob@webrtc.org,terelius@webrtc.org,hta@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com
>
> Change-Id: Iee01fdb874b4e0331277f3ffe60dacaabc3859a2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:11226,webrtc:11292
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251600
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35977}

# Not skipping CQ checks because this is a reland.

Bug: webrtc:11226,webrtc:11292
Change-Id: I2fcbc5fdade16bfe6a0f0a02841a33a598d4f2ad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251660
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35984}
2022-02-13 14:02:08 +00:00
Alessio Bazzica
a751f167c6 Revert "Remove unused APM voice activity detection sub-module"
This reverts commit b4e06d032e.

Reason for revert: breaking downstream projects

Original change's description:
> Remove unused APM voice activity detection sub-module
>
> API changes:
> - webrtc::AudioProcessing::Config::VoiceDetection removed
> - webrtc::AudioProcessingStats::voice_detected deprecated
> - cricket::AudioOptions::typing_detection deprecated
> - webrtc::StatsReport::StatsValueName::
>   kStatsValueNameTypingNoiseState deprecated
>
> PSA: https://groups.google.com/g/discuss-webrtc/c/7X6uwmJarE0
>
> Bug: webrtc:11226,webrtc:11292
> Change-Id: I8d008b56708cf62961b9857ec052b59fda3b41bf
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250666
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Reviewed-by: Björn Terelius <terelius@webrtc.org>
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35975}

TBR=gustaf@webrtc.org,saza@webrtc.org,alessiob@webrtc.org,terelius@webrtc.org,hta@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Iee01fdb874b4e0331277f3ffe60dacaabc3859a2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:11226,webrtc:11292
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251600
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35977}
2022-02-11 12:15:44 +00:00
Alessio Bazzica
b4e06d032e Remove unused APM voice activity detection sub-module
API changes:
- webrtc::AudioProcessing::Config::VoiceDetection removed
- webrtc::AudioProcessingStats::voice_detected deprecated
- cricket::AudioOptions::typing_detection deprecated
- webrtc::StatsReport::StatsValueName::
  kStatsValueNameTypingNoiseState deprecated

PSA: https://groups.google.com/g/discuss-webrtc/c/7X6uwmJarE0

Bug: webrtc:11226,webrtc:11292
Change-Id: I8d008b56708cf62961b9857ec052b59fda3b41bf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250666
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35975}
2022-02-11 10:47:39 +00:00
Henrik Lundin
8a9aa55561 Remove AudioProcessing::ChannelLayout
This enum is no longer needed. Also moving the last piece of code from
common.h to audio_processing_impl.h, allowing to delete common.h.

Bug: chromium:1271981, b/217349489
Change-Id: If115336c36d6d7b5845a903e421c18aebfe434ee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251242
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35946}
2022-02-08 10:07:36 +00:00
Alessio Bazzica
c7d0e4265c AGC1: min mic level override always applied
When the minimum mic level is overridden via the field trial named
WebRTC-Audio-AgcMinMicLevelExperiment, AGC1 can still lower the gain
beyond the minimum value (namely, when clipping is observed).

This CL changes the behavior of the field trial. When specified, the
override always applies and therefore the mic level is guaranteed to
never become lower than what the field trial specifies.

Tested: RTC call in Chromium with and without --force-fieldtrials="
WebRTC-Audio-AgcMinMicLevelExperiment/Enabled-255"

Bug: chromium:1275566
Change-Id: I42ff45add54c11084f5ca6a2b95887c627c3c3aa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250141
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35914}
2022-02-04 18:01:31 +00:00
Henrik Lundin
64253a93dc Remove more traces of keyboard mic support from APM
The 6-parameter Initialize method is removed. The has_keyboard parameter
in the StreamConfig constructor is removed together with the underlying
member and helper functions.

Bug: chromium:1271981, b/217349489
Change-Id: I7259a114a395f74f735a9c06510c0fc0f0f008e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250221
Reviewed-by: Sam Zackrisson <saza@google.com>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Auto-Submit: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35908}
2022-02-04 14:27:51 +00:00
Artem Titov
6cae2d5513 Reland "Remove RTC_DISALLOW_COPY_AND_ASSIGN usages completely"
This reverts commit 3f87250a4f.

Reason for revert: Downstream is fixed

Original change's description:
> Revert "Remove RTC_DISALLOW_COPY_AND_ASSIGN usages completely"
>
> This reverts commit 5f0eb93d2a.
>
> Reason for revert: Breaks downstream project. I'm going to fix that one and create a reland of this CL after.
>
> Original change's description:
> > Remove RTC_DISALLOW_COPY_AND_ASSIGN usages completely
> >
> > Bug: webrtc:13555, webrtc:13082
> > Change-Id: Iff2cda6f516739419e97e975e03f77a98f74be03
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249260
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Reviewed-by: Artem Titov <titovartem@webrtc.org>
> > Commit-Queue: (Daniel.L) Byoungchan Lee <daniel.l@hpcnt.com>
> > Cr-Commit-Position: refs/heads/main@{#35805}
>
> TBR=hta@webrtc.org,titovartem@webrtc.org,daniel.l@hpcnt.com,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com
>
> Change-Id: I33d497f1132adfe6d151023195a388d9b7d548f9
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:13555, webrtc:13082
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249364
> Reviewed-by: Artem Titov <titovartem@webrtc.org>
> Owners-Override: Artem Titov <titovartem@webrtc.org>
> Reviewed-by: Andrey Logvin <landrey@webrtc.org>
> Reviewed-by: Björn Terelius <terelius@webrtc.org>
> Commit-Queue: Artem Titov <titovartem@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#35807}

# Not skipping CQ checks because this is a reland.

Bug: webrtc:13555, webrtc:13082
Change-Id: I7ef1ef3b6e3c41b1a96014aa75f003c0fcf33949
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249365
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35814}
2022-01-27 12:55:44 +00:00
Artem Titov
3f87250a4f Revert "Remove RTC_DISALLOW_COPY_AND_ASSIGN usages completely"
This reverts commit 5f0eb93d2a.

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

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

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

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

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

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

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

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

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

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

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

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

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

Bug: webrtc:5298
Fix: chromium:1261339
Change-Id: I6e583c11d4abb58444c440509a8495a7f5ebc589
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235664
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35246}
2021-10-20 10:52:17 +00:00
Alessio Bazzica
20a9ac655c APM: add AudioProcessingBuilder::SetConfig()
Bug: webrtc:5298
Change-Id: If3468ebb841c49dcd410a8bea2f9f8111ee8bc06
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/234842
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35199}
2021-10-14 10:45:16 +00:00
Alessio Bazzica
7b80d4480e AGC2: SIMD allowed config flags to field trials
Bug: webrtc:7494
Change-Id: I41fa05d2ef6d969750f3d4c1e40ecbcd30293b5a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/233741
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35144}
2021-10-05 12:01:38 +00:00
Alessio Bazzica
a850e6c8b6 AGC2 config: allow tuning of headroom, max gain and initial gain
This CL does *not* change the behavior of the AGC2 adaptive digital
controller - bitexactness verified with audioproc_f on a collection of
AEC dumps and Wav files (42 recordings in total).

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

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

Bug: webrtc:7494
Change-Id: I12e40c8efe2d2126d7597ec18a78cf9d5d39baf2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232903
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35096}
2021-09-27 11:14:35 +00:00
Alessio Bazzica
1b200b93d5 APM: remove webrtc::Config
Remove the deprecated way of configuring APM.

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

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

Bug: webrtc:7494
Change-Id: I88a6672d6f7cd03fcf6a3031883522d256880140
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230940
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34893}
2021-09-01 12:45:20 +00:00
Niels Möller
4f776ac7de Use make_ref_counted in AudioProcessingBuilder
Bug: webrtc:12701
Change-Id: I51ca5a54f812a1620ee2e6605c9ff67b92e2a5f8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/224547
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34725}
2021-08-11 15:40:28 +00:00
Artem Titov
cfea2182f8 Use backticks not vertical bars to denote variables in comments
Bug: webrtc:12338
Change-Id: I89c8b3a328d04203177522cbdfd9e606fd4bce4c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228246
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34696}
2021-08-10 10:40:03 +00:00
Artem Titov
0b489303d2 Use backticks not vertical bars to denote variables in comments for /modules/audio_processing
Bug: webrtc:12338
Change-Id: I85bff694dd2ead83c939c4d1945eff82e1296001
No-Presubmit: True
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227161
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34690}
2021-08-09 21:49:02 +00:00
Alessio Bazzica
42dacda82c AGC analog clipping predictor: integrate evaluator
Integrate ClippingPredictorEvaluator in AgcManagerDirect adding the
possibility to run the predictor without affecting the analog gain
adjustment process.

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

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

Bug: webrtc:12774
Change-Id: Iafaddae52addc00eb790ac165bf407a4bdd1cb52
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221540
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34279}
2021-06-14 12:21:31 +00:00
Hanna Silen
a43953a518 Add ClippingPredictor config in AudioProcessing config
Bug: webrtc:12774
Change-Id: Id8cdb6b5499a22cbca40d424cf936f81c1e7d8d7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221104
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34204}
2021-06-02 16:16:25 +00:00
Hanna Silen
b8dc7fa5a6 Make AgcManagerDirect clipping parameters configurable
Bug: webrtc:12774
Change-Id: I99824b5aabe6f921a5db425dd1c1c1d4c606186c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219681
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34069}
2021-05-20 16:53:59 +00:00
Alessio Bazzica
dfc11d55af Add RTC_EXPORT to APM config structs with overloaded operators
Bug: webrtc:7494
Change-Id: I9b627709d8c5bb47d73fd7981259a95e6b51e16c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217766
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33946}
2021-05-07 11:31:18 +00:00
Alessio Bazzica
a2efd15627 AGC2 config operator= and unit tests update
Bug: webrtc:7494
Change-Id: I7957602d60658b84175a617f9c283ea44eafe57d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/216260
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@google.com>
Cr-Commit-Position: refs/heads/master@{#33876}
2021-04-29 16:37:17 +00:00
Alessio Bazzica
d66a60597d AGC2 adaptive digital dry run mode
Add the option to run the adaptive digital controller of AGC2 without
side-effects - i.e., no gain applied.

Tested: adapation verified during a video call in chromium

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

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

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

Bug: webrtc:7494
Change-Id: Iae4cff9fc955a716878f830957e893cd5bc59446
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214133
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33733}
2021-04-14 15:56:41 +00:00
Alessio Bazzica
841d74ea80 AGC2 periodically reset VAD state
Bug: webrtc:7494
Change-Id: I880ef3991ade4e429ccde843571f069ede149c0e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213342
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33604}
2021-03-31 14:15:10 +00:00
Per Åhgren
db5d728878 Add refined handling of the internal scaling of the audio in APM
This CL adds functionality that allows adjusting the audio levels
internally in APM. The main purpose of the functionality is to allow
APM to optionally be moved to an integration that does not provide an
analog gain to control, and the implementation of this has been
tailored specifically to meet the requirements for that.

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


Bug: b/177830918
Change-Id: I0f312996e4088c9bd242a713a703eaaeb17f188a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/209707
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33466}
2021-03-15 19:12:02 +00:00