Commit graph

7 commits

Author SHA1 Message Date
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
253f8369bb AGC2 RNN VAD: safe SIMD optimizations scheme + AVX2 kill switch
In preparation for adding AVX2 code, a safe scheme to support
different SIMD optimizations is added.

Safety features:
- AVX2 kill switch to stop using it even if supported by the
  architecture
- struct indicating the available CPU features propagated from
  AGC2 to each component; in this way
  - better control over the unit tests
  - no need to propagate individual kill switches but just
    set to false features that are turned off

Note that (i) this CL does not change the performance of the RNN VAD
and (ii) no AVX2 optimization is added yet.

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

Reason for revert: Bug fix

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

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

# Not skipping CQ checks because this is a reland.

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

Reason for revert: bug in ComputePitchPeriod48kHz()

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

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

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10480
Change-Id: I2a91f4f29566f872a7dfa220b31c6c625ed075db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192660
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32581}
2020-11-10 20:31:28 +00:00
Alessio Bazzica
9da3e177fd RNN VAD: pitch search optimizations (part 1)
TL;DR this CL improves efficiency and includes several code
readability improvements mainly triggered by the comments to
patch set #10.

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

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

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

Results:

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

Bug: webrtc:10480
Change-Id: I9a3e9164b2442114b928de506c92a547c273882f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/191320
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32568}
2020-11-09 16:12:10 +00:00
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
Alessio Bazzica
beb1d34729 AGC2 RNN VAD: Feature extraction.
This CL finalizes the feature extraction part for the RNN VAD adding
a class that combines a high-pass filter, LP residual computation,
pitch estimation and spectral features extraction.

This CL also includes a minor refactoring of the pitch estimation
library.

Bug: webrtc:9076
Change-Id: I918b9e143bc6dd2bf508a891446067258a68a777
Reviewed-on: https://webrtc-review.googlesource.com/75504
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23235}
2018-05-15 10:02:20 +00:00