-
Notifications
You must be signed in to change notification settings - Fork 349
Description
Is your feature request related to a problem? Please describe.
Yes, audio_stream_read_frag_sXX() and audio_stream_write_frag_sXX() cause high processing load due to their check for circular buffer wrap for every PCM sample. E.g. in stereo mixer case the overhead from those functions was 30 MCPS in CML cAVS platform.
Describe the solution you'd like
Access buffers in max. size blocks before buffers circular wrap, check wrap, and continue with next blob. The function audio_stream_bytes_without_wrap() has only a small overhead and typically is needed only a couple of times per copy() period.
Describe alternatives you've considered
Implement processing access to buffers with Xtensa circular buffers. This is an alternative that is already used in several components. However block processing could be still more efficient in algorithms with a straightforward buffer copy data traffic. It is due to only single HW circular buffer access at time. There's need to set the begin and end registers every time the buffer to access changes. There are also align requirements for data in HW circular buffers to take care about.
Additional context
Components those use read/write frag are here initially assumed some optimize priority. I assumed priority is high if topologies contain several instances of the component. Medium priority for single instance, low priority for test or demo components. All components in key phrase detection are high priority due low xtal oscillator use as DSP clock and low MCPS available.
- Crossover (medium)
- DC blocker (medium, fix in PR Audio: Dcblock: Optimize dcblock read/write frags #5871)
- DRC (medium, fix in PR Audio: DRC: Optimize source buffer read and sink buffer write #5489)
- EQ FIR (medium, fix in PR Audio: EQFIR: Optimize source and sink buffers use in generic C version #5339)
- EQ IIR (high, fix in PR Audio: Optimize IIR performance #4940)
- EQ IIR pass-through (medium, fix in PR Audio: EQIIR: Optimize pass-through mode read/write frags #5333)
- IGO NR (medium)
- KBP (high, fix in PR Audio: KPB: Optimize drain, buffer and copy functions #5049)
- Mixer (high, fix in PR Audio: Mixer: Optimize sources and sink buffers access #4944)
- Multi-band DRC (medium, fix in PR Audio: Multiband DRC: Optimize source and sink buffers access #5511)
- PCM converter generic (high, fix in PR Audio: pcm_converter: Optimize buffers access in generic version #5019)
- Selector (high, fix in PR Audio: Select: Optimize data copy operations #5053)
- Smart amp generic (medium)
- Smart amp Maxim DSM (medium)
- TDFB (medium, PR in Audio: TDFB: Optimize read/write frag operations #5351)
- Volume zero-crossings detect mode (medium, PR in Audio: Volume: Optimize read frag usage from zero crossing search #5328)
- Volume generic (low, fix in PR Audio: Volume: Replace read/write frag buffers in generic C version #5300)
- Google RTC audio processing (medium, fix in PR Audio: Google RTC Audio Proc: Process copy() without read/write frag #5579)
Other
- Components in samples, detect test, smart amp test, kwd nn test (low)
- Testbench (low)
- Cmocka (low)