Commit bd12891
committed
google_rtc_audio_processing: Major rework
Lots of work on AEC, with an eye to getting it working on main, where
it had bitrotten, and pulling in various features (IPC3 pipeline state
management and DP scheduling) that had merged in other branches.
Dynamically configure stream formats (sample format/rate and channel
count) from the connected streams at prepare() time instead of relying
on build-time tuning.
Port the code to use the source/sink API, in as sophisticated a manner
as I can find. Copies unroll cleanly into just a few instructions per
sample, including integer/float conversions and de-/interleaving.
Support both 16 and 32 bit sample formats, with a fairly clever
inlining scheme to share as much code as possible between them. The
component will select "copy" function pointers at prepare() time.
This works by using the _float32 variant of the AEC API (which is
actually the core internal implementation) instead of the _int16 one
which involves a conversion.
The large buffers required by this component (input and output staging
and an internally-managed pool/heap block) are now static symbols
instead of dynamic memory from the heap. These are very large, taking
up about half of what is available to the linker on MTL. Relying on
heap allocation is just dangerous in this context.
This fully decouples AEC from the playback stream. It will run
without an active reference happily, feeding zeros to the processing,
and pick up in stride when the pipeline starts. This requires adding
a trigger handler for pipeline control in IPC3, which will propagate
certain triggers across pipeline boundaries when shutting down
playback streams, breaking active capture. Note that this feature is
unexercisable on IPC4, where the kernel automatically starts up
connected pipelines.
Fixes a few bugs and misfeatures also:
+ Chunk the copies by full buffer strides between AEC processing calls
instead of testing at each copied frame.
+ Copy the reference and mic streams in tandem, preventing them from
becoming out of sync if the devices weren't themselves synchronized.
+ Copy the AEC results to the output stream after the call to
ProcessCapture() instead of before. This was a hidden latency bug
in the original code, I think.
+ Cleans up the Kconfig to remove stale variables and guard all
the component-specific tunables under the top-level component
variable. Also uses a default instead of a select to couple to
CONFIG_STUBS, allowing AEC to be manually tuned.
Signed-off-by: Andy Ross <andyross@google.com>1 parent 1cc7a4c commit bd12891
4 files changed
Lines changed: 386 additions & 309 deletions
File tree
- src
- audio/google
- include/ipc4
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| 26 | + | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 36 | + | |
| 37 | + | |
46 | 38 | | |
47 | 39 | | |
48 | | - | |
49 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
50 | 45 | | |
51 | 46 | | |
52 | 47 | | |
| |||
74 | 69 | | |
75 | 70 | | |
76 | 71 | | |
77 | | - | |
| 72 | + | |
78 | 73 | | |
79 | 74 | | |
80 | 75 | | |
81 | 76 | | |
82 | 77 | | |
| 78 | + | |
| 79 | + | |
83 | 80 | | |
0 commit comments