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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Add test for psy_hz_to_mel(), psy_mel_to_hz(), psy_get_mel_filterbank(),
and psy_apply_mel_filterbank_16/32(). All the test data in C header
files was created with script ref_auditory.m.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Code can now include <rtos/wait.h> and uses native Zephyr 64
cycle API instead of SOF version.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
No runtime semantic change. Use C library when RTOS uses
C library otherwise use own C library calls.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
No functional runtime change, but changes to rtos partitioning and the
layout of headers .
This patch creates RTOS specifc header paths and updates spinlock.h
and kernel.h to show the new usage. Other headers will incrementally follow.
It reuses the current zephyr topleve directory and creates a new
toplevel xtos directory for xtos specific files.
Due to the mixing of RTOS, driver and library headers at the top level include
directory it was necessary to create rtos specific header directories i.e.
src/include/rtos-xtos
src/include/rtos-zephyr
These RTOS include directories will eventually contain RTOS specific headers
whilst common logic and structures will be placed in non RTOS directories.
This will also mean
"#include <sof/spinlock.h>"
will become
"#include <rtos/spinlock.h>"
and will allow easier visualisation of where and why RTOS headers are being used.
This will help to eliminate cross usage of headers between RTOSes.
Subsequqnt patches will move more headers and rtos specific wrppaer
source files into rtos specific locations.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This patch adds cmocka test cases for window functions library.
The calculated windows are compared with RMS error criteria
to Matlab calculated windows in header files. The header files
are directly generated by script ref_window.m.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds tests for 16-bit FFT library version. The test SNR
is improved by using sine frequency that matches with length of FFT.
It allows to get highest SNR in transform without need for window
functions in test and attenuation in the signal.
The 32 bit FFT tests are updated to use the same signal generator.
With this criteria the minimum SNRs for 32 bit to pass could be
increased to 95 - 132 dB.
Also tests were added for 512 size FFT in addition to 256 and 1024.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>