Commit graph

11 commits

Author SHA1 Message Date
Alessio Bazzica
2076af4673 APM: InputVolumeController tests simplified
Bug: webrtc:7494
Change-Id: I8f622b950aed8f1d5c42fcb8eb0c37c86532b6fe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/285440
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38757}
2022-11-29 12:45:46 +00:00
Hanna Silen
27fed4513f InputVolumeController: Make speech_probability non-optional
Make the argument speech_probability non-optional in
InputVolumeController::Process() and
MonoInputVolumeController::Process().

Additional clean-up: Remove the flag enabled in the
config. Add unit tests for MonoInputVolumeController.

Bug: webrtc:7494
Change-Id: Ie28af77dc628bf71d09ce1ff033d39031f77a21e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283700
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38710}
2022-11-22 15:19:02 +00:00
Hanna Silen
bf28277774 InputVolumeController: Add configurable speech probability aggregation
Make speech probability threshold configurable by replacing
kSpeechProbabilitySilenceThreshold with speech_probability_threshold in
InputVolumeController::Config.

Make the processing more robust against outliers in speech probability
estimaton by computing an aggregate speech activity over a speech
segment. In MonoInputVolumeController::Process(), use the passed
non-empty speech probabilities to compute the speech activity over the
speech segment and only allow updates for segments with a high enough
ratio of speech frames. Pass RMS error and speech probability for every
frame in Process(): If rms_error_dbfs is empty, volume updates are not
allowed; if speech_probability is empty, the frame counts as a non-
speech frame.

Remove startup_min_volume from the config since it's no longer used
after https://webrtc-review.googlesource.com/c/src/+/282821.

Bug: webrtc:7494
Change-Id: I0ab81b03371496315348f552133aa9909bd36f26
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283523
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38685}
2022-11-18 19:37:05 +00:00
Hanna Silen
52b0ef7926 InputVolumeController: Make input volume update wait frames configurable
Replace kUpdateInputVolumeWaitFrames with
update_input_volume_wait_frames in InputVolumeController::Config.

Also, fix an off-by-one error in the frame count to give a better
readability for non-zero wait frames. Now
update_input_volume_wait_frames_ = 100 allows updates every 100 frames
instead of every 101 frames. Effectively, this makes
update_input_volume_wait_frames = 0 and 1 to behave similarly (i.e.,
they now both allow updates after every frame).

Bug: webrtc:7494
Change-Id: I597f7e88895a4dcd365dc6dee526acb9d971b2fc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/282863
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38648}
2022-11-16 13:48:54 +00:00
Alessio Bazzica
90c08d0b2e APM: mirror "unusued min startup volume param removed" CL in AGC2
See https://webrtc-review.googlesource.com/c/src/+/278787

Bug: webrtc:7494
Change-Id: Ie8ad8acc1d2e373d59d943282701e3483e980806
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/282821
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38588}
2022-11-09 11:40:50 +00:00
Hanna Silen
8a8de9be3b InputVolumeController: Replace speech level target and max digital gain
Replace the use of speech level target and digital gain maximum with speech level target range parameters.

Bug: webrtc:7494
Change-Id: I703756c5a3fbd330ed585e3f5b4ac3141d9ea6e2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280943
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38563}
2022-11-07 14:54:50 +00:00
Hanna Silen
dd34a482d9 InputVolumeController: Hardcode some digital gain parameters
In InputVolumeController/MonoInputVolumeController, set
min_digital_gain_db_ and disable_digital_adaptive_ to fixed values
ahead of replacing speech level target as well as digital gain
minimum and maximum with target range parameters.

In InputVolumeController, remove digital_adaptive_follows and
min_digital_gain_db from the config as they are no longer needed.

Bug: webrtc:7494
Change-Id: I1378b6e182224c41038c6d8c649e7a28961f73d4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280962
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38554}
2022-11-04 11:28:44 +00:00
Hanna Silen
49a6097e95 InputVolumeController: Modify unit tests ahead of RMS error changes
Modify unit tests ahead of changes that will replace the minimum
digital gain with a fixed value 0 and always enable digital gain
compensation.

Bug: webrtc:7494
Change-Id: I9df95667b831d5b68e70aaba22f631b398edf8e2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280960
Commit-Queue: Hanna Silen <silen@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38553}
2022-11-04 09:39:29 +00:00
Hanna Silen
87d391f748 InputVolumeController: Rename override constants/arguments/tests
Rename constants and arguments reflecting the old naming with RMS error
overriding the error calculated by the analog AGC. Rename the related
unit tests and helper functions.

Bug: webrtc:7494
Change-Id: I9a1d972e9ff7ab5cdd43ca3568379d511801adee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280481
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38552}
2022-11-04 08:43:20 +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
Hanna Silen
7587755d29 Copy AgcManagerDirect files to agc2 and rename the classes
Copy AgcManagerDirect files from agc to agc2. Rename the newly
created files and classes ahead of refactoring. Add a build
target.

This change is done to enable creating a class
InputVolumeController based on AgcManagerDirect. The added
temporary dependency on files in agc will be removed
in https://webrtc-review.googlesource.com/c/src/+/278625.

The exact copy of the files happened in the 1st patchset and it
has been verified as follows:

Checksum check:
```
$ git checkout main && git pull
# Go back to the tree state before [1] landed
$ git new-branch tmp
$ git reset --hard 2235776597
$ cd modules/audio_processing/agc/
$ md5 agc_manager_direct*
MD5 (agc_manager_direct.cc) = e661481a85f72596cae4599b62907f5b
MD5 (agc_manager_direct.h) = bf68280e2d0f689b4ebcd665b5db6052
MD5 (agc_manager_direct_unittest.cc) = 6bf0bf45ff5e940b1a3bb37154f09269
```

Patchset 1 (see [2])
```
$ cd modules/audio_processing/agc2/
$ md5 input_volume_controlle*
MD5 (input_volume_controller.cc) = e661481a85f72596cae4599b62907f5b
MD5 (input_volume_controller.h) = bf68280e2d0f689b4ebcd665b5db6052
MD5 (input_volume_controller_unittest.cc) = 6bf0bf45ff5e940b1a3bb37154f09269
```

[1] https://webrtc-review.googlesource.com/c/src/+/278781
[2] https://webrtc-review.googlesource.com/c/src/+/278624/1

Bug: webrtc:7494
Change-Id: I7804da899d18adf556b089c76a567ce27c299a62
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278624
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38512}
2022-10-31 15:58:11 +00:00