Commit Graph

382 Commits

Author SHA1 Message Date
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
Rander Wang b97fd67ef0 cmocka: add eq_fir unit test
This test uses module interface for eq_fir.

The use of decoded 16 bit FIR blob coefficients decreases a lot
the mismatch between float reference FIR vs. SOF fixed point
implementation.

This patch adds the script tools/tune/eq/cmocka_data_eq_fir.m that
generates the files cmocka_fir_coef_2ch.h and cmocka_fir_ref.h.

The script debug_files_plot.m can be used to visualize the unit
test result and error for data that is generated if macro
DEBUG_FILES is defined.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Andrula Song <xiaoyuan.song@intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-10-27 21:12:37 +01:00
Guennadi Liakhovetski 10f6dd0d7b module-adapter: add a constant data pointer
module_config contains a .data pointer that is used both for initial
and run-time configuration. The initial configuration should be
const. We add a new .init_data pointer for it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-10-26 15:56:49 +01:00
Baofeng Tian 47c52ccfe4 Component: move comp_copy from header file to source file an
On sof zephyr ipc4 build, component performance profiling logs can't
be enabled due to current xcc compiler does not support inline
logging in header file, logs as below:

  log_level undeclared (first use in this function)
  log_current_const_data undeclared (first use in this function)

Move comp_copy to component.c can resolve this limitation.
However, this brings another cmocka issue for mixer unit test,
this patch also fixed cmocka mixer unit test issue.

BugLink: https://github.com/zephyrproject-rtos/zephyr/issues/43786
Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2022-10-18 13:42:53 +03:00
Adrian Warecki 784bce763c mtl: Added meteorlake platform to the build system
Added new mtl platform to xtensa-build-zephyr.py.
Added ace directories to cmake files.
Added ACE to kconfig.
Add Meteorlake platform to be built with Zephyr under
CONFIG_ACE_VERSION_1_5 flag.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Signed-off-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-21 15:15:26 +02:00
Ranjani Sridharan 21587cee71 test: Add test infrastructure for module adapter
Add the test infrastructure for setting up and freeing a module and use
it in the volume unit test.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-09-15 16:41:55 +01:00
Ranjani Sridharan 68866f2c1f test: volume: remove unused code
Volume component no longer does format conversion. Remove the unused
test code.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-09-15 16:41:55 +01:00
Seppo Ingalsuo d3b58acab9 Test: cmocka: Add shift parameter to Mel filterbank reference
This patch adds to reference Mel filterbank the parameter
shift that is used to compensate in logarithmic power spectrum
the previously applied bitshift for linear spectrum values. The
added parameter is needed to test compatibility with C
implementation of the filterbank.

The test vectors were re-generated to include effect of shift
parameter values 0 - 3. The previous test used only value 0.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-09-14 12:06:32 +01:00
Liam Girdwood e8733b4f4c header: rtos: use rtos specific version of clk.h
Code can now include <rtos/clk.h>. API is not yet wrapped to Zephyr.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-12 11:44:27 +01:00
Liam Girdwood 4843516ab8 header: rtos: use rtos specific version of alloc.h
Code can now include <rtos/alloc.h> and uses thinly wrapped Zephyr
native for most uses. Wrapping can be removed over time.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-12 11:44:27 +01:00
Liam Girdwood e42f4a6e63 header: rtos: use rtos specific version of timer.h
Code can now include <rtos/timer.h> and uses native Zephyr timer API
for most uses. Some wrapping still exists which can be removed over
time.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-12 11:44:27 +01:00
Seppo Ingalsuo 957cebf64c Test: cmocka: Add test for DCT library
This patch adds 16 bit DCT matrix generation tests. The reference
DCT matrices are generated with Matlab or Octave with script ref_dct.m.
The test in dct.c compares SOF DCT lib generated matrix to reference
matrix and checks absolute and RMS error.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-09-09 13:57:22 +01:00