-
Notifications
You must be signed in to change notification settings - Fork 349
audio: Add Crossover Filter component #3263
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
Conversation
singalsu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some commit merge need plus it seems that there's a build error with TGL platform.
|
Thanks for the review @singalsu, I agree we should squash fixes into their original commit. |
7ee7567 to
746adf1
Compare
|
Thanks for review, commits are updated. |
singalsu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me! What's the preferred order of merging, this PR or IIR library move PR first?
|
SOFCI TEST |
746adf1 to
4f9dbd5
Compare
|
@singalsu @cujomalainey I have updated this PR to have iir_df2t functions in src/math. The previous inline implementation by Seb is removed. |
lgirdwood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - mostly minor thing to change or check. Some of the loops could be potentially improved too.
src/include/ipc/topology.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SOF_COMP_PROCESS should be used here. @keyonjie does your UUID PRs ass this type ? @plbossart fyi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SOF_COMP_PROCESS doesn't seem to exist in tip-of-tree code. Maybe it is still un-merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add a new comp type enum, just keep this part intact should work to me. @johnylin76
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnylin76 can you delete this change. I think we are good to merge after this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lgirdwood , my only concern is that testbench doesn't seem to have uuid token parsing now, which I think should be ported from Linux topology driver.
(mentioned in https://thesofproject.github.io/latest/developer_guides/uuid/index.html#linux-topology-driver)
Then it will cause unsupported comp type error while running testbench for crossover. Shouldn't we port the uuid token parsing to testbench first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lgirdwood , my only concern is that testbench doesn't seem to have uuid token parsing now, which I think should be ported from Linux topology driver.
(mentioned in https://thesofproject.github.io/latest/developer_guides/uuid/index.html#linux-topology-driver)Then it will cause unsupported comp type error while running testbench for crossover. Shouldn't we port the uuid token parsing to testbench first?
@johnylin76 @cujomalainey if nobody is using testbench for crossover ATM, it's fine to remove the adding of SOF_COMP_CROSSOVER and leave the tplg_parser gap as TODO?
4f9dbd5 to
c3ea31a
Compare
lgirdwood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, LGTM - we just pend on the SOF_COMP_PROCESS. @keyonjie are you doing this update ?
tools/topology/m4/crossover.m4
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need this token if you add UUID for it, e.g. refer to detect.m4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After I removed this token, the error messages will appear while "./scripts/build-tools.sh -t"
ALSA lib data.c:700:(build_tuples) cannot find tuples CROSSOVER1.0_crossover_process_tuples_str
ALSA lib parser.c:285:(tplg_build) failed to check topology integrity
It sounds like process_tuples_str is still necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you remove the whole definition of "'N_CROSSOVER($1)`_crossover_process_tuples_str" here, you need to remove the reference to this in line 34 below also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that works.
And I guess it still need to define a tuple_uuid type with UUID in crossover.m4 file?
(according to https://github.com/thesofproject/sof/blob/master/tools/tplg_parser/tplg_parser.c#L1395)
Or we should just leave process->comp->type as NONE in tplg_load_process?
(according to https://github.com/thesofproject/sof/blob/master/tools/tplg_parser/tplg_parser.c#L1058)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah please neglect my last comment because the answer is already in detect.m4 (after I rebased my project)
However, according to https://thesofproject.github.io/latest/developer_guides/uuid/index.html
I think something is still missing (e.g. parse uuid token) on running testbench. I will investigate more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keyonjie I think the code of parsing uuid token should be ported to tools/tplg_parser from Linux topology driver
(mentioned in https://thesofproject.github.io/latest/developer_guides/uuid/index.html#linux-topology-driver)
if we need to run testbench for topologies with UUID token (and without process_type token).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have UUID so dont need the comp enum now. Good to go otherwise.
src/include/ipc/topology.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnylin76 can you delete this change. I think we are good to merge after this.
Moved iir_df2t() from src/audio/eq_iir to src/math as a common library for IIR and Crossover usage. Signed-off-by: Pin-chih Lin <johnylin@google.com>
|
Hi @lgirdwood , my only concern is that testbench doesn't seem to have uuid token parsing now, which I think should be ported from Linux topology driver. Then it will cause unsupported comp type error while running testbench for crossover. Shouldn't we port the uuid token parsing to testbench first? |
|
@johnylin76 good point - @keyonjie or @singalsu any update here for support in testbench ? |
|
Hi, any suggestion? |
Yes, we need add this support to testbench, I can try to add it this week. |
@singalsu @lgirdwood just looking into tplg_parser/topology.h and find that we actually already have significant gap with Linux deriver sof/topology.c, we need to fill up those gaps first. |
|
@keyonjie and others: I find it really bad we have 2 different parsers in linux driver and testbench. There should be some way of detaching the exactly same parsing from the driver to test bench. Now, having tried this way back, it is pretty difficult as the kernel C types don't match user space. But maybe some kind of semi automatic scripting could work? In essence: if we do for example fuzzing in testbench, it could tell something about the driver's functionality, or it might not tell anything... |
|
@bzhg FYI |
|
@juimonen I agree, this isn't ideal, it makes fuzzing harder too as we are likely patching irrelevant memory bugs. |
|
@juimonen exactly. @xiulipan @aiChaoSONG please be noticed that the tplg_parser used in our CI could be out-of-date and not aligned with the Linux driver one. This worth a topic to discuss about how we should proceed. |
|
@lgirdwood given the hefty work to get tplg_parser fixed can we land as is for the time being an leave a TODO to remove the enum once tplg_parser is fixed? |
Does this PR changes the topology from ABI level, for example, snd_soc_tplg_damp_widget structure ,etc? if not, then we are good. Add a new widget type will not influence the topology parser. |
8ddcd02 to
26d56a4
Compare
|
@juimonen @keyonjie @cujomalainey @johnylin76 I think there are actually 3 parsers.
tplg_parser already has UUID support APIs, but it does need those APIs glued to component matching code which is currently using comp_type only. It's not a big job, probably a day or two. @johnylin76 can you remove the new comp_type form this PR and I will merge. I will find someone to fix parser so we can use Cross Over in the pasrer before v1.6. |
This commit adds Crossover to the list of SOF components. A crossover filter can be used to split an input to different frequency bands. The number of outputs should be set statically in the topology. The user then uses the control bytes to route the frequency bands to different outputs. (similar to the demux component). This commit adds support for the following formats: - S16_LE - S24_LE - S32_LE Signed-off-by: Sebastiano Carlucci <scarlucci@google.com>
This commit adds the topology files for the crossover component. The control bytes are generated by the tools in tune/crossover. Signed-off-by: Sebastiano Carlucci <scarlucci@google.com>
This commit adds the tools to generate the control bytes for the crossover component. To generate the control bytes, run the example_crossover.m script. The parameters of the crossover components are: - number of outputs - sink assignments (routing crossover output to different pipelines) - frequency cutoffs To tweak the parameters modify the values in example_crossover.m and run it. Refer to sof/src/include/user/crossover.h for more information on how the crossover config is structured and how sink assignments are done. Signed-off-by: Sebastiano Carlucci <scarlucci@google.com>
Add Crossover component for tplg_parser. Signed-off-by: Pin-chih Lin <johnylin@google.com>
Crossover component is added as multi-output playback tests for testbench. Signed-off-by: Pin-chih Lin <johnylin@google.com>
26d56a4 to
bddf48e
Compare
|
Hi @lgirdwood , |
Done, thanks. |
|
Jenkins has BSW DUT HW failure. |
|
@sebcarlucci fyi |
Note: this PR contains the upstreamed commits from PR: #2802
This patch adds a Crossover Filter component to SOF. A crossover can be used to split an input signal into different frequency bands. It's a one input, multiple output component. The number of outputs supported are 2,3 and 4. Supports s16_le, s24_le and s32_le.
To maximize code reuse, the biquad processing function was separated from iir_df2t(). This allows to process the biquads more freely. The motivation behind this change was to reuse the coefficients of the LR4 biquads. An LR4 filter is the basic building block of a crossover, and it is made of two biquads in series with same coefficients. Therefore to save memory, we can store one copy of each set of coeffcients, and pass those to the biquad processing function.
The tool to generate the coefficients are found under tools/tune/crossover, and you just need to run:
octave example_crossover.mIf you want tweak the parameters (number of outputs, frequency cutoffs or sink assignments) just modify example_crossover.m.