Commit Graph

393 Commits

Author SHA1 Message Date
Ranjani Sridharan 3540548b95 src: panic: Modify the signature of __panic()
Make the filename argument be a const char * to avoid the following
warning with c++ compliation:
warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-16 21:45:27 +02:00
Baofeng Tian e4445d781f test: cmocka: further remove unused META related definitions
Those definitions are not referred in cmocka anymore, remove it.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2024-01-23 19:43:02 +02:00
Seppo Ingalsuo 3a1cdedf01 Test: Cmocka: Add test case for lookup table sine function
The test function is based on test function for the cordic
sine function. The error tolerance is adjusted to just pass.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-01-11 15:33:52 +00:00
Baofeng Tian 214456d525 Trace: remove unused META definition
Remove unused META definition, below work is done:
1. removed META definition.
2. removed cmocka preproc module.
3. removed cmocka strcheck and debugability module.

With this change, cmocka does not have any dependency on
META programming.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2024-01-11 12:34:26 +00:00
Baofeng Tian 694053b79e Testbench: use macro replace immediate number
Direct numbers are hard to know what exactly means, it
actually represent log error level print, use macro to replace
it.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2024-01-04 13:48:16 +00:00
Baofeng Tian ded7ed83dc Audio: mixer: move mixer header file to module folder
This is a clean up, purpose is declutter headers, toml files,
Readme.md etc per module basis, since today everything is scattered
in current code base.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-12-13 14:24:01 +00:00
Baofeng Tian ae464443c8 Audio: mux: split mux code with ipc3 and ipc4
This is a clean up, purpose is de-cluster headers, toml files,
Readme.md etc per module basis, since today everything is
scattered in current code base.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-12-11 14:08:50 +02:00
Adrian Warecki f21670b3b2 module: sink: source: Move sink/source api headers to module
Moved header files to the module directory to separate an shared interface
used by sof and native loadable modules.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-11-24 16:17:46 +00:00
Baofeng Tian 5e40ac7c90 Audio: eq_fir: move out eq_fir ipc3 and ipc4 specific code
Move out ipc3 and ipc4 specific code to corresponding source file.
Also, move some common functions to header file.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-11-16 16:43:50 +02:00
Baofeng Tian df00e71416 audio: eq_fir: move eq fir header to its own directory
This is part of eq_fir code reorganize, move headers to
its own directory.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-11-16 16:43:50 +02:00
Jaroslaw Stelter df71b4e073 ipc: Add remote component search by pipeline idc
By default ipc_get_comp_by_ppl_id() routine omits component
from core different that the one where pipeline is working.
However with introduction of DP modules such situation can happen.
In some flows we need to find modules that belongs to given pipeline
but are scheduled on different core. This modifications will allow to
select when include such modules in the search.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-11-08 14:34:35 +02:00
Baofeng Tian 9e0f7eecec audio: eq_iir: create generic/ipc3/ipc4 source files for eq_iir
Create generic ipc3 ipc4 source files and move related code
into these source files.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-10-20 14:57:24 +01:00
Baofeng Tian 48616b2092 audio: module adapter: create ipc3 and ipc4 specific source file
create ipc3 and ipc4 specific source file, these files will
only be used to store specific code accordingly.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-10-10 14:56:20 +03:00
Liam Girdwood 5668576429 host: trace: decouple the testbench from host build
Host build should not depend on testbench symbols. Also add timestamp to
the trace log.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-09-14 16:19:15 +01:00
Marcin Szkudlinski 4a03699911 buf: remove coherent.h from struct comp_buffer
This commit removes coherent.h from struct comp_buffer

As sharing status of a buffer is known at creation time, it is
enough to create a buffer in shared (not cached mem alias)
when it will be used by several cores

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-09-11 11:10:14 +03:00
Rander Wang ea10065a58 ipc4: add S24_4LE_MSB format support
For sample format with 24 bits valid sample bit and 32 bits container,
valid sample is at msb 24bits if IPC4_TYPE_MSB_INTEGER is set.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2023-09-06 12:14:42 +03:00
Baofeng Tian 651791045a audio: volume: move volume header to volume folder
move them from include path to volume folder.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-08-31 20:29:48 +01:00
ShriramShastry 31453ceca3 Math: Library: Add the HiFi3, HiFi4, HiFi5 exponential function
This check in change eliminates the extra include isa.h header file
from the exp_fcn_hifi.c file, as it does in the exp_fcn.h file.

Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
2023-08-31 15:22:43 +01:00
ShriramShastry 7a7198dfd3 Math: Library: Add the hifi4 exponential function
This patch adds a single h-file include and other cosmetic
blanks/tabs changes.

Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
2023-08-31 15:22:43 +01:00
Baofeng Tian 7d9a3ca030 audio: volume: move volume out from module adapter
move volume from module adapter to src/audio directory, it is a
critical audio component.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-08-30 13:49:48 +01:00
Baofeng Tian 550968b169 audio: volume: create ipc3 and ipc4 specific file
create ipc3 and ipc4 specific files and used to cover specific
functions.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-08-30 13:49:48 +01:00
Marcin Szkudlinski d3884977cd Revert "ipc4: add S24_4LE_MSB format support"
This reverts commit 784630f80b.
2023-08-24 18:03:19 +03:00
Chao Song bc28b924d9 cmocka: fix cmocka build issue
Fix the cmocka build issue after adding functions
for explicitly get ipc device for component, buffer
and pipeline.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-08-23 11:22:42 +01:00
Rander Wang 784630f80b ipc4: add S24_4LE_MSB format support
For sample format with 24 bits valid sample bit and 32 bits container,
valid sample is at msb 24bits if IPC4_TYPE_MSB_INTEGER is set.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2023-08-22 17:51:56 +03:00
Adrian Warecki a0e2d961ed format: stream: Add support for unsigned 8 bit format
Defined a new frame type SOF_IPC_FRAME_U8 for 8-bit unsigned samples. Added
support for a new format to stream format conversion function and
get_sample_bytes function.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-07-24 16:53:20 +01:00
Adrian Warecki 722d86301a cmocka: volume: Add default case to handle unsupported formats
The switch supporting various sample formats was missing a default handler,
which caused compilation errors when enabling/adding a new format that is
not supported.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-07-24 16:53:20 +01:00
Adrian Warecki a60492e848 cmocka: selector: Add default case to handle unsupported formats
The switch supporting various sample formats was missing a default handler,
which caused compilation errors when enabling/adding a new format that is
not supported.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-07-24 16:53:20 +01:00
Andrula Song 7c85be8b3c Audio: Volume: Add passthrough functions
Add passthrough functions implementation. If the gain of all
channels equal 0dB, then we use passthrough functions to process
the volume component.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-06-22 10:33:16 +03:00
Andrula Song 607f086638 Audio: Volume: Split the hifi files into hifi3 and hifi4 version
Split the hifi version code into hifi3 and hifi4 version files.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-06-22 10:33:16 +03:00
Marcin Szkudlinski fa77edf9a4 pipeline2.0: change module prepare API to use sink/src.c
Module prepare is an operation that needs to set up sink
and source according to needs.
Therefore it must have access to sink/source handlers
This commit adds handlers to API. In case the module uses
legacy audio stream sink/source pointers will be NULLs
and number of sinks/sources will be zero

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-06-19 16:26:08 +02:00
Marcin Szkudlinski 002d4a3f66 Pipeline2.0: change module API to use various data
Target is to make all modules use sink/source API as
data source and destination.
However, current implementation of module adapter
allows 2 other completely different interfaces to be used:

"simple_copy"
  modules receive output_stream_buffer and
  input_stream_buffer table. void * data pointers
  from both structures point to audio_stream
  other fields in the structures are in fact not needed
  but are used

"! simple_copy"
  modules receive output_stream_buffer and
  input_stream_buffer table. void * data pointers
  from both structures point to raw linear data

to make transition smooth and easy, both
legacy ways have been kept, just to make the code
more clear - put at separate module API calls,

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-06-19 16:26:08 +02:00
Marcin Szkudlinski 05871a16de pipeline2.0: add source/sink api to audio_stream
Make audio_stream capable of using pipeline2.0
sink and source API
This change makes integration of sink/src api
possible in incremental way

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-06-19 16:26:08 +02:00
Marcin Szkudlinski 305f8a2088 pipeline2.0: introduce sink/source utilities
There are many operations on sink/source that may be put into a
common library. This is the place for it.

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-06-19 16:26:08 +02:00
Marcin Szkudlinski 7462552f12 pipeline2.0: introduce a sink API
this is a definition of API to sink of audio data

THE SINK is any component that can store data somehow
and provide a buffer to be filled with data at request.
The sink API does not define how the data will be processed/used

 The user - a module - sees this API as a destination
            it must send data to
 The IMPLEMENTATION - audio_stream, DP Queue -
            sees this as a producer that PROVIDES data for processing

Examples of components that should expose SINK api
 - /dev/null
     all the data stored in sink buffer are just simply discarded
 - I2S sender
     Data stored in sink buffer will be sent to the external world
 - a memory ring buffer
     data stored in the buffer will be sent to another module
     (usually using source API, but it does not matter in fact).

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-06-19 16:26:08 +02:00
Marcin Szkudlinski ff6ca2b78f pipeline2.0: introduce a source API
this is a definition of API to source of audio data

THE SOURCE is any component in the system that have data
stored somehow and can give the data outside at request.
The source API does not define who and how has produced
the data
  The user - a module - sees this as a producer that
             PROVIDES data for processing
  The IMPLEMENTATION - audio_stream, DP Queue - sees
             this API as a destination it must send data to

Examples of components that should expose source API:
  - DMIC. Data are coming from the outside world,
          stores in tmp buffer and can be presented
	  to the rest of the system using source_api
  - a memory ring buffer
	Data are coming from other module
        (usually using sink_api, but it does not matter in fact)

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-06-19 16:26:08 +02:00
Marcin Szkudlinski 589df2aea4 buffer: don't access stream internals
add more functions to audio_stream internals

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-06-19 16:26:08 +02:00
ShriramShastry c069197b63 Math: Library: Add the hifi4 exponential function
The 32-bit HiFi4 exponential library function has an accuracy of 1e-4,
a unit in last place error of 5.60032793, and output ranges from
0.0067379470 to 148.4131591026 for inputs from -5 to +5 (Q4.28) (Q9.23).

Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
2023-06-16 12:17:09 +03:00
Andrula Song 88990a62ef Audio_stream: Add default byte and frame alignment set in init function
Set byte_align as 1 and frame_align as 1 means no limit on both byte and
frame for this stream. Call audio_stream_init_alignment_constants in
audio_stream_init, set default align info while buffer created. And every
specific component can set its own byte and frame align info in its
prepare function later.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-04-24 10:09:32 +03:00
Seppo Ingalsuo 0ca1ddcf80 Test: Cmocka: Convert mux to module adapter
This patch converts the demux_copy, mux_copy, and
mux_get_processing_function tests to module adapter API.
The main change is in component new preparations with
UUID reference.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-03-09 13:33:26 +02:00
Przemyslaw Blaszkowski 4a8e8f9467 volume: add attenuation adjustment for peakmeter
Add peak-meter attenuation adjustment to PeakVol processing functions.

Note: attentuation supported only for 32 bit container audio formats.

Signed-off-by: Przemyslaw Blaszkowski <przemyslaw.blaszkowski@intel.com>
2023-03-06 14:49:09 +00:00
Laurentiu Mihalcea 0a5c049ac0 Switch to using rtos/task.h instead of sof/schedule/task.h
The purpose of this commit is to separate XTOS-specific code
from the Zephyr-specific code found in sof/schedule/task.h.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-02-24 14:28:49 +02:00
Laurentiu Mihalcea 2115a7bfea Switch to using rtos/sof.h instead of sof/sof.h
The purpose of this commit is to separate the XTOS-specifc
code from the Zephyr-specifc code found in sof/sof.h.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-02-22 13:15:06 +00:00
Andrula Song 6b91a55328 Audio: Fix the peak volume calculation error in volume component
Fix the peak volume calculation error in volume component, calculate
the maximum absolute value of input as peak volume as close source
firmware did.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-02-21 15:51:33 +00:00
ShriramShastry e6baebd54b Math: library: Add an exponential function
The 32-bit exponential library function has an accuracy
of 1e-4 and a unit in last place error of 4.5878 for
inputs from -5 to +5 (Q4.28) and outputs from 0.0067379470
to 148.4131591026 (Q9.23).

Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
2023-02-20 11:17:37 +00:00
Andrula Song 671f79819d Audio: Mixer: Use frame aligned API
Use frame aligned API to reduce the division calculation in mixer
process function.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-02-10 13:30:44 +02:00
Ranjani Sridharan b9c075a9ad eq_iir: Use the new module interface
Use the module interface instead of the comp drv interface for the
EQ IIR component.

In processing functions the dev structure is changed to the new mod
structure.

In filter initialize functions the mod structure provides the
configuration.

The eq_iir_init() function is converted to follow the module init
conventions.

The params() and cmd() functions are removed since they are done
in module adapter. The set/get config functions are added to handle
the binary blob set/get.

The copy() function is changed to module adapter eq_iir_process()
form. Data is processed from input_buffers[0] to output_buffers[0].

The eq_iir_prepare() is changed to set the frame and byte alignment
for module adapter. The sink streams size check is removed since
it is done in module adapter.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-02-02 21:37:46 +00:00
Andrula Song ee4629baf1 Audio: Math: Add HiFi3 version implementation of FFT
Add HiFi3 version implementation of FFT. Test with xtensa
simulator, we can save about 52.7% cycles for 16bit processing
and 58.1% for 32bit processing.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-01-11 14:28:00 +00:00
Guennadi Liakhovetski 12a553814b memcpy_s: fix the name of the last parameter
The last parameter of memcpy_s() isn't the size of the source buffer,
it's the actual number of bytes that should be copied.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-01-09 14:35:39 +00:00
Ranjani Sridharan 41a16145fc mixer: convert the mixer comp to use the module interface
Convert the mixer component and the mock tests to use the module
interface

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-12-15 20:44:20 +02:00
Andrula Song 87bd3d628b Math: IIR: add Direct-1 format implementation of IIR
Add C and hifi3 version Direct-1 implementation for IIR,
and rename the structure of sof_eq_iir_header_df2t to
sof_eq_iir_header for both two format sharing. Compared
with the original Direct-2 transport format,Direct-1 has
better performance on low frequency since lower quantization
noise while asking the same memory. The C version cost the
same cycles and hifi version can save about 9.8% cycles than
Direct-2 transport format.

Signed-off-by: Andrula Song <xiaoyuan.song@intel.com>
2022-10-28 12:33:56 +01:00