Skip to content

[FEATURE] Optimize audio processing components' source/sink buffer access, deprecate read/write frag #4967

@singalsu

Description

@singalsu

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.

Other

  • Components in samples, detect test, smart amp test, kwd nn test (low)
  • Testbench (low)
  • Cmocka (low)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestperformanceIssues related to code performance and speed optimizations.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions