Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crossover refactor #8652

Merged
merged 4 commits into from
Jan 4, 2024
Merged

Conversation

btian1
Copy link
Contributor

@btian1 btian1 commented Dec 20, 2023

  1. move crossover and multiband DRC common part to math include path.
  2. split ipc3 and ipc4 specific code.

@@ -204,7 +206,7 @@ set(dcblock_sources dcblock/dcblock.c dcblock/dcblock_generic.c dcblock/dcblock_
set(crossover_sources crossover/crossover.c crossover/crossover_generic.c)
set(tdfb_sources tdfb/tdfb.c tdfb/tdfb_generic.c tdfb/tdfb_direction.c)
set(drc_sources drc/drc.c drc/drc_generic.c drc/drc_math_generic.c)
set(multiband_drc_sources multiband_drc/multiband_drc_generic.c crossover/crossover.c crossover/crossover_generic.c drc/drc.c drc/drc_generic.c drc/drc_math_generic.c multiband_drc/multiband_drc.c )
set(multiband_drc_sources multiband_drc/multiband_drc_generic.c crossover/crossover.c drc/drc.c drc/drc_generic.c drc/drc_math_generic.c multiband_drc/multiband_drc.c )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it fits scope of this PR but eventually the crossover/crossover.c content should move to maths library where it's enabled by kconfig if crossover or multiband-drc component is built. I think the current sources linking duplicates the crossover .text and consumes more RAM.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all of crossover.c (e.g. prepare and other component ops) would be in maths library but only the common filter related functions those are really shared.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to figure out yesterday, however, the common part is prepare / params, not actually the processing functions, not easy to move filter related to math, you can check crossover_common.h
all listed are required by multiband_drc.

Regarding linking, I searched sof assembly, take crossover.c:
static void crossover_s32_default(struct comp_data *cd,
struct input_stream_buffer *bsource,
struct output_stream_buffer **bsinks,
int32_t num_sinks,
uint32_t frames)

as example, it only have one time results.

also for crossover_common part, all are embeded as inline, no more duplicated code found in assembly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now move it to include/module, seems more reasonable compared with math, since most of common part does not related with math.

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one open with the ABI

src/include/sof/math/crossover_common.h Outdated Show resolved Hide resolved
src/include/kernel/abi.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not fan of math folder usage. dct.h and matrix.h fit nicely to math, but putting whole algorithms there. But @singalsu , I do note the iir/fir core headers are there already. so maybe this agreed upon and we should put all "reusable algorithm core" headers here. I won't block the way...

src/audio/crossover/crossover.c Outdated Show resolved Hide resolved
Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets delete the ABI change and use module include directory for exported public crossover APIs.

src/audio/crossover/crossover.c Outdated Show resolved Hide resolved
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor note w.r.t. the "user" header. Also, @johnylin76 @cujomalainey please check if this looks reasonable (starts to be ready to merge).

@@ -10,9 +10,7 @@

#include <stdint.h>
#include <user/eq.h>

/* Maximum Number of sinks allowed in config */
#define SOF_CROSSOVER_MAX_STREAMS 4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this is a bit problematic. The "user/crossover.h" header should not have dependency to implementation parts, it should be independent description of the parameter interface (like user/eq.h).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was referenced by multiband DRC user header file with:
/* Maximum number of frequency band for Multiband DRC */
#define SOF_MULTIBAND_DRC_MAX_BANDS SOF_CROSSOVER_MAX_STREAMS

…d DRC

Multiband DRC requires crossover functionality to cover crossover
specific process, previously, these information defined in crossover
specific directory, now, create a new shared header file for common
information shared both in crossover and multiband DRC.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
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>
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>
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>
@lgirdwood lgirdwood merged commit 28e0652 into thesofproject:main Jan 4, 2024
41 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants